/* Sandwich Open Mic collection (comunidad) - layout and motion, from
   David's 2026-10-03 prototype. Load after /shared/tokens.css, which
   supplies the reset, font stack, link and focus styles. The colour
   palette (:root --background/--text/--muted/--accent/--line, light and
   dark) lives in the page's own <style> block, per tokens.css's
   convention, so the contrast check can verify it. */

:root {
  --measure: 42rem;
  --wide: 74rem;
}

html {
  scroll-behavior: smooth;
}

body {
  font-size: clamp(1rem, 0.96rem + 0.18vw, 1.125rem);
  line-height: 1.6;
}

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

figure {
  margin: 0;
}

a {
  text-underline-offset: 0.22em;
}

a:hover {
  text-decoration-thickness: 0.14em;
}

/* Top bar: back to the comunidad index, language switch. */
.topbar {
  width: min(calc(100% - 2.5rem), var(--wide));
  margin-inline: auto;
  min-height: 4.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  font-size: 0.95rem;
}

.topbar .home {
  font-weight: 700;
}

.languages {
  color: var(--muted);
}

.languages a {
  color: inherit;
}

.languages a[aria-current="page"] {
  color: var(--text);
  font-weight: 700;
  text-decoration: none;
}

.separator {
  margin: 0 0.55rem;
  color: var(--line);
}

.wrap,
.text-column {
  width: min(calc(100% - 2.5rem), var(--measure));
  margin-inline: auto;
}

.hero {
  min-height: 92svh;
  padding-block: clamp(3rem, 9vh, 7rem) 4rem;
  position: relative;
}

.eyebrow {
  margin: 0 0 1.2rem;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  max-width: 8ch;
  font-size: clamp(4.5rem, 14vw, 9.5rem);
  line-height: 0.78;
  letter-spacing: -0.065em;
  font-weight: 700;
}

.years {
  margin: 1.5rem 0 0;
  font-size: clamp(1.4rem, 3vw, 2rem);
  color: var(--muted);
  letter-spacing: 0.06em;
}

.opening-sticker {
  width: clamp(8rem, 20vw, 13rem);
  margin: clamp(3rem, 9vh, 6rem) 0 0 auto;
  border-radius: 50%;
  rotate: 2deg;
}

.intro {
  padding-block: clamp(3rem, 8vw, 7rem) clamp(7rem, 14vw, 12rem);
  font-size: clamp(1.25rem, 2.2vw, 1.7rem);
  line-height: 1.5;
}

.intro p:last-child {
  margin-top: 2.5rem;
  font-weight: 700;
}

.poster {
  width: min(calc(100% - 3rem), 38rem);
  margin: 0 auto clamp(8rem, 15vw, 13rem);
}

.poster img {
  width: 100%;
  box-shadow: 0 0.7rem 2rem rgb(36 33 30 / 0.08);
}

.small-poster {
  width: min(calc(100% - 4rem), 30rem);
}

.pair {
  width: min(calc(100% - 2.5rem), 66rem);
  margin: 0 auto clamp(9rem, 16vw, 14rem);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(1.25rem, 4vw, 4rem);
  align-items: start;
}

.pair figure.lower {
  margin-top: clamp(3rem, 8vw, 8rem);
}

.warm-pair img,
.narrow-pair img,
.solo img,
.feature-portrait img,
.closing-portrait img,
.afterword-portrait img {
  width: 100%;
}

.narrow-pair {
  width: min(calc(100% - 3rem), 56rem);
}

.wide-photo {
  width: min(90vw, 70rem);
  margin-bottom: clamp(9rem, 16vw, 15rem);
}

.wide-photo img {
  width: 100%;
}

.edge-left {
  margin-left: max(1.25rem, calc((100vw - 78rem) / 2));
  margin-right: auto;
}

.edge-right {
  margin-right: max(1.25rem, calc((100vw - 78rem) / 2));
  margin-left: auto;
}

.stickers {
  width: min(calc(100% - 3rem), 62rem);
  margin: 0 auto clamp(10rem, 18vw, 16rem);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(0.8rem, 2.5vw, 2rem);
  align-items: center;
}

.stickers img {
  border-radius: 50%;
}

.stickers img:nth-child(1) {
  rotate: -2deg;
}

.stickers img:nth-child(2) {
  translate: 0 1.7rem;
  rotate: 1.3deg;
}

.stickers img:nth-child(3) {
  rotate: -1deg;
}

.feature-portrait {
  width: min(calc(100% - 4rem), 37rem);
  margin: 0 auto clamp(10rem, 18vw, 16rem);
}

.solo {
  width: min(calc(100% - 4rem), 35rem);
  margin-bottom: clamp(10rem, 18vw, 16rem);
}

.offset-right {
  margin-left: auto;
  margin-right: max(2rem, calc((100vw - 64rem) / 2));
}

.offset-left {
  margin-right: auto;
  margin-left: max(2rem, calc((100vw - 64rem) / 2));
}

.roomy {
  margin-top: 2rem;
}

.cinematic {
  width: min(92vw, 76rem);
  margin: 0 auto clamp(11rem, 20vw, 18rem);
}

.cinematic img {
  width: 100%;
}

.emphatic {
  width: min(94vw, 80rem);
}

.drift-frame {
  overflow: hidden;
}

.drift-frame img {
  width: 106%;
  max-width: none;
  transform-origin: center;
}

.closing-portrait {
  width: min(calc(100% - 5rem), 27rem);
  margin: 0 auto clamp(8rem, 15vw, 13rem);
}

.outro {
  padding-block: 0 clamp(7rem, 14vw, 12rem);
}

.outro h2 {
  margin: 0 0 1.5rem;
  font-size: clamp(2rem, 5vw, 3.6rem);
  line-height: 1.05;
  letter-spacing: -0.035em;
}

.outro p {
  max-width: 38rem;
}

.outro p:last-child {
  margin-top: 2rem;
  font-weight: 700;
}

.afterword-portrait {
  width: min(calc(100% - 6rem), 23rem);
  margin-left: max(3rem, calc((100vw - 58rem) / 2));
  margin-bottom: clamp(16rem, 32vw, 30rem);
}

.last-word {
  width: min(calc(100% - 3rem), 48rem);
  margin: 0 auto;
  padding: 0 0 clamp(10rem, 24vw, 20rem);
  border: 0;
  text-align: center;
}

.last-word p {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 6vw, 4.6rem);
  line-height: 1.1;
  font-style: italic;
  letter-spacing: -0.025em;
}

.last-word footer {
  margin-top: 1.5rem;
  color: var(--muted);
}

/* Scroll-driven motion. Browsers without scroll timelines skip the
   whole block and show the images still. */
@supports (animation-timeline: view()) {
  /* Feature portrait: a visible rise-and-settle entrance. */
  .sparkle {
    animation: sparkle-in linear both;
    animation-timeline: view();
    animation-range: entry 0% cover 35%;
  }

  @keyframes sparkle-in {
    from {
      opacity: 0.75;
      transform: translateY(55px) scale(0.93);
    }

    to {
      opacity: 1;
      transform: translateY(0) scale(1);
    }
  }

  /* Motion portrait: slow drift and zoom inside a clipped frame. */
  .drift-frame img {
    animation: gentle-drift linear both;
    animation-timeline: view();
    animation-range: entry 0% exit 70%;
  }

  @keyframes gentle-drift {
    from {
      transform: translateX(-4%) scale(1.08);
    }

    to {
      transform: translateX(3%) scale(1.02);
    }
  }

  /* Arms-outstretched photo: a dramatic push-in as it crosses the viewport. */
  .dramatic-zoom {
    overflow: hidden;
  }

  .dramatic-zoom img {
    animation: dramatic-push-in linear both;
    animation-timeline: view();
    animation-range: entry 0% exit 85%;
    transform-origin: 50% 42%;
  }

  @keyframes dramatic-push-in {
    from {
      transform: scale(1);
    }

    to {
      transform: scale(1.24);
    }
  }

  /* Duo photo: cinematic lateral pan, overscan hidden by the frame. */
  .cinematic-pan {
    overflow: hidden;
  }

  .cinematic-pan img {
    width: 112%;
    max-width: none;
    animation: cinematic-pan-across linear both;
    animation-timeline: view();
    animation-range: entry 0% exit 90%;
    transform-origin: center;
  }

  @keyframes cinematic-pan-across {
    from {
      transform: translateX(-7%) scale(1.08);
    }

    to {
      transform: translateX(-1%) scale(1.08);
    }
  }
}

@media (prefers-color-scheme: dark) {
  .poster img {
    box-shadow: 0 0.7rem 2rem rgb(0 0 0 / 0.2);
  }
}

@media (max-width: 650px) {
  .hero {
    min-height: auto;
    padding-top: 3rem;
  }

  h1 {
    font-size: clamp(4rem, 22vw, 6.5rem);
  }

  .opening-sticker {
    width: 8.5rem;
  }

  .pair {
    grid-template-columns: 1fr;
    width: min(calc(100% - 3rem), 34rem);
    gap: 1.5rem;
  }

  .pair figure.lower {
    margin-top: 0;
  }

  .stickers {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
  }

  .stickers img:nth-child(2) {
    translate: 0 0.7rem;
  }

  .wide-photo,
  .cinematic {
    width: calc(100% - 1.5rem);
  }

  .edge-left,
  .edge-right,
  .offset-left,
  .offset-right {
    margin-inline: auto;
  }

  .afterword-portrait {
    margin-left: 2rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    transform: none !important;
  }
}
