/* MainsKeeper Product & System Guide — shared styles
   Lattice identity (light reading theme). Brand hex only in :root. */

@font-face {
  font-family: "Sora";
  src: url("fonts/Sora-VF.woff2") format("woff2");
  font-weight: 100 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "DM Mono";
  src: url("fonts/DMMono-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "DM Mono";
  src: url("fonts/DMMono-Medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

:root, [data-theme="light"] {
  /* Six seed tokens mapped to Lattice light */
  --bg: #F4F6F8;
  --surface: #FFFFFF;
  --fg: #101418;
  --muted: #4A5865;
  --border: #CBD3DB;
  --accent: #A34D00; /* sodium deep — brand accent, not status */

  --accent-soft: color-mix(in oklch, var(--accent) 12%, transparent);
  --fg-soft: color-mix(in oklch, var(--fg) 6%, transparent);

  --mint: #0B7358;
  --sodium: #A34D00;
  --mint-soft: color-mix(in oklch, var(--mint) 12%, transparent);
  --link: #0B7358;
  --critical: #C02F2F;
  --warning: #6E6100;
  --ok: #0B7358;
  --unknown: #4F5C69;
  --connectivity: #1D66A8;
  --sync: #5747C2;
  --power-line: #56626E;
  --surface-2: #EDF0F3;
  --surface-3: #E1E6EB;
  --border-strong: #7A8691;

  --status-accepted-bg: color-mix(in oklch, var(--ok) 12%, transparent);
  --status-accepted-fg: var(--ok);
  --status-proposed-bg: color-mix(in oklch, var(--sync) 12%, transparent);
  --status-proposed-fg: var(--sync);
  --status-open-bg: color-mix(in oklch, var(--warning) 14%, transparent);
  --status-open-fg: var(--warning);
  --status-rec-bg: color-mix(in oklch, var(--connectivity) 12%, transparent);
  --status-rec-fg: var(--connectivity);

  --font-display: "Sora", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --font-body: "Sora", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --font-mono: "DM Mono", ui-monospace, Menlo, monospace;

  --fs-h1: clamp(32px, 4vw, 44px);
  --fs-h2: clamp(24px, 2.8vw, 32px);
  --fs-h3: 18px;
  --fs-lead: 18px;
  --fs-body: 15.5px;
  --fs-meta: 12.5px;

  --gap-xs: 8px;
  --gap-sm: 12px;
  --gap-md: 20px;
  --gap-lg: 32px;
  --gap-xl: 48px;
  --gap-2xl: 72px;
  --container: 1080px;
  --rail: 240px;
  --gutter: 28px;
  --radius: 8px;
  --radius-lg: 12px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: 1.6;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--fg); }
button { font: inherit; cursor: pointer; }
p { text-wrap: pretty; margin: 0 0 1em; }
h1, h2, h3, h4 { text-wrap: balance; font-family: var(--font-display); color: var(--fg); margin: 0 0 0.5em; letter-spacing: -0.02em; }
h1 { font-size: var(--fs-h1); line-height: 1.15; font-weight: 620; }
h2 { font-size: var(--fs-h2); line-height: 1.2; font-weight: 600; margin-top: 2.2em; }
h3 { font-size: var(--fs-h3); line-height: 1.35; font-weight: 600; margin-top: 1.6em; }
h4 { font-size: 15px; font-weight: 600; margin-top: 1.2em; }
ul, ol { margin: 0 0 1.2em; padding-left: 1.25em; }
li + li { margin-top: 0.35em; }
code, .mono { font-family: var(--font-mono); font-size: 0.9em; }
pre {
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.45;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  overflow-x: auto;
  margin: 0 0 1.2em;
}
table { width: 100%; border-collapse: collapse; font-size: 14px; margin: 0 0 1.4em; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); font-weight: 600; background: var(--surface-2); }
.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

.skip-link {
  position: absolute; left: -999px; top: 0; background: var(--fg); color: var(--surface); padding: 8px 12px; z-index: 100;
}
.skip-link:focus { left: 8px; top: 8px; }

.topnav {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in oklch, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.topnav-inner {
  max-width: calc(var(--container) + var(--rail) + 64px);
  margin: 0 auto;
  padding: 12px var(--gutter);
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.topnav .brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--fg); }
.topnav .brand img { height: 22px; width: auto; }
.topnav .brand-sub { font-family: var(--font-mono); font-size: 11px; color: var(--muted); letter-spacing: 0.04em; text-transform: uppercase; }
.topnav nav { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }
.topnav nav a { font-size: 13px; color: var(--muted); text-decoration: none; }
.topnav nav a:hover, .topnav nav a[aria-current="page"] { color: var(--fg); }
.topnav .edition { font-family: var(--font-mono); font-size: 11px; color: var(--muted); }

.layout {
  max-width: calc(var(--container) + var(--rail) + 64px);
  margin: 0 auto;
  padding: 0 var(--gutter);
  display: grid;
  grid-template-columns: var(--rail) minmax(0, 1fr);
  gap: 40px;
  align-items: start;
}
.rail {
  position: sticky; top: 64px;
  padding: 28px 0 48px;
  max-height: calc(100vh - 64px);
  overflow: auto;
  font-size: 13px;
}
.rail .rail-label {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin: 0 0 10px;
}
.rail ol { list-style: none; padding: 0; margin: 0 0 24px; }
.rail li { margin: 0; }
.rail a {
  display: block; padding: 6px 10px; margin: 0 -10px; border-radius: 6px;
  color: var(--muted); text-decoration: none; line-height: 1.35;
}
.rail a:hover { color: var(--fg); background: var(--surface-2); }
.rail a[aria-current="page"] { color: var(--fg); background: var(--surface); border: 1px solid var(--border); font-weight: 600; }
.rail .path-block { margin-bottom: 20px; padding: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.rail .path-block strong { display: block; font-size: 12px; margin-bottom: 6px; }

.main { padding: 32px 0 80px; min-width: 0; }
.breadcrumb { font-family: var(--font-mono); font-size: 12px; color: var(--muted); margin-bottom: 18px; }
.breadcrumb a { color: var(--muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--fg); }
.lead { font-size: var(--fs-lead); color: var(--muted); max-width: 62ch; line-height: 1.55; margin-bottom: 1.4em; }
.eyebrow {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--accent); margin: 0 0 12px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  margin: 0 0 1.2em;
}
.card-flat { background: transparent; border: 0; padding: 0; }
.callout {
  border-left: 3px solid var(--mint);
  background: var(--mint-soft);
  padding: 14px 16px;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 0 0 1.2em;
}
.callout.warn { border-left-color: var(--warning); background: var(--status-open-bg); }
.callout.open { border-left-color: var(--warning); background: var(--status-open-bg); }
.callout.proposed { border-left-color: var(--sync); background: var(--status-proposed-bg); }

.status {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-mono); font-size: 11px; font-weight: 500;
  letter-spacing: 0.03em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 999px; white-space: nowrap;
}
.status-accepted { background: var(--status-accepted-bg); color: var(--status-accepted-fg); }
.status-proposed { background: var(--status-proposed-bg); color: var(--status-proposed-fg); }
.status-open { background: var(--status-open-bg); color: var(--status-open-fg); }
.status-recommendation { background: var(--status-rec-bg); color: var(--status-rec-fg); }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 16px; border-radius: var(--radius);
  border: 1px solid transparent; font-size: 14px; font-weight: 550;
  text-decoration: none; transition: background 0.15s ease, border-color 0.15s ease;
}
.btn:focus-visible, a:focus-visible, button:focus-visible, summary:focus-visible {
  outline: 2px solid var(--sodium); outline-offset: 2px;
}
.btn-primary { background: var(--fg); color: var(--surface); }
.btn-primary:hover { background: color-mix(in oklch, var(--fg) 88%, white); color: var(--surface); }
.btn-secondary { background: transparent; color: var(--fg); border-color: var(--border-strong); }
.btn-secondary:hover { border-color: var(--fg); color: var(--fg); }
.btn-ghost { background: transparent; color: var(--fg); }
.btn-ghost:hover { color: var(--accent); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap-lg); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--gap-md); }
.grid-2-1 { display: grid; grid-template-columns: 2fr 1fr; gap: var(--gap-lg); }
@media (max-width: 920px) {
  .layout { grid-template-columns: 1fr; }
  .rail { position: static; max-height: none; border-bottom: 1px solid var(--border); padding-bottom: 16px; margin-bottom: 8px; }
  .grid-2, .grid-3, .grid-2-1 { grid-template-columns: 1fr; }
  .topnav nav .hide-sm { display: none; }
}

.figure {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin: 1.4em 0 1.6em;
}
.figure figcaption { margin-top: 12px; }
.figure .fig-title { font-weight: 600; font-size: 14px; margin: 0 0 4px; }
.figure .fig-takeaway { color: var(--muted); font-size: 13.5px; margin: 0 0 8px; }
.figure .fig-links { font-family: var(--font-mono); font-size: 11.5px; color: var(--muted); }
.figure .fig-links a { color: var(--link); }
.figure svg { width: 100%; height: auto; }

.legend {
  display: flex; flex-wrap: wrap; gap: 12px 18px;
  font-size: 12px; color: var(--muted); margin-top: 10px;
}
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i {
  width: 14px; height: 3px; border-radius: 1px; background: var(--mint); display: inline-block;
}
.legend i.powers { background: var(--power-line); }
.legend i.dashed { border-top: 2px dashed var(--unknown); background: transparent; height: 0; width: 14px; }
.legend i.box { width: 12px; height: 12px; border: 1.5px solid var(--border-strong); background: var(--surface-2); border-radius: 2px; }

details.tech {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  margin: 0 0 1.2em;
}
details.tech > summary {
  cursor: pointer; padding: 12px 14px; font-weight: 600; font-size: 14px;
  list-style: none; display: flex; align-items: center; gap: 8px;
}
details.tech > summary::-webkit-details-marker { display: none; }
details.tech > summary::before {
  content: "+"; font-family: var(--font-mono); color: var(--muted); width: 1em;
}
details.tech[open] > summary::before { content: "−"; }
details.tech .tech-body { padding: 0 14px 14px; border-top: 1px solid var(--border); }
details.tech .tech-body > :first-child { margin-top: 12px; }

.iface-card h3 { margin-top: 0; }
.iface-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 6px 12px; font-size: 14px; margin: 0 0 1em; }
.kv dt { color: var(--muted); font-family: var(--font-mono); font-size: 12px; }
.kv dd { margin: 0; }

.hub-hero { padding: 48px 0 24px; }
.hub-hero h1 { max-width: 18ch; }
.path-cards .card h3 { margin-top: 0; font-size: 16px; }
.path-cards .card p { color: var(--muted); font-size: 14px; margin-bottom: 12px; }
.chapter-list { list-style: none; padding: 0; margin: 0; }
.chapter-list li {
  display: grid; grid-template-columns: 48px 1fr auto; gap: 12px; align-items: baseline;
  padding: 14px 0; border-bottom: 1px solid var(--border);
}
.chapter-list .n { font-family: var(--font-mono); color: var(--muted); font-size: 12px; }
.chapter-list a { text-decoration: none; color: var(--fg); font-weight: 600; }
.chapter-list a:hover { color: var(--link); }
.chapter-list .desc { grid-column: 2; color: var(--muted); font-size: 13.5px; font-weight: 400; margin-top: 2px; }

.pagefoot {
  border-top: 1px solid var(--border);
  padding: 28px var(--gutter) 40px;
  max-width: calc(var(--container) + var(--rail) + 64px);
  margin: 0 auto;
  color: var(--muted); font-size: 13px;
}
.pagefoot .row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; }
.pager { display: flex; justify-content: space-between; gap: 16px; margin-top: 48px; padding-top: 24px; border-top: 1px solid var(--border); }
.pager a { text-decoration: none; color: var(--fg); font-size: 14px; }
.pager a span { display: block; font-family: var(--font-mono); font-size: 11px; color: var(--muted); margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.05em; }
.pager a:hover { color: var(--link); }

.term {
  text-decoration: underline; text-decoration-style: dotted; text-underline-offset: 3px; color: inherit;
}
.decision-row { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: start; padding: 14px 0; border-bottom: 1px solid var(--border); }
.decision-row h4 { margin: 0 0 6px; }
.decision-row p { margin: 0; color: var(--muted); font-size: 14px; }
.alt-block { margin: 8px 0 28px; }
.alt-block h2 { margin-top: 0.6em; }
.alt-block .card h3 { margin-top: 0; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.alt-block .card p:last-child { margin-bottom: 0; }
.figure img.diagram { width: 100%; height: auto; }
.check-toolbar {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px;
  margin: 0 0 8px;
}
.check-toolbar p { margin: 0; }
.check-list { list-style: none; padding: 0; margin: 0 0 1.4em; }
.check-list li { margin: 0; border-bottom: 1px solid var(--border); }
.check-list label {
  display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 12px; align-items: start;
  padding: 12px 0; min-height: 44px; cursor: pointer;
}
.check-list input { width: 18px; height: 18px; margin-top: 4px; accent-color: var(--mint); }
.check-list p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
input:focus-visible { outline: 2px solid var(--sodium); outline-offset: 2px; }

@media print {
  .topnav, .rail, .pager, .skip-link, .no-print { display: none !important; }
  .layout { display: block; max-width: none; padding: 0; }
  .main { padding: 0; }
  a { color: inherit; text-decoration: none; }
  .figure, .card, details.tech { break-inside: avoid; }
  body { font-size: 11pt; background: white; color: black; }
  h1 { font-size: 22pt; }
  h2 { font-size: 16pt; }
}
