/* ==========================================================
   Hope Laugh Play · homepage v2 (Dec 2026)
   Loaded after styles.css on index.html only.
   Real photos, no eyebrow labels, cinematic but calm motion.
   ========================================================== */

/* Native smooth scroll fights ScrollTrigger; anchor links use JS. */
html { scroll-behavior: auto; }

/* Seven nav items need room: hamburger up to 960px */
@media (max-width: 960px) {
  .nav-links { display: none; }
  .menu-btn { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; padding: 0.65rem; }
}
.nav-links .nav-staff { gap: 0; }

/* ---------- Entrance states (only while .anim is on <html>) ---------- */
.anim .hx-line-in { transform: translate3d(0, 112%, 0); }
.anim .hx-fade { opacity: 0; transform: translate3d(0, 18px, 0); }
.anim [data-reveal] { opacity: 0; transform: translate3d(0, 28px, 0); }
.anim [data-reveal].is-in {
  opacity: 1; transform: none;
  transition: opacity 900ms var(--e-out), transform 1100ms var(--e-out);
  transition-delay: var(--d, 0ms);
}

/* ==========================================================
   HERO
   Wide screens: full-bleed film, words left of the figure.
   Portrait screens: film panel on top, words below on cream,
   so the copy can never sit on the character.
   ========================================================== */
.hx {
  position: relative;
  background: var(--cream);
  overflow: hidden;
  /* svh is fixed: the hero no longer resizes when the iOS bar hides */
  height: 100vh;
  height: 100svh;
  min-height: 600px;
}
.hx-media { position: absolute; inset: 0; overflow: hidden; background: #EFE7D8; }
/* Bleeds 8% top and bottom so the scroll drift never shows an edge */
.hx-media-inner { position: absolute; inset: -8% 0; will-change: transform; }
.hx-video,
.hx-still img,
.hx-alt {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  max-width: none;
  object-fit: cover; object-position: 50% 50%;
  pointer-events: none;
}
/* The first-frame still covers the film (and any native play button)
   until real frames are moving, then fades away. */
.hx-still { position: absolute; inset: 0; z-index: 1; }
.hx-still img { transition: opacity 700ms ease; }
.hx-media.is-live .hx-still img { opacity: 0; }
/* Low Power Mode copy for Safari: the same film played as an image */
.hx-alt { z-index: 2; opacity: 0; transition: opacity 600ms ease; }
.hx-alt.is-on { opacity: 1; }

/* Never show a native play button over the film.
   One rule per name: Safari drops a whole selector list
   if it does not know one of the names in it. */
.hx-video::-webkit-media-controls { display: none !important; -webkit-appearance: none; }
.hx-video::-webkit-media-controls-panel { display: none !important; -webkit-appearance: none; }
.hx-video::-webkit-media-controls-start-playback-button { display: none !important; -webkit-appearance: none; opacity: 0 !important; }
.hx-video::-webkit-media-controls-overlay-play-button { display: none !important; opacity: 0 !important; }
.hx-video::-webkit-media-controls-play-button { display: none !important; -webkit-appearance: none; }
.hx::after {
  content: ''; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: linear-gradient(90deg, rgba(250,246,238,0.94) 0%, rgba(250,246,238,0.78) 28%, rgba(250,246,238,0) 56%);
}
.hx-copy {
  position: relative; z-index: 2;
  height: 100%;
  display: flex; align-items: center;
  padding-top: 4.5rem;
}
.hx-content { max-width: min(40rem, 46vw); }
.hx-title {
  font-size: clamp(2.4rem, 4.4vw, 4.4rem);
  line-height: 1.04;
  letter-spacing: -0.045em;
  margin-bottom: 1.35rem;
  text-wrap: nowrap;
}
.hx-line { display: block; overflow: hidden; padding-bottom: 0.08em; margin-bottom: -0.08em; }
.hx-line-in { display: inline-block; white-space: nowrap; will-change: transform; }
.hx-title em { font-style: normal; color: var(--accent); }
.hx-lede {
  font-size: var(--lede);
  line-height: 1.6;
  color: var(--ink-soft);
  max-width: 30rem;
  margin-bottom: 2rem;
}
.hx-actions { display: flex; gap: 0.7rem; flex-wrap: wrap; }
.hx-down {
  position: absolute; z-index: 3;
  left: 50%; bottom: calc(1.4rem + env(safe-area-inset-bottom, 0px));
  width: 44px; height: 44px; margin-left: -22px;
  display: grid; place-items: center;
  border-radius: 50%;
  color: var(--ink);
  border: 1px solid var(--line-strong);
  background: rgba(250,246,238,0.65);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  transition: background 240ms, border-color 240ms;
}
.hx-down:hover { background: var(--paper); border-color: var(--ink); }
.hx-down i { font-size: 0.9rem; animation: hxBob 2.4s var(--e-soft) infinite; }
@keyframes hxBob { 0%, 100% { transform: translateY(-2px); } 50% { transform: translateY(4px); } }

/* Short landscape phones */
@media (max-height: 560px) and (min-aspect-ratio: 11/10) {
  .hx { min-height: 420px; }
  .hx-title { font-size: clamp(2rem, 6vh, 2.8rem); margin-bottom: 0.8rem; }
  .hx-lede { margin-bottom: 1.1rem; font-size: 0.98rem; }
  .hx-down { display: none; }
}

/* Portrait: stacked hero */
@media (max-aspect-ratio: 11/10) {
  .hx { height: auto; min-height: 0; display: flex; flex-direction: column; }
  .hx::after { display: none; }
  .hx-media {
    position: relative; inset: auto;
    height: min(60svh, 110vw);
    min-height: 300px;
    flex: none;
  }
  .hx-video, .hx-still img, .hx-alt { object-position: 50% 52%; }
  .hx-media::after {
    content: ''; position: absolute; inset: auto 0 0 0; height: 28%; z-index: 3;
    background: linear-gradient(to bottom, rgba(250,246,238,0), var(--cream));
    pointer-events: none;
  }
  .hx-copy { height: auto; display: block; padding: 0.5rem 0 clamp(2.5rem, 7vw, 4rem); }
  .hx-content { max-width: 38rem; }
  .hx-title { font-size: clamp(2.05rem, 8.6vw, 3.6rem); margin-bottom: 0.9rem; }
  .hx-lede { font-size: clamp(1rem, 2.4vw, 1.15rem); margin-bottom: 1.5rem; max-width: 34rem; }
  .hx-down { display: none; }
}
@media (max-aspect-ratio: 11/10) and (max-width: 600px) {
  .hx-actions .btn { flex: 1 1 0; justify-content: center; min-height: 50px; padding-inline: 1rem; }
}

/* ==========================================================
   INTRO: words brighten as you read down
   ========================================================== */
.intro { padding-block: clamp(4.5rem, 10vw, 8rem); }
.intro-quote { font-size: clamp(1.45rem, 2.8vw, 2.3rem); line-height: 1.38; }
.intro-quote .w { display: inline-block; will-change: opacity; }

/* ==========================================================
   MISSION
   ========================================================== */
.mx-photo {
  position: relative; margin: 0;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  border-radius: var(--r-lg);
  box-shadow: var(--sh-md);
  background: var(--cream-deep);
}
.mx-photo-in, .tb-photo-in { position: absolute; inset: 0; }
.mx-photo-in img, .tb-photo-in img { width: 100%; height: 100%; object-fit: cover; }
.mx-photo-in picture { display: block; width: 100%; height: 100%; }

/* Curtain: a paper panel lifts off the photo when it scrolls in */
[data-curtain]::after {
  content: ''; position: absolute; inset: 0; z-index: 2;
  background: var(--paper);
  transform-origin: 50% 0;
  transform: scaleY(0);
  pointer-events: none;
}
.anim [data-curtain]::after { transform: scaleY(1); }
.anim [data-curtain].is-in::after { transform: scaleY(0); transition: transform 1300ms cubic-bezier(0.77, 0, 0.18, 1); }

@media (max-width: 860px) {
  .mission-grid { grid-template-columns: 1fr; gap: 2.25rem; }
  .mx-photo { aspect-ratio: 4 / 4.4; }
}

/* ==========================================================
   STATS
   ========================================================== */
.stat-num .slash { color: var(--ink-soft); font-weight: 400; }

/* ==========================================================
   SHARED: stacked section heading (headline, then copy)
   ========================================================== */
.stack-head { max-width: 46rem; margin-bottom: clamp(2.25rem, 5vw, 3.75rem); }
.stack-head h2 { font-size: var(--h2); line-height: 1.12; margin-bottom: 1rem; }
.stack-head p { color: var(--ink-soft); font-size: 1.08rem; line-height: 1.7; max-width: 60ch; }

/* ==========================================================
   PROGRAMS: one tall story, two side stories, one wide row
   ========================================================== */
.pg {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: clamp(1rem, 2vw, 1.5rem);
}
.pg-card {
  display: flex; flex-direction: column;
  background: var(--cream);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.pg-a { grid-row: span 2; }
.pg-d { grid-column: 1 / -1; flex-direction: row; align-items: stretch; }
.pg-img { position: relative; overflow: hidden; aspect-ratio: 16 / 10; background: var(--cream-deep); }
.pg-a .pg-img { aspect-ratio: auto; flex: 1 1 auto; min-height: 340px; }
.pg-d .pg-img { aspect-ratio: 1; flex: none; width: min(34%, 300px); }
.pg-img img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  transform: scale(1.001);
  transition: transform 1400ms var(--e-out);
  scale: var(--z, 1);
}
.pg-card:hover .pg-img img { transform: scale(1.045); }
.pg-body { padding: clamp(1.25rem, 2.2vw, 1.75rem); }
.pg-d .pg-body { align-self: center; max-width: 62ch; padding: clamp(1.5rem, 3vw, 2.5rem); }
.pg-body h3 { font-size: var(--h3); margin-bottom: 0.55rem; line-height: 1.25; }
.pg-body p { color: var(--ink-soft); font-size: 0.99rem; line-height: 1.65; }

@media (max-width: 860px) {
  .pg { grid-template-columns: 1fr; }
  .pg-a { grid-row: auto; }
  .pg-a .pg-img { aspect-ratio: 1; min-height: 0; flex: none; }
  .pg-d { flex-direction: column; }
  .pg-d .pg-img { width: 100%; aspect-ratio: 16 / 10; }
}

/* ==========================================================
   GALLERY: an even grid, flush on every edge, tap to open.
   Twelve photos: eight regular, two tall, two wide, placed by
   name so no layout ever leaves a gap.
   ========================================================== */
.gallery { background: var(--cream); overflow: hidden; }
.gal-shell { container-type: inline-size; }
.gal {
  --cols: 4;
  --gap: clamp(0.6rem, 1.2vw, 1rem);
  display: grid;
  gap: var(--gap);
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  grid-auto-rows: 17vw;
  /* every regular tile is exactly 4:3 */
  grid-auto-rows: calc((100cqi - (var(--cols) - 1) * var(--gap)) / var(--cols) * 0.75);
  grid-template-areas:
    "w1 w1 r1 t1"
    "t2 r2 r3 t1"
    "t2 r4 w2 w2"
    "r5 r6 r7 r8";
}
.ga-w1 { grid-area: w1; } .ga-w2 { grid-area: w2; }
.ga-t1 { grid-area: t1; } .ga-t2 { grid-area: t2; }
.ga-r1 { grid-area: r1; } .ga-r2 { grid-area: r2; } .ga-r3 { grid-area: r3; } .ga-r4 { grid-area: r4; }
.ga-r5 { grid-area: r5; } .ga-r6 { grid-area: r6; } .ga-r7 { grid-area: r7; } .ga-r8 { grid-area: r8; }
.gal-item {
  position: relative; display: block; width: 100%; height: 100%; padding: 0;
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--cream-deep);
  cursor: zoom-in;
  isolation: isolate;
}
.gal-item img {
  position: absolute; inset: 0;
  width: 100%; height: 100%; max-width: none;
  object-fit: cover;
  scale: var(--z, 1);
  transition: transform 1100ms var(--e-out);
}
.gal-item:hover img { transform: scale(1.045); }
.gal-item:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* Tablets: three across */
@media (max-width: 1023px) {
  .gal {
    --cols: 3;
    grid-template-areas:
      "w1 w1 t1"
      "t2 r1 t1"
      "t2 r2 r3"
      "r4 w2 r5"
      "r6 r7 r8";
  }
}
/* Phones: two across, the wide photos run edge to edge */
@media (max-width: 700px) {
  .gal {
    --cols: 2;
    --gap: 0.55rem;
    grid-template-areas:
      "w1 w1"
      "r1 t1"
      "t2 t1"
      "t2 r2"
      "r3 r4"
      "w2 w2"
      "r5 r6"
      "r7 r8";
  }
  .gal-item { border-radius: var(--r-md); }
}

/* ==========================================================
   PROMISE: one big number, one plain statement
   ========================================================== */
.promise { background: var(--wash-promise, var(--paper)); text-align: left; }
.promise-grid {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: clamp(2rem, 6vw, 5rem);
  align-items: center;
  max-width: 1040px;
}
.promise-num {
  justify-self: start;
  width: fit-content;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 800;
  font-size: clamp(5rem, 13vw, 10.5rem);
  line-height: 0.9;
  letter-spacing: -0.06em;
  color: var(--ink);
}
.pn-line { display: flex; align-items: baseline; }
/* Solid digits (an ink-fill effect clipped the last zero) */
.pn-digits {
  display: inline-block;
  text-align: left;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.pn-pct { display: inline-block; color: var(--accent); transform-origin: 30% 90%; }
/* Ten LEGO bricks, one per 10%, in the logo's three face colours */
.pn-bricks {
  display: flex; gap: 0.035em;
  margin-top: 0.16em;
  padding-top: 0.035em;
}
.pn-bricks i {
  --c: #5FA8D3;
  position: relative;
  flex: 1 1 0;
  height: 0.105em;
  border-radius: 0.016em;
  background: var(--c);
  box-shadow: inset 0 -0.018em 0 rgba(0,0,0,0.14);
}
.pn-bricks i:nth-child(3n+2) { --c: #7DB04B; }
.pn-bricks i:nth-child(3n) { --c: var(--accent); }
.pn-bricks i::before,
.pn-bricks i::after {
  content: '';
  position: absolute; top: -0.03em;
  width: 28%; height: 0.032em;
  border-radius: 0.012em 0.012em 0 0;
  background: var(--c);
}
.pn-bricks i::before { left: 14%; }
.pn-bricks i::after { right: 14%; }
.promise .promise-copy h2 { font-size: var(--h2); margin-bottom: 1rem; }
.promise .promise-copy p { color: var(--ink-soft); font-size: 1.05rem; line-height: 1.7; margin: 0 0 0.75rem; max-width: 52ch; text-align: left; }
@media (max-width: 700px) {
  .promise-grid { grid-template-columns: 1fr; gap: 1.25rem; }
  .promise-num { font-size: clamp(4.5rem, 24vw, 6.5rem); }
}

/* ==========================================================
   STORIES
   ========================================================== */
.stories-grid { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(1.25rem, 3vw, 2.25rem); max-width: none; }
.stories .story {
  margin: 0; padding: clamp(1.6rem, 3vw, 2.4rem);
  background: var(--cream);
  border-radius: var(--r-lg);
  border-top: 0;
}
.stories .story blockquote {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 500;
  font-size: clamp(1.12rem, 1.7vw, 1.35rem);
  line-height: 1.5;
  letter-spacing: -0.015em;
  color: var(--ink);
  margin-bottom: 1.25rem;
}
.stories .story figcaption { color: var(--body); font-size: 0.95rem; }
@media (max-width: 760px) { .stories-grid { grid-template-columns: 1fr; } }

/* ==========================================================
   TEAM BAND
   ========================================================== */
.team-band { background: var(--paper); padding: clamp(1rem, 4vw, 3rem) 0 clamp(4.5rem, 9vw, 7.5rem); }
.tb-photo {
  position: relative; margin: 0;
  aspect-ratio: 2 / 1;
  overflow: hidden;
  border-radius: var(--r-lg);
  background: var(--cream-deep);
  scale: var(--s, 1);
}
.tb-photo-in img { object-position: 50% 38%; }
.tb-row {
  display: flex; justify-content: space-between; align-items: flex-end;
  gap: 1.5rem 2.5rem; flex-wrap: wrap;
  margin-top: clamp(1.75rem, 3vw, 2.5rem);
}
.tb-title { font-size: var(--h2); line-height: 1.15; max-width: 24ch; }
.tb-aside { display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap; }
@media (max-width: 700px) {
  .tb-photo { aspect-ratio: 4 / 3; }
  .tb-aside { width: 100%; justify-content: space-between; }
}

/* ==========================================================
   CTA + footer credit
   ========================================================== */
.cta .wrap-narrow { position: relative; z-index: 1; }

/* ==========================================================
   LIGHTBOX
   ========================================================== */
.lb {
  position: fixed; inset: 0; z-index: 90;
  display: grid; place-items: center;
  padding: calc(4rem + env(safe-area-inset-top, 0px)) 1rem calc(4.5rem + env(safe-area-inset-bottom, 0px));
  background: rgba(18, 21, 30, 0.94);
  opacity: 0; transition: opacity 260ms var(--e-out);
}
.lb.is-open { opacity: 1; }
.lb[hidden] { display: none; }
.lb-img {
  max-width: min(94vw, 1100px); max-height: 100%;
  width: auto; height: auto;
  border-radius: var(--r-md);
  box-shadow: 0 30px 80px rgba(0,0,0,0.45);
  transform: scale(0.97); transition: transform 380ms var(--e-out);
}
.lb.is-open .lb-img { transform: scale(1); }
.lb-close, .lb-nav {
  position: absolute; display: grid; place-items: center;
  width: 48px; height: 48px; border-radius: 50%;
  color: #fff; background: rgba(255,255,255,0.1);
  transition: background 200ms;
}
.lb-close:hover, .lb-nav:hover { background: rgba(255,255,255,0.2); }
.lb-close { top: calc(1rem + env(safe-area-inset-top, 0px)); right: 1rem; font-size: 1.3rem; }
.lb-prev { left: 1rem; top: 50%; transform: translateY(-50%); }
.lb-next { right: 1rem; top: 50%; transform: translateY(-50%); }
.lb-cap {
  position: absolute; left: 1rem; right: 1rem;
  bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px));
  text-align: center; color: rgba(255,255,255,0.78); font-size: 0.95rem;
}
@media (max-width: 700px) {
  .lb-prev, .lb-next { top: auto; transform: none; bottom: calc(3.4rem + env(safe-area-inset-bottom, 0px)); }
  .lb-cap { font-size: 0.88rem; }
}

/* ==========================================================
   Reduced motion: everything still, nothing hidden
   ========================================================== */
@media (prefers-reduced-motion: reduce) {
  .hx-down i { animation: none; }
  [data-curtain]::after { display: none; }
  .gal-item img, .pg-img img { transition: none; }
  .gal-item:hover img, .pg-card:hover .pg-img img { transform: none; }
}
