/* Body Weather. Calm, large, readable. Atkinson Hyperlegible throughout. */

@font-face { font-family: "Atkinson"; src: url("fonts/atkinson-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Atkinson"; src: url("fonts/atkinson-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  color-scheme: light;
  --page: #e8eeed;
  --paper: #f8fbfa;
  --ink: #14303a;
  --ink-2: #48616a;
  --muted: #6b8188;
  --line: #d2dddb;
  --tide: #0e6b6f;
  --tide-ink: #ffffff;
  --tide-soft: #d6ebe7;
  --wash: rgba(14, 107, 111, 0.10);
  --glass: #9ed3c6;
  --lamp: #8c5300;
  --lamp-mark: #c97d14;
  --lamp-wash: rgba(201, 125, 20, 0.13);
  --st-deep: #2b62c0; --st-light: #14917a; --st-rem: #7d5fd3; --st-awake: #e08a2a;
  --grid: #dfe7e5;
  --shadow: 0 1px 0 rgba(20, 48, 58, 0.06);
  --fs-s: 17px; --fs: 20px; --fs-m: 24px; --fs-l: 30px;
  --fs-forecast: clamp(26px, 6.2vw, 42px);
  --fs-num: clamp(44px, 11vw, 64px);
  --r: 18px;
  --gutter: 16px;
  --nav-h: 78px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0a171b; --paper: #10232a; --ink: #e3eeeb; --ink-2: #a9bfbb; --muted: #86a09b; --line: #22383f;
    --tide: #57b8b0; --tide-ink: #072326; --tide-soft: #173a3d; --wash: rgba(87, 184, 176, 0.12); --glass: #2f7e74;
    --lamp: #e8a64a; --lamp-mark: #e09a3a; --lamp-wash: rgba(224, 154, 58, 0.14);
    --st-deep: #3a74d6; --st-light: #16a07c; --st-rem: #8a70e0; --st-awake: #cc7d22;
    --grid: #1b3036; --shadow: none;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0a171b; --paper: #10232a; --ink: #e3eeeb; --ink-2: #a9bfbb; --muted: #86a09b; --line: #22383f;
  --tide: #57b8b0; --tide-ink: #072326; --tide-soft: #173a3d; --wash: rgba(87, 184, 176, 0.12); --glass: #2f7e74;
  --lamp: #e8a64a; --lamp-mark: #e09a3a; --lamp-wash: rgba(224, 154, 58, 0.14);
  --st-deep: #3a74d6; --st-light: #16a07c; --st-rem: #8a70e0; --st-awake: #cc7d22;
  --grid: #1b3036; --shadow: none;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--page); color: var(--ink);
  font-family: "Atkinson", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: var(--fs); line-height: 1.5; letter-spacing: 0.01em;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { line-height: 1.2; margin: 0 0 0.5em; font-weight: 700; }
h1 { font-size: var(--fs-l); }
h2 { font-size: var(--fs-m); margin-top: 1.6em; }
h3 { font-size: var(--fs); }
p { margin: 0 0 0.8em; max-width: 62ch; }
a { color: var(--tide); text-underline-offset: 3px; }
b, strong { font-weight: 700; }
code { font-size: 0.85em; word-break: break-all; background: var(--wash); padding: 2px 6px; border-radius: 6px; }
:focus-visible { outline: 3px solid var(--tide); outline-offset: 3px; border-radius: 8px; }
[tabindex="-1"]:focus { outline: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.hint, .quiet { color: var(--ink-2); }
.small { font-size: var(--fs-s); }
.num { font-variant-numeric: tabular-nums; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 56px; padding: 10px 22px; border-radius: 999px;
  font: inherit; font-weight: 700; font-size: var(--fs); line-height: 1.2;
  color: var(--ink); background: transparent; border: 2px solid var(--line);
  cursor: pointer; text-decoration: none; text-align: center;
}
.btn:hover { border-color: var(--tide); }
.btn.primary { background: var(--tide); color: var(--tide-ink); border-color: var(--tide); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.big { min-height: 68px; padding: 14px 30px; font-size: var(--fs-m); }
.btn.wide { width: 100%; }
.btn[disabled] { opacity: 0.5; cursor: default; }
.btn.link { border: 0; min-height: 48px; padding: 6px 4px; color: var(--tide); text-decoration: underline; text-underline-offset: 4px; }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }

/* ---------- Shell ---------- */
.shell { min-height: 100vh; }
.main { max-width: 1060px; margin: 0 auto; padding: 20px var(--gutter) calc(var(--nav-h) + 40px + env(safe-area-inset-bottom)); }
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--paper); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.nav a {
  min-height: var(--nav-h); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  color: var(--ink-2); text-decoration: none; font-size: 16px; font-weight: 700; text-align: center; padding: 6px 2px;
}
.nav a .dot { width: 26px; height: 26px; border-radius: 50%; border: 3px solid currentColor; opacity: 0.55; }
.nav a[aria-current="page"] { color: var(--tide); }
.nav a[aria-current="page"] .dot { background: var(--tide); border-color: var(--tide); opacity: 1; }
@media (min-width: 900px) {
  .shell { display: grid; grid-template-columns: 220px 1fr; }
  .nav { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; justify-content: flex-start;
    border-top: 0; border-right: 1px solid var(--line); padding: 28px 14px; gap: 6px; }
  .nav .brand { display: block; font-weight: 700; font-size: var(--fs-m); padding: 0 12px 22px; color: var(--ink); }
  .nav a { flex-direction: row; justify-content: flex-start; min-height: 60px; padding: 0 14px; border-radius: 14px; font-size: var(--fs); gap: 14px; }
  .nav a[aria-current="page"] { background: var(--wash); }
  .main { padding: 36px 40px 60px; margin: 0; }
}
.nav .brand { display: none; }

/* ---------- Banners ---------- */
.banner { background: var(--paper); border-radius: var(--r); padding: 18px 20px; margin: 0 0 20px; border: 2px solid var(--line); }
.banner.warn { border-color: var(--lamp-mark); background: var(--lamp-wash); }
.banner p:last-child { margin-bottom: 0; }
.progress { height: 10px; background: var(--tide-soft); border-radius: 99px; overflow: hidden; margin: 10px 0; }
.progress > span { display: block; height: 100%; background: var(--tide); border-radius: 99px; transition: width 0.6s ease; }

/* ---------- Today: greeting and forecast ---------- */
.greet { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 20px; margin-bottom: 18px; }
.greet h1 { margin: 0; }
.greet .date { color: var(--ink-2); }
.forecast { margin: 6px 0 14px; padding: 0; list-style: none; }
.forecast li { font-size: var(--fs-forecast); line-height: 1.22; margin: 0 0 0.28em; max-width: 24ch; }
.forecast .term { font-weight: 700; }
.forecast .phrase { color: var(--ink-2); }
.forecast .flag { color: var(--lamp); }
.forecast-empty { font-size: var(--fs-m); color: var(--ink-2); }

/* ---------- Two column on wide screens ---------- */
.today-grid { display: grid; gap: 8px 48px; }
@media (min-width: 1100px) { .today-grid { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); } }

/* ---------- Routine ---------- */
.routine { list-style: none; margin: 0; padding: 0; }
.routine > li { display: grid; grid-template-columns: 52px 1fr; gap: 6px 16px; padding: 18px 0; border-bottom: 1px solid var(--line); }
.routine > li:last-child { border-bottom: 0; }
.pebble { width: 46px; height: 46px; border-radius: 52% 48% 50% 50% / 50% 52% 48% 50%; border: 3px solid var(--tide); display: grid; place-items: center; font-weight: 700; color: var(--tide-ink); margin-top: 2px; }
.pebble.done { background: var(--tide); }
.pebble.done::after { content: "✓"; font-size: 26px; line-height: 1; }
.routine .what { font-size: var(--fs-m); font-weight: 700; }
.routine .detail { color: var(--ink-2); }
.routine .actions { grid-column: 2; display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; }
.meter { height: 14px; border-radius: 99px; background: var(--tide-soft); overflow: hidden; margin: 8px 0 4px; max-width: 420px; }
.meter > span { display: block; height: 100%; background: var(--tide); border-radius: 99px; }
.encourage { font-size: var(--fs-m); margin: 18px 0 6px; }

.week { display: grid; grid-template-columns: auto repeat(7, 1fr); gap: 6px 4px; align-items: center; margin: 12px 0 4px; max-width: 520px; }
.week .lbl { color: var(--ink-2); font-size: var(--fs-s); padding-right: 10px; }
.week .d { text-align: center; font-size: var(--fs-s); color: var(--ink-2); }
.week .d.today { color: var(--ink); font-weight: 700; }
.week .c { justify-self: center; width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid var(--line); }
.week .c.on { background: var(--tide); border-color: var(--tide); }

/* ---------- Readings list ---------- */
.readings { list-style: none; margin: 0; padding: 0; }
.readings a {
  display: grid; grid-template-columns: 1fr auto; grid-template-areas: "name value" "usual value" "spark spark";
  gap: 0 16px; padding: 16px 4px; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; align-items: end;
}
.readings li:last-child a { border-bottom: 0; }
.readings .name { grid-area: name; font-weight: 700; font-size: var(--fs-m); }
.readings .usual { grid-area: usual; color: var(--ink-2); font-size: var(--fs-s); }
.readings .usual.flag { color: var(--lamp); }
.readings .value { grid-area: value; font-size: 40px; font-weight: 700; line-height: 1; text-align: right; }
.readings .value small { display: block; font-size: var(--fs-s); font-weight: 400; color: var(--ink-2); margin-top: 6px; }
.readings .spark { grid-area: spark; margin-top: 10px; height: 40px; }
.readings a:hover .name { text-decoration: underline; text-underline-offset: 4px; }
.readings { container-type: inline-size; }
@container (min-width: 600px) {
  .readings a { grid-template-columns: 1fr 200px minmax(130px, auto); grid-template-areas: "name spark value" "usual spark value"; align-items: center; }
  .readings .spark { margin: 0; }
}

.moments { list-style: none; padding: 0; margin: 8px 0; }
.moments li { display: flex; gap: 14px; align-items: baseline; padding: 10px 0; border-bottom: 1px solid var(--line); }
.moments .mk { width: 14px; height: 14px; border-radius: 50%; background: var(--lamp-mark); flex: none; transform: translateY(2px); }

.band { color: var(--ink-2); margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--line); }

/* ---------- Choosers (big option buttons) ---------- */
.choose { display: flex; flex-wrap: wrap; gap: 10px; margin: 8px 0 20px; }
.choose button { min-height: 60px; min-width: 76px; padding: 8px 20px; border-radius: 999px; border: 2px solid var(--line); background: var(--paper); color: var(--ink); font: inherit; font-weight: 700; cursor: pointer; }
.choose button[aria-pressed="true"] { background: var(--tide); border-color: var(--tide); color: var(--tide-ink); }
.choose.stack { flex-direction: column; align-items: stretch; max-width: 560px; }
.choose.stack button { text-align: left; border-radius: var(--r); padding: 14px 20px; }
.choose.stack button span { display: block; font-weight: 400; font-size: var(--fs-s); opacity: 0.9; }

/* ---------- Panels ---------- */
.panel { background: var(--paper); border-radius: var(--r); padding: 20px; margin: 14px 0; box-shadow: var(--shadow); }
.panel h3 { margin-bottom: 8px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 18px; margin: 12px 0; }
.stat .v { font-size: 34px; font-weight: 700; line-height: 1.1; white-space: nowrap; }
.stat .l { color: var(--ink-2); font-size: var(--fs-s); }
.bignum { font-size: var(--fs-num); font-weight: 700; line-height: 1; margin: 6px 0 4px; }

/* ---------- Charts ---------- */
.chart { width: 100%; display: block; overflow: visible; }
.chart text { fill: var(--muted); font-size: 14px; font-family: inherit; }
.chart .grid { stroke: var(--grid); stroke-width: 1; }
.chart .axis { stroke: var(--line); stroke-width: 1; }
.chart .line { fill: none; stroke: var(--tide); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .band { fill: var(--wash); }
.chart .usual { fill: var(--glass); opacity: 0.28; }
.chart .bar { fill: var(--tide); }
.chart .bar.under { fill: var(--glass); }
.chart .target { stroke: var(--ink-2); stroke-width: 1.5; }
.chart .dot { fill: var(--tide); stroke: var(--paper); stroke-width: 2; }
.chart .flagdot { fill: var(--lamp-mark); stroke: var(--paper); stroke-width: 2; }
.chart .lbl { fill: var(--ink-2); font-size: 15px; }
.chart .halo { paint-order: stroke; stroke: var(--page); stroke-width: 5px; stroke-linejoin: round; font-weight: 700; }
.chart .hit { fill: transparent; }
.tip { position: fixed; z-index: 50; pointer-events: none; background: var(--ink); color: var(--paper); padding: 8px 12px; border-radius: 10px; font-size: var(--fs-s); max-width: 240px; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 8px 0; color: var(--ink-2); font-size: var(--fs-s); }
.legend i { display: inline-block; width: 14px; height: 14px; border-radius: 4px; margin-right: 6px; transform: translateY(2px); }
.stagebar { display: flex; height: 28px; gap: 2px; border-radius: 6px; overflow: hidden; margin: 10px 0; }
.stagebar span { display: block; height: 100%; }
table.data { border-collapse: collapse; width: 100%; font-size: var(--fs-s); }
table.data th, table.data td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
table.data td.n { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Body view tabs ---------- */
.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 18px; }
.tabs a { min-height: 52px; display: inline-flex; align-items: center; padding: 0 18px; border-radius: 999px; border: 2px solid var(--line); text-decoration: none; color: var(--ink); font-weight: 700; background: var(--paper); }
.tabs a[aria-current="page"] { background: var(--tide); border-color: var(--tide); color: var(--tide-ink); }

/* ---------- All data ---------- */
details.type { border-bottom: 1px solid var(--line); padding: 4px 0; }
details.type summary { cursor: pointer; padding: 12px 0; list-style: none; display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; }
details.type summary::-webkit-details-marker { display: none; }
details.type summary .t { font-weight: 700; }
details.type summary .s { color: var(--ink-2); font-size: var(--fs-s); grid-column: 1 / -1; }
details.type summary .c { color: var(--ink-2); }
dl.kv { display: grid; grid-template-columns: minmax(120px, max-content) 1fr; gap: 4px 16px; font-size: var(--fs-s); margin: 4px 0 14px; }
dl.kv dt { color: var(--ink-2); word-break: break-word; }
dl.kv dd { margin: 0; word-break: break-word; }
.form label { display: block; margin: 0 0 16px; font-weight: 700; }
.form input[type=text], .form input[type=password], .form input:not([type]), .form select, .form input[type=number] {
  display: block; width: 100%; max-width: 520px; margin-top: 6px; min-height: 56px; padding: 10px 14px;
  font: inherit; font-weight: 400; color: var(--ink); background: var(--paper); border: 2px solid var(--line); border-radius: 12px;
}
.form label.check { display: flex; gap: 12px; align-items: center; font-weight: 400; }
.form label.check input { width: 28px; height: 28px; }
.toggle { display: flex; gap: 14px; align-items: center; min-height: 56px; cursor: pointer; }
.toggle input { width: 28px; height: 28px; accent-color: var(--tide); }

/* ---------- Sitting (always dark, always calm) ---------- */
.sit {
  position: fixed; inset: 0; z-index: 100; background: #061216; color: #d6e8e3;
  display: grid; grid-template-rows: auto 1fr auto; padding: max(18px, env(safe-area-inset-top)) 18px max(18px, env(safe-area-inset-bottom));
}
.sit .top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.sit .clock { font-size: 26px; font-variant-numeric: tabular-nums; color: #9fb9b3; }
.sit .stage { position: relative; display: grid; place-items: center; overflow: hidden; }
.sit .circle {
  width: min(62vw, 46vh); aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle at 50% 45%, rgba(158, 211, 198, 0.55), rgba(47, 126, 116, 0.25) 60%, rgba(47, 126, 116, 0) 72%);
  transform: scale(0.8); transition: transform 0.25s linear;
}
.sit .say { position: absolute; bottom: 6%; left: 0; right: 0; text-align: center; font-size: 24px; color: #9fb9b3; }
.sit video { position: absolute; width: min(90vw, 560px); max-height: 60vh; border-radius: 24px; transform: scaleX(-1); object-fit: cover; opacity: 1; transition: opacity 1.2s ease; }
.sit video.fade { opacity: 0; }
.sit .guide { position: absolute; width: min(36vw, 230px); aspect-ratio: 0.78; border: 3px solid rgba(214, 232, 227, 0.75); border-radius: 50%; transform: translateY(-14%); pointer-events: none; transition: opacity 1.2s ease; }
.sit .guide.fade { opacity: 0; }
.sit .live { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; text-align: center; margin-bottom: 14px; }
.sit .live .v { font-size: 34px; font-weight: 700; font-variant-numeric: tabular-nums; }
.sit .live .l { font-size: 17px; color: #9fb9b3; }
.sit .live.hidden { visibility: hidden; }
.sit .controls { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.sit .btn { color: #d6e8e3; border-color: #2a4a4f; }
.sit .btn.primary { background: #2f7e74; border-color: #2f7e74; color: #fff; }
@media (prefers-reduced-motion: reduce) { .sit .circle { transition: none; } }

/* ---------- Toast ---------- */
.toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + 20px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: var(--paper); padding: 14px 22px; border-radius: 999px; z-index: 60; font-weight: 700; max-width: calc(100vw - 32px); text-align: center; }

/* ---------- Server rendered pages (setup, sign in) ---------- */
body.plain { background: var(--page); }
.plain-main { max-width: 760px; margin: 0 auto; padding: 32px var(--gutter) 60px; }
.plain-main .lead { font-size: var(--fs-m); color: var(--ink-2); }
.card { background: var(--paper); border-radius: var(--r); padding: 22px; margin: 18px 0; box-shadow: var(--shadow); }
.card.step.done { border-left: 6px solid var(--tide); }
.stepnum { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--tide); color: var(--tide-ink); margin-right: 10px; font-size: var(--fs); }
ol.steps li { margin-bottom: 10px; }
.copyrow { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 10px 0; }
.notice { padding: 14px 18px; border-radius: 14px; }
.notice.warn { background: var(--lamp-wash); border: 2px solid var(--lamp-mark); }
.notice.ok { background: var(--wash); border: 2px solid var(--tide); }
details summary { cursor: pointer; font-weight: 700; min-height: 44px; display: flex; align-items: center; }
