*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

@font-face {
  font-family: 'ABCDiatypeMono';
  src: url('assets/fonts/ABCDiatypeMonoCondensed-Regular.otf') format('opentype');
  font-weight: 400;
  font-style: normal;
}

@font-face {
  font-family: 'ABCDiatypeMono';
  src: url('assets/fonts/ABCDiatypeMonoCondensed-RegularItalic.otf') format('opentype');
  font-weight: 400;
  font-style: italic;
}

:root {
  font-size: 0.9rem;
  line-height: 1.4;
  --line-height: 1.4;
  --color-text: #1a1a1a;
  --color-bg: #f0f0f0;
  --left: 12rem;
  --top: 1.5rem;
}

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  background-color: var(--color-bg);
  font-family: 'Instrument Sans', sans-serif;
  color: var(--color-text);
  line-height: var(--line-height);
  transition: background-color 0.6s ease, color 0.6s ease;
}

body.dark {
  --color-bg: #2d2c2c;
  --color-text: #EFE1E8;
}

h1 {
  font-size: inherit;
  font-weight: inherit;
  margin: 0;
  padding: 0;
}

a {
  transition: color 0.6s ease;
}

button {
  font-size: inherit;
}

.layout {
  min-height: 100vh;
}

.col-left {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding-left: var(--left);
  overflow-y: auto;
  overflow-x: hidden;
}

.desktop-header {
  display: block;
  position: fixed;
  top: 0.6rem;
  left: calc(var(--left) - 5.5rem);
  height: 2.8rem;
  background-color: var(--color-bg);
  border-radius: 999px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 90;
  pointer-events: none;
  padding-left: 2rem;
  padding-right: 1.5rem;
}

.desktop-header.visible {
  opacity: 1;
}

.desktop-header .name-clone {
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.01em;
  opacity: 0;
  transition: opacity 0.3s ease;
  line-height: 3.1rem;
  margin-left: 3.5rem;
}

.desktop-header.name-visible .name-clone {
  opacity: 1;
}

/* ── Face ── */

.face {
  position: fixed;
  top: 1.3rem;
  left: calc(var(--left) - 4rem);
  cursor: pointer;
  z-index: 100;
}

.eye {
  display: inline-block;
  transition: transform 0.05s ease;
}

.eye.blinking {
  transform: scaleY(0.1);
}

.mouth {
  display: inline-block;
}

.face.sleeping .mouth {
  animation: breathe 3s ease-in-out infinite;
  transform: translateY(0.4em);
  font-size: 0.8em;
}

.face.sleeping .left-eye {
  margin-right: 0.1em;
}

.face.sleeping .right-eye {
  margin-left: 0.1em;
}

@keyframes breathe {
  0%, 100% { transform: translateY(0.55em) scale(1); }
  50% { transform: translateY(0.55em) scale(1.2); }
}

.face.surprised .left-eye {
  margin-right: 0.2em;
}

.face.surprised .right-eye {
  margin-left: 0.2em;
}

/* ── Name ── */

.name {
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.01em;
  padding-top: var(--top);
  opacity: 0;
  animation: fadeIn 0.6s ease forwards;
}

.name-jtf {
  display: none;
}

/* ── Bio ── */

.bio {
  margin-left: -6rem;
  margin-top: 2rem;
  width: calc(100vw - var(--left) - 3rem);
  max-width: 80vw;
  opacity: 0;
  animation: fadeIn 0.6s ease forwards;
  position: relative;
  overflow: hidden;
  transition: height 0.3s ease;
  flex-shrink: 0;
}

.bio-panel {
  font-family: 'ABCDiatypeMono', monospace;
  font-size: 2rem;
  line-height: var(--line-height);
  font-weight: 400;
  opacity: 0;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.bio-panel.active {
  opacity: 1;
  pointer-events: auto;
}

.bio-panel p + p {
  margin-top: 1em;
}

.bio-panel a {
  color: var(--color-text);
  text-decoration: none;
  position: relative;
}

.bio-panel a::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 100%;
  height: 1px;
  background-color: var(--color-text);
  transform-origin: right;
  transition: transform 0.2s linear, background-color 0.6s ease;
}

.bio-panel a:hover::after {
  transform: scaleX(0);
}

.bio-controls {
  margin-top: 0.75rem;
  margin-bottom: 1.4rem;
  position: relative;
  display: inline-block;
  opacity: 0;
  animation: fadeIn 0.6s ease forwards;
}

.bio-buttons {
  position: absolute;
  right: 100%;
  padding-right: 1rem;
  display: flex;
  gap: 1rem;
  align-items: baseline;
  top: 0.1em;
}

.bio-buttons.at-longest {
  top: 0.5em;
}

.bio-btn {
  background: none;
  border: none;
  padding: 0.5rem;
  margin: -0.5rem;
  cursor: pointer;
  color: var(--color-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}

.bio-btn:disabled {
  display: none;
}

#bio-plus {
  position: relative;
  top: 0.2em;
}

.bio-wordcount {
  font-family: 'Instrument Sans', sans-serif;
  font-size: 1rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.01em;
  color: var(--color-text);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  position: relative;
}

.bio-wordcount::before {
  content: attr(data-words);
}

.bio-wordcount:hover::before {
  content: 'copy bio';
}

.bio-wordcount[data-state='copied']::before,
.bio-wordcount[data-state='copied']:hover::before {
  content: 'copied!';
}

.bio-wordcount::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 100%;
  height: 1px;
  background-color: var(--color-text);
  transform-origin: right;
  transition: transform 0.2s linear, background-color 0.6s ease;
}

.bio-wordcount:hover::after {
  transform: scaleX(0);
}

.bio-wordcount[data-state='copied']::after {
  display: none;
}

.bio-spacer {
  display: none;
}

/* ── Navigation ── */

.sections-primary {
  flex-shrink: 0;
  margin-top: auto;
  margin-bottom: 1.4rem;
}

.sections-secondary {
  flex-shrink: 0;
  margin-top: auto;
  margin-bottom: 2rem;
}

.nav-item {
  display: block;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-family: inherit;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.01em;
  color: var(--color-text);
  opacity: 0;
  animation: fadeIn 0.6s ease forwards;
  line-height: var(--line-height);
  position: relative;
}

.nav-row {
  position: relative;
}

.nav-indicator {
  position: absolute;
  right: 100%;
  padding-right: 0.75rem;
  opacity: 0;
  transition: opacity 0.2s ease;
  display: inline-block;
  transform: scaleX(1.8) translateY(-0.1em);
}

.nav-item:hover .nav-indicator,
.nav-item.pinned .nav-indicator,
.nav-item.panel-hover .nav-indicator {
  opacity: 1;
}

/* ── Section panels ── */

.section-panel {
  position: absolute;
  left: 280px;
  width: calc(100vw - var(--left) - 280px - 3rem);
  top: 0;
  max-height: calc(100vh - 3rem);
  overflow-y: auto;
  scrollbar-width: none;
  padding-bottom: 5rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease;
}

.section-panel::-webkit-scrollbar {
  display: none;
}

.section-panel.visible {
  opacity: 1;
  visibility: visible;
  z-index: 10;
}

.section-panel p {
  display: flex;
  flex-direction: column;
}

.section-panel a {
  color: var(--color-text);
  text-decoration: none;
  position: relative;
}

.section-panel a::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 100%;
  height: 1px;
  background-color: var(--color-text);
  transform-origin: right;
  transition: transform 0.2s linear, background-color 0.6s ease;
}

.section-panel a:hover::after {
  transform: scaleX(0);
}

.section-panel .entry,
.section-panel .entry-full,
.section-panel .entry-portrait {
  opacity: 0;
  transition: opacity 0.4s ease;
}

.section-panel .entry.visible,
.section-panel .entry-full.visible,
.section-panel .entry-portrait.visible {
  opacity: 1;
}

.section-panel .entry.leaving,
.section-panel .entry-full.leaving,
.section-panel .entry-portrait.leaving {
  opacity: 0;
}

.section-overlay {
  display: none;
}

.entry {
  display: grid;
  grid-template-columns: 4.5rem 1fr;
  gap: 0;
}

.entry-year {
  font-family: 'ABCDiatypeMono', monospace;
}

.entry-full {
  display: block;
}

.entry-portrait {
  display: block;
  cursor: default;
}

.entry-trigger {
  cursor: pointer;
  position: relative;
}

.entry-trigger::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 100%;
  height: 1px;
  background-color: var(--color-text);
  transform-origin: right;
  transition: transform 0.2s linear, background-color 0.6s ease;
}

.entry-trigger:hover::after {
  transform: scaleX(0);
}

.entry-download {
  color: var(--color-text);
  text-decoration: none;
  position: relative;
}

.entry-download::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 100%;
  height: 1px;
  background-color: var(--color-text);
  transform-origin: right;
  transition: transform 0.2s linear, background-color 0.6s ease;
}

.entry-download:hover::after {
  transform: scaleX(0);
}

.entry-download-size {
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.entry-download:hover ~ .entry-download-size {
  opacity: 1;
}

.entry-caption {
  display: none;
}

/* ── Cursor portrait ── */

.cursor-portrait {
  position: fixed;
  width: 350px;
  height: auto;
  pointer-events: none;
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.cursor-portrait.visible {
  opacity: 1;
}

.cursor-caption {
  position: fixed;
  pointer-events: none;
  z-index: 1000;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.01em;
  color: var(--color-text);
  background-color: var(--color-bg);
  opacity: 0;
  transition: opacity 0.25s ease;
  max-width: 350px;
  padding-top: 0.4rem;
}

.cursor-caption.visible {
  opacity: 1;
}

.portrait-overlay {
  display: none;
}

/* ── Footer ── */

.footer {
  position: fixed;
  bottom: 1.5rem;
  left: calc(var(--left) - 1rem);
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.01em;
  font-size: 0.75rem;
  max-width: none;
  opacity: 0;
  animation: fadeIn 0.6s ease forwards;
  background-color: transparent;
  padding: 0.4rem 1rem;
  border-radius: 999px;
  box-shadow: none;
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
  z-index: 50;
}

.footer.pill-visible {
  background-color: var(--color-bg);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.footer a {
  color: var(--color-text);
  text-decoration: none;
  position: relative;
}

.footer a::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 100%;
  height: 1px;
  background-color: var(--color-text);
  transform-origin: right;
  transition: transform 0.2s linear, background-color 0.6s ease;
}

.footer a:hover::after {
  transform: scaleX(0);
}

.footer-spacer {
  flex-shrink: 1;
  flex-basis: 16rem;
}

/* ── Animations ── */

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.mobile-header {
  display: none;
}


/* ── Mobile ── */

@media (max-width: 768px) {

  html, body {
    overflow: hidden;
    height: 100%;
  }

  .name-jtf {
    display: block;
    position: fixed;
    top: 1.25rem;
    left: 3.5rem;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.01em;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 90;
    pointer-events: none;
  }

  .name-jtf.visible {
    opacity: 1;
  }

  .mobile-header {
    display: block;
    position: fixed;
    top: 0.6rem;
    left: 1rem;
    right: 1rem;
    height: 2.8rem;
    background-color: var(--color-bg);
    border-radius: 999px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 90;
    pointer-events: none;
  }

  .mobile-header.visible {
    opacity: 1;
  }

  .col-left {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    padding: 0 1.75rem;
    overflow-y: auto;
    overflow-x: hidden;
  }

  .desktop-header {
    display: none;
  }

  .name {
    padding-top: 1.25rem;
  }

  .name-clone {
    position: absolute;
    top: 50%;
    left: 2.5rem;
    transform: translateY(-50%);
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.01em;
    opacity: 0;
    transition: opacity 0.3s ease;
  }

  .mobile-header.name-visible .name-clone {
    opacity: 1;
  }

  .face {
    position: fixed;
    top: 1.25rem;
    left: auto;
    right: 3.5rem;
    z-index: 100;
  }

  .face.sleeping .left-eye {
    font-size: 0.9em;
    margin-right: 0.2em;
  }

  .face.sleeping .right-eye {
    font-size: 0.9em;
    margin-left: 0.2em;
  }

  .face.sleeping .mouth {
    font-size: 0.7em;
  }

  .bio {
    margin-left: -0.5rem;
    margin-top: 1.5rem;
    width: 100%;
    max-width: 100%;
  }
  .bio-panel {
    font-size: 1.2rem;
  }

  .bio-panel a {
    text-decoration: underline;
    text-underline-offset: 5px;
    text-decoration-thickness: 1px;
    text-decoration-color: var(--color-text);
  }

  .bio-controls {
    margin-left: 0;
    width: 100%;
    position: relative;
    margin-bottom: 2.8rem;
  }

  .bio-buttons {
    position: absolute;
    right: 1.75rem;
    top: 0.1em;
    left: auto;
    padding-right: 0;
    display: flex;
    gap: 1.25rem;
    align-items: baseline;
  }

  .bio-wordcount:hover::before {
    content: attr(data-words);
  }

  .bio-wordcount:hover::after {
    transform: none;
  }

  .sections-primary {
    display: block;
    margin-top: auto;
    margin-bottom: 1.4rem;
    pointer-events: none;
  }

  .sections-secondary {
    display: block;
    margin-top: 2rem;
    margin-bottom: 7.5rem;
    pointer-events: none;
  }

  .nav-item {
    cursor: default;
    pointer-events: none;
    line-height: 1.75;
  }

  .nav-indicator {
    display: none;
  }

  .section-panel {
    display: none;
  }

  .section-overlay {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: var(--color-bg);
    z-index: 80;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
    overflow: hidden;
  }

  .section-overlay.visible {
    opacity: 1;
    visibility: visible;
  }

  .section-overlay-content {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    flex: 1;
    padding: 1.75rem;
    padding-top: 5rem;
    padding-bottom: 5rem;
  }

  .section-overlay .entry-full {
    margin-bottom: 1.2rem;
  }

  .section-overlay-bar {
    position: fixed;
    bottom: 0.6rem;
    left: 1rem;
    right: 1rem;
    height: 2.8rem;
    background-color: var(--color-bg);
    border-radius: 999px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    z-index: 90;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-left: calc(1.75rem + 1.75rem - 1rem);
    padding-right: calc(3.5rem - 1rem);
  }

  .section-overlay-title {
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.01em;
    font-size: 1rem;
  }

  .section-overlay-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-text);
    font-family: inherit;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.01em;
    font-size: 1rem;
    padding: 0;
  }

  .section-overlay .entry {
    display: flex;
    flex-direction: column;
    margin-bottom: 1rem;
  }

  .section-overlay .entry-year {
    margin-top: 0.5rem;
    margin-bottom: 0.3rem;
    padding-left: 1.75rem;
    font-family: 'ABCDiatypeMono', monospace;
    font-size: 1.1rem;
    opacity: 0.95;
  }

  .section-overlay .entry:first-child .entry-year {
    margin-top: 0;
  }

  .section-overlay-content p {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin: 0;
  }

  .section-overlay-content a {
    color: var(--color-text);
    text-decoration: underline;
    text-underline-offset: 4px;
    text-decoration-thickness: 1px;
    text-decoration-color: var(--color-text);
  }

  .section-overlay-content a::after,
  .bio-panel a::after,
  .section-panel a::after,
  .footer a::after {
    display: none;
  }

  .portrait-overlay {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: var(--color-bg);
    z-index: 80;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
  }

  .portrait-overlay.visible {
    opacity: 1;
    visibility: visible;
  }

 .portrait-controls {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    padding-left: calc(1.75rem + 1.75rem);
    padding-right: 3.5rem;
    padding-bottom: 1.5rem;
    background-color: var(--color-bg);
  }

  .portrait-share,
  .portrait-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-text);
    font-family: inherit;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.01em;
    font-size: 1rem;
    padding: 0;
  }

  .portrait-images {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    flex: 1;
  }

  .portrait-item {
    margin-bottom: 2rem;
  }

  .portrait-item img {
    width: 100%;
    display: block;
  }

  .portrait-caption {
    padding: 0.75rem 1.75rem 0;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.01em;
    margin-left: -0.5rem;
  }

  .entry-download {
    display: none;
  }

  .footer {
    position: relative;
    bottom: auto;
    left: auto;
    width: 100%;
    padding-left: 0;
    padding-right: 0.5rem;
    padding-bottom: 2.75rem;
    padding-top: 1rem;
    margin-left: -0.5rem;
    max-width: 100%;
    font-size: 0.75rem;
    text-transform: none;
    background-color: transparent;
    border-radius: 0;
    box-shadow: none;
  }

  .footer a {
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-thickness: 0.5px;
  }

  .footer a::after {
    height: 0.5px;
  }

  .footer-spacer {
    display: none;
  }

  .footer.pill-visible {
    background-color: transparent;
    box-shadow: none;
  }

  .name,
  .bio-controls,
  .sections-primary,
  .sections-secondary {
    padding-left: 1.75rem;
  }
}