/* Copyright (c) 2025-2026 Tahseen Huda / Ooua */
/*
 * Components shared by the app (style.css loads after this) and the public pages
 * (prerender.mjs writes tokens.css + this + the page rules as /p.css). One definition
 * of the base text styles, focus ring, buttons, inputs, tags, KPIs, notes, charts and
 * the sign-up box. Every value is a token from tokens.css.
 */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); }
body { font: var(--fw-normal) var(--fs-body) / var(--lh-body) var(--font); color: var(--fg); }
h1, h2, h3 { line-height: var(--lh-tight); font-weight: var(--fw-bold); }
b, strong, th { font-weight: var(--fw-bold); }
p { margin: var(--s2) 0; }
input { margin: 0; }
a { color: var(--link); }
a:hover { text-decoration-thickness: 2px; }
button, select, input { font: inherit; color: inherit; }
button { cursor: pointer; line-height: var(--lh-tight); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
/* one visible focus ring everywhere: the focus colour with a surface-coloured halo so it reads on ink, paper and the map */
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; box-shadow: 0 0 0 4px var(--bg); }
.muted { color: var(--fg-muted); font-size: var(--fs-small); }
.note { font-size: var(--fs-small); color: var(--fg-muted); margin: var(--s1) 0 var(--s2); }
.nd { color: var(--fg-muted); font-style: italic; }
/* secondary buttons and button-shaped links */
.btn { border: var(--border); background: var(--bg); color: var(--fg); border-radius: var(--r-md); padding: 0 var(--s3); min-height: 36px; display: inline-flex; align-items: center; justify-content: center; gap: var(--s1); text-decoration: none; }
.btn:hover { background: var(--bg-soft); }
.btn.primary { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.actions { display: flex; gap: var(--s2); margin: var(--s2) 0; flex-wrap: wrap; }
.actions button, .actions a { border: var(--border); background: var(--bg); color: var(--fg); border-radius: var(--r-md); padding: 0 var(--s3); min-height: 36px; display: inline-flex; align-items: center; gap: var(--s1); text-decoration: none; font-size: var(--fs-small); }
.actions button:hover, .actions a:hover { background: var(--bg-soft); }
.actions .primary { background: var(--fg); color: var(--bg); border-color: var(--fg); }
input[type=search], input[type=email], input[type=text], .signup select { font-size: var(--fs-lead); /* 16px: iOS does not zoom the page on focus */
  color: var(--fg); background: var(--bg); border: var(--border); border-radius: var(--r-md); padding: var(--s2) var(--s3); min-height: 40px; width: 100%; }
/* tags: static labels (type, city, scale, dev application); the dot takes its colour from the .t-* class (tokens.css) */
.tag { display: inline-flex; align-items: center; gap: var(--s1); font-size: var(--fs-small); line-height: var(--lh-tight); padding: 0 var(--s2); min-height: 20px; border-radius: var(--r-sm); background: var(--bg-soft); color: var(--fg); max-width: 100%; white-space: nowrap; }
.tag i, i.t { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: 0 0 auto; background: var(--c); }
i.t { margin-right: var(--s1); vertical-align: 0; }
.tag.dev { border: 1px solid var(--dev); background: var(--bg); }
.tag.scale { background: var(--bg); border: 1px dashed var(--line); }
.tag.build { background: var(--fg); color: var(--bg); }
.tag.withheld { background: var(--bg); border: var(--border); color: var(--fg-muted); font-style: italic; }
.tag.city { background: var(--bg); border: var(--border); color: var(--fg-muted); font-weight: var(--fw-bold); letter-spacing: .02em; }
/* KPI cards */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: var(--s2); margin: var(--s3) 0; }
.kpis div { background: var(--bg-soft); border-radius: var(--r-md); padding: var(--s2) var(--s3); min-width: 0; }
.kpis b { display: block; font-size: var(--fs-title); line-height: var(--lh-tight); overflow-wrap: anywhere; }
.kpis span { font-size: var(--fs-small); color: var(--fg-muted); }
/* stacked year bars (.t-* segments, or an ink segment) + axis */
.bars { display: flex; align-items: stretch; gap: var(--s1); height: 90px; margin: var(--s5) 0 var(--s1); border-bottom: var(--border); }
.bars div { flex: 1; height: 100%; display: flex; flex-direction: column-reverse; justify-content: flex-start; min-width: 4px; max-width: 48px; position: relative; }
.bars span { display: block; flex: none; background: var(--c, var(--fg)); }
.bars small { position: absolute; top: -16px; left: 0; right: 0; text-align: center; font-size: var(--fs-small); line-height: var(--lh-tight); color: var(--fg-muted); white-space: nowrap; }
.axis { display: flex; gap: var(--s1); font-size: var(--fs-small); color: var(--fg-muted); }
.axis span { flex: 1; text-align: center; min-width: 4px; max-width: 48px; }
/* the weekly digest sign-up box */
.signup { margin: var(--s6) 0 var(--s2); padding: var(--s3); border: var(--border); border-radius: var(--r-md); background: var(--bg-soft); }
.signup h2, .signup h3 { border: 0; margin: 0 0 var(--s1); padding: 0; }
.signup label, .signup .field { display: flex; flex-direction: column; gap: var(--s1); font-size: var(--fs-small); color: var(--fg-muted); margin: var(--s2) 0; }
.signup .two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--s2); }
.signup .two label { min-width: 0; }
.signup select { width: 100%; min-width: 0; }
.signup .where { font-size: var(--fs-body); color: var(--fg); }
.signup .linkish { align-self: flex-start; border: 0; background: none; color: var(--link); padding: var(--s1) 0; min-height: 24px; font-size: var(--fs-small); text-decoration: underline; }
.signup .hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.signup button[type=submit] { width: 100%; padding: var(--s3); border: 0; border-radius: var(--r-md); background: var(--fg); color: var(--bg); font-weight: var(--fw-bold); margin-top: var(--s1); }
.signup button[disabled] { opacity: .6; }
.signup .msg { min-height: 24px; margin: var(--s2) 0 0; font-size: var(--fs-small); color: var(--fg-muted); }
.signup .msg:not(:empty) { color: var(--fg); padding: var(--s2) var(--s3); border-radius: var(--r-md); border: var(--border); background: var(--bg); }
.signup .msg.ok { border-color: var(--ok); background: var(--ok-bg); color: var(--ok); }
.signup .msg.ok::before { content: "✓ "; font-weight: var(--fw-bold); }
.signup .msg.err { border-color: var(--err); background: var(--err-bg); color: var(--err); }
.signup .msg.err::before { content: "! "; font-weight: var(--fw-bold); }
/* theme toggle: moon = switch to dark, sun = switch to light (aria-pressed = dark is on) */
.theme-btn { width: 36px; padding: 0; font-size: var(--fs-lead); }
.theme-btn::before { content: "☾"; }
.theme-btn[aria-pressed="true"]::before { content: "☀"; }
