/* MyPCBench — paper.html
 * Editorial / publication aesthetic. Source Serif body on warm cream paper,
 * Bricolage Grotesque display headings (continuity with the landing page),
 * IBM Plex Mono for numbers, captions, code, and section metadata.
 * Tufte-style margin figures on wide screens; collapses inline below 1200px. */

:root {
  /* Paper palette — aligned with office.css (Office TV show: white printer
     paper + black bold + Dunder steel blue) */
  --paper:        #FFFFFF;
  --paper-2:      #F4F4F2;
  --paper-deep:   #E8E8E5;
  --ink:          #0A0A0C;
  --ink-2:        #1A1A1D;
  --body:         #2A2A2D;
  --muted:        #7A7A78;
  --line:         #D8D6D0;
  --line-2:       #A6A39B;
  --rule:         #0A0A0C;

  --accent:       #1B4F8B;       /* Dunder steel blue */
  --accent-deep:  #0F3568;
  --highlight:    #FFE16A;
  --pass:         #1F5C2E;
  --pass-soft:    #DCEAD9;
  --fail:         #802626;
  --fail-soft:    #EFD5D5;

  --brand:    "Archivo Black","Helvetica Neue","Arial Black",sans-serif;
  --display:  "Archivo","Helvetica Neue",Arial,sans-serif;
  --serif:    "Source Serif 4","Source Serif Pro","Charter","Georgia","Times New Roman",serif;
  --sans:     "IBM Plex Sans","Helvetica Neue",Arial,sans-serif;
  --mono:     "IBM Plex Mono","SFMono-Regular",Menlo,monospace;

  --max:      1320px;
  --col:      640px;
  --leading:  1.72;

  --shadow:   0 1px 2px rgba(28,22,12,0.06), 0 8px 28px -12px rgba(28,22,12,0.18);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

html, body { background: var(--paper); }
body {
  color: var(--ink-2);
  font-family: var(--serif);
  font-size: 18px;
  line-height: var(--leading);
  font-feature-settings: "kern", "liga", "onum";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* No paper grain or vignette — clean white printer paper, like office.css */
body::before, body::after { content: none; }

img { max-width: 100%; display: block; }
hr  { border: none; border-top: 1px solid var(--line); margin: 36px 0; }
em, i { font-style: italic; }
strong, b { font-weight: 600; }
sup { font-feature-settings: "sups"; vertical-align: baseline; font-size: 0.9em; }

a { color: var(--ink); text-decoration: none; box-shadow: 0 1px 0 var(--line-2); transition: box-shadow 0.18s, color 0.18s; }
a:hover { color: var(--accent); box-shadow: 0 1px 0 var(--accent); }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ============================================================
 * Top bar — reading progress + brand chip
 * ============================================================ */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 60;
  height: 4px;
  background: linear-gradient(to right, var(--ink) var(--progress, 0%), transparent var(--progress, 0%));
  transition: background 80ms linear;
}
.brand-chip {
  position: fixed; top: 18px; left: 24px; z-index: 60;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 0;
  font-family: var(--display); font-weight: 700; font-size: 14px;
  letter-spacing: -0.005em;
  color: var(--ink);
  box-shadow: var(--shadow);
}
.brand-chip:hover { color: var(--accent); box-shadow: var(--shadow); }
.brand-chip .dot {
  width: 8px; height: 8px; background: var(--ink); border-radius: 50%;
}
.brand-chip:hover .dot { background: var(--accent); }
.brand-chip a { box-shadow: none; color: inherit; }

/* ============================================================
 * Page frame
 * ============================================================ */
.page {
  position: relative;
  max-width: var(--max);
  margin: 0 auto;
  padding: 88px 56px 96px;
  z-index: 2;
}
@media (max-width: 800px) { .page { padding: 80px 26px 72px; } }

/* ============================================================
 * Masthead
 * ============================================================ */
.masthead {
  margin-top: 16px;
  padding-bottom: 56px;
  border-bottom: 2px solid var(--rule);
}
.masthead .runninghead {
  display: flex; justify-content: space-between; align-items: baseline;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.22em;
  text-transform: uppercase; color: var(--muted); font-weight: 600;
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
  margin-bottom: 36px;
}
.masthead .runninghead span:first-child::before {
  content: "✺ "; color: var(--accent); margin-right: 4px;
}
.masthead h1 {
  font-family: var(--brand);
  font-weight: 900;
  font-size: clamp(44px, 5.8vw, 76px);
  line-height: 0.98;
  letter-spacing: -0.025em;
  color: var(--ink);
  margin: 0;
}
.masthead h1 em {
  font-style: normal;
  color: var(--ink);
}
.masthead .deck {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(20px, 2.1vw, 26px);
  line-height: 1.42;
  color: var(--body);
  margin: 22px 0 0;
  max-width: 820px;
}

.masthead .byline {
  margin-top: 36px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 32px;
  align-items: end;
  border-top: 1px solid var(--line);
  padding-top: 22px;
}
.masthead .authors {
  font-family: var(--serif);
  font-size: 18px;
  color: var(--ink);
}
.masthead .authors .au {
  font-variant: small-caps;
  letter-spacing: 0.04em;
  font-weight: 600;
}
.masthead .authors .au + .au::before { content: " · "; color: var(--muted); margin: 0 4px; font-variant: normal; }
.masthead .authors .aff {
  margin-top: 6px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.masthead .stamps {
  font-family: var(--mono); font-size: 12px;
  color: var(--muted); letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: right; line-height: 1.7;
}
.masthead .stamps .lab { color: var(--ink); font-weight: 700; }

.masthead .actions {
  margin-top: 28px;
  display: flex; flex-wrap: wrap; gap: 10px;
}
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 16px;
  font-family: var(--mono); font-size: 12px;
  letter-spacing: 0.16em; text-transform: uppercase;
  font-weight: 600;
  background: var(--ink); color: var(--paper);
  border: 1.5px solid var(--ink); border-radius: 0;
  box-shadow: none;
  text-decoration: none;
  transition: transform 0.12s, background 0.18s, color 0.18s;
}
.btn:hover { background: var(--accent); border-color: var(--accent); color: #fff; transform: translateY(-1px); box-shadow: none; }
.btn.ghost { background: transparent; color: var(--ink); }
.btn.ghost:hover { background: var(--ink); color: var(--paper); }
.btn.muted { color: var(--muted); border-color: var(--line); background: transparent; pointer-events: none; }

/* ============================================================
 * Abstract block
 * ============================================================ */
.abstract {
  margin: 56px auto 36px;
  max-width: 880px;
  padding: 32px 44px 36px;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-left: 4px solid var(--ink);
  position: relative;
}
.abstract::before {
  content: "ABSTRACT";
  position: absolute;
  top: -10px; left: 26px;
  font-family: var(--mono); font-weight: 700;
  font-size: 11px; letter-spacing: 0.22em;
  background: var(--paper);
  padding: 0 10px;
  color: var(--ink);
}
.abstract p {
  font-family: var(--serif);
  font-size: 17.5px;
  line-height: 1.65;
  color: var(--body);
  margin: 0;
}
.abstract p + p { margin-top: 14px; }
.abstract .first-letter::first-letter {
  /* small drop initial */
  font-family: var(--display);
  font-weight: 700;
  font-size: 3.4em;
  line-height: 0.92;
  float: left;
  margin: 6px 12px 0 0;
  color: var(--ink);
}

/* ============================================================
 * Body layout — three-column on desktop
 *   [TOC | text | sidenotes]
 * Below 1200px: TOC becomes a slide-in drawer; sidenotes inline.
 * ============================================================ */
.body-grid {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr) 280px;
  column-gap: 56px;
  align-items: start;
  position: relative;
}

/* ----- TOC ----- */
.toc {
  position: sticky; top: 56px;
  align-self: start;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--muted);
  padding-top: 32px;
  border-top: 1px solid var(--line);
}
.toc .lab {
  font-weight: 700; letter-spacing: 0.22em; font-size: 10px;
  color: var(--ink); margin-bottom: 14px; text-transform: uppercase;
  display: flex; align-items: center; gap: 8px;
}
.toc .lab::before { content: ""; height: 1px; flex: 1; background: var(--line); }
.toc ol {
  list-style: none; padding: 0; margin: 0;
  counter-reset: toc;
}
.toc li {
  position: relative; padding: 6px 0 6px 26px;
  border-bottom: 1px dashed var(--line);
  counter-increment: toc;
  line-height: 1.4;
}
.toc li::before {
  content: counter(toc, decimal-leading-zero);
  position: absolute; left: 0; top: 6px;
  font-size: 10px; color: var(--muted); letter-spacing: 0.04em;
}
.toc li:last-child { border-bottom: none; }
.toc a {
  color: var(--muted); box-shadow: none;
  text-transform: uppercase; letter-spacing: 0.06em;
  font-weight: 600; font-size: 11px;
}
.toc li:hover a { color: var(--ink); }
.toc li.active {
  background: linear-gradient(to right, var(--highlight) 0 4px, transparent 4px);
}
.toc li.active::before { color: var(--ink); }
.toc li.active a { color: var(--ink); }
.toc li.active::after {
  content: ""; position: absolute;
  left: -28px; top: 0; bottom: 0; width: 4px;
  background: var(--ink);
}

/* ----- Body column ----- */
.body {
  max-width: var(--col);
  width: 100%;
  padding-top: 32px;
  border-top: 1px solid var(--line);
}
.body h2 {
  font-family: var(--display);
  font-variation-settings: "opsz" 72;
  font-weight: 600;
  font-size: clamp(32px, 3.4vw, 44px);
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin: 72px 0 18px;
  position: relative;
  padding-left: 0;
}
.body h2 .secnum {
  display: block;
  font-family: var(--mono); font-size: 12px;
  font-weight: 700; letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 14px;
}
.body h2 .secnum .roman {
  display: inline-block;
  font-family: var(--display);
  font-weight: 700;
  color: var(--ink);
  font-size: 14px;
  letter-spacing: 0;
  margin-right: 10px;
  padding: 1px 6px;
  background: var(--paper-deep);
}
.body h3 {
  font-family: var(--display);
  font-weight: 600;
  font-size: 22px;
  line-height: 1.25;
  letter-spacing: -0.005em;
  color: var(--ink);
  margin: 38px 0 10px;
}
.body h4 {
  font-family: var(--mono);
  font-weight: 700; font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 28px 0 6px;
}

.body p {
  margin: 0 0 16px;
  text-indent: 0;
  hyphens: auto;
  -webkit-hyphens: auto;
}
/* First paragraph after section: drop initial */
.body section.lead > p:first-of-type::first-letter,
.body p.lead::first-letter {
  font-family: var(--display);
  font-weight: 700;
  font-size: 4.6em;
  line-height: 0.85;
  float: left;
  margin: 8px 14px 0 0;
  padding: 0 4px 0 0;
  color: var(--ink);
}
/* Indented continuation paragraphs (newspaper style) */
.body section p + p { text-indent: 1.4em; }
.body section p + p.noindent { text-indent: 0; }
.body p.paragraph-lead {
  text-indent: 0;
  margin-top: 22px;
}
.body p.paragraph-lead .runin {
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: -0.005em;
  color: var(--ink);
  margin-right: 6px;
}

.body ol, .body ul { padding-left: 22px; margin: 8px 0 18px; }
.body li { margin: 4px 0; }
.body ul.contrib { list-style: none; padding-left: 0; }
.body ul.contrib li {
  position: relative;
  padding-left: 36px;
  margin: 12px 0;
  counter-increment: contrib;
}
.body ul.contrib li::before {
  content: counter(contrib);
  position: absolute; left: 0; top: 0;
  font-family: var(--mono); font-weight: 700;
  font-size: 11px;
  color: var(--paper);
  background: var(--ink);
  width: 22px; height: 22px;
  display: inline-flex; align-items: center; justify-content: center;
  letter-spacing: 0;
}
.body ul.contrib { counter-reset: contrib; }

.body code, .body kbd {
  font-family: var(--mono);
  font-size: 0.86em;
  background: var(--paper-deep);
  padding: 1px 6px;
  border: 1px solid var(--line);
  border-radius: 0;
  color: var(--ink);
}
.body pre {
  font-family: var(--mono);
  font-size: 13px; line-height: 1.55;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--ink);
  padding: 18px 22px;
  margin: 18px 0;
  overflow-x: auto;
}

.body blockquote {
  margin: 22px 0;
  padding: 4px 0 4px 24px;
  border-left: 2px solid var(--ink);
  font-style: italic;
  color: var(--body);
}

/* Pull-quote */
.pullquote {
  margin: 36px -32px;
  padding: 22px 32px;
  font-family: var(--display);
  font-weight: 600;
  font-size: 30px;
  line-height: 1.1;
  letter-spacing: -0.015em;
  color: var(--ink);
  border-top: 2px solid var(--ink);
  border-bottom: 2px solid var(--ink);
  text-align: left;
}
.pullquote span.attrib {
  display: block;
  margin-top: 12px;
  font-family: var(--mono);
  font-style: normal;
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ----- Sidenotes column ----- */
.sidenotes {
  position: relative;
  padding-top: 32px;
  border-top: 1px solid var(--line);
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.5;
  color: var(--body);
}
.sidenote {
  margin-bottom: 28px;
  padding: 14px 16px 16px;
  background: var(--paper-2);
  border: 1px solid var(--line);
  position: relative;
  font-family: var(--sans);
}
.sidenote::before {
  content: attr(data-mark);
  position: absolute;
  top: -10px; left: 12px;
  background: var(--paper);
  padding: 0 8px;
  font-family: var(--mono);
  font-weight: 700; font-size: 10px;
  letter-spacing: 0.22em;
  color: var(--ink);
}
.sidenote.figure { padding: 0; background: transparent; border: none; }
.sidenote.figure::before { display: none; }
.sidenote.figure .img-wrap {
  border: 1px solid var(--line);
  background: #fff;
  overflow: hidden;
}
.sidenote.figure .img-wrap img { display: block; }
.sidenote.figure figcaption {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.55;
  color: var(--muted);
  letter-spacing: 0.02em;
}
.sidenote.figure figcaption .figlab {
  display: inline-block;
  font-weight: 700; color: var(--ink);
  margin-right: 6px;
  text-transform: uppercase; letter-spacing: 0.16em;
}
.sidenote.fact .num {
  font-family: var(--display);
  font-variation-settings: "opsz" 72;
  font-weight: 700;
  font-size: 38px; line-height: 1; letter-spacing: -0.02em;
  color: var(--ink);
  display: block; margin-bottom: 4px;
}
.sidenote.fact .lbl {
  font-family: var(--mono); font-size: 10px;
  letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--muted);
}
.sidenote .ref {
  font-family: var(--mono); font-size: 10px;
  letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--muted);
}

/* ============================================================
 * Big in-flow figures (full body width)
 * ============================================================ */
figure.big {
  margin: 36px -16px;
  padding: 0;
}
figure.big .img-wrap {
  border: 1px solid var(--line);
  background: #fff;
  overflow: hidden;
}
figure.big img { display: block; width: 100%; }
figure.big figcaption {
  margin-top: 12px;
  font-family: var(--mono);
  font-size: 12px; line-height: 1.55;
  color: var(--body);
  letter-spacing: 0.02em;
  padding: 0 6px;
}
figure.big figcaption .figlab {
  display: inline-block;
  font-weight: 700; color: var(--ink);
  margin-right: 8px;
  text-transform: uppercase; letter-spacing: 0.18em;
}

/* ============================================================
 * Tables (book-style)
 * ============================================================ */
table.book {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--serif); font-size: 15px;
  margin: 22px 0;
}
table.book caption {
  caption-side: top;
  text-align: left;
  font-family: var(--mono);
  font-size: 11px; letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink);
  font-weight: 700;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--ink);
  margin-bottom: 8px;
}
table.book th, table.book td {
  text-align: left; vertical-align: top;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}
table.book thead th {
  border-bottom: 1.5px solid var(--ink);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink);
}
table.book tbody tr:hover { background: rgba(168,18,26,0.04); }
table.book td.num {
  font-family: var(--mono);
  font-feature-settings: "tnum" 1;
  text-align: right;
  white-space: nowrap;
}
table.book td.type, table.book td.model {
  font-family: var(--display);
  font-weight: 600;
  font-size: 16px;
  letter-spacing: -0.005em;
  white-space: nowrap;
}
table.book td.example {
  font-family: var(--serif);
  font-style: italic;
  color: var(--body);
}
table.book .top    { font-weight: 700; color: var(--ink); }
table.book .winner {
  font-weight: 700;
  background: linear-gradient(to bottom, transparent 0 60%, var(--highlight) 60%);
}

/* ============================================================
 * Equation block
 * ============================================================ */
.equation {
  margin: 26px auto;
  padding: 18px 20px;
  background: var(--paper-2);
  border: 1px solid var(--line);
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.4;
  position: relative;
  gap: 18px;
}
.equation .label {
  font-family: var(--mono); font-size: 11px;
  letter-spacing: 0.22em; color: var(--muted); text-transform: uppercase;
}
.equation .body-eq {
  font-family: 'Cambria Math','Latin Modern Math',var(--serif);
  text-align: center;
}
.equation .frac { display: inline-block; vertical-align: middle; text-align: center; padding: 0 6px; }
.equation .frac .top {
  display: block; padding: 0 6px;
  border-bottom: 1.2px solid var(--ink);
  font-style: italic;
}
.equation .frac .bot { display: block; padding: 2px 6px 0; font-style: italic; }
.equation .sum { font-size: 32px; vertical-align: middle; }
.equation .sub { font-size: 0.7em; vertical-align: sub; }

/* ============================================================
 * References
 * ============================================================ */
.refs {
  margin-top: 56px; padding-top: 28px;
  border-top: 2px solid var(--ink);
  font-family: var(--serif);
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--body);
  columns: 2;
  column-gap: 36px;
}
.refs h3 {
  font-family: var(--display); font-weight: 700;
  font-size: 28px; letter-spacing: -0.01em;
  margin: 0 0 18px;
  color: var(--ink);
  column-span: all;
  -webkit-column-span: all;
}
.refs ol { padding-left: 22px; margin: 0; }
.refs ol li { margin-bottom: 12px; break-inside: avoid; }
.refs ol li .a { font-variant: small-caps; letter-spacing: 0.04em; }
.refs ol li .t { font-style: italic; }
.refs ol li .v { color: var(--muted); }

/* ============================================================
 * Bibtex / Cite block
 * ============================================================ */
.cite-block {
  margin-top: 56px;
  padding-top: 28px;
  border-top: 2px solid var(--ink);
}
.cite-block h3 {
  font-family: var(--display); font-weight: 700;
  font-size: 28px; letter-spacing: -0.01em;
  margin: 0 0 12px;
}
pre.bibtex {
  font-family: var(--mono);
  font-size: 12.5px; line-height: 1.55;
  background: var(--paper-deep);
  border: 1px solid var(--line);
  padding: 18px 22px; margin: 12px 0;
  white-space: pre-wrap; word-break: break-word;
  overflow-x: auto;
}
.copy-btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--ink); color: var(--paper);
  border: 1.5px solid var(--ink);
  padding: 8px 14px;
  font-family: var(--mono); font-size: 11px;
  letter-spacing: 0.18em; text-transform: uppercase;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.copy-btn:hover { background: var(--accent); border-color: var(--accent); }
.copy-btn.copied { background: var(--pass); border-color: var(--pass); }

/* ============================================================
 * Footer
 * ============================================================ */
footer.colophon {
  margin-top: 80px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  align-items: end;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--muted);
}
footer.colophon .left .sig {
  font-family: var(--display);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin-bottom: 4px;
}
footer.colophon a { color: var(--ink); }

/* ============================================================
 * Responsive collapse — sidenotes go inline
 * ============================================================ */
@media (max-width: 1200px) {
  .body-grid { grid-template-columns: minmax(0, 1fr); column-gap: 0; }
  .toc {
    position: relative; top: auto; padding-top: 0; border: none;
    margin: 0 0 28px;
  }
  .toc ol {
    display: flex; flex-wrap: wrap; gap: 8px;
    border: 1px solid var(--line);
    padding: 12px;
    background: var(--paper-2);
  }
  .toc li {
    border-bottom: none; padding: 0 12px 0 22px;
  }
  .toc li::before { top: 0; font-size: 9px; }
  .toc li.active::after { display: none; }

  .sidenotes {
    border-top: none;
    padding-top: 0;
  }
  .sidenote {
    margin: 22px -16px;
    background: var(--paper-2);
  }
  .sidenote.figure { background: transparent; }
}
@media (max-width: 800px) {
  body { font-size: 17px; line-height: 1.65; }
  .body { max-width: 100%; }
  .pullquote { margin-left: -8px; margin-right: -8px; padding: 18px 12px; font-size: 24px; }
  figure.big { margin: 28px -8px; }
  table.book { font-size: 13.5px; }
  table.book th, table.book td { padding: 8px 9px; }
  .refs { columns: 1; }
}
