:root {
  --bg: #0B0B0A;
  --surface: #141412;
  --card: #1C1C19;
  --card-hover: #232320;
  --border: #2A2A26;
  --ink: #F7F3E8;
  --ink-dim: #A8A497;
  --ink-faint: #8B887A;
  --brass: #B8935A;
  --brass-dim: #6E5A3A;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'IBM Plex Sans', sans-serif;
  line-height: 1.6;
}

header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 40px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.brand { font-family: 'Fraunces', serif; font-weight: 500; font-size: 17px; letter-spacing: 0.01em; color: inherit; text-decoration: none; }
.brand em { font-style: italic; color: var(--brass); }
nav { display: flex; gap: 28px; font-size: 13px; color: var(--ink-dim); }
nav a { color: inherit; text-decoration: none; }
nav a:hover { color: var(--ink); }

.constants-widget { position: relative; }
.constants-toggle {
  display: flex;
  align-items: center;
  gap: 7px;
  background: none;
  border: none;
  color: var(--ink-dim);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  padding: 6px 2px;
  transition: color 0.15s ease;
}
.constants-toggle:hover { color: var(--ink); }
.constants-chevron {
  width: 10px;
  height: 7px;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.2s ease;
}
.constants-toggle[aria-expanded="true"] .constants-chevron { transform: rotate(180deg); }
.constants-panel {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  min-width: 220px;
  max-width: calc(100vw - 40px);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px 16px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
  z-index: 50;
}
.constants-panel[hidden] { display: none; }
.constants-row {
  display: grid;
  grid-template-columns: 22px auto 1fr;
  align-items: baseline;
  gap: 12px;
  padding: 10px 0;
}
.constants-row + .constants-row { border-top: 1px solid var(--border); }
.constants-symbol { font-family: 'Fraunces', serif; font-style: italic; font-size: 17px; color: var(--brass); }
.constants-name { font-size: 12px; color: var(--ink-dim); white-space: nowrap; }
.constants-value { font-family: 'IBM Plex Mono', monospace; font-size: 12px; color: var(--ink); text-align: right; }

.hero {
  position: relative;
  height: 170px;
  background: var(--bg);
  overflow: hidden;
  border-bottom: 1px solid var(--border);
}
.hero span {
  position: absolute;
  font-family: 'Fraunces', serif;
  font-style: italic;
  color: var(--ink);
  white-space: nowrap;
  animation: hero-float var(--dur, 20s) ease-in-out infinite;
  animation-delay: var(--delay, 0s);
  will-change: transform;
}
@keyframes hero-float {
  0%   { transform: translate(0, 0); }
  25%  { transform: translate(calc(var(--dx) * 0.6), calc(var(--dy) * -0.3)); }
  50%  { transform: translate(var(--dx), var(--dy)); }
  75%  { transform: translate(calc(var(--dx) * 0.3), calc(var(--dy) * 0.6)); }
  100% { transform: translate(0, 0); }
}

.scale {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 40px;
  border-bottom: 1px solid var(--border);
}
.scale .line { flex: 1; height: 1px; background: var(--border); position: relative; }
.scale .line::before {
  content: ''; position: absolute; left: 0; top: -3px; bottom: -3px; width: 1px; background: var(--brass-dim);
}
.scale .label { font-family: 'IBM Plex Mono', monospace; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--brass); }

main { max-width: 80%; margin: 0 auto; padding: 32px 40px 64px; }
.section-heading { font-family: 'Fraunces', serif; font-size: 22px; font-weight: 500; margin-bottom: 4px; }
.section-sub { font-size: 13px; color: var(--ink-faint); margin-bottom: 20px; }
.zig-visual .section-sub { text-align: center; }

.back-link { display: inline-block; font-size: 13px; color: var(--ink-dim); text-decoration: none; margin-bottom: 20px; }
.back-link:hover { color: var(--ink); }

.page-title { font-family: 'Fraunces', serif; font-weight: 500; font-size: 34px; margin-bottom: 20px; }

.grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px;
  margin-bottom: 56px;
}
.card {
  display: block;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px;
  color: inherit;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.card:hover { background: var(--card-hover); border-color: var(--brass-dim); }
.card.disabled { opacity: 0.55; cursor: default; pointer-events: none; }
.card .name { font-size: 15px; font-weight: 500; margin-bottom: 6px; }
.card .desc { font-size: 12px; color: var(--ink-dim); margin-bottom: 14px; line-height: 1.5; }
.card .formula { font-family: 'Fraunces', serif; font-style: italic; font-size: 17px; margin-bottom: 14px; color: var(--ink); }
.card .formula-fib { font-size: 14px; letter-spacing: 0.01em; }
.card .viz { height: 44px; border-radius: 6px; background: var(--bg); border: 1px solid var(--border); }
.card .spiral-anim-svg { display: block; width: 100%; height: auto; border-radius: 6px; background: var(--bg); border: 1px solid var(--border); }
.card .pyth-hero-svg { display: block; width: 100%; height: auto; border-radius: 6px; background: var(--bg); border: 1px solid var(--border); }
.card .normal-hero-svg { display: block; width: 100%; height: auto; border-radius: 6px; background: var(--bg); border: 1px solid var(--border); }
.card .complex-hero-svg { display: block; width: 100%; height: auto; border-radius: 6px; background: var(--bg); border: 1px solid var(--border); }
.normal-hero-curve { fill: none; stroke: var(--brass); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.normal-hero-grid { stroke: var(--border); stroke-width: 1; }
.logistic-hero-stack { position: relative; width: 100%; }
.logistic-hero-canvas { display: block; width: 100%; height: auto; border-radius: 6px; background: var(--bg); border: 1px solid var(--border); }
.logistic-hero-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; border: 1px solid transparent; }
.pyth-hero-bg { fill: var(--surface); stroke: var(--border); stroke-width: 1.5px; }

.detail-mock {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.zig-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: start;
  padding: 48px 40px;
  border-bottom: 1px solid var(--border);
}
.zig-row:last-of-type { border-bottom: none; }
.zig-visual { display: flex; flex-direction: column; align-items: center; gap: 20px; }
.viz-placeholder-box { display: block; width: 100%; aspect-ratio: 3 / 2; border-radius: 8px; background: var(--bg); border: 1px solid var(--border); object-fit: cover; }
img.viz-placeholder-box { border: none; }
.hero-spiral { display: block; width: 100%; max-width: 260px; height: auto; }
.hero-pyth { display: block; width: 100%; max-width: 220px; height: auto; }
.hero-growth { display: block; width: 100%; max-width: 240px; height: auto; }
.growth-curve { fill: none; stroke: var(--brass); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.growth-asymptote { fill: none; stroke: var(--ink-faint); stroke-width: 1; stroke-dasharray: 3 4; }
.growth-axis { stroke: var(--ink-faint); stroke-width: 1; }
.growth-axis-label { font-family: 'IBM Plex Mono', monospace; font-size: 11px; font-style: italic; fill: var(--ink-faint); }
.growth-p0-dot { fill: var(--brass); }
.normal-curve-svg { display: block; width: 100%; max-width: 400px; height: auto; margin: 0 auto; }
.normal-axis { stroke: var(--ink-faint); stroke-width: 1; }
.normal-axis-label { font-family: 'IBM Plex Mono', monospace; font-size: 11px; font-style: italic; fill: var(--ink-faint); }
.normal-curve { fill: none; stroke: var(--brass); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.normal-mu-line { stroke: rgba(247, 243, 232, 0.6); stroke-width: 1; stroke-dasharray: 3 4; }
.normal-controls { max-width: 460px; margin: 14px auto 0; display: flex; flex-direction: column; gap: 8px; }
.normal-control-row { display: flex; align-items: center; gap: 12px; font-family: 'IBM Plex Mono', monospace; font-size: 13px; }
.normal-control-label { color: var(--brass); font-style: italic; min-width: 190px; text-align: left; }
.normal-slider { flex: 1; accent-color: var(--brass); }
.normal-control-value { min-width: 64px; text-align: right; color: var(--ink); }
.normal-rule-svg { display: block; width: 100%; max-width: 400px; height: auto; margin: 0 auto; }
.normal-rule-curve { fill: none; stroke: var(--brass); stroke-width: 1.5; stroke-linecap: round; }
.normal-rule-band-1 { fill: rgba(184, 147, 90, 0.55); stroke: none; }
.normal-rule-band-2 { fill: rgba(184, 147, 90, 0.32); stroke: none; }
.normal-rule-band-3 { fill: rgba(184, 147, 90, 0.16); stroke: none; }
.normal-rule-pct-label { font-family: 'IBM Plex Mono', monospace; font-size: 11px; fill: var(--ink); }
.normal-rule-bracket { stroke: var(--ink-faint); stroke-width: 1; }
.zig-text .eyebrow { font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: var(--brass); letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 12px; }
.zig-text .formula-big { font-family: 'Fraunces', serif; font-style: italic; font-size: 26px; color: var(--brass); }
.zig-text .formula-big-small { font-size: 19px; }
.zig-text .formula-desc { font-size: 14px; color: var(--ink-dim); margin-top: 16px; }
.zig-text p { font-size: 14px; color: var(--ink-dim); margin-bottom: 12px; }
.zig-text p:last-child { margin-bottom: 0; }
.zig-text p a { color: var(--brass); text-decoration: underline; text-underline-offset: 2px; }
.zig-text p a:hover { color: var(--ink); }

.fib-stairs {
  font-family: 'IBM Plex Mono', monospace; font-size: 12px; color: var(--ink-faint); margin-bottom: 20px;
  display: grid; grid-template-columns: auto auto auto auto; align-items: center;
}
.fib-operands { text-align: right; white-space: nowrap; padding: 3px 6px 3px 0; }
.fib-eq-sign { text-align: center; }
.fib-result { color: var(--brass); font-weight: 500; padding: 3px 0 3px 6px; }
.fib-ratio-step { text-align: right; padding-left: 20px; color: var(--ink-faint); }
.fib-ratio-step:not(:empty)::before { content: '\2192\00A0'; }
.fib-tail { margin-left: 6px; margin-bottom: 20px; }
.fib-ratio { font-family: 'Fraunces', serif; font-style: italic; font-size: 20px; color: var(--ink); white-space: nowrap; }
.fib-ratio-note { font-family: 'IBM Plex Sans', sans-serif; font-style: normal; font-size: 12px; color: var(--ink-faint); }

.binet-eq {
  font-family: 'Fraunces', serif; font-style: italic; font-size: 18px; color: var(--brass);
  margin-bottom: 14px; line-height: 2.2;
}
.zig-text .frac { display: inline-flex; flex-direction: column; align-items: center; vertical-align: middle; margin: 0 6px; line-height: 1.3; }
.zig-text .frac .num { padding: 0 4px 2px; border-bottom: 1px solid var(--brass); }
.zig-text .frac .den { padding: 2px 4px 0; }
.binet-table {
  font-family: 'IBM Plex Mono', monospace; font-size: 12px; color: var(--ink-faint);
  display: grid; grid-template-columns: auto auto auto; column-gap: 20px; row-gap: 3px;
}
.binet-th { color: var(--ink-dim); font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; padding-bottom: 6px; border-bottom: 1px solid var(--border); text-align: right; }
.binet-n { text-align: right; color: var(--ink-faint); }
.binet-approx { text-align: right; }
.binet-exact { color: var(--brass); font-weight: 500; text-align: right; }
.binet-ellipsis { color: var(--ink-faint); font-weight: 400; text-align: center; }
.box-diagram { display: flex; flex-direction: column; align-items: center; gap: 18px; }
#box-svg { width: 100%; max-width: 460px; height: auto; border: 1px solid var(--border); border-radius: 6px; }
#sim-svg { width: 100%; max-width: 320px; height: auto; border: 1px solid var(--border); border-radius: 6px; }
.box-rect { transition: opacity 0.25s ease; }
.box-outline {
  fill: none; stroke: var(--brass-dim); stroke-width: 1; stroke-dasharray: 3 4;
  transition: x 0.5s ease, y 0.5s ease, width 0.5s ease, height 0.5s ease;
}
.box-label { font-family: 'IBM Plex Mono', monospace; font-size: 13px; fill: var(--ink-dim); }
.box-label-inner { font-family: 'IBM Plex Mono', monospace; font-size: 13px; font-weight: 600; fill: var(--ink-dim); }
.sim-label { fill: var(--ink); }
.sim-label-faint { fill: var(--ink-faint); }
.sim-stroke { stroke: var(--ink); }
.sim-highlight { transition: fill-opacity 0.5s ease; }
.sim-fade { opacity: 0; transition: opacity 0.5s ease; }
.bifurc-stack { position: relative; width: 100%; max-width: 560px; margin: 0 auto; }
.bifurc-canvas { display: block; width: 100%; height: auto; border: 1px solid var(--border); border-radius: 6px; }
.bifurc-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; cursor: ew-resize; touch-action: none; }
.bifurc-controls { display: flex; align-items: center; gap: 14px; margin-top: 14px; max-width: 560px; width: 100%; margin-left: auto; margin-right: auto; font-family: 'IBM Plex Mono', monospace; font-size: 13px; }
.bifurc-slider { flex: 1; accent-color: var(--brass); }
.bifurc-r-value { min-width: 80px; text-align: right; color: var(--ink); }
.timeseries-wrap { margin-top: 22px; }
.timeseries-canvas { display: block; width: 100%; max-width: 320px; height: auto; border: 1px solid var(--border); border-radius: 6px; margin: 0 auto; }
.step-wrap { margin-top: 22px; }
.step-table {
  font-family: 'IBM Plex Mono', monospace; font-size: 12px; color: var(--ink-faint);
  display: grid; grid-template-columns: auto auto; column-gap: 20px; row-gap: 3px;
  max-width: 160px; margin: 0 auto;
}
.step-th { color: var(--ink-dim); font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; padding-bottom: 6px; border-bottom: 1px solid var(--border); text-align: right; }
.step-n { text-align: right; color: var(--ink-faint); }
.step-value { color: var(--brass); font-weight: 500; text-align: right; }
.reality-table {
  font-family: 'IBM Plex Mono', monospace; font-size: 13px; color: var(--ink-faint);
  display: grid; grid-template-columns: auto auto auto; column-gap: 20px; row-gap: 8px;
  align-items: center; max-width: 340px; margin: 0 auto;
}
.reality-th { color: var(--ink-dim); font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.reality-label { color: var(--ink); }
.reality-value { color: var(--brass); font-weight: 500; text-align: right; }
.normal-example-svg { display: block; width: 100%; max-width: 400px; height: auto; margin: 12px auto 0; }
.normal-example-tail { fill: rgba(184, 147, 90, 0.55); stroke: none; }
.normal-example-caption { margin-top: 8px; margin-bottom: 0; }
.savant-stat { text-align: center; }
.savant-stat-number { font-family: 'Fraunces', serif; font-style: italic; font-weight: 500; font-size: 36px; color: var(--brass); }
.savant-stat-sub { font-family: 'IBM Plex Mono', monospace; font-size: 13px; color: var(--ink-dim); margin-top: 10px; }

/* Kvadratroten av -1 - 2-kolonners variant av reality-table (år/navn, uttrykk/verdi) */
.reality-table.two-col { grid-template-columns: auto auto; }
.reality-reverse { margin-top: 10px; }

/* Kvadratroten av -1 - regnetabell med retningspiler (venstre-mot-høyre, snur på siste rad) */
.reality-table.reality-arrows { grid-template-columns: auto auto auto; column-gap: 10px; }
.reality-arrow { color: var(--ink-faint); text-align: center; font-size: 12px; }

/* Kvadratroten av -1 - statisk rutenett over det komplekse planet */
.complex-grid-svg { display: block; width: 100%; max-width: 320px; height: auto; margin: 20px auto 0; }
.complex-grid-axis { stroke: var(--ink-faint); stroke-width: 1; }
.complex-grid-axis-label { font-family: 'IBM Plex Mono', monospace; font-size: 11px; fill: var(--ink-dim); }
.complex-grid-tick { font-family: 'IBM Plex Mono', monospace; font-size: 11px; font-style: italic; fill: var(--ink-faint); }
.complex-grid-caption { margin-top: 8px; margin-bottom: 0; font-style: italic; }
.complex-grid-dot { fill: var(--brass); }
.complex-grid-point-label { font-family: 'Fraunces', serif; font-style: italic; font-size: 13px; fill: var(--ink); }

/* Kvadratroten av -1 - geometrisk tolkning (punkt z = a+bi, argument φ) */
.complex-arg-svg { display: block; width: 100%; max-width: 320px; height: auto; margin: 4px auto 0; }
.complex-arg-dash { stroke: var(--ink-faint); stroke-width: 1; stroke-dasharray: 3 3; }
.complex-arg-arc { fill: none; stroke: var(--brass-dim); stroke-width: 1; }
.complex-arg-phi-label { font-family: 'Fraunces', serif; font-style: italic; font-size: 13px; fill: var(--brass); }
.complex-arg-vector { stroke: var(--brass); stroke-width: 1.5; }
.complex-arg-dot { fill: var(--brass); }
.complex-arg-point-label { font-family: 'Fraunces', serif; font-style: italic; font-size: 13px; fill: var(--ink); }

/* Kvadratroten av -1 - kort-hero (autoanimert roterende punkt) */
.complex-hero-minor-grid { stroke: var(--border); stroke-width: 1; opacity: 0.4; }
.complex-hero-circle { fill: none; stroke: var(--border); stroke-width: 1; }
.complex-hero-grid { stroke: var(--border); stroke-width: 1; }
.complex-hero-vector { stroke: var(--brass); stroke-width: 1.5; }
.complex-hero-dot { fill: var(--brass); }
.complex-hero-a-arrow { stroke: #7C93A9; stroke-width: 1.5; }
.complex-hero-b-arrow { stroke: #A97C7C; stroke-width: 1.5; }
.complex-hero-caption { margin-top: 8px; margin-bottom: 0; font-size: 11px; font-style: italic; color: var(--ink-faint); text-align: center; }
.complex-hero-readout { margin-top: 10px; display: flex; flex-direction: column; gap: 3px; font-family: 'IBM Plex Mono', monospace; font-size: 11px; }
.complex-hero-readout-row { display: flex; justify-content: space-between; gap: 10px; }
.complex-hero-readout-label { color: var(--brass); font-style: italic; }
.complex-hero-readout-value { color: var(--ink-dim); }
/* Samme blå/rust-par som katetene på Pytagoras-siden (pytagoras-similarity.js) */
.complex-hero-a-color { color: #7C93A9; }
.complex-hero-b-color { color: #A97C7C; }

.box-controls { display: flex; align-items: center; gap: 16px; }
.box-btn {
  width: 30px; height: 30px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface);
  color: var(--ink-dim); font-size: 14px; cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: border-color 0.15s, color 0.15s;
}
.box-btn:hover:not(:disabled) { border-color: var(--brass-dim); color: var(--ink); }
.box-btn:disabled { opacity: 0.35; cursor: default; }
.box-step-label { font-family: 'IBM Plex Mono', monospace; font-size: 12px; color: var(--ink-faint); min-width: 84px; text-align: center; }
.pyth-proof { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.pyth-frame { width: 100%; max-width: 320px; }
.pyth-frame img { display: block; width: 100%; height: auto; transition: opacity 0.25s ease; }
.pyth-frame img.is-switching { opacity: 0; }
.pyth-caption { max-width: 340px; min-height: 42px; text-align: center; font-size: 14px; color: var(--ink-dim); }
#spiral-svg { width: 100%; max-width: 460px; height: auto; }
.spiral-rect { opacity: 0; transition: opacity 0.5s ease; }
.spiral-curve { fill: none; stroke: var(--brass); stroke-width: 1.5; stroke-linecap: round; }
.binet-calc { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; font-family: 'IBM Plex Mono', monospace; font-size: 14px; }
.binet-calc-label { color: var(--ink-dim); }
.binet-calc-input {
  width: 72px; font-family: inherit; font-size: 16px; font-weight: 500; color: var(--ink); background: var(--card);
  border: 1px solid var(--brass-dim); border-radius: 6px; padding: 7px 10px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.binet-calc-input:hover { border-color: var(--brass); }
.binet-calc-input:focus { outline: none; border-color: var(--brass); box-shadow: 0 0 0 3px rgba(184, 147, 90, 0.18); }
.binet-calc-result { display: flex; gap: 24px; flex-wrap: wrap; color: var(--ink-faint); }
.binet-calc-result b { color: var(--ink); font-weight: 500; }
.binet-exact-out { color: var(--brass) !important; }
.binet-calc-note { margin: 0; text-align: center; }
.refs { padding: 28px 40px 36px; }
.refs ul { list-style: none; }
.refs li { display: flex; gap: 10px; align-items: baseline; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.refs li:last-child { border-bottom: none; }
.refs .type { font-family: 'IBM Plex Mono', monospace; font-size: 10px; color: var(--brass); text-transform: uppercase; letter-spacing: 0.06em; min-width: 48px; }
.refs a { color: var(--ink-dim); text-decoration: none; }
.refs a:hover { color: var(--ink); }

/* Kvadratroten av -1 - interaktivt komplekst plan */
.complex-plane-svg { display: block; width: 100%; max-width: 320px; height: auto; margin: 0 auto; }
.complex-unit-circle { fill: none; stroke: var(--border); stroke-width: 1; stroke-dasharray: 3 4; }
.complex-axis { stroke: var(--ink-faint); stroke-width: 1; }
.complex-axis-label { font-family: 'IBM Plex Mono', monospace; font-size: 11px; font-style: italic; fill: var(--ink-faint); }
.complex-marker { fill: var(--ink-faint); }
.complex-marker-label { font-family: 'Fraunces', serif; font-style: italic; font-size: 13px; fill: var(--ink-dim); }
.complex-vector { stroke: var(--brass); stroke-width: 2; stroke-linecap: round; }
.complex-vector-dot { fill: var(--brass); }
.complex-controls { max-width: 320px; margin: 14px auto 0; display: flex; flex-direction: column; gap: 8px; }
.complex-control-row { display: flex; align-items: center; gap: 12px; font-family: 'IBM Plex Mono', monospace; font-size: 13px; }
.complex-control-label { color: var(--brass); font-style: italic; min-width: 150px; text-align: left; }
.complex-slider { flex: 1; accent-color: var(--brass); }
.complex-control-value { min-width: 64px; text-align: right; color: var(--ink); }

/* Logaritmer — interaktiv log-graf (seksjon 1) */
.log-graph-svg {
  display: block;
  width: 100%;
  max-width: 560px;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
}
.log-graph-controls {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 14px;
  max-width: 560px;
  width: 100%;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 13px;
}
.log-graph-slider {
  flex: 1;
  accent-color: var(--brass);
}
.log-graph-base-label {
  min-width: 90px;
  text-align: right;
  color: var(--brass);
  font-style: italic;
}
.log-graph-readout {
  margin-top: 8px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  color: var(--ink-dim);
  text-align: center;
  min-height: 18px;
}

/* Logaritmer — målere (seksjon 4) */
.scale-illustration {
  display: block;
  width: 100%;
  max-width: 400px;
  height: auto;
  margin: 8px auto;
}

/* Logaritmer — eˣ/ln(x)-speilgraf (seksjon 5) */
.log-scales-svg {
  display: block;
  width: 100%;
  max-width: 400px;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
}

/* Logaritmer — regnestav (seksjon 6) */
.slide-rule-stack {
  position: relative;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
}
.slide-rule-canvas {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
}
.slide-rule-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  touch-action: none;
}
.slide-rule-readout {
  margin-top: 12px;
  text-align: center;
}
.slide-rule-equation {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 14px;
  color: var(--ink);
}

/* Logaritmer — hero-kort */
.log-hero-canvas {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 6px;
  background: var(--bg);
  border: 1px solid var(--border);
}

/* Eulers identitet — pseudo-3D helix (seksjon 1) */
.euler-helix-canvas {
  display: block;
  width: 100%;
  max-width: 560px;
  height: auto;
  margin: 0 auto;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
}
.euler-readout {
  max-width: 560px;
  margin: 12px auto 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
}
.euler-readout-row { display: flex; justify-content: space-between; gap: 10px; }
.euler-readout-label { color: var(--ink-dim); }
.euler-readout-value { color: var(--ink); }
.euler-result-readout { margin-top: 14px; text-align: center; }
.euler-result-label { font-family: 'Fraunces', serif; font-style: italic; font-size: 18px; color: var(--ink-dim); margin-right: 8px; }
.euler-result-value { font-family: 'Fraunces', serif; font-style: italic; font-weight: 500; font-size: 26px; color: var(--brass); }

/* Drake-ligningen — interaktiv kalkulator (seksjon 1) */
.drake-controls {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 460px;
  margin: 14px auto 0;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
}
.drake-control-row {
  display: grid;
  grid-template-columns: 124px 1fr 68px;
  align-items: center;
  gap: 10px;
}
.drake-control-label { color: var(--brass); font-style: italic; }
.drake-slider { accent-color: var(--brass); }
.drake-control-value { text-align: right; color: var(--ink); }
.drake-n-readout { margin-top: 22px; text-align: center; }
.drake-n-label { font-family: 'Fraunces', serif; font-style: italic; font-size: 20px; color: var(--ink-dim); margin-right: 8px; }
.drake-n-value { font-family: 'Fraunces', serif; font-style: italic; font-weight: 500; font-size: 32px; color: var(--brass); }

/* Eulers identitet — hero-kort */
.euler-hero-canvas {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 6px;
  background: var(--bg);
  border: 1px solid var(--border);
}

/* Drake-ligningen — hero-kort (jord/sol-loop, lånt fra X5) */
.drake-hero-canvas {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 6px;
  background: var(--bg);
  border: 1px solid var(--border);
}

/* Primtall — hero-kort (Eratosthenes' såld i miniatyr) */
.primes-hero-canvas {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 6px;
  background: var(--bg);
  border: 1px solid var(--border);
}

/* Primtall — interaktivt såld (seksjon 1) */
.sieve-wrap { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.sieve-svg {
  display: block;
  width: 100%;
  max-width: 400px;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
}
.sieve-cell-rect { transition: fill 0.3s ease, stroke 0.3s ease, opacity 0.3s ease; }
.sieve-cell-rect.neutral { fill: var(--card); stroke: var(--border); stroke-width: 1; }
.sieve-cell-rect.one { fill: none; stroke: var(--ink-faint); stroke-width: 1; stroke-dasharray: 2 3; }
.sieve-cell-rect.composite { fill: var(--surface); stroke: var(--border); stroke-width: 1; opacity: 0.5; }
.sieve-cell-rect.current { fill: var(--card); stroke: var(--brass); stroke-width: 2.5; }
.sieve-cell-rect.prime { fill: rgba(184, 147, 90, 0.18); stroke: var(--brass); stroke-width: 1.5; }
.sieve-cell-text { font-family: 'IBM Plex Mono', monospace; font-size: 13px; text-anchor: middle; dominant-baseline: central; transition: fill 0.3s ease, opacity 0.3s ease; }
.sieve-cell-text.neutral { fill: var(--ink-dim); }
.sieve-cell-text.one { fill: var(--ink-faint); font-style: italic; }
.sieve-cell-text.composite { fill: var(--ink-faint); opacity: 0.55; }
.sieve-cell-text.current { fill: var(--brass); font-weight: 500; }
.sieve-cell-text.prime { fill: var(--ink); font-weight: 500; }
.sieve-strike { stroke: var(--ink-faint); stroke-width: 1.3; opacity: 0.55; }
.sieve-caption { max-width: 380px; min-height: 42px; text-align: center; font-size: 14px; color: var(--ink-dim); }

/* Perfekte tall — hero-kort (divisorhjul i miniatyr) */
.perfect-hero-canvas {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 6px;
  background: var(--bg);
  border: 1px solid var(--border);
}

/* Perfekte tall — interaktivt divisorhjul (seksjon 1) */
.wheel-wrap { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.wheel-svg { display: block; width: 100%; max-width: 300px; height: auto; }
.wheel-ref-circle { fill: none; stroke: var(--border); stroke-width: 1; stroke-dasharray: 3 4; }
.wheel-wedge { stroke: var(--bg); stroke-width: 1.5; }
.wheel-wedge-overflow { stroke: var(--bg); stroke-width: 1.5; fill: #A97C7C; }
.wheel-center-label { font-family: 'Fraunces', serif; font-style: italic; font-size: 30px; fill: var(--ink); text-anchor: middle; }
.wheel-center-sub { font-family: 'IBM Plex Mono', monospace; font-size: 12px; text-anchor: middle; }
.wheel-center-sub.is-perfect { fill: var(--brass); }
.wheel-center-sub.is-deficient { fill: #7C93A9; }
.wheel-center-sub.is-abundant { fill: #A97C7C; }
.perfect-calc { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; font-family: 'IBM Plex Mono', monospace; font-size: 14px; justify-content: center; }
.perfect-calc-label { color: var(--ink-dim); }
.perfect-calc-input {
  width: 96px; font-family: inherit; font-size: 16px; font-weight: 500; color: var(--ink); background: var(--card);
  border: 1px solid var(--brass-dim); border-radius: 6px; padding: 7px 10px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.perfect-calc-input:hover { border-color: var(--brass); }
.perfect-calc-input:focus { outline: none; border-color: var(--brass); box-shadow: 0 0 0 3px rgba(184, 147, 90, 0.18); }
.perfect-divisors { font-size: 13px; color: var(--ink-dim); text-align: center; max-width: 320px; }
.perfect-divisors b { color: var(--ink); }
.perfect-verdict { text-align: center; font-family: 'Fraunces', serif; font-style: italic; font-size: 19px; min-height: 26px; }
.perfect-verdict.is-perfect { color: var(--brass); }
.perfect-verdict.is-deficient { color: #7C93A9; }
.perfect-verdict.is-abundant { color: #A97C7C; }

/* Primtall / Perfekte tall — 4-kolonners variant av reality-table */
.reality-table.four-col { grid-template-columns: auto auto auto auto; }

@media (max-width: 720px) {
  header, .scale, main, .refs { padding-left: 20px; padding-right: 20px; }
  main { max-width: 100%; }
  .grid { grid-template-columns: 1fr; }
  .zig-row { grid-template-columns: 1fr; gap: 24px; padding: 32px 20px; }
  .zig-text { order: 1; }
  .zig-visual { order: 2; }
  .page-title { font-size: 26px; }
  .zig-text .formula-big { font-size: 20px; }

  .hero { height: 130px; }

  .complex-control-row { flex-wrap: wrap; }
  .complex-control-label { min-width: 0; }
  .complex-slider { min-width: 0; }

  .drake-control-row { grid-template-columns: 1fr; row-gap: 2px; }
  .drake-control-value { text-align: left; }

  .constants-toggle-label { display: none; }
  .constants-panel { min-width: 190px; }
}

/* Primtall: liten zeta-figur med lenke til grafer */
.zeta-mini { display: flex; flex-direction: column; gap: 10px; width: 100%; max-width: 460px; margin-top: 18px; padding: 16px; border: 1px solid var(--border); background: var(--surface); color: inherit; text-decoration: none; }
.zeta-mini:hover { border-color: var(--brass-dim); }
.zeta-mini-title { font-family: 'Fraunces', serif; font-size: 17px; }
.zeta-mini canvas { width: 100%; aspect-ratio: 1; display: block; }
.zeta-mini-cap { font-size: 12.5px; line-height: 1.5; color: var(--ink-dim); }
.zeta-mini-link { font-family: 'IBM Plex Mono', monospace; font-size: 12px; color: var(--brass); }

/* Footer */
.site-footer { margin-top: 64px; padding: 22px 40px; border-top: 1px solid var(--border); background: var(--surface); font-size: 12.5px; letter-spacing: 0.02em; color: var(--ink-faint); text-align: center; }
.site-footer em { font-family: 'Fraunces', serif; font-style: italic; color: var(--brass); }
