/* Sleep Station — the landing page.
   One idea: a night, told slowly. A moon, one sentence, then the night itself as you scroll.
   Nothing here decorates; every element is either the story or the way in.

   Robustness rule: the page is complete with no JavaScript and no animation. The default
   state is the finished, still page. `html.js` (set by site.js) turns the night into the
   scroll-driven scene; `html.anim` (set only when the visitor has not asked for reduced
   motion) adds the autonomous motion — entrances, the breathing moon, drifting stars. */

.landing { background-image: linear-gradient(180deg, #0B0E22 0%, #0D1126 40%, #0D1126 100%); }
.landing main { position: relative; z-index: 1; }

/* ——— Stars: two layers, the slower one further away ——— */
.stars { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.stars i { position: absolute; inset: -10%; display: block; background-repeat: repeat; }
.stars .far {
  background-image:
    radial-gradient(1px 1px at 12% 18%, rgba(246, 235, 217, 0.7) 50%, transparent 52%),
    radial-gradient(1px 1px at 37% 64%, rgba(246, 235, 217, 0.55) 50%, transparent 52%),
    radial-gradient(1px 1px at 58% 28%, rgba(246, 235, 217, 0.6) 50%, transparent 52%),
    radial-gradient(1px 1px at 81% 72%, rgba(246, 235, 217, 0.5) 50%, transparent 52%),
    radial-gradient(1px 1px at 92% 12%, rgba(246, 235, 217, 0.6) 50%, transparent 52%),
    radial-gradient(1px 1px at 24% 88%, rgba(246, 235, 217, 0.45) 50%, transparent 52%),
    radial-gradient(1px 1px at 70% 50%, rgba(246, 235, 217, 0.5) 50%, transparent 52%);
  background-size: 640px 640px;
}
.stars .near {
  background-image:
    radial-gradient(1.6px 1.6px at 8% 40%, var(--cream) 50%, transparent 52%),
    radial-gradient(1.4px 1.4px at 44% 12%, var(--cream) 50%, transparent 52%),
    radial-gradient(1.8px 1.8px at 66% 78%, var(--accent-soft) 50%, transparent 52%),
    radial-gradient(1.4px 1.4px at 88% 36%, var(--cream) 50%, transparent 52%),
    radial-gradient(1.6px 1.6px at 28% 70%, var(--cream) 50%, transparent 52%);
  background-size: 900px 900px;
}
.anim .stars .far { animation: drift 120s linear infinite; }
.anim .stars .near { animation: drift 200s linear infinite reverse, twinkle 6s ease-in-out infinite alternate; }
@keyframes drift { from { transform: translate3d(0, 0, 0); } to { transform: translate3d(-64px, 32px, 0); } }
@keyframes twinkle { from { opacity: 0.55; } to { opacity: 1; } }

/* ——— Top bar: the name, and one quiet link ——— */
.top { position: absolute; top: 0; left: 0; right: 0; z-index: 5; }
.top .wrap { display: flex; align-items: center; justify-content: space-between; height: 84px; }
.top a.quiet { color: var(--text-3); font-size: 14px; font-weight: 500; }
.top a.quiet:hover { color: var(--text-1); text-decoration: none; }

/* ——— Hero ——— */
.hero { position: relative; min-height: 100vh; min-height: 100svh; display: grid; place-items: center; text-align: center; padding: 120px 0 160px; }
.hero-inner { display: flex; flex-direction: column; align-items: center; gap: 40px; max-width: 820px; margin-inline: auto; }
.moon-wrap { will-change: transform; }
.moon {
  --size: clamp(150px, 20vw, 220px);
  width: var(--size); height: var(--size); border-radius: 50%; position: relative;
  background: radial-gradient(circle at 38% 34%, #FFF8EA 0%, #F6EBD9 36%, #E8D1A6 70%, #C6AE88 100%);
  box-shadow:
    0 0 60px rgba(246, 217, 168, 0.35),
    0 0 180px rgba(246, 217, 168, 0.16),
    0 0 360px rgba(155, 123, 255, 0.16);
}
.moon::after {
  content: ''; position: absolute; inset: 0; border-radius: 50%; mix-blend-mode: overlay; opacity: 0.55;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
/* 4-7-8: in for four, hold for seven, out for eight. The app's own breathing pacer. */
.anim .moon { animation: breathe 19s ease-in-out infinite; will-change: transform; }
@keyframes breathe {
  0% { transform: scale(1); }
  21% { transform: scale(1.07); }
  58% { transform: scale(1.07); }
  100% { transform: scale(1); }
}
.hero h1 { font-size: clamp(46px, 7.4vw, 96px); font-weight: 700; letter-spacing: -0.035em; line-height: 1.02; text-wrap: balance; }
.hero h1 .w { display: inline-block; }
.hero h1 em { font-style: normal; background: linear-gradient(90deg, #C9B8FF 0%, #9B7BFF 40%, #FFB37C 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero .lede { font-size: clamp(17px, 1.6vw, 21px); color: var(--text-2); max-width: 30em; line-height: 1.6; }
.hero .cta { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 14px; }
/* Entrances, only when motion is welcome. Without them the text is simply there. */
.anim .hero h1 .w { opacity: 0; transform: translateY(0.45em); animation: rise 1100ms cubic-bezier(0.2, 0.7, 0.2, 1) forwards; animation-delay: var(--d, 0ms); }
.anim .hero .lede { opacity: 0; animation: fade 1200ms cubic-bezier(0.2, 0.7, 0.2, 1) 700ms forwards; }
.anim .hero .cta { opacity: 0; animation: fade 1200ms cubic-bezier(0.2, 0.7, 0.2, 1) 1000ms forwards; }
@keyframes rise { to { opacity: 1; transform: none; } }
@keyframes fade { to { opacity: 1; } }
.scroll-hint {
  text-decoration: none !important;
  position: absolute; bottom: 44px; left: 50%; transform: translateX(-50%);
  display: none; flex-direction: column; align-items: center; gap: 12px;
  color: var(--text-3); font-size: 11.5px; letter-spacing: 0.16em; text-transform: uppercase; font-weight: 600;
}
.js .scroll-hint { display: flex; }
.scroll-hint:hover { color: var(--text-2); }
.scroll-hint i { display: block; width: 1px; height: 44px; background: linear-gradient(180deg, var(--accent-soft), transparent); }
.anim .scroll-hint { opacity: 0; animation: fade 1200ms cubic-bezier(0.2, 0.7, 0.2, 1) 1800ms forwards; }
.anim .scroll-hint i { animation: hint 2.6s ease-in-out infinite; }
@keyframes hint { 0% { transform: translateY(-8px); opacity: 0; } 35% { opacity: 1; } 100% { transform: translateY(10px); opacity: 0; } }

/* ——— The night ———
   Default: laid out flat and fully drawn — the graph, the four moments, the morning.
   With JS: a tall section whose sticky stage is driven by scroll progress. */
.night { position: relative; }
.stage { position: relative; --dawn: 1; }
.sky-dawn {
  position: absolute; inset: 0; pointer-events: none; opacity: var(--dawn);
  background: radial-gradient(72% 58% at 50% 108%, rgba(255, 217, 163, 0.62) 0%, rgba(255, 179, 124, 0.4) 28%, rgba(130, 89, 240, 0.22) 60%, rgba(13, 17, 38, 0) 100%);
}
.stage-inner { position: relative; display: grid; gap: 40px; padding: 96px 0 64px; }
.clock { display: none; align-items: baseline; justify-content: space-between; gap: 24px; }
.clock b { font-size: clamp(30px, 3.6vw, 48px); font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.03em; }
.clock span { font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase; font-weight: 600; color: var(--text-3); }
.scene { display: flex; flex-direction: column; gap: clamp(28px, 6vh, 64px); }
.graph { position: relative; }
.graph svg { width: 100%; height: auto; overflow: visible; }
.graph .track { stroke: rgba(160, 175, 255, 0.08); stroke-width: 1; fill: none; }
.graph .line { stroke: var(--sky); stroke-width: 2; fill: none; stroke-linejoin: round; stroke-linecap: round; filter: drop-shadow(0 0 6px rgba(143, 184, 255, 0.35)); }
.graph .area { fill: url(#areaFill); }
.graph .lvl { fill: var(--text-3); font: 600 11px/1 var(--font); letter-spacing: 0.14em; text-transform: uppercase; opacity: 0.8; }
.graph .snore { opacity: var(--snore, 1); }
.graph .snore .pulse { fill: none; stroke: var(--gold); stroke-width: 1.2; opacity: 0.6; transform-box: fill-box; transform-origin: center; }
.anim .graph .snore .pulse { animation: pulse 2.4s ease-out infinite; }
@keyframes pulse { 0% { transform: scale(0.4); opacity: 0.9; } 100% { transform: scale(2.2); opacity: 0; } }
.moon-s { display: none; fill: url(#moonFill); filter: drop-shadow(0 0 14px rgba(246, 217, 168, 0.55)); }
.stage-caption { display: grid; gap: 28px; text-align: center; }
.stage-caption p { width: min(100%, 36em); margin-inline: auto; font-size: clamp(19px, 2.1vw, 26px); line-height: 1.4; color: var(--text-1); text-wrap: balance; }
.stage-caption p time { display: block; margin-bottom: 12px; font-size: 12px; letter-spacing: 0.18em; text-transform: uppercase; font-weight: 700; color: var(--gold); }
.stage-caption p span { color: var(--text-2); }
.morning { position: relative; display: grid; place-items: center; text-align: center; padding-top: 56px; }
.morning-inner { display: flex; flex-direction: column; align-items: center; gap: 22px; padding: 0 var(--pad); }
.ring { position: relative; width: clamp(170px, 22vw, 240px); aspect-ratio: 1; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); overflow: visible; }
.ring .rt { stroke: rgba(160, 175, 255, 0.14); stroke-width: 7; fill: none; }
.ring .ra { stroke: url(#ringFill); stroke-width: 7; fill: none; stroke-linecap: round; stroke-dasharray: 339.3; stroke-dashoffset: 61; filter: drop-shadow(0 0 10px rgba(255, 179, 124, 0.4)); }
.ring .num { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring .num b { font-size: clamp(56px, 7vw, 80px); font-weight: 700; letter-spacing: -0.04em; line-height: 1; font-variant-numeric: tabular-nums; }
.ring .num small { margin-top: 8px; font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; font-weight: 700; color: var(--text-3); }
.morning h2 { font-size: clamp(28px, 3.6vw, 44px); }
.morning p { color: var(--text-2); font-size: clamp(16px, 1.5vw, 19px); max-width: 30em; }
.morning p b { color: var(--text-1); font-weight: 600; }

/* The scene, once JS is there to drive it */
.js .night { height: 460vh; }
.js .stage { position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden; --dawn: 0; --snore: 0; }
.js .stage .stars { opacity: calc(1 - var(--dawn)); }
.js .stage-inner { position: absolute; inset: 0; grid-template-rows: auto 1fr; gap: 0; padding: 40px 0 48px; }
.js .clock { display: flex; }
.js .scene { align-self: center; }
.js .graph { opacity: calc(1 - var(--dawn) * 0.9); }
.js .moon-s { display: block; }
.js .stage-caption { display: block; position: relative; height: 7.2em; }
.js .stage-caption p { position: absolute; left: 50%; top: 0; margin: 0; transform: translate(-50%, 12px); opacity: 0; }
.js .stage-caption p.on { opacity: 1; transform: translate(-50%, 0); }
.anim .stage-caption p { transition: opacity 600ms cubic-bezier(0.2, 0.7, 0.2, 1), transform 600ms cubic-bezier(0.2, 0.7, 0.2, 1); }
.js .morning { position: absolute; inset: 0; padding: 0; pointer-events: none; opacity: var(--dawn); transform: translateY(calc((1 - var(--dawn)) * 24px)); }

/* ——— Quiet sections ——— */
.beat { padding: clamp(120px, 22vh, 220px) 0; text-align: center; }
.beat-inner { max-width: 720px; margin-inline: auto; display: flex; flex-direction: column; align-items: center; gap: 28px; }
.beat h2 { font-size: clamp(32px, 4.6vw, 56px); letter-spacing: -0.03em; text-wrap: balance; }
.beat .lede { font-size: clamp(17px, 1.6vw, 21px); color: var(--text-2); max-width: 30em; text-wrap: pretty; }
.beat a.more { color: var(--text-2); font-weight: 500; font-size: 15px; border-bottom: 1px solid var(--border-strong); padding-bottom: 2px; }
.beat a.more:hover { color: var(--text-1); border-color: var(--accent-soft); text-decoration: none; }
.truths { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 22px; width: 100%; max-width: 560px; }
.truths li { font-size: clamp(17px, 1.7vw, 22px); color: var(--text-1); line-height: 1.45; padding-top: 22px; position: relative; }
.truths li::before { content: ''; position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 28px; height: 2px; border-radius: 2px; background: var(--dawn-grad); opacity: 0.9; }
.truths li span { color: var(--text-2); }
.price { font-size: clamp(17px, 1.6vw, 21px); color: var(--text-2); max-width: 30em; }
.price b { color: var(--text-1); font-weight: 600; }

.landing .footer { padding-top: 24px; }
.landing .footer .legal { text-align: center; margin-inline: auto; margin-top: 32px; }
.landing .footer-grid { justify-content: center; flex-direction: column; gap: 22px; }

@media (max-width: 720px) {
  .hero { padding: 110px 0 150px; }
  .hero-inner { gap: 32px; }
  .js .stage-inner { padding: 28px 0 40px; }
  .js .stage-caption { height: 9.5em; }
  .graph .lvl { display: none; }
}
