:root {
  --paper: #f3eee2; --paper-2: #ebe4d3; --ink: #26241f; --ink-2: #5a5648; --ink-3: #8f8a7a; --rule: #cfc7b3;
  --accent: #2f5d45; --accent-2: #9c4a34; --grid: #ded7c4;
  --serif-display: "Fraunces", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --serif: "Spectral", "Iowan Old Style", Georgia, serif;
  --mono: "IBM Plex Mono", "SFMono-Regular", Menlo, Consolas, monospace;
  box-sizing: border-box; padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
html { scroll-padding-top: env(safe-area-inset-top, 0px); scroll-behavior: smooth; }
*, *::before, *::after { box-sizing: inherit; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--serif); font-weight: 300; font-size: 17px; line-height: 1.55;
  background-image: radial-gradient(circle at 20% 0%, #f8f4ea 0%, transparent 60%), radial-gradient(circle at 100% 100%, #e9e2d0 0%, transparent 50%);
  -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
b, strong { font-weight: 600; }
canvas { display: block; width: 100%; }

.masthead { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 10px 22px 12px;
  background: color-mix(in srgb, var(--paper) 90%, transparent); backdrop-filter: blur(6px); border-bottom: 1px solid var(--rule); }
.brand { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; color: var(--ink); white-space: nowrap; }
.brand img { border-radius: 3px; opacity: .9; }
.brand-title { font-family: var(--serif-display); font-size: 17px; font-variation-settings: "opsz" 24, "SOFT" 50; }
.brand-by { font-family: var(--mono); font-size: 11px; color: var(--ink-3); letter-spacing: .05em; }
.stepper { display: flex; gap: 6px; }
.stepper a { display: inline-flex; align-items: center; gap: 7px; text-decoration: none; color: var(--ink-3); font-family: var(--serif); font-size: 14px; padding: 4px 10px 4px 4px; border-radius: 999px; transition: color .2s, background .2s; }
.stepper a i { font-style: normal; font-family: var(--serif-display); font-size: 12px; width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--rule); display: inline-grid; place-items: center; transition: background .2s, color .2s, border-color .2s; }
.stepper a.on { color: var(--ink); background: color-mix(in srgb, var(--paper-2) 80%, transparent); }
.stepper a.on i, .stepper a.done i { background: var(--accent-2); color: var(--paper); border-color: var(--accent-2); }
.stepper a.done { color: var(--ink-2); }
.lang { display: flex; gap: 2px; border: 1px solid var(--rule); border-radius: 999px; padding: 2px; }
.lang button { font-family: var(--mono); font-size: 11px; letter-spacing: .06em; background: none; border: 0; color: var(--ink-3); padding: 3px 8px; border-radius: 999px; cursor: pointer; }
.lang button.on { background: var(--ink); color: var(--paper); }
.notes-toggle summary { list-style: none; cursor: pointer; font-family: var(--mono); font-size: 12.5px; letter-spacing: .04em; color: var(--accent); border: 1px solid var(--rule); border-radius: 999px; padding: 8px 14px; display: inline-block; }
.notes-toggle summary::-webkit-details-marker { display: none; }
.notes-toggle summary::before { content: "+ "; }
.notes-toggle[open] summary::before { content: "− "; }
.notes-toggle .prose { margin-top: 26px; }
.progress { position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: transparent; }
.progress i { display: block; height: 100%; width: 0; background: var(--accent-2); transition: width .15s linear; }

.plate-no { font-family: var(--mono); font-size: 12px; letter-spacing: .18em; text-transform: uppercase; color: var(--accent-2); margin: 0 0 8px; }
h1 { font-family: var(--serif-display); font-weight: 300; font-size: clamp(46px, 7vw, 92px); line-height: .95; margin: 0 0 18px; letter-spacing: -.01em; font-variation-settings: "opsz" 144, "SOFT" 50; }
h2 { font-family: var(--serif-display); font-weight: 300; font-size: clamp(34px, 4.6vw, 56px); line-height: 1.02; margin: 0 0 14px; font-variation-settings: "opsz" 96, "SOFT" 50; }
h3 { font-family: var(--serif-display); font-weight: 400; font-style: italic; font-size: 20px; margin: 0 0 10px; color: var(--ink-2); }
.deck { font-size: 19px; max-width: 46ch; margin: 0; }
.hint { font-family: var(--mono); font-size: 12px; color: var(--ink-3); margin: 14px 0 0; }

/* Plate I */
.hero { padding: 0 0 20px; }
.hero-canvas-wrap { position: relative; height: calc(100vh - 44px); min-height: 560px; max-height: 1100px; overflow: hidden; border-bottom: 1px solid var(--rule); cursor: grab; touch-action: none; }
.hero-canvas-wrap:active { cursor: grabbing; }
#c-hero { height: 100%; }
.hero-hud { position: absolute; inset: 0; pointer-events: none; display: flex; flex-direction: column; justify-content: space-between; padding: 26px 26px 18px; }
.hud-title { max-width: 520px; pointer-events: none; }
.hud-title .deck { background: color-mix(in srgb, var(--paper) 78%, transparent); padding: 6px 0; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 10px; max-width: 900px; pointer-events: auto; }
.legend button { font-family: var(--mono); font-size: 11.5px; background: color-mix(in srgb, var(--paper) 85%, transparent); border: 1px solid var(--rule); border-radius: 999px; padding: 4px 10px 4px 7px; color: var(--ink-2); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.legend button i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.legend button.on { border-color: var(--ink); color: var(--ink); }
.legend.filtered button:not(.on) { opacity: .45; }
.hero-tip, .tip { position: absolute; font-family: var(--mono); font-size: 12px; background: var(--ink); color: var(--paper); padding: 6px 9px; border-radius: 3px; pointer-events: none; opacity: 0; transition: opacity .12s; white-space: nowrap; z-index: 5; }
.hero-tip { left: 26px; bottom: 18px; }
.tip.on, .hero-tip.on { opacity: 1; }

.scroll-cue { position: absolute; right: 26px; bottom: 48px; display: flex; flex-direction: column; align-items: center; gap: 4px; text-decoration: none; color: var(--ink-2); font-family: var(--mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; pointer-events: auto; }
.scroll-cue i { width: 1px; height: 26px; background: var(--ink-2); display: block; animation: cue 1.6s ease-in-out infinite; }
@keyframes cue { 0% { transform: scaleY(.2); transform-origin: top; opacity: .2 } 50% { transform: scaleY(1); opacity: 1 } 100% { transform: scaleY(.2); transform-origin: bottom; opacity: .2 } }

.caption { font-size: 14.5px; color: var(--ink-2); max-width: 78ch; margin: 14px 22px 0; }

/* Plates */
.plate { max-width: 1240px; margin: 0 auto; padding: 90px 22px 40px; border-top: 1px solid var(--rule); }
.plate-head { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 16px 40px; align-items: end; margin-bottom: 30px; }
.plate-head .plate-no { grid-column: 1 / -1; margin: 0; }
.ornament { grid-column: 1 / -1; width: 28px; height: 28px; opacity: .55; border-radius: 3px; }
.plate-head .deck { align-self: end; }
.fig { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 40px 36px; }
.fig-cell { position: relative; min-width: 0; }
.fig-cell.wide { grid-column: 1 / -1; }
.fig-note { font-size: 13.5px; color: var(--ink-2); margin: 10px 0 0; max-width: 70ch; }
/* scrollytelling */
.scrolly { display: grid; grid-template-columns: minmax(240px, 1fr) minmax(0, 2fr); gap: 0 44px; align-items: start; }
.steps { padding: 20vh 0 30vh; }
.step { min-height: 62vh; display: flex; flex-direction: column; justify-content: center; opacity: .28; transition: opacity .3s; }
.step.on { opacity: 1; }
.step .k { font-family: var(--mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--accent-2); margin: 0 0 8px; }
.step h3 { font-style: normal; font-size: 24px; margin: 0 0 8px; color: var(--ink); line-height: 1.15; }
.step p { margin: 0; font-size: 16.5px; color: var(--ink-2); max-width: 34ch; }
.step .big { font-family: var(--serif-display); font-size: 44px; line-height: 1; color: var(--ink); margin: 0 0 8px; font-variation-settings: "opsz" 96, "SOFT" 50; }
.sticky { position: sticky; top: calc(64px + env(safe-area-inset-top, 0px)); height: calc(100vh - 90px); display: flex; flex-direction: column; justify-content: center; }
.sticky canvas { max-height: calc(100vh - 140px); }
.sticky .fig-note { margin-top: 8px; }
.findings { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin: 10px 0 0; }
.finding { border-top: 1px solid var(--ink); padding: 12px 0 0; }
.finding .v { font-family: var(--serif-display); font-size: 36px; line-height: 1; margin: 0 0 6px; font-variation-settings: "opsz" 96, "SOFT" 50; }
.finding p { margin: 0; font-size: 14.5px; color: var(--ink-2); }
.findings .lede { grid-column: 1 / -1; font-size: 18px; max-width: 70ch; margin: 6px 0 4px; }

.prose { max-width: 72ch; margin: 44px 0 0; font-size: 18px; }
.prose p { margin: 0 0 1.1em; }
.prose .n { font-family: var(--mono); font-size: .9em; background: var(--paper-2); padding: 1px 5px; border-radius: 3px; }
.methods .prose { max-width: 84ch; font-size: 15.5px; }
.methods h4 { font-family: var(--serif-display); font-style: italic; font-weight: 400; margin: 22px 0 6px; }
.foot { max-width: 1240px; margin: 40px auto 0; padding: 26px 22px 40px; border-top: 1px solid var(--rule); font-size: 13.5px; color: var(--ink-3); }
.loading { font-family: var(--mono); font-size: 12px; color: var(--ink-3); padding: 20px 22px; }

@media (max-width: 820px) {
  .plate-head, .fig, .findings { grid-template-columns: 1fr; }
  .stepper a span { display: none; }
  .masthead { gap: 8px; padding: 8px 12px 10px; }
  .lang button { padding: 3px 6px; font-size: 10px; }
  .stepper a { padding: 3px; }
  .brand-by { display: none; }
  .scrolly { grid-template-columns: 1fr; }
  .sticky { order: -1; position: sticky; top: calc(52px + env(safe-area-inset-top, 0px)); height: 46vh; background: var(--paper); z-index: 2; justify-content: flex-start; padding-top: 6px; }
  .sticky canvas { max-height: 40vh; }
  .sticky .fig-note { display: none; }
  .steps { padding: 6vh 0 20vh; }
  .step { min-height: 40vh; }
  .step h3 { font-size: 20px; } .step .big { font-size: 34px; }
  .hero-canvas-wrap { height: 78vh; min-height: 480px; }
  .hero-hud { padding: 16px; }
  .legend { max-width: 100%; gap: 5px; flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .legend button { white-space: nowrap; flex: 0 0 auto; }
  .hint { display: none; }
  .hud-title .deck { font-size: 15px; }
  .legend button { font-size: 10.5px; padding: 3px 8px 3px 6px; }
  h1 { font-size: 44px; }
  .deck { font-size: 16.5px; }
  .plate { padding-top: 60px; }
  .prose { font-size: 17px; }
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --paper: #1d1c18; --paper-2: #27251f; --ink: #ece6d6; --ink-2: #b9b2a0; --ink-3: #7f7969; --rule: #3a372e; --grid: #2f2d26; --accent: #8fb99e; --accent-2: #d08b72; color-scheme: dark; }
  :root:not([data-theme="light"]) body { background-image: none; }
}
:root[data-theme="dark"] { --paper: #1d1c18; --paper-2: #27251f; --ink: #ece6d6; --ink-2: #b9b2a0; --ink-3: #7f7969; --rule: #3a372e; --grid: #2f2d26; --accent: #8fb99e; --accent-2: #d08b72; color-scheme: dark; }
