#bio-container {
  width: min(100% - 40px, 980px);
  margin: 0 auto;
  padding: 88px 0 180px;
  display: grid;
  grid-template-columns: minmax(0, 430px) minmax(0, 420px);
  justify-content: space-between;
  gap: 72px;
  min-height: calc(100vh - 92px);
  line-height: 1.5;
}

html.bio-theme-light {
  background: #fff;
  color: #000;
}

html.bio-theme-dark {
  background: #111;
  color: #f2f0ea;
}

body[data-page="bio"] {
  font-size: 14px;
  background: #fff;
  color: #000;
  transition:
    background-color var(--transition-time) var(--transition-effect),
    color var(--transition-time) var(--transition-effect),
    opacity 0.3s ease;
}

html.bio-theme-dark body[data-page="bio"] {
  background: #111;
  color: #f2f0ea;
}

body[data-page="bio"].bio-theme-dark {
  background: #111;
  color: #f2f0ea;
}

body[data-page="bio"] #header {
  z-index: 100;
  top: auto;
  bottom: calc(52px + env(safe-area-inset-bottom, 0px));
  transform: none;
  padding-top: 12px;
  padding-bottom: 12px;
  background: inherit;
}

body[data-page="bio"] #header menu {
  color: inherit;
}

body[data-page="bio"] #contact-overlay {
  z-index: 90;
}

#bio-intro {
  display: flex;
  flex-direction: column;
  gap: 28px;
  position: sticky;
  top: 88px;
  height: fit-content;
}

#bio-main {
  display: flex;
  flex-direction: column;
  gap: 0;
}

#bio-intro h1 {
  font-size: 18px;
  line-height: 1.4;
  max-width: 38ch;
  text-wrap: pretty;
}

.bio-kicker {
  font-size: 11px;
  letter-spacing: .04em;
}

#bio-links {
  font-size: 12px;
}

#bio-summary,
#bio-currently,
.bio-small-copy {
  max-width: 40em;
}

#bio-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0 11px;
}

.bio-link-list {
  display: flex;
  flex-direction: column;
  margin-top: 18px;
  gap: 8px;
}

#bio-links a:not(:hover),
.bio-link-list a:not(:hover) {
  text-decoration: underline;
  text-decoration-thickness: .5px;
  text-underline-offset: 1px;
}

#bio-links span,
.bio-link-list span {
  opacity: .35;
}

#bio-theme-toggle {
  position: fixed;
  top: 24px;
  right: max(20px, calc((100vw - 980px) / 2));
  z-index: 101;
  display: grid;
  grid-template-columns: repeat(2, 32px);
  gap: 0;
  background: inherit;
  pointer-events: auto;
}

#bio-theme-toggle button {
  box-sizing: border-box;
  width: 32px;
  height: 32px;
  position: relative;
  display: grid;
  place-items: center;
  transition:
    opacity var(--transition-time) var(--transition-effect),
    outline-color var(--transition-time) var(--transition-effect);
}

#bio-theme-toggle button::before {
  content: "";
  width: 9px;
  height: 9px;
  border: 1px solid currentColor;
}

#bio-theme-toggle button[data-bio-theme-option="light"]::before {
  background: #fff;
}

#bio-theme-toggle button[data-bio-theme-option="dark"]::before {
  background: #111;
}

#bio-theme-toggle button[aria-pressed="true"]::before {
  outline: 1px solid currentColor;
  outline-offset: 3px;
}

#bio-theme-toggle button[aria-pressed="false"] {
  opacity: .45;
}

#bio-sound-trigger {
  position: fixed;
  top: 56px;
  right: max(12px, calc((100vw - 980px) / 2 - 8px));
  z-index: 101;
  font-size: 11px;
  line-height: 1;
  padding: 8px;
  min-height: 28px;
  box-sizing: border-box;
  pointer-events: auto;
  transition: opacity var(--transition-time) var(--transition-effect);
}

#bio-sound-trigger:hover,
body.bio-sound-open #bio-sound-trigger {
  opacity: .45;
}

#bio-sound-signal {
  position: fixed;
  top: 62px;
  right: max(66px, calc((100vw - 980px) / 2 + 46px));
  z-index: 101;
  width: 76px;
  height: 16px;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--transition-time) var(--transition-effect);
}

#bio-sound-signal svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.bio-signal-base,
.bio-signal-wave {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.bio-signal-base {
  opacity: .2;
  stroke-width: .8;
}

.bio-signal-wave {
  stroke-width: 1;
  transform-box: fill-box;
  transform-origin: 50% 50%;
}

.bio-signal-wave-a {
  stroke-dasharray: 8 4;
}

.bio-signal-wave-b {
  opacity: 0;
  stroke-dasharray: 3 7;
}

body.bio-sound-open #bio-sound-signal {
  opacity: .72;
}

body.bio-sound-open .bio-signal-wave-a {
  animation: bio-signal-primary 1.6s steps(7, end) infinite;
}

body.bio-sound-open .bio-signal-wave-b {
  animation: bio-signal-secondary 2.1s steps(6, end) infinite;
}

#bio-sound-signal::after {
  content: "";
  position: absolute;
  top: 2px;
  bottom: 2px;
  left: 0;
  width: 1px;
  background: currentColor;
  opacity: 0;
}

body.bio-sound-open #bio-sound-signal::after {
  animation: bio-signal-scan 2.8s linear infinite;
}

#bio-sound-audio {
  display: none;
}

@keyframes bio-signal-primary {
  0% {
    stroke-dashoffset: 0;
    transform: scaleY(.7) translateX(0);
  }
  25% {
    transform: scaleY(1.18) translateX(1px);
  }
  50% {
    stroke-dashoffset: -12;
    transform: scaleY(.86) translateX(-1px);
  }
  75% {
    transform: scaleY(1.32) translateX(0);
  }
  100% {
    stroke-dashoffset: -24;
    transform: scaleY(.7) translateX(0);
  }
}

@keyframes bio-signal-secondary {
  0% {
    opacity: 0;
    transform: scaleY(.9);
  }
  35% {
    opacity: .35;
    transform: scaleY(1.24);
  }
  65% {
    opacity: .12;
    transform: scaleY(.78);
  }
  100% {
    opacity: 0;
    transform: scaleY(.9);
  }
}

@keyframes bio-signal-scan {
  0% {
    opacity: 0;
    transform: translateX(0);
  }
  12% {
    opacity: .2;
  }
  82% {
    opacity: .2;
  }
  100% {
    opacity: 0;
    transform: translateX(76px);
  }
}

.bio-copy {
  font-size: 14px;
  max-width: 46em;
}

.bio-archive-image {
  width: min(74%, 440px);
  margin: 6px 0 36px auto;
  transform: rotate(2.2deg) translateX(4px);
  transform-origin: 50% 50%;
}

.bio-archive-image img {
  display: block;
  width: 100%;
  height: auto;
  box-shadow: 0 18px 44px rgba(0, 0, 0, .1);
}

html.bio-theme-dark .bio-archive-image img {
  box-shadow: 0 18px 44px rgba(0, 0, 0, .38);
}

.bio-copy p + p {
  margin-top: 18px;
}

.bio-topic summary {
  font-size: 12px;
  line-height: 1.4;
  letter-spacing: .025em;
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 20px;
  padding: 0 0 13px;
  cursor: pointer;
  list-style: none;
  text-transform: uppercase;
  user-select: none;
  color: inherit;
  transition: opacity var(--transition-time) var(--transition-effect);
}

.bio-topic summary::-webkit-details-marker {
  display: none;
}

.bio-topic summary:hover {
  opacity: .45;
}

.bio-topic + .bio-topic {
  margin-top: 8px;
}

.bio-topic[open] + .bio-topic {
  margin-top: 16px;
}

.bio-topic-content {
  padding: 2px 0 34px 62px;
  max-width: 52em;
}

.bio-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bio-list li {
  max-width: 52em;
}

.bio-index-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.bio-index-list li {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
}

#bio-footer {
  font-size: 10px;
  line-height: 1.4;
  position: fixed;
  left: max(20px, calc((100vw - 980px) / 2));
  right: max(20px, calc((100vw - 980px) / 2));
  bottom: 20px;
  z-index: 50;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  width: auto;
  padding: 0;
  grid-template-columns: none;
  pointer-events: none;
}

#bio-footer a {
  pointer-events: auto;
}

/* ------------------------------------------------------------ */

/*                           MOBILE                             */

/* ------------------------------------------------------------ */

@media only screen and (max-width: 1000px) {
  #bio-container {
    width: 100%;
    max-width: 100vw;
    margin: 0;
    padding: 84px 15px 180px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 44px;
    min-height: calc(100vh - 56px);
  }

  #bio-intro {
    position: static;
    gap: 24px;
    min-width: 0;
    max-width: 100%;
  }

  #bio-main {
    gap: 0;
    min-width: 0;
    max-width: 100%;
  }

  #bio-intro h1 {
    font-size: 16px;
    width: 100%;
    max-width: 38ch;
    overflow-wrap: break-word;
  }

  #bio-summary,
  #bio-currently,
  .bio-small-copy,
  .bio-copy {
    max-width: 100%;
    overflow-wrap: break-word;
  }

  .bio-kicker {
    font-size: 11px;
  }

  #bio-theme-toggle {
    top: 14px;
    right: 15px;
    grid-template-columns: repeat(2, 32px);
    gap: 0;
  }

  #bio-theme-toggle button {
    width: 32px;
    height: 32px;
  }

  #bio-sound-trigger {
    top: 46px;
    right: 7px;
    font-size: 10px;
  }

  #bio-sound-signal {
    top: 54px;
    right: 53px;
    width: 58px;
    height: 14px;
  }

  #bio-footer {
    left: 15px;
    right: 15px;
    bottom: 14px;
    font-size: 10px;
    align-items: flex-end;
    gap: 10px;
  }

  #bio-footer > * {
    min-width: 0;
  }

  #bio-footer div {
    flex: 1 1 auto;
    max-width: 58%;
  }

  #bio-footer a {
    flex: 0 1 42%;
    max-width: 42%;
    text-align: right;
    overflow-wrap: anywhere;
    word-break: break-word;
    white-space: normal;
  }

  .bio-copy {
    font-size: 14px;
  }

  .bio-archive-image {
    width: min(70%, 300px);
    margin: 4px 0 28px auto;
    transform: rotate(1.6deg) translateX(0);
  }

  .bio-topic summary {
    grid-template-columns: 28px 1fr;
    gap: 12px;
    padding: 0 0 11px;
  }

  .bio-topic-content {
    padding: 1px 0 28px 40px;
  }

  .bio-index-list li {
    grid-template-columns: 1fr;
    gap: 8px;
  }
}

/* Keep open folders clear of the fixed navigation and prevent grid overflow. */
#bio-intro,
#bio-main,
.bio-index-list li > * {
  min-width: 0;
  overflow-wrap: anywhere;
}

body[data-page="bio"] #main {
  background: inherit;
}

body[data-page="bio"] #header .nav-link {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
}

body[data-page="bio"] #header .nav-li {
  opacity: .55;
}

body[data-page="bio"] #header .nav-li:has(.nav-link:hover),
body[data-page="bio"] #header .nav-li:has(.nav-link:focus-visible) {
  opacity: 1;
}

body[data-page="bio"] :is(a, button, summary):focus-visible {
  outline: 1px solid currentColor;
  outline-offset: 4px;
}

.bio-topic summary {
  min-height: 36px;
}

#bio-footer {
  bottom: 0;
  padding: 14px 0 calc(14px + env(safe-area-inset-bottom, 0px));
  background: inherit;
  flex-direction: row;
}

body[data-page="bio"] #contact-overlay {
  visibility: hidden;
  overflow-y: auto;
  color: #000;
}

body[data-page="bio"].show-contact #contact-overlay {
  visibility: visible;
}

body[data-page="bio"] #contact-container {
  min-height: 0;
  padding: 100px max(20px, calc((100vw - 980px) / 2)) 200px;
}

@media (max-width: 1000px) {
  #bio-container {
    max-width: 680px;
    margin-inline: auto;
  }

  body[data-page="bio"] #header menu {
    gap: 8px 16px;
  }

  body[data-page="bio"] #header .nav-li.nav-li-home {
    width: 100%;
  }

  body[data-page="bio"] #contact-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
  }

  body[data-page="bio"] #contact-contacts {
    grid-column: auto;
    overflow-wrap: anywhere;
  }
}

@media (prefers-reduced-motion: reduce) {
  body[data-page="bio"] .bio-signal-wave,
  body[data-page="bio"] #bio-sound-signal::after {
    animation: none;
  }
}

/* An opaque toolbar keeps scrolling copy clear of the fixed controls. */
body[data-page="bio"]::before {
  content: "";
  position: fixed;
  inset: 0 0 auto;
  height: 84px;
  background: inherit;
  z-index: 100;
  pointer-events: none;
}

body[data-page="bio"] #header svg {
  fill: currentColor;
}

body[data-page="bio"]::after {
  content: "";
  position: fixed;
  inset: auto 0 0;
  height: calc(52px + env(safe-area-inset-bottom, 0px));
  background: inherit;
  z-index: 49;
  pointer-events: none;
}

body[data-page="bio"] :is(summary, a, button) {
  scroll-margin-top: 92px;
  scroll-margin-bottom: 180px;
}

/* Keep utility text subordinate without shrinking reading copy on mobile. */
body[data-page="bio"] #header {
  font-size: 12px;
}

@media (max-width: 1000px) {
  body[data-page="bio"] #header {
    font-size: 11px;
  }

  body[data-page="bio"] #header .nav-li.nav-li-moodboard,
  body[data-page="bio"] #header .nav-li.nav-li-contact {
    width: auto;
  }

  #bio-summary,
  .bio-topic-content {
    max-width: 60ch;
  }
}

/* Reset legacy swatch paint while keeping the larger touch targets. */
body[data-page="bio"] #bio-theme-toggle button {
  background: transparent;
  border: 0;
  outline: none;
}
body[data-page="bio"] #bio-theme-toggle button:focus-visible {
  outline: 1px solid currentColor;
  outline-offset: 2px;
}
