/* Syx website. Plain CSS, no build step. */

:root {
  --bg: #f7f6f2;
  --bg-alt: #efede6;
  --panel: #ffffff;
  --ink: #1b1d1f;
  --ink-2: #4a4f55;
  --ink-3: #767c83;
  --rule: #d9d6cc;
  --rule-strong: #b9b5a8;
  --accent: #1f5f8b;
  --accent-ink: #164a6d;
  --accent-soft: #dde9f2;
  --warn: #8a5a12;
  --warn-soft: #f4ead8;
  --code-bg: #eceae3;
  --diagram-fill: #ffffff;
  --diagram-fill-2: #f1efe9;
  --diagram-kernel: #e4ecf2;
  --mono: ui-monospace, "SFMono-Regular", "JetBrains Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --measure: 44rem;
  --wide: 68rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121416;
    --bg-alt: #181b1e;
    --panel: #1b1f23;
    --ink: #e6e4de;
    --ink-2: #b4b2ab;
    --ink-3: #868a8f;
    --rule: #2c3136;
    --rule-strong: #3d444b;
    --accent: #79b4dd;
    --accent-ink: #9cc8e8;
    --accent-soft: #1d2f3d;
    --warn: #e0b46a;
    --warn-soft: #2d2617;
    --code-bg: #1f2327;
    --diagram-fill: #1b1f23;
    --diagram-fill-2: #20252a;
    --diagram-kernel: #1c2a35;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.6 var(--sans);
  text-rendering: optimizeLegibility;
}

a { color: var(--accent); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { color: var(--accent-ink); }

code, kbd, pre, .mono { font-family: var(--mono); font-size: 0.88em; }
code { background: var(--code-bg); padding: 0.08em 0.32em; border-radius: 3px; }
pre {
  background: var(--code-bg);
  padding: 1rem 1.1rem;
  border-radius: 4px;
  overflow-x: auto;
  line-height: 1.5;
  font-size: 0.82rem;
}
pre code { background: none; padding: 0; font-size: inherit; }

h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.2; letter-spacing: -0.005em; }
h1 { font-size: 2.6rem; margin: 0 0 0.6rem; }
h2 { font-size: 1.7rem; margin: 3.2rem 0 0.9rem; }
h3 { font-size: 1.2rem; margin: 2rem 0 0.5rem; }
p, ul, ol { margin: 0 0 1rem; }
li { margin-bottom: 0.35rem; }
hr { border: 0; border-top: 1px solid var(--rule); margin: 3rem 0; }

.wrap { max-width: var(--wide); margin: 0 auto; padding: 0 16px; }
@media (min-width: 720px) { .wrap { padding: 0 32px; } }
.prose { max-width: var(--measure); }

/* Header */
.site-header {
  border-bottom: 1px solid var(--rule);
  background: var(--bg);
}
.site-header .wrap {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; min-height: 60px; flex-wrap: wrap;
}
.brand {
  display: flex; align-items: center; gap: 0.6rem;
  font-family: var(--mono); font-weight: 600; font-size: 1.05rem;
  color: var(--ink); text-decoration: none; letter-spacing: 0.02em;
}
.brand svg { width: 26px; height: 26px; }
.nav { display: flex; gap: 1.3rem; flex-wrap: wrap; font-size: 0.95rem; }
.nav a { color: var(--ink-2); text-decoration: none; padding: 0.2rem 0; border-bottom: 1px solid transparent; }
.nav a:hover { color: var(--ink); }
.nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }

/* Hero */
.hero { padding: 4.5rem 0 3rem; border-bottom: 1px solid var(--rule); }
.hero .eyebrow {
  font-family: var(--mono); font-size: 0.8rem; color: var(--ink-3);
  text-transform: uppercase; letter-spacing: 0.12em; margin-bottom: 1.2rem;
}
.hero h1 { font-size: 2.4rem; max-width: 22ch; }
@media (min-width: 720px) { .hero h1 { font-size: 3rem; } }
.hero .lede { font-size: 1.2rem; color: var(--ink-2); max-width: 40rem; }
.question {
  margin: 2rem 0 0; padding: 1rem 1.25rem; max-width: 42rem;
  border-left: 3px solid var(--accent); background: var(--panel);
  font-family: var(--serif); font-size: 1.15rem; line-height: 1.5;
}
.status-line {
  display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 2rem;
  font-family: var(--mono); font-size: 0.78rem;
}
.tag {
  border: 1px solid var(--rule-strong); border-radius: 3px; padding: 0.15rem 0.5rem;
  color: var(--ink-2); background: var(--panel); white-space: nowrap;
}
.tag.warn { border-color: var(--warn); color: var(--warn); background: var(--warn-soft); }

/* Page header for inner pages */
.page-head { padding: 3.5rem 0 2rem; border-bottom: 1px solid var(--rule); }
.page-head p { color: var(--ink-2); font-size: 1.1rem; max-width: 42rem; margin: 0; }

/* Sections */
section { padding: 1rem 0 1rem; }
.section-label {
  font-family: var(--mono); font-size: 0.75rem; text-transform: uppercase;
  letter-spacing: 0.12em; color: var(--ink-3); margin: 3.2rem 0 -2.4rem;
}

.grid { display: grid; gap: 1px; background: var(--rule); border: 1px solid var(--rule); }
@media (min-width: 720px) { .grid.two { grid-template-columns: 1fr 1fr; } }
@media (min-width: 960px) { .grid.three { grid-template-columns: 1fr 1fr 1fr; } }
@media (min-width: 720px) and (max-width: 959px) { .grid.three { grid-template-columns: 1fr 1fr; } }
.cell { background: var(--panel); padding: 1.3rem 1.4rem 1.1rem; }
.cell h3 { margin-top: 0; font-size: 1.08rem; }
.cell p { color: var(--ink-2); font-size: 0.95rem; }
.cell p:last-child { margin-bottom: 0; }
.cell .k { font-family: var(--mono); font-size: 0.72rem; color: var(--ink-3); letter-spacing: 0.06em; display: block; margin-bottom: 0.4rem; }

/* Terminal transcript */
.term {
  background: #15181b; color: #d6d4cd; border-radius: 6px;
  font-family: var(--mono); font-size: 0.8rem; line-height: 1.55;
  padding: 0.9rem 1.1rem 1rem; overflow-x: auto; margin: 1.2rem 0 0.5rem;
  border: 1px solid #262b30;
}
.term .bar { color: #7d8288; font-size: 0.72rem; margin-bottom: 0.6rem; border-bottom: 1px solid #262b30; padding-bottom: 0.45rem; }
.term .p { color: #8fc1e3; }
.term .c { color: #7d8288; }
.term .ok { color: #9fd49a; }
.caption { font-size: 0.85rem; color: var(--ink-3); margin-top: 0.4rem; }

/* Tables */
.table-wrap { overflow-x: auto; margin: 1.2rem 0 1.5rem; border: 1px solid var(--rule); background: var(--panel); }
table { border-collapse: collapse; width: 100%; font-size: 0.92rem; }
th, td { text-align: left; padding: 0.55rem 0.85rem; border-bottom: 1px solid var(--rule); vertical-align: top; }
th { font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-3); background: var(--bg-alt); }
tr:last-child td { border-bottom: 0; }
td.mono, td code { white-space: nowrap; }

/* Figures */
figure { margin: 1.8rem 0 2rem; }
figure .fig {
  background: var(--panel); border: 1px solid var(--rule); padding: 1.2rem; overflow-x: auto;
}
figure svg { display: block; width: 100%; height: auto; min-width: 560px; color: var(--ink); }
figcaption { font-size: 0.85rem; color: var(--ink-3); margin-top: 0.55rem; max-width: var(--measure); }
svg .box { fill: var(--diagram-fill); stroke: var(--rule-strong); }
svg .box2 { fill: var(--diagram-fill-2); stroke: var(--rule-strong); }
svg .kbox { fill: var(--diagram-kernel); stroke: var(--accent); }
svg .line { stroke: var(--ink-3); fill: none; }
svg .aline { stroke: var(--accent); fill: none; }
svg .dline { stroke: var(--ink-3); fill: none; stroke-dasharray: 4 4; }
svg text { fill: var(--ink); font-family: var(--sans); font-size: 13px; }
svg text.m { font-family: var(--mono); font-size: 11.5px; fill: var(--ink-2); }
svg text.s { font-size: 11.5px; fill: var(--ink-3); }
svg text.h { font-weight: 600; }
svg text.a { fill: var(--accent); }
svg .arrowhead { fill: var(--ink-3); }
svg .arrowhead-a { fill: var(--accent); }

/* Callouts */
.note {
  border: 1px solid var(--rule); border-left: 3px solid var(--accent);
  background: var(--panel); padding: 0.9rem 1.1rem; margin: 1.5rem 0; font-size: 0.95rem;
}
.note.warn { border-left-color: var(--warn); }
.note p:last-child { margin-bottom: 0; }
.note strong:first-child { font-family: var(--mono); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em; display: block; margin-bottom: 0.3rem; color: var(--ink-3); }

/* Two-column layout with sidebar TOC on wide screens */
.doc { display: block; }
@media (min-width: 1080px) {
  .doc { display: grid; grid-template-columns: 13rem minmax(0, 1fr); gap: 3rem; }
  .toc { position: sticky; top: 1.5rem; align-self: start; }
}
.toc { font-size: 0.88rem; padding-top: 2.6rem; }
.toc ol { list-style: none; padding: 0; margin: 0; counter-reset: toc; }
.toc li { margin: 0 0 0.45rem; }
.toc a { color: var(--ink-2); text-decoration: none; }
.toc a:hover { color: var(--accent); }
.toc .k { font-family: var(--mono); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-3); margin-bottom: 0.8rem; }
@media (max-width: 1079px) { .toc { display: none; } }

/* Lists */
ul.plain { list-style: none; padding: 0; }
ul.dash { padding-left: 1.1rem; }
ul.dash li::marker { content: "\2013  "; color: var(--ink-3); }

/* ADR log */
.adr { list-style: none; padding: 0; margin: 1rem 0; border-top: 1px solid var(--rule); }
.adr li { display: grid; grid-template-columns: 3.4rem 1fr; gap: 0.8rem; padding: 0.55rem 0; border-bottom: 1px solid var(--rule); margin: 0; font-size: 0.93rem; }
.adr .n { font-family: var(--mono); color: var(--ink-3); font-size: 0.82rem; padding-top: 0.12rem; }
.adr .d { display: block; font-family: var(--mono); font-size: 0.75rem; color: var(--ink-3); }

.links { display: flex; gap: 1.2rem; flex-wrap: wrap; margin-top: 1.5rem; font-size: 0.95rem; }
.links a { text-decoration: none; border-bottom: 1px solid var(--rule-strong); }
.links a:hover { border-bottom-color: var(--accent); }

/* Footer */
.site-footer { border-top: 1px solid var(--rule); margin-top: 5rem; padding: 2rem 0 3rem; color: var(--ink-3); font-size: 0.85rem; }
.site-footer .wrap { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.site-footer a { color: var(--ink-2); }

.skip { position: absolute; left: -999px; }
.skip:focus { left: 1rem; top: 1rem; background: var(--panel); padding: 0.4rem 0.7rem; z-index: 10; }

/* Actions: one primary link, the rest as plain links */
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem 1.4rem; margin-top: 2rem; font-size: 0.98rem; }
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-family: var(--mono); font-size: 0.9rem; font-weight: 600;
  padding: 0.55rem 0.95rem; border-radius: 4px; text-decoration: none;
  background: var(--ink); color: var(--bg); border: 1px solid var(--ink);
}
.btn:hover { color: var(--bg); background: var(--accent-ink); border-color: var(--accent-ink); }
.actions a:not(.btn) { text-decoration: none; border-bottom: 1px solid var(--rule-strong); }
.actions a:not(.btn):hover { border-bottom-color: var(--accent); }

/* Proof: the result first, shown as it happened */
.proof { padding: 3rem 0 0.5rem; }
.proof h2 { margin-top: 0.4rem; }
.proof-grid { display: grid; gap: 1.2rem; margin-top: 1.4rem; }
@media (min-width: 960px) { .proof-grid { grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); align-items: start; } }
.video { background: #000; border: 1px solid #262b30; border-radius: 6px; overflow: hidden; }
.video video { display: block; width: 100%; height: auto; aspect-ratio: 720 / 400; background: #000; }
.checks { list-style: none; padding: 0; margin: 0; font-family: var(--mono); font-size: 0.8rem; }
.checks li { padding: 0.32rem 0; border-bottom: 1px solid #262b30; margin: 0; }
.checks li:last-child { border-bottom: 0; }
.term .checks li { color: #d6d4cd; }
.term .checks .ok { margin-right: 0.5rem; }
.term.tight { margin-top: 0; }

/* Central argument */
.thesis { font-family: var(--serif); font-size: 1.3rem; line-height: 1.45; max-width: 40rem; margin: 0 0 1.4rem; }
ol.steps { padding-left: 1.3rem; }
ol.steps li { margin-bottom: 0.6rem; }
ol.steps li::marker { font-family: var(--mono); font-size: 0.85em; color: var(--ink-3); }
