/* 晓眠 / KnowSleep — knowsleep.soakout.com
 *
 * Every colour here is copied from the app's design token contract
 * (docs/knowsleep/2026-09-07-design-tokens-contract.md). The site and the app are
 * the same product, so they are the same palette — when a token changes there,
 * change it here too rather than eyeballing something close.
 *
 * No web fonts. The app deliberately ships no font files and never sets a family
 * (contract §5.4): the platform face renders Chinese and Latin correctly, keeps
 * Dynamic Type working, and costs nothing to download. The site follows it, which
 * is also why there is no font-subsetting step in the build.
 *
 * The screenshots in /shots are exported straight from the design file, cropped to
 * the 390×844 phone ratio. They are the product, not illustrations of it.
 */

:root {
  --bg: #FAF8F5;
  --card: #FFFDFB;
  --track: #F0EDE7;
  --border: #EAE5DE;
  --primary: #1C1A17;
  --secondary: #33302C;
  --body: #4E4A45;
  --muted: #6F6A62;
  --on-primary: #FFFDFB;

  --dawn-0: #FEFAF7;
  --dawn-1: #FDFCF9;
  --dawn-2: #FAF8F5;

  --sky: #B6DFEE;
  --mint: #CBE9C8;
  --butter: #F8EBA4;
  --lav: #D8D0F0;
  --peach: #F9D6C2;
  --coral: #E9A184;

  --on-sky: #2E4C57;
  --on-mint: #32552E;
  --on-butter: #5C5131;
  --on-lav: #463D73;
  --on-peach: #634235;
  --on-coral: #3C2820;

  --r-sm: 24px;
  --r-md: 26px;
  --r-lg: 30px;

  --measure: 660px;
  --wide: 1120px;

  /* One shadow, warm rather than neutral — a grey shadow on a warm ground reads
     as dirt, the same reason every neutral in the palette carries a warm hue. */
  --lift: 0 2px 6px rgba(60, 46, 32, .05), 0 18px 44px rgba(60, 46, 32, .10);
  --orb: .55;
  --wash: 1;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16140F;
    --card: #221F1C;
    --track: #2E2B26;
    --border: #FFFFFF1A;
    --primary: #F4F1EC;
    --secondary: #E2DED8;
    --body: #CBC6BE;
    --muted: #98938B;
    --on-primary: #16140F;

    --dawn-0: #242028;
    --dawn-1: #1B181E;
    --dawn-2: #16140F;

    --sky: #23607A;
    --mint: #2F6B3D;
    --butter: #7A6420;
    --lav: #4A3F7A;
    --peach: #7A4A3A;
    --coral: #7A4030;

    --on-sky: #BCE5F6;
    --on-mint: #D2F0D2;
    --on-butter: #FCF5D1;
    --on-lav: #C9BAF6;
    --on-peach: #F9D1C1;
    --on-coral: #F7C5AF;

    --lift: 0 2px 6px rgba(0, 0, 0, .3), 0 18px 44px rgba(0, 0, 0, .45);
    --orb: .30;
    --wash: .34;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

/* The page sits on a fixed wash of the four candy hues at very low strength.
 * Fixed, not scrolling: it behaves like light in a room rather than a texture on
 * the page, so scrolling moves the content through it instead of dragging it along.
 * The four positions are the four sleep stages in the app's own order. */
body {
  margin: 0;
  background-color: var(--bg);
  background-image:
    radial-gradient(58em 42em at 8% 4%,   color-mix(in srgb, var(--lav) calc(42% * var(--wash)), transparent), transparent 62%),
    radial-gradient(52em 40em at 96% 22%, color-mix(in srgb, var(--sky) calc(38% * var(--wash)), transparent), transparent 60%),
    radial-gradient(46em 38em at 4% 56%,  color-mix(in srgb, var(--mint) calc(34% * var(--wash)), transparent), transparent 60%),
    radial-gradient(50em 40em at 92% 82%, color-mix(in srgb, var(--peach) calc(34% * var(--wash)), transparent), transparent 62%);
  background-attachment: fixed;
  background-repeat: no-repeat;
  color: var(--body);
  font: 400 17px/1.75 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.num { font-variant-numeric: tabular-nums; }
a { color: inherit; }

h1, h2, h3 { color: var(--primary); margin: 0; line-height: 1.28; }
h1 { font-size: 52px; font-weight: 700; letter-spacing: -0.025em; }
h2 { font-size: 34px; font-weight: 700; letter-spacing: -0.02em; }
h3 { font-size: 18px; font-weight: 600; letter-spacing: -0.01em; }
p  { margin: 0; }

.inner { max-width: var(--wide); margin: 0 auto; padding: 0 24px; }

/* A small label that sits above a heading and names the section. */
.eyebrow {
  font-size: 13px; font-weight: 700; letter-spacing: .10em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 16px;
}

/* ── Ambient candy orbs ───────────────────────────────────────────────────
 * The app's four candy hues, blurred out to a wash. They are the brand mark
 * dissolved into the page rather than decoration picked from a stock set —
 * and they are the only thing on the page that is not either type or product. */
.orbs { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 0; }
.orbs i {
  position: absolute; display: block; border-radius: 50%;
  filter: blur(72px); opacity: var(--orb);
}
.orbs i:nth-child(1) { width: 420px; height: 420px; background: var(--lav);    top: -130px; left: -90px; }
.orbs i:nth-child(2) { width: 360px; height: 360px; background: var(--sky);    top: 40px;  right: -110px; }
.orbs i:nth-child(3) { width: 300px; height: 300px; background: var(--butter); bottom: -140px; left: 34%; }
.orbs i:nth-child(4) { width: 260px; height: 260px; background: var(--mint);   top: 300px; left: 18%; }

/* ── Hero ─────────────────────────────────────────────────────────────────
 * The app's "dawn" background: three stops that flatten at 45%. The last stop
 * equals --bg on purpose; anything else leaves a seam where the gradient ends
 * (contract §4). */
.hero {
  position: relative; overflow: hidden;
  background: linear-gradient(180deg, var(--dawn-0) 0%, var(--dawn-1) 22%, var(--dawn-2) 45%);
  padding: 72px 0 80px;
}
.hero .inner { position: relative; z-index: 1; }
.hero-grid {
  display: grid; gap: 48px; align-items: center;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
}
.hero-copy { padding-bottom: 0; }
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 30px; }
.brand img { width: 44px; height: 44px; display: block; }
.brand b { font-size: 17px; font-weight: 700; color: var(--primary); letter-spacing: .01em; }
.hero h1 { margin-bottom: 20px; }
.hero h1 em { font-style: normal; color: var(--on-lav); }
.tagline { font-size: 19px; color: var(--secondary); max-width: 30em; margin-bottom: 32px; }

.cta {
  display: inline-flex; align-items: center; gap: 10px;
  background: var(--primary); color: var(--on-primary);
  text-decoration: none; font-size: 15px; font-weight: 700;
  padding: 17px 32px; border-radius: 999px;
  transition: transform .15s ease, opacity .15s ease;
}
.cta:hover { transform: translateY(-1px); opacity: .9; }
.cta.pending { background: var(--track); color: var(--muted); cursor: default; pointer-events: none; }
.cta-note { font-size: 14px; color: var(--muted); margin-top: 16px; }

/* A screen is always taller than the space you give it, so every shot is a crop.
   The fade at the bottom is what makes the crop deliberate rather than accidental:
   the screen runs out of room instead of being chopped. */
.hero-shot { align-self: end; }
.shot { position: relative; margin: 0 auto; width: fit-content; }
.shot::after {
  content: ""; position: absolute; left: 1px; right: 1px; bottom: 1px; height: 96px;
  border-radius: 0 0 33px 33px; pointer-events: none;
  background: linear-gradient(180deg, transparent, var(--bg) 88%);
}
.panel .shot::after { background: linear-gradient(180deg, transparent, var(--card) 88%); }
.hero .shot::after { background: linear-gradient(180deg, transparent, var(--dawn-2) 88%); }
/* The exports are full screens at the 390×844 ratio — 2.16 tall for every 1 wide.
 * Shown whole they tower over the text beside them and leave the copy column mostly
 * empty, so the height is capped and the image is cropped from the top instead of
 * being scaled down: the part of a screen worth showing is always its head. */
.phone {
  width: 100%; max-width: 320px; display: block; margin: 0 auto;
  max-height: 600px; object-fit: cover; object-position: top;
  border-radius: 34px; border: 1px solid var(--border);
  box-shadow: var(--lift); background: var(--card);
}
.hero-shot .phone { max-height: 540px; }
.split-shot .phone { max-height: 520px; max-width: 300px; }

/* ── Sections ─────────────────────────────────────────────────────────── */
section { padding: 96px 0; position: relative; }

/* A plain hairline. This was briefly a 3px hypnogram in the four stage colours,
 * with the real proportions of the night the site is built around — and David, who
 * knows the product better than anyone, had to ask what it was. A concept that needs
 * explaining outside the page does not work on it: at 3px, repeated six times and
 * unlabelled, it read as a stray coloured bar. The real hypnogram is already in the
 * screenshots, where it has an axis and labels and can actually be read. */
section + section::before,
footer::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: var(--border); pointer-events: none;
}
footer { position: relative; }

.panel { background: color-mix(in srgb, var(--card) calc(84% * var(--wash)), transparent); }
.lede { font-size: 19px; color: var(--secondary); max-width: var(--measure); margin-top: 18px; }
.lede + .lede { margin-top: 14px; }

/* Text on one side, a screen on the other; every other one flipped. */
.split {
  display: grid; gap: 56px; align-items: center;
  grid-template-columns: minmax(0, 1fr) minmax(0, 340px);
}
.split.flip { grid-template-columns: minmax(0, 340px) minmax(0, 1fr); }
.split.flip .split-copy { order: 2; }
.split.flip .split-shot { order: 1; }

/* ── Step list ────────────────────────────────────────────────────────── */
.steps { margin-top: 34px; display: grid; gap: 22px; }
.step { display: grid; grid-template-columns: 40px 1fr; gap: 18px; align-items: start; }
.step .no {
  width: 40px; height: 40px; border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 700;
}
.step:nth-child(1) .no { background: var(--lav);  color: var(--on-lav); }
.step:nth-child(2) .no { background: var(--sky);  color: var(--on-sky); }
.step:nth-child(3) .no { background: var(--mint); color: var(--on-mint); }
.step h3 { margin-bottom: 6px; }
.step p { font-size: 16px; }

/* ── The verdict card ─────────────────────────────────────────────────── */
.verdict {
  background: var(--lav); color: var(--on-lav);
  border-radius: var(--r-lg); padding: 34px 32px;
  max-width: var(--measure); margin-top: 34px; box-shadow: var(--lift);
}
.verdict .label { font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; opacity: .72; }
.verdict .line { font-size: 23px; font-weight: 700; margin-top: 14px; line-height: 1.55; }
.verdict .foot { font-size: 14px; margin-top: 18px; opacity: .76; }

/* ── Switches ─────────────────────────────────────────────────────────── */
.switches { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }
.sw { border-radius: var(--r-sm); padding: 20px 24px; min-width: 176px; flex: 1 1 176px; }
.sw .k { font-size: 14px; font-weight: 600; opacity: .82; }
.sw .v { font-size: 21px; font-weight: 700; margin-top: 8px; }
.sw.bad  { background: var(--coral); color: var(--on-coral); }
.sw.warn { background: var(--peach); color: var(--on-peach); }
.sw.good { background: var(--sky);   color: var(--on-sky); }
.sw.none { background: var(--track); color: var(--muted); }

/* ── Privacy facts ────────────────────────────────────────────────────── */
.facts { display: grid; gap: 14px; margin-top: 34px; grid-template-columns: repeat(auto-fit, minmax(238px, 1fr)); }
.fact { background: var(--card); border: 1px solid var(--border); border-radius: var(--r-md); padding: 24px; }
.fact b { display: block; color: var(--primary); font-size: 16px; margin-bottom: 8px; }
.fact p { font-size: 15px; }

/* ── Price ────────────────────────────────────────────────────────────── */
.prices { display: grid; gap: 16px; margin-top: 34px; max-width: 900px; grid-template-columns: repeat(auto-fit, minmax(238px, 1fr)); }
.price { background: var(--card); border: 1px solid var(--border); border-radius: var(--r-md); padding: 28px; }
.price.pick { background: var(--butter); color: var(--on-butter); border-color: transparent; box-shadow: var(--lift); }
.price .k { font-size: 15px; font-weight: 600; color: var(--primary); }
.price.pick .k { color: var(--on-butter); }
.price .p { font-size: 32px; font-weight: 700; color: var(--primary); margin: 10px 0 8px; letter-spacing: -0.02em; }
.price.pick .p { color: var(--on-butter); }
.price .n { font-size: 14px; }
.price.pick .n { color: var(--on-butter); opacity: .84; }
.price-note { font-size: 14px; color: var(--muted); margin-top: 16px; }

.disclaimer {
  background: var(--track); border-radius: var(--r-md);
  padding: 24px 26px; margin-top: 36px; max-width: 900px;
  font-size: 14px; color: var(--muted);
}

/* ── Legal pages ──────────────────────────────────────────────────────── */
.legal { padding: 60px 0 84px; }
.legal .inner { max-width: var(--measure); }
.legal h1 { font-size: 38px; margin-bottom: 10px; }
.legal .updated { font-size: 14px; color: var(--muted); margin-bottom: 38px; }
.legal h2 { font-size: 21px; margin: 42px 0 12px; }
.legal p { margin: 12px 0; font-size: 16px; }
.legal ul { margin: 12px 0; padding-left: 22px; font-size: 16px; }
.legal li { margin: 8px 0; }
.legal strong { color: var(--primary); }
.legal .back { display: inline-block; font-size: 15px; color: var(--muted); text-decoration: none; margin-bottom: 28px; }
.legal .back:hover { color: var(--primary); }

/* ── Footer ───────────────────────────────────────────────────────────── */
footer { padding: 39px 0 52px; font-size: 14px; color: var(--muted); }
footer .row { display: flex; flex-wrap: wrap; gap: 20px; align-items: center; }
footer a { color: var(--muted); text-decoration: none; }
footer a:hover { color: var(--primary); }
footer .spacer { flex: 1 1 auto; }

/* ── Narrow ───────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .hero-grid, .split, .split.flip { grid-template-columns: minmax(0, 1fr); }
  .split.flip .split-copy, .split.flip .split-shot { order: initial; }
  .hero-shot .phone { margin-bottom: -60px; }
  .split-shot .phone { max-width: 280px; max-height: 460px; }
  h1 { font-size: 40px; }
  h2 { font-size: 29px; }
  section { padding: 72px 0; }
}

@media (max-width: 560px) {
  body { font-size: 16px; }
  .hero { padding-top: 54px; }
  h1 { font-size: 33px; }
  h2 { font-size: 25px; }
  .tagline { font-size: 17px; }
  .lede { font-size: 17px; }
  .verdict .line { font-size: 20px; }
  section { padding: 58px 0; }
  .orbs i { filter: blur(56px); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .cta:hover { transform: none; }
}
