/* Shared tokens and base components for the design showcase site.
   Concept: an architect's drawing set - basalt ink on cool birch paper, one glacier-blue accent,
   rust reserved for the building itself. Archivo for titles, Inter for text, IBM Plex Mono for data.
   Load fonts in each page's <head>:
   <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Archivo:wght@600;700;800&family=IBM+Plex+Mono:wght@400;500&family=Inter:wght@400;500;600&display=swap"> */

:root {
  --paper: #f4f6f4;        /* page ground: cool birch paper */
  --sheet: #ffffff;        /* raised surfaces: cards, panels */
  --ink: #1c2321;          /* basalt: text */
  --ink-2: #4a5552;        /* secondary text */
  --ink-3: #7b8683;        /* captions, axis labels */
  --line: #d9dfdc;         /* hairlines, borders */
  --line-2: #c3cbc8;       /* stronger rules */
  --accent: #2b6178;       /* glacier blue: links, active state, focus */
  --accent-ink: #ffffff;   /* text on accent */
  --accent-soft: #e2edf1;  /* accent tint backgrounds */
  --rust: #a4552f;         /* the building: highlights in drawings and 3D */
  --pass: #2f7a4b;
  --pass-soft: #e3f1e8;
  --warn: #a56a12;
  --warn-soft: #f7ecd8;
  --fail: #b23a32;
  --fail-soft: #f8e3e1;
  --zone-residential: #cfe0ec;
  --zone-common: #d6e8d0;
  --zone-staff: #f1e2c4;
  --zone-service: #e3deef;
  --zone-entry: #f2d6d2;
  --zone-core: #e7cfcb;
  --zone-circulation: #eceeed;
  --shadow: 0 1px 2px rgba(20, 30, 28, .06), 0 6px 24px rgba(20, 30, 28, .06);

  --font-display: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  --step--1: .8125rem;  /* captions */
  --step-0: 1rem;       /* body */
  --step-1: 1.25rem;    /* lead */
  --step-2: 1.625rem;   /* h3 */
  --step-3: 2.25rem;    /* h2 */
  --step-4: clamp(2.5rem, 5vw, 4rem); /* h1 / hero */

  --radius: 6px;
  --gap: 1.25rem;
  --measure: 65ch;
  --page-max: 1320px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #121716; --sheet: #1a2120; --ink: #e8eeec; --ink-2: #b4c0bc; --ink-3: #85928e;
    --line: #2a3331; --line-2: #3a4542; --accent: #7fb6cc; --accent-ink: #0d1a20; --accent-soft: #1b2d35;
    --rust: #d58a63; --pass: #6cc08b; --pass-soft: #17291e; --warn: #e0a64a; --warn-soft: #2e2414;
    --fail: #ef857c; --fail-soft: #331b19;
    --zone-residential: #26394a; --zone-common: #26392a; --zone-staff: #3d3423; --zone-service: #312c40;
    --zone-entry: #40292a; --zone-core: #3e2b28; --zone-circulation: #252b2a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 24px rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #121716; --sheet: #1a2120; --ink: #e8eeec; --ink-2: #b4c0bc; --ink-3: #85928e;
  --line: #2a3331; --line-2: #3a4542; --accent: #7fb6cc; --accent-ink: #0d1a20; --accent-soft: #1b2d35;
  --rust: #d58a63; --pass: #6cc08b; --pass-soft: #17291e; --warn: #e0a64a; --warn-soft: #2e2414;
  --fail: #ef857c; --fail-soft: #331b19;
  --zone-residential: #26394a; --zone-common: #26392a; --zone-staff: #3d3423; --zone-service: #312c40;
  --zone-entry: #40292a; --zone-core: #3e2b28; --zone-circulation: #252b2a;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 24px rgba(0, 0, 0, .3);
  color-scheme: dark;
}

/* ------------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }
body {
  background: var(--paper); color: var(--ink);
  font: 400 var(--step-0)/1.6 var(--font-body);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.1; text-wrap: balance; margin: 0; letter-spacing: -.01em; }
h1 { font-size: var(--step-4); font-weight: 800; }
h2 { font-size: var(--step-3); font-weight: 700; }
h3 { font-size: var(--step-2); font-weight: 600; }
h4 { font-size: var(--step-1); font-weight: 600; }
p { margin: 0; max-width: var(--measure); }
a { color: var(--accent); text-underline-offset: .2em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
img { max-width: 100%; height: auto; display: block; }
picture { display: contents; }   /* responsive variants: the img lays out as if it were the direct child */
.mono, code, .num { font-family: var(--font-mono); }
.num { font-variant-numeric: tabular-nums; }
.eyebrow { font: 500 var(--step--1)/1.3 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.muted { color: var(--ink-2); }
.caption { font-size: var(--step--1); color: var(--ink-3); }

/* layout: one outer wrapper carries the gutter */
.wrap {
  max-width: var(--page-max); margin-inline: auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.stack { display: flex; flex-direction: column; gap: var(--gap); }
.row { display: flex; flex-wrap: wrap; gap: var(--gap); align-items: baseline; }
.grid { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.grid > *, .row > * { min-width: 0; }
section.band { padding-block: clamp(2.5rem, 6vw, 5rem); border-top: 1px solid var(--line); }

/* sticky header */
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--paper); }
.site-header {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 9;
  background: color-mix(in srgb, var(--paper) 92%, transparent); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap { display: flex; align-items: center; gap: 1.5rem; min-height: 56px; flex-wrap: wrap; }
.brand { font: 700 1rem/1 var(--font-display); color: var(--ink); text-decoration: none; letter-spacing: -.01em; }
.brand small { font: 500 .7rem/1 var(--font-mono); color: var(--ink-3); margin-left: .5rem; letter-spacing: .06em; }
.nav { display: flex; gap: .25rem; flex-wrap: wrap; margin-left: auto; }
.nav a { color: var(--ink-2); text-decoration: none; padding: .4rem .7rem; border-radius: var(--radius); font-weight: 500; font-size: .92rem; }
.nav a:hover { color: var(--ink); background: var(--accent-soft); }
.nav a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }

/* components */
.btn {
  display: inline-flex; align-items: center; gap: .5rem; cursor: pointer;
  font: 600 .92rem/1 var(--font-body); padding: .7rem 1rem; border-radius: var(--radius);
  border: 1px solid var(--line-2); background: var(--sheet); color: var(--ink); text-decoration: none;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); color: var(--accent-ink); }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: var(--radius); overflow: hidden; }
.seg button { font: 500 .85rem/1 var(--font-body); padding: .55rem .8rem; border: 0; background: var(--sheet); color: var(--ink-2); cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }

.card { background: var(--sheet); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.card:hover { box-shadow: var(--shadow); }
.card .card-body { padding: 1rem 1.1rem 1.2rem; display: flex; flex-direction: column; gap: .5rem; }
.card .media { aspect-ratio: 16 / 10; background: var(--zone-circulation); max-width: 100%; }
.card .media img { width: 100%; height: 100%; object-fit: cover; }

.pill { display: inline-flex; align-items: center; gap: .35rem; font: 500 .75rem/1 var(--font-mono); padding: .3rem .5rem; border-radius: 999px; border: 1px solid var(--line-2); color: var(--ink-2); white-space: nowrap; }
.pill.pass { color: var(--pass); background: var(--pass-soft); border-color: transparent; }
.pill.warn { color: var(--warn); background: var(--warn-soft); border-color: transparent; }
.pill.fail { color: var(--fail); background: var(--fail-soft); border-color: transparent; }
.pill.accent { color: var(--accent); background: var(--accent-soft); border-color: transparent; }

/* key figures: label over value */
.figures { display: grid; gap: 0; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.figure { padding: .9rem 1rem; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: .25rem; }
.figure .v { font: 600 1.6rem/1.1 var(--font-display); font-variant-numeric: tabular-nums; }
.figure .v small { font: 500 .8rem/1 var(--font-mono); color: var(--ink-3); margin-left: .2rem; }
.figure .k { font: 500 .72rem/1.3 var(--font-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }

/* score bar 0..100 */
.bar { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.bar.pass > i { background: var(--pass); } .bar.warn > i { background: var(--warn); } .bar.fail > i { background: var(--fail); }

/* tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--sheet); }
table { border-collapse: collapse; width: 100%; font-size: .92rem; }
th, td { text-align: left; padding: .6rem .8rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font: 500 .72rem/1.2 var(--font-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); background: var(--paper); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--font-mono); }
tr:last-child td { border-bottom: 0; }

/* drawing frame: an image presented like a sheet of a drawing set */
.sheet { background: var(--sheet); border: 1px solid var(--line-2); border-radius: 2px; }
.sheet .sheet-title { display: flex; justify-content: space-between; gap: 1rem; padding: .5rem .8rem; border-top: 1px solid var(--line-2); font: 500 .75rem/1.3 var(--font-mono); color: var(--ink-2); flex-wrap: wrap; }

.site-footer { border-top: 1px solid var(--line); padding-block: 2rem 3rem; color: var(--ink-3); font-size: var(--step--1); }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }
