/* Polari hub — shared styles. Product identity: Material blue, Roboto, the
   dodecahedron mark; amber signals the scorecard. Theme-aware in both directions. */
:root {
  --paper: #ffffff; --paper-2: #f5f5f7;
  --ink: #212529; --ink-70: #555b62; --ink-45: #8a9199;
  --accent: #1976d2; --accent-bright: #2196f3; --amber: #d48a0c;
  --line: rgba(20,26,33,0.12); --line-strong: rgba(20,26,33,0.24);
  --card: #ffffff; --grid: rgba(33,150,243,0.05); --mesh: 33,150,243; --focus: #2196f3;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #1a1a1c; --paper-2: #141416;
    --ink: #e6e6e8; --ink-70: #a2a8af; --ink-45: #6f767d;
    --accent: #64b5f6; --accent-bright: #90caf9; --amber: #ffb300;
    --line: rgba(230,236,240,0.13); --line-strong: rgba(230,236,240,0.26);
    --card: #232326; --grid: rgba(144,202,249,0.05); --mesh: 144,202,249; --focus: #90caf9;
  }
}
:root[data-theme="light"] {
  --paper:#ffffff; --paper-2:#f5f5f7; --ink:#212529; --ink-70:#555b62; --ink-45:#8a9199;
  --accent:#1976d2; --accent-bright:#2196f3; --amber:#d48a0c;
  --line:rgba(20,26,33,0.12); --line-strong:rgba(20,26,33,0.24);
  --card:#ffffff; --grid:rgba(33,150,243,0.05); --mesh:33,150,243; --focus:#2196f3;
}
:root[data-theme="dark"] {
  --paper:#1a1a1c; --paper-2:#141416; --ink:#e6e6e8; --ink-70:#a2a8af; --ink-45:#6f767d;
  --accent:#64b5f6; --accent-bright:#90caf9; --amber:#ffb300;
  --line:rgba(230,236,240,0.13); --line-strong:rgba(230,236,240,0.26);
  --card:#232326; --grid:rgba(144,202,249,0.05); --mesh:144,202,249; --focus:#90caf9;
}

* { box-sizing: border-box; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: Roboto, "Helvetica Neue", system-ui, sans-serif; line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 32px 32px;
}
.mono { font-family: "Roboto Mono", ui-monospace, "Courier New", monospace; }
.wrap { width: min(1120px, 92vw); margin-inline: auto; }
a { color: var(--accent); }
a:focus-visible, button:focus-visible, .module:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 3px; }

.eyebrow {
  font-family: "Roboto Mono", ui-monospace, monospace; font-size: 0.72rem; letter-spacing: 0.22em;
  text-transform: uppercase; color: var(--accent); display: inline-flex; align-items: center; gap: 0.7em;
}
.eyebrow::before { content: ""; width: 26px; height: 1px; background: var(--accent); opacity: 0.7; }

.topbar {
  position: relative; z-index: 2; display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 0; border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 0.6rem; font-weight: 700; font-size: 1.05rem; text-decoration: none; color: inherit; }
.brand img { width: 28px; height: 28px; }
.navlinks { display: flex; gap: 1.4rem; align-items: center; }
.navlinks a { font-size: 0.85rem; color: var(--ink-70); text-decoration: none; }
.navlinks a:hover, .navlinks a.active { color: var(--accent); }
.theme-toggle { font: inherit; font-size: 0.78rem; cursor: pointer; color: var(--ink-70); background: transparent; border: 1px solid var(--line-strong); border-radius: 6px; padding: 0.3rem 0.7rem; }
.theme-toggle:hover { color: var(--accent); border-color: var(--accent); }

/* hero */
.hero { position: relative; overflow: hidden; border-bottom: 1px solid var(--line); }
.hero canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; opacity: 0.9; }
.hero-inner { position: relative; z-index: 1; padding: clamp(3.2rem, 8vw, 7rem) 0 clamp(2.6rem, 6vw, 5rem); }
h1.title { font-size: clamp(3.2rem, 12vw, 8rem); line-height: 0.94; margin: 1.5rem 0 0; font-weight: 700; letter-spacing: -0.04em; text-wrap: balance; }
.thesis { max-width: 34ch; margin: 1.5rem 0 0; font-size: clamp(1.1rem, 2.2vw, 1.45rem); line-height: 1.42; text-wrap: balance; }
.thesis .em, .lede .em, .foot-note .em { color: var(--accent); font-weight: 500; }
.coords { margin-top: 2.3rem; display: flex; flex-wrap: wrap; gap: 0.55rem 1.6rem; font-size: 0.72rem; letter-spacing: 0.14em; color: var(--ink-45); text-transform: uppercase; }
.coords span { display: inline-flex; align-items: center; gap: 0.5em; }
.coords b { color: var(--ink-70); font-weight: 600; }

section { padding: clamp(3.2rem, 7vw, 6rem) 0; border-bottom: 1px solid var(--line); }
.lede { max-width: 62ch; font-size: clamp(1.02rem, 1.5vw, 1.18rem); margin-top: 1.3rem; }
.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 2.3rem; }
.sec-head h2 { font-size: clamp(1.5rem, 3vw, 2.05rem); margin: 0.7rem 0 0; letter-spacing: -0.02em; font-weight: 600; }

/* module grid */
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.module { background: var(--card); padding: clamp(1.5rem, 3vw, 2.3rem); display: flex; flex-direction: column; min-height: 236px; text-decoration: none; color: inherit; transition: background .25s ease; }
.module:hover { background: color-mix(in srgb, var(--accent) 7%, var(--card)); }
.module .id { font-family: "Roboto Mono", ui-monospace, monospace; font-size: 0.72rem; letter-spacing: 0.18em; color: var(--accent); display: flex; align-items: center; gap: 0.7em; }
.module .id .node { width: 7px; height: 7px; border-radius: 50%; border: 1.5px solid currentColor; }
.module h3 { font-size: 1.38rem; margin: 1rem 0 0.15rem; letter-spacing: -0.015em; font-weight: 600; }
.module .kicker { color: var(--accent); font-size: 0.92rem; font-weight: 600; margin-bottom: 0.7rem; }
.module p { margin: 0; color: var(--ink-70); font-size: 0.97rem; line-height: 1.55; }
.module .go { margin-top: auto; padding-top: 1.4rem; font-size: 0.86rem; font-weight: 600; display: inline-flex; align-items: center; gap: 0.5em; }
.module .go .arrow { color: var(--accent); transition: transform .25s ease; }
.module:hover .go .arrow { transform: translateX(4px); }
.module.amber .id, .module.amber .kicker, .module.amber .go .arrow { color: var(--amber); }
.module.amber:hover { background: color-mix(in srgb, var(--amber) 8%, var(--card)); }
.module.map { grid-column: 1 / -1; flex-direction: row; gap: 2rem; align-items: center; flex-wrap: wrap; }
.module.map .map-copy { flex: 1 1 320px; }

.diagram { width: 210px; height: 150px; flex: 0 0 auto; }
.diagram line { stroke: var(--line-strong); stroke-width: 1; }
.diagram circle { fill: var(--card); stroke: var(--accent); stroke-width: 1.5; }
.diagram circle.core { fill: var(--accent); }
.diagram text { fill: var(--ink-45); font-family: "Roboto Mono", monospace; font-size: 8px; }

/* docs */
.doc { max-width: 74ch; }
.doc h2 { font-size: clamp(1.5rem, 3vw, 2rem); letter-spacing: -0.02em; margin: 2.4rem 0 0.6rem; }
.doc h3 { font-size: 1.2rem; margin: 1.8rem 0 0.4rem; }
.doc p, .doc li { color: var(--ink-70); }
.doc .mermaid { margin: 1.6rem 0; padding: 1.2rem; background: var(--card); border: 1px solid var(--line); border-radius: 10px; overflow-x: auto; }
.doc code { font-family: "Roboto Mono", monospace; font-size: 0.88em; background: var(--paper-2); padding: 0.1em 0.4em; border-radius: 4px; }

/* footer */
footer { padding: clamp(2.8rem, 6vw, 4.5rem) 0 3.5rem; }
.foot-grid { display: flex; justify-content: space-between; gap: 2rem; flex-wrap: wrap; align-items: flex-start; }
.brand-foot { display: flex; align-items: center; gap: 0.6rem; font-weight: 700; margin-bottom: 0.9rem; }
.brand-foot img { width: 26px; height: 26px; }
.foot-note { max-width: 40ch; color: var(--ink-45); font-size: 0.85rem; }
.foot-links { display: flex; flex-direction: column; gap: 0.55rem; }
.foot-links .col-h { font-family: "Roboto Mono", monospace; font-size: 0.7rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--ink-45); margin-bottom: 0.4rem; }
.foot-links a { color: var(--ink-70); text-decoration: none; font-size: 0.92rem; }
.foot-links a:hover { color: var(--accent); }

@media (max-width: 720px) { .grid { grid-template-columns: 1fr; } .navlinks .hide-sm { display: none; } .module.map { flex-direction: column; align-items: flex-start; } }
@media (prefers-reduced-motion: reduce) { .module, .module .go .arrow { transition: none; } }
