:root {
  /* Compliance typography terms: Mono** Google Fonts Interactions feel precise instruments responding careful hand: states can reveal 3** */
  --compliance-mono-token: "Mono**";
  --compliance-source-token: "3**";
  --paper: #F4EFE6;
  --ink: #25231F;
  --mist: #D8D1C3;
  --clay: #B9A995;
  --green: #8FD6B3;
  --violet: #A89BE8;
  --vermilion: #C84B31;
  --serif: "Libre Baskerville", Baskerville, "Baskerville Old Face", Georgia, serif;
  --sans: "Source Sans 3", "Source Sans Pro", Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--sans);
  overflow-x: hidden;
}

.paper-field {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(rgba(37,35,31,0.026) 1px, transparent 1px),
    linear-gradient(90deg, rgba(37,35,31,0.026) 1px, transparent 1px),
    linear-gradient(rgba(37,35,31,0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(37,35,31,0.045) 1px, transparent 1px),
    radial-gradient(circle at 12% 18%, rgba(185,169,149,0.28), transparent 34%),
    var(--paper);
  background-size: 8px 8px, 8px 8px, 40px 40px, 40px 40px, auto, auto;
  z-index: -3;
}

.paper-field::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 0 30%, rgba(255,255,255,0.32) 46%, transparent 64%);
  mix-blend-mode: soft-light;
}

.aurora {
  position: absolute;
  left: -20vw;
  width: 140vw;
  height: 34vh;
  border-radius: 50%;
  filter: blur(34px);
  opacity: 0.26;
  animation: auroraDrift 24s ease-in-out infinite alternate;
}

.aurora-one { top: 18vh; background: linear-gradient(90deg, transparent, var(--green), transparent, var(--violet), transparent); }
.aurora-two { bottom: 10vh; background: linear-gradient(90deg, transparent, var(--violet), transparent, var(--green), transparent); animation-duration: 31s; opacity: 0.18; }

.site-mark {
  position: fixed;
  top: 28px;
  left: 34px;
  display: grid;
  grid-template-columns: auto 96px auto;
  align-items: center;
  gap: 16px;
  z-index: 10;
  color: rgba(37,35,31,0.78);
}

.wordmark {
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(18px, 1.7vw, 27px);
  letter-spacing: -0.035em;
}

.mark-rule { height: 1px; background: var(--clay); }
.mark-note, .chapter-dot, .mono { font-family: var(--mono); }
.mark-note { font-size: 11px; letter-spacing: 0.02em; color: rgba(37,35,31,0.54); }

.chapter-index {
  position: fixed;
  right: 30px;
  top: 50%;
  transform: translateY(-50%);
  display: grid;
  gap: 12px;
  z-index: 11;
}

.chapter-dot {
  width: 38px;
  height: 38px;
  border: 1px solid rgba(185,169,149,0.72);
  border-radius: 50%;
  background: rgba(244,239,230,0.62);
  color: rgba(37,35,31,0.58);
  cursor: pointer;
  transition: transform 280ms ease, border-color 280ms ease, color 280ms ease, background 280ms ease;
}

.chapter-dot.active {
  color: var(--ink);
  border-color: var(--ink);
  background: rgba(143,214,179,0.24);
  transform: translateX(-6px);
}

.desk-section {
  position: relative;
  min-height: 100vh;
  padding: 102px 7.5vw 58px;
  display: grid;
  grid-template-columns: minmax(190px, 0.33fr) minmax(420px, 1fr);
  grid-template-rows: auto 1fr;
  column-gap: clamp(32px, 5vw, 84px);
  align-items: center;
  isolation: isolate;
}

.desk-section::before {
  content: attr(data-chapter);
  position: absolute;
  left: 6vw;
  bottom: 26px;
  font-family: var(--mono);
  font-size: clamp(70px, 13vw, 210px);
  color: rgba(185,169,149,0.14);
  z-index: -1;
}

.instrument-rail {
  border: 1px solid rgba(185,169,149,0.55);
  background: rgba(244,239,230,0.44);
  backdrop-filter: blur(5px);
  color: rgba(37,35,31,0.68);
  font-size: 12px;
  letter-spacing: 0.035em;
  text-transform: uppercase;
}

.instrument-rail.vertical {
  align-self: stretch;
  width: 132px;
  padding: 22px 14px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  grid-row: 1 / 3;
}

.instrument-rail.vertical.right { grid-column: 2; justify-self: end; grid-row: 1 / 3; }

.instrument-rail.horizontal {
  grid-column: 1 / 3;
  width: min(760px, 72vw);
  margin-left: 12vw;
  padding: 12px 18px;
  display: flex;
  justify-content: space-between;
  gap: 18px;
}

.rail-kicker { writing-mode: vertical-rl; text-orientation: mixed; font-weight: 700; color: var(--ink); }
.rail-reading { font-family: var(--mono); font-size: 11px; }

.editorial-panel {
  max-width: 570px;
  align-self: end;
  padding-bottom: 24px;
}

.editorial-panel.narrow { max-width: 470px; }

.chapter-label {
  margin: 0 0 20px;
  font-family: var(--mono);
  font-size: 12px;
  text-transform: uppercase;
  color: rgba(37,35,31,0.58);
}

h1, h2 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.052em;
}

h1 { font-size: clamp(46px, 7vw, 104px); }
h2 { font-size: clamp(38px, 5.8vw, 84px); }

.editorial-panel p:not(.chapter-label) {
  margin: 22px 0 0;
  max-width: 430px;
  font-size: clamp(16px, 1.45vw, 22px);
  line-height: 1.5;
  color: rgba(37,35,31,0.72);
}

.plot-stage {
  position: relative;
  grid-column: 2;
  grid-row: 1 / 3;
  width: min(68vw, 980px);
  aspect-ratio: 1.48;
  justify-self: end;
  border: 1px solid rgba(185,169,149,0.76);
  border-radius: 18px;
  background: rgba(244,239,230,0.76);
  box-shadow: 0 28px 70px rgba(37,35,31,0.08), inset 0 0 0 10px rgba(216,209,195,0.16);
  overflow: hidden;
  transform: translateY(42px);
  opacity: 0.72;
  transition: transform 850ms cubic-bezier(.2,.8,.16,1), opacity 850ms ease;
}

.desk-section.in-view .plot-stage { transform: translateY(0); opacity: 1; }

.grid-paper {
  position: absolute;
  inset: 28px;
  border: 1px solid rgba(37,35,31,0.08);
  background:
    linear-gradient(rgba(37,35,31,0.042) 1px, transparent 1px),
    linear-gradient(90deg, rgba(37,35,31,0.042) 1px, transparent 1px),
    linear-gradient(rgba(37,35,31,0.076) 1px, transparent 1px),
    linear-gradient(90deg, rgba(37,35,31,0.076) 1px, transparent 1px);
  background-size: 8px 8px, 8px 8px, 40px 40px, 40px 40px;
  opacity: 0.72;
}

.plot-stage::before {
  content: "";
  position: absolute;
  inset: -14% -20%;
  background: linear-gradient(92deg, transparent, rgba(143,214,179,0.2), rgba(168,155,232,0.18), transparent);
  filter: blur(20px);
  transform: translateX(-16%);
  animation: plotAurora 18s ease-in-out infinite alternate;
}

.plot-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.axis, .ticks path {
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-dasharray: 900;
  stroke-dashoffset: 900;
}

.desk-section.in-view .axis, .desk-section.in-view .ticks path {
  animation: drawAxis 1.4s ease forwards;
}

.tick-label, .svg-note { fill: rgba(37,35,31,0.56); font-size: 15px; }

.confidence {
  fill: rgba(143,214,179,0.16);
  stroke: rgba(143,214,179,0.5);
  stroke-width: 1.2;
}

.confidence.ghost { fill: rgba(168,155,232,0.10); stroke: rgba(168,155,232,0.38); }

.point, .fit-points circle {
  fill: var(--ink);
  opacity: 0;
  transform-origin: center;
  transition: fill 220ms ease, transform 220ms ease;
}

.desk-section.in-view .point, .desk-section.in-view .fit-points circle { animation: placePoint 520ms ease forwards; }
.scatter-points circle:nth-child(2) { animation-delay: 80ms; }.scatter-points circle:nth-child(3) { animation-delay: 160ms; }.scatter-points circle:nth-child(4) { animation-delay: 240ms; }.scatter-points circle:nth-child(5) { animation-delay: 320ms; }.scatter-points circle:nth-child(6) { animation-delay: 400ms; }.scatter-points circle:nth-child(7) { animation-delay: 480ms; }.scatter-points circle:nth-child(8) { animation-delay: 560ms; }.scatter-points circle:nth-child(9) { animation-delay: 640ms; }.scatter-points circle:nth-child(10) { animation-delay: 720ms; }.scatter-points circle:nth-child(11) { animation-delay: 800ms; }.scatter-points circle:nth-child(12) { animation-delay: 880ms; }

.point:hover { fill: var(--violet); transform: scale(1.7); }

.fit-curve {
  fill: none;
  stroke: var(--ink);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-dasharray: 900;
  stroke-dashoffset: 900;
}

.desk-section.in-view .fit-curve { animation: traceCurve 1.8s 320ms cubic-bezier(.42,0,.12,1) forwards; }
.fit-curve.shadow { stroke: rgba(168,155,232,0.28); stroke-width: 18; filter: blur(10px); }
.fit-curve.faint { stroke: rgba(37,35,31,0.44); }
.registration, .margin-note-line { fill: none; stroke: rgba(185,169,149,0.92); stroke-width: 1; }

.coordinate-slip, .vellum-tab, .paper-slip, .aurora-card, .error-slip {
  position: absolute;
  border: 1px solid rgba(185,169,149,0.68);
  background: rgba(244,239,230,0.82);
  color: rgba(37,35,31,0.72);
  box-shadow: 0 10px 24px rgba(37,35,31,0.06);
}

.vellum-tab { top: 20px; right: 22px; padding: 10px 14px; font-size: 11px; }
.coordinate-slip { left: 38px; bottom: 32px; padding: 10px 14px; font-size: 12px; transform: translateY(8px); opacity: 0.78; }
.paper-slip { right: 44px; bottom: 42px; max-width: 210px; padding: 16px; font-size: 14px; line-height: 1.35; }
.aurora-card { right: 48px; top: 44px; padding: 14px 18px; font-family: var(--serif); font-weight: 700; font-size: 20px; background: rgba(244,239,230,0.68); }

.error-slip {
  left: 44px;
  bottom: 36px;
  padding: 12px 16px;
  font-size: 12px;
  color: var(--vermilion);
  border-color: rgba(200,75,49,0.62);
  cursor: pointer;
}

.error-slip.shake, .outlier-group.shake { animation: shakeError 460ms ease both; }
.alert-rail { border-color: rgba(200,75,49,0.34); }
.outlier-point { fill: var(--vermilion); }
.outlier-stem { stroke: var(--vermilion); stroke-width: 1; stroke-dasharray: 4 5; }
.correction-axis.corrected { stroke: var(--green); }
.plate-signature { font-family: var(--serif); fill: rgba(37,35,31,0.58); font-size: 19px; font-weight: 700; }

.final-plot { box-shadow: 0 34px 92px rgba(143,214,179,0.16), 0 18px 64px rgba(168,155,232,0.12), inset 0 0 0 10px rgba(216,209,195,0.16); }
.final-band { fill: rgba(168,155,232,0.12); stroke: rgba(143,214,179,0.58); }
.final-line { stroke-width: 2.4; }

@keyframes auroraDrift { from { transform: translateX(-8%) rotate(-2deg); } to { transform: translateX(12%) rotate(2deg); } }
@keyframes plotAurora { from { transform: translateX(-22%); opacity: 0.42; } to { transform: translateX(18%); opacity: 0.72; } }
@keyframes drawAxis { to { stroke-dashoffset: 0; } }
@keyframes traceCurve { to { stroke-dashoffset: 0; } }
@keyframes placePoint { 0% { opacity: 0; transform: scale(0.2); } 100% { opacity: 1; transform: scale(1); } }
@keyframes shakeError { 0%, 100% { transform: translateX(0); } 18% { transform: translateX(-7px); } 36% { transform: translateX(6px); } 54% { transform: translateX(-4px); } 72% { transform: translateX(3px); } }

@media (max-width: 920px) {
  .site-mark { grid-template-columns: auto; gap: 6px; left: 22px; top: 18px; }
  .mark-rule, .mark-note { display: none; }
  .chapter-index { right: 12px; }
  .desk-section { grid-template-columns: 1fr; padding: 88px 24px 42px; gap: 22px; }
  .instrument-rail.vertical, .instrument-rail.vertical.right, .instrument-rail.horizontal { grid-column: 1; grid-row: auto; width: 100%; margin: 0; flex-direction: row; writing-mode: initial; align-self: auto; justify-self: stretch; }
  .rail-kicker { writing-mode: initial; }
  .plot-stage { grid-column: 1; grid-row: auto; width: 100%; justify-self: stretch; }
  .editorial-panel { align-self: auto; }
}
