/* Recurmind - shared styles. No external JS. Light and dark via prefers-color-scheme. */
:root {
  --bg: #f8f7f4;
  --bg-2: #f0eee9;
  --ink: #17171b;
  --ink-2: #3c3c44;
  --muted: #6b6b74;
  --rule: #dedbd3;
  --rule-2: #c9c5bb;
  --accent: #2c5a86;
  --accent-soft: rgba(44, 90, 134, .10);
  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "Cascadia Code", Consolas, monospace;
  --wrap: 1120px;
  --gutter: 24px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111114;
    --bg-2: #18181c;
    --ink: #ecebe6;
    --ink-2: #c9c8c2;
    --muted: #8f8f98;
    --rule: #2a2a30;
    --rule-2: #3a3a42;
    --accent: #93b6dc;
    --accent-soft: rgba(147, 182, 220, .12);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 16.5px/1.65 var(--sans);
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; text-decoration-color: color-mix(in srgb, var(--accent) 35%, transparent); transition: text-decoration-color .15s ease, color .15s ease; }
a:hover { text-decoration-color: currentColor; }
a:focus-visible, .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
::selection { background: var(--accent-soft); }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 12px; background: var(--bg); padding: 6px 10px; z-index: 10; }

/* Header */
.site-head { border-bottom: 1px solid var(--rule); }
.site-head .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 28px; min-height: 64px; padding-top: 12px; padding-bottom: 12px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font: 600 15px/1 var(--sans); letter-spacing: .01em; }
.brand svg { width: 20px; height: 20px; flex: none; }
.site-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 24px; font-size: 14.5px; }
.site-nav a { color: var(--muted); text-decoration: none; }
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--ink); }
.site-nav a[aria-current="page"] { box-shadow: inset 0 -1px 0 var(--ink); }
.site-nav a.talk { color: var(--ink); border: 1px solid var(--rule-2); border-radius: 999px; padding: 5px 13px; box-shadow: none; }
.site-nav a.talk:hover { border-color: var(--ink); }

/* Type */
.label {
  font: 500 11.5px/1.4 var(--mono);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
}
.label .n { color: var(--ink-2); margin-right: .9em; }
h1, h2, h3 { font-family: var(--serif); font-weight: 400; color: var(--ink); }
h1 { font-size: clamp(36px, 5.6vw, 62px); line-height: 1.06; letter-spacing: -.018em; margin: 18px 0 24px; max-width: 17ch; font-optical-sizing: auto; }
h2 { font-size: clamp(25px, 3vw, 32px); line-height: 1.15; letter-spacing: -.01em; margin: 0 0 18px; }
h3 { font-family: var(--sans); font-size: 16px; font-weight: 600; line-height: 1.35; margin: 0 0 6px; letter-spacing: -.003em; }
p { margin: 0 0 16px; }
.prose { max-width: 66ch; }
.prose p, .prose li { color: var(--ink-2); }
.prose b, .prose strong { color: var(--ink); font-weight: 600; }
.lede { font-size: clamp(18px, 2vw, 20.5px); line-height: 1.55; color: var(--ink-2); max-width: 60ch; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.num, .mono { font-family: var(--mono); font-feature-settings: "tnum"; }
code { font-family: var(--mono); font-size: .88em; background: var(--bg-2); padding: 1px 5px; border-radius: 3px; }

/* Hero */
.hero { padding: 88px 0 72px; }
.hero .meta { display: flex; flex-wrap: wrap; gap: 8px 28px; margin-top: 36px; padding-top: 18px; border-top: 1px solid var(--rule); max-width: 760px; }
.hero .meta div { min-width: 140px; }
.hero .meta dt { margin: 0 0 2px; }
.hero .meta dd { margin: 0; font-size: 14.5px; color: var(--ink-2); }

/* Sections: label column + content column */
.sec { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 9fr); gap: 16px 48px; padding: 56px 0; border-top: 1px solid var(--rule); }
.sec > .label { padding-top: 9px; }
.sec-body > :last-child { margin-bottom: 0; }

/* System cards */
.systems { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; border-top: 1px solid var(--rule); border-left: 1px solid var(--rule); }
.system { display: flex; flex-direction: column; padding: 26px 26px 24px; border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule); color: inherit; text-decoration: none; transition: background-color .2s ease; }
.system:hover { background: var(--bg-2); }
.system h3 { font: 400 28px/1.15 var(--serif); letter-spacing: -.01em; margin: 14px 0 10px; }
.system p { color: var(--ink-2); font-size: 15.5px; }
.system .more { margin-top: auto; padding-top: 10px; font-size: 14px; color: var(--accent); }

/* Results table */
.results { width: 100%; border-collapse: collapse; font-size: 15px; }
.results caption { text-align: left; padding-bottom: 12px; }
.results th, .results td { text-align: left; vertical-align: baseline; padding: 14px 16px 14px 0; border-bottom: 1px solid var(--rule); }
.results thead th { padding-top: 0; padding-bottom: 10px; border-bottom-color: var(--rule-2); }
.results td.v, .results th.v { text-align: right; padding-right: 0; white-space: nowrap; }
.results td.v { font: 500 17px/1.3 var(--mono); font-feature-settings: "tnum"; color: var(--ink); }
.results .what { color: var(--ink); font-weight: 500; }
.results .cond { display: block; color: var(--muted); font-size: 13.5px; margin-top: 2px; }
.results tbody th { font-weight: 400; }
.foot { margin-top: 14px; font-size: 13.5px; color: var(--muted); }

/* Numbered principles */
.principles { list-style: none; margin: 0; padding: 0; counter-reset: p; }
.principles li { display: grid; grid-template-columns: 44px minmax(0, 1fr); padding: 20px 0; border-top: 1px solid var(--rule); counter-increment: p; }
.principles li:last-child { border-bottom: 1px solid var(--rule); }
.principles li::before { content: counter(p, decimal-leading-zero); font: 500 12px/1.9 var(--mono); color: var(--muted); }
.principles p { margin: 0; color: var(--ink-2); }

/* Definition rows (component lists) */
.rows { margin: 0; }
.rows > div { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 5fr); gap: 4px 32px; padding: 18px 0; border-top: 1px solid var(--rule); }
.rows > div:last-child { border-bottom: 1px solid var(--rule); }
.rows dt { font-weight: 600; color: var(--ink); }
.rows dt .label { display: block; font-weight: 500; margin-top: 3px; }
.rows dd { margin: 0; color: var(--ink-2); }
.rows dd p:last-child { margin-bottom: 0; }

/* Plain ruled list */
ul.ruled { list-style: none; padding: 0; margin: 0 0 18px; }
ul.ruled li { padding: 13px 0; border-top: 1px solid var(--rule); color: var(--ink-2); }
ul.ruled li:last-child { border-bottom: 1px solid var(--rule); }

/* Status / callouts */
.status { display: inline-flex; align-items: center; gap: 8px; font: 500 11.5px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-2); border: 1px solid var(--rule-2); border-radius: 999px; padding: 6px 11px; margin-bottom: 16px; }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--muted); }
.status.open::before { background: transparent; border: 1px solid var(--muted); }
.placeholder { border: 1px dashed var(--rule-2); padding: 22px 24px; color: var(--muted); max-width: 66ch; }
.placeholder .label { display: block; margin-bottom: 6px; }

/* Bars */
.bars { margin: 6px 0 4px; max-width: 640px; }
.bar { display: grid; grid-template-columns: 96px minmax(0, 1fr) 60px; align-items: center; gap: 14px; padding: 7px 0; font-size: 14px; }
.bar .l { font-family: var(--mono); color: var(--muted); font-size: 12.5px; }
.bar .track { height: 6px; background: var(--bg-2); position: relative; }
.bar .track::after { content: ""; position: absolute; left: 50%; top: -3px; bottom: -3px; border-left: 1px dotted var(--rule-2); }
.bar .fill { height: 100%; background: var(--ink-2); }
.bar.hl .fill { background: var(--accent); }
.bar .v { text-align: right; font: 500 14px/1 var(--mono); font-feature-settings: "tnum"; }

/* Log entries */
.entries { list-style: none; margin: 0; padding: 0; }
.entries li { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 4px 24px; padding: 18px 0; border-top: 1px solid var(--rule); }
.entries li:last-child { border-bottom: 1px solid var(--rule); }
.entries time, .entries .when { font: 500 12.5px/1.9 var(--mono); color: var(--muted); }
.entries p { margin: 0; color: var(--ink-2); }
.entries .v { font-family: var(--mono); color: var(--ink); font-weight: 500; }

/* Diagram */
figure.diagram { margin: 0 0 8px; max-width: 470px; }
figure.diagram svg { display: block; width: 100%; height: auto; }
figure.diagram figcaption { margin-top: 12px; font-size: 13.5px; color: var(--muted); }
.dg-box { fill: var(--bg); stroke: var(--rule-2); stroke-width: 1; }
.dg-box.key { stroke: var(--ink-2); }
.dg-box.alt { stroke-dasharray: 4 3; }
.dg-lbl { font: 500 10.5px var(--mono); letter-spacing: .11em; fill: var(--muted); text-transform: uppercase; }
.dg-txt { font: 400 13px var(--sans); fill: var(--ink); }
.dg-edge { stroke: var(--muted); stroke-width: 1; fill: none; }
.dg-edge.dash { stroke-dasharray: 3 3; }
.dg-head { fill: var(--muted); }
.dg-note { font: 400 11px var(--mono); fill: var(--muted); }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 10px 18px; border: 1px solid var(--ink); border-radius: 999px; color: var(--ink); text-decoration: none; font-size: 14.5px; font-weight: 500; transition: background-color .15s ease, color .15s ease; }
.btn:hover { background: var(--ink); color: var(--bg); }
.btn .arr { transition: transform .15s ease; }
.btn:hover .arr { transform: translateX(2px); }
.actions { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; margin-top: 32px; }

/* Footer */
.site-foot { border-top: 1px solid var(--rule); color: var(--muted); font-size: 13.5px; margin-top: 24px; }
.site-foot .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; padding-top: 24px; padding-bottom: 36px; }
.site-foot nav { display: flex; gap: 18px; }
.site-foot nav a { color: var(--muted); text-decoration: none; }
.site-foot nav a:hover { color: var(--ink); }

@media (max-width: 820px) {
  .sec { grid-template-columns: minmax(0, 1fr); gap: 14px; padding: 44px 0; }
  .sec > .label { padding-top: 0; }
  .rows > div { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 600px) {
  :root { --gutter: 16px; }
  body { font-size: 16px; }
  .hero { padding: 52px 0 48px; }
  .systems { grid-template-columns: minmax(0, 1fr); }
  .system { padding: 22px 18px; }
  .entries li { grid-template-columns: minmax(0, 1fr); }
  .bar { grid-template-columns: 64px minmax(0, 1fr) 52px; gap: 10px; }
  .site-nav { gap: 6px 16px; }
  .results th, .results td { padding-right: 10px; }
}
