/* Dusk: Migraine Tracker — dusktracker.com
   The site wears the app's identity: the dark room. Default theme is dusk —
   true-black ground (never a backlit white page), dimmed lavender ink (never
   #FFF — it haloes for photophobic eyes), a warm amber readout like the last
   light on the horizon, and a calm periwinkle accent. The optional light theme
   is dawn — a pale lilac pre-sunrise sky, amber deepened to ink strength, still
   no glare and no pure white. Type: Nunito (rounded display, SF-Rounded analog)
   / Atkinson Hyperlegible (body — designed for low-vision legibility) / IBM
   Plex Mono (readouts + eyebrows). */

:root {
  color-scheme: dark;
  --night:      #000000;   /* page ground — the dark room */
  --surface:    #121016;   /* raised card, barely lifted off black */
  --sheet:      #1A1620;   /* nested / inset surface */
  --ink:        #D9D4E4;   /* primary text — dimmed lavender-white */
  --ink-soft:   #8A8398;   /* secondary text */
  --line:       #2A2633;   /* hairlines */
  --peri:       #9E93F0;   /* periwinkle — links, accents, the star */
  --peri-deep:  #574FD6;
  --amber:      #E0A44E;   /* the readout — amber on black */
  --amber-soft: rgba(224,164,78,.14);
  --peri-soft:  rgba(158,147,240,.13);
  --glow-a:     rgba(224,164,78,.16);  /* horizon glow, core */
  --glow-b:     rgba(224,164,78,.05);  /* horizon glow, falloff */
  --topbar-bg:  rgba(0,0,0,.78);
  --radius:     16px;
  --radius-lg:  24px;
  --shadow:     0 24px 56px -28px rgba(0,0,0,.9);
  --maxw:       1040px;
}

/* dawn — the light theme. Lilac sky, not clinical white; amber becomes ink. */
html[data-theme="light"] {
  color-scheme: light;
  --night:      #EFECF4;
  --surface:    #E6E2EE;
  --sheet:      #F9F8FC;
  --ink:        #262030;
  --ink-soft:   #5C5468;
  --line:       #D6D0E1;
  --peri:       #4B44C0;
  --peri-deep:  #574FD6;
  --amber:      #8A5507;
  --amber-soft: rgba(176,116,16,.14);
  --peri-soft:  rgba(87,79,214,.10);
  --glow-a:     rgba(224,164,78,.34);
  --glow-b:     rgba(224,164,78,.12);
  --topbar-bg:  rgba(239,236,244,.82);
  --shadow:     0 24px 48px -30px rgba(38,32,47,.35);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: 'Atkinson Hyperlegible', system-ui, -apple-system, sans-serif;
  font-size: 1.1rem;
  line-height: 1.65;
  color: var(--ink);
  background: var(--night);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; display: block; }

a { color: var(--peri); text-decoration-thickness: 1.5px; text-underline-offset: 3px; }

h1, h2, h3, .display {
  font-family: 'Nunito', system-ui, sans-serif;
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 0;
}

.eyebrow {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 0.76rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--amber);
  margin: 0;
}

/* ---------- layout ---------- */

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

.section { padding: 96px 0; }
.section--tint { background: var(--surface); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }

.section-head { max-width: 620px; margin: 0 auto 52px; text-align: center; }
.section-head h2 { font-size: clamp(1.9rem, 4.5vw, 2.8rem); margin-top: 14px; }
.section-head p { color: var(--ink-soft); font-size: 1.1rem; margin: 14px 0 0; }

/* ---------- top bar ---------- */

.topbar {
  position: sticky; top: 0; z-index: 50;
  background: var(--topbar-bg);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; height: 66px; gap: 16px; }
.brand { display: flex; align-items: center; gap: 12px; font-family: 'Nunito',sans-serif; font-weight: 800; font-size: 1.25rem; color: var(--ink); text-decoration: none; }
.brand img { width: 34px; height: 34px; border-radius: 9px; }
.topnav { display: flex; align-items: center; gap: 26px; }
.topnav a { color: var(--ink); text-decoration: none; font-weight: 500; font-size: .98rem; }
.topnav a:hover { color: var(--peri); }

/* theme toggle: shows the theme you'd switch to (sun in the dark, moon at dawn) */
.theme-toggle {
  width: 38px; height: 38px; border-radius: 50%;
  border: 1px solid var(--line); background: transparent; color: var(--ink);
  display: grid; place-items: center; cursor: pointer; padding: 0;
  transition: color .16s ease, border-color .16s ease;
}
.theme-toggle:hover { color: var(--peri); border-color: var(--peri); }
.theme-toggle svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
html:not([data-theme="light"]) .theme-toggle .i-moon { display: none; }
html[data-theme="light"] .theme-toggle .i-sun { display: none; }

/* ---------- buttons ---------- */

.btn {
  display: inline-flex; align-items: center; gap: 10px;
  background: var(--peri-deep); color: #EFEDFB;
  padding: 15px 26px; border-radius: 999px;
  font-family: 'Nunito',sans-serif; font-weight: 700; font-size: 1.04rem;
  text-decoration: none; border: 0; cursor: pointer;
  transition: transform .16s ease, background .16s ease;
}
.btn:hover { transform: translateY(-2px); background: #6A62E2; }
.btn .apple { width: 19px; height: 22px; flex: 0 0 auto; }
.btn--soon { background: var(--sheet); color: var(--ink); border: 1px solid var(--line); cursor: default; }
.btn--soon:hover { transform: none; background: var(--sheet); }

/* ---------- hero: the dark room, with the real app in it ---------- */

.hero {
  position: relative;
  padding: 64px 0 0;
  overflow: hidden;
}
/* the amber horizon — a soft glow rising from the bottom of the hero */
.hero::after {
  content: "";
  position: absolute; left: 50%; bottom: -260px; transform: translateX(-50%);
  width: 1200px; height: 420px; border-radius: 50%;
  background: radial-gradient(closest-side, var(--glow-a), var(--glow-b) 55%, transparent 75%);
  pointer-events: none;
}
.hero > .wrap { position: relative; z-index: 1; }

.hero-grid {
  display: grid; grid-template-columns: 1.05fr .95fr;
  gap: 48px; align-items: center;
}
.hero-copy { padding-bottom: 96px; }

.hero .pill {
  display: inline-flex; align-items: center; gap: 10px;
  background: var(--peri-soft); color: var(--peri);
  font-family: 'IBM Plex Mono',monospace; font-size: .78rem; letter-spacing: .12em; text-transform: uppercase;
  padding: 7px 15px; border-radius: 999px; margin: 0 0 28px;
}

.phrase {
  font-family: 'Nunito',sans-serif; font-weight: 800;
  font-size: clamp(2.1rem, 5.5vw, 3.6rem);
  line-height: 1.08; color: var(--ink);
  max-width: 14ch; margin: 0;
  animation: rise .6s .05s both cubic-bezier(.2,.7,.2,1);
}

.hero .lede { max-width: 44ch; margin: 26px 0 0; font-size: 1.16rem; color: var(--ink); animation: rise .6s .2s both cubic-bezier(.2,.7,.2,1); }
.hero .lede b { color: var(--amber); font-weight: 700; }
.hero .cta-row { margin-top: 30px; display: flex; flex-direction: column; align-items: flex-start; gap: 14px; animation: fade .6s .35s both; }
.fine { font-family: 'IBM Plex Mono',monospace; font-size: .8rem; color: var(--ink-soft); letter-spacing: .02em; }

/* the stage: eclipse + star in the sky, the real home screen rising from the
   horizon — bottom-cropped by the hero's edge so it reads as entering the page */
/* min-width:0 lets the grid column shrink below the phone image's natural
   720px — without it the whole page pans sideways on phones */
.hero-stage { position: relative; align-self: end; min-width: 0; display: flex; justify-content: center; animation: fade .8s .3s both; }
.hero .moon { position: absolute; top: -12px; right: 4%; width: 116px; height: 116px; z-index: 0; }
.hero .moon .star { animation: twinkle 5s 1.4s ease-in-out infinite; transform-origin: center; }
.hero-phone {
  position: relative; z-index: 1;
  width: min(300px, 74%); height: auto;
  margin: 84px 0 -150px;
  transform: translateX(9%);
  filter: drop-shadow(0 24px 36px rgba(0,0,0,.55));
}
/* the watch rides in front of the phone's lower-left corner, cropped by the
   same horizon edge — the pairing says "phone and wrist" in one glance */
.hero-watch {
  position: absolute; z-index: 2;
  width: 200px; height: auto;
  left: -2%; bottom: -78px;
  filter: drop-shadow(0 20px 30px rgba(0,0,0,.6));
}

/* ---------- feature bands ---------- */

.band-label { display: flex; align-items: center; gap: 14px; max-width: var(--maxw); margin: 0 auto 32px; }
.band-label .tag { font-family: 'IBM Plex Mono',monospace; font-size: .76rem; letter-spacing: .16em; text-transform: uppercase; padding: 6px 13px; border-radius: 999px; white-space: nowrap; }
.band-label .tag--free { background: var(--amber-soft); color: var(--amber); }
.band-label .tag--pro { background: var(--peri-soft); color: var(--peri); }
.band-label .rule { height: 1px; background: var(--line); flex: 1; }

.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; max-width: var(--maxw); margin: 0 auto; }
.feature {
  background: var(--sheet); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 28px; transition: transform .2s ease, border-color .2s ease;
}
.feature:hover { transform: translateY(-3px); border-color: var(--peri); }
.feature .ico { width: 44px; height: 44px; border-radius: 12px; background: var(--peri-soft); display: grid; place-items: center; margin-bottom: 16px; }
.feature .ico svg { width: 24px; height: 24px; stroke: var(--peri); fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.feature h3 { font-size: 1.3rem; margin-bottom: 8px; }
.feature p { margin: 0; color: var(--ink-soft); font-size: 1.02rem; line-height: 1.55; }
.price-line { text-align: center; margin: 56px 0 0; font-family: 'IBM Plex Mono',monospace; font-size: .86rem; color: var(--ink-soft); letter-spacing: .04em; }
.price-line b { color: var(--amber); font-weight: 600; }

/* ---------- privacy band ---------- */

.privacy-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 18px 40px; max-width: 880px; margin: 44px auto 0; }
.promise { display: flex; gap: 15px; align-items: flex-start; text-align: left; }
.promise .mark { flex: 0 0 auto; width: 30px; height: 30px; border-radius: 50%; background: var(--amber-soft); display: grid; place-items: center; margin-top: 3px; }
.promise .mark svg { width: 17px; height: 17px; stroke: var(--amber); fill: none; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.promise b { color: var(--ink); font-weight: 700; }
.promise span { display: block; color: var(--ink-soft); font-size: 1rem; line-height: 1.5; }

/* ---------- screenshots ---------- */

.shots {
  display: flex; align-items: flex-start; gap: 22px;
  overflow-x: auto; padding: 8px 24px 22px;
  scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch;
}
.shots::-webkit-scrollbar { height: 8px; }
.shots::-webkit-scrollbar-thumb { background: var(--line); border-radius: 8px; }
.shot { flex: 0 0 auto; width: 230px; margin: 0; scroll-snap-align: center; }
/* auto side margins center the row when it fits the viewport, and collapse to
   a normal scroll strip when it doesn't — no tapering off to one side */
.shot:first-child { margin-left: auto; }
.shot:last-child { margin-right: auto; }
.shot img {
  width: 100%; height: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  background: #0B0A0E;   /* captures are dark-mode; ground them the same in both themes */
}
/* non-device tiles match the framed phones' height so the row reads as one
   rank of equal figures, captions on a single baseline */
.shot:not(.shot--device) img {
  aspect-ratio: 720 / 1472;
  object-fit: contain;
  padding: 18px 10px;
}
/* device shots: Apple product bezels bring their own edges — no card chrome */
.shot--device img {
  border: 0; border-radius: 0; background: transparent; box-shadow: none;
  filter: drop-shadow(0 18px 28px rgba(0,0,0,.6));
}
.shot figcaption {
  margin-top: 12px; text-align: center;
  font-family: 'IBM Plex Mono',monospace; font-size: .74rem;
  letter-spacing: .14em; text-transform: uppercase; color: var(--ink-soft);
}

/* ---------- Apple Watch feature ---------- */

.watch-hero {
  display: grid; grid-template-columns: 1fr auto; align-items: center;
  gap: 56px; margin-top: 56px;
  background: var(--sheet);
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 56px 72px 56px 56px;
  overflow: hidden;
}
.watch-copy h2 { font-size: clamp(1.7rem, 3.6vw, 2.4rem); margin: 14px 0 0; }
.watch-copy p { color: var(--ink-soft); font-size: 1.08rem; margin: 16px 0 0; max-width: 44ch; }
.watch-copy .fine { margin-top: 20px; }

/* The stage caps its own height so the tall product image (full band) bleeds
   past the card's top and bottom edges and crops there — the device reads as
   entering the frame, not floating in it (Apple product-page pattern). */
.watch-stage { position: relative; display: grid; place-items: center; }
.watch-glow {
  position: absolute; inset: -40px -60px;
  background: radial-gradient(closest-side, var(--glow-a), var(--glow-b) 60%, transparent 78%);
  border-radius: 50%;
  animation: glowpulse 7s ease-in-out infinite;
}
/* Apple's official Series 7 Midnight product image (Apple Design Resources
   bezel) with the real simulator capture composited into the display. */
.watch-img {
  position: relative; z-index: 1;
  display: block; width: 380px; height: auto;
  margin: -120px 0;   /* band bleeds past the card's top & bottom edges */
  filter: drop-shadow(0 30px 40px rgba(0,0,0,.7));
  animation: watchfloat 6.5s ease-in-out infinite;
}

@keyframes watchfloat {
  0%, 100% { transform: translateY(0) rotate(-.8deg); }
  50%      { transform: translateY(-12px) rotate(.8deg); }
}
@keyframes glowpulse {
  0%, 100% { opacity: .55; transform: scale(.96); }
  50%      { opacity: 1; transform: scale(1.04); }
}

@media (max-width: 860px) {
  .watch-hero { grid-template-columns: 1fr; padding: 40px 28px 0; gap: 32px; text-align: center; }
  .watch-copy p { margin-left: auto; margin-right: auto; }
  /* min-width:0 lets the grid column shrink below the image's natural size —
     without it the card overflows the viewport and the whole page pans. */
  .watch-stage { justify-self: center; min-width: 0; width: 100%; }
  /* stacked: no top bleed (it would ride up over the copy) — the band sinks
     off the card's bottom edge only, and the image never exceeds the viewport */
  .watch-img { width: 100%; max-width: 320px; margin: 0 auto -110px; }
}

/* ---------- final CTA ---------- */

.closer { text-align: center; position: relative; overflow: hidden; }
.closer::after {
  content: "";
  position: absolute; left: 50%; bottom: -300px; transform: translateX(-50%);
  width: 1200px; height: 420px; border-radius: 50%;
  background: radial-gradient(closest-side, var(--glow-a), transparent 75%);
  pointer-events: none;
}
.closer .wrap { position: relative; z-index: 1; }
.closer h2 { font-size: clamp(2rem, 5.5vw, 3.1rem); }
.closer .cta-row { margin-top: 30px; display: flex; flex-direction: column; align-items: center; gap: 14px; }

/* ---------- footer ---------- */

.foot { border-top: 1px solid var(--line); color: var(--ink-soft); padding: 40px 0 46px; text-align: center; }
.foot a { color: var(--ink); text-decoration: none; margin: 0 14px; font-weight: 500; }
.foot a:hover { color: var(--peri); text-decoration: underline; }
.foot p { margin: 20px 0 0; font-size: .92rem; }
.foot .disclaimer { max-width: 62ch; margin: 22px auto 0; font-size: .85rem; line-height: 1.5; }

/* ---------- content pages (support / privacy / terms) ---------- */

.page-head { background: var(--surface); border-bottom: 1px solid var(--line); text-align: center; padding: 60px 0 68px; }
.page-head img.logo { width: 88px; height: 88px; border-radius: 21px; margin: 0 auto 22px; box-shadow: var(--shadow); }
.page-head h1 { font-size: clamp(2.2rem,6vw,3.1rem); }
.page-head .eyebrow { margin-bottom: 14px; }

.prose { max-width: 740px; margin: 0 auto; padding: 68px 24px; }
.prose h2 { font-size: 1.8rem; margin: 8px 0 24px; }
.prose h3 { font-size: 1.3rem; margin: 40px 0 12px; }
.prose p { margin: 0 0 18px; }
.prose ul { margin: 0 0 18px; padding-left: 22px; }
.prose li { margin: 0 0 8px; }
.prose b, .prose strong { color: var(--ink); }
.updated { display: inline-block; font-family: 'IBM Plex Mono',monospace; font-size: .82rem; color: var(--amber); background: var(--amber-soft); padding: 8px 14px; border-radius: 10px; margin-bottom: 30px; }

.faq { border: 1px solid var(--line); border-radius: var(--radius); background: var(--sheet); margin-bottom: 14px; overflow: hidden; }
.faq summary { cursor: pointer; padding: 20px 24px; font-weight: 700; font-family: 'Nunito',sans-serif; font-size: 1.1rem; color: var(--ink); list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-family: 'IBM Plex Mono',monospace; color: var(--amber); font-size: 1.4rem; line-height: 1; transition: transform .2s; }
.faq[open] summary::after { transform: rotate(45deg); }
.faq .answer { padding: 0 24px 22px; color: var(--ink-soft); font-size: 1.02rem; line-height: 1.6; }
.faq .answer b { color: var(--ink); }

.callout { background: var(--sheet); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px 28px; }
.callout--amber { border-color: rgba(224,164,78,.35); background: var(--amber-soft); }
.back-link { display: inline-block; margin-top: 26px; color: var(--ink); background: var(--peri-soft); padding: 12px 22px; border-radius: 999px; text-decoration: none; font-weight: 700; font-family: 'Nunito',sans-serif; }
.back-link:hover { background: rgba(158,147,240,.22); }

/* ---------- motion primitives ---------- */

@keyframes rise    { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: none; } }
@keyframes fade    { from { opacity: 0; } to { opacity: 1; } }
@keyframes twinkle { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

/* ---------- accessibility floor ---------- */

a:focus-visible, button:focus-visible, summary:focus-visible {
  outline: 3px solid var(--peri); outline-offset: 3px; border-radius: 6px;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .phrase, .hero-stage, .hero .lede, .hero .cta-row { opacity: 1 !important; transform: none !important; }
}

/* ---------- responsive ---------- */

@media (max-width: 860px) {
  .hero { padding-top: 44px; }
  .hero-grid { grid-template-columns: 1fr; gap: 0; text-align: center; }
  .hero-copy { padding-bottom: 0; }
  .hero-copy .phrase, .hero .lede { margin-left: auto; margin-right: auto; }
  .hero .lede { margin-top: 22px; }
  .hero .cta-row { align-items: center; }
  .hero-stage { margin-top: 40px; }
  .hero .moon { top: -6px; right: 6%; width: 88px; height: 88px; }
  .hero-phone { width: min(270px, 70%); margin: 30px 0 -130px; }
  .hero-watch { width: 150px; left: 1%; bottom: -56px; }
}

@media (max-width: 720px) {
  body { font-size: 1.05rem; }
  .section { padding: 64px 0; }
  .topnav { gap: 16px; font-size: .92rem; }
  .topnav a.hide-sm { display: none; }
  .grid, .privacy-grid { grid-template-columns: 1fr; }
}
