/* ═══════════════════════════════════════════════════════════
   Digital — 情報のデジタル化  (Explorables)
   Dark minimal theme, echoing the Weaire–Phelan / Curves explorables
   Accent: cyan (digital) × amber (analog)
   ═══════════════════════════════════════════════════════════ */

:root {
  --bg: #0a0d13;
  --bg-2: #0c1018;
  --surface: rgba(255, 255, 255, 0.035);
  --surface-2: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.09);
  --border-2: rgba(255, 255, 255, 0.16);
  --text: #e8ecf4;
  --text-2: #a9b3c6;
  --text-3: #6b7688;
  --cyan: #22d3ee;
  --amber: #fbbf24;
  --red: #ef4444;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Noto Sans JP", "Yu Gothic UI", sans-serif;
  --mono: "SF Mono", "Cascadia Code", Consolas, Menlo, monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.9;
  -webkit-font-smoothing: antialiased;
}

::selection { background: rgba(34, 211, 238, 0.35); }

/* ── Top navigation ─────────────────────────────────────── */
.topnav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.55rem 1.2rem;
  background: rgba(10, 13, 19, 0.82);
  backdrop-filter: blur(14px) saturate(1.4);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  border-bottom: 1px solid var(--border);
  font-size: 0.8rem;
}
.topnav-home {
  color: var(--text-2);
  text-decoration: none;
  letter-spacing: 0.04em;
  white-space: nowrap;
  transition: color 0.2s;
}
.topnav-home:hover { color: var(--text); }
.topnav-title {
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--text-3);
  text-transform: uppercase;
  font-size: 0.7rem;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topnav-links { display: flex; gap: 0.3rem; }
.topnav-links a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.7rem; height: 1.7rem;
  border-radius: 50%;
  color: var(--text-3);
  text-decoration: none;
  font-size: 0.72rem;
  font-family: var(--mono);
  border: 1px solid transparent;
  transition: all 0.2s;
}
.topnav-links a:hover { color: var(--text); border-color: var(--border-2); }
.topnav-links a.active {
  color: #0a0d13;
  background: var(--cyan);
  font-weight: 700;
}

/* ── Hero ───────────────────────────────────────────────── */
.hero {
  position: relative;
  min-height: 92vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: radial-gradient(120% 90% at 50% 0%, #0f1622 0%, var(--bg) 65%);
}
#heroCanvas {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  opacity: 0.9;
}
.hero-inner {
  position: relative;
  z-index: 1;
  max-width: 780px;
  padding: 6rem 1.5rem 4rem;
  text-align: center;
}
.hero-eyebrow {
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--cyan);
  margin-bottom: 1.4rem;
}
.hero h1 {
  font-size: clamp(1.7rem, 4.6vw, 2.9rem);
  font-weight: 700;
  letter-spacing: 0.03em;
  line-height: 1.45;
  margin-bottom: 1.6rem;
}
.hero-dash { margin: 0 0.35em; color: var(--text-3); font-weight: 300; }
.hero-lead {
  font-size: 0.95rem;
  color: var(--text-2);
  text-align: left;
  margin-bottom: 2.4rem;
}
.hero-lead strong { color: var(--amber); font-weight: 600; }
.hero-cta {
  display: inline-block;
  padding: 0.75rem 2.2rem;
  border: 1px solid var(--border-2);
  border-radius: 999px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  background: var(--surface);
  transition: all 0.25s;
}
.hero-cta:hover { background: var(--surface-2); border-color: var(--cyan); }

/* ── Chapters ───────────────────────────────────────────── */
.content { max-width: 860px; margin: 0 auto; padding: 0 1.4rem; }

.chapter {
  padding: 5.5rem 0 3rem;
  border-bottom: 1px solid var(--border);
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
.chapter.visible { opacity: 1; transform: none; }
.chapter:last-of-type { border-bottom: none; }

.ch-head { margin-bottom: 2rem; }
.ch-index {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--cyan);
}
.ch-head h2 {
  font-size: clamp(1.35rem, 3vw, 1.85rem);
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.5;
  margin: 0.5rem 0 0.4rem;
}
.ch-sub { font-size: 0.9rem; color: var(--text-3); }

.ch-prose p { margin-bottom: 1.3rem; font-size: 0.95rem; color: var(--text-2); }
.ch-prose strong { color: var(--text); font-weight: 600; }
.ch-prose code {
  font-family: var(--mono);
  font-size: 0.86em;
  color: var(--cyan);
  background: rgba(34, 211, 238, 0.09);
  border: 1px solid rgba(34, 211, 238, 0.18);
  border-radius: 5px;
  padding: 0.05em 0.36em;
}

/* formulas / code-ish blocks */
.eq {
  font-family: var(--mono);
  font-size: 0.95rem;
  color: var(--amber);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.9rem 1.2rem;
  margin: 0 0 1.3rem;
  text-align: center;
  overflow-x: auto;
  white-space: nowrap;
}
.eq-inline {
  font-family: var(--mono);
  font-size: 0.88em;
  color: var(--amber);
  white-space: nowrap;
}
.eq-name {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  text-align: left;
  white-space: normal;
  color: var(--text-2);
  font-size: 0.86rem;
}
.eq-name b { color: var(--amber); font-size: 1.05em; }

/* tool notes */
.toolnote {
  position: relative;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 1.1rem 1.3rem 1rem;
  margin: 1.6rem 0;
}
.toolnote p { margin: 0.35rem 0 0; font-size: 0.88rem; color: var(--text-2); }
.toolnote-tag {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 0.18rem 0.7rem;
  border-radius: 999px;
}
.toolnote.il { border-left: 3px solid #f59e0b; }
.toolnote.il .toolnote-tag { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.toolnote.rh { border-left: 3px solid #34d399; }
.toolnote.rh .toolnote-tag { background: rgba(52, 211, 153, 0.13); color: #34d399; }
.toolnote.dg { border-left: 3px solid var(--cyan); }
.toolnote.dg .toolnote-tag { background: rgba(34, 211, 238, 0.13); color: var(--cyan); }

/* lists */
.glist { margin: 0 0 1.3rem 1.2rem; }
.glist li { font-size: 0.92rem; color: var(--text-2); margin-bottom: 0.55rem; }
.glist strong { color: var(--text); }

/* comparison table */
.tool-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  margin: 0 0 1.5rem;
}
.tool-table th, .tool-table td {
  text-align: left;
  padding: 0.55rem 0.8rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-2);
  vertical-align: top;
}
.tool-table th {
  color: var(--text-3);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 600;
}
.tool-table td:first-child { color: var(--text); white-space: nowrap; }

/* ── Demos ──────────────────────────────────────────────── */
.demo { margin: 2.2rem 0; }
.demo-stage {
  position: relative;
  aspect-ratio: 16 / 9;
  max-height: 540px;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #080b10;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}
.demo-stage canvas {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  display: block;
  touch-action: none;
  cursor: crosshair;
}
.demo-stage.tall { aspect-ratio: 16 / 10; }
.demo-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  margin-top: 0.8rem;
  min-height: 2rem;
}
.demo-hint {
  margin-top: 0.7rem;
  font-size: 0.78rem;
  color: var(--text-3);
  line-height: 1.7;
}

/* control chips */
.chip {
  appearance: none;
  border: 1px solid var(--border-2);
  background: var(--surface);
  color: var(--text-2);
  font-family: var(--font);
  font-size: 0.76rem;
  letter-spacing: 0.03em;
  padding: 0.34rem 0.95rem;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.18s;
  white-space: nowrap;
}
.chip:hover { color: var(--text); border-color: rgba(255, 255, 255, 0.3); }
.chip.on {
  background: var(--cyan);
  border-color: var(--cyan);
  color: #0a0d13;
  font-weight: 600;
}
.chip.gold.on { background: var(--amber); border-color: var(--amber); }

.ctl-group {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.22rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
}
.ctl-label {
  font-size: 0.72rem;
  color: var(--text-3);
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.ctl-value {
  font-family: var(--mono);
  font-size: 0.74rem;
  color: var(--amber);
  min-width: 2.6em;
  text-align: right;
  white-space: nowrap;
}
.ctl-sep { width: 1px; height: 1.1rem; background: var(--border-2); margin: 0 0.2rem; }
.ctl-break { flex-basis: 100%; height: 0; }

input[type="range"].ctl-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 120px;
  height: 3px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.18);
  outline: none;
  cursor: pointer;
}
input[type="range"].ctl-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 13px; height: 13px;
  border-radius: 50%;
  background: var(--text);
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.4);
  cursor: pointer;
}
input[type="range"].ctl-slider::-moz-range-thumb {
  width: 13px; height: 13px;
  border: none;
  border-radius: 50%;
  background: var(--text);
  cursor: pointer;
}
input[type="range"].ctl-slider:disabled { opacity: 0.35; cursor: default; }

.readout {
  font-family: var(--mono);
  font-size: 0.74rem;
  color: var(--text-2);
  padding: 0.3rem 0.8rem;
  border-radius: 999px;
  border: 1px dashed var(--border-2);
  white-space: nowrap;
}
.readout b { color: var(--cyan); font-weight: 600; }

/* ── Text-encoding demo (DOM inside stage) ───────────────── */
.textlab {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: 1.1rem 1.2rem;
  gap: 0.8rem;
  overflow-y: auto;
  background:
    linear-gradient(180deg, rgba(34, 211, 238, 0.04), transparent 30%),
    #080b10;
}
.textlab-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-2);
  border-radius: 10px;
  color: var(--text);
  font-family: var(--font);
  font-size: 1.05rem;
  padding: 0.6rem 0.9rem;
  outline: none;
}
.textlab-input:focus { border-color: var(--cyan); }
.charwall {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-content: flex-start;
}
.charcard {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  padding: 0.45rem 0.6rem 0.5rem;
  text-align: center;
  min-width: 5.4rem;
}
.charcard .cc-ch {
  font-size: 1.35rem;
  line-height: 1.3;
  color: var(--text);
}
.charcard .cc-cp {
  font-family: var(--mono);
  font-size: 0.62rem;
  color: var(--text-3);
  letter-spacing: 0.02em;
}
.charcard .cc-bytes {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 0.35rem;
}
.charcard .cc-byte {
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.06em;
  color: var(--cyan);
  background: rgba(34, 211, 238, 0.07);
  border-radius: 4px;
  padding: 0.06rem 0.3rem;
  white-space: nowrap;
}
.charcard.multi .cc-byte { color: #7dd3fc; }
.textlab-row { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.textlab-note {
  font-size: 0.72rem;
  color: var(--text-3);
}
.mojibake-out {
  font-size: 1.02rem;
  line-height: 1.7;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  padding: 0.55rem 0.9rem;
  min-height: 2.6rem;
  color: var(--text);
  overflow-wrap: anywhere;
}
.mojibake-out.bad { color: #fda4af; border-color: rgba(244, 63, 94, 0.35); }
.textlab-label {
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-3);
}

/* ── Encoding-history demo (DOM inside stage) ────────────── */
.enclab {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  padding: 1.1rem 1.2rem;
  overflow-y: auto;
  background:
    linear-gradient(180deg, rgba(34, 211, 238, 0.04), transparent 30%),
    #080b10;
}
.encrow {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  padding: 0.65rem 0.9rem 0.75rem;
}
.enc-head {
  display: flex;
  align-items: baseline;
  gap: 0.7rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}
.enc-name {
  font-family: var(--mono);
  font-weight: 700;
  color: var(--text);
  font-size: 0.92rem;
}
.enc-note { font-size: 0.7rem; color: var(--text-3); flex: 1; }
.enc-total {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--amber);
  white-space: nowrap;
}
.encgroups { display: flex; flex-wrap: wrap; gap: 0.55rem; }
.encgroup {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  border: 1px dashed var(--border-2);
  border-radius: 8px;
  padding: 0.3rem 0.5rem 0.35rem;
}
.encchar { font-size: 1.05rem; color: var(--text); line-height: 1.35; }
.encbytes { display: flex; gap: 0.35rem; }
.encbyte { display: flex; flex-direction: column; align-items: center; gap: 1px; }
.encbyte .hx {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--text-2);
}
.encbyte .bi {
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.04em;
  color: var(--cyan);
}
.encbyte .bi b { color: var(--amber); font-weight: 700; }
.encrow.sjis .encbyte .bi { color: #9aa4b5; }

/* ── JIS 区点 → Shift_JIS / EUC-JP rule demo (DOM inside stage) ── */
.jislab {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  padding: 1.0rem 1.1rem;
  overflow-y: auto;
  background:
    linear-gradient(180deg, rgba(34, 211, 238, 0.04), transparent 30%),
    #080b10;
}
/* this demo is content-rich → let the stage grow instead of scrolling internally */
#demo-jis .demo-stage { aspect-ratio: auto; max-height: none; }
#demo-jis .jislab { position: static; inset: auto; overflow: visible; }
.jis-src {
  display: flex;
  align-items: center;
  gap: 1rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  padding: 0.55rem 0.9rem;
}
.jis-ch {
  font-size: 2.3rem;
  line-height: 1.1;
  color: var(--text);
}
.jis-srcinfo {
  font-size: 0.76rem;
  color: var(--text-2);
  line-height: 1.8;
}
.jis-srcinfo b { color: var(--amber); font-family: var(--mono); }
.jis-paths {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7rem;
  align-items: start;
}
.jis-path {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  padding: 0.6rem 0.85rem 0.7rem;
}
.jis-path h4 {
  margin: 0 0 0.45rem;
  font-family: var(--mono);
  font-size: 0.9rem;
  color: var(--text);
}
.jis-path h4 span {
  display: block;
  font-family: var(--font);
  font-weight: 400;
  font-size: 0.68rem;
  color: var(--text-3);
  margin-top: 0.15rem;
}
.jis-step {
  font-size: 0.74rem;
  color: var(--text-2);
  line-height: 1.85;
  padding: 0.28rem 0;
  border-top: 1px dashed var(--border-2);
}
.jis-step b { color: var(--text); font-family: var(--mono); }
.jis-step .jhex { font-family: var(--mono); color: var(--text); }
.jis-step .jbits { font-family: var(--mono); font-size: 0.66rem; color: var(--cyan); letter-spacing: 0.04em; }
.jis-step .jbits b { color: var(--amber); }
.jis-ex { color: #fda4af; }

/* the "why shift?" background box in the Shift_JIS column */
.jis-why {
  font-size: 0.7rem;
  line-height: 1.7;
  color: var(--text-2);
  background: rgba(251, 191, 36, 0.06);
  border: 1px solid rgba(251, 191, 36, 0.18);
  border-radius: 8px;
  padding: 0.5rem 0.65rem;
  margin-bottom: 0.35rem;
}
.jis-why b { color: var(--amber); font-weight: 700; }

/* before → after conversion line (one byte at a time) */
.jis-conv {
  display: grid;
  grid-template-columns: 4.4rem auto 1fr auto auto;
  align-items: center;
  gap: 0.15rem 0.5rem;
  padding: 0.4rem 0 0.35rem;
  border-top: 1px dashed var(--border-2);
}
.jc-pos {
  font-size: 0.66rem;
  color: var(--text-3);
  letter-spacing: 0.02em;
}
.jhex.big {
  font-family: var(--mono);
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--text-2);
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.jhex.big i {
  font-style: normal;
  font-size: 0.6em;
  font-weight: 500;
  color: var(--text-3);
  margin-left: 0.3em;
}
.jhex.big.to.cy { color: var(--cyan); }
.jhex.big.to.am { color: var(--amber); }
.jc-op {
  justify-self: end;
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--text-3);
}
.jc-arrow { color: var(--text-3); font-size: 0.85rem; }
.jc-note {
  grid-column: 1 / -1;
  font-size: 0.68rem;
  color: var(--text-2);
  line-height: 1.6;
  margin-top: 0.1rem;
}
.jc-note b { color: var(--text); }
.jbits { font-family: var(--mono); font-size: 0.64rem; color: var(--cyan); letter-spacing: 0.03em; }
.jbits b { color: var(--amber); }
.jis-result {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.5rem;
  padding-top: 0.45rem;
  border-top: 1px solid var(--border);
}
.jis-result .jr-name {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--text-3);
  letter-spacing: 0.06em;
}
.jis-path.sjis .encbyte .bi { color: #9aa4b5; }
.jhex { font-family: var(--mono); color: var(--text); }

/* text input used in demo controls (Huffman) */
.ctl-text {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-2);
  border-radius: 8px;
  padding: 0.28rem 0.6rem;
  width: 11.5rem;
  outline: none;
}
.ctl-text:focus { border-color: rgba(34, 211, 238, 0.5); }

/* ── Takeaway box ───────────────────────────────────────── */
.takeaway {
  margin-top: 2.4rem;
  border: 1px solid rgba(34, 211, 238, 0.25);
  background: rgba(34, 211, 238, 0.045);
  border-radius: 14px;
  padding: 1.3rem 1.6rem 1.1rem;
}
.takeaway h3 {
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--cyan);
  margin-bottom: 0.7rem;
}
.takeaway ul { margin-left: 1.2rem; }
.takeaway li { font-size: 0.88rem; color: var(--text-2); margin-bottom: 0.4rem; }
.takeaway strong { color: var(--text); }

/* ── Timeline ───────────────────────────────────────────── */
.timeline {
  list-style: none;
  margin: 1.8rem 0 1rem;
  border-left: 2px solid rgba(34, 211, 238, 0.3);
  padding-left: 0;
}
.timeline li {
  position: relative;
  display: flex;
  gap: 1.1rem;
  padding: 0 0 1.05rem 1.6rem;
  font-size: 0.88rem;
}
.timeline li::before {
  content: "";
  position: absolute;
  left: -6px; top: 0.5em;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--cyan);
}
.tl-year {
  font-family: var(--mono);
  color: var(--amber);
  min-width: 4.2em;
  flex-shrink: 0;
}
.tl-body { color: var(--text-2); }

/* ── Q&A ────────────────────────────────────────────────── */
.qa {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  margin-bottom: 0.8rem;
  overflow: hidden;
}
.qa summary {
  cursor: pointer;
  padding: 1rem 1.3rem;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
  list-style: none;
  position: relative;
  padding-right: 3rem;
  transition: background 0.2s;
}
.qa summary::-webkit-details-marker { display: none; }
.qa summary::after {
  content: "+";
  position: absolute;
  right: 1.2rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--cyan);
  font-size: 1.2rem;
  font-weight: 400;
  transition: transform 0.25s;
}
.qa[open] summary::after { transform: translateY(-50%) rotate(45deg); }
.qa summary:hover { background: var(--surface-2); }
.qa-body { padding: 0 1.3rem 1.1rem; }
.qa-body p { font-size: 0.88rem; color: var(--text-2); margin: 0 0 0.6rem; }
.qa-body strong { color: var(--text); }

/* next-content card */
.nextcard {
  display: block;
  margin-top: 2.2rem;
  border: 1px solid var(--border-2);
  border-radius: 14px;
  background: var(--surface);
  padding: 1.2rem 1.5rem;
  text-decoration: none;
  transition: all 0.25s;
}
.nextcard:hover { border-color: var(--cyan); background: var(--surface-2); }
.nextcard .nc-eyebrow {
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--cyan);
}
.nextcard .nc-title { color: var(--text); font-weight: 700; font-size: 1.02rem; margin: 0.25rem 0 0.2rem; }
.nextcard .nc-desc { color: var(--text-2); font-size: 0.82rem; }

/* ── Footer ─────────────────────────────────────────────── */
.site-footer {
  margin-top: 4rem;
  padding: 2.4rem 1.5rem 3rem;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-3);
}
.site-footer nav { margin-top: 0.6rem; display: flex; gap: 1.4rem; justify-content: center; }
.site-footer a { color: var(--text-2); text-decoration: none; }
.site-footer a:hover { color: var(--text); }

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 640px) {
  body { font-size: 15px; }
  .topnav { padding: 0.5rem 0.8rem; gap: 0.6rem; }
  .topnav-title { display: none; }
  .demo-stage { aspect-ratio: 4 / 3; }
  .demo-stage.tall { aspect-ratio: 4 / 3.4; }
  .chapter { padding-top: 4rem; }
  input[type="range"].ctl-slider { width: 90px; }
  .jis-paths { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .chapter { opacity: 1; transform: none; transition: none; }
}
