/* Layout: a single calm column like a brokerage app — one big number, one big chart,
   then quiet lists. Warm vs cool replaces gain vs loss. */
:root {
  --bg: #fbfaf8;
  --surface: #ffffff;
  --ink: #14161a;
  --muted: #6b7079;
  --faint: #9aa0a8;
  --line: #ebe9e4;
  --hover: #f3f2ee;
  --warm: #e2552d;
  --warm-soft: #fde8e1;
  --cool: #2f74d0;
  --cool-soft: #e2edfb;
  --brand: #5a48d0;
  --brand-soft: #ece9fb;
  --font: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #101114; --surface: #17181c; --ink: #f2f2f0; --muted: #9a9ea6; --faint: #6c7078;
    --line: #26282e; --hover: #1e2025; --warm: #ff7a52; --warm-soft: #3a2119; --cool: #5d9bff;
    --cool-soft: #17263d; --brand: #9b8cff; --brand-soft: #241f45; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #101114; --surface: #17181c; --ink: #f2f2f0; --muted: #9a9ea6; --faint: #6c7078;
  --line: #26282e; --hover: #1e2025; --warm: #ff7a52; --warm-soft: #3a2119; --cool: #5d9bff;
  --cool-soft: #17263d; --brand: #9b8cff; --brand-soft: #241f45; color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 16px/1.5 var(--font); padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px)); }
@media (min-width: 900px) { body { padding-bottom: 0; } }
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
svg { display: block; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 6px; }
.num { font-variant-numeric: tabular-nums; }
.wrap { width: 100%; max-width: 1080px; margin-inline: auto; padding-inline: 16px; }
@media (min-width: 720px) { .wrap { padding-inline: 24px; } }

/* Top bar */
.topbar { position: sticky; top: 0; z-index: 20; background: color-mix(in oklab, var(--bg) 92%, transparent); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top, 0px); }
.topbar-inner { display: flex; align-items: center; gap: 12px; height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: -0.01em; text-decoration: none; white-space: nowrap; }
.brand-mark { width: 22px; height: 22px; border-radius: 50%; background: conic-gradient(from 200deg, var(--cool), var(--brand), var(--warm), var(--cool)); flex: none; }
.brand-text { display: none; }
@media (min-width: 520px) { .brand-text { display: inline; } }
.search { position: relative; flex: 1; max-width: 420px; display: flex; align-items: center; gap: 8px; background: var(--hover); border-radius: 10px; padding: 0 12px; height: 40px; }
.search svg { width: 18px; height: 18px; fill: none; stroke: var(--muted); stroke-width: 2; flex: none; }
.search input { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; height: 100%; font-size: 16px; }
.search-results { position: absolute; left: 0; right: 0; top: 46px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px rgb(0 0 0 / 0.14); max-height: 70vh; overflow-y: auto; }
.search-results button { display: flex; width: 100%; justify-content: space-between; align-items: baseline; gap: 12px; padding: 12px 14px; border: 0; background: none; text-align: left; cursor: pointer; }
.search-results button:hover, .search-results button:focus-visible { background: var(--hover); }
.search-results small { color: var(--muted); white-space: nowrap; }
.search-results .sr-head { padding: 10px 14px 4px; font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; }
.search-results .sr-empty { padding: 12px 14px; color: var(--muted); }
.top-nav { display: none; align-items: center; gap: 4px; margin-left: auto; }
.top-nav a { padding: 8px 12px; border-radius: 8px; text-decoration: none; font-weight: 600; color: var(--muted); white-space: nowrap; }
.top-nav a[aria-current="page"] { color: var(--ink); }
.top-nav a:hover { background: var(--hover); }
@media (min-width: 900px) { .top-nav { display: flex; } }
.unit-toggle { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; min-width: 48px; height: 36px; padding: 0 10px; font-weight: 700; cursor: pointer; flex: none; }
.mobile-unit { margin-left: auto; }
@media (min-width: 900px) { .mobile-unit { display: none; } }

/* Bottom tab bar on phones */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: grid; grid-template-columns: repeat(3, 1fr); background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom, 0px); }
.tabbar a { display: grid; justify-items: center; gap: 2px; padding: 8px 0 10px; font-size: 12px; font-weight: 600; color: var(--faint); text-decoration: none; }
.tabbar a[aria-current="page"] { color: var(--ink); }
.tabbar svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
@media (min-width: 900px) { .tabbar { display: none; } }

main { outline: none; padding-block: 24px 40px; min-height: 60vh; }

/* The big number */
.hero-label { color: var(--muted); font-weight: 500; margin: 0 0 2px; }
.big { font-size: clamp(44px, 11vw, 64px); font-weight: 600; letter-spacing: -0.03em; line-height: 1.05; margin: 0; font-variant-numeric: tabular-nums; }
.big small { font-size: 0.4em; font-weight: 500; color: var(--muted); margin-left: 8px; letter-spacing: 0; }
.delta { margin: 6px 0 0; font-weight: 600; min-height: 1.5em; font-variant-numeric: tabular-nums; }
.delta .when { color: var(--muted); font-weight: 500; }
.warm { color: var(--warm); }
.cool { color: var(--cool); }
.flat { color: var(--muted); }

/* Chart */
.chart path, .chart line { vector-effect: non-scaling-stroke; }
.chart-dot { position: absolute; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--surface); transform: translate(-50%, -50%); pointer-events: none; }
.chart-wrap { position: relative; margin: 20px -16px 0; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
@media (min-width: 720px) { .chart-wrap { margin-inline: 0; } }
.chart { width: 100%; height: 230px; overflow: visible; cursor: crosshair; }
@media (min-width: 720px) { .chart { height: 290px; } }
.chart .line { fill: none; stroke-width: 2.25; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { opacity: 0.1; }
.chart .ref { stroke: var(--faint); stroke-width: 1; stroke-dasharray: 2 4; }
.chart .now { stroke: var(--faint); stroke-width: 1; stroke-dasharray: 3 3; }
.chart .scrub { stroke: var(--muted); stroke-width: 1; }
.axis-row { position: relative; height: 20px; margin-top: 4px; }
.axis-row span { position: absolute; transform: translateX(-50%); font-size: 12px; color: var(--faint); white-space: nowrap; }
.chart-tip { position: absolute; top: -18px; transform: translateX(-50%); font-size: 12px; color: var(--muted); white-space: nowrap; pointer-events: none; font-weight: 600; }
.chart-controls { display: flex; align-items: center; gap: 4px; margin-top: 8px; border-bottom: 1px solid var(--line); padding-bottom: 12px; flex-wrap: wrap; }
.ranges, .modes { display: flex; gap: 2px; }
.ranges button, .modes button { border: 0; background: none; padding: 6px 9px; border-radius: 999px; font-weight: 700; font-size: 14px; cursor: pointer; color: var(--muted); min-height: 36px; }
.ranges button[aria-pressed="true"] { background: var(--brand-soft); color: var(--brand); }
.modes { margin-left: auto; }
.modes button[aria-pressed="true"] { color: var(--ink); background: var(--hover); }

/* Sections and rows */
.layout { display: grid; gap: 32px; }
@media (min-width: 900px) { .layout { grid-template-columns: minmax(0, 1fr) 320px; align-items: start; } .layout > aside { position: sticky; top: 84px; } }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 32px 0 8px; }
.section-title h2 { font-size: 22px; font-weight: 600; letter-spacing: -0.01em; margin: 0; }
.link { color: var(--brand); font-weight: 600; text-decoration: none; font-size: 14px; background: none; border: 0; cursor: pointer; padding: 0; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 16px 16px 8px; }
.panel-head h2 { font-size: 18px; margin: 0; font-weight: 600; }
.rows { list-style: none; margin: 0; padding: 0; }
.row { display: grid; grid-template-columns: minmax(0, 1fr) 72px auto; align-items: center; gap: 12px; padding: 12px 16px; text-decoration: none; border-top: 1px solid var(--line); }
.rows li:first-child .row { border-top: 0; }
.row:hover { background: var(--hover); }
.row strong { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row small { display: block; color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.spark { width: 72px; height: 32px; }
.spark path { fill: none; stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
.spark line { stroke: var(--faint); stroke-width: 1; stroke-dasharray: 1 3; }
.pill { min-width: 72px; text-align: center; border: 0; border-radius: 8px; padding: 7px 10px; font-weight: 700; font-size: 14px; cursor: pointer; font-variant-numeric: tabular-nums; }
.pill.warm { background: var(--warm); color: #fff; }
.pill.cool { background: var(--cool); color: #fff; }
.pill.flat { background: var(--hover); color: var(--ink); }
.pill.wet { background: var(--brand); color: #fff; }
.skel { display: inline-block; height: 12px; border-radius: 6px; background: var(--hover); width: 56px; }
.empty { padding: 20px 16px; color: var(--muted); }
.empty strong { color: var(--ink); display: block; margin-bottom: 4px; }
.pill-hint { color: var(--muted); font-size: 13px; padding: 8px 16px 14px; margin: 0; }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 24px; }
@media (min-width: 560px) { .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.stat { display: flex; justify-content: space-between; gap: 8px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.stat span { color: var(--muted); }
.stat strong { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.summary { font-size: 18px; line-height: 1.5; margin: 0; max-width: 60ch; }

/* Day list */
.days { list-style: none; margin: 0; padding: 0; }
.day { display: grid; grid-template-columns: 56px 26px 40px 36px minmax(0, 1fr) 36px; align-items: center; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.day .name { font-weight: 600; }
.day .icon { font-size: 18px; text-align: center; }
.day .rain { font-size: 12px; color: var(--brand); font-weight: 700; text-align: right; }
.day .lo { color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.day .hi { font-weight: 600; font-variant-numeric: tabular-nums; }
.range-track { position: relative; height: 6px; border-radius: 999px; background: var(--hover); }
.range-fill { position: absolute; top: 0; bottom: 0; border-radius: 999px; background: linear-gradient(90deg, var(--cool), var(--warm)); }

/* Buttons and chips */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 999px; font-weight: 700; border: 0; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn-primary { background: var(--ink); color: var(--bg); }
.btn-quiet { background: var(--hover); }
.btn-follow { background: var(--brand); color: #fff; }
.btn-follow[aria-pressed="true"] { background: var(--hover); color: var(--ink); }
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chips::-webkit-scrollbar { display: none; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 8px 14px; font-weight: 600; white-space: nowrap; cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.detail-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.kicker { color: var(--muted); font-size: 14px; font-weight: 600; margin: 0 0 4px; }
.place-name { font-size: 18px; font-weight: 600; margin: 0 0 12px; }
.note { margin-top: 16px; padding: 12px 14px; border-radius: 12px; background: var(--hover); color: var(--muted); font-size: 14px; }
.state { padding: 48px 0; color: var(--muted); }
.state strong { display: block; color: var(--ink); font-size: 18px; margin-bottom: 6px; }

/* Wedding planner */
.plan { display: grid; gap: 20px; max-width: 640px; }
.plan-form { display: grid; gap: 14px; padding: 16px; }
@media (min-width: 560px) { .plan-form { grid-template-columns: 1fr 1fr auto; align-items: end; } }
.field { display: grid; gap: 6px; }
.field label { font-weight: 600; font-size: 14px; }
.field select, .field input { height: 48px; border: 1px solid var(--line); border-radius: 12px; padding: 0 12px; background: var(--surface); width: 100%; min-width: 0; }
.result { padding: 20px; }
.result h3 { margin: 0; font-size: 20px; font-weight: 600; }
.verdict { font-size: 18px; font-weight: 600; margin: 12px 0 4px; }
.small-print { color: var(--muted); font-size: 13px; margin: 12px 0 0; }

.footer { color: var(--muted); font-size: 13px; padding-block: 24px 32px; border-top: 1px solid var(--line); }
.footer p { margin: 6px 0; max-width: 70ch; }
.back-link { font-weight: 700; color: var(--ink); text-decoration: none; }

@media (prefers-reduced-motion: no-preference) {
  .fade { animation: fade 0.25s ease both; }
  @keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
}
