/* Walls design system.
   One family (Archivo) with its width axis doing the expressive work: wide and heavy for
   measurements, normal for reading. Concrete section-hatching marks every wall. Teal is the
   room you have; amber and red only appear when that room shrinks. */

@font-face {
  font-family: "Sora"; font-style: normal; font-display: swap; font-weight: 100 800;
  src: url(/fonts/sora-latin-wght-normal.woff2) format("woff2");
}
@font-face {
  font-family: "DM Sans"; font-style: normal; font-display: swap; font-weight: 100 1000;
  src: url(/fonts/dm-sans-latin-wght-normal.woff2) format("woff2");
}

:root {
  /* light (default) */
  --paper: #EDEFEC;
  --paper-2: #E1E6E3;
  --surface: #F7F8F6;
  --panel: #FBFCFB;
  --raise: #EEF2F0;
  --ink: #13262B;
  --muted: #56686B;
  --rule: #C9D1CE;
  --brand: #0E7468;
  --brand-ink: #F2FBF9;
  --brand-hover: #0B5E55;
  --warn: #A86E00;
  --warn-text: #7A5000;
  --crit: #B3261E;
  --crit-text: #9A1F18;
  --hatch: #8E9B98;
  --gain: #00846F;
  --loss: #C0362C;
  --frame: #DCE2DF;
  --deep: #13262B;
  --shadow: 0 1px 0 rgb(19 38 43 / .04), 0 12px 32px -18px rgb(19 38 43 / .28);

  --r-lg: 18px;
  --r-md: 10px;
  --r-sm: 6px;
  --f: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --fd: "Sora", "DM Sans", system-ui, sans-serif;
  --measure: 66ch;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0D191C; --paper-2: #102226; --surface: #13242A; --panel: #13242A; --raise: #1A3036;
    --ink: #E3EAE8; --muted: #8FA3A3; --rule: #24393F; --brand: #33B5A5; --brand-ink: #06201C; --brand-hover: #4CC9B9;
    --warn: #E5A823; --warn-text: #F5D58A; --crit: #EF5A45; --crit-text: #FFB4A8; --hatch: #3D5559; --gain: #22A593; --loss: #EF5A45; --frame: #0A1416; --deep: #071113;
    --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0D191C; --paper-2: #102226; --surface: #13242A; --panel: #13242A; --raise: #1A3036;
  --ink: #E3EAE8; --muted: #8FA3A3; --rule: #24393F; --brand: #33B5A5; --brand-ink: #06201C; --brand-hover: #4CC9B9;
  --warn: #E5A823; --warn-text: #F5D58A; --crit: #EF5A45; --crit-text: #FFB4A8; --hatch: #3D5559; --gain: #22A593; --loss: #EF5A45; --frame: #0A1416; --deep: #071113;
  --shadow: none; color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--f);
  font-size: 17px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 3px; border-radius: 4px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

.wrap { width: min(1160px, 100% - 32px); margin-inline: auto; }

/* Type scale (1.25 ratio, wide axis for display) */
.display {
  font-family: var(--fd); font-weight: 650;
  font-size: clamp(2.3rem, 5.2vw, 4.1rem);
  line-height: 1.02;
  letter-spacing: -0.035em;
  margin: 0;
  max-width: 17ch;
}
h2, .h2 {
  font-family: var(--fd); font-weight: 620;
  font-size: clamp(1.7rem, 3.2vw, 2.45rem);
  line-height: 1.08;
  letter-spacing: -0.015em;
  margin: 0 0 .5em;
  max-width: 24ch;
}
h3, .h3 {
  font-family: var(--fd); font-weight: 600;
  font-size: 1.22rem;
  line-height: 1.25;
  margin: 0 0 .4em;
}
p { margin: 0 0 1em; max-width: var(--measure); }
.lede { font-size: 1.2rem; color: var(--muted); max-width: 52ch; }
.small { font-size: .9rem; color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  font: inherit; font-weight: 640; font-size: 1rem;
  padding: .8em 1.25em; border-radius: var(--r-md);
  border: 1.5px solid var(--ink); background: transparent; color: var(--ink);
  text-decoration: none; cursor: pointer; transition: background .15s, color .15s;
}
.btn:hover { background: var(--ink); color: var(--paper); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); color: var(--brand-ink); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn.quiet { border-color: transparent; padding-inline: .6em; text-decoration: underline; text-underline-offset: 3px; }
.btn.quiet:hover { background: transparent; color: var(--brand); }

/* Concrete hatch used for every wall */
.hatch {
  background-color: var(--paper-2);
  background-image: repeating-linear-gradient(-45deg, var(--hatch) 0 1.5px, transparent 1.5px 9px);
}

/* ---------- The wall gauge ---------- */
.gauge { --g-ink: var(--ink); --g-muted: var(--muted); --g-rule: var(--rule); --g-room: var(--brand); --g-hatch: var(--hatch); color: var(--g-ink); }
.gauge.band-warning { --g-room: var(--warn); }
.gauge.band-critical, .gauge.band-breached { --g-room: var(--crit); }

.g-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: .2em .6em; margin-bottom: .55rem; }
.g-num {
  font-family: var(--fd); font-weight: 650; font-variant-numeric: tabular-nums;
  font-size: clamp(2rem, 4.6vw, 3.3rem); line-height: 1; letter-spacing: -0.02em; color: var(--g-room);
}
.gauge.small .g-num { font-size: clamp(1.45rem, 3vw, 2rem); }
.g-cap { font-size: 1.02rem; color: var(--g-muted); }
.g-cap b { color: var(--g-ink); font-weight: 640; }

.g-track { position: relative; height: 54px; border-radius: var(--r-sm); overflow: hidden;
  border: 1.5px solid var(--g-rule); background: transparent; }
.gauge.small .g-track { height: 34px; }
.g-wall { position: absolute; inset: 0 auto 0 0; width: 12%;
  background-image: repeating-linear-gradient(-45deg, var(--g-hatch) 0 1.5px, transparent 1.5px 8px);
  border-right: 3px solid var(--g-ink); }
.g-room { position: absolute; top: 0; bottom: 0; left: 12%;
  background: color-mix(in srgb, var(--g-room) 20%, transparent);
  border-right: 3px solid var(--g-room); transition: width .7s cubic-bezier(.2,.7,.2,1); }
.g-tick { position: absolute; top: 0; bottom: 0; width: 0; border-left: 1.5px dashed color-mix(in srgb, var(--g-ink) 35%, transparent); }
.g-tick span { position: absolute; bottom: 3px; left: 5px; font-size: .72rem; white-space: nowrap; color: var(--g-muted); }
.gauge.small .g-tick span { display: none; }
.g-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .3em 1em; margin-top: .45rem; font-size: .86rem; color: var(--g-muted); }

/* ---------- Forms ---------- */
label.field { display: block; margin-bottom: 1rem; }
label.field > span { display: block; font-weight: 600; font-size: .95rem; margin-bottom: .3rem; }
.input, select.input, textarea.input {
  width: 100%; font: inherit; font-size: 1rem; padding: .72em .85em; border-radius: var(--r-md);
  border: 1.5px solid var(--rule); background: var(--surface); color: var(--ink);
}
.input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 25%, transparent); }
.hint { display: block; font-size: .85rem; color: var(--muted); margin-top: .3rem; }
.error-text { color: var(--crit); font-size: .9rem; font-weight: 600; margin-top: .35rem; }
.input.bad { border-color: var(--crit); }

/* Theme toggle */
.theme-btn { font: inherit; font-size: .88rem; display: inline-flex; align-items: center; gap: .4rem; background: transparent; color: var(--muted); border: 1.5px solid var(--rule); border-radius: 999px; padding: .4em .8em; cursor: pointer; }
.theme-btn:hover { color: var(--ink); border-color: var(--muted); }
.theme-btn svg { width: 16px; height: 16px; }
@media (max-width: 640px) { .theme-btn span { display: none; } .theme-btn { padding: .5em .6em; } }
.g-guard { position: absolute; top: -1px; bottom: -1px; width: 0; border-left: 3px solid var(--warn); }
.g-guard span { position: absolute; top: 3px; left: 6px; font-size: .72rem; font-weight: 650; white-space: nowrap; color: var(--warn-text); }
.g-guard.crossed { border-left-color: var(--crit); } .g-guard.crossed span { color: var(--crit-text); }
.gauge.small .g-guard span { display: none; }

/* Brand mark */
.mark { display: inline-flex; align-items: center; gap: .5rem; text-decoration: none; font-family: var(--fd); font-weight: 650; font-size: 1.5rem; letter-spacing: -0.035em; color: var(--ink); }
.mark-svg { width: 32px; height: 32px; }
[hidden] { display: none !important; }

/* Language links and the first-visit language offer */
.foot-lang { font-size: .86rem; color: var(--muted); margin: .4rem 0 .8rem; }
.foot-lang a { color: var(--muted); }
.foot-lang b { color: var(--ink, inherit); font-weight: 600; }
.app-legal .foot-lang { margin: .6rem 0 0; font-size: .78rem; }
.lang-offer { position: fixed; left: 50%; bottom: max(16px, env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 60; display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; padding: .7rem .9rem; border-radius: 14px; background: var(--panel, #0d1b1e); border: 1px solid var(--rule); box-shadow: 0 10px 30px rgba(0,0,0,.25); max-width: calc(100vw - 32px); font-size: .92rem; }
.lang-offer .btn { padding: .45rem .8rem; font-size: .88rem; }

/* How-to-read key under the gauges */
.g-guide { margin-top: .9rem; padding: .75rem .9rem; border-radius: var(--r-sm); background: color-mix(in srgb, var(--ink) 4%, transparent); font-size: .86rem; color: var(--muted); display: grid; gap: .45rem; }
.g-guide p { margin: 0; max-width: none; }
.g-guide.compact { padding: .5rem .75rem; margin-top: .6rem; }
.g-key { display: flex; flex-wrap: wrap; gap: .35rem 1.1rem; }
.g-key span { display: inline-flex; align-items: center; gap: .45rem; }
.g-key i { flex: none; display: inline-block; width: 20px; height: 14px; border-radius: 3px; }
.g-key .k-wall { border: 1.5px solid var(--rule); background-image: repeating-linear-gradient(-45deg, var(--hatch) 0 1.5px, transparent 1.5px 5px); box-shadow: inset -3px 0 0 var(--ink); }
.g-key .k-room { background: color-mix(in srgb, var(--brand) 20%, transparent); border: 1.5px solid var(--rule); }
.g-key .k-you { width: 0; height: 16px; border-radius: 0; border-left: 3px solid var(--brand); }
.g-key .k-tick { width: 0; height: 16px; border-radius: 0; border-left: 1.5px dashed color-mix(in srgb, var(--ink) 45%, transparent); }
.g-key .k-guard { width: 0; height: 16px; border-radius: 0; border-left: 3px solid var(--warn); }
.g-count { color: var(--ink); }
.g-count b { font-variant-numeric: tabular-nums; }
.g-guide details { display: grid; gap: .45rem; }
.g-guide summary { cursor: pointer; font-weight: 600; color: var(--ink); width: fit-content; }
.g-guide details[open] summary { margin-bottom: .45rem; }
.g-guide details .g-how { margin-top: .45rem; }
/* Narrow screens: keep every dashed line but only the first label, so labels never collide. */
@media (max-width: 520px) { .g-tick ~ .g-tick span { display: none; } }
