/* Soft Minimal. Tokens are the contrast-checked values from the spec. */

@font-face {
  font-family: "Instrument Serif";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/instrument-serif-latin-400-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Instrument Serif";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/instrument-serif-latin-400-italic.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/inter-latin-wght-normal.woff2") format("woff2");
}

:root {
  --bg: #F6F3EE;
  --surface: #FFFFFF;
  --ink: #1F1D1A;
  --muted: #6B655C;
  --hero: #1F1D1A;
  --hero-ink: #F6F3EE;
  --hero-muted: #B9B1A4;
  --accent: #55775B;
  --soft: #E7EFE6;
  --soft-ink: #3E5A43;
  --danger: #B83A32;
  --on-danger: #FFFFFF;
  --line: #E4DED4;
  --shade: rgba(31, 29, 26, 0.14);
  --serif: "Instrument Serif", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15130F;
    --surface: #211E19;
    --ink: #EDE7DC;
    --muted: #A39A8C;
    --hero: #EDE7DC;
    --hero-ink: #15130F;
    --hero-muted: #5E574D;
    --accent: #9DBB9F;
    --soft: #1F2A20;
    --soft-ink: #B7CFB8;
    --danger: #C9423A;
    --on-danger: #FFFFFF;
    --line: #3A352D;
    --shade: rgba(0, 0, 0, 0.5);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #15130F;
  --surface: #211E19;
  --ink: #EDE7DC;
  --muted: #A39A8C;
  --hero: #EDE7DC;
  --hero-ink: #15130F;
  --hero-muted: #5E574D;
  --accent: #9DBB9F;
  --soft: #1F2A20;
  --soft-ink: #B7CFB8;
  --danger: #C9423A;
  --on-danger: #FFFFFF;
  --line: #3A352D;
  --shade: rgba(0, 0, 0, 0.5);
  color-scheme: dark;
}

html { font-size: 100%; -webkit-text-size-adjust: 100%; }
html[data-text-size="large"] { font-size: 112.5%; }
html[data-text-size="larger"] { font-size: 125%; }
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--sans); font-size: 1rem; line-height: 1.5; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* Page */
.page { max-width: 34rem; margin: 0 auto; padding: 1rem 18px 7rem; }
.top { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; min-height: 3rem; }
.dateline { margin: 0; font-size: 0.8125rem; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 0.8125rem; }
.eyebrow, .label, legend { display: block; font-size: 0.6875rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin: 1.25rem 0.125rem 0.5rem; padding: 0; }
.title { font-family: var(--serif); font-weight: 400; font-size: 2.125rem; line-height: 1.05; margin: 0.25rem 0 1rem; }
.title em { color: var(--accent); }
.title-sm { font-family: var(--serif); font-weight: 400; font-size: 1.875rem; line-height: 1.1; margin: 0; }
.back { display: inline-flex; align-items: center; min-height: 3rem; color: var(--muted); font-size: 0.875rem; text-decoration: none; }
.stack > * + * { margin-top: 0.75rem; }

/* Buttons */
.pill { display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; min-height: 3rem; padding: 0.75rem 1.25rem; border-radius: 999px; border: 1px solid transparent; font-weight: 600; font-size: 0.9375rem; text-decoration: none; cursor: pointer; transition: transform 120ms ease-out; }
.pill:active { transform: scale(0.98); }
.pill-dark { background: var(--ink); color: var(--bg); }
.pill-light { background: var(--surface); color: var(--ink); border-color: var(--line); }
.pill-inverse { background: var(--hero-ink); color: var(--hero); }
.grow { flex: 1; }

/* Home */
.hero { background: var(--hero); color: var(--hero-ink); border-radius: 24px; padding: 1rem 1.125rem; margin: 0 0 0.625rem; }
.hero-row { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; }
.hero-label { margin: 0; font-size: 0.6875rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--hero-muted); font-weight: 600; }
.hero-big { margin: 0.125rem 0; font-size: 1.875rem; font-weight: 600; line-height: 1.2; }
.hero-bar { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; font-size: 0.875rem; margin-top: 0.5rem; }
.waiting { margin: 0.25rem 0 0; font-size: 0.8125rem; color: var(--muted); }
.hero .waiting { color: var(--hero-muted); }
.ring { position: relative; width: 3.5rem; height: 3.5rem; flex: none; }
.ring svg { width: 100%; height: 100%; display: block; }
.ring-track { fill: none; stroke: var(--hero-muted); stroke-width: 5; opacity: 0.4; }
.ring-fill { fill: none; stroke: var(--hero-ink); stroke-width: 5; stroke-linecap: round; }
.ring-text { position: absolute; inset: 0; display: grid; place-items: center; font-size: 0.6875rem; font-weight: 600; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; margin: 0.625rem 0; }
.tile { display: block; width: 100%; text-align: left; background: var(--surface); color: var(--ink); border: 0; border-radius: 20px; padding: 0.75rem 0.875rem; min-height: 5.5rem; cursor: pointer; transition: transform 120ms ease-out; }
.tile:active { transform: scale(0.98); }
.tile-emoji { display: block; font-size: 1.25rem; }
.tile-name { display: block; font-weight: 600; font-size: 0.9375rem; }
.tile-hint { display: block; color: var(--muted); font-size: 0.75rem; margin-top: 0.125rem; }
.soft-card { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; background: var(--soft); color: var(--soft-ink); border-radius: 18px; padding: 0.875rem 1rem; min-height: 3rem; text-decoration: none; font-size: 0.875rem; font-weight: 500; }
.note-card { background: var(--soft); color: var(--soft-ink); border-radius: 20px; padding: 1rem; margin: 0.625rem 0; }
.note-card p { margin: 0 0 0.5rem; }
.note-card .label { color: var(--soft-ink); margin: 0 0 0.25rem; }
.stale { background: var(--surface); border: 2px solid var(--ink); border-radius: 20px; padding: 1rem; margin: 0 0 0.625rem; }
.stale p { margin: 0 0 0.5rem; }
.links { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.75rem 0; }
.entries { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.375rem; }
.entry { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; text-align: left; background: var(--surface); color: var(--ink); border: 0; border-radius: 16px; padding: 0.75rem 1rem; min-height: 3rem; }
button.entry { cursor: pointer; }
.entry-label { font-weight: 600; font-size: 0.9375rem; }
.entry-time { color: var(--muted); font-size: 0.8125rem; white-space: nowrap; }
.entry-waiting { display: block; color: var(--muted); font-size: 0.8125rem; }

/* Cards and Emergency */
.card { background: var(--surface); border-radius: 20px; padding: 1rem; margin: 0.5rem 0; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; }
.row p { margin: 0; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; margin: 0.5rem 0; }
.who { display: block; background: var(--surface); color: var(--ink); border-radius: 18px; padding: 0.75rem; text-decoration: none; min-height: 3rem; }
.who-name { display: block; font-weight: 600; }
.who-sub { display: block; color: var(--muted); font-size: 0.75rem; }
.call-911 { display: flex; justify-content: space-between; align-items: center; background: var(--danger); color: var(--on-danger); border-radius: 26px; padding: 1.125rem; text-decoration: none; min-height: 5rem; }
.call-big { display: block; font-size: 1.75rem; font-weight: 700; line-height: 1.2; }
.call-small { display: block; font-size: 0.8125rem; }
.call-dot { width: 3.25rem; height: 3.25rem; border-radius: 50%; background: var(--surface); display: grid; place-items: center; font-size: 1.375rem; flex: none; }
.addr { margin: 0; font-weight: 600; }
.list { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.375rem; }
.list-card { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; background: var(--surface); color: var(--ink); border-radius: 16px; padding: 0.75rem 0.875rem; min-height: 3rem; font-weight: 600; text-decoration: none; }
.guide-card { margin-top: 1rem; }
.card-title { font-family: var(--serif); font-weight: 400; font-size: 1.625rem; line-height: 1.15; margin: 0 0 0.5rem; }
.md p { margin: 0.5rem 0; }
.md ul, .md ol { margin: 0.25rem 0 0.75rem; padding-left: 1.375rem; }
.md li { margin: 0.25rem 0; }
.md a, .sources a, .facts a { color: var(--accent); text-underline-offset: 2px; }
.epi { border-top: 1px solid var(--line); margin-top: 0.75rem; padding-top: 0.5rem; }
.sources { border-top: 1px solid var(--line); margin-top: 1rem; padding-top: 0.5rem; font-size: 0.8125rem; }
.sources ul { padding-left: 1.125rem; margin: 0.25rem 0; }
.sources li { margin: 0.375rem 0; }
.facts { margin: 0 0 0.75rem; }
.facts div { padding: 0.375rem 0; border-bottom: 1px solid var(--line); }
.facts dt { font-size: 0.75rem; color: var(--muted); }
.facts dd { margin: 0; font-weight: 500; }

/* Always there */
.status { margin: 0; padding: 0.625rem 18px; background: var(--ink); color: var(--bg); font-size: 0.8125rem; text-align: center; }
.sos { position: fixed; left: 18px; right: 18px; bottom: calc(18px + env(safe-area-inset-bottom)); max-width: 32rem; margin: 0 auto; display: flex; align-items: center; justify-content: center; min-height: 3.25rem; background: var(--danger); color: var(--on-danger); border-radius: 999px; font-weight: 700; font-size: 0.9375rem; text-decoration: none; box-shadow: 0 8px 24px var(--shade); z-index: 10; }
.toast { position: fixed; left: 18px; right: 18px; bottom: calc(5.5rem + env(safe-area-inset-bottom)); max-width: 30rem; margin: 0 auto; background: var(--ink); color: var(--bg); border-radius: 16px; padding: 0.75rem 1rem; font-size: 0.875rem; box-shadow: 0 8px 24px var(--shade); z-index: 11; }
.toast[hidden] { display: none; }

/* Bottom sheet */
.sheet { margin: auto auto 0; width: 100%; max-width: 100%; max-height: 92vh; border: 0; padding: 0; border-radius: 28px 28px 0 0; background: var(--bg); color: var(--ink); box-shadow: 0 -8px 32px var(--shade); }
.sheet::backdrop { background: rgba(21, 19, 15, 0.45); }
.sheet[open] { animation: sheet-up 200ms ease-out; }
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: translateY(0); } }
.sheet-inner { padding: 0.875rem 18px calc(1.25rem + env(safe-area-inset-bottom)); max-width: 34rem; margin: 0 auto; }
.grab { width: 2.5rem; height: 0.3125rem; border-radius: 9px; background: var(--line); margin: 0 auto 0.625rem; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; margin-bottom: 0.75rem; }
.seg { display: flex; background: var(--line); border-radius: 999px; padding: 0.25rem; margin-bottom: 0.75rem; }
.seg .chip { flex: 1; border: 0; background: transparent; color: var(--ink); }
.seg .chip.on { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 3px var(--shade); }
.chips { display: flex; flex-wrap: wrap; gap: 0.375rem; margin: 0.75rem 0; }
.chip { min-height: 3rem; padding: 0.5rem 0.875rem; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-size: 0.875rem; cursor: pointer; }
.chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.stepper { display: flex; justify-content: space-between; align-items: center; background: var(--surface); border-radius: 22px; padding: 0.875rem; }
.stepper-reading { margin: 0; }
.stepper-value { font-size: 2.5rem; font-weight: 600; line-height: 1; }
.stepper-unit { color: var(--muted); font-size: 0.8125rem; margin-left: 0.25rem; }
.stepper-btns { display: flex; gap: 0.5rem; }
.stepper-btn { width: 3rem; height: 3rem; border-radius: 50%; border: 0; background: var(--bg); color: var(--ink); font-size: 1.25rem; cursor: pointer; }
.field { display: block; margin: 0.75rem 0; }
.field .label { margin: 0 0.125rem 0.375rem; }
.field input, .field textarea, .field select { display: block; width: 100%; min-height: 3rem; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); color: var(--ink); padding: 0.625rem 0.875rem; font-size: 1rem; }
.sheet-actions { display: flex; gap: 0.5rem; margin-top: 1rem; }
.error { margin: 0.5rem 0; padding: 0.5rem 0.75rem; border-left: 3px solid var(--ink); font-weight: 600; font-size: 0.875rem; }

/* Hours, recap, preferences */
.stats { list-style: none; padding: 0; margin: 0.5rem 0; display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.stat { background: var(--surface); border-radius: 18px; padding: 0.75rem 0.875rem; }
.stat-num { display: block; font-size: 1.5rem; font-weight: 600; }
.stat-text { display: block; color: var(--muted); font-size: 0.8125rem; }
.plain { list-style: none; padding: 0; margin: 0; }
.plain li { background: var(--surface); border-radius: 16px; padding: 0.75rem 1rem; margin: 0.375rem 0; }
.badge { display: inline-block; padding: 0.125rem 0.5rem; border-radius: 999px; border: 1px solid var(--line); font-size: 0.75rem; color: var(--muted); }
.shift-row { background: var(--surface); border-radius: 18px; padding: 0.875rem 1rem; margin: 0.375rem 0; }
.shift-row p { margin: 0.125rem 0; }
fieldset { border: 0; padding: 0; margin: 0 0 1rem; min-width: 0; }
.slot { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0.375rem; align-items: end; background: var(--surface); border-radius: 16px; padding: 0.5rem; margin: 0.375rem 0; }
.slot .field { margin: 0; }
.slot .field input, .slot .field select { padding: 0.5rem; }
.slot .pill { grid-column: 1 / -1; }
.check { display: flex; align-items: center; gap: 0.625rem; min-height: 3rem; }
.check input { width: 1.5rem; height: 1.5rem; accent-color: var(--accent); }
.instructions { white-space: pre-line; margin: 0; }

/* No motion on the Emergency screen, and none anywhere when asked. */
.emergency *, .emergency *:active { transition: none; transform: none; animation: none; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .pill:active, .tile:active { transform: none; }
}
