/* ==========================================================================
   jayneborras.com
   Concert black and white, warmed by instrument wood.
   ========================================================================== */

/* ---------- Fonts (self-hosted, latin subset, variable weight) ---------- */
@font-face {
  font-family: "Cormorant Garamond";
  src: url("../fonts/cormorant-garamond.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Cormorant Garamond";
  src: url("../fonts/cormorant-garamond-italic.woff2") format("woff2");
  font-weight: 400 700;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Source Sans 3";
  src: url("../fonts/source-sans-3.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Source Sans 3";
  src: url("../fonts/source-sans-3-italic.woff2") format("woff2");
  font-weight: 400 700;
  font-style: italic;
  font-display: swap;
}

/* ---------- Tokens ---------- */
:root {
  /* Palette */
  --ink: #111111;          /* concert black */
  --paper: #faf8f4;        /* warm white */
  --wood: #8b5a2b;         /* violin / cello brown */
  --wood-light: #c9a27a;   /* maple, spruce */
  --stone: #6b6560;        /* gray-brown secondary text */
  --stone-light: #b5ada5;
  --paper-deep: #f1ece4;

  /* Semantic roles (light section by default) */
  --bg: var(--paper);
  --fg: var(--ink);
  --muted: var(--stone);            /* 5.4:1 on paper */
  --accent: var(--wood);            /* 5.5:1 on paper */
  --on-accent: var(--paper);
  --surface: var(--paper-deep);
  --rule: color-mix(in oklab, var(--ink) 16%, transparent);

  /* Type */
  --font-serif: "Cormorant Garamond", "Cormorant", Garamond, "Times New Roman", serif;
  --font-sans: "Source Sans 3", "Source Sans Pro", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --step--1: clamp(0.875rem, 0.84rem + 0.15vw, 0.95rem);
  --step-0: clamp(1.0625rem, 1rem + 0.25vw, 1.1875rem);
  --step-1: clamp(1.25rem, 1.12rem + 0.6vw, 1.55rem);
  --step-2: clamp(1.6rem, 1.3rem + 1.3vw, 2.3rem);
  --step-3: clamp(2.2rem, 1.6rem + 2.6vw, 3.6rem);
  --step-hero: clamp(3.4rem, 1.6rem + 8vw, 8.2rem);

  /* Space */
  --gutter: clamp(1.25rem, 0.8rem + 2vw, 2.5rem);
  --section-space: clamp(4.5rem, 3rem + 6vw, 9rem);
  --header-h: 4.5rem;
  --radius: 3px;

  --ease-out: cubic-bezier(0.2, 0.7, 0.2, 1);

  color-scheme: light dark;
  accent-color: var(--wood);
}

/* Dark sections: the stage against the house */
.section--dark {
  --bg: var(--ink);
  --fg: var(--paper);
  --muted: var(--stone-light);      /* 8.5:1 on ink */
  --accent: var(--wood-light);      /* 8.0:1 on ink */
  --on-accent: var(--ink);
  --surface: #1c1a18;
  --rule: color-mix(in oklab, var(--paper) 18%, transparent);
  color-scheme: dark;
}

/* Dark mode leans into the black stage: light sections become warm charcoal */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1a1816;
    --fg: #ede8e1;                  /* 14.5:1 */
    --muted: var(--stone-light);    /* 8.0:1 */
    --accent: var(--wood-light);    /* 7.5:1 */
    --on-accent: var(--ink);
    --surface: #23201d;
    --rule: color-mix(in oklab, #ede8e1 16%, transparent);
    accent-color: var(--wood-light);
  }
  .section--dark {
    --bg: #0e0e0e;
    --fg: #ede8e1;
    --accent: #d4b28c;              /* 9.7:1 */
    --surface: #181716;
  }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { font-size-adjust: from-font; } /* keeps fallback fonts visually stable during swap */

html {
  scroll-padding-top: var(--header-h);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  @media (prefers-reduced-motion: no-preference) {
    scroll-behavior: smooth;
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: var(--step-0);
  line-height: 1.6;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

img, svg, iframe { display: block; max-width: 100%; }
img { height: auto; }

h1, h2, h3 {
  font-family: var(--font-serif);
  font-weight: 500;
  line-height: 1.1;
  margin: 0;
  text-wrap: balance;
}
p { margin: 0; text-wrap: pretty; }
cite { font-style: italic; }

a { color: inherit; }
a:hover { color: var(--accent); }

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}
/* Sections are programmatic focus targets for in-page links; no ring needed there */
section[tabindex="-1"]:focus { outline: none; }

::selection { background: var(--wood-light); color: var(--ink); }

.visually-hidden {
  position: absolute !important;
  inline-size: 1px; block-size: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: fixed;
  inset-block-start: 0.75rem;
  inset-inline-start: 0.75rem;
  z-index: 100;
  padding: 0.75rem 1.25rem;
  background: var(--paper);
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
  translate: 0 -200%;
  &:focus { translate: 0 0; }
}

.container {
  inline-size: min(100% - 2 * var(--gutter), 72rem);
  margin-inline: auto;
}

.section {
  background: var(--bg);
  color: var(--fg);
  padding-block: var(--section-space);
}

.eyebrow {
  font-family: var(--font-sans);
  font-size: var(--step--1);
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  margin-block-end: 0.75rem;
}

.section-title {
  font-size: var(--step-3);
  max-inline-size: 22ch;
  /* A thin line under each heading, like a baton's stroke */
  &::after {
    content: "";
    display: block;
    inline-size: 4rem;
    block-size: 2px;
    margin-block-start: 1.25rem;
    background: var(--accent);
    transform-origin: left center;
  }
}

.section-lede {
  margin-block-start: 1.5rem;
  max-inline-size: 60ch;
  color: var(--muted);
  font-size: var(--step-1);
  font-family: var(--font-serif);
  font-style: italic;
}

.text-link {
  color: var(--accent);
  font-weight: 600;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.25em;
  &:hover { text-decoration-thickness: 2px; }
}

/* ---------- Buttons ---------- */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-block-size: 3rem;
  padding: 0.7rem 1.6rem;
  border: 1px solid transparent;
  border-radius: 999px;
  font: 600 var(--step--1) / 1.2 var(--font-sans);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}
.button--solid {
  background: var(--accent);
  color: var(--on-accent);
  &:hover { background: var(--fg); color: var(--bg); }
}
.button--ghost {
  background: transparent;
  color: var(--fg);
  border-color: color-mix(in oklab, var(--fg) 55%, transparent);
  &:hover { border-color: var(--accent); color: var(--accent); }
}

/* ---------- Header ---------- */
.site-header {
  position: fixed;
  inset-block-start: 0;
  inset-inline: 0;
  z-index: 50;
  color: var(--paper);
  isolation: isolate;

  /* Solid, slightly blurred background layer. Without scroll-driven
     animations it is always shown, so the header stays legible. */
  &::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: color-mix(in oklab, var(--ink) 94%, transparent);
    backdrop-filter: blur(12px) saturate(1.2);
    -webkit-backdrop-filter: blur(12px) saturate(1.2);
    border-block-end: 1px solid color-mix(in oklab, var(--paper) 10%, transparent);
  }
}

/* Transparent over the hero, solid once the page scrolls (no scroll listener) */
@supports ((animation-timeline: scroll()) and (animation-range: 0% 100%)) {
  .site-header::before {
    animation: header-solidify linear both;
    animation-timeline: scroll(block root);
    animation-range: 0 40svh;
  }
}
@keyframes header-solidify {
  from { opacity: 0; }
  to { opacity: 1; }
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  inline-size: min(100% - 2 * var(--gutter), 80rem);
  min-block-size: var(--header-h);
  margin-inline: auto;
}

.wordmark {
  font-family: var(--font-serif);
  font-size: 1.6rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-decoration: none;
  color: inherit;
  white-space: nowrap;
  &:hover { color: var(--wood-light); }
}

.menu-button {
  anchor-name: --menu-button;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-block-size: 2.75rem;
  padding: 0.5rem 1rem;
  border: 1px solid color-mix(in oklab, var(--paper) 40%, transparent);
  border-radius: 999px;
  background: color-mix(in oklab, var(--ink) 35%, transparent);
  color: inherit;
  font: 600 var(--step--1) / 1 var(--font-sans);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  &:focus-visible { outline-color: var(--wood-light); }
}

/* Narrow: the link list is a native popover (no JavaScript needed) */
.site-menu {
  list-style: none;
  margin: 0;
  padding: 0.5rem;
  position: fixed;
  inset: auto;
  inset-inline-end: var(--gutter);
  inset-block-start: calc(var(--header-h) - 0.25rem);  /* fallback without anchor positioning */
  inset-block-start: calc(anchor(--menu-button bottom) + 0.5rem);
  inline-size: min(80dvw, 18rem);
  max-block-size: calc(100dvh - 6rem);
  overflow: auto;
  border: 1px solid color-mix(in oklab, var(--paper) 18%, transparent);
  border-radius: 0.5rem;
  background: var(--ink);
  color: var(--paper);
  box-shadow: 0 1.5rem 3rem rgb(0 0 0 / 0.35);

  opacity: 1;
  transition: opacity 0.2s ease, translate 0.25s var(--ease-out), display 0.25s, overlay 0.25s;
  transition-behavior: allow-discrete;

  &:not(:popover-open) { opacity: 0; translate: 0 -0.5rem; }
  @starting-style {
    &:popover-open { opacity: 0; translate: 0 -0.5rem; }
  }
  @media (prefers-reduced-motion: reduce) {
    translate: none !important;
  }

  a {
    display: block;
    padding: 0.85rem 1rem;
    font-size: var(--step-0);
    text-decoration: none;
    border-radius: 0.25rem;
    &:hover { background: color-mix(in oklab, var(--paper) 8%, transparent); color: var(--wood-light); }
    &:focus-visible { outline-color: var(--wood-light); outline-offset: -3px; }
  }
}
/* Before the popover polyfill (if ever needed) or in browsers without :popover-open */
@supports not selector(:popover-open) {
  .site-menu:not(.\:popover-open) { display: none; }
}

/* Wide: the same list sits inline in the header */
@media (width >= 48rem) {
  .menu-button { display: none; }
  .site-menu {
    display: flex;
    gap: 0.25rem;
    position: static;
    inset: auto;
    inline-size: auto;
    max-block-size: none;
    overflow: visible;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    color: inherit;
    opacity: 1;
    translate: none;
    &:not(:popover-open) { opacity: 1; translate: none; }
    a {
      position: relative;
      padding: 0.5rem 0.8rem;
      font-size: var(--step--1);
      font-weight: 600;
      letter-spacing: 0.1em;
      text-transform: uppercase;
      &:hover { background: transparent; }
      &::after {
        content: "";
        position: absolute;
        inset-inline: 0.8rem;
        inset-block-end: 0.25rem;
        block-size: 1px;
        background: var(--wood-light);
        scale: 0 1;
        transition: scale 0.3s var(--ease-out);
      }
      &:hover::after { scale: 1 1; }
    }
  }
  @supports not selector(:popover-open) {
    .site-menu:not(.\:popover-open) { display: flex; }
  }
}

/* Active section in the nav (CSS scroll-target-group where supported, JS fallback otherwise) */
.site-menu { scroll-target-group: auto; }
.site-menu a:is(:target-current, .is-current) {
  color: var(--wood-light);
  &::after { scale: 1 1; }
}
@media (width < 48rem) {
  .site-menu a:is(:target-current, .is-current) {
    box-shadow: inset 2px 0 0 var(--wood-light);
  }
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  display: grid;
  align-items: end;
  min-block-size: max(36rem, 100svh);
  overflow: hidden;
  isolation: isolate;
  background: var(--ink);
  color: var(--paper);

  &::after {  /* scrim keeps the name and buttons at high contrast over the photo */
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background:
      linear-gradient(to bottom, rgb(17 17 17 / 0.6), transparent 22%),
      linear-gradient(to top, rgb(17 17 17 / 0.92) 8%, rgb(17 17 17 / 0.55) 42%, rgb(17 17 17 / 0.08) 75%);
  }
}

.hero-media {
  position: absolute;
  inset: 0;
  z-index: -2;
  img {
    inline-size: 100%;
    block-size: 100%;
    object-fit: cover;
    object-position: 62% 30%;
    @media (prefers-reduced-motion: no-preference) {
      animation: ken-burns 28s var(--ease-out) both;
    }
  }
}
@keyframes ken-burns {
  from { scale: 1.12; }
  to { scale: 1; }
}

.hero-content {
  inline-size: min(100% - 2 * var(--gutter), 80rem);
  margin-inline: auto;
  padding-block: calc(var(--header-h) + 4rem) clamp(3rem, 2rem + 6svh, 6.5rem);
}

.hero-title {
  font-size: var(--step-hero);
  font-weight: 500;
  line-height: 0.92;
  letter-spacing: -0.01em;
}

.hero-descriptor {
  margin-block-start: 1.25rem;
  font-family: var(--font-serif);
  font-size: var(--step-2);
  font-style: italic;
  color: #e9dccd;
  span { color: var(--wood-light); padding-inline: 0.15em; }
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-block-start: 2.25rem;
  .button--solid { --accent: var(--wood-light); --on-accent: var(--ink); }
  .button--ghost { --fg: var(--paper); }
}

@media (prefers-reduced-motion: no-preference) {
  .hero-title, .hero-descriptor, .hero-actions {
    animation: rise 1s var(--ease-out) both;
  }
  .hero-descriptor { animation-delay: 0.18s; }
  .hero-actions { animation-delay: 0.36s; }
}
@keyframes rise {
  from { opacity: 0; translate: 0 1.5rem; }
}

/* ---------- At a glance ---------- */
.role-cards {
  list-style: none;
  padding: 0;
  margin: clamp(2.5rem, 2rem + 2vw, 4rem) 0 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 12.5rem), 1fr));
  gap: clamp(1.25rem, 1rem + 1vw, 2rem);
}

.role-card {
  padding-block-start: 1.25rem;
  border-block-start: 1px solid var(--rule);
  position: relative;
  &::before {  /* short wood accent on the rule */
    content: "";
    position: absolute;
    inset-block-start: -1px;
    inset-inline-start: 0;
    inline-size: 2rem;
    block-size: 2px;
    background: var(--accent);
  }
  h3 { font-size: var(--step-1); font-weight: 600; }
  p { margin-block-start: 0.6rem; color: var(--muted); font-size: 1rem; line-height: 1.55; }
}
.role-note {
  font-family: var(--font-sans);
  font-size: 0.75em;
  font-weight: 400;
  color: var(--muted);
  white-space: nowrap;
}

.credentials {
  list-style: none;
  margin: clamp(3rem, 2rem + 3vw, 4.5rem) 0 0;
  padding: 1.5rem 0;
  border-block: 1px solid var(--rule);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.25rem 0;
  font-family: var(--font-serif);
  font-size: var(--step-1);
  font-style: italic;
  li + li::before {
    content: "·";
    padding-inline: 0.9em;
    color: var(--accent);
    font-style: normal;
  }
}

.glance-more {
  margin-block-start: 2rem;
  text-align: center;
}

/* ---------- Performances ---------- */
.video-grid {
  display: grid;
  gap: clamp(1.5rem, 1rem + 2vw, 2.5rem);
  margin-block-start: clamp(2.5rem, 2rem + 2vw, 4rem);

  @media (width >= 40rem) {
    grid-template-columns: 1fr 1fr;
    .video-card--lead { grid-column: 1 / -1; }
  }
  @media (width >= 64rem) {
    grid-template-columns: 2fr 1fr;
    grid-template-rows: auto auto;
    .video-card--lead { grid-column: 1; grid-row: 1 / span 2; }
  }
}

.video-grid--pair {
  margin-block-start: 1.5rem;
  @media (width >= 40rem) {
    grid-template-columns: 1fr 1fr;
  }
  @media (width >= 64rem) {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto;
  }
}

.video-group-title {
  margin-block-start: clamp(3.5rem, 2.5rem + 3vw, 5rem);
  padding-block-start: 1.5rem;
  border-block-start: 1px solid var(--rule);
  font-size: var(--step-2);
}

.video-card {
  margin: 0;
  figcaption {
    display: grid;
    gap: 0.15rem;
    margin-block-start: 1rem;
  }
}
.video-kind {
  font-size: var(--step--1);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}
.video-title {
  font-family: var(--font-serif);
  font-size: var(--step-1);
  line-height: 1.2;
}
.video-card--lead .video-title { font-size: var(--step-2); }
.video-meta { color: var(--muted); font-size: 1rem; }

.video-facade,
.gallery-item {
  position: relative;
  display: block;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--paper);
  img { inline-size: 100%; }
  @media (prefers-reduced-motion: no-preference) {
    img { transition: scale 0.6s var(--ease-out), filter 0.4s; }
    &:is(:hover, :focus-visible) img { scale: 1.035; }
  }
  &:is(:hover, :focus-visible) img { filter: brightness(1.06); }
}

.video-facade {
  aspect-ratio: 16 / 9;
  img { block-size: 100%; object-fit: cover; }
  &::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgb(0 0 0 / 0.35), transparent 50%);
    pointer-events: none;
  }
}

.play-badge {
  position: absolute;
  inset: 0;
  margin: auto;
  z-index: 1;
  display: grid;
  place-items: center;
  inline-size: clamp(3.5rem, 3rem + 2vw, 5rem);
  aspect-ratio: 1;
  border-radius: 50%;
  background: rgb(250 248 244 / 0.92);
  color: var(--ink);
  box-shadow: 0 0.5rem 2rem rgb(0 0 0 / 0.35);
  transition: background-color 0.2s, color 0.2s;
  svg { translate: 2px 0; }
  .video-facade:is(:hover, :focus-visible) & {
    background: var(--wood-light);
  }
  @media (prefers-reduced-motion: no-preference) {
    transition: background-color 0.2s, color 0.2s, scale 0.35s var(--ease-out);
    .video-facade:is(:hover, :focus-visible) & { scale: 1.08; }
  }
}

/* ---------- Delaware County Children's Chorus ---------- */
.chorus {
  background: var(--surface);   /* deeper cream: separates it from the light section below */
}
.chorus-layout {
  display: grid;
  gap: clamp(2rem, 1.5rem + 3vw, 5rem);
  align-items: center;
  @media (width >= 56rem) {
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  }
}
.chorus-photo {
  margin: 0;
  img { inline-size: 100%; border-radius: var(--radius); }
}
.chorus-logo {
  inline-size: clamp(6.5rem, 5rem + 4vw, 9rem);
  block-size: auto;
  margin-block-end: 2rem;
  /* The logo's navy wordmark needs a light ground; give it one in dark mode */
  @media (prefers-color-scheme: dark) {
    padding: 0.85rem;
    border-radius: 0.5rem;
    background: var(--paper);
    box-sizing: content-box;
  }
}
.chorus-place {
  margin-block-start: 1.25rem;
  color: var(--muted);
  font-family: var(--font-serif);
  font-size: var(--step-1);
  font-style: italic;
}
.chorus-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 1.75rem;
  margin-block-start: 2.25rem;
}

/* Links on the chorus name in running text */
.role-card p a,
.timeline-org a {
  color: inherit;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  &:hover { color: var(--accent); text-decoration-thickness: 2px; }
}

/* ---------- Ensembles timeline ---------- */
.timeline {
  list-style: none;
  margin: clamp(2.5rem, 2rem + 2vw, 4rem) 0 0;
  padding: 0;
  position: relative;
  &::before {  /* the staff line */
    content: "";
    position: absolute;
    inset-block: 0.6rem 0;
    inset-inline-start: 0.3rem;
    inline-size: 1px;
    background: var(--rule);
  }
}

.timeline-item {
  position: relative;
  display: grid;
  gap: 0.35rem 2rem;
  padding-inline-start: 2rem;
  padding-block-end: 2.5rem;
  &:last-child { padding-block-end: 0; }
  &::before {  /* note head */
    content: "";
    position: absolute;
    inset-inline-start: 0;
    inset-block-start: 0.45rem;
    inline-size: 0.65rem;
    aspect-ratio: 1;
    border-radius: 50%;
    background: var(--bg);
    border: 2px solid var(--accent);
  }
  @media (width >= 48rem) {
    grid-template-columns: 9rem 1fr;
    padding-inline-start: 2.5rem;
  }
}

.timeline-when {
  font-size: var(--step--1);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  padding-block-start: 0.2rem;
}

.timeline-body {
  h3 { font-size: var(--step-2); }
  p { color: var(--muted); max-inline-size: 60ch; }
  .timeline-org {
    margin-block: 0.3rem 0.5rem;
    color: var(--fg);
    font-weight: 600;
  }
}

.facts {
  display: grid;
  gap: 2.5rem;
  margin-block-start: clamp(3rem, 2rem + 3vw, 5rem);
  padding-block-start: clamp(2rem, 1.5rem + 2vw, 3rem);
  border-block-start: 1px solid var(--rule);
  @media (width >= 48rem) { grid-template-columns: 3fr 2fr; gap: 4rem; }
  ul { list-style: none; margin: 1rem 0 0; padding: 0; display: grid; gap: 0.75rem; }
  li { color: var(--muted); }
  strong { color: var(--fg); font-weight: 600; }
}
.facts-title { font-size: var(--step-2); }

/* ---------- Gallery (masonry via CSS columns) ---------- */
.masonry {
  list-style: none;
  margin: clamp(2.5rem, 2rem + 2vw, 4rem) 0 0;
  padding: 0;
  columns: 3 10rem;
  column-gap: clamp(0.75rem, 0.5rem + 1vw, 1.25rem);
  li {
    break-inside: avoid;
    margin-block-end: clamp(0.75rem, 0.5rem + 1vw, 1.25rem);
  }
}
.gallery-item {
  cursor: zoom-in;
  img { block-size: auto; }
}

/* ---------- Biography ---------- */
.bio-layout {
  display: grid;
  gap: clamp(2rem, 1.5rem + 3vw, 5rem);
  @media (width >= 56rem) {
    grid-template-columns: 22rem minmax(0, 1fr);
    align-items: start;
  }
}
.bio-portrait {
  margin: 0;
  max-inline-size: 28rem;
  img { border-radius: var(--radius); inline-size: 100%; }
  @media (width >= 56rem) {
    position: sticky;
    inset-block-start: calc(var(--header-h) + 2rem);
  }
}
.bio-text {
  max-inline-size: 65ch;
  > p:not(.eyebrow) {
    margin-block-start: 1.25em;
    font-size: var(--step-0);
    line-height: 1.75;
  }
  .section-title + p { margin-block-start: 2rem; }
}

/* ---------- Contact ---------- */
.contact-inner {
  display: grid;
  justify-items: center;
  text-align: center;
  .section-title { max-inline-size: none; }
  .section-title::after { margin-inline: auto; }
}
.contact-email {
  margin-block: 2.25rem 1.75rem;
  font-family: var(--font-serif);
  font-size: clamp(1.75rem, 1rem + 4vw, 3.75rem);
  line-height: 1.15;
  overflow-wrap: anywhere;
  a {
    text-decoration: underline;
    text-decoration-color: var(--accent);
    text-decoration-thickness: 1px;
    text-underline-offset: 0.18em;
    &:hover { color: var(--accent); text-decoration-thickness: 2px; }
  }
}

.copy { position: relative; display: inline-block; }
.copy-button {
  .icon-check { display: none; }
  &[data-copied] {
    .icon-copy { display: none; }
    .icon-check { display: block; }
  }
}
.copy-tip {
  position: absolute;
  inset-inline-start: 50%;
  inset-block-end: calc(100% + 0.6rem);
  translate: -50% 0;
  padding: 0.3rem 0.75rem;
  border-radius: 0.3rem;
  background: var(--fg);
  color: var(--bg);
  font-size: var(--step--1);
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
  &:not(:empty) { opacity: 1; }
}

/* ---------- Footer ---------- */
.site-footer {
  background: var(--bg);
  color: var(--muted);
  border-block-start: 1px solid var(--rule);
  font-size: var(--step--1);
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 2rem;
  padding-block: 2rem;
  a { color: var(--fg); }
}

/* ---------- Dialogs ---------- */
dialog {
  border: 0;
  padding: 0;
  color: var(--paper);
  background: var(--ink);
}
dialog:modal {
  overscroll-behavior: contain;
}
dialog::backdrop {
  background: rgb(8 8 8 / 0.88);
  backdrop-filter: blur(4px);
  overflow: hidden;
  overscroll-behavior: contain;
}

.dialog-close,
.lightbox-nav {
  display: grid;
  place-items: center;
  min-inline-size: 2.75rem;
  min-block-size: 2.75rem;
  padding: 0;
  border: 1px solid rgb(250 248 244 / 0.35);
  border-radius: 50%;
  background: rgb(17 17 17 / 0.6);
  color: var(--paper);
  cursor: pointer;
  transition: background-color 0.2s, border-color 0.2s;
  &:hover { background: var(--wood-light); border-color: var(--wood-light); color: var(--ink); }
  &:focus-visible { outline: 3px solid var(--wood-light); outline-offset: 3px; }
}

.video-dialog {
  inline-size: min(100% - 2rem, 72rem);
  max-block-size: calc(100dvh - 2rem);
  border-radius: 0.4rem;
  overflow: hidden;

  opacity: 1;
  transition: opacity 0.25s ease, display 0.25s, overlay 0.25s;
  transition-behavior: allow-discrete;
  &:not([open]) { opacity: 0; }
  @starting-style { &[open] { opacity: 0; } }
  &::backdrop { transition: opacity 0.25s, display 0.25s, overlay 0.25s; transition-behavior: allow-discrete; }
  &:not([open])::backdrop { opacity: 0; }
  @starting-style { &[open]::backdrop { opacity: 0; } }
}
.dialog-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.6rem 0.6rem 0.6rem 1.25rem;
}
.dialog-title {
  font-size: var(--step-1);
  font-weight: 500;
}
.video-frame {
  aspect-ratio: 16 / 9;
  max-block-size: calc(100dvh - 6rem);
  margin-inline: auto;
  background: #000;
  iframe { inline-size: 100%; block-size: 100%; border: 0; }
}

.lightbox {
  inline-size: 100dvw;
  block-size: 100dvh;
  max-inline-size: none;
  max-block-size: none;
  background: transparent;
  &[open] {
    display: grid;
    grid-template: "close" auto "figure" 1fr "nav" auto / 1fr;
    place-items: center;
    gap: 0.75rem;
    padding: 1rem;
  }
  &::backdrop { background: rgb(8 8 8 / 0.94); }
}
.lightbox-close-form { grid-area: close; justify-self: end; }
.lightbox-figure {
  grid-area: figure;
  margin: 0;
  display: grid;
  justify-items: center;
  gap: 0.75rem;
  min-block-size: 0;
  img {
    max-inline-size: min(100%, 92dvw);
    max-block-size: calc(100dvh - 11rem);
    inline-size: auto;
    block-size: auto;
    object-fit: contain;
    border-radius: var(--radius);
  }
}
.lightbox-caption {
  max-inline-size: 60ch;
  color: #e9dccd;
  font-size: var(--step--1);
  text-align: center;
}
.lightbox-prev { grid-area: nav; justify-self: start; }
.lightbox-next { grid-area: nav; justify-self: end; }
@media (width >= 48rem) {
  .lightbox[open] {
    grid-template: "prev close next" auto "prev figure next" 1fr / 4rem 1fr 4rem;
    padding: 1.5rem;
  }
  .lightbox-close-form { grid-area: close; }
  .lightbox-prev { grid-area: prev; justify-self: center; }
  .lightbox-next { grid-area: next; justify-self: center; }
  .lightbox-figure img { max-block-size: calc(100dvh - 9rem); }
}

/* View transition between a thumbnail and the lightbox image */
::view-transition-group(gallery-photo) {
  animation-duration: 0.45s;
  animation-timing-function: var(--ease-out);
}
::view-transition-old(gallery-photo),
::view-transition-new(gallery-photo) {
  block-size: 100%;
  object-fit: cover;
}
@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) {
    animation: none !important;
  }
}

/* ---------- Scroll-driven reveals (progressive enhancement) ---------- */
@media (prefers-reduced-motion: no-preference) {
  @supports ((animation-timeline: view()) and (animation-range: entry)) {
    .reveal {
      animation: reveal linear both;
      animation-timeline: view();
      animation-range: entry 0% entry 80%;
    }
    .section-title::after {
      animation: draw-line linear both;
      animation-timeline: view();
      animation-range: entry 40% cover 40%;
    }
    .timeline::before {
      transform-origin: top;
      animation: draw-staff linear both;
      animation-timeline: view();
      animation-range: entry 10% cover 60%;
    }
  }
}
@keyframes reveal {
  from { opacity: 0; translate: 0 2.25rem; }
}
@keyframes draw-line {
  from { scale: 0 1; }
}
@keyframes draw-staff {
  from { scale: 1 0; }
}

/* ---------- Forced colors ---------- */
@media (forced-colors: active) {
  .site-header::before { background: Canvas; opacity: 1 !important; }
  .button, .menu-button { border-color: ButtonText; }
  .section-title::after, .role-card::before { background: CanvasText; }
  .site-menu a:is(:target-current, .is-current) { text-decoration: underline; }
}
