/* "Faces through the years" (section .story): copy beside a portrait that grows from baby to 18.
   faces.js stacks the five portraits in the stage and cross-fades them; without it the last one shows.
   Only opacity and transform animate. Gold tints use --gold-a from site.css. */

/* ---------- section layout ---------- */
.story__grid {
  display: grid;
  gap: clamp(40px, 6vw, 72px);
  align-items: center;
}
.story__copy {
  min-width: 0;
}
.story__copy .lead {
  margin-top: 22px;
}
.story__note {
  max-inline-size: 32em;
  margin-top: 22px;
  padding-left: 16px;
  border-left: 2px solid rgba(var(--gold-a), 0.5);
  color: var(--muted);
  font-size: 15px;
}
@media (min-width: 1024px) {
  .story__grid {
    grid-template-columns: repeat(12, minmax(0, 1fr));
    column-gap: 24px;
  }
  .story__copy {
    grid-column: 1 / span 5;
  }
  .faces {
    grid-column: 6 / span 7;
  }
}

/* ---------- the block: a glass card with a warm glow behind the portrait ---------- */
.faces {
  --face: 240px;
  --t0: 38px; /* first thumbnail */
  --step: 6px; /* each next thumbnail is this much larger */
  --age-h: 16px;
  --age-gap: 8px;
  position: relative;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: clamp(32px, 5vw, 56px) clamp(12px, 3.4vw, 44px) clamp(28px, 4vw, 44px);
  border: 1px solid var(--glass-line);
  border-radius: var(--radius-xl);
  background:
    radial-gradient(56% 42% at 50% 36%, rgba(var(--gold-a), 0.16), transparent 72%),
    linear-gradient(180deg, var(--glass-strong), var(--glass));
  box-shadow: var(--shadow-soft);
}
@media (min-width: 480px) {
  .faces {
    --face: 280px;
    --t0: 44px;
    --step: 7px;
  }
}
@media (min-width: 1024px) {
  .faces {
    --face: 320px;
    --t0: 52px;
    --step: 8px;
  }
}

/* ---------- stage: circular portrait inside a gold double ring ---------- */
.faces__stage {
  position: relative;
  isolation: isolate;
  width: var(--face);
  max-width: 100%;
  aspect-ratio: 1;
  margin-block: 14px;
}
/* Inner ring: a 2 px gold gradient band (masked to the border box). */
.faces__stage::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  padding: 2px;
  border-radius: 50%;
  background: var(--gold-grad);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  pointer-events: none;
}
/* Outer hairline ring and the glow. */
.faces__stage::after {
  content: "";
  position: absolute;
  inset: -12px;
  z-index: -1;
  border: 1px solid rgba(var(--gold-a), 0.38);
  border-radius: 50%;
  box-shadow:
    0 0 80px 8px rgba(var(--gold-a), 0.16),
    0 28px 60px rgba(3, 7, 20, 0.55);
  pointer-events: none;
}
.faces__stage img {
  position: absolute;
  inset: 7px;
  width: calc(100% - 14px);
  height: calc(100% - 14px);
  max-width: none;
  border-radius: 50%;
  object-fit: cover;
  background: var(--night-800);
}
.faces__layer {
  z-index: 0;
  opacity: 0;
  transition: opacity 600ms ease-in-out;
}
/* The face on its way out stays opaque under the incoming one, so the cross-fade never dims. */
.faces__layer.is-prev {
  z-index: 1;
  opacity: 1;
  transition: none;
}
.faces__layer.is-on {
  z-index: 2;
  opacity: 1;
}

.faces__caption {
  min-height: 1.3em;
  margin-top: 18px;
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 800;
  font-size: clamp(1.25rem, 1.1rem + 0.6vw, 1.5rem);
  line-height: 1.3;
  color: var(--gold-200);
  text-align: center;
}

/* ---------- stop/play: a quiet glass pill; faces.js shows it only where the run moves ---------- */
.faces__toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: var(--tap);
  margin-top: 14px;
  padding: 0 18px 0 16px;
  border: 1px solid var(--glass-line);
  border-radius: var(--radius-pill);
  background: var(--glass);
  color: var(--muted);
  font-family: var(--font-ui);
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.04em;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
/* Pause glyph (two bars); a play triangle while stopped. */
.faces__toggle::before {
  content: "";
  flex: none;
  width: 10px;
  height: 12px;
  border-inline: 3px solid currentColor;
}
.faces__toggle.is-stopped {
  border-color: rgba(var(--gold-a), 0.5);
  color: var(--gold-200);
}
.faces__toggle.is-stopped::before {
  border: 0;
  background: currentColor;
  clip-path: polygon(0 0, 100% 50%, 0 100%);
}
@media (hover: hover) {
  .faces__toggle:hover {
    background: var(--glass-strong);
    color: var(--text);
  }
}
/* While the toggle is hidden (no script, reduced motion) its space stays, so nothing jumps when it appears. */
.faces__toggle[hidden] + .faces__row {
  margin-top: calc(14px + var(--tap) + 14px);
}

/* ---------- row: five growing thumbnails on a gold timeline ---------- */
.faces__row {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  width: 100%;
  max-width: 460px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}
/* The line runs through the centres of the circles (each item is circle + gap + age label). */
.faces__row::before {
  content: "";
  position: absolute;
  top: calc(50% - (var(--age-gap) + var(--age-h)) / 2);
  left: calc(var(--t0) / 2);
  right: calc((var(--t0) + 4 * var(--step)) / 2);
  height: 1px;
  background: linear-gradient(90deg, rgba(var(--gold-a), 0.2), rgba(var(--gold-a), 0.75));
}
.faces__row li {
  --s: var(--t0);
  position: relative;
  display: flex;
}
.faces__row li:nth-child(2) {
  --s: calc(var(--t0) + var(--step));
}
.faces__row li:nth-child(3) {
  --s: calc(var(--t0) + 2 * var(--step));
}
.faces__row li:nth-child(4) {
  --s: calc(var(--t0) + 3 * var(--step));
}
.faces__row li:nth-child(5) {
  --s: calc(var(--t0) + 4 * var(--step));
}

.faces__thumb {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--age-gap);
  min-width: var(--tap);
  min-height: var(--tap);
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 14px;
  background: none;
  color: var(--muted);
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.faces__thumb img {
  width: var(--s);
  height: var(--s);
  border-radius: 50%;
  object-fit: cover;
  background: var(--night-800);
  box-shadow:
    0 0 0 1px rgba(var(--gold-a), 0.4),
    0 6px 16px rgba(3, 7, 20, 0.5);
  opacity: 0.72;
  transition:
    opacity var(--t-med) var(--ease),
    transform var(--t-med) var(--ease);
}
/* Active ring: drawn around the circle, it fades and settles in. */
.faces__thumb::before {
  content: "";
  position: absolute;
  top: -5px;
  left: 50%;
  width: calc(var(--s) + 10px);
  height: calc(var(--s) + 10px);
  margin-left: calc((var(--s) + 10px) / -2);
  border: 2px solid var(--gold-300);
  border-radius: 50%;
  box-shadow: 0 0 16px rgba(var(--gold-a), 0.45);
  opacity: 0;
  transform: scale(0.86);
  transition:
    opacity var(--t-med) var(--ease),
    transform var(--t-med) var(--ease);
  pointer-events: none;
}
.faces__age {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 12px;
  line-height: var(--age-h);
  letter-spacing: 0.02em;
}
.faces__thumb[aria-pressed="true"] {
  color: var(--gold-200);
}
.faces__thumb[aria-pressed="true"] img {
  opacity: 1;
}
.faces__thumb[aria-pressed="true"]::before {
  opacity: 1;
  transform: none;
}
.faces__thumb:active img {
  transform: scale(0.94);
}
@media (hover: hover) {
  .faces__thumb:hover {
    color: var(--text);
  }
  .faces__thumb:hover img {
    opacity: 1;
    transform: translateY(-2px);
  }
}
.faces__thumb:focus-visible {
  outline-offset: 4px;
}
@media (min-width: 480px) {
  .faces__age {
    font-size: 13px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .faces__layer,
  .faces__thumb img,
  .faces__thumb::before {
    transition: none;
  }
  .faces__thumb:active img,
  .faces__thumb:hover img {
    transform: none;
  }
}
