/* assets/home.css — front page only (sun-cycle bands + scroll reveals).
   site.css stays shared with /approach/; everything here is additive.
   Arc: sunset hero -> night (others' approaches) -> sunrise (easymaking)
        -> morning (who) -> midday blue (you can become). */

/* ---------- bands ---------- */
.band { position: relative; overflow: hidden; }
.band-inner {
  position: relative; z-index: 2;
  max-width: 880px; margin: 0 auto; padding: 3rem 1.5rem;
}

/* grain texture, shared by every band */
.band::before {
  content: ''; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix type='saturate' values='0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  opacity: 0.05;
  transform: translateZ(0); /* own layer: mobile Safari re-rasterizes these
     full-band noise tiles during scroll — reads as sky shimmer */
}

/* ---------- WebGL sky (sun.js) ----------
   #skyfx + html.webgl exist only after sun.js renders its first frame.
   Until then (no-JS, reduced-motion, no-WebGL, context loss) the band
   gradients below ARE the sky — never make them transparent otherwise. */
#skyfx {
  /* pinned to the LARGE viewport: the mobile URL-bar show/hide must never
     resize this box (a per-frame fixed-box resize stretches the GL buffer
     against stale uniforms — visible as horizon jitter while scrolling) */
  position: fixed; top: 0; left: 0; z-index: -1;
  width: 100vw; height: 100vh; height: 100lvh;
  display: block; pointer-events: none;
  /* own compositor layer: iOS Safari re-rasterizes negative-z fixed
     layers mid-scroll, flashing the body background through the
     transparent bands (sky flicker on slow touch scrolls) */
  will-change: transform;
  transform: translateZ(0);
  backface-visibility: hidden;
}
html.webgl .hero-track, html.webgl .band-hero, html.webgl .band-night,
html.webgl .band-dawn, html.webgl .band-midday {
  background: transparent;
}
/* shader renders the stars itself */
html.webgl .band-night::after { display: none; }
/* morning ::after becomes the backlight: a warm spot that follows the sun
   behind the panel (sun.js drives --sunlit / --sun-y every frame) */
html.webgl .band-morning::after {
  content: ''; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  width: auto; height: auto; border-radius: 0; transform: none;
  background:
    radial-gradient(circle 9rem at 72% var(--sun-y, 45%),
      rgba(255, 255, 250, 0.95) 0%, rgba(255, 255, 250, 0) 72%),
    radial-gradient(circle 28rem at 72% var(--sun-y, 45%),
      rgba(255, 233, 158, 0.75) 0%, rgba(255, 233, 158, 0) 72%),
    linear-gradient(rgba(255, 248, 228, 0.18), rgba(255, 248, 228, 0.18));
  opacity: var(--sunlit, 0);
}
/* morning: the whole band is a full-bleed semi-translucent panel — the sun
   hides straight behind it, its brightness reading through */
html.webgl .band-morning {
  /* thins a touch while the sun is behind it — more light gets through */
  background: rgba(250, 245, 234, calc(0.72 - 0.12 * var(--sunlit, 0)));
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid rgba(255, 255, 255, 0.45);
  border-bottom: 1px solid rgba(255, 255, 255, 0.45);
}

/* ---------- 1. hero: setting sun (pinned while the phrase cycles) ---------- */
.hero-track { height: 100vh; background: #3A2C3A; }
.band-hero {
  position: sticky; top: 0; height: 80vh;
  display: flex; flex-direction: column;
  background: linear-gradient(180deg,
    #FDF8EF 0%, #FAE9D2 38%, #F6C794 64%, #EE9A5F 82%, #D96B3C 100%);
}
.band-hero .nav { width: 100%; max-width: 880px; }
/* bottom-anchored under the sun's 25vh start. All three lines are
   fixed-height — the scramble only changes the last line's length,
   never the block height, so nothing shakes. */
.hero-inner {
  flex: 1; display: flex; flex-direction: column; justify-content: flex-end;
  padding-top: 2.5rem; padding-bottom: 24vh;
}
.hero-inner h1 {
  /* explicit breaks, viewport-conditional: desktop 3 lines (.br-d),
     mobile 4 lines (.br-m) — see the 680px block */
  font-size: clamp(2.1rem, 5vw, 3.25rem); font-weight: 700;
  line-height: 1.12;
}
.br-m { display: none; }
.hero-inner h1 em { font-style: italic; color: var(--accent); transition: color 0.5s ease; }
/* the transforming phrase rides inline with the rest of the sentence */
#hero-swap { display: inline; }
/* each step cools toward the midday sky at the bottom of the page */
.hero-inner h1 em[data-idx="1"] { color: #8B5E9E; }
.hero-inner h1 em[data-idx="2"] { color: #6FA9CE; }

/* ---------- 2. night: the struggle ---------- */
.band-night {
  background: linear-gradient(180deg, #3A2C3A 0%, #221E33 30%, #131325 65%, #0E0F1D 100%);
  color: #D9D5E3;
}
.band-night::before { opacity: 0.08; }
/* sparse stars */
.band-night::after {
  content: ''; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    radial-gradient(1.4px 1.4px at 12% 28%, rgba(255,255,255,0.8) 50%, transparent 51%),
    radial-gradient(1px 1px at 28% 64%, rgba(255,255,255,0.55) 50%, transparent 51%),
    radial-gradient(1.6px 1.6px at 41% 18%, rgba(255,255,255,0.7) 50%, transparent 51%),
    radial-gradient(1px 1px at 57% 47%, rgba(255,255,255,0.5) 50%, transparent 51%),
    radial-gradient(1.3px 1.3px at 68% 25%, rgba(255,255,255,0.75) 50%, transparent 51%),
    radial-gradient(1px 1px at 79% 58%, rgba(255,255,255,0.5) 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 88% 34%, rgba(255,255,255,0.65) 50%, transparent 51%),
    radial-gradient(1px 1px at 19% 81%, rgba(255,255,255,0.4) 50%, transparent 51%),
    radial-gradient(1.2px 1.2px at 64% 78%, rgba(255,255,255,0.45) 50%, transparent 51%),
    radial-gradient(1px 1px at 93% 72%, rgba(255,255,255,0.4) 50%, transparent 51%);
}
.band-night .band-inner { padding: 2.5rem 1.5rem; }

.big-quote {
  font-family: 'Zodiak', serif; font-weight: 400;
  font-size: clamp(1.4rem, 3.1vw, 2.05rem); line-height: 1.45;
  margin: 0; max-width: 32ch;
  text-wrap: pretty; /* no single-word last lines on narrow screens */
}
.band-night .big-quote em { font-style: italic; color: #A9B6D6; }

/* ---------- 3. sunrise: the easymaking turn ---------- */
.band-dawn {
  /* night remnants at the very top giving way to dawn */
  background: linear-gradient(180deg,
    #1A1729 0%, #5C3F51 6%, #C98C76 13%, #F2D3A8 26%,
    #F7E3C2 55%, #FBCF8C 84%, #F8AC60 100%);
}
.band-dawn .band-inner { padding: 5rem 1.5rem 3.5rem 1.5rem; }
.band-dawn .big-quote { color: #3A2A1C; }
.band-dawn .big-quote em { font-style: italic; color: #B23E1D; white-space: nowrap; }

/* ---------- 4. morning: who ---------- */
.band-morning {
  background: linear-gradient(180deg, #F8EEDC 0%, #F0F0E6 55%, #E3EEF2 100%);
}
.band-morning::after {
  content: ''; position: absolute; z-index: 0;
  width: 34rem; height: 34rem; border-radius: 50%;
  right: -9rem; top: 50%; transform: translateY(-50%);
  background: radial-gradient(circle, rgba(255, 224, 150, 0.4) 0%, rgba(255, 224, 150, 0) 70%);
}
.who-grid {
  display: grid; grid-template-columns: 200px 1fr; gap: 3rem; align-items: start;
}
.swap-title {
  font-family: 'Zodiak', serif; font-weight: 700;
  font-size: clamp(1.6rem, 3.4vw, 2.3rem); line-height: 1.2;
  margin: 0 0 0.4em 0; letter-spacing: -0.01em;
}
.who-name {
  display: block; margin-top: 0.25em;
  font-family: 'Bricolage Grotesque', system-ui, sans-serif;
  font-weight: 600; font-size: 0.82rem; letter-spacing: 0.13em;
  text-transform: uppercase; color: var(--muted);
}
.band-morning p { color: var(--body); margin: 1.2em 0 0.4em 0; }

/* Facilitator -> Easy-maker scramble-rewrite (reverses when scrolled away) */
.swap-word { transition: color 0.6s ease; }
.swap-word.swapped { color: var(--accent); font-style: italic; }

/* headshot */
.headshot { margin: 0; }
.headshot img, .headshot.pending::before {
  display: block; width: 200px; height: 200px; object-fit: cover; border-radius: 50%;
}
.headshot.pending img { display: none; }
.headshot.pending::before {
  content: '';
  background: linear-gradient(135deg, rgba(217,79,48,0.18), rgba(242,183,91,0.25));
  border: 1px solid var(--rule);
}

/* wants list */
.wants { margin: 0.5em 0 0 0; padding: 0; list-style: none; max-width: 56ch; }
.wants li { color: var(--body); padding: 0.8em 0 0.8em 1.6rem; position: relative; font-size: 1.05rem; }
.wants li + li { border-top: 1px solid var(--rule); }
.wants li::before {
  content: ''; position: absolute; left: 0; top: 1.45em;
  width: 0.55rem; height: 0.55rem; border-radius: 50%;
  background: var(--accent); opacity: 0.8;
}

/* ---------- 5. midday: you can become ---------- */
.band-midday {
  background: linear-gradient(180deg, #D7EAF2 0%, #A8CFE5 40%, #6FA9CE 100%);
  color: #14334A; text-align: center;
}
.band-midday::before { opacity: 0.04; }
/* soft clouds */
.band-midday::after {
  content: ''; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    radial-gradient(38% 16% at 18% 24%, rgba(255,255,255,0.65) 0%, rgba(255,255,255,0) 70%),
    radial-gradient(30% 13% at 76% 16%, rgba(255,255,255,0.55) 0%, rgba(255,255,255,0) 70%),
    radial-gradient(44% 15% at 55% 70%, rgba(255,255,255,0.35) 0%, rgba(255,255,255,0) 70%);
}
.band-midday .band-inner { padding: 3.5rem 1.5rem 4rem 1.5rem; }
.band-midday h2 {
  font-family: 'Zodiak', serif; font-weight: 700;
  font-size: clamp(2rem, 4.6vw, 3rem); line-height: 1.15; margin: 0; letter-spacing: -0.01em;
}
.band-midday h2 { text-wrap: balance; }
.band-midday .quiet {
  color: #2B5570; font-size: 1.15rem; margin: 1em auto 0 auto;
  text-wrap: balance; /* phone width orphaned "life." onto its own line */
}
/* full-bleed: one line whenever the window is wide enough, wraps below that.
   Centered via margins, NOT transform — the .reveal transition owns transform */
.band-midday .invite {
  color: #2B5570; font-size: 1rem;
  width: 100vw; margin: 1.6em 0 0 calc(50% - 50vw);
  padding: 0 1.5rem;
  text-wrap: pretty;
}
.band-midday .invite em { font-style: italic; }
.band-midday .invite a { color: #14334A; }
.band-midday .cta-row { margin-top: 1.4rem; }
.cta-big {
  display: inline-block; padding: 0.9rem 2.2rem; border-radius: 99px;
  background: #14334A; color: #EFF7FB; text-decoration: none;
  font-weight: 500; font-size: 1.05rem;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.cta-big:hover { transform: translateY(-2px); box-shadow: 0 10px 30px rgba(10, 30, 45, 0.35); }
.cta-big:focus-visible, .band-midday .invite a:focus-visible { outline: 2px solid #14334A; outline-offset: 3px; }

/* footer on deep blue night */
.foot-dark { background: #122433; }
.foot-dark .foot, .foot-dark .foot a { color: rgba(223, 234, 242, 0.55); }

/* ---------- scroll reveals (reversible) ----------
   hidden state only when reveal.js ran (html.js);
   no-JS and reduced-motion users see everything immediately */
html.js .reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 1s cubic-bezier(0.22, 1, 0.36, 1),
              transform 1s cubic-bezier(0.22, 1, 0.36, 1);
}
html.js .reveal.in { opacity: 1; transform: none; }
html.js .reveal.d2 { transition-delay: 0.22s; }
html.js .reveal.d3 { transition-delay: 0.44s; }
html.js .reveal.d4 { transition-delay: 0.66s; }
/* exits shouldn't lag behind the scroll */
html.js .reveal:not(.in) { transition-delay: 0s; transition-duration: 0.45s; }

/* scroll-linked text fades: sun.js drives --herofade / --nightfade every
   frame as the next section's mood takes over the sky */
html.webgl.js .hero-inner h1.reveal.in { opacity: var(--herofade, 1); transition-duration: 0.25s; }
html.webgl.js .band-night .big-quote.reveal.in { opacity: var(--nightfade, 1); transition-duration: 0.25s; }

@media (max-width: 680px) {
  .band-inner, .band-night .band-inner, .band-dawn .band-inner, .band-midday .band-inner {
    padding-top: 2.5rem; padding-bottom: 2.5rem;
  }
  .band-dawn .band-inner { padding-top: 4rem; }
  .hero-track { height: 94vh; }
  .band-hero { height: 74vh; }
  /* the blanket .band-inner padding override above would flatten the
     hero's 24vh bottom anchor — without it the pinned headline sits at
     the hero's bottom edge and the rising night horizon climbs through
     it mid-pin. Keep the anchor: horizon clears the text before unpin. */
  .hero-inner { padding-bottom: 24vh; }
  /* headline: 4 lines, sized so the longest ("everything in your life")
     fills the narrow viewport without a stray 5th-line wrap */
  .br-m { display: inline; }
  .br-d { display: none; }
  .hero-inner h1 { font-size: clamp(1.5rem, 7vw, 3.25rem); }
  /* let the key phrase wrap naturally — nowrap forced "obviousness of
     sensation." onto its own line (or off-screen) at phone widths */
  .band-dawn .big-quote em { white-space: normal; }
  .who-grid { grid-template-columns: 1fr; gap: 2rem; }
  .headshot img, .headshot.pending::before { width: 160px; height: 160px; }
}

@media (prefers-reduced-motion: reduce) {
  .cta-big { transition: none; }
}
