/* Clearing. One accent per theme, used only for the live thing on screen; one hairline instead of shadows;
   exactly one filled button per screen. Every text colour is checked for 4.5:1 contrast by src/tests.py. */

@font-face { font-family: "Fraunces"; src: url(fonts/Fraunces-Variable.ttf) format("truetype"); font-weight: 300 900; font-display: swap; }
@font-face { font-family: "Lato"; src: url(fonts/Lato-Regular.ttf) format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Lato"; src: url(fonts/Lato-Bold.ttf) format("truetype"); font-weight: 700; font-display: swap; }

:root {
  --paper: #FBF8F3;
  --card: #FFFFFF;
  --ink: #2C2A27;
  --soft: #605B55;
  --line: #E6E0D6;
  --accent: #4C6347;
  --on-accent: #FFFFFF;
  --radius: 20px;
  --gutter: 24px;
  --body: 17px;
  --fade: 140ms;
}
:root[data-theme="moss"]    { --accent: #4C6347; }
:root[data-theme="clay"]    { --accent: #9A5B3C; }
:root[data-theme="harbour"] { --accent: #3F5A70; }
:root[data-theme="plum"]    { --accent: #6B4A63; }
:root[data-theme="ember"]   { --accent: #8E452F; }
:root[data-theme="slate"]   { --accent: #49535C; }

:root[data-mode="dark"] {
  --paper: #201E1C;
  --card: #2A2724;
  --ink: #F2EEE8;
  --soft: #BCB4A9;
  --line: #3A3631;
  --on-accent: #16140F;
}
:root[data-mode="dark"][data-theme="moss"]    { --accent: #9DC08B; }
:root[data-mode="dark"][data-theme="clay"]    { --accent: #E0A078; }
:root[data-mode="dark"][data-theme="harbour"] { --accent: #93BBD6; }
:root[data-mode="dark"][data-theme="plum"]    { --accent: #CBA3C2; }
:root[data-mode="dark"][data-theme="ember"]   { --accent: #EFA088; }
:root[data-mode="dark"][data-theme="slate"]   { --accent: #AEB8C2; }

:root[data-large="yes"] { --body: 20px; }
:root[data-calm="yes"] * { transition: none !important; animation: none !important; }

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: Lato, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: var(--body);
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
}
h1, h2, h3 { font-family: Fraunces, Georgia, serif; font-weight: 600; letter-spacing: -0.01em; margin: 0; }
button { font: inherit; color: inherit; cursor: pointer; }
.noscript { padding: var(--gutter); }

/* ---------- header and tabs ---------- */
header {
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(12px + env(safe-area-inset-top)) var(--gutter) 6px;
}
header h1 { font-size: 26px; }
.heads { display: flex; gap: 8px; }
.ghost {
  background: none; border: 1px solid var(--line); border-radius: 999px;
  min-width: 44px; min-height: 44px; padding: 0 14px; color: var(--ink);
}
.ghost:hover { border-color: var(--accent); }

#tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  display: flex; background: var(--paper); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
#tabs button {
  flex: 1; background: none; border: 0; padding: 10px 2px 12px;
  color: var(--soft); font-size: 12px; min-height: 60px;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
#tabs button .dot { width: 22px; height: 22px; border-radius: 8px; border: 2px solid currentColor; opacity: .75; }
#tabs button[aria-current="page"] { color: var(--accent); font-weight: 700; }
#tabs button[aria-current="page"] .dot { background: var(--accent); border-color: var(--accent); opacity: 1; }

main { padding: 0 var(--gutter) 28px; max-width: 760px; margin: 0 auto; }

/* ---------- the pieces ---------- */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; margin: 0 0 16px;
}
.one { padding: 22px 20px 20px; }
.one .task { font-family: Fraunces, Georgia, serif; font-size: 28px; line-height: 1.25; margin: 0 0 10px; }
.one .step { font-size: var(--body); margin: 0 0 8px; }
.one .step b { font-weight: 700; }
.one .why { color: var(--soft); font-size: 14px; margin: 0 0 18px; }
.one .row { display: flex; flex-wrap: wrap; gap: 10px; }

.fill {
  background: var(--accent); color: var(--on-accent); border: 0; border-radius: 999px;
  padding: 14px 22px; font-weight: 700; min-height: 48px;
}
.fill:hover { filter: brightness(1.06); }
.plain {
  background: none; border: 1px solid var(--line); border-radius: 999px;
  padding: 12px 18px; min-height: 48px; color: var(--ink);
}
.plain:hover { border-color: var(--accent); }
.link { background: none; border: 0; padding: 8px 6px; color: var(--accent); text-decoration: underline; min-height: 44px; min-width: 44px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 11px; }
.chips .label { width: 100%; color: var(--soft); font-size: 14px; margin: 0 0 -3px; }
.chip {
  background: none; border: 1px solid var(--line); border-radius: 999px;
  padding: 8px 15px; min-height: 44px; min-width: 44px; color: var(--ink); transition: background var(--fade), border-color var(--fade);
}
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 700; }

.quiet { color: var(--soft); }
.small { font-size: 14px; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { border-top: 1px solid var(--line); padding: 14px 0; display: flex; gap: 12px; align-items: flex-start; }
.list li:first-child { border-top: 0; }
.list .grow { flex: 1; min-width: 0; }
.list .mins { color: var(--soft); font-size: 14px; white-space: nowrap; }
.tick {
  width: 30px; height: 30px; min-width: 30px; border-radius: 10px; border: 2px solid var(--line);
  background: none; display: inline-flex; align-items: center; justify-content: center; padding: 0;
}
.tick[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.tick[aria-pressed="true"]::after { content: "✓"; font-size: 17px; line-height: 1; }

input[type="text"], input[type="number"], input[type="date"], select, textarea {
  font: inherit; color: var(--ink); background: var(--card);
  border: 1px solid var(--line); border-radius: 12px; padding: 12px; width: 100%; min-height: 48px;
}
textarea { min-height: 140px; resize: vertical; }
label.field { display: block; margin: 0 0 14px; }
label.field span { display: block; font-size: 14px; color: var(--soft); margin-bottom: 6px; }
label.switch { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 0; border-top: 1px solid var(--line); min-height: 56px; }
label.switch input { width: 24px; height: 24px; min-height: 24px; accent-color: var(--accent); }

.timer { font-family: Fraunces, Georgia, serif; font-size: 44px; font-variant-numeric: tabular-nums; margin: 0 0 6px; }
.bar { display: block; height: 6px; border-radius: 999px; background: var(--line); overflow: hidden; margin: 12px 0 0; }
.bar i { display: block; height: 100%; background: var(--accent); transition: width var(--fade); }

.week { display: grid; gap: 10px; }
.day { border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; background: var(--card); }
.day.today { border-color: var(--accent); }
.day h3 { font-size: 18px; margin-bottom: 4px; }
.day .load { color: var(--soft); font-size: 14px; }
.day.heavy .load { color: var(--ink); font-weight: 700; }

.sheet[hidden] { display: none; }   /* [hidden] alone loses to display:flex below, and an invisible overlay would eat every tap */
.sheet { position: fixed; inset: 0; background: rgba(20,18,16,.45); display: flex; align-items: flex-end; justify-content: center; z-index: 20; }
.sheet-card { background: var(--card); border-radius: 22px 22px 0 0; padding: 22px var(--gutter) calc(26px + env(safe-area-inset-bottom)); width: 100%; max-width: 760px; max-height: 86vh; overflow: auto; }
.sheet-card h2 { font-size: 21px; margin-bottom: 14px; }
@media (min-width: 620px) { .sheet { align-items: center; } .sheet-card { border-radius: 22px; } }

.say {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(86px + env(safe-area-inset-bottom));
  background: var(--ink); color: var(--paper); padding: 10px 18px; border-radius: 999px; font-size: 15px;
  margin: 0; z-index: 30; opacity: 0; pointer-events: none; transition: opacity var(--fade);
}
.say[data-show="yes"] { opacity: 1; }

/* Simple view: the one card and nothing else. */
:root[data-simple="yes"] .only-full { display: none !important; }

.empty { text-align: center; color: var(--soft); padding: 30px 10px; }
.empty p { margin: 0 0 16px; }

/* the month grid */
.month { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-top: 12px; }
.month .mname { font-size: 12px; color: var(--soft); text-align: center; padding-bottom: 4px; }
.month .mday {
  min-height: 56px; border: 1px solid var(--line); border-radius: 10px; padding: 5px 4px 4px;
  display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 13px;
}
.month .mday.empty { border: 0; min-height: 0; }
.month .mday.now { border-color: var(--accent); }
.month .mday b { font-weight: 700; }
.month .mdate { font-style: normal; font-size: 10px; color: var(--soft); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.month .mdots { display: flex; flex-wrap: wrap; gap: 2px; justify-content: center; }
.month .mdot { width: 5px; height: 5px; border-radius: 999px; background: var(--accent); display: block; }
.month .mdot.done { background: var(--soft); }
.month .mdot.bill { background: var(--ink); }

/* The timer ring, the body-double line and the reward jar (2026-11-24). The ring is drawn from the stored start
   time, so it is always right after the phone has been locked; `calm` stops it animating. */
.ring { position: relative; width: 240px; max-width: 72vw; margin: 18px auto 6px; }
.ring svg { display: block; width: 100%; height: auto; transform: rotate(-90deg); }
.ring .track { fill: none; stroke: var(--line); stroke-width: 12; }
.ring .run { fill: none; stroke: var(--accent); stroke-width: 12; stroke-linecap: round;
             transition: stroke-dashoffset 1s linear; }
:root[data-calm="yes"] .ring .run { transition: none; }
.ring .timer { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
               margin: 0; font-variant-numeric: tabular-nums; }
.company { margin-top: 14px; text-align: center; color: var(--soft); font-size: 1rem; line-height: 1.4; }
.jar { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0 10px; }
.jar .token { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); }
.jar .token.in { background: var(--accent); border-color: var(--accent); }

/* A goal's next step is its own line: it was an inline span, so it ran straight into the why text
   ("Mum is staying in MarchNext: Clear the spare bed"), found in the 2026-11-24 renders. */
.list .next { display: block; margin-top: 2px; }
