/* Linear Group — research site
   Type: IBM Plex Sans / IBM Plex Mono
   Accent: trace red, used sparingly */

:root {
  --paper: #FCFCFB;
  --ink: #16181C;
  --muted: #5C6470;
  --faint: #E4E6E9;
  --trace: #C81F2E;
  --maxw: 680px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #131417;
    --ink: #E8E8E6;
    --muted: #9AA1AB;
    --faint: #26282D;
    --trace: #E4404F;
  }
}

/* forced themes (?theme=light|dark) — win over system pref */
html[data-theme="light"] {
  --paper: #FCFCFB;
  --ink: #16181C;
  --muted: #5C6470;
  --faint: #E4E6E9;
  --trace: #C81F2E;
  color-scheme: light;
}
html[data-theme="dark"] {
  --paper: #131417;
  --ink: #E8E8E6;
  --muted: #9AA1AB;
  --faint: #26282D;
  --trace: #E4404F;
  color-scheme: dark;
}

.themeswitch { font-size: .8rem; }
.themeswitch a { color: var(--muted); }
.themeswitch a.on { color: var(--trace); font-weight: 500; }

* { box-sizing: border-box; }

html { font-size: 17px; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "IBM Plex Sans", -apple-system, "Segoe UI", sans-serif;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 20px 80px;
}

/* ---------- header ---------- */

header.site {
  padding: 44px 0 28px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.mark { flex: none; display: block; }

.wordmark {
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: 0.01em;
  text-decoration: none;
  color: var(--ink);
}

.wordmark:hover { color: var(--trace); }

header.site .sub {
  margin-left: auto;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  color: var(--muted);
  letter-spacing: 0.04em;
}

/* ---------- intro ---------- */

.intro h1 {
  font-size: 1.9rem;
  line-height: 1.25;
  font-weight: 600;
  letter-spacing: -0.015em;
  margin: 28px 0 14px;
}

.intro p {
  color: var(--muted);
  margin: 0 0 10px;
  max-width: 56ch;
}

.intro .byline {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.78rem;
  color: var(--ink);
  margin-top: 18px;
}

.intro .byline a { color: var(--trace); text-decoration: none; }
.intro .byline a:hover { text-decoration: underline; }

/* ---------- notes ledger ---------- */

section.ledger { margin-top: 48px; }

.ledger h2 {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 6px;
}

ul.notes {
  list-style: none;
  margin: 0;
  padding: 0;
}

ul.notes li {
  border-top: 1px solid var(--faint);
  padding: 14px 0;
  display: grid;
  grid-template-columns: 84px 1fr;
  gap: 16px;
  align-items: baseline;
}

ul.notes li:last-child { border-bottom: 1px solid var(--faint); }

.notes .date {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.75rem;
  color: var(--muted);
  white-space: nowrap;
}

.notes .title a {
  color: var(--ink);
  text-decoration: none;
  font-weight: 500;
}

.notes .title a:hover { color: var(--trace); }

.notes .finding {
  display: block;
  color: var(--muted);
  font-size: 0.88rem;
  margin-top: 2px;
}

.notes .links {
  display: block;
  margin-top: 4px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
}

.notes .links a {
  color: var(--trace);
  text-decoration: none;
  margin-right: 14px;
}

.notes .links a:hover { text-decoration: underline; }

@media (max-width: 480px) {
  ul.notes li { grid-template-columns: 1fr; gap: 2px; }
}

/* ---------- provenance / about ---------- */

section.prov { margin-top: 56px; }

.prov h2 {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 12px;
}

.prov p { max-width: 58ch; margin: 0 0 12px; }
.prov a { color: var(--trace); text-decoration: none; }
.prov a:hover { text-decoration: underline; }

/* ---------- footer ---------- */

footer.site {
  margin-top: 72px;
  padding-top: 20px;
  border-top: 1px solid var(--faint);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

footer.site a { color: var(--muted); text-decoration: none; }
footer.site a:hover { color: var(--trace); }

/* ---------- note pages ---------- */

article.note h1 {
  font-size: 1.7rem;
  line-height: 1.3;
  font-weight: 600;
  letter-spacing: -0.015em;
  margin: 10px 0 6px;
}

article.note .meta {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 30px;
}

article.note .meta a { color: var(--trace); text-decoration: none; }

article.note h2 {
  font-size: 1.15rem;
  font-weight: 600;
  margin: 36px 0 10px;
}

article.note p { margin: 0 0 16px; }

article.note figure {
  margin: 28px 0;
}

article.note figure img {
  width: 100%;
  height: auto;
  border: 1px solid var(--faint);
  border-radius: 4px;
}

article.note figcaption {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 8px;
}

article.note code {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.85em;
  background: var(--faint);
  padding: 1px 5px;
  border-radius: 3px;
}

article.note pre {
  background: var(--faint);
  padding: 14px 16px;
  border-radius: 4px;
  overflow-x: auto;
  font-size: 0.82rem;
  line-height: 1.5;
}

article.note pre code { background: none; padding: 0; }

article.note a { color: var(--trace); text-decoration: none; }
article.note a:hover { text-decoration: underline; }

article.note .implications {
  border-left: 3px solid var(--trace);
  padding: 4px 0 4px 18px;
  margin: 32px 0;
}

article.note .implications h2 { margin-top: 0; }

/* accessibility */
a:focus-visible {
  outline: 2px solid var(--trace);
  outline-offset: 2px;
  border-radius: 2px;
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
