/*
  Ånde: breathing pacer app page (Screenery template)
  Scandinavian calm: a linen ground with a faint weave, one sand disc with birch-log growth rings, sage used only
  for meaning (breathing in, the active choice, success). Fraunces, soft and light, for the voice; Work Sans for the rest.
  Type does the hierarchy in four steps: display, heading, body, small. Motion is the breath itself and nothing else.

  Contents
   1. Tokens
   2. Base and browser surfaces
   3. Components: buttons, options, chips, toggle, fields, checks
   4. Header
   5. Hero and pacer (stage, disc, read-out, timeline, controls, summary)
   6. History
   7. Patterns
   8. The app (drawn phone) and specs
   9. Health note and birches
  10. Changelog
  11. Get Ånde
  12. Footer
  13. Motion
  14. Narrow screens
*/

/* ---------- 1. Tokens ---------- */
@property --disc { syntax: '<color>'; inherits: true; initial-value: #dccdb2; }

:root {
  /* Ground and paper */
  --linen: #f1ece2;        /* page ground */
  --linen-2: #e9e2d5;      /* weave thread, wells */
  --birch: #f9f7f2;        /* raised paper, birch bark */
  --sand: #dccdb2;         /* the disc, the health section */
  --sand-2: #e6dac5;       /* disc while breathing out */
  --sand-3: #d3c2a3;       /* health section ground */

  /* Ink */
  --ink: #2b2d28;          /* 13:1 on linen */
  --ink-2: #4f5049;        /* 7.4:1 on linen */
  --ink-3: #64645b;        /* 5.4:1 on linen, labels */
  --line: rgb(43 45 40 / 0.16);
  --line-strong: rgb(43 45 40 / 0.34);

  /* The one accent: sage, for breathing in, the active choice and success */
  --sage: #8b9e86;         /* fills, never text */
  --sage-tint: #cdd6c6;    /* disc while breathing in */
  --sage-ink: #45563f;     /* text and buttons, 7:1 on linen */
  --on-sage: #f9f7f2;

  --error: #92371f;        /* lingonberry, 6.6:1 on linen */

  /* Type */
  --serif: "Fraunces", "Iowan Old Style", Georgia, serif;
  --sans: "Work Sans", "Helvetica Neue", Arial, sans-serif;
  --fs-display: clamp(2.5rem, 1.6rem + 2.8vw, 4rem);
  --fs-head: clamp(1.75rem, 1.35rem + 1.3vw, 2.5rem);
  --fs-body: 1.0625rem;
  --fs-small: 0.875rem;

  /* Space: a 4px base, big gaps between groups */
  --s-1: 0.25rem; --s-2: 0.5rem; --s-3: 0.75rem; --s-4: 1rem; --s-5: 1.5rem;
  --s-6: 2rem; --s-7: 3rem; --s-8: 4.5rem; --s-9: 7rem;
  --gutter: clamp(1rem, 4vw, 3.5rem);
  --max: 82rem;

  --r-1: 6px; --r-2: 14px; --r-pill: 999px;
  --shadow: 0 18px 40px -24px rgb(60 50 30 / 0.45), 0 2px 6px -2px rgb(60 50 30 / 0.18);

  /* Breath timings (the slowest page in the library) */
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --slow: 1.6s;

  --disc: var(--sand);
}

/* ---------- 2. Base and browser surfaces ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 5rem; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background-color: var(--linen);
  /* a faint linen weave: two hairline grids, very low contrast */
  background-image:
    repeating-linear-gradient(0deg, rgb(43 45 40 / 0.018) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(90deg, rgb(43 45 40 / 0.016) 0 1px, transparent 1px 4px);
  color: var(--ink);
  font: 400 var(--fs-body)/1.6 var(--sans);
  caret-color: var(--sage-ink);
  accent-color: var(--sage-ink);
  scrollbar-color: var(--sand-3) var(--linen);
}
::selection { background: var(--sage-tint); color: var(--ink); }
::-webkit-scrollbar { width: 12px; }
::-webkit-scrollbar-track { background: var(--linen); }
::-webkit-scrollbar-thumb { background: var(--sand-3); border-radius: 12px; border: 3px solid var(--linen); }

h1, h2, h3, p, ol, ul, dl, dd, figure, fieldset { margin: 0; padding: 0; }
fieldset { border: 0; min-width: 0; }
ol, ul { list-style: none; }
a { color: var(--sage-ink); text-decoration-thickness: 1px; text-underline-offset: 0.22em; }
a:hover { color: var(--ink); }
strong { font-weight: 600; }
:focus-visible { outline: 2px solid var(--sage-ink); outline-offset: 3px; border-radius: 4px; }
[hidden] { display: none !important; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.defs { position: absolute; }
.skip { position: absolute; left: var(--s-4); top: -4rem; z-index: 50; background: var(--ink); color: var(--birch); padding: var(--s-2) var(--s-4); border-radius: var(--r-1); }
.skip:focus { top: var(--s-3); }

.icon { width: 1.25em; height: 1.25em; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* The four type steps */
.display {
  font: 300 var(--fs-display)/1.02 var(--serif);
  font-variation-settings: "SOFT" 100, "opsz" 144;
  letter-spacing: -0.025em;
  text-wrap: balance;
}
.h2, .h3 {
  font: 350 var(--fs-head)/1.12 var(--serif);
  font-variation-settings: "SOFT" 100, "opsz" 96;
  letter-spacing: -0.015em;
  text-wrap: balance;
}
.h3 { font-size: clamp(1.5rem, 1.3rem + 0.6vw, 1.875rem); }
.body-text, .lede { max-width: 62ch; color: var(--ink-2); text-wrap: pretty; }
.lede { font-size: 1.125rem; }

section { padding-inline: var(--gutter); }
section > * { max-width: var(--max); margin-inline: auto; }

/* ---------- 3. Components ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  min-height: 48px; padding: 0 var(--s-5);
  border: 1px solid var(--line-strong); border-radius: var(--r-pill);
  background: transparent; color: var(--ink);
  font: 500 1rem/1 var(--sans); text-decoration: none; cursor: pointer;
  transition: background-color 0.4s var(--ease), border-color 0.4s var(--ease), color 0.4s var(--ease);
}
.btn:hover { background: var(--birch); border-color: var(--ink-3); color: var(--ink); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; background: transparent; }
.btn--primary { background: var(--sage-ink); border-color: var(--sage-ink); color: var(--on-sage); }
.btn--primary:hover { background: var(--ink); border-color: var(--ink); color: var(--birch); }
.btn--quiet { border-color: transparent; color: var(--sage-ink); }
.btn--quiet:hover { border-color: var(--line); }
.btn--small { min-height: 40px; padding: 0 var(--s-4); font-size: var(--fs-small); }
.btn--wide { width: 100%; }
.btn[aria-busy="true"] { cursor: progress; }
.btn[aria-busy="true"] .icon { animation: breathe-dot 1.6s ease-in-out infinite; }

.link-btn {
  display: inline-flex; align-items: center; gap: var(--s-2); min-height: 44px; padding: 0;
  border: 0; background: none; color: var(--sage-ink); cursor: pointer;
  font: 500 1rem/1 var(--sans); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.3em;
}
.link-btn:hover { color: var(--ink); }

legend { font: 500 var(--fs-small)/1.3 var(--sans); color: var(--ink-3); margin-bottom: var(--s-3); padding: 0; }

/* Pattern options: hairline rows, the chosen one gets a sage dot */
.opt, .plan-opt {
  position: relative; display: grid; grid-template-columns: 1.5rem 1fr auto; align-items: baseline; gap: var(--s-3);
  padding: var(--s-2) 0; border-top: 1px solid var(--line); cursor: pointer; min-height: 44px;
}
.opt:last-child, .plan-opt:last-child { border-bottom: 1px solid var(--line); }
.opt input, .plan-opt input, .len input, .chip input, .check input, .toggle input {
  position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0;
}
.opt::before, .plan-opt::before {
  content: ""; width: 14px; height: 14px; border-radius: 50%; border: 1px solid var(--ink-3);
  align-self: center; transition: background-color 0.5s var(--ease), border-color 0.5s var(--ease), box-shadow 0.5s var(--ease);
}
.opt:has(input:checked)::before, .plan-opt:has(input:checked)::before {
  background: var(--sage-ink); border-color: var(--sage-ink); box-shadow: 0 0 0 4px var(--sage-tint);
}
.opt:has(input:focus-visible), .plan-opt:has(input:focus-visible),
.len:has(input:focus-visible) span, .chip:has(input:focus-visible) span,
.check:has(input:focus-visible) .check__box, .toggle:has(input:focus-visible) .toggle__track {
  outline: 2px solid var(--sage-ink); outline-offset: 3px; border-radius: 6px;
}
.opt:has(input:disabled) { opacity: 0.5; cursor: not-allowed; }
.opt__name, .plan-opt__name { font: 400 1.25rem/1.2 var(--serif); font-variation-settings: "SOFT" 100; }
.opt__time, .plan-opt__price { color: var(--ink-3); font-size: var(--fs-small); font-variant-numeric: tabular-nums; text-align: right; }
.plan-opt__price { color: var(--ink); font-weight: 500; font-size: 1rem; }
.plan-opt { padding: var(--s-3) 0; }
.plan-opt__desc { grid-column: 2 / -1; color: var(--ink-3); font-size: var(--fs-small); }

/* Length chips and phone choice */
.lens { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.len span, .chip span {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 var(--s-4);
  border: 1px solid var(--line-strong); border-radius: var(--r-pill);
  font-size: 0.9375rem; font-variant-numeric: tabular-nums; cursor: pointer;
  transition: background-color 0.5s var(--ease), color 0.5s var(--ease), border-color 0.5s var(--ease);
}
.len:hover input:not(:checked) + span, .chip:hover input:not(:checked) + span { border-color: var(--ink-3); background: var(--birch); }
.len input:checked + span, .chip input:checked + span { background: var(--sage-ink); border-color: var(--sage-ink); color: var(--on-sage); }
.len input:disabled + span { opacity: 0.5; cursor: not-allowed; }

/* Toggle */
.toggle { position: relative; display: inline-flex; align-items: center; gap: var(--s-3); min-height: 44px; cursor: pointer; font-size: var(--fs-small); color: var(--ink-2); }
.toggle__track { width: 40px; height: 24px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--linen-2); position: relative; transition: background-color 0.5s var(--ease); flex: none; }
.toggle__track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--ink-3); transition: transform 0.5s var(--ease), background-color 0.5s var(--ease); }
.toggle input:checked + .toggle__track { background: var(--sage-tint); border-color: var(--sage-ink); }
.toggle input:checked + .toggle__track::after { transform: translateX(16px); background: var(--sage-ink); }

/* Fields */
.field { display: grid; gap: var(--s-2); }
.field label { font-weight: 500; font-size: var(--fs-small); color: var(--ink-2); }
.field input {
  min-height: 52px; padding: 0 var(--s-4); width: 100%;
  border: 1px solid var(--line-strong); border-radius: var(--r-1); background: var(--birch);
  font: 400 1.0625rem/1 var(--sans); color: var(--ink);
  transition: border-color 0.4s var(--ease), box-shadow 0.4s var(--ease);
}
.field input::placeholder { color: var(--ink-3); opacity: 1; }
.field input:hover { border-color: var(--ink-3); }
.field input:focus { outline: none; border-color: var(--sage-ink); box-shadow: 0 0 0 3px var(--sage-tint); }
.field__msg { font-size: var(--fs-small); color: var(--ink-3); min-height: 1.4em; }
.field.is-error input { border-color: var(--error); box-shadow: 0 0 0 3px rgb(146 55 31 / 0.14); }
.field.is-error .field__msg, .field__msg.is-error { color: var(--error); }
.field.is-ok input { border-color: var(--sage-ink); }

/* Checks */
.check { position: relative; display: grid; grid-template-columns: 24px 1fr; gap: var(--s-3); align-items: start; cursor: pointer; font-size: 0.9375rem; color: var(--ink-2); padding: var(--s-1) 0; }
.check__box { width: 24px; height: 24px; border: 1px solid var(--ink-3); border-radius: 5px; background: var(--birch); display: grid; place-items: center; color: transparent; transition: background-color 0.4s var(--ease); }
.check__box .icon { width: 16px; height: 16px; stroke-width: 2; }
.check input:checked + .check__box { background: var(--sage-ink); border-color: var(--sage-ink); color: var(--on-sage); }
.check.is-error .check__box { border-color: var(--error); }
.field__msg--check { margin-top: calc(var(--s-3) * -1); padding-left: calc(24px + var(--s-3)); }
.field__msg--check:empty { display: none; }

.note { font-size: var(--fs-small); color: var(--ink-2); padding: var(--s-3) var(--s-4); border: 1px solid var(--line-strong); border-radius: var(--r-1); background: var(--birch); max-width: 52ch; }

/* ---------- 4. Header ---------- */
.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: var(--s-6);
  padding: var(--s-3) var(--gutter);
  background: var(--linen); border-bottom: 1px solid var(--line);
}
.mark { display: inline-flex; align-items: center; gap: var(--s-2); color: var(--ink); text-decoration: none; font: 400 1.5rem/1 var(--serif); font-variation-settings: "SOFT" 100; min-height: 44px; }
.mark__disc { width: 26px; height: 26px; fill: var(--sand); stroke: var(--sage-ink); stroke-width: 1.2; }
.mark__disc circle + circle { fill: none; }
.nav { display: flex; gap: var(--s-5); margin-left: auto; }
.nav a { color: var(--ink-2); text-decoration: none; font-size: 0.9375rem; padding: var(--s-2) 0; }
.nav a:hover { color: var(--ink); text-decoration: underline; }
.top__get { display: inline-flex; align-items: center; min-height: 40px; padding: 0 var(--s-4); border-radius: var(--r-pill); background: var(--sage-ink); color: var(--on-sage); text-decoration: none; font-weight: 500; font-size: 0.9375rem; }
.top__get:hover { background: var(--ink); color: var(--birch); }

/* ---------- 5. Hero and pacer ---------- */
.hero {
  display: grid; max-width: calc(var(--max) + 2 * var(--gutter)); margin-inline: auto;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  grid-template-areas: "words stage" "controls stage" "controls timeline";
  grid-template-rows: auto 1fr auto;
  column-gap: clamp(2rem, 5vw, 6rem); row-gap: var(--s-5);
  padding-top: var(--s-6); padding-bottom: var(--s-8);
}
.hero > * { max-width: none; margin: 0; }
.hero__words { grid-area: words; display: grid; gap: var(--s-5); align-self: end; }
.pacer { display: contents; }

.stage {
  grid-area: stage; position: relative; align-self: center; justify-self: center;
  width: min(100%, 40rem, calc(100vh - 11rem)); aspect-ratio: 1; border-radius: 50%;
}
.stage { cursor: pointer; -webkit-tap-highlight-color: transparent; }
.stage:focus-visible { outline-offset: 8px; border-radius: 50%; }
.stage__svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.guide { fill: none; stroke: var(--line-strong); stroke-width: 1; vector-effect: non-scaling-stroke; }
.guide--in { stroke-dasharray: 2 6; }
.disc { transform-origin: 0 0; }
.disc__fill { fill: var(--disc); transition: fill var(--slow) var(--ease); }
.disc__ring { fill: none; stroke: rgb(90 70 40 / 0.16); stroke-width: 1; vector-effect: non-scaling-stroke; }
.bead { fill: var(--sage-ink); opacity: 0; transition: opacity 0.8s var(--ease); }
.pacer[data-run="running"] .bead, .pacer[data-run="paused"] .bead { opacity: 1; }

/* phase colours: sage while breathing in, sand while holding, paler sand breathing out */
.pacer[data-phase="in"] { --disc: var(--sage-tint); }
.pacer[data-phase="hold"], .pacer[data-phase="rest"] { --disc: var(--sand); }
.pacer[data-phase="out"] { --disc: var(--sand-2); }
@supports (transition: --disc 1s) { .pacer { transition: --disc var(--slow) var(--ease); } .disc__fill { fill: var(--disc); } }

.stage__read {
  position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: var(--s-2);
  text-align: center; pointer-events: none;
}
.phase { font: 300 clamp(1.875rem, 1.4rem + 1.6vw, 3rem)/1.05 var(--serif); font-variation-settings: "SOFT" 100, "opsz" 120; letter-spacing: -0.015em; }
.count { font: 400 1.0625rem/1 var(--sans); color: var(--ink-2); font-variant-numeric: tabular-nums; min-height: 1em; }
.ticks { display: flex; gap: 7px; min-height: 8px; margin-top: var(--s-2); }
.ticks li { width: 8px; height: 8px; border-radius: 50%; border: 1px solid var(--ink-3); transition: background-color 0.6s var(--ease); }
.ticks li.is-on { background: var(--ink-2); border-color: var(--ink-2); }
.ticks li.is-half { background: linear-gradient(90deg, var(--ink-2) 50%, transparent 50%); }

.timeline { grid-area: timeline; width: min(100%, 40rem, calc(100vh - 11rem)); justify-self: center; }
.timeline__bar { height: 2px; background: var(--line); border-radius: 2px; overflow: hidden; }
.timeline__bar span { display: block; height: 100%; width: 0; background: var(--sage-ink); }
.timeline__text { display: flex; justify-content: space-between; margin-top: var(--s-2); font-size: var(--fs-small); color: var(--ink-3); font-variant-numeric: tabular-nums; }

.controls, .summary { grid-area: controls; display: grid; gap: var(--s-4); align-content: start; }
.choice--len legend { margin-bottom: var(--s-3); }
.plan { font-size: var(--fs-small); color: var(--ink-2); font-variant-numeric: tabular-nums; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3) var(--s-4); }
.keys, .nojs { font-size: var(--fs-small); color: var(--ink-3); }
.pacer[data-run="running"] .controls fieldset { opacity: 0.55; }

.summary { padding: var(--s-2) 0 0; }
.summary > * { margin-inline: 0; max-width: none; }
.summary:focus { outline: none; }
.summary__title { font: 300 var(--fs-display)/1 var(--serif); font-variation-settings: "SOFT" 100, "opsz" 144; letter-spacing: -0.025em; }
.summary__line { font: 400 1.375rem/1.35 var(--serif); font-variation-settings: "SOFT" 100; color: var(--ink-2); max-width: 34ch; text-wrap: pretty; }
.feel__opts { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.chip { position: relative; }
.note--care { border-color: var(--sand-3); background: var(--sand-2); color: var(--ink); }

/* ---------- 6. History ---------- */
.history { padding-top: var(--s-7); padding-bottom: var(--s-8); }
.history__head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: var(--s-3) var(--s-6); padding-bottom: var(--s-5); border-bottom: 1px solid var(--line-strong); }
.history__total { color: var(--ink-2); font-variant-numeric: tabular-nums; }
.sessions { counter-reset: none; }
.session {
  display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr 1.2fr; gap: var(--s-4); align-items: baseline;
  padding: var(--s-4) 0; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums;
}
.session__when { color: var(--ink); }
.session__what { font: 400 1.1875rem/1.2 var(--serif); font-variation-settings: "SOFT" 100; }
.session__len, .session__breaths { color: var(--ink-2); }
.session__feel { color: var(--ink-3); text-align: right; }
.session.is-new { background: linear-gradient(90deg, rgb(205 214 198 / 0.55), transparent 70%); }
.empty { padding: var(--s-7) 0; color: var(--ink-2); border-bottom: 1px solid var(--line); }
.empty p { max-width: 52ch; }
.history__foot { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-4); padding-top: var(--s-3); }
.confirm { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3); }
.confirm p { color: var(--ink); font-size: 0.9375rem; }

/* ---------- 7. Patterns ---------- */
.patterns { padding-top: var(--s-8); padding-bottom: var(--s-8); border-top: 1px solid var(--line); }
.patterns__head { display: grid; gap: var(--s-4); margin-bottom: var(--s-7); }
.scale { position: relative; height: 1.5rem; font-size: var(--fs-small); color: var(--ink-3); font-variant-numeric: tabular-nums; border-bottom: 1px solid var(--line-strong); margin-bottom: var(--s-2); }
.scale span { position: absolute; bottom: 0.35rem; transform: translateX(-50%); }
.scale span:nth-child(1) { left: 0; transform: none; }
.scale span:nth-child(2) { left: calc(5 / 19 * 100%); }
.scale span:nth-child(3) { left: calc(10 / 19 * 100%); }
.scale span:nth-child(4) { left: calc(15 / 19 * 100%); }
.scale span:nth-child(5) { right: 0; left: auto; transform: none; }

.pattern { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s-4); padding: var(--s-6) 0; border-bottom: 1px solid var(--line); }
.pattern__head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: var(--s-2) var(--s-5); }
.pattern__rate { color: var(--ink-2); font-variant-numeric: tabular-nums; }
.pattern__rate strong { font: 400 1.375rem/1 var(--serif); color: var(--ink); }
.bars { display: flex; gap: 3px; height: 3.25rem; }
.seg {
  flex: 0 0 calc(var(--s) / 19 * 100% - 3px); display: flex; align-items: flex-end; padding: var(--s-2);
  border-radius: 4px; font-size: var(--fs-small); color: var(--ink); white-space: nowrap; overflow: hidden;
  font-variant-numeric: tabular-nums;
}
.seg--in { background: var(--sage-tint); }
.seg--hold { background: var(--sand); }
.seg--out { background: var(--sand-2); border: 1px solid var(--sand-3); }
.pattern__text { max-width: 64ch; color: var(--ink-2); }
.pattern .link-btn { justify-self: start; }

/* ---------- 8. The app ---------- */
.app {
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(2rem, 6vw, 7rem); align-items: center;
  max-width: calc(var(--max) + 2 * var(--gutter)); margin-inline: auto;
  padding-top: var(--s-8); padding-bottom: var(--s-9);
}
.app > * { max-width: none; margin: 0; }
.phone { justify-self: center; width: min(17.5rem, 100%); }
.phone__body {
  aspect-ratio: 9 / 19; padding: 11px; border-radius: 44px; background: #34362f;
  box-shadow: var(--shadow), inset 0 0 0 1px rgb(255 255 255 / 0.08);
}
.phone__screen {
  height: 100%; border-radius: 34px; background: var(--linen); overflow: hidden;
  display: grid; grid-template-rows: auto 1fr auto auto auto; justify-items: center; padding: 14px 18px 30px;
}
.phone__status { width: 100%; display: flex; justify-content: space-between; align-items: center; font-size: 11px; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.phone__notch { width: 64px; height: 18px; border-radius: 10px; background: #34362f; }
.phone__disc { align-self: center; width: 82%; aspect-ratio: 1; border-radius: 50%; border: 1px solid var(--line-strong); display: grid; place-items: center; }
.phone__disc span { width: 70%; aspect-ratio: 1; border-radius: 50%; background: var(--sand-2); box-shadow: inset 0 0 0 1px rgb(90 70 40 / 0.12), inset 0 0 0 14px var(--sand-2), inset 0 0 0 15px rgb(90 70 40 / 0.12), inset 0 0 0 30px var(--sand-2), inset 0 0 0 31px rgb(90 70 40 / 0.12); }
.phone__phase { font: 300 1.625rem/1.1 var(--serif); font-variation-settings: "SOFT" 100; }
.phone__count { font-size: 0.9375rem; color: var(--ink-2); margin-top: 4px; }
.phone__left { font-size: 11px; color: var(--ink-3); margin-top: 14px; font-variant-numeric: tabular-nums; }

.app__text { display: grid; gap: var(--s-5); }
.specs { border-top: 1px solid var(--line-strong); margin-top: var(--s-2); }
.specs div { display: grid; grid-template-columns: 9rem 1fr; gap: var(--s-4); padding: var(--s-3) 0; border-bottom: 1px solid var(--line); }
.specs dt { color: var(--ink-3); font-size: var(--fs-small); padding-top: 0.15em; }
.specs dd { color: var(--ink); font-variant-numeric: tabular-nums; }

/* ---------- 9. Health ---------- */
.health {
  display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); gap: clamp(2rem, 5vw, 6rem);
  background: var(--sand); padding-top: var(--s-9); padding-bottom: var(--s-9); padding-inline: max(var(--gutter), calc((100% - var(--max)) / 2));
}
.health > * { max-width: none; margin: 0; }
.birches { width: 100%; height: calc(100% + 2 * var(--s-9)); min-height: 24rem; align-self: stretch; margin-block: calc(-1 * var(--s-9)); }
.birch__bark { fill: var(--birch); stroke: rgb(43 45 40 / 0.22); stroke-width: 1; vector-effect: non-scaling-stroke; }
.birch__mark { fill: var(--ink); stroke: var(--ink); stroke-width: 0.8; stroke-linejoin: round; opacity: 0.82; }
.birch__branch { fill: none; stroke: var(--ink-2); stroke-width: 1; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.health__text { display: grid; gap: var(--s-5); align-content: start; }
.health .body-text { color: var(--ink); }
.rules { display: grid; border-top: 1px solid rgb(43 45 40 / 0.24); max-width: 64ch; }
.rules li { padding: var(--s-4) 0; border-bottom: 1px solid rgb(43 45 40 / 0.24); color: var(--ink); }

/* ---------- 10. Changelog ---------- */
.changes { padding-top: var(--s-9); padding-bottom: var(--s-8); }
.changes .h2 { margin-bottom: var(--s-6); }
.log { border-top: 1px solid var(--line-strong); }
.log li { display: grid; grid-template-columns: 8rem 3.5rem minmax(0, 1fr); gap: var(--s-4); padding: var(--s-4) 0; border-bottom: 1px solid var(--line); align-items: baseline; }
.log time { color: var(--ink-3); font-size: var(--fs-small); font-variant-numeric: tabular-nums; }
.log__v { font: 400 1.1875rem/1 var(--serif); }
.log p { max-width: 64ch; color: var(--ink-2); }

/* ---------- 11. Get Ånde ---------- */
.get {
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: clamp(2rem, 6vw, 7rem); align-items: start;
  max-width: calc(var(--max) + 2 * var(--gutter)); margin-inline: auto;
  padding-top: var(--s-8); padding-bottom: var(--s-9); border-top: 1px solid var(--line);
}
.get > * { max-width: none; margin: 0; }
.get__intro { display: grid; gap: var(--s-4); position: sticky; top: 6rem; }
.next { display: grid; margin-top: var(--s-4); border-top: 1px solid var(--line); max-width: 46ch; }
.next li { display: grid; grid-template-columns: 2rem 1fr; padding: var(--s-3) 0; border-bottom: 1px solid var(--line); color: var(--ink-2); font-size: 0.9375rem; }
.next span { font: 400 1.125rem/1.3 var(--serif); color: var(--ink); }
.form, .sent { display: grid; gap: var(--s-5); background: var(--birch); border: 1px solid var(--line); border-radius: var(--r-2); padding: clamp(1.25rem, 3vw, 2.25rem); box-shadow: var(--shadow); }
.sent { justify-items: start; }
.sent:focus { outline: none; }
.sent__disc { width: 64px; height: 64px; }
.sent__disc circle { fill: var(--sage-tint); }
.sent__disc path { fill: none; stroke: var(--sage-ink); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.total { display: grid; gap: var(--s-1); padding: var(--s-4) 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.total p { display: flex; justify-content: space-between; gap: var(--s-4); color: var(--ink-2); font-size: 0.9375rem; }
.total p span:last-child { white-space: nowrap; text-align: right; }
.total p:first-child { color: var(--ink); font-weight: 500; font-size: 1rem; }
.form__status { font-size: var(--fs-small); color: var(--ink-2); min-height: 1.4em; }
.form__status:empty { display: none; }
.form__status.is-error { color: var(--error); display: flex; gap: var(--s-2); align-items: flex-start; }
.form.is-busy fieldset, .form.is-busy .field, .form.is-busy .check { opacity: 0.55; pointer-events: none; }

/* ---------- 12. Footer ---------- */
.foot { padding: var(--s-7) max(var(--gutter), calc((100% - var(--max)) / 2)) var(--s-8); border-top: 1px solid var(--line-strong); display: grid; gap: var(--s-2); color: var(--ink-2); font-size: 0.9375rem; }
.foot__mark { font: 300 3rem/1 var(--serif); font-variation-settings: "SOFT" 100; color: var(--ink); margin-bottom: var(--s-3); }
.foot a { display: inline-block; padding: var(--s-1) 0; }
.foot__small { color: var(--ink-3); font-size: var(--fs-small); margin-top: var(--s-3); }

/* ---------- 13. Motion ---------- */
/* The disc's scale is driven by script.js every frame. Without JS, the drawn phone breathes on its own in CSS. */
@media (prefers-reduced-motion: no-preference) {
  .phone__disc span { animation: phone-breath 11s ease-in-out infinite; }
}
@keyframes phone-breath { 0%, 100% { transform: scale(0.62); } 50% { transform: scale(1); } }
@keyframes breathe-dot { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

/* Reduced motion (system setting or ?motion=reduced): the disc stays at a middle size; the dots and colour pace */
.is-still .disc { transform: translate(200px, 200px) scale(0.72) translate(-200px, -200px) !important; }
.is-still .bead { display: none; }
.is-still .ticks li { width: 11px; height: 11px; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; animation: none !important; }
  .disc__fill { transition: none; }
}

/* Wide screens: keep Start inside the first viewport */
@media (min-width: 1081px) {
  .hero { padding-top: var(--s-5); row-gap: var(--s-4); }
  .hero__words { gap: var(--s-4); }
  .hero .display { font-size: clamp(2.5rem, 1.6rem + 2.4vw, 3.5rem); }
  .hero .lede { font-size: 1.0625rem; line-height: 1.55; }
  .controls { gap: var(--s-3); }
  .controls legend { margin-bottom: var(--s-2); }
  .controls .opt { min-height: 42px; padding: 0.3rem 0; }
}

/* ---------- 14. Narrow screens ---------- */
@media (max-width: 1080px) {
  .hero { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .session { grid-template-columns: 1.3fr 1fr 1fr 1fr; }
  .session__feel { grid-column: 1 / -1; text-align: left; margin-top: calc(var(--s-3) * -1); }
}
@media (max-width: 860px) {
  .nav { display: none; }
  .top__get { margin-left: auto; }
  .hero { grid-template-columns: minmax(0, 1fr); grid-template-areas: "words" "stage" "timeline" "controls"; grid-template-rows: auto; padding-top: var(--s-6); }
  .stage, .timeline { width: min(100%, 30rem, calc(100svh - 14rem)); }
  .stage { min-width: 16rem; }
  .app, .get, .health { grid-template-columns: minmax(0, 1fr); }
  .get__intro { position: static; }
  .health { padding-inline: var(--gutter); }
  .birches { order: 2; height: 18rem; min-height: 0; width: 100%; margin-block: 0 calc(-1 * var(--s-9)); -webkit-mask-image: linear-gradient(to bottom, transparent, #000 45%); mask-image: linear-gradient(to bottom, transparent, #000 45%); }
}
@media (max-width: 600px) {
  .session { grid-template-columns: 1fr auto; gap: var(--s-1) var(--s-4); }
  .session__when { grid-column: 1 / -1; font-size: var(--fs-small); color: var(--ink-3); }
  .session__breaths { text-align: right; }
  .session__len { grid-column: 1; }
  .session__what { grid-column: 1; }
  .session__feel { grid-column: 2; grid-row: 2; text-align: right; margin: 0; }
  .log li { grid-template-columns: 1fr auto; }
  .log p { grid-column: 1 / -1; }
  .specs div { grid-template-columns: 1fr; gap: var(--s-1); }
  .opt { grid-template-columns: 1.5rem 1fr; }
  .opt__time { grid-column: 2; text-align: left; }
  .plan-opt { grid-template-columns: 1.5rem 1fr; }
  .plan-opt__price { grid-column: 2; text-align: left; }
  .seg { padding: var(--s-1) 5px; font-size: 11px; }
  .bars { height: 2.75rem; }
}
