/* Symmetry Survey — microsite styles
   MIT-OCW / blackboard aesthetic. Dark by default.
   ~380 lines, single file. */

/* ---------- tokens ---------- */
:root {
  --bg:        oklch(0.18 0.010 250);
  --bg-rise:   oklch(0.22 0.012 250);
  --bg-sink:   oklch(0.14 0.010 250);
  --fg:        oklch(0.94 0.005 90);
  --fg-mute:   oklch(0.74 0.008 90);
  --fg-dim:    oklch(0.55 0.010 250);
  --rule:      oklch(0.38 0.010 250);
  --rule-soft: oklch(0.28 0.010 250);
  --accent-a:  oklch(0.75 0.12 55);   /* chalk amber — gauge-free */
  --accent-b:  oklch(0.72 0.10 205);  /* chalk cyan  — training-invariant */
  --accent-c:  oklch(0.62 0.06 25);   /* desat brick — probe-fake */
  --grid:      oklch(0.26 0.010 250);
  --font-serif: "Source Serif 4", Charter, "Iowan Old Style", Georgia, serif;
  --font-mono:  "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --font-ui:    "Source Serif 4", Georgia, serif;
  --step-1: 0.84rem; --step-0: 1rem; --step-1u: 1.18rem;
  --step-2: 1.44rem; --step-3: 2.1rem; --step-4: 3.2rem; --step-5: 4.6rem;
}
:root[data-theme="light"] {
  --bg:        oklch(0.975 0.003 90);
  --bg-rise:   oklch(0.995 0.002 90);
  --bg-sink:   oklch(0.94 0.004 90);
  --fg:        oklch(0.22 0.010 250);
  --fg-mute:   oklch(0.40 0.010 250);
  --fg-dim:    oklch(0.55 0.010 250);
  --rule:      oklch(0.72 0.010 250);
  --rule-soft: oklch(0.86 0.008 250);
  --accent-a:  oklch(0.55 0.14 55);
  --accent-b:  oklch(0.50 0.12 215);
  --accent-c:  oklch(0.48 0.10 25);
  --grid:      oklch(0.88 0.005 90);
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-serif);
  font-size: 17px;
  line-height: 1.55;
  font-feature-settings: "onum" 1, "liga" 1;
  text-rendering: optimizeLegibility;
}
a { color: var(--fg); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--accent-a); }
code, kbd, .mono { font-family: var(--font-mono); font-size: 0.92em; }
hr { border: 0; border-top: 1px solid var(--rule-soft); margin: 0; }
img, svg { max-width: 100%; height: auto; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 32px; }
@media (max-width: 720px) { .wrap { padding: 0 20px; } }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-dim);
}

/* ---------- top bar ---------- */
.topbar {
  border-bottom: 1px solid var(--rule-soft);
  background: var(--bg);
  position: sticky; top: 0; z-index: 20;
  backdrop-filter: saturate(1.1);
}
.topbar .row {
  display: flex; align-items: center; gap: 24px;
  height: 56px;
}
.brand {
  font-family: var(--font-mono);
  font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--fg-mute); text-decoration: none;
}
.brand b { color: var(--fg); font-weight: 600; letter-spacing: 0.02em; }
.nav { display: flex; gap: 22px; margin-left: auto; }
.nav a {
  font-family: var(--font-mono); font-size: 12px;
  letter-spacing: 0.06em; text-decoration: none; color: var(--fg-mute);
}
.nav a:hover { color: var(--fg); }
.theme-toggle {
  font-family: var(--font-mono); font-size: 12px;
  background: transparent; border: 1px solid var(--rule);
  color: var(--fg-mute); padding: 4px 10px; cursor: pointer;
  letter-spacing: 0.06em;
}
.theme-toggle:hover { color: var(--fg); border-color: var(--fg-mute); }
@media (max-width: 720px) { .nav { display: none; } }

/* ---------- section scaffold ---------- */
section { padding: 72px 0; border-bottom: 1px solid var(--rule-soft); }
section:last-of-type { border-bottom: 0; }
.section-head {
  display: grid; grid-template-columns: 180px 1fr; gap: 32px;
  align-items: baseline; margin-bottom: 40px;
}
.section-head .num { font-family: var(--font-mono); font-size: 12px; color: var(--fg-dim); letter-spacing: 0.12em; }
.section-head h2 {
  font-family: var(--font-serif); font-weight: 400;
  font-size: var(--step-3); margin: 0; letter-spacing: -0.01em;
}
.section-head .lede { grid-column: 2; color: var(--fg-mute); max-width: 60ch; margin-top: 4px; }
@media (max-width: 720px) {
  section { padding: 48px 0; }
  .section-head { grid-template-columns: 1fr; gap: 8px; }
  .section-head .lede { grid-column: 1; }
}

/* ---------- hero ---------- */
.hero { padding: 72px 0 56px; border-bottom: 1px solid var(--rule-soft); }
.hero .meta {
  display: flex; gap: 18px; align-items: center;
  color: var(--fg-dim); font-family: var(--font-mono); font-size: 11px;
  letter-spacing: 0.12em; text-transform: uppercase;
  margin-bottom: 28px;
}
.hero .meta .dot { width: 4px; height: 4px; background: var(--fg-dim); border-radius: 50%; }
.hero h1 {
  font-family: var(--font-serif); font-weight: 400;
  font-size: clamp(2rem, 4.4vw, var(--step-5));
  line-height: 1.08; letter-spacing: -0.02em;
  margin: 0 0 18px; max-width: 22ch;
}
.hero h1 em { font-style: italic; color: var(--accent-a); }
.hero .thesis {
  font-size: var(--step-1u); max-width: 62ch; color: var(--fg-mute);
  margin: 0 0 40px;
}
.hero-layout { display: grid; grid-template-columns: 1.1fr 1fr; gap: 56px; align-items: start; }
@media (max-width: 900px) { .hero-layout { grid-template-columns: 1fr; gap: 36px; } }
.hero-stats {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 0; border-top: 1px solid var(--rule-soft);
  border-bottom: 1px solid var(--rule-soft);
}
.hero-stats .cell {
  padding: 16px 14px 14px; border-right: 1px solid var(--rule-soft);
}
.hero-stats .cell:last-child { border-right: 0; }
.hero-stats .n { font-family: var(--font-mono); font-size: var(--step-2); font-variant-numeric: tabular-nums; }
.hero-stats .n .of { color: var(--fg-dim); font-size: 0.6em; }
.hero-stats .lbl { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.14em; color: var(--fg-dim); text-transform: uppercase; margin-top: 2px; }

/* taxonomy graph */
.taxonomy {
  border: 1px solid var(--rule-soft);
  background:
    repeating-linear-gradient(0deg,   transparent 0 23px, var(--grid) 23px 24px),
    repeating-linear-gradient(90deg,  transparent 0 23px, var(--grid) 23px 24px),
    var(--bg-sink);
  aspect-ratio: 5 / 4;
  position: relative;
  overflow: hidden;
}
.taxonomy svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.taxonomy .caption {
  position: absolute; bottom: 10px; left: 12px; right: 12px;
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.1em;
  color: var(--fg-dim); text-transform: uppercase;
  display: flex; justify-content: space-between;
}

/* ---------- catalog grid ---------- */
.catalog {
  display: grid; gap: 0;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  border-top: 1px solid var(--rule-soft);
  border-left: 1px solid var(--rule-soft);
}
@media (max-width: 720px) { .catalog { grid-template-columns: 1fr; } }
.card {
  position: relative;
  padding: 22px 22px 20px;
  border-right: 1px solid var(--rule-soft);
  border-bottom: 1px solid var(--rule-soft);
  text-decoration: none; color: inherit;
  background: var(--bg);
  transition: background 120ms;
  display: flex; flex-direction: column; gap: 10px; min-height: 210px;
}
.card:hover { background: var(--bg-rise); }
.card::before {
  content: ""; position: absolute; top: 0; left: 0; width: 3px; height: 100%;
  background: var(--rule);
}
.card[data-class="gauge-free"]::before        { background: var(--accent-a); }
.card[data-class="training-invariant"]::before { background: var(--accent-b); }
.card[data-class="probe-fake"]::before        { background: var(--accent-c); }
.card .klass {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--fg-dim);
  display: flex; align-items: center; gap: 8px;
}
.card .klass .glyph { width: 10px; height: 10px; border: 1px solid currentColor; }
.card[data-class="gauge-free"] .klass .glyph        { background: var(--accent-a); border-color: var(--accent-a); }
.card[data-class="training-invariant"] .klass .glyph { background: transparent; border-color: var(--accent-b); }
.card[data-class="probe-fake"] .klass .glyph        { background: transparent; border-color: var(--accent-c); border-style: dashed; }
.card h3 {
  font-family: var(--font-serif); font-weight: 400; font-size: 1.22rem;
  margin: 0; letter-spacing: -0.005em;
}
.card .inv {
  flex: 1; color: var(--fg-mute);
  font-size: 0.96rem; padding: 4px 0;
  overflow-x: auto;
}
.card .inv .katex { font-size: 0.95em; }
.card .foot {
  display: flex; justify-content: space-between; align-items: baseline;
  font-family: var(--font-mono); font-size: 11px; color: var(--fg-dim);
  letter-spacing: 0.04em; padding-top: 8px;
  border-top: 1px dotted var(--rule);
}
.card .foot .proof { font-variant-numeric: tabular-nums; color: var(--fg); }
.card .foot .proof .of { color: var(--fg-mute); }
.card .foot .arrow { color: var(--fg-mute); }
.card:hover .foot .arrow { color: var(--accent-a); }

/* legend */
.legend {
  display: flex; gap: 24px; flex-wrap: wrap; margin-bottom: 24px;
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.06em;
  color: var(--fg-mute);
}
.legend span { display: inline-flex; align-items: center; gap: 8px; }
.legend .sw { width: 12px; height: 12px; border: 1px solid currentColor; }
.legend .sw.a { background: var(--accent-a); border-color: var(--accent-a); }
.legend .sw.b { background: transparent; border-color: var(--accent-b); }
.legend .sw.c { background: transparent; border-color: var(--accent-c); border-style: dashed; }

/* ---------- widgets ---------- */
.widgets { display: grid; gap: 0; grid-template-columns: 1fr; }
.widget {
  border: 1px solid var(--rule-soft);
  margin-bottom: -1px;
  padding: 0;
  background: var(--bg);
  display: grid; grid-template-columns: 320px 1fr;
}
@media (max-width: 820px) { .widget { grid-template-columns: 1fr; } }
.widget .panel {
  padding: 24px; border-right: 1px solid var(--rule-soft);
  display: flex; flex-direction: column; gap: 16px;
}
@media (max-width: 820px) { .widget .panel { border-right: 0; border-bottom: 1px solid var(--rule-soft); } }
.widget .stage {
  padding: 24px;
  background:
    repeating-linear-gradient(0deg,  transparent 0 15px, var(--grid) 15px 16px),
    repeating-linear-gradient(90deg, transparent 0 15px, var(--grid) 15px 16px),
    var(--bg-sink);
  min-height: 320px;
  position: relative;
}
.widget h3 {
  font-family: var(--font-serif); font-weight: 400; font-size: 1.3rem;
  margin: 0 0 4px;
}
.widget .sub { color: var(--fg-mute); font-size: 0.94rem; margin: 0; }
.widget .ctrl { display: flex; flex-direction: column; gap: 4px; }
.widget .ctrl label {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.12em;
  color: var(--fg-dim); text-transform: uppercase;
  display: flex; justify-content: space-between;
}
.widget .ctrl label .val { color: var(--fg); font-variant-numeric: tabular-nums; }
.widget input[type="range"] { -webkit-appearance: none; appearance: none; height: 2px; background: var(--rule); outline: none; }
.widget input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 14px; height: 14px;
  background: var(--accent-a); border-radius: 50%; cursor: pointer;
}
.widget input[type="range"]::-moz-range-thumb {
  width: 14px; height: 14px; background: var(--accent-a);
  border: 0; border-radius: 50%; cursor: pointer;
}
.widget .readout {
  font-family: var(--font-mono); font-size: 11px; color: var(--fg-mute);
  padding: 10px 12px; background: var(--bg-sink); border: 1px dotted var(--rule);
}
.widget .readout b { color: var(--fg); font-weight: 400; }
.btn-row { display: flex; gap: 6px; flex-wrap: wrap; }
.btn {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.06em;
  padding: 6px 10px; border: 1px solid var(--rule);
  background: transparent; color: var(--fg-mute); cursor: pointer;
}
.btn:hover { color: var(--fg); border-color: var(--fg-mute); }
.btn.active { color: var(--bg); background: var(--fg); border-color: var(--fg); }

/* ---------- lean table ---------- */
.lean-table {
  width: 100%; border-collapse: collapse;
  font-family: var(--font-mono); font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.lean-table th, .lean-table td {
  text-align: right; padding: 10px 14px;
  border-bottom: 1px solid var(--rule-soft);
}
.lean-table th:first-child, .lean-table td:first-child { text-align: left; font-family: var(--font-serif); font-size: 15px; }
.lean-table thead th {
  font-weight: 400; font-size: 10px; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--fg-dim);
  border-bottom: 1px solid var(--rule);
}
.lean-table tbody tr:hover { background: var(--bg-rise); }
.lean-table .status-bar {
  display: flex; height: 4px; min-width: 120px; gap: 1px; margin-left: auto;
}
.lean-table .status-bar span { display: block; }
.lean-table .status-bar .p { background: var(--accent-b); }
.lean-table .status-bar .d { background: var(--accent-a); }
.lean-table .status-bar .a { background: var(--accent-c); }
.lean-table .status-bar .s { background: var(--rule); }
.lean-table tfoot td { border-top: 1px solid var(--rule); border-bottom: 0; font-weight: 600; color: var(--fg); padding-top: 14px; }
.table-scroll { overflow-x: auto; }

/* ---------- artifacts ---------- */
.artifacts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0;
  border-top: 1px solid var(--rule-soft); border-left: 1px solid var(--rule-soft); }
@media (max-width: 820px) { .artifacts { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .artifacts { grid-template-columns: 1fr; } }
.artifact {
  padding: 22px; border-right: 1px solid var(--rule-soft); border-bottom: 1px solid var(--rule-soft);
  text-decoration: none; color: inherit;
  display: flex; flex-direction: column; gap: 8px;
  background: var(--bg); transition: background 120ms;
}
.artifact:hover { background: var(--bg-rise); }
.artifact .kind { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.14em; color: var(--fg-dim); text-transform: uppercase; }
.artifact .name { font-family: var(--font-serif); font-size: 1.15rem; }
.artifact .det { font-family: var(--font-mono); font-size: 11px; color: var(--fg-mute); margin-top: auto; }

.bibtex {
  margin-top: 32px; border: 1px solid var(--rule-soft);
  background: var(--bg-sink); position: relative;
}
.bibtex pre {
  margin: 0; padding: 20px 22px; font-family: var(--font-mono);
  font-size: 12.5px; line-height: 1.6; color: var(--fg-mute);
  overflow-x: auto; white-space: pre;
}
.bibtex .copy {
  position: absolute; top: 10px; right: 10px;
  font-family: var(--font-mono); font-size: 11px;
  padding: 5px 10px; background: var(--bg); border: 1px solid var(--rule);
  color: var(--fg-mute); cursor: pointer; letter-spacing: 0.06em;
}
.bibtex .copy:hover { color: var(--fg); border-color: var(--fg-mute); }
.bibtex .copy.copied { color: var(--accent-b); border-color: var(--accent-b); }

/* ---------- footer ---------- */
footer {
  padding: 40px 0 60px;
  font-family: var(--font-mono); font-size: 11px;
  letter-spacing: 0.06em; color: var(--fg-dim);
  display: flex; gap: 24px; justify-content: space-between; flex-wrap: wrap;
}
footer a { color: var(--fg-mute); }

/* ---------- widget-specific internals ---------- */
.rope-band { stroke-width: 1; fill: none; }
.rope-band.active { stroke: var(--accent-a); stroke-width: 1.6; }
.rope-band.inactive { stroke: var(--rule); }
.rope-axis { stroke: var(--rule); stroke-width: 1; }
.rope-label { font-family: var(--font-mono); font-size: 9px; fill: var(--fg-dim); letter-spacing: 0.08em; }

.dormancy-cell { stroke: var(--bg-sink); stroke-width: 1; cursor: pointer; }
.dormancy-cell.on { fill: var(--accent-b); }
.dormancy-cell.dormant { fill: var(--bg); }
.dormancy-cell.block-zero { fill: var(--accent-c); opacity: 0.55; }

.signphase-net { stroke: var(--fg-mute); stroke-width: 1; fill: none; }
.signphase-node { stroke: var(--fg); stroke-width: 1; }
.signphase-node.pos { fill: var(--accent-a); }
.signphase-node.neg { fill: var(--bg-sink); }

/* katex sizing inside cards */
.card .katex { font-size: 0.95em; }
.katex-display { overflow-x: auto; overflow-y: hidden; padding: 2px 0; }

@media (max-width: 600px) {
  .hero .meta { flex-wrap: wrap; gap: 8px 14px; }
  .hero h1 { font-size: clamp(1.5rem, 7vw, 2.4rem); max-width: 100%; }
  .topbar .brand { font-size: 11px; }
  .topbar { gap: 12px; }
}
@media (max-width: 420px) {
  .topbar .brand { max-width: 60vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}
.artifact.pending { opacity: 0.55; pointer-events: none; cursor: default;
  border-style: dashed !important; background: transparent; }
.artifact.pending:hover { background: transparent; }
.artifact .pill { font-size: 9px; letter-spacing: 0.08em; text-transform: uppercase;
  display: inline-block; padding: 2px 6px; border: 1px solid var(--rule); border-radius: 999px;
  color: var(--fg-mute); margin-bottom: 6px; }
