/* Carbon publications page ("Day ledger") — page stylesheet.
   Load ../tokens.css first (separate <link>). Shared Cut rules below are copied verbatim (or trimmed) from
   siliconcordat-design/prototypes/site.css: base, skip, meta, family header, menu, footer.
   Page rules (day-head, toc, paper, chapter, records) are new and use only token values plus derived layout values.
   No light theme. No Weft loom CSS. Green budget zero; --weft-link only on links that point at Weft. */

/* ---------- Base (Cut) ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 16px); }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body {
  margin: 0; background: var(--bg); color: var(--ink-2);
  font: 400 17px/1.65 var(--font-body);
  text-rendering: optimizeLegibility; -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
p { margin: 0 0 1em; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 400; color: var(--ink); margin: 0; letter-spacing: -0.012em; font-optical-sizing: auto; }
a { color: var(--link); text-decoration: underline; text-decoration-color: rgb(212 180 138 / 0.45); text-decoration-thickness: 1px; text-underline-offset: 0.22em; transition: color var(--dur-ui) var(--ease-film), text-decoration-color var(--dur-ui) var(--ease-film); }
a:hover { color: var(--link-hover); text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: 0; }
::selection { background: var(--carbon-deep); color: var(--fire-strong); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--fire); color: var(--bg); padding: 10px 14px; font: 500 0.9rem var(--font-body); text-decoration: none; border-radius: var(--radius); }
.skip:focus { top: 12px; }
.wrap { width: 100%; max-width: var(--max-landing); margin: 0 auto; padding: 0 var(--gutter); }
.wrap--ml { max-width: var(--max-ml); }
.meta { font: 500 0.75rem/1.4 var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.meta.host { text-transform: none; letter-spacing: 0.04em; } /* a host name is a URL: mono, not uppercased (Cut 3.2) */

/* External marker (Cut rule): ↗ visible, "(external site)" for AT */
.ext { display: inline-block; margin-left: 0.3em; font-family: var(--font-body); font-size: 0.85em; text-decoration: none; transition: transform var(--dur-ui) var(--ease-film); }
a:hover .ext { transform: translate(1px, -1px); }

/* ---------- Family header (Cut 5.2, solid from the start like /ml/*) ---------- */
.family-header { position: sticky; top: 0; z-index: 50; height: var(--header-h); background: rgb(10 9 8 / 0.86); border-bottom: 1px solid var(--line); }
@supports (backdrop-filter: blur(1px)) { .family-header { background: rgb(10 9 8 / 0.72); backdrop-filter: blur(10px) saturate(1.1); } }
.family-header .wrap { height: 100%; display: flex; align-items: center; gap: 8px; }
.fam { display: flex; align-items: center; gap: 4px; margin: 0; padding: 0; list-style: none; }
.fam a { position: relative; display: inline-flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 12px; color: var(--ink-2); text-decoration: none; font: 500 0.875rem/1 var(--font-body); letter-spacing: 0.01em; }
.fam a:hover { color: var(--ink); }
.fam .fam-home { padding-left: 0; margin-right: 18px; color: var(--ink); font: 500 1.125rem/1 var(--font-display); letter-spacing: 0; }
.fam .fam-home svg { width: 28px; height: 28px; }
/* Sibling host: no item is aria-current, so no fire underline / fire diamond rules are needed here. */
.weft-tick { display: inline-block; width: 6px; height: 6px; background: var(--weft-bg); outline: 1px solid var(--weft-link); outline-offset: 0; transform: rotate(45deg); transition: background var(--dur-ui); }
.fam .fam-weft:hover { color: var(--weft-link); }
.fam .fam-weft:hover .weft-tick { background: var(--weft-link); }
.header-meta { margin-left: auto; }
.menu { display: none; margin-left: auto; position: relative; }
.menu > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; min-width: 44px; padding: 0 12px; border: 1px solid var(--line-2); color: var(--ink); font: 500 0.75rem var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; border-radius: var(--radius); }
.menu > summary::-webkit-details-marker { display: none; }
.menu > summary:hover, .menu[open] > summary { border-color: var(--fire); }
.menu-panel { position: absolute; right: 0; top: calc(100% + 10px); min-width: 240px; background: var(--surface); border: 1px solid var(--line-2); padding: 6px; display: grid; }
.menu-panel a { display: flex; align-items: center; justify-content: space-between; min-height: 48px; padding: 0 14px; color: var(--ink); text-decoration: none; font: 500 1rem var(--font-body); border-bottom: 1px solid var(--line); }
.menu-panel a:last-child { border-bottom: 0; }
.menu-panel .weft-row:hover { color: var(--weft-link); }
.menu-panel .weft-row:hover .weft-tick { background: var(--weft-link); }
@media (max-width: 720px) {
  .fam li:not(:first-child) { display: none; }
  .header-meta { display: none; }
  .menu { display: block; }
}

/* ==================================================================
   Page: Day ledger
   ================================================================== */

/* ---------- Page head (not a hero) ---------- */
.day-head { padding: clamp(56px, 8vw, 104px) 0 clamp(36px, 4.5vw, 56px); border-bottom: 1px solid var(--line); }
.day-head h1 { font-size: clamp(2.75rem, 1.6rem + 4vw, 5.25rem); line-height: 0.98; font-weight: 360; letter-spacing: -0.028em; font-variation-settings: "opsz" 60; margin: 0 0 clamp(20px, 2.4vw, 28px); }
.intro { max-width: var(--max-prose); margin: 0; color: var(--ink-2); }

/* ---------- Doc grid + TOC (from /ml/principles/) ---------- */
.doc { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 8fr); gap: clamp(32px, 6vw, 80px); padding-top: clamp(40px, 5vw, 72px); padding-bottom: clamp(64px, 8vw, 120px); }
.toc { position: sticky; top: calc(var(--header-h) + 40px); align-self: start; }
.toc ol { list-style: none; margin: 14px 0 0; padding: 0; border-left: 1px solid var(--line-2); }
.toc a { display: grid; grid-template-columns: 30px 1fr; align-items: baseline; min-height: 44px; padding: 10px 0 10px 14px; color: var(--ink-2); text-decoration: none; font-size: 0.9375rem; line-height: 1.4; margin-left: -1px; border-left: 1px solid transparent; }
.toc a .n { font: 500 0.75rem var(--font-mono); color: var(--muted); }
.toc a:hover { color: var(--ink); border-left-color: var(--fire); }
.toc .toc-paper a { grid-template-columns: 1fr; color: var(--ink); font-family: var(--font-display); font-size: 1rem; line-height: 1.35; padding-bottom: 14px; }
.toc .toc-paper a .n { display: none; }

/* ---------- Featured paper: the day's specimen ---------- */
.paper {
  position: relative; background: var(--surface); border: 1px solid var(--line); border-left: 2px solid var(--carbon);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: clamp(28px, 4vw, 52px) clamp(22px, 4vw, 56px) clamp(26px, 3.4vw, 44px);
  margin-bottom: clamp(56px, 7vw, 96px); scroll-margin-top: calc(var(--header-h) + 24px);
}
.paper h2 { font-size: clamp(1.6rem, 1.2rem + 1.5vw, 2.35rem); line-height: 1.14; font-weight: 400; letter-spacing: -0.018em; font-variation-settings: "opsz" 48; max-width: 30ch; margin: 0 0 clamp(22px, 2.6vw, 32px); text-wrap: balance; }
.paper > p { max-width: var(--max-prose); color: var(--ink-2); }
.paper > p:first-of-type { color: var(--ink); }
.paper-doi { margin: clamp(22px, 2.6vw, 30px) 0 0 !important; }
.paper-doi a { display: inline-flex; align-items: center; min-height: 44px; font: 500 1rem/1.3 var(--font-mono); letter-spacing: 0.01em; overflow-wrap: anywhere; }
.paper-doi a:hover { color: var(--fire-strong); }
.credits { margin-top: clamp(18px, 2vw, 24px); padding-top: clamp(16px, 1.8vw, 20px); border-top: 1px solid var(--line-2); }
.credits p { margin: 0; font-size: 0.9375rem; line-height: 1.55; color: var(--ink-2); max-width: var(--max-prose); }
.credits p + p { margin-top: 6px; }

/* ---------- Chapters (record groups) ---------- */
.chapter { position: relative; padding-top: clamp(28px, 3vw, 36px); margin-bottom: clamp(48px, 6vw, 80px); scroll-margin-top: calc(var(--header-h) + 16px); }
.chapter:last-child { margin-bottom: 0; }
/* one carbon -> fire -> silicon hairline per chapter, fading out; no Threshold seam stub */
.chapter::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 1px; background: linear-gradient(90deg, var(--carbon) 0, var(--fire) 18%, var(--silicon) 36%, var(--line) 62%, transparent 100%); opacity: 0.8; }
.chapter__n { font: 500 0.8125rem var(--font-mono); letter-spacing: 0.1em; color: var(--fire); margin: 0 0 14px; display: flex; align-items: center; gap: 12px; }
.chapter__n::after { content: ""; width: 24px; height: 1px; background: var(--line-2); }
.chapter h2 { font-size: clamp(1.5rem, 1.25rem + 0.8vw, 1.875rem); line-height: 1.12; font-weight: 380; letter-spacing: -0.016em; font-variation-settings: "opsz" 36; margin: 0 0 clamp(8px, 1vw, 12px); }

/* ---------- Records: a ledger, uniform rows ---------- */
.records { list-style: none; margin: 0; padding: 0; }
.rec { padding: 26px 20px 24px; margin: 0 -20px; border-bottom: 1px solid var(--line); scroll-margin-top: calc(var(--header-h) + 16px); transition: background-color var(--dur-ui) var(--ease-film); border-radius: var(--radius); }
.rec:last-child { border-bottom: 0; }
.rec:hover { background-color: rgb(230 210 168 / 0.05); }
.rec h3 { font: 500 1.25rem/1.3 var(--font-body); letter-spacing: -0.005em; color: var(--ink); margin: 0 0 10px; }
.rec p { font-size: 0.975rem; line-height: 1.62; color: var(--ink-2); max-width: var(--max-prose); margin: 0 0 12px; }
.rec .rec-credit { color: var(--ink); font-size: 0.9375rem; margin-bottom: 8px; }
.rec .rec-links { display: flex; flex-wrap: wrap; align-items: center; column-gap: 2px; margin: 4px 0 0; font: 400 0.875rem/1.3 var(--font-mono); letter-spacing: 0.01em; }
.rec-links a { display: inline-flex; align-items: center; min-height: 44px; overflow-wrap: anywhere; }
.rec-links .sep { color: var(--muted); padding: 0 10px; }
.rec-links a.gh { font-family: var(--font-body); font-weight: 500; font-size: 0.9rem; }
/* GitHub-only rows: .rec-links--repo and a.repo are hooks; mono DOI-string style from .rec-links */

/* Weft-pointing links only: aqua (the single aqua in the page) */
a.to-weft { color: var(--weft-link); text-decoration-color: rgb(127 203 227 / 0.45); }
a.to-weft:hover { color: var(--weft-ink); text-decoration-color: currentColor; }

/* ---------- Footer (Cut 8.8, no humility block) ---------- */
.site-footer { padding: clamp(56px, 7vw, 88px) 0 48px; background: linear-gradient(var(--bg), var(--bg-2)); border-top: 1px solid var(--line); }
.footer-grid { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 7fr); gap: clamp(32px, 6vw, 96px); align-items: start; }
.footer-brand { display: inline-flex; align-items: center; gap: 12px; min-height: 44px; color: var(--ink); font: 500 1.25rem var(--font-display); text-decoration: none; margin-bottom: 16px; }
.footer-brand svg { width: 30px; height: 30px; }
.footer-fam, .footer-related { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.footer-fam a { display: inline-flex; align-items: center; gap: 12px; min-height: 44px; color: var(--ink-2); text-decoration: none; font-size: 0.9375rem; }
.footer-fam a:hover { color: var(--ink); }
.footer-fam .path { font: 400 0.75rem var(--font-mono); color: var(--muted); }
.footer-fam a.fam-weft:hover { color: var(--weft-link); }
.footer-related { border-top: 1px solid var(--line-2); padding-top: 12px; margin-top: 60px; }
.footer-related a { display: inline-flex; align-items: center; min-height: 44px; font-size: 0.9375rem; }
.footer-base { margin-top: 56px; padding-top: 20px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.footer-base a.source-repo { display: inline-flex; align-items: center; min-height: 44px; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .doc, .footer-grid { grid-template-columns: minmax(0, 1fr); }
  .toc { position: static; }
  .footer-related { margin-top: 0; }
}
@media (max-width: 600px) {
  body { font-size: 16px; }
  .rec { padding: 22px 0 20px; margin: 0; border-radius: 0; }
  .rec h3 { font-size: 1.1875rem; }
}

/* ---------- Motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
  a:hover .ext { transform: none; }
}
