/* Amber's website (ADR-0011), "Nightlight" (owner's choice, 2026-10-29): the night of a 3 a.m. feed, lit by a warm
   amber glow. One theme, dark. Every text/background pair below is checked for WCAG AA contrast by
   tests/contrast.test.mjs, so a colour changed here is changed there too. Fonts are self-hosted (Base.astro). */

:root {
  --bg: #13152b;
  --surface: #1d2040;
  --text: #f3ece0;
  --muted: #b9b4cc;
  --accent: #ffb547;
  --accent-text: #1a1306;
  --border: #363a66;
  --glow: rgb(255 181 71 / .22);
  --serif: "Young Serif", Georgia, "Times New Roman", serif;
  --sans: "Atkinson Hyperlegible Next Variable", "Atkinson Hyperlegible Next", system-ui, sans-serif;
  --measure: 68ch;
  --wide: 72rem;
  color-scheme: dark;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 1.0625rem/1.65 var(--sans);
  font-kerning: normal;
  text-rendering: optimizeLegibility;
}

h1, h2, h3 { font-family: var(--serif); font-weight: 400; line-height: 1.15; letter-spacing: -.01em; text-wrap: balance; }
p, li { text-wrap: pretty; }
/* At very large text on a narrow screen, a long word wraps rather than pushing the page sideways (WCAG 1.4.10). */
h1, h2, h3, p, li, dd, th, td { overflow-wrap: anywhere; hyphens: auto; }

a { color: var(--accent); text-underline-offset: .2em; text-decoration-thickness: 1px; }
a, button { touch-action: manipulation; -webkit-tap-highlight-color: rgb(255 181 71 / .25); }
[id] { scroll-margin-top: 1.5rem; }
a:hover { text-decoration-thickness: 2px; }
a:focus-visible, button:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

.skip { position: absolute; left: -999px; }
.skip:focus { left: 1rem; top: 1rem; background: var(--surface); color: var(--text); padding: .5rem 1rem; z-index: 30; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Page frame */
.site-header, .site-footer, main { max-width: var(--wide); margin: 0 auto; padding-inline: clamp(1.25rem, 4vw, 2.5rem); }

.site-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  padding-block: 1.25rem; }
.brand { display: inline-flex; align-items: center; gap: .625rem; min-height: 44px; color: var(--text);
  text-decoration: none; font-family: var(--serif); font-size: 1.5rem; }
.brand svg { color: var(--accent); }
.site-header nav, .site-footer nav { display: flex; gap: .25rem 1.5rem; flex-wrap: wrap; }
.site-header nav a, .site-footer nav a { min-height: 44px; display: inline-flex; align-items: center; }
.site-header nav a { color: var(--text); text-decoration: none; }
.site-header nav a:hover { color: var(--accent); }

.site-footer { border-top: 1px solid var(--border); margin-top: 5rem; padding-block: 2rem 3rem; color: var(--muted);
  font-size: .9375rem; }
.site-footer p { margin: 1rem 0 0; }

/* Home: the hero is the night itself, with the app glowing in it. */
.hero { position: relative; overflow-x: clip; display: grid; gap: 3rem; align-items: center; padding-block: 3rem 4rem;
  grid-template-columns: 1fr; }
@media (min-width: 56rem) { .hero { grid-template-columns: 1.1fr .9fr; padding-block: 4rem 6rem; } }
.hero h1 { font-size: clamp(2.5rem, 6.5vw, 4.5rem); margin: 0 0 1.5rem; }
.hero .lede { font-size: clamp(1.1875rem, 2vw, 1.375rem); color: var(--muted); max-width: 32ch; margin: 0 0 2rem; }
.availability { margin: 0; color: var(--text); max-width: 34ch; }
.availability strong { color: var(--accent); font-weight: 600; }

/* The phone and watch are drawn in HTML and CSS, so they stay sharp and cost almost nothing to load. They are one
   image to a screen reader (role="img" with a label); their insides are hidden from it. */
.device { position: relative; margin: 4rem auto 0; width: min(19rem, 82vw); isolation: isolate; }
.device::before { content: ""; position: absolute; inset: -30% -40%; z-index: -1;
  background: radial-gradient(closest-side, var(--glow), transparent); }
.phone { border-radius: 2.75rem; padding: .625rem; background: #0b0c19; border: 1px solid var(--border);
  box-shadow: 0 30px 80px rgb(0 0 0 / .5), 0 0 0 1px rgb(255 255 255 / .04) inset; }
.screen { border-radius: 2.25rem; background: linear-gradient(180deg, #232650, #191b38 60%); padding: 1.5rem 1.25rem 1.25rem;
  min-height: 31rem; display: flex; flex-direction: column; gap: .75rem; font-size: .9375rem; }
.app-bar { display: flex; justify-content: space-between; align-items: center; margin: 0 0 1.25rem; color: var(--muted); }
.baby { background: rgb(255 181 71 / .14); color: var(--accent); border-radius: 999px; padding: .125rem .75rem;
  font-weight: 600; }
.state { margin: 0; color: var(--muted); }
/* App timers use the reading face: Young Serif's old-style figures dip below the line, which suits the night's times
   below but not a running clock. */
.timer { margin: 0; font-size: 4rem; font-weight: 300; line-height: 1; letter-spacing: -.02em; color: var(--text);
  font-variant-numeric: tabular-nums; }
.since { margin: 0 0 1rem; color: var(--muted); }
.app-actions { display: grid; grid-template-columns: 1fr 1fr; gap: .625rem; }
.app-actions span { display: grid; place-items: center; min-height: 3.5rem; border-radius: 1.25rem; font-weight: 600; }
.app-actions .switch { border: 1px solid var(--border); color: var(--text); }
.app-actions .stop { background: var(--accent); color: var(--accent-text); }
.recent { list-style: none; margin: .75rem 0 0; padding: 1rem 0 0; border-top: 1px solid var(--border); display: grid; gap: .5rem; }
.recent li { display: flex; justify-content: space-between; gap: 1rem; color: var(--muted); }
.recent li span:first-child { color: var(--text); }

.watch { position: absolute; left: -2.75rem; bottom: -1.75rem; width: 8.5rem; border-radius: 2.25rem; padding: .4rem;
  background: #0b0c19; border: 1px solid var(--border); box-shadow: 0 20px 50px rgb(0 0 0 / .55); }
.watch-face { border-radius: 1.9rem; background: #1d2040; padding: .875rem .75rem; text-align: center;
  font-size: .8125rem; line-height: 1.3; color: var(--muted); }
.watch-face b { display: block; font-weight: 400; font-size: 1.75rem; color: var(--text);
  font-variant-numeric: tabular-nums; margin: .125rem 0 .375rem; }
.watch-face i { display: block; font-style: normal; background: var(--accent); color: var(--accent-text);
  border-radius: 999px; padding: .25rem 0; font-weight: 600; }
@media (max-width: 30rem) { .watch { left: -1rem; width: 7.25rem; } }

/* The spoken command over the phone, and the app's reply on screen. */
.said { position: absolute; top: -3.75rem; right: -1.5rem; z-index: 2; margin: 0; max-width: 15rem;
  background: var(--accent); color: var(--accent-text); font-family: var(--serif); font-size: 1.125rem; line-height: 1.3;
  padding: .75rem 1rem; border-radius: 1.25rem 1.25rem .25rem 1.25rem; box-shadow: 0 12px 30px rgb(0 0 0 / .4); }
@media (max-width: 30rem) { .said { right: 0; font-size: 1rem; } }
.reply { margin: 2.25rem 0 .5rem; color: var(--text); background: rgb(255 255 255 / .06); border-radius: .875rem;
  padding: .5rem .75rem; }

/* Just say it */
.phrases { list-style: none; margin: 0 0 3rem; padding: 0; display: grid; gap: .875rem 2.5rem;
  grid-template-columns: repeat(auto-fit, minmax(min(17rem, 100%), 1fr)); }
.phrases li { font-family: var(--serif); font-size: clamp(1.25rem, 2.4vw, 1.625rem); line-height: 1.3; color: var(--text); }
.exchange { max-width: 30rem; margin: 0 0 2rem; }
.exchange h3 { font-size: 1.375rem; margin: 0 0 1rem; }
.line { margin: 0 0 .625rem; padding: .625rem 1rem; border-radius: 1rem; width: fit-content; max-width: 100%; }
.line .who { display: block; font-size: .8125rem; color: var(--muted); }
.line.you { background: var(--surface); border: 1px solid var(--border); }
.line.amber { margin-left: auto; background: rgb(255 181 71 / .14); color: var(--text); }
.line.amber .who { color: var(--accent); }
.aside { color: var(--muted); max-width: 52ch; margin: 1.5rem 0 0; }

/* On your wrist */
.watches { display: flex; gap: 2rem; align-items: center; justify-content: flex-start; flex-wrap: wrap; margin: 0 0 3rem; }
.watch-lg { width: 11rem; border-radius: 2.75rem; padding: .5rem; background: #0b0c19; border: 1px solid var(--border);
  box-shadow: 0 24px 60px rgb(0 0 0 / .5), 0 0 60px var(--glow); }
.watch-lg.round { width: 12rem; border-radius: 50%; }
.watch-lg .watch-face { border-radius: 2.3rem; padding: 1rem .875rem; font-size: .875rem; display: grid; gap: .375rem; }
.watch-lg.round .watch-face { border-radius: 50%; aspect-ratio: 1; align-content: center; padding: 1.5rem; }
.watch-lg .watch-face b { font-size: 1.375rem; margin: 0; }
.watch-lg .watch-face .sub { color: var(--muted); }

/* One night with Amber: a real sequence, so it is an ordered list with times. */
.section { padding-block: 4rem 2rem; }
.section > h2 { font-size: clamp(1.875rem, 4vw, 2.75rem); margin: 0 0 .75rem; }
.section > .intro { color: var(--muted); max-width: 52ch; margin: 0 0 2.5rem; font-size: 1.125rem; }

.night { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; max-width: 46rem; }
.night li { display: grid; grid-template-columns: 4.5rem 1fr; gap: 0 1.5rem; padding: 1.5rem 0 1.5rem;
  border-top: 1px solid var(--border); }
.night li:last-child { border-bottom: 1px solid var(--border); }
.night time { font-family: var(--serif); font-size: 1.5rem; color: var(--accent); font-variant-numeric: tabular-nums;
  line-height: 1.2; }
.night h3 { font-size: 1.375rem; margin: 0 0 .375rem; }
.night p { margin: 0; color: var(--muted); max-width: 52ch; }

.promises { display: grid; gap: 2rem 3rem; grid-template-columns: repeat(auto-fit, minmax(min(15rem, 100%), 1fr)); margin: 2rem 0 0;
  padding: 0; list-style: none; }
.promises h3 { font-size: 1.25rem; margin: 0 0 .5rem; }
.promises p { margin: 0; color: var(--muted); }

.note { background: var(--surface); border: 1px solid var(--border); border-radius: 1.25rem; padding: 1.5rem 1.75rem;
  max-width: 46rem; margin: 0; }
.note h2 { font-size: 1.5rem; margin: 0 0 .5rem; }
.note p { margin: 0; color: var(--text); }

/* Legal pages: long reading at night, so a narrower measure and generous leading. */
.legal { max-width: var(--measure); padding-block: 2rem; }
.legal h1 { font-size: clamp(2.25rem, 5vw, 3.25rem); margin: 0 0 .5rem; }
.legal h2 { font-size: 1.625rem; margin: 2.75rem 0 .75rem; }
.legal h3 { font-size: 1.25rem; margin: 2rem 0 .5rem; }
.legal li { margin-bottom: .375rem; }
/* A table scrolls inside its own box on a narrow screen, never the whole page (WCAG 1.4.10). The box is focusable so
   it can be scrolled from the keyboard. */
.table-scroll { overflow-x: auto; margin: 1rem 0; }
.table-scroll:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.legal table { border-collapse: collapse; width: 100%; font-size: .9375rem; }
.legal th, .legal td { border: 1px solid var(--border); padding: .625rem .75rem; text-align: left; vertical-align: top; }
.legal th { background: var(--surface); font-weight: 600; }
.legal .note { margin: 1.5rem 0; }
.legal .note p + p { margin-top: .75rem; }
.updated { color: var(--muted); margin-top: 0; }
.draft { border: 2px dashed var(--accent); border-radius: 1rem; padding: 1rem 1.25rem; }

/* Buttons */
.button { min-height: 44px; padding: .625rem 1.375rem; border-radius: 999px; border: 2px solid var(--accent);
  background: var(--accent); color: var(--accent-text); font: inherit; font-weight: 600; cursor: pointer; }
.button.secondary { background: transparent; color: var(--text); border-color: var(--border); }
.link { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; text-decoration: underline;
  text-underline-offset: .2em; cursor: pointer; min-height: 44px; }
a, .button, .link { transition: color .2s ease, background-color .2s ease, border-color .2s ease; }
.button:hover { filter: brightness(1.06); }
.button.secondary:hover { border-color: var(--muted); }
button { cursor: pointer; }

/* Analytics consent */
.consent { position: fixed;
  inset: auto max(1rem, env(safe-area-inset-right)) max(1rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
  overscroll-behavior: contain; max-width: 34rem; margin-left: auto; background: var(--surface);
  color: var(--text); border: 1px solid var(--border); border-radius: 1.25rem; padding: 1.25rem 1.5rem;
  box-shadow: 0 20px 60px rgb(0 0 0 / .55); z-index: 20;
  /* At large text sizes or zoom the whole explanation stays reachable: the banner scrolls inside the viewport. */
  max-height: calc(100vh - 2rem); max-height: calc(100dvh - 2rem); overflow-y: auto; }
.consent[hidden] { display: none; }
/* While the banner is open, the page can scroll its footer clear of it. */
body.consent-open { padding-bottom: 14rem; }
.consent-title { font-family: var(--serif); font-size: 1.25rem; margin: 0 0 .25rem; }
.consent-actions { display: flex; gap: .75rem; justify-content: flex-end; flex-wrap: wrap; }

.todo { background: #ffe2a8; color: #13152b; padding: 0 .25rem; border-radius: 4px; }

/* Reduced motion: no transitions (the timer's count-up, the page's one animation, is skipped in its script). */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
