/* ============================================================
   What's in a PowerPoint file? — interactive explainer
   Design language: warm paper, ink, presentation-orange accents,
   dark "editor" panels for everything that lives inside the file.
   ============================================================ */

:root {
  --paper: #f6f1e7;
  --paper-2: #efe8d9;
  --paper-3: #e7ddc9;
  --ink: #211c14;
  --ink-soft: #6a5f4c;
  --ink-faint: #97897a;
  --line: #ddd2ba;
  --accent: #d24726;
  --accent-deep: #a83418;
  --accent-soft: #fbe9e2;
  --gold: #b98a1d;
  --steel: #27688f;
  --green: #2e7d4f;
  --shape-red: #e23b2e;

  --panel: #262017;
  --panel-2: #2e2619;
  --panel-line: #453a28;
  --panel-ink: #efe6d2;
  --panel-dim: #a2947a;
  --tk-tag: #e8b365;
  --tk-ns-p: #f08a4b;
  --tk-ns-a: #7fb6e8;
  --tk-attr: #c9b590;
  --tk-str: #a3cf8a;
  --tk-com: #8b7d63;
  --tk-punc: #8b7d63;

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Charter, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  --shadow-1: 0 1px 2px rgba(33, 28, 20, .08), 0 4px 14px rgba(33, 28, 20, .07);
  --shadow-2: 0 2px 6px rgba(33, 28, 20, .12), 0 12px 32px rgba(33, 28, 20, .14);
  --radius: 14px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background:
    radial-gradient(1200px 500px at 85% -10%, rgba(210, 71, 38, .06), transparent 60%),
    radial-gradient(900px 500px at -10% 30%, rgba(185, 138, 29, .05), transparent 60%),
    var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
}

::selection { background: rgba(210, 71, 38, .22); }

a { color: var(--accent-deep); text-underline-offset: 2px; }
a:hover { color: var(--accent); }

code, kbd {
  font-family: var(--mono);
  font-size: .86em;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: .08em .35em;
  white-space: nowrap;
}

/* ---------- progress + top bar ---------- */

#progress {
  position: fixed; inset: 0 0 auto 0; height: 3px; z-index: 60;
  background: var(--paper-3);
}
#progress-fill {
  height: 100%; width: 0;
  background: linear-gradient(90deg, var(--gold), var(--accent));
  transition: width .45s cubic-bezier(.22, .8, .3, 1);
}

.topbar {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1240px; margin: 0 auto; padding: 10px 24px;
  display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap;
}
.brand { display: flex; align-items: baseline; gap: 10px; text-decoration: none; color: var(--ink); }
.brand-mark {
  font-family: var(--sans); font-weight: 800; font-size: 15px; letter-spacing: .02em;
  color: #fff; background: var(--accent); border-radius: 7px; padding: 3px 8px;
  box-shadow: var(--shadow-1);
}
.brand-mark em { font-style: normal; opacity: .75; font-weight: 600; }
.brand-text { font-weight: 700; font-size: 16.5px; }
.topbar-sub { color: var(--ink-soft); font-size: 13.5px; font-style: italic; }
.crumb {
  margin-left: auto; font-family: var(--mono); font-size: 12px; color: var(--ink-soft);
  background: var(--paper-2); border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px;
}
.dots { display: none; }

/* ---------- layout ---------- */

.layout {
  max-width: 1240px; margin: 0 auto; padding: 0 24px;
  display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 40px;
}

.rail { padding-top: 34px; }
.rail-sticky { position: sticky; top: 84px; }
.rail-title {
  font-family: var(--sans); font-size: 11px; font-weight: 700; letter-spacing: .14em;
  text-transform: uppercase; color: var(--ink-soft); margin: 0 0 10px 4px;
}
.rail-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  background: none; border: 0; padding: 8px 10px; margin: 0 0 2px;
  border-radius: 9px; cursor: pointer; text-align: left;
  font-family: var(--sans); font-size: 13.5px; color: var(--ink-soft);
  transition: background .18s, color .18s;
}
.rail-item:hover { background: var(--paper-2); color: var(--ink); }
.rail-item:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.rail-n {
  flex: none; width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--mono); font-size: 11px;
  background: var(--paper-2); border: 1px solid var(--line); color: var(--ink-soft);
  transition: all .18s;
}
.rail-on { color: var(--ink); font-weight: 600; background: var(--accent-soft); }
.rail-on .rail-n { background: var(--accent); border-color: var(--accent); color: #fff; }
.rail-hint { margin: 14px 4px 0; font-size: 11.5px; color: var(--ink-faint); font-family: var(--sans); }

.chapters { min-width: 0; padding: 26px 0 10px; }

.chapter { display: none; }
.chapter-on { display: block; animation: ch-in .5s cubic-bezier(.22, .8, .3, 1); }
@keyframes ch-in {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}
.chapter-inner { max-width: 940px; }

/* ---------- typography ---------- */

.kicker {
  font-family: var(--sans); font-size: 12px; font-weight: 700;
  letter-spacing: .16em; text-transform: uppercase; color: var(--accent-deep);
  margin: 0 0 8px;
}
.scene-title {
  font-size: clamp(28px, 4.2vw, 42px); line-height: 1.12; margin: 0 0 18px;
  letter-spacing: -0.01em;
}
.prose { max-width: 68ch; margin-bottom: 22px; }
.prose p { margin: 0 0 14px; }
.prose strong { color: var(--ink); }
.prose em { color: var(--accent-deep); font-style: italic; }

.callout {
  border: 1px solid var(--line); border-left: 4px solid var(--gold);
  background: var(--paper-2); border-radius: 10px;
  padding: 14px 18px; margin: 22px 0; max-width: 68ch;
  font-size: 15.5px;
}
.callout-good { border-left-color: var(--green); }

/* ---------- stage / grids ---------- */

.stage {
  background: #fffdf8;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
  padding: 18px 20px 20px;
  margin: 18px 0 26px;
}
.stage-label {
  font-family: var(--sans); font-size: 11.5px; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase; color: var(--ink-soft);
  margin-bottom: 14px; display: flex; align-items: center; gap: 8px;
}
.stage-label::before {
  content: ""; width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}

.duo {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: 18px; align-items: start;
}
.duo-folders { grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); }

/* ---------- slide canvas ---------- */

.canvas-wrap { margin-bottom: 12px; }

.slide-canvas {
  container-type: inline-size;
  position: relative;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: var(--shadow-2);
  overflow: hidden;
  width: 100%;
}
.slide-canvas::after { /* subtle screen sheen */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(160deg, rgba(255,255,255,.35), transparent 30%);
}

.sobj {
  position: absolute;
  border-radius: 3px;
  transition: box-shadow .18s, outline-color .18s;
  outline: 2px solid transparent;
  outline-offset: 2px;
}
button.sobj { border: 0; padding: 0; background: none; cursor: pointer; font: inherit; text-align: inherit; }
.sobj-hl { outline-color: var(--accent); box-shadow: 0 0 0 5px rgba(210, 71, 38, .14); z-index: 3; }

.sobj-text { display: flex; align-items: center; justify-content: center; overflow: visible; }
.sobj-txt { font-family: Arial, sans-serif; color: #111; white-space: nowrap; }
.sobj-img { width: 100%; height: 100%; object-fit: contain; display: block; }
.sobj-chart { width: 100%; height: 100%; }

.chart-svg { width: 100%; height: 100%; display: block; }
.chart-title { font: 600 11px Arial, sans-serif; text-anchor: middle; fill: #222; }
.chart-grid { stroke: #d9d9d9; stroke-width: .8; }
.chart-svg.chart-nogrid .chart-grid { display: none; }
.chart-axis { stroke: #888; stroke-width: 1.2; }
.chart-tick { font: 8px Arial, sans-serif; text-anchor: end; fill: #666; }
.chart-legend { font: 8.5px Arial, sans-serif; fill: #444; }

/* anatomy objects */
.anatomy-wrap { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, .75fr); gap: 18px; align-items: start; }
.an-obj { transition: outline-color .15s, box-shadow .15s, transform .15s; }
.an-obj:hover { outline-color: rgba(210, 71, 38, .6); }
.an-title { font: 700 4.6cqw Arial, sans-serif; color: #111; display: flex; align-items: center; }
.an-body { font: 2cqw/1.5 Arial, sans-serif; color: #222; }
.an-body ul { margin: 0; padding-left: 1.1em; }
.an-table table { width: 100%; height: 100%; border-collapse: collapse; font: 1.7cqw Arial, sans-serif; background: #fff; }
.an-table th, .an-table td { border: 1px solid #bbb; padding: .2em .5em; text-align: left; }
.an-table th { background: #444; color: #fff; }

.prop-card {
  border: 1px dashed var(--line); border-radius: 12px;
  background: var(--paper); padding: 16px 18px; min-height: 220px;
  font-family: var(--sans); font-size: 14px;
  position: sticky; top: 90px;
}
.prop-card-empty { color: var(--ink-soft); line-height: 1.6; }
.prop-card-kind {
  font-weight: 800; font-size: 12px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--accent-deep); margin-bottom: 10px;
}
.prop-list { list-style: none; margin: 0 0 12px; padding: 0; font-family: var(--mono); font-size: 12.5px; }
.prop-list li { padding: 4px 0; border-bottom: 1px dotted var(--line); overflow-wrap: anywhere; }
.prop-card-cap { color: var(--ink-soft); font-size: 13px; font-style: italic; margin: 10px 0 0; }

/* ---------- buttons & controls ---------- */

.btn {
  font-family: var(--sans); font-size: 14px; font-weight: 600;
  color: var(--ink); background: #fff;
  border: 1px solid var(--line); border-radius: 10px;
  padding: 9px 16px; cursor: pointer;
  box-shadow: var(--shadow-1);
  transition: transform .15s, box-shadow .2s, background .2s, opacity .2s;
}
.btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: var(--shadow-2); }
.btn:active:not(:disabled) { transform: translateY(0); }
.btn:disabled { opacity: .45; cursor: default; box-shadow: none; }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn-accent { background: var(--accent); border-color: var(--accent-deep); color: #fff; }
.btn-accent:hover:not(:disabled) { background: var(--accent-deep); }
.btn-mini { font-size: 12.5px; padding: 6px 12px; border-radius: 8px; }
.btn-mini-on { background: var(--ink); color: var(--paper); border-color: var(--ink); }

.controls { display: flex; flex-direction: column; gap: 10px; }
.ctl-row { display: flex; align-items: center; gap: 10px; font-family: var(--sans); font-size: 13.5px; }
.ctl-label { color: var(--ink-soft); flex: none; }
.ctl-input {
  flex: 1; font-family: var(--mono); font-size: 14px; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink);
}
.ctl-input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.ctl-hint { margin: 0; font-size: 13px; color: var(--ink-soft); font-style: italic; }

.slide-tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.slide-tab {
  font-family: var(--mono); font-size: 12px; padding: 5px 12px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--paper-2);
  color: var(--ink-soft); cursor: pointer; transition: all .18s;
}
.slide-tab:hover { border-color: var(--accent); color: var(--accent-deep); }
.slide-tab-on { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.slide-tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* switch */
.lift-bar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.switch {
  flex: none; width: 52px; height: 28px; border-radius: 999px;
  background: var(--paper-3); border: 1px solid var(--line);
  position: relative; cursor: pointer; transition: background .25s;
}
.switch-knob {
  position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%;
  background: #fff; box-shadow: var(--shadow-1);
  transition: left .25s cubic-bezier(.22, .8, .3, 1);
}
.switch-on { background: var(--accent); border-color: var(--accent-deep); }
.switch-on .switch-knob { left: 27px; }
.switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch-label { font-family: var(--sans); font-size: 14px; font-weight: 600; }
.lift-stats { display: flex; gap: 8px; flex-wrap: wrap; margin-left: auto; }
.lift-panel { max-height: 430px; overflow-y: auto; }
.lift-legend { display: flex; gap: 16px; margin-top: 12px; font-family: var(--sans); font-size: 12px; color: var(--ink-soft); }
.lg { display: inline-flex; align-items: center; gap: 6px; }
.lg::before { content: ""; width: 10px; height: 10px; border-radius: 3px; }
.lg-shared::before { background: rgba(210, 71, 38, .35); }
.lg-unique::before { background: var(--paper-3); }

.stat-chip {
  display: inline-flex; flex-direction: column; align-items: flex-start;
  background: var(--paper-2); border: 1px solid var(--line); border-radius: 10px;
  padding: 6px 12px; font-family: var(--sans);
}
.stat-v { font-weight: 800; font-size: 16px; color: var(--accent-deep); }
.stat-l { font-size: 11px; color: var(--ink-soft); letter-spacing: .04em; }

/* ---------- line panel (the .txt listing) ---------- */

.panel-scroll {
  background: var(--panel); border-radius: 12px; border: 1px solid var(--panel-line);
  box-shadow: var(--shadow-2), inset 0 1px 0 rgba(255, 255, 255, .05);
  padding: 14px 0; overflow-x: auto;
}
.file-head {
  display: flex; align-items: baseline; gap: 10px; margin-bottom: 8px;
  font-family: var(--mono);
}
.file-name { font-size: 13px; font-weight: 700; color: var(--ink); background: var(--paper-2); border: 1px solid var(--line); border-radius: 7px; padding: 3px 10px; }
.file-tag { font-size: 11.5px; color: var(--ink-soft); font-style: italic; }

.lpanel { font-family: var(--mono); font-size: 13px; line-height: 1.75; min-width: max-content; }
.lline {
  padding: 0 18px 0 calc(18px + var(--ind, 0) * 1.7em);
  color: var(--panel-ink); white-space: pre;
  border-left: 3px solid transparent;
  transition: background .15s;
}
.lline-head { color: #fff; font-weight: 700; }
.lline-subhead { color: var(--tk-tag); }
.lline-blank { min-height: .9em; }
.lline-hl { background: rgba(210, 71, 38, .22); border-left-color: var(--accent); }
.lline-shared { background: rgba(210, 71, 38, .13); }
.lline-shared:hover { background: rgba(210, 71, 38, .22); }
.lline-lifted { color: var(--tk-str); }
.lline-ellipsis { color: var(--panel-dim); }
.lline-enter { animation: ll-in .45s cubic-bezier(.22, .8, .3, 1); }
@keyframes ll-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; } }

.pk-head { color: #fff; font-weight: 700; }
.pk-key { color: var(--tk-ns-a); }
.pk-eq { color: var(--tk-punc); }
.pk-val { color: var(--panel-ink); }
.pk-str { color: var(--tk-str); }
.pk-com { color: var(--tk-com); font-style: italic; }

.rep-bar { margin-top: 12px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.rep-bar-on { border-top: 1px dashed var(--line); padding-top: 12px; }
.rep-note { flex-basis: 100%; margin: 4px 0 0; font-size: 13.5px; color: var(--ink-soft); font-family: var(--sans); }

/* ---------- code blocks ---------- */

.codeblock {
  margin: 0; background: var(--panel); color: var(--panel-ink);
  border: 1px solid var(--panel-line); border-radius: 12px;
  padding: 16px 18px; overflow-x: auto;
  font-family: var(--mono); font-size: 12.8px; line-height: 1.7;
  box-shadow: var(--shadow-2);
}
.tk-tag { color: var(--tk-tag); }
.tk-tag-word { color: #e8d5a0; }
.tk-ns-p { color: var(--tk-ns-p); font-weight: 600; }
.tk-ns-a { color: var(--tk-ns-a); font-weight: 600; }
.tk-attr { color: var(--tk-attr); }
.tk-str { color: var(--tk-str); }
.tk-com { color: var(--tk-com); font-style: italic; }
.tk-punc { color: var(--tk-punc); }

/* ---------- file tree ---------- */

.tree-wrap {
  background: var(--panel); border: 1px solid var(--panel-line); border-radius: 12px;
  padding: 10px 8px; box-shadow: var(--shadow-2); overflow-x: auto;
  font-family: var(--mono);
}
.frow {
  display: flex; align-items: center; gap: 7px; width: 100%; min-width: max-content;
  background: none; border: 0; border-radius: 7px;
  padding: 5px 10px 5px calc(8px + var(--depth, 0) * 18px);
  color: var(--panel-ink); font: 12.5px var(--mono); text-align: left; cursor: pointer;
  transition: background .15s;
}
.frow:hover { background: rgba(255, 255, 255, .07); }
.frow:focus-visible { outline: 2px solid var(--tk-ns-a); outline-offset: -2px; }
.frow-selected { background: rgba(210, 71, 38, .3); }
.frow-dim { opacity: .5; }
.frow-new { animation: ll-in .5s cubic-bezier(.22, .8, .3, 1); }
.fcaret { width: 9px; height: 9px; flex: none; fill: none; stroke: var(--panel-dim); stroke-width: 1.6; transition: transform .2s; }
.frow[aria-expanded="true"] .fcaret { transform: rotate(90deg); }
.fcaret-sp { width: 9px; flex: none; }
.fic { width: 14px; height: 14px; flex: none; fill: var(--tk-tag); }
.fic-fold { fill: none; stroke: var(--tk-tag); stroke-width: 1; }
.fic-img { fill: var(--tk-ns-a); }
.fic-sun { fill: #ffd98a; }
.fic-mtn { fill: #3f5c7a; }
.fic-xls { fill: var(--green); }
.fic-grid { fill: none; stroke: #cfe8d8; stroke-width: .9; }
.fname { flex: none; }
.fnote { color: var(--panel-dim); font-size: 11px; font-style: italic; margin-left: 8px; white-space: nowrap; }
.fkids { display: none; }
.fkids-open { display: block; }

.fviewer {
  background: #fffdf8; border: 1px solid var(--line); border-radius: 12px;
  min-height: 260px; box-shadow: var(--shadow-1); overflow: hidden;
  display: flex; flex-direction: column;
}
.fviewer-empty {
  margin: auto; text-align: center; color: var(--ink-faint);
  font-family: var(--sans); font-size: 13.5px; padding: 40px 20px;
}
.fviewer-ic { width: 44px; height: 44px; margin-bottom: 8px; opacity: .5; }
.fviewer-head {
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
  padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--paper-2);
}
.fviewer-path { font: 700 12.5px var(--mono); color: var(--accent-deep); overflow-wrap: anywhere; }
.fviewer-note { font: italic 12px var(--sans); color: var(--ink-soft); }
.fviewer-body { flex: 1; overflow: auto; }
.fviewer-body .codeblock { border: 0; border-radius: 0; box-shadow: none; }
.fviewer-imgwrap { display: grid; place-items: center; gap: 12px; padding: 26px; }
.fviewer-imgwrap img { width: 130px; image-rendering: auto; filter: drop-shadow(0 4px 10px rgba(0,0,0,.15)); }
.fviewer-meta { font: 12px var(--sans); color: var(--ink-soft); text-align: center; }
.fviewer-stub { padding: 22px; color: var(--ink-soft); font-size: 14px; }

/* spreadsheet */
.sheet { padding: 16px; }
.sheet-chrome {
  display: flex; align-items: center; gap: 5px;
  background: #217346; border-radius: 8px 8px 0 0; padding: 7px 10px;
}
.sheet-dot { width: 9px; height: 9px; border-radius: 50%; background: rgba(255,255,255,.45); }
.sheet-tab { margin-left: 10px; font: 600 11px var(--sans); color: #fff; background: rgba(255,255,255,.16); border-radius: 5px; padding: 2px 10px; }
.sheet-grid { width: 100%; border-collapse: collapse; font: 12.5px var(--mono); background: #fff; border: 1px solid #cfd8d3; }
.sheet-grid th { background: #eef3f0; color: #55685e; font-weight: 600; padding: 5px 10px; border: 1px solid #dfe7e2; font-size: 11px; }
.sheet-grid td { border: 1px solid #e3eae6; padding: 5px 10px; color: #1f3327; }
.sheet-grid .sheet-hd { background: #f6faf8; font-weight: 700; }
.sheet-corner { width: 28px; }
.sheet-cap { font: 12.5px var(--sans); color: var(--ink-soft); margin: 10px 2px 0; }

/* folder step buttons */
.folder-steps { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.btn-step { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; padding: 12px 16px; }
.step-label { font-weight: 700; }
.step-sub { font-size: 12px; font-weight: 400; color: var(--ink-soft); }
.btn-step-next { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.btn-step-done { opacity: .5; }
.btn-step-done .step-label::after { content: " ✓"; color: var(--green); }
.mini-slide-wrap { margin-top: 4px; }
.mini-cap { font: italic 13px var(--sans); color: var(--ink-soft); margin: 0 0 6px; }
.mini-slide { max-width: 340px; }

/* ---------- zip reveal ---------- */

.zipcard-wrap { display: flex; align-items: center; gap: 26px; flex-wrap: wrap; margin-bottom: 6px; }
.zipcard {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  background: var(--paper-2); border: 1px solid var(--line); border-radius: 14px;
  padding: 22px 30px 16px; box-shadow: var(--shadow-1);
  transition: transform .3s, background .3s;
}
.zipcard-zip { background: #fdf3e7; transform: rotate(-1.2deg); }
.zipcard-ic { width: 74px; }
.zc-page { fill: #fff; stroke: var(--ink-soft); stroke-width: 1.2; }
.zc-fold { fill: var(--paper-3); stroke: var(--ink-soft); stroke-width: 1; }
.zc-badge { fill: var(--accent); transition: fill .3s; }
.zipcard-zip .zc-badge { fill: var(--gold); }
.zc-ext { fill: #fff; font: 700 9.5px var(--sans); text-anchor: middle; }
.zipcard-name { font: 600 15px var(--mono); }
.zc-ext-label { color: var(--accent-deep); font-weight: 800; transition: opacity .25s, transform .25s; display: inline-block; }
.zc-morph { opacity: 0; transform: translateY(-8px); }
.zc-morph-back { opacity: 1; transform: none; }
.zipcard-size { font: 12px var(--sans); color: var(--ink-soft); }
.zip-actions { display: flex; flex-direction: column; gap: 10px; }

.zip-treezone { max-height: 0; opacity: 0; overflow: hidden; transition: max-height .7s cubic-bezier(.22,.8,.3,1), opacity .5s; }
.zip-treezone-in { max-height: 1400px; opacity: 1; margin-top: 18px; }

.map-table-wrap { overflow-x: auto; margin: 18px 0; }
.map-table { border-collapse: collapse; width: 100%; font-size: 14px; background: #fffdf8; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; box-shadow: var(--shadow-1); }
.map-table th { font: 700 11px var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-soft); text-align: left; padding: 10px 14px; background: var(--paper-2); border-bottom: 1px solid var(--line); }
.map-table td { padding: 9px 14px; border-bottom: 1px solid var(--paper-2); vertical-align: top; }
.map-table tr:last-child td { border-bottom: 0; }
.map-arrow { color: var(--accent); font-weight: 700; }
.map-note { color: var(--ink-soft); font-size: 12.5px; }
.map-dim td { color: var(--ink-soft); font-size: 13px; font-style: italic; background: var(--paper); }

/* ---------- morph viewer ---------- */

.seg-wrap { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.seg { display: inline-flex; background: var(--paper-2); border: 1px solid var(--line); border-radius: 11px; padding: 3px; gap: 3px; }
.seg-btn {
  border: 0; background: none; border-radius: 8px; padding: 7px 14px; cursor: pointer;
  font: 600 13px var(--sans); color: var(--ink-soft); transition: all .2s;
}
.seg-btn:hover { color: var(--ink); }
.seg-on { background: var(--ink); color: var(--paper); box-shadow: var(--shadow-1); }
.seg-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.morph-area { transition: all .3s; }
.morph-pane .cl { display: inline; transition: background .15s; }
.cl-hl { background: rgba(210, 71, 38, .3); border-radius: 3px; }
.morph-split { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.morph-col { min-width: 0; display: flex; flex-direction: column; }
.morph-col-label { font: 700 11px var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-soft); margin-bottom: 6px; }
.morph-col .codeblock { flex: 1; font-size: 11.6px; }
.morph-cap { margin: 12px 2px 0; font: italic 13.5px var(--sans); color: var(--ink-soft); max-width: 75ch; }

/* ---------- EMU lab ---------- */

.emu-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); gap: 18px; align-items: start; }
.emu-canvas { cursor: default; }
.ruler { position: absolute; pointer-events: none; z-index: 1; }
.ruler-top { top: 0; left: 0; right: 0; height: 16px; border-bottom: 1px dashed rgba(39, 104, 143, .35); }
.ruler-left { top: 0; left: 0; bottom: 0; width: 16px; border-right: 1px dashed rgba(39, 104, 143, .35); }
.rtick { position: absolute; font: 8.5px var(--mono); color: var(--steel); }
.ruler-top .rtick { top: 1px; transform: translateX(2px); border-left: 1px solid var(--steel); padding-left: 2px; height: 8px; }
.ruler-left .rtick { left: 1px; transform: translateY(-50%); border-top: 1px solid var(--steel); padding-top: 1px; padding-left: 2px; width: 14px; }

.emu-box {
  position: absolute; z-index: 2;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, .85);
  border: 2px dashed var(--accent); border-radius: 4px;
  cursor: grab; touch-action: none;
  transition: box-shadow .15s;
}
.emu-box:hover, .emu-box:focus-visible { box-shadow: 0 0 0 5px rgba(210, 71, 38, .18); outline: none; }
.emu-box-on { cursor: grabbing; border-style: solid; box-shadow: 0 0 0 6px rgba(210, 71, 38, .22); }
.emu-box-txt { font: 600 clamp(9px, 2.2cqw, 15px) Arial, sans-serif; color: #111; white-space: nowrap; }

.emu-readout {
  background: var(--panel); border: 1px solid var(--panel-line); border-radius: 12px;
  padding: 14px 16px; font: 12.5px var(--mono); box-shadow: var(--shadow-2);
  display: flex; flex-direction: column; gap: 8px;
}
.emu-line { display: grid; grid-template-columns: 74px 96px 1fr; gap: 8px; align-items: baseline; }
.emu-k { color: var(--tk-ns-a); }
.emu-v { color: var(--tk-str); font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.emu-u { color: var(--panel-dim); font-size: 11.5px; }
.emu-note { margin-top: 6px; padding-top: 10px; border-top: 1px dashed var(--panel-line); color: var(--panel-dim); font-size: 11.5px; font-style: italic; }
.emu-note code { background: none; border: 0; color: var(--tk-tag); padding: 0; }

.emu-conv { margin-top: 16px; }
.conv-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.conv-cell { display: flex; flex-direction: column; gap: 4px; font: 600 11.5px var(--sans); color: var(--ink-soft); letter-spacing: .06em; text-transform: uppercase; }
.conv-in {
  font: 700 16px var(--mono); padding: 9px 12px; width: 170px;
  border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.conv-in:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.conv-swap { border: 0; background: none; font: 600 12px var(--mono); color: var(--steel); cursor: default; padding: 4px 8px; }
.conv-cap { font: 13.5px var(--sans); color: var(--ink-soft); margin: 12px 0 0; max-width: 75ch; }

/* theme */
.duo-theme { background: none; border: 0; box-shadow: none; padding: 0; }
.theme-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: stretch; }
.theme-aside { display: flex; flex-direction: column; gap: 12px; justify-content: center; }
.theme-card {
  display: flex; align-items: baseline; gap: 10px;
  background: #fffdf8; border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px;
  box-shadow: var(--shadow-1);
}
.theme-tag { font: 700 12px var(--mono); color: var(--tk-ns-a); background: var(--panel); border-radius: 6px; padding: 3px 8px; }
.theme-val { font: 800 18px var(--sans); }
.theme-use { font: italic 12.5px var(--sans); color: var(--ink-soft); }
.theme-cap { font: 13.5px var(--sans); color: var(--ink-soft); margin: 4px 0 0; }

/* ---------- chapter 6 ---------- */

.timeline { margin: 20px 0 8px; border-left: 3px solid var(--line); padding-left: 0; }
.tl-item { display: flex; gap: 16px; padding: 10px 0 10px 22px; position: relative; }
.tl-item::before {
  content: ""; position: absolute; left: -8.5px; top: 16px;
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--paper); border: 3px solid var(--accent);
}
.tl-year { flex: none; width: 52px; font: 800 17px var(--mono); color: var(--accent-deep); }
.tl-body { display: flex; flex-direction: column; font: 14.5px var(--sans); }
.tl-body span { color: var(--ink-soft); font-size: 13px; }

.scale-grid { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 22px; align-items: end; }
.stack-wrap { display: flex; gap: 12px; align-items: stretch; height: 300px; }
.stack-ruler { position: relative; width: 34px; border-right: 2px solid var(--ink-soft); }
.srmark {
  position: absolute; right: 4px; transform: translateY(50%);
  font: 10.5px var(--mono); color: var(--ink-soft);
  border-top: 2px solid var(--ink-soft); padding: 1px 4px 0 0; min-width: 26px; text-align: right;
}
.stack-col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; gap: 8px; }
.paper-stack {
  width: 100%; border-radius: 4px 4px 0 0;
  background:
    repeating-linear-gradient(0deg, #fffdf8 0 2px, #e8e0cf 2px 3px);
  border: 1px solid var(--line); border-bottom: 0;
  box-shadow: var(--shadow-1);
  transition: height .35s cubic-bezier(.22, .8, .3, 1);
  min-height: 3px;
}
.stack-label { text-align: center; font: 700 13px var(--mono); color: var(--ink); }
.scale-ctl { display: flex; flex-direction: column; gap: 12px; }
.scale-slider { width: 100%; accent-color: var(--accent); height: 28px; cursor: pointer; }
.scale-presets { display: flex; gap: 8px; flex-wrap: wrap; }
.scale-readout { background: var(--panel); color: var(--panel-ink); border-radius: 12px; padding: 14px 18px; font-family: var(--sans); }
.scale-big { font: 800 34px var(--mono); color: var(--tk-str); font-variant-numeric: tabular-nums; }
.scale-unit { font: 600 14px var(--sans); color: var(--panel-dim); margin-left: 8px; }
.scale-sub { color: var(--panel-dim); font-size: 13px; margin-top: 2px; }
.scale-hit { margin-top: 8px; color: var(--tk-ns-p); font-weight: 700; font-size: 13.5px; }

.lotr { margin-top: 18px; }
.lotr-title { font: 600 13px var(--sans); color: var(--ink-soft); margin-bottom: 8px; }
.lotr-bar { display: flex; gap: 4px; }
.lotr-seg {
  flex: 1; height: 34px; border-radius: 8px;
  background: linear-gradient(180deg, #7a4a2b, #5d3820);
  display: grid; place-items: center;
  color: #f3e2c7; font: 600 11.5px var(--sans); letter-spacing: .04em;
  box-shadow: var(--shadow-1);
}
.lotr-cap { font: 13px var(--sans); color: var(--ink-soft); margin-top: 8px; }

.theories { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin: 20px 0; }
.theory {
  border-radius: var(--radius); padding: 20px 22px; font-size: 14.5px; line-height: 1.6;
  box-shadow: var(--shadow-1);
}
.theory h3 { margin: 0 0 10px; font-size: 18px; }
.theory-src { font: italic 13px var(--sans); color: var(--ink-soft); }
.theory-a { background: #fdf0ea; border: 1px solid #efc4b2; }
.theory-a h3 { color: var(--accent-deep); }
.theory-a blockquote {
  margin: 12px 0; padding: 10px 14px; border-left: 3px solid var(--accent);
  background: rgba(255,255,255,.6); border-radius: 0 8px 8px 0;
  font-size: 13.5px; color: #4d2c20;
}
.theory-b { background: #eef4f8; border: 1px solid #c3d8e5; }
.theory-b h3 { color: var(--steel); }

.takeaway {
  background: var(--ink); color: var(--paper); border-radius: var(--radius);
  padding: 26px 28px; margin: 26px 0 10px; box-shadow: var(--shadow-2);
}
.takeaway h3 { margin: 0 0 10px; font-size: 22px; color: var(--gold); }
.take-lead { font-size: 17.5px; }
.takeaway p { max-width: 70ch; }
.takeaway strong { color: #ffd9a8; }
.recap { margin-top: 16px; border-top: 1px solid rgba(246, 241, 231, .2); padding-top: 14px; }
.recap-label { font: 600 12px var(--sans); letter-spacing: .08em; text-transform: uppercase; color: rgba(246, 241, 231, .55); }
.recap-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.recap-chip {
  border: 1px solid rgba(246, 241, 231, .35); background: none; color: var(--paper);
  border-radius: 999px; padding: 6px 14px; font: 600 12.5px var(--sans); cursor: pointer;
  transition: all .18s;
}
.recap-chip:hover { background: var(--accent); border-color: var(--accent); }
.recap-chip:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* arc map (chapter 0) */
.arc-title { font: 700 13px var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-soft); margin: 26px 0 10px; }
.arc-map { display: grid; grid-template-columns: repeat(auto-fit, minmax(112px, 1fr)); gap: 8px; margin-bottom: 10px; }
.arc-step {
  display: flex; flex-direction: column; gap: 3px; align-items: flex-start;
  background: #fffdf8; border: 1px solid var(--line); border-radius: 11px;
  padding: 11px 12px; cursor: pointer; text-align: left;
  transition: transform .15s, box-shadow .2s, border-color .2s;
}
.arc-step:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); border-color: var(--accent); }
.arc-step:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.arc-n { font: 800 11px var(--mono); color: var(--accent-deep); background: var(--accent-soft); border-radius: 5px; padding: 1px 6px; }
.arc-label { font: 700 13px var(--sans); }
.arc-sub { font: italic 11px var(--sans); color: var(--ink-soft); }
.arc-now { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* reveal on scroll */
.rv { opacity: 0; transform: translateY(16px); transition: opacity .6s cubic-bezier(.22,.8,.3,1), transform .6s cubic-bezier(.22,.8,.3,1); }
.rv-in { opacity: 1; transform: none; }

/* ---------- page nav & footer ---------- */

.pagenav {
  max-width: 1240px; margin: 8px auto 0; padding: 18px 24px 26px;
  display: flex; justify-content: space-between; gap: 12px;
}
.btn-nav { min-width: 150px; }

.footer {
  border-top: 1px solid var(--line);
  padding: 22px 24px 34px; text-align: center;
  font: 13px var(--sans); color: var(--ink-soft);
}
.footer p { max-width: 70ch; margin: 0 auto; }

/* ---------- responsive ---------- */

@media (max-width: 1080px) {
  .layout { grid-template-columns: 1fr; }
  .rail { display: none; }
  .dots { display: flex; gap: 6px; justify-content: center; padding: 0 16px 10px; }
  .dot {
    width: 10px; height: 10px; border-radius: 50%; border: 1px solid var(--ink-soft);
    background: none; cursor: pointer; padding: 0; transition: all .18s;
  }
  .dot-on { background: var(--accent); border-color: var(--accent); transform: scale(1.25); }
  .dot:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
}

.duo > *, .anatomy-wrap > *, .emu-grid > *, .theme-grid > *, .scale-grid > *, .zip-treezone .duo > * { min-width: 0; }

@media (max-width: 860px) {
  body { font-size: 16px; }
  .duo, .duo-folders, .anatomy-wrap, .emu-grid, .theme-grid, .scale-grid, .theories { grid-template-columns: minmax(0, 1fr); }
  .morph-split { grid-template-columns: minmax(0, 1fr); }
  .prop-card { position: static; min-height: 0; }
  .topbar-sub { display: none; }
  .stack-wrap { height: 240px; }
  .pagenav { flex-direction: row; }
  .btn-nav { min-width: 0; flex: 1; }
  .crumb { display: none; }
  .lpanel { font-size: 11.8px; }
  .codeblock { font-size: 11.5px; }
  .map-table { font-size: 12.5px; }
}

@media (max-width: 520px) {
  .fnote { display: none; }
  .frow { min-width: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  html { scroll-behavior: auto; }
}
