/* ============================================================
   education.denizkarli.com
   Noir intro (home hero) + Journal paper (everything else)
   ============================================================ */

:root {
  /* noir */
  --noir: #07070a;
  --noir-fg: #f2efe8;
  --noir-muted: #8a877f;
  --lime: #d9ff5b;
  /* paper */
  --paper: #f3efe4;
  --paper-2: #ebe5d6;
  --ink: #1b1a17;
  --ink-2: #57534a;
  --rule: rgba(27, 26, 23, .18);
  --red: #a8321f;
  /* type */
  --serif: "Newsreader", Georgia, serif;
  --display: "Instrument Serif", "Newsreader", Georgia, serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --measure: 1120px;
  --ease: cubic-bezier(.2, .7, .1, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { background: var(--paper); color: var(--ink); scroll-behavior: smooth; }
body {
  font-family: var(--serif); font-size: 18px; line-height: 1.55;
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
  background: var(--paper);
  background-image: radial-gradient(rgba(27, 26, 23, .035) 1px, transparent 1px);
  background-size: 3px 3px;
}
body.home { background: var(--noir); }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
.wrap { max-width: var(--measure); margin: 0 auto; padding: 0 clamp(16px, 4vw, 40px); }
.mono { font-family: var(--mono); font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; }

/* ---------- link underline ---------- */
.ul { position: relative; }
.ul::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -2px; height: 1px; background: var(--red);
  transform: scaleX(0); transform-origin: left; transition: transform .35s cubic-bezier(.6, 0, .2, 1);
}
.ul:hover::after, .ul[aria-current="page"]::after { transform: scaleX(1); }

/* ============================================================
   HOME — fixed nav over the noir hero
   ============================================================ */
.topnav {
  position: fixed; inset: 0 0 auto 0; z-index: 20;
  display: flex; justify-content: space-between; align-items: center;
  padding: 22px clamp(16px, 4vw, 48px);
  color: #fff; mix-blend-mode: difference;
  font-family: var(--mono); font-size: 12px; letter-spacing: .06em; text-transform: uppercase;
}
.topnav { transition: background .35s, color .35s, padding .35s, border-color .35s; border-bottom: 1px solid transparent; }
.topnav.solid {
  mix-blend-mode: normal; color: var(--ink); padding-top: 14px; padding-bottom: 14px;
  background: rgba(243, 239, 228, .92); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-bottom-color: var(--rule);
}
.topnav .brand { font-family: var(--display); font-size: 24px; letter-spacing: 0; text-transform: none; }
.topnav ul { display: flex; gap: clamp(14px, 3vw, 34px); list-style: none; }
.topnav a { opacity: .8; transition: opacity .2s; }
.topnav a:hover { opacity: 1; }

.hero {
  position: sticky; top: 0; height: 100svh; min-height: 560px;
  display: grid; place-items: center; overflow: hidden;
  background: var(--noir); color: var(--noir-fg);
}
#paths { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero-inner { position: relative; text-align: center; padding: 0 16px; width: 100%; will-change: transform, opacity; }
.eyebrow { font-family: var(--mono); font-size: 12px; color: var(--noir-muted); letter-spacing: .14em; text-transform: uppercase; margin-bottom: 28px; }
.rotator {
  font-family: var(--display); font-weight: 400;
  font-size: clamp(56px, 13vw, 200px); line-height: .95; letter-spacing: -.02em;
  height: 1.05em; perspective: 900px; white-space: nowrap; width: 100%;
}
.rotator .ch { display: inline-block; transform-origin: 50% 100% -.2em; backface-visibility: hidden; }
.rotator .ch.sp { width: .25em; }
.hero .sub { margin: 30px auto 0; color: var(--noir-muted); font-family: var(--serif); font-size: clamp(15px, 1.6vw, 18px); max-width: 560px; line-height: 1.6; }
.hero .corner { position: absolute; bottom: 28px; font-family: var(--mono); font-size: 12px; color: var(--noir-muted); }
.hero .corner.l { left: clamp(16px, 4vw, 48px); }
.hero .corner.r { right: clamp(16px, 4vw, 48px); }
.hero .corner.r::after {
  content: ""; display: inline-block; width: 1px; height: 28px; background: var(--noir-muted);
  margin-left: 10px; vertical-align: middle; animation: drip 2s ease-in-out infinite; transform-origin: top;
}
@keyframes drip { 0% { transform: scaleY(0) } 50% { transform: scaleY(1) } 100% { transform: scaleY(0); transform-origin: bottom } }

/* the paper sheet slides up over the noir hero */
.sheet {
  position: relative; z-index: 5;
  background: var(--paper);
  background-image: radial-gradient(rgba(27, 26, 23, .035) 1px, transparent 1px);
  background-size: 3px 3px;
  border-radius: 28px 28px 0 0;
  box-shadow: 0 -30px 80px rgba(0, 0, 0, .55);
  padding-top: 8px;
}

/* ============================================================
   PAPER — masthead (inner pages) and shared journal elements
   ============================================================ */
.masthead { border-bottom: 3px double var(--ink); padding: 18px 0 12px; }
.masthead .wrap { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; flex-wrap: wrap; }
.masthead .title { font-size: 20px; font-style: italic; }
.masthead nav { display: flex; gap: clamp(12px, 2.5vw, 28px); flex-wrap: wrap; }
.volume { border-bottom: 1px solid var(--rule); padding: 8px 0; }
.volume .wrap { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; }

h1.display {
  font-weight: 300; font-size: clamp(48px, 7.4vw, 104px); line-height: .98; letter-spacing: -.025em;
  font-variation-settings: "opsz" 72;
}
h1.display em { font-weight: 400; }
.lines .line { display: block; overflow: hidden; padding-bottom: .04em; }
.lines .line > span { display: inline-block; transform: translateY(105%); animation: rise 1.1s var(--ease) forwards; }
.lines .line:nth-child(2) > span { animation-delay: .1s; }
.lines .line:nth-child(3) > span { animation-delay: .2s; }
.lines .line:nth-child(4) > span { animation-delay: .3s; }
@keyframes rise { to { transform: none; } }

.intro { padding: clamp(56px, 10vh, 110px) 0 40px; display: grid; grid-template-columns: 1.25fr 1fr; gap: clamp(28px, 5vw, 72px); align-items: end; }
.byline { margin-top: 28px; font-size: 17px; }
.byline b { font-weight: 500; font-variant: small-caps; letter-spacing: .04em; font-size: 19px; }
.byline span { color: var(--ink-2); font-style: italic; }
.abstract { border-top: 1px solid var(--ink); padding-top: 14px; }
.abstract p { font-size: 16.5px; color: var(--ink-2); text-align: justify; hyphens: auto; margin-top: 8px; }
.dropcap::first-letter { font-size: 3.1em; float: left; line-height: .8; padding: 6px 8px 0 0; color: var(--red); font-weight: 400; }

/* figure */
figure.fig { margin: 24px 0 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); padding: 24px 0 14px; }
figure.fig svg { display: block; width: 100%; height: auto; overflow: visible; }
.fig .axis, .fig .tick { stroke: var(--ink); stroke-width: 1; }
.fig .tlabel { font-family: var(--mono); font-size: 10px; fill: var(--ink-2); }
.fig .path { fill: none; stroke: var(--ink); stroke-width: 1.1; stroke-linejoin: round; }
.fig .ghost { fill: none; stroke: var(--ink); stroke-width: .7; opacity: .16; }
.fig .band { fill: none; stroke: var(--red); stroke-width: 1; stroke-dasharray: 3 4; }
.fig .dot { fill: var(--red); }
figcaption { display: flex; justify-content: space-between; gap: 16px; margin-top: 12px; font-size: 15px; color: var(--ink-2); flex-wrap: wrap; }
figcaption b { color: var(--ink); font-weight: 500; font-variant: small-caps; letter-spacing: .04em; }

/* sections */
section.s { padding: clamp(64px, 11vh, 120px) 0 0; scroll-margin-top: 24px; }
.sec-head { display: grid; grid-template-columns: 90px 1fr; gap: 20px; border-top: 1px solid var(--ink); padding-top: 16px; margin-bottom: 36px; }
.sec-head .num { font-size: 40px; line-height: 1; color: var(--red); font-weight: 300; }
h2 { font-weight: 400; font-size: clamp(32px, 4.2vw, 52px); line-height: 1.05; letter-spacing: -.015em; }
h2 em { color: var(--ink-2); }
h3 { font-weight: 500; font-size: 22px; line-height: 1.2; }

/* table-of-contents course list */
.toc { list-style: none; }
.toc a { display: grid; grid-template-columns: 90px 1fr 240px; gap: 20px; align-items: baseline; padding: 16px 0; border-bottom: 1px solid var(--rule); }
.toc .sec { font-family: var(--mono); font-size: 12px; color: var(--ink-2); }
.toc .row { display: flex; align-items: baseline; gap: 12px; min-width: 0; }
.toc .name { font-size: clamp(22px, 2.8vw, 34px); white-space: nowrap; transition: color .3s; }
.toc .code { font-family: var(--mono); font-size: 11px; color: var(--ink-2); letter-spacing: .06em; white-space: nowrap; }
.toc .leader { flex: 1; border-bottom: 1.5px dotted var(--rule); transform: translateY(-6px); transition: border-color .3s; min-width: 20px; }
.toc .pg { font-family: var(--mono); font-size: 12px; color: var(--ink-2); white-space: nowrap; }
.toc .margin { font-style: italic; font-size: 15px; color: var(--ink-2); opacity: 0; transform: translateX(-8px); transition: opacity .35s, transform .35s; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.toc .blurb { grid-column: 2 / 3; font-size: 15.5px; color: var(--ink-2); margin-top: -6px; }
.toc a:hover .name { color: var(--red); }
.toc a:hover .leader { border-color: var(--red); }
.toc a:hover .margin { opacity: 1; transform: none; }

/* definition boxes */
.defs { display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(20px, 3vw, 40px); }
.def { display: block; border-top: 2px solid var(--ink); padding-top: 14px; transition: border-color .3s; }
a.def:hover { border-color: var(--red); }
.def .k { font-variant: small-caps; letter-spacing: .05em; font-weight: 600; }
.def .k i { font-weight: 400; font-variant: normal; color: var(--ink-2); }
.def p { margin-top: 8px; font-size: 16.5px; color: var(--ink-2); }
.def .foot { display: flex; justify-content: space-between; align-items: baseline; margin-top: 10px; font-size: 14px; }
.soon { font-family: var(--mono); font-size: 11px; color: var(--red); letter-spacing: .08em; text-transform: uppercase; }

.epigraph { margin: clamp(64px, 11vh, 120px) auto 0; max-width: 640px; text-align: center; font-size: clamp(22px, 2.6vw, 30px); font-style: italic; line-height: 1.35; font-weight: 300; }
.epigraph cite { display: block; margin-top: 14px; font-style: normal; }

footer.foot { margin-top: clamp(64px, 11vh, 120px); border-top: 3px double var(--ink); padding: 18px 0 36px; }
footer.foot .wrap { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; }

/* ============================================================
   COURSE PAGE
   ============================================================ */
.crumbs { padding-top: 28px; }
.crumbs a { color: var(--ink-2); }
.course-head { padding: clamp(40px, 7vh, 80px) 0 32px; }
.course-head .meta { display: flex; gap: 18px; flex-wrap: wrap; margin-bottom: 22px; }
.course-head .meta .no { color: var(--red); }
.course-head .lead { margin-top: 26px; font-size: clamp(19px, 2vw, 23px); line-height: 1.45; max-width: 44ch; color: var(--ink-2); font-style: italic; font-weight: 300; }

.equation {
  display: grid; grid-template-columns: 1fr auto; align-items: center;
  border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule);
  padding: clamp(28px, 5vh, 48px) 0; margin-top: 16px;
}
.equation .eq { text-align: center; font-size: clamp(26px, 4vw, 48px); font-style: italic; font-weight: 300; }
.equation .tag { font-family: var(--mono); font-size: 13px; color: var(--ink-2); }

.course-body { display: grid; grid-template-columns: 220px 1fr; gap: clamp(28px, 5vw, 72px); padding-top: clamp(40px, 7vh, 72px); }
.side { position: sticky; top: 24px; align-self: start; }
.side ol { list-style: none; border-top: 1px solid var(--ink); }
.side li a { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--rule); font-size: 16px; transition: color .25s, padding .25s; }
.side li a span { font-family: var(--mono); font-size: 11px; color: var(--ink-2); }
.side li a:hover, .side li a.on { color: var(--red); padding-left: 6px; }
.side .back { display: block; margin-top: 22px; }

.course-body section.s { padding-top: 0; margin-bottom: clamp(56px, 9vh, 96px); }
.course-body .sec-head { grid-template-columns: 64px 1fr; }
.course-body .sec-head .num { font-size: 30px; }
.course-body h2 { font-size: clamp(28px, 3.4vw, 40px); }
.prose p { max-width: 64ch; margin-bottom: 1em; }

.contents { list-style: none; counter-reset: ch; }
.contents li { counter-increment: ch; display: grid; grid-template-columns: 56px 1fr; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--rule); }
.contents li::before { content: counter(ch, upper-roman) "."; font-family: var(--serif); color: var(--red); font-variant: small-caps; }

.list { list-style: none; border-top: 1px solid var(--rule); }
.list li { border-bottom: 1px solid var(--rule); }
.list a, .list .item { display: grid; grid-template-columns: 110px 1fr auto; gap: 16px; align-items: baseline; padding: 14px 0; }
.list .kind { font-family: var(--mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); }
.list .t { font-size: 18px; transition: color .25s; }
.list .by { color: var(--ink-2); font-style: italic; }
.list .note { display: block; font-size: 15px; color: var(--ink-2); margin-top: 2px; }
.list .go { font-family: var(--mono); font-size: 12px; color: var(--ink-2); transition: transform .25s, color .25s; }
.list a:hover .t, .list a:hover .go { color: var(--red); }
.list a:hover .go { transform: translate(3px, -3px); }
.list .course-tag { font-family: var(--mono); font-size: 11px; color: var(--ink-2); }

.empty { border: 1px dashed var(--rule); padding: 22px 24px; color: var(--ink-2); font-style: italic; }
.empty .soon { font-style: normal; display: block; margin-bottom: 6px; }

.videos { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 24px; }
.video .frame { position: relative; aspect-ratio: 16 / 9; background: var(--ink); overflow: hidden; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video .cap { margin-top: 8px; font-size: 16px; }

.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; border-top: 1px solid var(--ink); padding-top: 18px; margin-top: clamp(40px, 7vh, 72px); }
.pager a { display: block; }
.pager a:last-child { text-align: right; }
.pager .t { font-size: clamp(22px, 2.6vw, 30px); display: block; transition: color .25s; }
.pager a:hover .t { color: var(--red); }

/* library filter chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 28px; }
.chips button {
  font: inherit; font-family: var(--mono); font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase;
  background: none; border: 1px solid var(--rule); color: var(--ink-2); padding: 7px 12px; cursor: pointer; transition: all .25s;
}
.chips button:hover { border-color: var(--ink); color: var(--ink); }
.chips button[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }

/* ============================================================
   SIMULATIONS (shared by assets/js/sims/*.js)
   ============================================================ */
.sim { border-top: 2px solid var(--ink); padding-top: 14px; }
.sim + .sim { margin-top: clamp(56px, 9vh, 88px); }
.sim-head { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.sim-head .mono { color: var(--red); }
.sim-head h3 { font-weight: 400; font-size: clamp(24px, 2.8vw, 32px); letter-spacing: -.01em; }
.sim-intro p { max-width: 64ch; }
.sim-eq { margin: 18px 0 8px; font-size: clamp(20px, 2.4vw, 26px); font-style: italic; font-weight: 300; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.frac { display: inline-flex; flex-direction: column; text-align: center; line-height: 1.15; vertical-align: middle; }
.frac > span:first-child { border-bottom: 1px solid var(--ink); padding: 0 4px 2px; }
.frac > span:last-child { padding-top: 2px; }
.lim { display: inline-flex; flex-direction: column; align-items: center; line-height: 1; vertical-align: middle; }
.lim small { font-size: .5em; font-style: normal; margin-top: 2px; }

.sim-controls { display: flex; flex-wrap: wrap; gap: 20px 40px; align-items: flex-end; border-top: 1px solid var(--rule); padding-top: 16px; margin-top: 24px; }
.sim-controls .ctl { min-width: 0; }
.sim-controls .ctl.wide { flex-basis: 100%; }
.sim-controls .ctl > span.mono, .sim-controls .ctl > label.mono { display: block; margin-bottom: 10px; }
.sim-controls .chips { margin-bottom: 0; }
.sim-controls .ctl-range { width: min(100%, 360px); }
.ctl-range .ticks { display: flex; justify-content: space-between; font-size: 10px; margin-top: 2px; }
.val { color: var(--red); font-weight: 400; }
.ctl-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.btn {
  font: inherit; font-family: var(--mono); font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase;
  background: var(--ink); color: var(--paper); border: 1px solid var(--ink); padding: 8px 14px; cursor: pointer; transition: all .25s;
}
.btn:hover { background: var(--red); border-color: var(--red); }
.btn.ghost { background: none; color: var(--ink); }
.btn.ghost:hover { color: var(--red); border-color: var(--red); background: none; }
.btn:disabled { opacity: .35; pointer-events: none; }

input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 22px; background: none; cursor: pointer; --p: 0%; }
input[type="range"]::-webkit-slider-runnable-track { height: 2px; background: linear-gradient(to right, var(--red) var(--p), var(--rule) var(--p)); }
input[type="range"]::-moz-range-track { height: 2px; background: var(--rule); }
input[type="range"]::-moz-range-progress { height: 2px; background: var(--red); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; margin-top: -6px; border-radius: 50%; background: var(--paper); border: 1.5px solid var(--ink); transition: transform .2s; }
input[type="range"]::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: var(--paper); border: 1.5px solid var(--ink); }
input[type="range"]:hover::-webkit-slider-thumb { transform: scale(1.2); border-color: var(--red); }

.sim-plot { position: relative; margin-top: 10px; }
.sim-plot figure.fig { margin-top: 18px; }
.sim-plot svg { touch-action: none; }
.sim-plot figure.fig svg, .arch-grid figure.fig svg { overflow: hidden; }
.sim-inset {
  position: absolute; z-index: 1; top: 30px; right: 0; width: 27%; min-width: 190px;
  background: var(--paper); border: 1px solid var(--rule) !important; padding: 10px 12px 8px !important; margin: 0 !important;
}
.sim-inset figcaption { font-size: 12.5px; margin-top: 4px; }
.sim-readout { color: var(--ink-2); text-transform: none; letter-spacing: .02em; font-size: 12.5px; }
.sim-readout b { color: var(--red); font-weight: 400; }
.sim-hint { margin-top: 18px; font-size: 16px; color: var(--ink-2); max-width: 70ch; }

/* svg vocabulary */
.fig .bar, .fig .rect { fill: rgba(27, 26, 23, .12); stroke: rgba(27, 26, 23, .6); stroke-width: .8; }
.fig .rect.over { fill: rgba(168, 50, 31, .12); stroke: rgba(168, 50, 31, .7); }
.fig .normal, .fig .red { fill: none; stroke: var(--red); stroke-width: 1.8; }
.fig .curve { fill: none; stroke: var(--ink); stroke-width: 1.8; stroke-linejoin: round; }
.fig .thin { fill: none; stroke: var(--ink); stroke-width: .9; opacity: .55; }
.fig .dash { fill: none; stroke: var(--red); stroke-width: 1.2; stroke-dasharray: 5 4; }
.fig .guide { fill: none; stroke: var(--ink-2); stroke-width: 1; stroke-dasharray: 2 3; }
.fig .shade { fill: rgba(168, 50, 31, .07); stroke: none; }
.fig .pt { fill: var(--ink); }
.fig .pt.red { fill: var(--red); stroke: none; }
.fig .handle { fill: var(--paper); stroke: var(--red); stroke-width: 2; cursor: grab; }
.fig .handle:active { cursor: grabbing; }
.fig .grid { stroke: var(--rule); stroke-width: 1; }
.fig .pop-area { fill: rgba(27, 26, 23, .12); stroke: var(--ink); stroke-width: 1.2; stroke-linejoin: round; }
.fig .pop-stem { stroke: var(--ink); stroke-width: 1.5; }
.fig .pop-dot { fill: var(--ink); }
.fig .mu { stroke: var(--red); stroke-width: 1; stroke-dasharray: 3 3; }
.fig .mu-l, .fig .lab-red { fill: var(--red); font-style: italic; }
.fig .lab { font-family: var(--serif); font-style: italic; font-size: 16px; fill: var(--ink); }
.fig .lab.red { fill: var(--red); stroke: none; }

/* gradient / level curves */
.mv-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 28px; align-items: start; }
.mv-grid .map { cursor: crosshair; }
.fig .contour { fill: none; stroke: rgba(27, 26, 23, .38); stroke-width: .9; }
.fig .level { fill: none; stroke: var(--red); stroke-width: 1.8; stroke-dasharray: 7 4; }
.fig .arrow-red { stroke: var(--red); stroke-width: 2.6; }
.fig .arrow-ink { stroke: var(--ink); stroke-width: 2; }

/* Hilbert's hotel */
.fig .room { fill: rgba(27, 26, 23, .03); stroke: var(--ink); stroke-width: 1.2; }
.fig .guest { fill: var(--paper); stroke: var(--ink); stroke-width: 1.4; }
.fig .guest.red { fill: rgba(168, 50, 31, .1); stroke: var(--red); }
.fig .glab { font-family: var(--mono); font-size: 13px; fill: var(--ink); }
.fig .glab.red { fill: var(--red); }
.fig .frac-cell { font-family: var(--serif); font-size: 20px; fill: var(--ink-2); transition: fill .3s; }
.fig .frac-cell.dup { opacity: .35; text-decoration: line-through; }
.fig .frac-cell.on { fill: var(--red); font-weight: 600; }
.fig .digit { font-family: var(--mono); font-size: 22px; fill: var(--ink-2); }
.fig .digit.on { fill: var(--ink); font-weight: 600; }
.fig .digit.red { fill: var(--red); font-weight: 600; }
.fig .diag-box { fill: none; stroke: var(--red); stroke-width: 1.6; }

/* sums & Fibonacci */
.fig .cell { fill: rgba(27, 26, 23, .16); stroke: rgba(27, 26, 23, .5); stroke-width: .8; }
.fig .cell.alt { fill: rgba(168, 50, 31, .16); stroke: rgba(168, 50, 31, .6); }
.fig .grid-cell { fill: none; stroke: rgba(27, 26, 23, .18); stroke-width: .6; }
.fig .fib-sq { fill: rgba(27, 26, 23, .04); stroke: var(--ink); stroke-width: 1.2; }
.fig .fib-lab { font-family: var(--serif); fill: var(--ink-2); font-weight: 300; }

/* ciphers */
.cipher-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; margin-top: 18px; }
.cipher-grid .mono, .sim .cipher-out + .mono { display: block; margin-bottom: 8px; }
.sim textarea, .cipher-out, .sim input[type="text"] {
  width: 100%; font: inherit; font-size: 15px; line-height: 1.55; color: var(--ink);
  background: rgba(255, 255, 255, .35); border: 1px solid var(--rule); padding: 12px 14px; border-radius: 0;
}
.sim textarea { resize: vertical; min-height: 170px; }
.sim textarea:focus, .sim input[type="text"]:focus { outline: none; border-color: var(--ink); }
.sim input[type="text"] { font-family: var(--mono); letter-spacing: .1em; text-transform: uppercase; padding: 7px 10px; width: 180px; }
.cipher-out { font-family: var(--mono); font-size: 13px; letter-spacing: .04em; white-space: pre-wrap; word-break: break-word; min-height: 170px; max-height: 240px; overflow: auto; }
.cipher-out.dec { min-height: 0; margin-top: 8px; }

/* Archimedes table */
.arch-table { width: 100%; border-collapse: collapse; font-size: 15px; margin-top: 8px; }
.arch-table th { font-family: var(--mono); font-weight: 400; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); text-align: right; padding: 6px 8px; border-bottom: 1px solid var(--ink); }
.arch-table th:first-child, .arch-table td:first-child { text-align: left; }
.arch-table td { text-align: right; padding: 6px 8px; border-bottom: 1px solid var(--rule); font-variant-numeric: tabular-nums; }
.arch-table tr.new td { animation: rowIn .6s var(--ease); }
.arch-table tr.famous td { color: var(--red); }
@keyframes rowIn { from { background: rgba(168, 50, 31, .12); } to { background: transparent; } }
.arch-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 32px; align-items: start; }
.arch-grid > *, .course-body > * { min-width: 0; }
.arch-grid .table-wrap { overflow-x: auto; }

/* Sieve of Eratosthenes */
.sieve { display: grid; grid-template-columns: repeat(20, minmax(0, 1fr)); gap: 3px; margin-top: 22px; }
.sieve span {
  aspect-ratio: 1; display: grid; place-items: center; font-size: clamp(9px, 1.25vw, 14px); min-width: 0; overflow: hidden; font-variant-numeric: tabular-nums;
  border: 1px solid var(--rule); transition: background .35s, color .35s, opacity .35s, border-color .35s;
}
.sieve span.one { opacity: .25; }
.sieve span.cur { background: var(--red); color: var(--paper); border-color: var(--red); }
.sieve span.hit { background: rgba(168, 50, 31, .16); }
.sieve span.out { opacity: .28; text-decoration: line-through; }
.sieve span.prime { font-weight: 600; border-color: var(--ink); }

@media (max-width: 860px) {
  .sim-inset { position: static; width: auto; max-width: 320px; margin-top: 18px !important; }
  .arch-grid, .mv-grid, .cipher-grid { grid-template-columns: 1fr; }
  .arch-table { font-size: 13px; }
  .arch-table th, .arch-table td { padding: 5px 4px; }
  .sieve { gap: 2px; }
}

/* ---------- reveal ---------- */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .9s ease, transform .9s var(--ease); }
.reveal.in { opacity: 1; transform: none; }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .intro { grid-template-columns: 1fr; }
  .defs { grid-template-columns: 1fr; }
  .toc a { grid-template-columns: 1fr; gap: 4px; }
  .toc .blurb { grid-column: auto; margin-top: 0; }
  .toc .margin { opacity: 1; transform: none; }
  .toc .name { white-space: normal; }
  .toc .row { flex-wrap: wrap; column-gap: 10px; row-gap: 2px; }
  .toc .leader { display: none; }
  .sec-head, .course-body .sec-head { grid-template-columns: 1fr; gap: 6px; }
  .course-body { grid-template-columns: 1fr; }
  .side { position: static; }
  .list a, .list .item { grid-template-columns: 1fr; gap: 2px; }
  .equation { grid-template-columns: 1fr; gap: 10px; text-align: center; }
  .topnav ul li:not(.keep) { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .lines .line > span { animation: none; transform: none; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .hero .corner.r::after { animation: none; }
}
