/* Sumi & Rose — a warm paper surface shared by text, plates, and motion.
   The original artwork is preserved; white source paper composites into this sheet. */
:root {
  --paper: #fffefc;
  --ivory: var(--paper);
  --rose: #e5c6ba;
  --clay: #cda79a;
  --ink: #292c35;
  --heading: #34465b;
  --muted: #6b5a54;
  --indigo: #364c6a;
  --vermilion: #914f46;
  --blue: var(--vermilion);
  --gold: #9b774e;
  --line: rgba(114, 80, 65, .16);
  --wash: rgba(229, 198, 186, .10);
  --serif: Georgia, 'Times New Roman', serif;
  --sans: Inter, 'Avenir Next', 'Helvetica Neue', Arial, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { scroll-behavior: auto; background: var(--paper); }
body {
  margin: 0;
  background-color: var(--paper);
  /* Almost-white paper: only 6% of the original warm fibre texture shows. */
  background-image: linear-gradient(rgba(255,254,252,.94), rgba(255,254,252,.94)), url('assets/paper/washi.png');
  background-size: auto, 1024px 1024px;
  background-repeat: repeat;
  color: var(--ink);
  font: 16px/1.75 var(--sans);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--vermilion); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--indigo); }
a:focus-visible, button:focus-visible, summary:focus-visible, input:focus-visible {
  outline: 2px solid var(--vermilion); outline-offset: 4px;
}
::selection { background: #dfbdb1; color: #292c35; }
.progress { position: fixed; z-index: 20; inset: 0 0 auto; height: 3px; }
.progress i { display: block; width: 0; height: 100%; background: var(--vermilion); }
.masthead {
  padding: 17px clamp(22px,5vw,76px); border-bottom: 1px solid var(--line);
  display: flex; justify-content: space-between; gap: 20px; align-items: center;
  background: transparent; position: relative; z-index: 5;
}
.eyebrow, .kicker {
  font-size: .7rem; letter-spacing: .15em; text-transform: uppercase;
  color: var(--muted); font-weight: 700;
}
.kicker { color: var(--vermilion); font-size: 1.05rem; }
.masthead nav { display: flex; gap: 20px; font-size: .82rem; }
.masthead nav a { color: var(--muted); text-decoration: none; }
.cover { max-width: 1240px; margin: 0 auto; padding: 38px clamp(22px,5vw,64px) 16px; }
.cover-copy { max-width: 1050px; }
.cover h1 {
  font: 700 clamp(2rem,5.5vw,3.625rem)/1.01 var(--serif);
  color: var(--heading); letter-spacing: -.045em; margin: 12px 0 18px;
}
.dek { font: italic clamp(1.15rem,2.1vw,1.55rem)/1.4 var(--serif); max-width: 690px; color: var(--muted); margin: 0; }
.byline { color: var(--muted); font-size: .8rem; margin: 18px 0 0; }
.cover .figure { margin-top: 30px; }
.cover figcaption { max-width: 850px; margin: 0 auto; line-height: 1.65; }
.layout { display: block; max-width: 868px; margin: 0 auto; padding: 28px clamp(22px,5vw,64px) 70px; }
.toc { position: relative; margin-bottom: 48px; font-size: .78rem; }
.toc strong { font-size: .68rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.toc ol { margin: 14px 0 0; padding: 0; list-style: none; display: grid; grid-template-columns: 1fr 1fr; gap: 3px 20px; }
.toc li a { display: block; padding: 4px 0; color: var(--muted); text-decoration: none; }
.toc li a.active { color: var(--vermilion); }
.article { min-width: 0; font-size: 17px; line-height: 1.85; }
.article > h1 { font: 700 clamp(2.3rem,4vw,4.6rem)/1.03 var(--serif); letter-spacing: -.045em; margin: 0 0 30px; }
.article h2 { font: 700 clamp(1.7rem,2.8vw,2.65rem)/1.12 var(--serif); color: var(--heading); letter-spacing: -.025em; margin: 78px 0 20px; scroll-margin-top: 85px; }
.article h3 { font: 700 1.2rem/1.25 var(--serif); color: var(--heading); margin: 45px 0 8px; scroll-margin-top: 32px; }
.article p { max-width: 740px; margin: 0 0 22px; }
.article > p:first-child { font: 600 clamp(1.6rem,3vw,2.05rem)/1.35 var(--serif); letter-spacing: -.02em; margin-bottom: 24px; }
.article blockquote { margin: 32px 0; padding: 22px 25px; border-left: 2px solid var(--vermilion); background: var(--wash); font: italic 1.13rem/1.55 var(--serif); }
.article blockquote p:last-child { margin-bottom: 0; }
.article code { font: .88em ui-monospace,SFMono-Regular,Menlo,monospace; background: rgba(145,79,70,.07); padding: .14em .35em; border-radius: 3px; }
.article pre { padding: 20px; overflow: auto; border-radius: 4px; background: rgba(52,70,91,.065); border: 1px solid var(--line); color: var(--ink); }
.article pre code { background: none; padding: 0; }
.article ul, .article ol { padding-left: 1.3em; }
.article table { width: 100%; border-collapse: collapse; margin: 28px 0; font-size: .9rem; }
.article th, .article td { padding: 11px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.article th { color: var(--muted); font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; }
.article details { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 16px 0; margin: 28px 0; }
.article summary { cursor: pointer; color: var(--vermilion); font-weight: 600; }
.article details[open] summary { margin-bottom: 20px; }
.figure { margin: 46px 0 58px; padding: 0; background: transparent; border: 0; box-shadow: none; scroll-margin-top: 24px; }
.figure.breakout { --plate-width: min(1100px,calc(100vw - 48px)); width: var(--plate-width); margin-left: calc((100% - var(--plate-width)) / 2); }
/* Apply to the media group, never to captions. White maps to the paper below.
   Keep the ancestors' background transparent; isolation here would reintroduce white. */
.figure-art { mix-blend-mode: multiply; }
.figure[data-autoplay="true"] .figure-art { mix-blend-mode: normal; }
.figure[data-autoplay="true"] .static-frame { mix-blend-mode: normal; }
.figure[data-autoplay="true"] .motion-video { mix-blend-mode: normal; }
.figure-link { display: block; cursor: zoom-in; }
.figure img, .figure video { display: block; width: 100%; height: auto; }
.figure figcaption { padding: 19px 7px 4px; color: var(--muted); font-size: .82rem; }
.figure .label { display: block; color: var(--vermilion); font-size: .68rem; letter-spacing: .11em; text-transform: uppercase; font-weight: 700; margin-bottom: 5px; }
.figure figcaption a { margin-left: 4px; }
.figure .caption-takeaway { max-width: 850px; margin: 0 0 8px; line-height: 1.7; color: var(--ink); }
.figure .figure-enlarge { display: inline-block; margin: 0 0 6px; }
.figure .caption-details { margin: 8px 0 0; padding: 9px 0 0; border-top: 1px solid var(--line); border-bottom: 0; }
.figure .caption-details > summary { cursor: pointer; color: var(--muted); font-weight: 500; }
.figure .caption-details[open] > summary { margin-bottom: 10px; }
.figure .caption-settings { max-width: 1000px; line-height: 1.8; overflow-wrap: anywhere; }
.figure .caption-downloads { display: flex; flex-wrap: wrap; gap: 6px 15px; margin-top: 10px; }
.figure .caption-downloads a { margin-left: 0; }
.figure.pending { min-height: 170px; display: grid; place-items: center; border: 1px dashed var(--line); background: var(--wash); }
.motion { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 10px 7px 0; color: var(--muted); font-size: .78rem; }
.motion button { font: 600 .78rem var(--sans); border: 1px solid var(--vermilion); background: transparent; color: var(--vermilion); border-radius: 99px; padding: 7px 13px; cursor: pointer; }
.motion button:hover { background: var(--wash); }
.figure[data-autoplay="true"] .motion { margin-top: 8px; }
.motion-video[hidden], .static-frame[hidden] { display: none; }
.gif-download, .video-alternative, .source-original { white-space: nowrap; }
.demo { margin: 50px 0; padding: 25px; background: var(--wash); color: var(--ink); border: 1px solid var(--line); border-radius: 5px; }
.demo h3 { margin: 0 0 8px; font: 700 1.25rem var(--serif); }
.demo p { color: var(--muted); font-size: .86rem; margin: 0 0 16px; }
.demo svg { width: 100%; height: auto; display: block; background: rgba(255,254,252,.60); border-radius: 3px; }
.demo svg text { fill: var(--indigo); }
.demo [data-arrow], .demo [data-projection] { stroke: var(--indigo); }
.demo [data-arrow][data-sign="negative"] { stroke: var(--vermilion); }
.demo [data-vector] { stroke: var(--vermilion); }
.demo [data-point] { fill: var(--vermilion); }
.demo [data-projected-point] { fill: var(--indigo); }
.demo-controls { display: flex; align-items: center; gap: 14px; margin-top: 14px; flex-wrap: wrap; font-size: .85rem; }
.demo input[type=range] { accent-color: var(--vermilion); min-width: 120px; }
.demo output { font: 700 1rem ui-monospace,monospace; }
.math { font-family: 'KaTeX_Main',var(--serif); font-style: italic; }
.katex-display { overflow-x: auto; overflow-y: hidden; }
.article .katex-display { margin: 28px 0; padding: 18px 12px; background: rgba(205,167,154,.06); border-radius: 3px; }
.article .katex-display > .katex { min-width: max-content; text-align: center; }
.article details .katex-display { background: transparent; padding-left: 0; padding-right: 0; }
.article .footnote { margin-top: 45px; border-top: 1px solid var(--line); padding-top: 24px; font-size: .85rem; line-height: 1.65; }
.site-footer { padding: 55px clamp(22px,8vw,150px); border-top: 1px solid var(--line); color: var(--muted); font-size: .82rem; }
.site-footer pre { overflow-x: auto; }
.viewer { max-width: 1700px; margin: 0 auto; padding: 32px clamp(16px,4vw,64px) 50px; }
.back-to-article { font-size: .84rem; }
.viewer-figure { margin: 28px 0 0; }
.viewer-figure figcaption { max-width: 1000px; }
@media (min-width:1000px) { .cover h1 { letter-spacing: -.04em; } .cover .dek { max-width: 1000px; } .cover { padding-top: 30px; } }
@media (max-width:850px) { .figure.breakout { --plate-width: calc(100vw - 32px); } }
@media (max-width:600px) {
  .masthead { align-items: flex-start; flex-direction: column; }
  .cover { padding-top: 28px; }
  .cover h1 { font-size: 3rem; }
  .toc ol { display: block; }
  .toc li a { white-space: normal; }
  .article { font-size: 16px; }
  .article table { display: block; overflow: auto; white-space: normal; }
  .article th, .article td { min-width: 135px; }
  .figure.breakout { --plate-width: calc(100vw - 24px); }
  .figure figcaption { font-size: .78rem; padding-left: 6px; padding-right: 6px; }
  .figure .label { font-size: .64rem; }
  .cover figcaption { padding: 12px 5px 3px; }
  .byline { max-width: 290px; line-height: 1.65; }
  .article .katex { font-size: 1.04em; }
  .article .katex-display { padding: 14px 8px; }
  .motion { gap: 8px; }
  .demo { padding: 18px; }
}
@media print {
  body { background: var(--paper); print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .progress, .motion, .masthead nav { display: none; }
  .figure { break-inside: avoid; }
}
