/*
  Hush: sleep sounds app (Screenery template)
  Accessible soft UI: one dusk-lavender ground, every control extruded or pressed in with a paired light and dark shadow,
  and on top of that a 3:1 outline on every control, a text state ("On", "62%", "Playing") and a solid indigo focus ring.

  Contents
   1. Tokens
   2. Base and browser surfaces
   3. Soft surfaces: raised, pressed, outlined
   4. Components: buttons, fields, switch, knob, range, chips, notices
   5. Header
   6. Hero and device frame
   7. The app: now bar, transport, sounds, timer, mixes
   8. How it helps
   9. Sleep week
  10. Notes, pricing, questions
  11. Footer
  12. Motion
  13. Narrow screens
*/

/* ---------- 1. Tokens ---------- */
:root {
  /* Palette */
  --ground: #dcd7e6;      /* the one soft surface everything is pressed out of */
  --ink: #241f38;         /* text, 12.6:1 on ground */
  --ink-soft: #463f5e;    /* secondary text, 7.4:1 on ground */
  --edge: #7a7093;        /* control outlines, 3.2:1 on ground (WCAG 1.4.11) */
  --accent: #4d3aa8;      /* on states, focus ring, 5.9:1 on ground */
  --accent-ink: #ffffff;  /* text on accent, 8.6:1 */
  --moon: #f3e6c4;        /* warm lamp tint, used on the accent only */
  --error: #96243a;       /* 5.4:1 on ground */
  --ok: #1f6446;          /* 5.6:1 on ground */

  /* The paired shadows of soft UI */
  --hi: #f8f6fc;          /* light from the top left */
  --lo: #a9a0bf;          /* shade to the bottom right */
  --well: #d2ccdf;        /* slightly deeper ground for pressed wells */

  --raise-sm: -3px -3px 7px var(--hi), 3px 3px 7px var(--lo);
  --raise: -6px -6px 14px var(--hi), 6px 6px 14px var(--lo);
  --raise-lg: -14px -14px 32px var(--hi), 14px 14px 32px var(--lo);
  --press: inset 3px 3px 7px var(--lo), inset -3px -3px 7px var(--hi);
  --press-sm: inset 2px 2px 4px var(--lo), inset -2px -2px 4px var(--hi);

  /* Type */
  --font: "Quicksand", system-ui, sans-serif;
  --step-0: 1rem;
  --step-1: 1.125rem;
  --step-2: 1.375rem;
  --step-3: clamp(1.6rem, 1.2rem + 1.6vw, 2.25rem);
  --step-4: clamp(2.2rem, 1.4rem + 3vw, 3.6rem);

  /* Space and radius */
  --s-1: .25rem; --s-2: .5rem; --s-3: .75rem; --s-4: 1rem; --s-5: 1.5rem; --s-6: 2rem; --s-7: 3rem; --s-8: 5rem; --s-9: 7.5rem;
  --r-sm: 12px; --r: 20px; --r-lg: 28px; --r-xl: 44px; --r-pill: 999px;
  --gutter: clamp(1rem, 4vw, 3rem);
  --max: 1240px;

  --ease: cubic-bezier(.16, 1, .3, 1); /* exponential ease-out */
  --focus: 0 0 0 3px var(--ground), 0 0 0 6px var(--accent);
}

/* ---------- 2. Base and browser surfaces ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scrollbar-color: var(--edge) var(--ground); accent-color: var(--accent); }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font: 500 var(--step-0)/1.6 var(--font);
  caret-color: var(--accent);
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--accent); color: var(--accent-ink); }
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: var(--ground); }
::-webkit-scrollbar-thumb { background: var(--edge); border-radius: 12px; border: 3px solid var(--ground); }
h1, h2, h3 { margin: 0; line-height: 1.15; text-wrap: balance; font-weight: 700; letter-spacing: -.015em; }
p { margin: 0; text-wrap: pretty; }
a { color: var(--accent); text-underline-offset: .22em; text-decoration-thickness: 1.5px; }
a:hover { color: var(--ink); }
strong { font-weight: 700; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.ico { width: 1.25em; height: 1.25em; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: var(--s-4); top: -100px; z-index: 10; padding: var(--s-3) var(--s-4); background: var(--accent); color: var(--accent-ink); border-radius: var(--r-sm); font-weight: 700; }
.skip:focus { top: var(--s-4); }
.skip:hover { color: var(--accent-ink); }
[hidden] { display: none !important; }
.tabnum, output, .knob-value, .ring-time, .bar-val, .price-num, .week-table td { font-variant-numeric: tabular-nums; }

/* ---------- 3. Soft surfaces ----------
   The accessibility rule of this template: softness never carries meaning on its own.
   Every control also has a visible outline (--edge, 3:1) and a text state. */
.raised { background: var(--ground); box-shadow: var(--raise); }

/* ---------- 4. Components ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  min-height: 48px; padding: 0 var(--s-5);
  border: 1.5px solid var(--accent); border-radius: var(--r-pill);
  background: var(--accent); color: var(--accent-ink);
  font: 700 var(--step-0)/1 var(--font); text-decoration: none; cursor: pointer;
  box-shadow: var(--raise-sm);
  transition: box-shadow .25s var(--ease), transform .25s var(--ease), background-color .2s;
}
.btn:hover { color: var(--accent-ink); background: color-mix(in srgb, var(--accent) 88%, var(--ink)); }
.btn:active { box-shadow: var(--press-sm); transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--raise-sm), var(--focus); }
.btn-sm { min-height: 44px; padding: 0 var(--s-4); font-size: .95rem; }
.btn-quiet { background: var(--ground); color: var(--ink); border-color: var(--edge); }
.btn-quiet:hover { background: var(--ground); color: var(--accent); border-color: var(--accent); }
.btn[disabled], .btn[aria-busy="true"] { cursor: progress; opacity: 1; background: var(--well); color: var(--ink-soft); border-color: var(--edge); box-shadow: var(--press-sm); }

.field {
  width: 100%; min-height: 48px; padding: 0 var(--s-4);
  border: 1.5px solid var(--edge); border-radius: var(--r-sm);
  background: var(--well); color: var(--ink);
  font: 600 var(--step-0)/1 var(--font);
  box-shadow: var(--press);
}
.field::placeholder { color: var(--ink-soft); opacity: 1; font-weight: 500; }
.field:focus-visible { outline: none; border-color: var(--accent); box-shadow: var(--press), var(--focus); }
.field[aria-invalid="true"] { border-color: var(--error); border-width: 2px; }
.field-err, .field-msg { min-height: 1.4em; margin-top: var(--s-2); font-size: .9rem; font-weight: 600; }
.field-err, .field-msg[data-tone="error"] { color: var(--error); }
.field-msg[data-tone="ok"] { color: var(--ok); }
.field-msg[data-tone="busy"] { color: var(--ink-soft); }
label { font-weight: 600; font-size: .95rem; }
.help { color: var(--ink-soft); font-size: .875rem; line-height: 1.5; }

/* Switch: a pressed-in track with a raised thumb, plus the word On or Off */
.switch {
  display: inline-flex; align-items: center; gap: var(--s-2);
  min-height: 44px; padding: 0 var(--s-3) 0 var(--s-1);
  border: 0; background: none; color: var(--ink); cursor: pointer;
  font: 700 .9rem/1 var(--font); border-radius: var(--r-pill);
}
.switch-track {
  position: relative; width: 52px; height: 30px; border-radius: var(--r-pill);
  background: var(--well); border: 1.5px solid var(--edge); box-shadow: var(--press-sm);
  transition: background-color .3s var(--ease), border-color .3s;
}
.switch-thumb {
  position: absolute; top: 3px; left: 3px; width: 21px; height: 21px; border-radius: 50%;
  background: var(--ground); border: 1.5px solid var(--edge);
  box-shadow: -1px -1px 3px var(--hi), 2px 2px 4px var(--lo);
  transition: transform .35s var(--ease), background-color .3s;
}
.switch[aria-checked="true"] .switch-track { background: var(--accent); border-color: var(--accent); }
.switch[aria-checked="true"] .switch-thumb { transform: translateX(22px); background: var(--moon); border-color: var(--moon); }
.switch-text { min-width: 2em; text-align: left; }
.switch[aria-checked="true"] .switch-text { color: var(--accent); }
.switch:focus-visible { outline: none; box-shadow: var(--focus); }

/* Knob: rotary volume. The arc shows the level, the cap's tick points at it, the number says it. */
.knob {
  --v: 50;
  position: relative; display: grid; place-items: center;
  width: 76px; height: 76px; flex: none;
  border-radius: 50%; cursor: ns-resize; touch-action: none; user-select: none;
}
.knob-arc { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.arc-track, .arc-fill { fill: none; stroke-width: 5; stroke-linecap: round; }
.arc-track { stroke: var(--edge); opacity: .55; }
.arc-fill { stroke: var(--accent); stroke-dasharray: var(--v) 100; transition: stroke-dasharray .12s linear, stroke .3s; }
.knob-cap {
  position: relative; width: 46px; height: 46px; border-radius: 50%;
  background: var(--ground); border: 1.5px solid var(--edge); box-shadow: var(--raise-sm);
  transform: rotate(calc(-135deg + var(--v) * 2.7deg));
}
.knob-tick { position: absolute; left: 50%; top: 5px; width: 3px; height: 12px; margin-left: -1.5px; border-radius: 2px; background: var(--ink); }
.knob-value { position: absolute; bottom: -2px; left: 50%; transform: translate(-50%, 100%); font-size: .85rem; font-weight: 700; color: var(--ink); }
.knob:focus-visible { outline: none; }
.knob:focus-visible .knob-cap { box-shadow: var(--raise-sm), var(--focus); }
.knob.is-dragging .knob-cap { box-shadow: var(--press-sm); }

/* Range: master volume */
.range { -webkit-appearance: none; appearance: none; width: 100%; height: 44px; background: transparent; cursor: pointer; margin: 0; }
.range::-webkit-slider-runnable-track { height: 14px; border-radius: var(--r-pill); border: 1.5px solid var(--edge); box-shadow: var(--press-sm);
  background: linear-gradient(90deg, var(--accent) 0 var(--fill, 70%), var(--well) var(--fill, 70%)); }
.range::-moz-range-track { height: 14px; border-radius: var(--r-pill); border: 1.5px solid var(--edge); background: var(--well); box-shadow: var(--press-sm); }
.range::-moz-range-progress { height: 14px; border-radius: var(--r-pill); background: var(--accent); }
.range::-webkit-slider-thumb { -webkit-appearance: none; width: 28px; height: 28px; margin-top: -8.5px; border-radius: 50%; background: var(--ground); border: 1.5px solid var(--edge); box-shadow: var(--raise-sm); }
.range::-moz-range-thumb { width: 26px; height: 26px; border-radius: 50%; background: var(--ground); border: 1.5px solid var(--edge); box-shadow: var(--raise-sm); }
.range:focus-visible { outline: none; }
.range:focus-visible::-webkit-slider-thumb { box-shadow: var(--raise-sm), var(--focus); }
.range:focus-visible::-moz-range-thumb { box-shadow: var(--raise-sm), var(--focus); }

/* Chips and mix buttons: raised when idle, pressed in and outlined in accent when chosen */
.chip, .mix {
  min-height: 44px; padding: 0 var(--s-4);
  border: 1.5px solid var(--edge); border-radius: var(--r-pill);
  background: var(--ground); color: var(--ink);
  font: 700 .95rem/1 var(--font); cursor: pointer;
  box-shadow: var(--raise-sm);
  transition: box-shadow .3s var(--ease), color .2s, border-color .2s;
}
.chip:hover, .mix:hover { border-color: var(--accent); color: var(--accent); }
.chip[aria-pressed="true"], .mix[aria-pressed="true"] { box-shadow: var(--press-sm); border: 2px solid var(--accent); color: var(--accent); background: var(--well); }
.chip:focus-visible, .mix:focus-visible { outline: none; box-shadow: var(--raise-sm), var(--focus); }
.chip[aria-pressed="true"]:focus-visible, .mix[aria-pressed="true"]:focus-visible { box-shadow: var(--press-sm), var(--focus); }

.notice { display: flex; gap: var(--s-3); padding: var(--s-4); border-radius: var(--r); border: 2px solid var(--error); background: var(--well); color: var(--ink); box-shadow: var(--press-sm); font-size: .925rem; }
.notice .ico { color: var(--error); width: 1.5em; height: 1.5em; }
.notice-title { font-weight: 700; color: var(--error); margin-bottom: var(--s-1); }

/* ---------- 5. Header ---------- */
.top {
  display: flex; align-items: center; gap: var(--s-5);
  max-width: var(--max); margin: 0 auto; padding: var(--s-5) var(--gutter);
}
.logo { display: inline-flex; align-items: center; gap: var(--s-3); color: var(--ink); text-decoration: none; font-weight: 700; font-size: 1.45rem; letter-spacing: -.02em; border-radius: var(--r-pill); }
.logo-mark { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--ground); color: var(--accent); border: 1.5px solid var(--edge); box-shadow: var(--raise-sm); }
.logo-mark .ico { width: 22px; height: 22px; fill: var(--accent); stroke: var(--accent); }
.nav { display: flex; gap: var(--s-2); margin-left: auto; }
.nav a { padding: var(--s-2) var(--s-3); border-radius: var(--r-pill); color: var(--ink); text-decoration: none; font-weight: 600; }
.nav a:hover { color: var(--accent); text-decoration: underline; }

/* ---------- 6. Hero and device frame ---------- */
.hero {
  display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.45fr); gap: clamp(2rem, 4vw, 4.5rem);
  align-items: start; max-width: var(--max); margin: 0 auto; padding: var(--s-6) var(--gutter) var(--s-8);
}
.hero-copy { position: sticky; top: var(--s-6); padding-top: var(--s-6); display: grid; gap: var(--s-5); }
.hero h1 { font-size: var(--step-4); letter-spacing: -.03em; }
.lede { font-size: var(--step-1); color: var(--ink-soft); max-width: 40ch; }
.hero-facts { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-3); }
.hero-facts li { display: flex; gap: var(--s-3); align-items: flex-start; font-weight: 600; }
.hero-facts .ico { color: var(--accent); margin-top: .15em; stroke-width: 2.2; }
.hero-note { padding: var(--s-3) var(--s-4); border: 1.5px solid var(--edge); border-radius: var(--r); box-shadow: var(--press-sm); font-size: .95rem; }

.device-slab {
  position: relative; padding: clamp(1.25rem, 2.4vw, 2rem); padding-top: 2.75rem;
  border-radius: var(--r-xl); background: var(--ground);
  border: 1.5px solid color-mix(in srgb, var(--edge) 45%, var(--ground));
  box-shadow: var(--raise-lg);
}
.device-ear { position: absolute; top: 1.1rem; left: 50%; width: 72px; height: 8px; margin-left: -36px; border-radius: var(--r-pill); box-shadow: var(--press-sm); background: var(--well); }
.app { display: grid; gap: var(--s-5); outline: none; }

/* ---------- 7. The app ---------- */
.now { display: flex; align-items: center; justify-content: space-between; gap: var(--s-4); flex-wrap: wrap; }
.now-label { font-size: .875rem; font-weight: 600; color: var(--ink-soft); }
.now-name { font-size: var(--step-2); font-weight: 700; line-height: 1.2; }
.status {
  display: inline-flex; align-items: center; gap: var(--s-2);
  min-height: 40px; padding: var(--s-2) var(--s-4); border-radius: var(--r-pill);
  border: 1.5px solid var(--edge); box-shadow: var(--press-sm); background: var(--well);
  font-size: .9rem; font-weight: 700;
}
.status-ico { width: 1.15em; height: 1.15em; }
.eq { display: none; align-items: flex-end; gap: 2px; height: 14px; }
.eq i { width: 3px; height: 100%; border-radius: 2px; background: currentColor; transform-origin: bottom; transform: scaleY(.6); }
.status[data-status="playing"], .status[data-status="fading"] { color: var(--accent); border-color: var(--accent); }
.status[data-status="playing"] .eq, .status[data-status="fading"] .eq { display: inline-flex; }
.status[data-status="playing"] .status-ico, .status[data-status="fading"] .status-ico { display: none; }
.status[data-status="error"] { color: var(--error); border-color: var(--error); }
.status[data-status="finished"] { color: var(--ok); border-color: var(--ok); }

.transport { display: grid; grid-template-columns: auto 1fr; gap: var(--s-6); align-items: center; padding: var(--s-5); border-radius: var(--r-lg); box-shadow: var(--press); border: 1.5px solid color-mix(in srgb, var(--edge) 50%, var(--ground)); }
.play-wrap { position: relative; display: grid; place-items: center; width: 128px; height: 128px; }
.breath { position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--accent); opacity: 0; }
.play {
  position: relative; display: grid; place-items: center; gap: 2px; align-content: center;
  width: 112px; height: 112px; border-radius: 50%;
  border: 2px solid var(--edge); background: var(--ground); color: var(--ink); cursor: pointer;
  font: 700 1rem/1 var(--font); box-shadow: var(--raise);
  transition: box-shadow .45s var(--ease), color .3s, border-color .3s, background-color .3s;
}
.play .ico { width: 34px; height: 34px; fill: currentColor; stroke-width: 1.5; }
.play .ico-pause { display: none; fill: none; stroke-width: 3; }
.play:hover { border-color: var(--accent); color: var(--accent); }
.play[aria-pressed="true"] { box-shadow: var(--press); border-color: var(--accent); color: var(--accent); background: var(--well); }
.play[aria-pressed="true"] .ico-play { display: none; }
.play[aria-pressed="true"] .ico-pause { display: block; }
.play:focus-visible { outline: none; box-shadow: var(--raise), var(--focus); }
.play[aria-pressed="true"]:focus-visible { box-shadow: var(--press), var(--focus); }
.play:disabled { cursor: not-allowed; color: var(--ink-soft); border-style: dashed; box-shadow: var(--press-sm); }
.play:disabled:hover { border-color: var(--edge); }
.master { display: grid; gap: var(--s-1); }
.master-label { display: flex; justify-content: space-between; gap: var(--s-3); }
.master-label output { font-weight: 700; color: var(--accent); }

.sounds { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-4); }
.sound {
  display: grid; grid-template-rows: auto auto 1fr; gap: var(--s-1);
  padding: var(--s-4) var(--s-4) var(--s-5); border-radius: var(--r);
  background: var(--ground); border: 1.5px solid color-mix(in srgb, var(--edge) 55%, var(--ground));
  box-shadow: var(--raise-sm);
  transition: box-shadow .4s var(--ease), border-color .3s;
}
.sound[data-on="true"] { border: 2px solid var(--accent); }
.sound-head { display: flex; align-items: center; gap: var(--s-3); }
.sound-ico { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; box-shadow: var(--press-sm); color: var(--ink-soft); transition: color .3s, background-color .3s; }
.sound[data-on="true"] .sound-ico { color: var(--accent-ink); background: var(--accent); box-shadow: -2px -2px 4px var(--hi), 2px 2px 4px var(--lo); }
.sound-name { font-size: 1.05rem; }
.sound-desc { font-size: .85rem; color: var(--ink-soft); }
.sound-controls { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); margin-top: var(--s-3); padding-bottom: var(--s-4); flex-wrap: wrap; }
.sound[data-on="false"] .arc-fill { stroke: var(--ink-soft); }
.knob-help { margin-top: calc(var(--s-3) * -1); }

.lower { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--s-4); }
.panel { padding: var(--s-5); border-radius: var(--r-lg); box-shadow: var(--press); border: 1.5px solid color-mix(in srgb, var(--edge) 50%, var(--ground)); display: grid; gap: var(--s-4); align-content: start; }
.panel-title { display: flex; align-items: center; gap: var(--s-2); font-size: 1.1rem; }
.panel-title .ico { color: var(--accent); }

.timer { container-type: inline-size; }
.timer-body { display: grid; grid-template-columns: auto 1fr; gap: var(--s-5); align-items: start; }
.ring { position: relative; width: 132px; height: 132px; border-radius: 50%; box-shadow: var(--raise); display: grid; place-items: center; }
.ring svg { position: absolute; inset: 8px; width: calc(100% - 16px); height: calc(100% - 16px); transform: rotate(-90deg); }
.ring-well { fill: none; stroke: var(--well); stroke-width: 10; }
.ring-fill { fill: none; stroke: var(--accent); stroke-width: 10; stroke-linecap: round; stroke-dasharray: var(--p, 0) 100; transition: stroke-dasharray .3s linear; }
.ring[data-state="off"] .ring-fill { stroke: transparent; }
.ring[data-state="fading"] .ring-fill { stroke: var(--ink-soft); }
.ring-text { position: relative; display: grid; text-align: center; line-height: 1.1; }
.ring-time { font-size: 1.5rem; font-weight: 700; }
.ring-sub { font-size: .8rem; font-weight: 600; color: var(--ink-soft); }
.timer-controls { display: grid; gap: var(--s-3); }
.chips { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-2); }
.chip { padding: 0 var(--s-3); }
.custom { display: grid; gap: var(--s-1); }
.custom-row, .save-row, .trial-row { display: flex; gap: var(--s-2); margin-top: var(--s-1); }
.custom-row .field { max-width: 7.5rem; }
#timer-cancel { justify-self: start; }
@container (max-width: 420px) {
  .timer-body { grid-template-columns: 1fr; justify-items: center; }
  .timer-controls { width: 100%; }
}

.mix-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--s-2); }
.mix-list li { display: flex; align-items: center; }
.mix-custom { display: inline-flex; align-items: center; border-radius: var(--r-pill); }
.mix-custom .mix { border-radius: var(--r-pill) 0 0 var(--r-pill); border-right-width: 0; }
.mix-del { display: grid; place-items: center; width: 44px; min-height: 44px; border: 1.5px solid var(--edge); border-radius: 0 var(--r-pill) var(--r-pill) 0; background: var(--ground); color: var(--ink); cursor: pointer; box-shadow: var(--raise-sm); }
.mix-del:hover { color: var(--error); border-color: var(--error); }
.mix-del:focus-visible { outline: none; box-shadow: var(--raise-sm), var(--focus); }
.save { display: grid; }
.save-row .field { flex: 1; min-width: 0; }

/* ---------- 8. How it helps ---------- */
section[id] { scroll-margin-top: var(--s-5); }
.helps, .week, .notes, .pricing, .faq { max-width: var(--max); margin: 0 auto; padding: var(--s-8) var(--gutter) 0; }
.helps > h2, .week h2, .notes h2, .pricing h2, .faq h2 { font-size: var(--step-3); max-width: 24ch; }
.section-lede { margin-top: var(--s-4); color: var(--ink-soft); font-size: var(--step-1); max-width: 62ch; }
.helps-grid { display: grid; grid-template-columns: 1.15fr 1fr; gap: var(--s-6); margin-top: var(--s-7); align-items: stretch; }
.use { display: grid; gap: var(--s-4); align-content: start; padding: clamp(1.5rem, 3vw, 2.5rem); border-radius: var(--r-lg); }
.use h3 { display: flex; align-items: center; gap: var(--s-3); font-size: var(--step-2); }
.use h3 .ico { color: var(--accent); width: 1.3em; height: 1.3em; }
.use p { max-width: 62ch; }
.use-sleep { box-shadow: var(--raise); border: 1.5px solid color-mix(in srgb, var(--edge) 45%, var(--ground)); }
.use-focus { box-shadow: var(--press); border: 1.5px solid color-mix(in srgb, var(--edge) 45%, var(--ground)); }
.fade-fig { margin: var(--s-2) 0 0; padding: var(--s-4); border-radius: var(--r); box-shadow: var(--press-sm); background: var(--well); }
.fade-fig svg { width: 100%; height: auto; display: block; overflow: visible; }
.fade-fig text { font: 600 12px var(--font); fill: var(--ink-soft); }
.fig-grid { fill: none; stroke: var(--edge); stroke-width: 1.5; }
.fig-line { fill: none; stroke: var(--accent); stroke-width: 4; stroke-linecap: round; }
.fig-mark { stroke: var(--ink-soft); stroke-width: 1.5; stroke-dasharray: 4 5; }
.fade-fig figcaption { margin-top: var(--s-3); font-size: .875rem; color: var(--ink-soft); }
.focus-list { list-style: none; margin: var(--s-2) 0 0; padding: 0; display: grid; gap: var(--s-3); }
.focus-list li { display: flex; justify-content: space-between; flex-wrap: wrap; gap: var(--s-2); padding: var(--s-3) var(--s-4); border-radius: var(--r-pill); background: var(--ground); box-shadow: var(--raise-sm); border: 1.5px solid color-mix(in srgb, var(--edge) 45%, var(--ground)); color: var(--ink-soft); font-size: .95rem; }
.focus-list strong { color: var(--ink); }

/* ---------- 9. Sleep week ---------- */
.week-card { margin-top: var(--s-6); padding: clamp(1.25rem, 3vw, 2.5rem); border-radius: var(--r-lg); box-shadow: var(--raise); border: 1.5px solid color-mix(in srgb, var(--edge) 45%, var(--ground)); display: grid; gap: var(--s-5); }
.week-sum { font-size: var(--step-1); max-width: 60ch; }
.week-sum strong { color: var(--accent); }
.chart { position: relative; height: 320px; padding-left: 2.6rem; --labels: 3.2rem; }
.chart-grid { position: absolute; inset: 0 0 var(--labels) 2.6rem; }
.chart-grid span { position: absolute; left: -2.6rem; right: 0; bottom: var(--h); border-bottom: 1.5px dashed color-mix(in srgb, var(--edge) 60%, var(--ground)); font-size: .8rem; font-weight: 600; color: var(--ink-soft); line-height: 1; padding-bottom: 2px; }
.bars { position: relative; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: clamp(.4rem, 1.6vw, 1.25rem); height: 100%; }
.bar { display: grid; grid-template-rows: 1fr 2rem 1.2rem; justify-items: center; text-align: center; min-width: 0; }
.bar-well { width: min(100%, 56px); height: 100%; border-radius: var(--r-sm) var(--r-sm) 6px 6px; box-shadow: var(--press-sm); background: var(--well); display: flex; flex-direction: column; justify-content: flex-end; align-items: center; }
.bar-val { padding-bottom: 4px; font-size: .85rem; font-weight: 700; line-height: 1.1; }
.bar-fill { width: 100%; height: calc(var(--v) / 540 * 100%); flex: none; border-radius: var(--r-sm) var(--r-sm) 6px 6px; background: var(--accent); box-shadow: -2px -2px 4px var(--hi), 2px 2px 5px var(--lo); }
.bar[data-mix="seaside"] .bar-fill { background: color-mix(in srgb, var(--accent) 62%, var(--ink)); }
.bar[data-mix="campfire"] .bar-fill { background: var(--ink-soft); }
.bar-day { align-self: end; font-weight: 700; line-height: 1.2; }
.bar-mix { font-size: .75rem; color: var(--ink-soft); font-weight: 600; line-height: 1.2; }
.legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-5); font-size: .9rem; font-weight: 600; }
.legend li { display: inline-flex; align-items: center; gap: var(--s-2); }
.sw { width: 14px; height: 14px; border-radius: 4px; background: var(--accent); }
.sw-seaside { background: color-mix(in srgb, var(--accent) 62%, var(--ink)); }
.sw-campfire { background: var(--ink-soft); }
.table-wrap { border-radius: var(--r); border: 1.5px solid var(--edge); padding: var(--s-1) var(--s-4); }
.table-wrap summary { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); min-height: 48px; font-weight: 700; cursor: pointer; list-style: none; }
.table-wrap summary::-webkit-details-marker { display: none; }
.table-wrap summary:focus-visible { outline-offset: 4px; border-radius: 8px; }
.table-wrap[open] summary .ico, .q[open] summary .ico { transform: rotate(180deg); }
.week-table { width: 100%; border-collapse: collapse; margin-bottom: var(--s-4); font-size: .95rem; }
.week-table th, .week-table td { text-align: left; padding: var(--s-2) var(--s-3) var(--s-2) 0; border-bottom: 1px solid color-mix(in srgb, var(--edge) 50%, var(--ground)); }
.week-table thead th { color: var(--ink-soft); font-size: .85rem; }
.week-table tfoot th, .week-table tfoot td { font-weight: 700; border-bottom: 0; }
.fine { font-size: .85rem; color: var(--ink-soft); max-width: 70ch; }

/* ---------- 10. Notes, pricing, questions ---------- */
.notes-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-6); margin-top: var(--s-6); }
.note { margin: 0; display: grid; gap: var(--s-5); align-content: space-between; padding: clamp(1.5rem, 3vw, 2.25rem); border-radius: var(--r-lg); box-shadow: var(--press); }
.note blockquote { margin: 0; font-size: var(--step-1); line-height: 1.55; font-weight: 600; }
.note figcaption { display: flex; align-items: center; gap: var(--s-3); font-size: .9rem; color: var(--ink-soft); }
.note figcaption strong { color: var(--ink); display: block; }
.avatar { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: var(--ground); box-shadow: var(--raise-sm); border: 1.5px solid var(--edge); font-weight: 700; color: var(--accent); flex: none; }

.pricing-head { display: flex; align-items: end; justify-content: space-between; gap: var(--s-5); flex-wrap: wrap; }
.billing { display: flex; align-items: center; gap: var(--s-2); font-weight: 700; }
.billing-save { padding: var(--s-1) var(--s-3); border-radius: var(--r-pill); border: 1.5px solid var(--ok); color: var(--ok); font-size: .85rem; }
.plans { display: grid; grid-template-columns: .85fr 1.15fr; gap: var(--s-6); margin-top: var(--s-6); align-items: start; }
.plan { display: grid; gap: var(--s-4); padding: clamp(1.5rem, 3vw, 2.5rem); border-radius: var(--r-lg); box-shadow: var(--raise); border: 1.5px solid color-mix(in srgb, var(--edge) 45%, var(--ground)); }
.plan-plus { border: 2px solid var(--accent); }
.plan h3 { font-size: var(--step-2); }
.price { display: flex; align-items: baseline; flex-wrap: wrap; gap: var(--s-2); }
.price-num { font-size: 2.6rem; font-weight: 700; letter-spacing: -.03em; line-height: 1; }
.price-per { color: var(--ink-soft); font-weight: 600; }
.plan-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-3); }
.plan-list li { display: flex; gap: var(--s-3); }
.plan-list .ico { color: var(--accent); stroke-width: 2.2; margin-top: .15em; }
.plan .btn { justify-self: start; }
.trial { display: grid; margin-top: var(--s-2); padding-top: var(--s-4); border-top: 1.5px solid color-mix(in srgb, var(--edge) 50%, var(--ground)); }
.trial-row .field { flex: 1; min-width: 0; }

.faq { padding-bottom: var(--s-8); display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.5fr); gap: var(--s-7); align-items: start; }
.faq-head { position: sticky; top: var(--s-6); }
.faq-list { display: grid; gap: var(--s-4); }
.q { border-radius: var(--r); background: var(--ground); box-shadow: var(--raise-sm); border: 1.5px solid color-mix(in srgb, var(--edge) 55%, var(--ground)); transition: box-shadow .35s var(--ease); }
.q[open] { box-shadow: var(--press-sm); border-color: var(--edge); }
.q summary { display: flex; align-items: center; justify-content: space-between; gap: var(--s-4); min-height: 56px; padding: var(--s-3) var(--s-5); font-weight: 700; font-size: 1.05rem; cursor: pointer; list-style: none; border-radius: var(--r); }
.q summary::-webkit-details-marker { display: none; }
.q summary:focus-visible { outline: none; box-shadow: var(--focus); }
.q summary .ico, .table-wrap summary .ico { transition: transform .35s var(--ease); color: var(--accent); }
.q p { padding: 0 var(--s-5) var(--s-5); max-width: 68ch; color: var(--ink-soft); }

/* ---------- 11. Footer ---------- */
.foot { max-width: var(--max); margin: 0 auto; padding: var(--s-7) var(--gutter); display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: var(--s-6); border-top: 1.5px solid color-mix(in srgb, var(--edge) 50%, var(--ground)); }
.foot-brand { display: grid; gap: var(--s-3); align-content: start; }
.foot-brand p { color: var(--ink-soft); max-width: 36ch; }
.foot-links { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-1) var(--s-4); align-content: start; }
.foot-links a, .foot-contact a { color: var(--ink); font-weight: 600; text-decoration: none; padding: var(--s-2) 0; min-height: 44px; display: inline-flex; align-items: center; }
.foot-links a:hover, .foot-contact a:hover { color: var(--accent); text-decoration: underline; }
.foot-contact { font-style: normal; display: grid; align-content: start; }
.foot-small { grid-column: 1 / -1; font-size: .85rem; color: var(--ink-soft); }

/* ---------- 12. Motion ----------
   Signature: while Hush plays, a ring breathes out around the Play button at six breaths a minute.
   Reduced motion removes the breathing, the level bars and all slides; states still read from text and outline. */
@media (prefers-reduced-motion: no-preference) {
  .app[data-playing="true"] .breath { animation: breathe 10s var(--ease) infinite; }
  .status[data-status="playing"] .eq i { animation: eq 1.6s ease-in-out infinite; }
  .status .eq i:nth-child(2) { animation-delay: -.5s; }
  .status .eq i:nth-child(3) { animation-delay: -1.1s; }
  .status[data-status="fading"] .eq i { animation: eq 3.2s ease-in-out infinite; }
  @supports (animation-timeline: view()) {
    .use, .week-card, .note, .plan { animation: rise linear both; animation-timeline: view(); animation-range: entry 0% entry 40%; }
  }
}
@keyframes breathe {
  0% { transform: scale(.88); opacity: 0; }
  40% { transform: scale(1.12); opacity: .55; }
  100% { transform: scale(1.2); opacity: 0; }
}
@keyframes eq { 0%, 100% { transform: scaleY(.35); } 50% { transform: scaleY(1); } }
@keyframes rise { from { transform: translateY(18px); box-shadow: none; } }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; animation: none !important; }
}

/* ---------- 13. Narrow screens ---------- */
@media (max-width: 1100px) {
  .hero { grid-template-columns: 1fr; }
  /* The mixer comes straight after the headline; the rest of the intro follows it */
  .hero { gap: var(--s-6); }
  .hero-copy { display: contents; }
  .hero h1 { order: 0; max-width: 16ch; }
  .device { order: 1; }
  .lede { order: 2; max-width: 60ch; }
  .hero-facts { order: 3; }
  .hero-note { display: none; }
}
@media (max-width: 860px) {
  .nav { display: none; }
  .top .btn { margin-left: auto; }
  .lower, .helps-grid, .notes-row, .plans, .faq { grid-template-columns: 1fr; }
  .faq { gap: var(--s-5); }
  .faq-head { position: static; }
  .foot { grid-template-columns: 1fr 1fr; }
  .foot-brand { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  /* Phones: the device frame falls away and the app takes the whole width */
  .hero { padding-top: var(--s-3); padding-bottom: var(--s-4); gap: var(--s-5); }
  .helps, .week, .notes, .pricing, .faq { padding-top: var(--s-7); }
  .device-slab { padding: 0; border: 0; border-radius: 0; box-shadow: none; background: none; }
  .device-ear { display: none; }
  .transport { grid-template-columns: 1fr; justify-items: center; gap: var(--s-4); padding: var(--s-4); }
  .master { width: 100%; }
  .sounds { grid-template-columns: 1fr 1fr; gap: var(--s-3); }
  .sound { padding: var(--s-3) var(--s-3) var(--s-4); }
  .sound-controls { flex-direction: column-reverse; align-items: center; gap: var(--s-4); }
  .timer-body { grid-template-columns: 1fr; justify-items: center; }
  .timer-controls { width: 100%; }
  .chips { justify-content: center; }
  .panel { padding: var(--s-4); }
  .chart { height: 280px; padding-left: 2.2rem; }
  .chart-grid { left: 2.2rem; }
  .chart-grid span { left: -2.2rem; }
  .chart { --labels: 2rem; }
  .bar-val { font-size: .7rem; }
  .bar-mix { display: none; }
  .bar { grid-template-rows: 1fr 2rem; }
  .week-table { font-size: .85rem; }
  .foot { grid-template-columns: 1fr; }
  .trial-row { flex-direction: column; }
  .pricing-head { align-items: start; }
}
@media (max-width: 380px) {
  .sounds { grid-template-columns: 1fr; }
  .sound-controls { flex-direction: row; }
}
