/* chshlab/css/components.css */

/* ── NAV ── */
.nav {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-inline: var(--space-5);
  height: 52px;
  background:
    linear-gradient(180deg, rgba(18, 19, 26, 0.97), rgba(18, 19, 26, 0.9)),
    linear-gradient(90deg, rgba(201, 64, 64, 0.08), transparent 36%, rgba(201, 169, 77, 0.04));
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  transition: background 0.3s ease, border-color 0.3s ease;
}

.nav--scrolled {
  background: rgba(14, 15, 20, 0.95);
  border-bottom-color: rgba(201, 169, 77, 0.12);
}

.nav__logo {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 13px;
  letter-spacing: 0.06em;
  color: var(--text);
  text-decoration: none;
}

.nav__logo span { color: var(--amber); }

.nav__links {
  display: flex;
  gap: var(--space-4);
  list-style: none;
}

.nav__links a {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s ease;
}

.nav__links a:hover { color: var(--text); }

.nav__toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
  width: 40px;
  height: 40px;
  border: 1px solid transparent;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  z-index: 22;
}

.nav__toggle-bar {
  display: block;
  width: 18px;
  height: 1.5px;
  background: currentColor;
  transition: transform 0.25s ease, opacity 0.2s ease;
  transform-origin: center;
}

.nav--open .nav__toggle .nav__toggle-bar:nth-child(1) {
  transform: translateY(5.5px) rotate(45deg);
}

.nav--open .nav__toggle .nav__toggle-bar:nth-child(2) {
  opacity: 0;
}

.nav--open .nav__toggle .nav__toggle-bar:nth-child(3) {
  transform: translateY(-5.5px) rotate(-45deg);
}

/* ── MATH BLOCK ── */
.math-block {
  position: relative;
  background:
    radial-gradient(circle at top right, var(--paper-stain-soft), transparent 34%),
    linear-gradient(180deg, var(--surface-paper), transparent 90%),
    var(--surface-2);
  border: 1px solid var(--border);
  border-left: 3px solid rgba(201, 64, 64, 0.78);
  padding: var(--space-3) var(--space-4);
  margin-block: var(--space-3);
  overflow-x: auto;
  box-shadow: var(--paper-shadow-soft);
}

.math-block::before {
  content: '';
  position: absolute;
  left: var(--space-4);
  right: var(--space-4);
  top: 0;
  height: 1px;
  background: linear-gradient(90deg, rgba(201, 64, 64, 0.55), transparent);
}

.math-block::after {
  content: '';
  position: absolute;
  right: 18px;
  top: 16px;
  width: 80px;
  height: 80px;
  background: radial-gradient(circle, rgba(201, 169, 77, 0.09), transparent 72%);
  pointer-events: none;
}

.math-block__label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: var(--space-2);
  display: inline-flex;
  padding-inline: 3px 7px;
  box-shadow: inset 0 -0.62em 0 var(--marker-crimson-soft);
}

/* ── THEOREM CARD ── */
.theorem-card {
  position: relative;
  background:
    radial-gradient(circle at top right, var(--paper-stain-soft), transparent 34%),
    linear-gradient(180deg, rgba(255,255,255,0.025), rgba(255,255,255,0)),
    linear-gradient(180deg, var(--surface-paper), transparent 88%),
    var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--amber);
  padding: var(--space-4);
  margin-block: var(--space-4);
  overflow: hidden;
  box-shadow: var(--paper-shadow-soft);
  transition: border-color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
}

.theorem-card::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  background: linear-gradient(90deg, rgba(201, 64, 64, 0.65), transparent 55%);
}

.theorem-card::after {
  content: '';
  position: absolute;
  inset: 10px;
  border: 1px solid rgba(255, 248, 230, 0.04);
  pointer-events: none;
}

.theorem-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.28), 0 0 42px -22px rgba(201, 64, 64, 0.26);
}

.theorem-card__number {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--amber);
  text-transform: uppercase;
  display: inline-block;
  padding-inline: 3px 7px;
  box-shadow: inset 0 -0.62em 0 rgba(201, 64, 64, 0.14);
  margin-bottom: var(--space-2);
}

.theorem-card__title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  margin-bottom: var(--space-3);
}

.theorem-card__statement {
  font-style: italic;
  color: var(--text-subtle);
  margin-bottom: var(--space-3);
}

.theorem-card details { margin-top: var(--space-3); }

.theorem-card summary {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--crimson);
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.theorem-card summary::-webkit-details-marker { display: none; }
.theorem-card summary::before {
  content: '+ ';
  display: inline-block;
  transition: transform 0.3s ease;
}
.theorem-card details[open] summary::before {
  transform: rotate(45deg);
}

.theorem-card__proof {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.4s ease, opacity 0.3s ease;
  opacity: 0;
  margin-top: var(--space-3);
}
.theorem-card details[open] .theorem-card__proof {
  grid-template-rows: 1fr;
  opacity: 1;
}
.theorem-card__proof > * {
  overflow: hidden;
}
.theorem-card__proof .proof-body {
  padding-left: var(--space-3);
  position: relative;
  font-size: 0.9rem;
  color: var(--text-muted);
}
.theorem-card__proof .proof-body::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(180deg, var(--crimson), var(--amber));
  transform: scaleY(0);
  transform-origin: top;
  transition: transform 0.4s ease 0.2s;
}
.theorem-card details[open] .theorem-card__proof .proof-body::before {
  transform: scaleY(1);
}
.theorem-card details[open] {
  box-shadow: 0 0 0 1px rgba(100,140,230,0.2);
  transition: box-shadow 0.4s ease;
}

/* ── THEOREM HEADER ── */
.theorem-header {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  margin-bottom: var(--space-3);
}

/* ── THEOREM MATH CONTAINER ── */
.theorem-math {
  margin-block: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background:
    linear-gradient(180deg, rgba(241, 232, 209, 0.05), rgba(255,255,255,0)),
    var(--surface-2);
  border: 1px solid var(--border);
  overflow-x: auto;
  box-shadow: var(--paper-shadow-soft);
}

/* ── FIGURE CARD ── */
.figure-card {
  background:
    radial-gradient(circle at top right, var(--paper-stain-soft), transparent 30%),
    linear-gradient(180deg, var(--surface-paper), transparent 88%),
    var(--surface);
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: var(--paper-shadow-soft);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.4s ease;
  will-change: transform;
}

.figure-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--paper-shadow), 0 0 42px -24px rgba(201, 64, 64, 0.24);
}
.figure-card:hover .figure-card__label {
  color: var(--amber);
}

.figure-card__image-wrap {
  aspect-ratio: 4 / 3;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    linear-gradient(180deg, rgba(241, 232, 209, 0.05), transparent 78%),
    var(--surface-2);
}

.figure-card__image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 0.3s var(--ease);
}

.figure-card:hover .figure-card__image-wrap img {
  transform: scale(1.03);
}

.figure-card__caption {
  padding: var(--space-3) var(--space-4);
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.55;
}

.figure-card__label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--amber);
  display: inline-block;
  padding-inline: 2px 8px;
  box-shadow: inset 0 -0.62em 0 rgba(201, 64, 64, 0.14);
  margin-bottom: var(--space-1);
}

/* ── DEMO CANVAS / SVG CONTAINERS ── */
.demo-canvas-wrap {
  background:
    radial-gradient(circle at top right, var(--paper-stain-soft), transparent 30%),
    linear-gradient(180deg, var(--surface-paper), transparent 88%),
    var(--surface);
  border: 1px solid var(--border);
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  box-shadow: var(--paper-shadow-soft);
}

.demo-canvas-wrap canvas,
.demo-canvas-wrap svg {
  width: 100%;
  display: block;
}

.demo-readout {
  font-family: var(--font-mono);
  font-size: 2rem;
  font-weight: 300;
  letter-spacing: 0.04em;
  text-align: center;
  font-variant-numeric: tabular-nums;
  text-shadow: var(--ink-shadow);
}

.demo-readout__label {
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
  display: inline-block;
  padding-inline: 2px 8px;
  box-shadow: inset 0 -0.62em 0 rgba(201, 64, 64, 0.14);
  margin-bottom: var(--space-1);
}

.demo-readout--classical { color: var(--amber); }
.demo-readout--quantum   { color: var(--blue); }
.demo-readout--artifact  { color: var(--crimson); }

.demo-slider-row {
  display: grid;
  grid-template-columns: 100px 1fr 48px;
  align-items: center;
  gap: var(--space-3);
}

.demo-slider-row label {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

.demo-slider-row span {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-faint);
  text-align: right;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  height: 2px;
  background: var(--border);
  width: 100%;
  cursor: pointer;
}

input[type="range"]:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 6px;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--amber);
  cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--amber);
  border: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb:hover,
input[type="range"]::-webkit-slider-thumb:active {
  box-shadow: 0 0 0 6px rgba(201,169,77,0.15);
}
input[type="range"]::-moz-range-thumb:hover,
input[type="range"]::-moz-range-thumb:active {
  box-shadow: 0 0 0 6px rgba(201,169,77,0.15);
}

/* ── SCROLL REVEAL (initial hidden state — GSAP animates to visible) ── */
.reveal {
  opacity: 0;
  transform: translateY(20px);
}

/* If JS disabled, show everything */
.no-js .reveal {
  opacity: 1;
  transform: none;
}

/* ── READOUT VALUE ── */
.readout-value {
  font-family: var(--font-mono);
  font-size: 2rem;
  font-weight: 300;
  letter-spacing: 0.04em;
  display: block;
  transition: transform 0.15s ease;
}

.readout-value.tick {
  transform: translateY(-2px);
}

/* ── AMBIENT GLOW ── */
@keyframes glowPulse {
  0%, 100% { opacity: 0.4; transform: translate(-50%, -50%) scale(1); }
  50%      { opacity: 0.8; transform: translate(-50%, -50%) scale(1.15); }
}

.ambient-glow {
  position: absolute;
  width: 300px;
  height: 300px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(201,169,77,0.06) 0%, transparent 70%);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation: glowPulse 4s ease-in-out infinite;
  pointer-events: none;
  z-index: 0;
  will-change: transform;
}

/* ── REFERENCES LIST ── */
.references-list {
  list-style: decimal;
  margin-top: var(--space-5);
  padding-left: var(--space-4);
}

.reference-item {
  padding-block: var(--space-3);
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.ref-cite-btn {
  vertical-align: middle;
  font-size: 9px;
  padding: 1px 6px;
  margin-left: 4px;
  opacity: 0.5;
  transition: opacity 0.15s ease;
}

.reference-item:hover .ref-cite-btn {
  opacity: 1;
}

/* ── AMBIENT MUSIC TOGGLE ── */
.ambient-toggle {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(148, 163, 184, 0.15);
  background: rgba(22, 25, 33, 0.80);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  color: var(--text-faint, #64748b);
  font-size: 16px;
  cursor: pointer;
  z-index: 100;
  transition: color 0.2s, border-color 0.2s, box-shadow 0.2s;
  overflow: hidden;
}

.ambient-toggle::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 25%;
  width: 50%;
  height: 1.5px;
  background: var(--crimson, #f87171);
  transform: rotate(-45deg);
  transform-origin: center;
  transition: opacity 0.2s ease;
}

.ambient-toggle:hover {
  color: var(--blue, #60a5fa);
  border-color: rgba(96, 165, 250, 0.3);
}

.ambient-toggle.active {
  color: var(--blue, #60a5fa);
  box-shadow: 0 0 12px rgba(96, 165, 250, 0.2);
}

.ambient-toggle.active::after {
  opacity: 0;
}

@media print {
  .ambient-toggle {
    display: none !important;
  }
}

/* ── SITE FOOTER ── */
.site-footer {
  padding-block: var(--space-6);
  border-top: 1px solid var(--border);
  background: var(--surface);
  position: relative;
  z-index: 10;
}

.site-footer::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: var(--content-width);
  max-width: calc(100% - var(--space-5) * 2);
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--amber), var(--blue), transparent);
  opacity: 0.3;
}

.footer-text {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: var(--space-2);
}

.footer-text--small {
  font-size: 0.75rem;
  color: var(--text-faint);
}

.footer-text a { color: var(--blue); }

/* ── VERDICT READOUT ── */
.demo-readout--verdict { color: var(--text); }

/* ── NAV ACTIVE LINK ── */
.nav-link--active { color: var(--amber) !important; }

/* ── TIMELINE ── */
.timeline-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.timeline-toolbar__hint {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.timeline-toolbar__controls {
  display: flex;
  gap: var(--space-2);
}

.timeline-nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--border);
  background:
    linear-gradient(180deg, rgba(255, 248, 230, 0.08), rgba(255, 248, 230, 0.02)),
    var(--surface);
  color: var(--text);
  box-shadow: var(--paper-shadow-soft);
  transition: border-color var(--dur-fast) ease, color var(--dur-fast) ease, transform var(--dur-fast) ease;
}

.timeline-nav-btn:hover:not(:disabled),
.timeline-nav-btn:focus-visible:not(:disabled) {
  border-color: rgba(79, 163, 212, 0.45);
  color: var(--blue);
  transform: translateY(-1px);
}

.timeline-nav-btn:disabled {
  opacity: 0.38;
  cursor: not-allowed;
  transform: none;
}

.timeline-viewport {
  position: relative;
}

.timeline-viewport::before,
.timeline-viewport::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 42px;
  pointer-events: none;
  z-index: 2;
  opacity: 0;
  transition: opacity var(--dur-fast) ease;
}

.timeline-viewport::before {
  left: 0;
  background: linear-gradient(90deg, var(--bg), transparent);
}

.timeline-viewport::after {
  right: 0;
  background: linear-gradient(90deg, transparent, var(--bg));
}

.timeline-viewport[data-scroll-start="false"]::before {
  opacity: 1;
}

.timeline-viewport[data-scroll-end="false"]::after {
  opacity: 1;
}

.timeline-track {
  display: flex;
  gap: var(--space-5);
  position: relative;
  padding: var(--space-5) var(--space-1) var(--space-4);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  scroll-padding-inline: var(--space-1);
  scrollbar-gutter: stable both-edges;
  scrollbar-width: thin;
  scrollbar-color: var(--amber-dim) transparent;
}

.timeline-line {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(201, 64, 64, 0.26), rgba(201, 169, 77, 0.34), transparent);
  pointer-events: none;
}

.timeline-node {
  flex: 0 0 clamp(148px, 16vw, 182px);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-3);
  background:
    linear-gradient(180deg, var(--surface-paper), transparent 88%),
    var(--surface);
  border: 1px solid var(--border);
  border-left: 2px solid rgba(201, 64, 64, 0.42);
  position: relative;
  z-index: 1;
  box-shadow: var(--paper-shadow-soft);
  scroll-snap-align: start;
  scroll-snap-stop: always;
}

.timeline-node__year {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--amber);
  display: inline-block;
  width: fit-content;
  padding-inline: 2px 7px;
  box-shadow: inset 0 -0.6em 0 rgba(201, 64, 64, 0.14);
}

.timeline-node__title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 500;
}

.timeline-node__note {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.timeline-node__badge {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 2px 6px;
  border: 1px solid;
  width: fit-content;
  margin-top: var(--space-1);
}

.timeline-node__badge--established { border-color: var(--amber-dim); color: var(--amber); }
.timeline-node__badge--contested   { border-color: var(--crimson-dim); color: var(--crimson); }
.timeline-node__badge--resolved    { border-color: var(--blue-dim); color: var(--blue); }

.timeline-status {
  margin-top: var(--space-2);
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ── DEMO EXPORT BUTTONS ── */
.demo-export-btns {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-3);
}

.demo-export-btn {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  padding: var(--space-1) var(--space-2);
  border: 1px solid var(--border);
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}
.demo-export-btn:hover { color: var(--text-muted); border-color: var(--amber-dim); }

/* ── SONIFICATION TOGGLE ── */
.sonification-toggle {
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s, border-color 0.2s;
  flex-shrink: 0;
}
.sonification-toggle:hover { color: var(--text-muted); }
.sonification-toggle--active { color: var(--amber); border-color: var(--amber-dim); }
.sonification-toggle .mute-line { stroke: var(--crimson); }

/* ── BELL TEST SETTING BUTTONS ── */
.belltest-setting-btn {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  padding: var(--space-1) var(--space-3);
  border: 1px solid var(--border);
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
  margin-right: var(--space-2);
  margin-bottom: var(--space-2);
}

.belltest-setting-btn:hover {
  color: var(--text);
  border-color: var(--amber-dim);
}

.belltest-setting-btn--active {
  color: var(--amber);
  border-color: var(--amber);
  background: rgba(201, 169, 77, 0.08);
}

/* ── FIGURE LEGEND ── */
.figure-legend {
  display: flex;
  gap: var(--space-3);
  margin-top: var(--space-2);
  flex-wrap: wrap;
}

.figure-legend__item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--text-faint);
}

.figure-legend__dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.figure-legend__dot--green { background: #6B8F71; }
.figure-legend__dot--red { background: #C94040; }
.figure-legend__dot--amber { background: #C9A94D; }
.figure-legend__dot--blue { background: #4FA3D4; }

.figure-legend__dot--diamond {
  border-radius: 0;
  transform: rotate(45deg);
  width: 7px;
  height: 7px;
}

/* ── KEY STATISTIC HIGHLIGHT ── */
.key-stat {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  padding: 0 6px 1px;
  background: transparent;
  border: none;
  box-shadow: inset 0 -0.58em 0 var(--marker-amber);
  white-space: nowrap;
}
.key-stat--quantum {
  box-shadow: inset 0 -0.58em 0 rgba(79, 163, 212, 0.18);
  color: var(--blue);
}
.key-stat--danger {
  box-shadow: inset 0 -0.58em 0 rgba(201, 64, 64, 0.18);
  color: var(--crimson);
}

/* ── SCROLL HINT (hero) ── */
.scroll-hint {
  position: absolute;
  bottom: var(--space-5);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
  color: var(--text-faint);
  opacity: 0;
  animation: scrollHintIn 0.8s ease 2.8s forwards;
}

.scroll-hint__text {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.scroll-hint__chevron {
  animation: scrollHintBounce 2s ease-in-out infinite;
}

@keyframes scrollHintIn {
  to { opacity: 1; }
}

@keyframes scrollHintBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(4px); }
}

/* Hide scroll hint once user has scrolled */
.scroll-hint--hidden {
  opacity: 0 !important;
  transition: opacity 0.4s ease;
  pointer-events: none;
}

/* ── SKIP LINK ── */
.skip-link {
  position: fixed;
  top: -100%;
  left: var(--space-4);
  z-index: 100;
  font-family: var(--font-mono);
  font-size: 12px;
  padding: var(--space-2) var(--space-4);
  background: var(--amber);
  color: var(--bg);
  text-decoration: none;
  transition: top 0.2s;
}
.skip-link:focus-visible {
  top: var(--space-2);
}

:where(
  .nav__logo,
  .nav__links a,
  .nav__toggle,
  .theorem-card summary,
  .demo-export-btn,
  .sonification-toggle,
  .belltest-setting-btn,
  .section-dot,
  .scroll-top,
  .conclusion-link
):focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 3px;
  border-radius: 2px;
}

/* ── SCROLL PROGRESS BAR ── */
.scroll-progress {
  position: fixed;
  top: 52px; /* below nav */
  left: 0;
  height: 2px;
  width: 0%;
  background: linear-gradient(90deg, var(--amber), var(--blue));
  z-index: 21;
  pointer-events: none;
  transition: width 0.1s linear;
}

/* ── SCROLL-TO-TOP BUTTON ── */
.scroll-top {
  position: fixed;
  bottom: var(--space-5);
  right: var(--space-5);
  z-index: 20;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  background: rgba(14, 15, 20, 0.9);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.3s, transform 0.3s, color 0.2s, border-color 0.2s;
  pointer-events: none;
}
.scroll-top--visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.scroll-top:hover {
  color: var(--amber);
  border-color: var(--amber-dim);
}

/* ── MOBILE NAV (hamburger) ── */
@media (max-width: 600px) {
  .nav__toggle { display: flex; }

  .nav__links {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 52px;
    left: 0;
    right: 0;
    min-height: calc(100svh - 52px);
    overflow-y: auto;
    background:
      linear-gradient(180deg, rgba(14, 15, 20, 0.995), rgba(14, 15, 20, 0.985)),
      rgba(14, 15, 20, 0.99);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    padding: var(--space-4) var(--space-5);
    gap: var(--space-3);
    border-bottom: 1px solid var(--border);
    transform: translateY(-100%);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
    pointer-events: none;
    z-index: 21;
  }

  .nav--open .nav__links {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }

  .nav__links a {
    font-size: 13px;
    padding: var(--space-2) 0;
  }
}

/* ── TIMELINE SCROLL AFFORDANCE ── */
.timeline-wrap {
  position: relative;
  overflow: visible;  /* override .figure-wrap's overflow:hidden to allow .timeline-track scrolling */
}

/* ── HIGH CONTRAST / FORCED COLORS ── */
@media (forced-colors: active) {
  .badge--amber, .badge--blue, .badge--crimson { border-color: ButtonText; color: ButtonText; }
  .timeline-node__badge { border-color: ButtonText; color: ButtonText; }
  .theorem-card__number { color: Highlight; }
  .timeline-nav-btn { border-color: ButtonText; color: ButtonText; }
  .timeline-viewport::before,
  .timeline-viewport::after { display: none; }
}

/* ── SECTION INDICATOR DOTS ── */
.section-dots {
  position: fixed;
  right: var(--space-4);
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 15;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.section-dots--visible {
  opacity: 1;
}

.section-dot {
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  opacity: 0.75;
  transition: opacity 0.2s ease, transform 0.2s ease;
  text-decoration: none;
  cursor: pointer;
}

.section-dot::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-faint);
  opacity: 0.35;
  transition: opacity 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.section-dot:hover {
  transform: scale(1.12);
}

.section-dot:hover::before {
  opacity: 0.7;
}

.section-dot--active::before {
  opacity: 1;
  background: var(--amber);
  transform: scale(1.3);
}

/* Tooltip label on hover */
.section-dot::after {
  content: attr(title);
  position: absolute;
  right: calc(100% + 8px);
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  white-space: nowrap;
  color: var(--text-muted);
  background: rgba(14, 15, 20, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  padding: 3px 8px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.section-dot:hover::after,
.section-dot:focus-visible::after {
  opacity: 1;
}

/* ── EVIDENCE STRIP ── */
.evidence-card {
  background:
    radial-gradient(circle at top right, var(--paper-stain-soft), transparent 30%),
    linear-gradient(180deg, var(--surface-paper), transparent 90%),
    var(--surface);
  border: 1px solid var(--border);
  padding: var(--space-4);
  box-shadow: var(--paper-shadow-soft);
}

.evidence-card--muted {
  border-color: rgba(79, 163, 212, 0.14);
  border-top: 2px solid var(--blue);
}

.evidence-card--muted .evidence-card__value {
  color: var(--blue);
}

.evidence-card--baseline {
  border-top: 2px solid var(--amber);
}

.evidence-card--baseline .evidence-card__value {
  color: var(--amber);
}

.evidence-card--danger {
  border-color: rgba(201, 64, 64, 0.22);
  border-top: 2px solid var(--crimson);
  box-shadow: 0 0 36px -20px rgba(201, 64, 64, 0.28);
}

.evidence-card__label {
  display: block;
  margin-bottom: var(--space-2);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
  display: inline-block;
  width: fit-content;
  padding-inline: 2px 8px;
  box-shadow: inset 0 -0.62em 0 rgba(201, 64, 64, 0.14);
}

.evidence-card__value {
  display: block;
  margin-bottom: var(--space-2);
  font-family: var(--font-mono);
  font-size: clamp(1.25rem, 3vw, 1.8rem);
  font-variant-numeric: tabular-nums;
  color: var(--text);
  text-shadow: var(--ink-shadow);
}

.evidence-card--danger .evidence-card__value {
  color: var(--crimson);
}

.evidence-card__note {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.55;
}

/* ── DASHBOARD + SHARE MODULE ── */
.dashboard-shell {
  display: grid;
  gap: var(--space-5);
}

.dashboard-panel-grid {
  display: grid;
  gap: var(--space-4);
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
}

.dashboard-panel {
  background:
    radial-gradient(circle at top right, var(--paper-stain-soft), transparent 30%),
    linear-gradient(180deg, var(--surface-paper), transparent 88%),
    var(--surface);
  border: 1px solid var(--border);
  padding: var(--space-4);
  box-shadow: var(--paper-shadow-soft);
}

.dashboard-panel__header {
  display: grid;
  gap: var(--space-1);
  margin-bottom: var(--space-3);
}

.dashboard-panel__title {
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 2.2vw, 1.6rem);
  display: inline-block;
  box-shadow: inset 0 -0.14em 0 rgba(201, 64, 64, 0.14);
}

.dashboard-kpis {
  display: grid;
  gap: var(--space-3);
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.dashboard-kpi {
  display: grid;
  gap: var(--space-1);
  padding: var(--space-3);
  border: 1px solid rgba(255, 255, 255, 0.08);
  background:
    linear-gradient(180deg, rgba(241, 232, 209, 0.05), rgba(255,255,255,0.01)),
    linear-gradient(180deg, rgba(255,255,255,0.025), rgba(255,255,255,0.01));
  box-shadow: inset 0 1px 0 rgba(255, 248, 230, 0.04);
}

.dashboard-kpi__label,
.dashboard-chart__label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
  display: inline-block;
  width: fit-content;
  padding-inline: 2px 7px;
  box-shadow: inset 0 -0.6em 0 rgba(201, 64, 64, 0.12);
}

.dashboard-kpi__value {
  font-family: var(--font-mono);
  font-size: clamp(1.35rem, 2vw, 1.8rem);
  color: var(--text);
  font-variant-numeric: tabular-nums;
  text-shadow: var(--ink-shadow);
}

.dashboard-kpi__note,
.dashboard-chart__note,
.share-module__summary {
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.55;
}

.dashboard-charts {
  display: grid;
  gap: var(--space-3);
}

.dashboard-chart {
  display: grid;
  gap: var(--space-2);
}

.dashboard-chart__header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-3);
}

.dashboard-chart__svg {
  width: 100%;
  min-height: 120px;
  display: block;
  border: 1px solid rgba(255, 248, 230, 0.06);
  background:
    linear-gradient(180deg, rgba(241, 232, 209, 0.025), rgba(255,255,255,0)),
    transparent;
}

.dashboard-table-wrap {
  overflow-x: auto;
}

.dashboard-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.dashboard-table th,
.dashboard-table td {
  padding: var(--space-2) var(--space-1);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  vertical-align: top;
}

.dashboard-table thead th {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
  text-align: left;
  border-top: none;
}

.dashboard-table tbody th {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 500;
  color: var(--text);
  text-align: left;
}

.share-module {
  margin-top: var(--space-5);
  display: grid;
  gap: var(--space-3);
  padding: var(--space-4);
  border: 1px solid rgba(79, 163, 212, 0.18);
  background:
    linear-gradient(180deg, rgba(241, 232, 209, 0.05), transparent 86%),
    radial-gradient(circle at top right, rgba(79,163,212,0.08), transparent 36%),
    linear-gradient(180deg, rgba(255,255,255,0.025), rgba(255,255,255,0.01));
  box-shadow: var(--paper-shadow-soft);
}

.share-module__copy {
  display: grid;
  gap: var(--space-2);
}

.share-module__title {
  font-family: var(--font-display);
  font-size: clamp(1.15rem, 2vw, 1.45rem);
  display: inline-block;
  box-shadow: inset 0 -0.14em 0 rgba(201, 64, 64, 0.14);
}

.share-module__summary {
  white-space: pre-line;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.share-module__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.share-module__button {
  min-width: 168px;
  justify-content: center;
}

.share-module__button--platform {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  text-align: center;
}

.share-module__button--platform:hover {
  color: var(--text);
  border-color: var(--amber-dim);
  text-decoration: none;
}

@media (max-width: 900px) {
  .section-dots { display: none; }
  .dashboard-panel-grid {
    grid-template-columns: 1fr;
  }
  .dashboard-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media print {
  .section-dots { display: none; }
}

/* ── MOBILE TOUCH TARGETS ── */
@media (max-width: 600px) {
  .timeline-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }
  .timeline-toolbar__controls {
    width: 100%;
    justify-content: space-between;
  }
  .timeline-nav-btn {
    flex: 1 1 0;
  }
  .belltest-setting-btn {
    min-height: 44px;
    min-width: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  .demo-export-btn {
    min-height: 44px;
    padding: var(--space-2) var(--space-3);
  }
  .conclusion-link {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }
  .dashboard-kpis {
    grid-template-columns: 1fr;
  }
  .share-module__actions {
    flex-direction: column;
    align-items: stretch;
  }
  .timeline-track {
    gap: var(--space-3);
    padding-inline: 0;
  }
  .timeline-node {
    flex: 0 0 min(248px, calc(100vw - 5.5rem));
    padding: var(--space-3);
  }
  input[type="range"] {
    height: 28px;
  }
  input[type="range"]::-webkit-slider-thumb {
    width: 22px;
    height: 22px;
  }
  input[type="range"]::-moz-range-thumb {
    width: 22px;
    height: 22px;
  }
}

/* ── CONTESTED BADGE PULSE ── */
@media (prefers-reduced-motion: no-preference) {
  .timeline-node__badge--contested {
    animation: pulse-contested 2s ease-in-out infinite;
  }
  @keyframes pulse-contested {
    0%, 100% { box-shadow: 0 0 0 rgba(248, 113, 113, 0); }
    50% { box-shadow: 0 0 12px rgba(248, 113, 113, 0.4); }
  }
}

/* ── TIMELINE CONNECTION LINES ── */
@media (prefers-reduced-motion: no-preference) {
  .timeline-node::after {
    content: '';
    position: absolute;
    top: 50%;
    right: -20px;
    width: 20px;
    height: 2px;
    background: linear-gradient(90deg, rgba(201, 64, 64, 0.4), rgba(201, 169, 77, 0.3));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
  }
  .timeline-node:last-child::after {
    display: none;
  }
  .timeline-node.revealed::after {
    transform: scaleX(1);
  }
}

/* ── EVIDENCE CARD VALUE COUNTER ── */
@media (prefers-reduced-motion: no-preference) {
  .evidence-card__value {
    transition: opacity 0.4s ease;
  }
  .evidence-card__value.counting {
    font-variant-numeric: tabular-nums;
  }
}

/* ── PAPER EXCERPT ── */
.paper-excerpt-section {
  padding: var(--space-2) 0 var(--space-3) 0;
}

.paper-excerpt {
  max-width: 700px;
  margin: 0 auto;
}

.paper-excerpt__page {
  background: rgba(22, 25, 33, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(148, 163, 184, 0.10);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
  padding: 48px 56px 48px 80px;
  position: relative;
  transition: border-color 0.3s ease;
  font-family: 'EB Garamond', 'Georgia', serif;
  color: var(--text, #e2e8f0);
  line-height: 1.75;
  font-size: 1.05rem;
}

.paper-excerpt__page:hover {
  border-color: rgba(148, 163, 184, 0.18);
}

/* Left margin line — removed for dark theme */
.paper-excerpt__page::before {
  display: none;
}

.paper-excerpt__margin {
  position: absolute;
  left: 12px;
  top: 48px;
  width: 50px;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-family: var(--font-mono, monospace);
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--blue, #60a5fa);
  opacity: 0.5;
}

.paper-excerpt__text {
  margin-bottom: 1.2em;
}

.paper-excerpt__text:last-child {
  margin-bottom: 0;
}

/* Red highlighter marks — animated */
.redmark {
  background-image: linear-gradient(
    to right,
    rgba(248, 100, 100, 0.25) 0%,
    rgba(248, 100, 100, 0.20) 40%,
    rgba(248, 100, 100, 0.28) 100%
  );
  background-repeat: no-repeat;
  background-size: 0% 85%;
  background-position: 0 60%;
  padding: 1px 2px;
  transition: background-size 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  border-radius: 2px;
}

.redmark.revealed {
  background-size: 100% 85%;
}

@media (prefers-reduced-motion: reduce) {
  .paper-excerpt__page {
    transition: none;
  }
  .redmark {
    transition: none;
    background-size: 100% 85%;
  }
}

@media (max-width: 600px) {
  .paper-excerpt__page {
    padding: 32px 24px 32px 48px;
    font-size: 0.95rem;
  }
  .paper-excerpt__margin {
    left: 4px;
    width: 28px;
    font-size: 8px;
  }
}

/* ── INTERFERENCE VISUALIZATION ── */
.interference-section {
  position: relative;
  width: 100%;
  height: 150px;
  overflow: hidden;
}

.interference-section::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to bottom, rgba(14, 15, 20, 0.95) 0%, transparent 30%, transparent 70%, rgba(14, 15, 20, 0.95) 100%),
    radial-gradient(ellipse at center, transparent 30%, rgba(14, 15, 20, 0.7) 100%);
  pointer-events: none;
}

.interference-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.interference-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: var(--space-3) var(--space-4);
  background: linear-gradient(transparent, rgba(22, 25, 33, 0.8));
  pointer-events: none;
}

.interference-label {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-faint);
  text-align: center;
  letter-spacing: 0.06em;
}

/* CSS fallback for no-WebGL */
.interference-fallback {
  display: none;
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(
      90deg,
      rgba(96, 165, 250, 0.08) 0px,
      rgba(96, 165, 250, 0.15) 12px,
      transparent 12px,
      transparent 24px,
      rgba(201, 64, 64, 0.06) 24px,
      rgba(201, 64, 64, 0.1) 36px,
      transparent 36px,
      transparent 48px
    );
  animation: interference-drift 8s linear infinite;
}

.interference-section.no-webgl .interference-fallback {
  display: block;
}

.interference-section.no-webgl .interference-canvas {
  display: none;
}

@keyframes interference-drift {
  0% { background-position: 0 0; }
  100% { background-position: 48px 0; }
}

@media (prefers-reduced-motion: reduce) {
  .interference-fallback {
    animation: none;
  }
}

/* ── PRINT STYLES ── */
@media print {
  body::before, body::after,
  #starfield, .atmosphere-layer,
  .nav, .scroll-progress, .scroll-top,
  .sonification-toggle, .demo-export-btns,
  .skip-link { display: none !important; }
  body { opacity: 1 !important; background: white !important; color: black !important; }
  .beat, .section { padding-block: 1em; break-inside: avoid; }
  .figure-wrap { border-color: #ccc; }
  .section-rule { background: #ccc; transform: scaleX(1); }
  a { color: #1a0dab; }
  .badge { border-color: #666; color: #333; }
  .reveal { opacity: 1 !important; transform: none !important; }
}
