/* ───────────────────────────────────────────────────────────
   Sunup — the page is a sunrise. Night at the top, daybreak
   at the bottom, and the day's timeline running down the
   left margin as the spine.
   Palette lifted from src/theme.ts so the site and the app
   are unmistakably the same object.
   ─────────────────────────────────────────────────────────── */

:root {
  --ink:        #F5F3EE;
  --ink-dim:    #C6C1D2;
  --ink-faint:  #8A85A0;
  --dark:       #2E1B0E;   /* text once we're in the amber */
  --dark-dim:   #6B4626;
  --amber:      #FFA94D;
  --ember:      #F97B57;
  --edge:       rgba(245,243,238,.14);

  --display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --body:    "Instrument Sans", "Helvetica Neue", sans-serif;
  --mono:    "Azeret Mono", ui-monospace, "SF Mono", monospace;

  --gut: clamp(20px, 5vw, 64px);
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; overflow-x: clip; }

body {
  position: relative;
  margin: 0;
  font-family: var(--body);
  color: var(--ink);
  /* Propagates to the canvas, so anything past the gradient — an over-tall
     viewport, overscroll — lands on daybreak rather than a stray band. */
  background-color: #FFCE83;
  -webkit-font-smoothing: antialiased;
}

/* Night to almost-dawn, painted across the document rather than the canvas.
   The last of the sunrise belongs to .close, which paints its own. */
body::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image: linear-gradient(
    180deg,
    #07070C   0%,
    #0B0A18  16%,
    #14102A  34%,
    #1E1738  50%,
    #2E2047  64%,
    #46305C  74%,
    #6E4468  84%,
    #9A5F63  92%,
    #C07C62 100%
  );
}

.wrap { width: 100%; max-width: 1160px; margin: 0 auto; padding: 0 var(--gut); }

.sr {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.pot { position: absolute; left: -9999px; opacity: 0; pointer-events: none; }

/* ── atmosphere ─────────────────────────────────────────── */

/* the sun climbs as you scroll — --sun set from main.js, 0 → 1 */
.sun {
  position: fixed;
  left: 50%;
  /* Sized against the viewport height, not vmax: on a wide, short desktop
     window vmax is the width, and the disc floods the hero instead of
     sitting on the horizon. --sun (0 → 1, set in main.js) raises it. */
  width: 130vh; height: 130vh;
  margin-left: -65vh;
  bottom: calc(-104vh + (var(--sun, 0) * 74vh));
  border-radius: 50%;
  background: radial-gradient(circle at 50% 50%,
    rgba(255,206,131,.30) 0%,
    rgba(255,169,94,.17) 34%,
    rgba(249,123,87,.08) 56%,
    rgba(249,123,87,0)   72%);
  filter: blur(20px);
  pointer-events: none;
  z-index: 0;
  transition: bottom .18s linear;
}

.grain {
  position: fixed; inset: 0; z-index: 2; pointer-events: none;
  opacity: .05; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)'/%3E%3C/svg%3E");
}

main, .topbar, .foot { position: relative; z-index: 1; }

/* ── chrome ─────────────────────────────────────────────── */

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 26px var(--gut);
}
.wordmark {
  font-family: var(--display);
  font-variation-settings: "opsz" 40;
  font-weight: 700; font-size: 21px; letter-spacing: -.01em;
  color: var(--ink); text-decoration: none;
}
.topcta {
  font-size: 13px; letter-spacing: .01em; color: var(--ink-dim);
  text-decoration: none; padding: 8px 15px; border-radius: 999px;
  border: 1px solid var(--edge); transition: color .3s, border-color .3s, background .3s;
}
.topcta:hover { color: var(--ink); border-color: rgba(255,169,94,.6); background: rgba(255,169,94,.08); }

/* ── the mono timestamp spine ───────────────────────────── */

.stamp {
  font-family: var(--mono);
  font-size: 12px; font-weight: 500; letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--amber);
  margin: 0 0 20px;
}
.stamp::before {
  content: ""; display: inline-block;
  width: 26px; height: 1px; margin-right: 12px; vertical-align: 4px;
  background: currentColor; opacity: .5;
}
.stamp.dark { color: var(--dark-dim); }

/* ── hero ───────────────────────────────────────────────── */

.hero { padding: clamp(40px, 8vh, 96px) 0 clamp(90px, 14vh, 170px); }

.hero-grid {
  display: grid; gap: clamp(48px, 7vw, 88px);
  grid-template-columns: minmax(0, 1.08fr) minmax(0, .92fr);
  align-items: center;
}

h1 {
  font-family: var(--display);
  font-variation-settings: "opsz" 144;
  font-weight: 600;
  font-size: clamp(50px, 8.4vw, 116px);
  line-height: .92;
  letter-spacing: -.035em;
  margin: 0 0 30px;
}
h1 span { display: block; }
h1 .l2 { padding-left: .09em; }
h1 .l3 { padding-left: .2em; }
h1 em {
  font-style: italic;
  font-variation-settings: "opsz" 144, "SOFT" 60;
  color: var(--amber);
}

.lede {
  font-size: clamp(16.5px, 1.35vw, 19px);
  line-height: 1.6; color: var(--ink-dim);
  max-width: 46ch; margin: 0 0 34px;
  text-wrap: pretty;
}

.fineprint {
  margin: 16px 0 0; font-size: 12.5px; line-height: 1.6;
  color: rgba(245,243,238,.46); letter-spacing: .01em;
}

/* ── signup form ────────────────────────────────────────── */

.signup { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; max-width: 500px; }

.signup input[type="email"] {
  flex: 1 1 220px; min-width: 0;
  font-family: var(--body); font-size: 15.5px; color: var(--ink);
  background: rgba(245,243,238,.05);
  border: 1px solid var(--edge);
  border-radius: 999px;
  padding: 14px 20px;
  transition: border-color .25s, background .25s;
}
.signup input[type="email"]::placeholder { color: var(--ink-faint); }
.signup input[type="email"]:focus {
  outline: none;
  border-color: rgba(255,169,94,.75);
  background: rgba(245,243,238,.08);
}

.signup button {
  flex: 0 0 auto;
  font-family: var(--body); font-size: 15px; font-weight: 600;
  color: #2A1808; cursor: pointer;
  background: linear-gradient(180deg, #FFCE83, #FFA94D);
  border: none; border-radius: 999px;
  padding: 15px 25px;
  transition: transform .2s cubic-bezier(.2,.7,.2,1), box-shadow .25s, filter .2s;
  box-shadow: 0 6px 22px -8px rgba(255,169,94,.7);
}
.signup button:hover { transform: translateY(-1px); filter: brightness(1.06); box-shadow: 0 12px 30px -10px rgba(255,169,94,.85); }
.signup button:active { transform: translateY(0); }
.signup button[disabled] { opacity: .55; cursor: default; transform: none; }

.formnote {
  flex: 1 0 100%; margin: 4px 0 0; min-height: 1.2em;
  font-size: 13px; letter-spacing: .01em; color: var(--amber);
}
.formnote.err { color: #FF9E8F; }

.signup.big { max-width: 560px; }
.signup.big input[type="email"] {
  color: var(--dark);
  background: rgba(46,27,14,.06);
  border-color: rgba(46,27,14,.22);
  padding: 16px 22px; font-size: 16.5px;
}
.signup.big input[type="email"]::placeholder { color: rgba(46,27,14,.42); }
.signup.big input[type="email"]:focus { border-color: rgba(46,27,14,.6); background: rgba(46,27,14,.09); }
.signup.big button {
  background: #2E1B0E; color: #FFE6BE;
  padding: 17px 30px; font-size: 16px;
  box-shadow: 0 10px 30px -12px rgba(46,27,14,.8);
}
.signup.big .formnote { color: var(--dark); }
.signup.big .formnote.err { color: #8C2F16; }

/* ── the phone ──────────────────────────────────────────── */

.hero-device { display: flex; justify-content: center; }

.phone {
  position: relative;
  width: min(320px, 78vw);
  aspect-ratio: 320 / 660;
  border-radius: 52px;
  padding: 11px;
  background: linear-gradient(160deg, #33323C, #17171D 44%, #2C2B34);
  box-shadow:
    0 60px 90px -40px rgba(0,0,0,.85),
    0 0 0 1px rgba(255,255,255,.06),
    inset 0 0 0 1px rgba(255,255,255,.05);
  transform: rotate(-1.6deg);
}

.phone-screen {
  position: relative; height: 100%;
  border-radius: 42px; overflow: hidden;
  display: flex; flex-direction: column;
  padding: 22px 16px 16px;
  background:
    radial-gradient(120% 70% at 50% 108%, rgba(255,178,90,.55), transparent 62%),
    linear-gradient(180deg, #101024 0%, #3B2C54 52%, #B4577E 100%);
}

.island {
  width: 84px; height: 24px; border-radius: 999px;
  background: #08080C; margin: 0 auto 26px;
}

.ls-top { text-align: center; }
.ls-date { margin: 0 0 2px; font-size: 12.5px; color: rgba(245,243,238,.72); letter-spacing: .01em; }
.ls-time {
  position: relative; margin: 0; height: 68px;
  font-family: var(--display); font-variation-settings: "opsz" 144;
  font-weight: 300; font-size: 66px; line-height: 68px; letter-spacing: -.03em;
  color: #fff;
}
.ls-time span { position: absolute; inset: 0; }
.t-a { animation: swapA 12s infinite; }
.t-b { animation: swapB 12s infinite; }

.ls-cards { position: relative; flex: 1; margin-top: 30px; }

.card {
  position: absolute; left: 0; right: 0; top: 0;
  border-radius: 20px; padding: 14px 15px 15px;
  background: rgba(20,18,32,.42);
  border: 1px solid rgba(255,255,255,.14);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 18px 40px -22px rgba(0,0,0,.9);
}
.card-alarm { animation: swapA 12s infinite; }
.card-task  { animation: swapB 12s infinite; }

.card-row { display: flex; align-items: center; gap: 7px; margin-bottom: 9px; }
.card-label { font-size: 11px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: rgba(245,243,238,.8); }
.card-meta { margin-left: auto; font-family: var(--mono); font-size: 10px; letter-spacing: .06em; color: rgba(245,243,238,.55); }

.dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.dot.ringing { background: #FF7A45; box-shadow: 0 0 0 0 rgba(255,122,69,.6); animation: ping 1.4s infinite; }
.dot.pending { background: var(--amber); animation: breathe 2.8s ease-in-out infinite; }

.card-title { margin: 0 0 3px; font-size: 16.5px; font-weight: 600; color: #fff; letter-spacing: -.01em; }
.card-sub { margin: 0; font-size: 12.5px; line-height: 1.45; color: rgba(245,243,238,.66); }

.card-actions { margin-top: 12px; }
.chip {
  display: inline-block; font-size: 12.5px; font-weight: 600;
  color: #2A1808; background: linear-gradient(180deg,#FFCE83,#FFA94D);
  padding: 7px 15px; border-radius: 999px;
}

.ls-bar { width: 108px; height: 4px; border-radius: 999px; background: rgba(255,255,255,.55); margin: 0 auto; }

@keyframes swapA {
  0%, 26%   { opacity: 1; transform: translateY(0); }
  33%, 100% { opacity: 0; transform: translateY(-10px); }
}
@keyframes swapB {
  0%, 30%   { opacity: 0; transform: translateY(12px); }
  40%, 94%  { opacity: 1; transform: translateY(0); }
  100%      { opacity: 0; transform: translateY(0); }
}
@keyframes ping {
  0%   { box-shadow: 0 0 0 0 rgba(255,122,69,.65); }
  70%  { box-shadow: 0 0 0 9px rgba(255,122,69,0); }
  100% { box-shadow: 0 0 0 0 rgba(255,122,69,0); }
}
@keyframes breathe {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: .45; transform: scale(.82); }
}

/* ── beats: they drift rightward down the page, like a sun's arc ── */

.beat { padding: clamp(58px, 9vh, 104px) 0; }
.beat-grid { display: grid; grid-template-columns: 132px minmax(0, 1fr); gap: clamp(20px, 4vw, 56px); }
.beat-grid .stamp { margin: 10px 0 0; }
.beat-body { max-width: 620px; }

#beat-alarm .beat-body { margin-left: 0; }
#beat-task  .beat-body { margin-left: clamp(0px, 6vw, 88px); }
#beat-nudge .beat-body { margin-left: clamp(0px, 12vw, 176px); }
#beat-byo   .beat-body { margin-left: clamp(0px, 18vw, 264px); }

h2 {
  font-family: var(--display);
  font-variation-settings: "opsz" 144;
  font-weight: 600;
  font-size: clamp(30px, 4vw, 50px);
  line-height: 1.04; letter-spacing: -.03em;
  margin: 0 0 20px; text-wrap: balance;
}
.beat-body p {
  font-size: clamp(16px, 1.25vw, 18px); line-height: 1.65;
  color: rgba(245,243,238,.84); margin: 0 0 15px; text-wrap: pretty;
}
.beat-body p:last-child { margin-bottom: 0; }
.beat-body em { font-style: normal; color: var(--ink); box-shadow: inset 0 -.42em 0 rgba(255,169,94,.24); }
.beat-body .muted { color: rgba(245,243,238,.6); font-size: 15.5px; }

/* The warmer the ground gets, the more the type has to lift off it. */
#beat-nudge .beat-body p, #beat-byo .beat-body p { color: rgba(255,251,246,.9); }
#beat-nudge .beat-body em, #beat-byo .beat-body em { color: #fff; box-shadow: inset 0 -.42em 0 rgba(255,206,131,.3); }
#beat-byo .stamp { color: #FFD9A8; }

/* ── daybreak ───────────────────────────────────────────── */

.close {
  padding: clamp(110px, 16vh, 200px) 0 clamp(60px, 9vh, 110px);
  color: var(--dark);
  background: linear-gradient(
    180deg,
    rgba(255,206,131,0)   0%,
    rgba(255,201,124,.72) 18%,
    #FFCE83              34%,
    #FFCE83             100%
  );
}
.close-h {
  font-size: clamp(52px, 9vw, 122px); line-height: .9; letter-spacing: -.04em;
  font-weight: 700; margin: 0 0 26px; color: var(--dark);
}
.close-p {
  font-size: clamp(16.5px, 1.35vw, 19px); line-height: 1.6;
  color: var(--dark-dim); max-width: 44ch; margin: 0 0 34px; text-wrap: pretty;
}

.foot { padding: 26px 0 44px; color: rgba(46,27,14,.55); background: #FFCE83; }
.foot-in { display: flex; justify-content: space-between; gap: 16px; font-size: 12.5px; letter-spacing: .01em; flex-wrap: wrap; }

/* ── reveals ────────────────────────────────────────────── */

/* Content is visible by default. The `js-reveal` class is only added by the
   inline head script when JS is running and IntersectionObserver exists, so a
   script failure degrades to a plain, readable page instead of a blank one. */
.reveal { opacity: 1; transform: none; }
.js-reveal .reveal { opacity: 0; transform: translateY(20px); }
.js-reveal .reveal.in {
  opacity: 1; transform: none;
  transition: opacity .9s cubic-bezier(.2,.7,.2,1), transform .9s cubic-bezier(.2,.7,.2,1);
}
.js-reveal .hero-device.in { transition-delay: .12s; }

/* ── narrow ─────────────────────────────────────────────── */

@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-device { order: -1; margin-bottom: 8px; }
  .phone { width: min(280px, 70vw); transform: rotate(-1deg); }
  .beat-grid { grid-template-columns: 1fr; gap: 4px; }
  .beat-grid .stamp { margin: 0 0 14px; }
  #beat-task .beat-body, #beat-nudge .beat-body, #beat-byo .beat-body { margin-left: 0; }
  .topcta { display: none; }
  .signup button { flex: 1 1 100%; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal, .js-reveal .reveal { opacity: 1; transform: none; }
  .t-a, .t-b, .card-alarm, .card-task, .dot.ringing, .dot.pending { animation: none; }
  .t-a, .card-alarm { opacity: 0; }
  .t-b, .card-task  { opacity: 1; }
  .signup button:hover { transform: none; }
}
