/* The Atelier (staff page), scoped so the home page stays unchanged. */
/* Hero: the staff photo in the home page's hero. Layout, type and shade all come from styles.css, so the
   two pages match at every window size. Only the photo's box is our own: it frames exactly like
   object-fit: cover (50% 45%) but keeps the whole 16:9 picture, so focus view can zoom out to all of it. */
.about-page .hero {
  --hero-h: min(100svh, 56.25vw + 6rem);
  --photo-w: max(100%, var(--hero-h) * 16 / 9);
}
.about-page .hero-img {
  width: var(--photo-w); max-width: none; height: auto; aspect-ratio: 16 / 9; inset: auto;
  left: calc((100% - var(--photo-w)) / 2);
  top: calc((var(--hero-h) - var(--photo-w) * 9 / 16) * 0.45);
}
.about-page .hero-caption { display: none; }
/* Home's title sits above its button; with no button here, the same space goes under the text. */
.about-page .hero-copy { padding-bottom: calc(clamp(3rem, 8vw, 6rem) + 5rem); }
@media (max-width: 640px) {
  .about-page .hero { --photo-w: calc(100vw * 16 / 9); }
  .about-page .hero-img { height: 100vw; left: auto; top: auto; margin-left: calc((100% - var(--photo-w)) / 2); }
  .about-page .hero-copy { padding-bottom: clamp(3rem, 8vw, 6rem); }
}

.atelier {
  width: min(100% - 2 * var(--gutter), 72rem);
  margin-inline: auto;
  padding-block: clamp(3rem, 7vw, 5.5rem);
  display: grid; gap: clamp(2.5rem, 6vw, 4.5rem);
}

.staff { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(2.5rem, 5vw, 4rem) clamp(1.5rem, 4vw, 3.5rem); }
.member { display: grid; grid-template-columns: minmax(0, 11rem) minmax(0, 1fr); gap: 1.5rem; align-items: start; padding-top: 2rem; border-top: 1px solid var(--brass); }
.member.lead { grid-column: 1 / -1; grid-template-columns: minmax(0, 20rem) minmax(0, 1fr); gap: clamp(1.5rem, 5vw, 4rem); align-items: center; }
.member.lead h2 { font-size: clamp(2.4rem, 5vw, 3.6rem); }
.member.lead .bio { font-size: 1.2rem; }

/* Whole portrait, never cropped: square art in a square frame. */
.portrait { margin: 0; aspect-ratio: 1; border: 1px solid var(--brass); background: var(--wood); }
.portrait img { width: 100%; height: 100%; object-fit: contain; }

.member h2 { font-size: clamp(1.9rem, 3.6vw, 2.6rem); text-wrap: balance; }
.copy { display: grid; gap: 0.6rem; min-width: 0; }
.role { font: 600 0.75rem/1.2 var(--sans); letter-spacing: 0.14em; text-transform: uppercase; color: var(--ear); }
.aka { margin-top: -0.3rem; font: italic 400 1rem/1.4 var(--serif); color: var(--tweed); }
.bio { font: 400 1.05rem/1.65 var(--serif); max-width: 36rem; }
.known { margin-top: 0.4rem; font: italic 400 0.95rem/1 var(--serif); color: var(--tweed); }
.quirks { margin: 0; padding: 0; list-style: none; display: grid; gap: 0.35rem; }
.quirks li { padding-left: 1.1rem; position: relative; font-size: 0.95rem; color: var(--tweed); }
.quirks li::before { content: ""; position: absolute; left: 0; top: 0.6em; width: 0.45rem; height: 1px; background: var(--brass); }

.atelier-cta { border-top: 1px solid var(--brass); padding-top: 1.75rem; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1.25rem 2rem; }
.atelier-cta p { font: italic 400 1.05rem/1.6 var(--serif); color: var(--tweed); max-width: 34rem; }

@media (max-width: 860px) {
  .staff { grid-template-columns: minmax(0, 1fr); }
  .member.lead { grid-template-columns: minmax(0, 1fr); }
  .member.lead .portrait { max-width: 22rem; }
}
@media (max-width: 480px) {
  .member { grid-template-columns: minmax(0, 1fr); }
  .member .portrait { max-width: 15rem; }
}

/* ---------- Draft C: full-window slides. The whole staff, then each profile, then the fish tank. ---------- */
.slide-tank {
  position: relative; overflow: hidden; aspect-ratio: 16 / 9;
  background: #0f4a4c url("/img/staff/tank-water.jpg") center / cover no-repeat;
}
.tank-frame {
  border: clamp(12px, 1.6vw, 22px) solid #4a2a1a;
  border-image: linear-gradient(135deg, #7a4a2c 0%, #4a2a1a 18%, #6b3f25 34%, #3a2014 52%, #7a4a2c 70%, #4a2a1a 86%, #5e3520 100%) 1;
  box-shadow: inset 0 0 0 2px rgba(138, 106, 63, 0.9), inset 0 14px 30px rgba(0, 0, 0, 0.45), inset 0 -10px 24px rgba(0, 0, 0, 0.35), 0 18px 40px rgba(0, 0, 0, 0.5);
}
/* Each fish is one cut-out shown three times and clipped into head, rear body and tail.
   The rear swings from its joint with the head, and the tail swings from the rear, so the body
   flexes and the tail and back fins beat. Rotations only; runs while the tank is on screen. */
.slide-tank .fish { position: absolute; left: 0; display: block; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.35)); }
.slide-tank .fish img { display: block; width: 100%; height: auto; }
.slide-tank .flex-rear, .slide-tank .flex-tail, .slide-tank .seg-rear, .slide-tank .seg-tail { position: absolute; inset: 0; }
.slide-tank .seg-front { clip-path: inset(0 0 0 calc(var(--rear) - 1.5%)); }
.slide-tank .seg-rear { clip-path: inset(0 calc(100% - var(--rear)) 0 calc(var(--tail) - 1.5%)); }
.slide-tank .seg-tail { clip-path: inset(0 calc(100% - var(--tail)) 0 0); }
.slide-tank .flex-rear { transform-origin: var(--rear) 52%; animation: fish-flex calc(var(--beat, 0.9s) * var(--fish-beat-scale)) ease-in-out infinite paused; }
.slide-tank .flex-tail { transform-origin: var(--tail) 52%; animation: fish-tail calc(var(--beat, 0.9s) * var(--fish-beat-scale)) ease-in-out infinite paused; animation-delay: calc(var(--beat, 0.9s) * var(--fish-beat-scale) * -0.3); }
.slide-tank.swimming .flex-rear, .slide-tank.swimming .flex-tail { animation-play-state: running; }
@keyframes fish-flex { 0%, 100% { transform: rotate(calc(var(--fish-flex-deg) * var(--fish-flex-on) * -1)); } 50% { transform: rotate(calc(var(--fish-flex-deg) * var(--fish-flex-on))); } }
@keyframes fish-tail { 0%, 100% { transform: rotate(calc(var(--fish-tail-deg) * var(--fish-flex-on))); } 50% { transform: rotate(calc(var(--fish-tail-deg) * var(--fish-flex-on) * -1)); } }
.f-antler { --tail: 27%; --rear: 52%; }
.f-swirl { --tail: 22%; --rear: 46%; }
.f-puffer { --tail: 19%; --rear: 40%; --beat: 0.7s; }
.f-stripe { --tail: 24%; --rear: 50%; --beat: 0.75s; }
.slide-tank .fish:nth-child(1) { width: 15%; top: 14%; --beat: 1s; }
.slide-tank .fish:nth-child(2) { width: 11%; top: 40%; --beat: 0.85s; }
.slide-tank .fish:nth-child(3) { width: 12%; top: 66%; }
.slide-tank .fish:nth-child(4) { width: 11%; top: 24%; }
.slide-tank .fish:nth-child(5) { width: 9%; top: 54%; --beat: 0.8s; }
.slide-tank .fish:nth-child(6) { width: 10%; top: 6%; --beat: 0.65s; }

/* Without motion (no script, or reduced motion): the tank, then each profile in turn. */
.slides-sticky { width: min(100% - 2 * var(--gutter), 72rem); margin-inline: auto; padding-block: clamp(3rem, 7vw, 5.5rem); display: grid; gap: clamp(2.5rem, 6vw, 4.5rem); }
html:not(.motion) .slide-tank .fish:nth-child(1) { left: 8%; }
html:not(.motion) .slide-tank .fish:nth-child(2) { left: 32%; transform: scaleX(-1); }
html:not(.motion) .slide-tank .fish:nth-child(3) { left: 56%; }
html:not(.motion) .slide-tank .fish:nth-child(4) { left: 72%; transform: scaleX(-1); }
html:not(.motion) .slide-tank .fish:nth-child(5) { left: 20%; }
html:not(.motion) .slide-tank .fish:nth-child(6) { left: 48%; }
.slides + .atelier { padding-top: 0; }

/* With motion: one pinned window; slides.js fades each slide in and out as you scroll. */
.motion .slides { position: relative; }
.motion .slides-sticky {
  --stage-top: 4.25rem; /* the compact nav: profiles sit below it, the office photo runs under it */
  position: sticky; top: 0; height: 100svh;
  width: 100%; padding: 0; display: block; overflow: hidden;
}
/* The staff photo, first in the pinned window. slides.js moves and scales it into focus view. */
.motion .slides-sticky > .hero .hero-caption {
  display: block; position: absolute; left: 0; right: 0; margin: 0; padding-inline: var(--gutter); opacity: 0;
  text-align: center; font: italic 400 0.95rem/1.4 var(--serif); color: var(--tweed);
}
.motion .slides-sticky > .hero { position: absolute; top: 0; left: 0; right: 0; overflow: visible; will-change: opacity; }
/* On scroll the shade clears from the bottom up behind a soft edge, down to --shade-keep. It is as tall
   as the window, so the moving photo never passes under an end of it. */
.motion .slides-sticky > .hero::before {
  bottom: auto; height: 100svh;
  background:
    linear-gradient(90deg, rgba(36, 21, 15, 0.92) 0%, rgba(36, 21, 15, 0.7) 32%, rgba(36, 21, 15, 0) 58%),
    linear-gradient(180deg, rgba(36, 21, 15, 0) calc(var(--hero-h) * 0.7), var(--panel) var(--hero-h)),
    linear-gradient(180deg, rgba(36, 21, 15, 0.7) 0, rgba(36, 21, 15, 0) calc(var(--hero-h) * 0.18));
  -webkit-mask-image: linear-gradient(0deg, rgb(0 0 0 / var(--shade-keep, 0)) calc(var(--wipe, 0%) - 35%), #000 var(--wipe, 0%));
  mask-image: linear-gradient(0deg, rgb(0 0 0 / var(--shade-keep, 0)) calc(var(--wipe, 0%) - 35%), #000 var(--wipe, 0%));
}
/* As the photo moves into focus its edges soften into the page, so no hard line crosses the screen. */
.motion .slides-sticky > .hero .hero-img {
  --soft: calc(var(--focus, 0) * 6%); --soft-end: var(--soft);
  will-change: transform;
  -webkit-mask-image:
    linear-gradient(180deg, transparent 0, #000 var(--soft), #000 calc(100% - var(--soft-end)), transparent 100%),
    linear-gradient(90deg, transparent 0, #000 var(--soft), #000 calc(100% - var(--soft)), transparent 100%);
  mask-image:
    linear-gradient(180deg, transparent 0, #000 var(--soft), #000 calc(100% - var(--soft-end)), transparent 100%),
    linear-gradient(90deg, transparent 0, #000 var(--soft), #000 calc(100% - var(--soft)), transparent 100%);
  -webkit-mask-composite: source-in; mask-composite: intersect;
}
@media (max-width: 640px) {
  /* Phones start with home's soft bottom edge. */
  .motion .slides-sticky > .hero .hero-img { --soft-end: calc(28% - var(--focus, 0) * 22%); }
}
.motion .slide, .motion .slide-tank { position: absolute; opacity: 0; will-change: opacity; }
.motion .slide-tank .fish { will-change: transform; }
.motion .member.slide, .motion .member.lead.slide {
  inset: var(--stage-top) 0 0; margin: 0 auto; max-width: 84rem;
  padding: clamp(1.5rem, 4vh, 3rem) calc(var(--gutter) + 11rem) clamp(1.5rem, 4vh, 3rem) var(--gutter);
  border: 0;
  display: grid; grid-template-columns: minmax(0, auto) minmax(0, 1fr); align-items: center; align-content: center;
  gap: clamp(2rem, 5vw, 5rem);
}
.motion .member.slide .portrait { width: min(34rem, 62svh, 38vw); }
.motion .member.slide h2 { font-size: clamp(2.4rem, 3.9vw, 3.9rem); }
.motion .member.slide .bio { font-size: clamp(1.05rem, 1.5vw, 1.35rem); max-width: 40rem; }
/* The tank is a 16:9 box, as large as fits beside the rail. */
.motion .slide-tank {
  --room-w: calc(100vw - 2 * var(--gutter) - 11rem);
  --room-h: calc(100svh - 4.25rem - 2 * clamp(1rem, 4vh, 2.5rem) - 2.25rem);
  inset: var(--stage-top) 11rem 2.25rem 0; margin: auto;
  width: min(var(--room-w), var(--room-h) * 16 / 9); height: auto; aspect-ratio: 16 / 9;
}

/* Staff rail: dots on the right; the member in view is lit; click to jump straight there. */
.staff-rail {
  position: fixed; right: clamp(0.75rem, 2vw, 1.75rem); top: 50%; z-index: 15;
  transform: translateY(-50%); display: grid; gap: 0.9rem;
}
.staff-rail a { display: flex; align-items: center; justify-content: flex-end; gap: 0.6rem; text-decoration: none; font-size: 0.8rem; color: var(--tweed); padding-block: 0.15rem; }
.staff-rail a::after { content: ""; flex: none; width: 0.6rem; height: 0.6rem; border-radius: 50%; border: 1px solid var(--brass); transition: background-color 0.2s, transform 0.2s; }
.staff-rail a span { opacity: 0; transform: translateX(0.4rem); transition: opacity 0.2s, transform 0.2s; white-space: nowrap; }
.staff-rail a:hover span, .staff-rail a:focus-visible span, .staff-rail a[aria-current] span { opacity: 1; transform: none; }
.staff-rail a[aria-current] { color: var(--parchment); }
.staff-rail a[aria-current]::after { background: var(--ear); border-color: var(--ear); transform: scale(1.25); }
.staff-rail { transition: opacity 0.3s; }
.staff-rail:not(:has([aria-current])):not(:focus-within) { opacity: 0; pointer-events: none; }
html:not(.motion) .staff-rail { display: none; }
@media (prefers-reduced-motion: reduce) { .staff-rail, .staff-rail a::after, .staff-rail a span { transition: none; } }

@media (max-width: 1100px) {
  .motion .member.slide, .motion .member.lead.slide { padding-right: calc(var(--gutter) + 3rem); }
  .motion .slide-tank { --room-w: calc(100vw - 2 * var(--gutter) - 3rem); right: 3rem; }
  .staff-rail a span { display: none; }
}
@media (max-width: 860px) {
  .motion .slides-sticky { --stage-top: 3.6rem; }
  /* Every profile on a phone uses the same box: portrait the same size, at the same top. */
  .motion .member.slide, .motion .member.lead.slide {
    grid-template-columns: minmax(0, 1fr); align-content: start; align-items: start; gap: 1.1rem;
    padding: clamp(1rem, 3svh, 1.75rem) calc(var(--gutter) + 1.75rem) 1rem var(--gutter);
  }
  .motion .member.slide .portrait, .motion .member.lead.slide .portrait { width: min(17rem, 34svh); max-width: none; aspect-ratio: 1; }
  .motion .member.slide h2 { font-size: 2rem; }
  .motion .member.slide .bio { font-size: 1rem; line-height: 1.55; }
  .motion .member.slide .quirks li { font-size: 0.88rem; }
  .motion .slide-tank { --room-w: calc(100vw - 2 * var(--gutter) - 1.75rem); right: 1.75rem; }
  .motion .slide-tank .fish:nth-child(1) { width: 20%; }
  .motion .slide-tank .fish:nth-child(2) { width: 15%; }
  .motion .slide-tank .fish:nth-child(3) { width: 16%; }
  .motion .slide-tank .fish:nth-child(4) { width: 15%; }
  .motion .slide-tank .fish:nth-child(5) { width: 12%; }
  .motion .slide-tank .fish:nth-child(6) { width: 13%; }
  .staff-rail { right: 0.55rem; gap: 1.1rem; }
  .staff-rail a span { display: none; }
}
