/* ==========================================================================
   Vibe Discovery Research Blog Stylesheet
   Self-Hosted Computer Modern Serif Typography · High-Contrast Light & Dark
   ========================================================================== */

@font-face {
  font-family: "CMU Serif";
  src: url("assets/fonts/cmu-serif-roman.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "CMU Serif";
  src: url("assets/fonts/cmu-serif-roman.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "CMU Serif";
  src: url("assets/fonts/cmu-serif-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "CMU Serif";
  src: url("assets/fonts/cmu-serif-italic.woff2") format("woff2");
  font-weight: 500;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "CMU Serif";
  src: url("assets/fonts/cmu-serif-bold.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "CMU Serif";
  src: url("assets/fonts/cmu-serif-bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "CMU Serif";
  src: url("assets/fonts/cmu-serif-bolditalic.woff2") format("woff2");
  font-weight: 600;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "CMU Serif";
  src: url("assets/fonts/cmu-serif-bolditalic.woff2") format("woff2");
  font-weight: 700;
  font-style: italic;
  font-display: swap;
}

:root {
  /* Palette 1 (UISDC 626956): Deep Pine #065758 · Ocean Teal #00999F · Mint #BCEDD8 · Lemon #FEEE30 · Glacier Sky #81D2E3 */
  --c-pine: #065758;
  --c-teal: #00999F;
  --c-mint: #BCEDD8;
  --c-lemon: #FEEE30;
  --c-sky: #81D2E3;

  --bg-page: #f4faf9;
  --bg-surface: #ffffff;
  --bg-subtle: #e7f4f2;
  --bg-elevated: #ffffff;
  --bg-code: #e4f3f0;
  --bg-canvas: #041d1e;

  --text-primary: #063839;
  --text-secondary: #1e5355;
  --text-muted: #4b797b;
  --text-on-accent: #ffffff;

  --border-subtle: #c8e5e2;
  --border-strong: #8fc8cc;

  --accent-primary: #065758;
  --accent-primary-hover: #00999F;
  --accent-primary-soft: rgba(188, 237, 216, 0.45);

  --accent-copper: #008288;
  --accent-copper-soft: rgba(129, 210, 227, 0.28);

  --accent-emerald: #065758;
  --accent-emerald-soft: rgba(188, 237, 216, 0.56);

  --accent-ochre: #7d6f00;
  --accent-ochre-soft: rgba(254, 238, 48, 0.34);

  --shadow-sm: 0 1px 3px rgba(6, 87, 88, 0.06);
  --shadow-md: 0 6px 20px rgba(6, 87, 88, 0.10);
  --shadow-lg: 0 18px 44px rgba(4, 38, 39, 0.18);

  --font-serif: "CMU Serif", "Computer Modern Serif", "Latin Modern Roman", Georgia, serif;
  --font-sans: "CMU Serif", "Computer Modern Serif", "Latin Modern Roman", Georgia, serif;
  --font-mono: "CMU Serif", "Computer Modern Serif", "Latin Modern Roman", Georgia, serif;
  --font-math: "CMU Serif", "Computer Modern Serif", "Latin Modern Roman", Georgia, serif;

  --header-height: 62px;
  --radius-sm: 4px;
  --radius-md: 7px;
  --radius-lg: 10px;
}

[data-theme="dark"] {
  --bg-page: #041718;
  --bg-surface: #072325;
  --bg-subtle: #0a2e31;
  --bg-elevated: #0e393c;
  --bg-code: #0b3033;
  --bg-canvas: #031112;

  --text-primary: #eefaf8;
  --text-secondary: #bce2df;
  --text-muted: #7cb4b7;
  --text-on-accent: #041718;

  --border-subtle: #134447;
  --border-strong: #1e6266;

  --accent-primary: #81D2E3;
  --accent-primary-hover: #BCEDD8;
  --accent-primary-soft: rgba(129, 210, 227, 0.16);

  --accent-copper: #00b8bf;
  --accent-copper-soft: rgba(0, 153, 159, 0.22);

  --accent-emerald: #BCEDD8;
  --accent-emerald-soft: rgba(188, 237, 216, 0.16);

  --accent-ochre: #FEEE30;
  --accent-ochre-soft: rgba(254, 238, 48, 0.16);

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.45);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.58);
  --shadow-lg: 0 20px 52px rgba(0, 0, 0, 0.75);
}

/* Base Reset */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + 24px);
  font-size: 17px;
}

body {
  margin: 0;
  background-color: var(--bg-page);
  color: var(--text-primary);
  font-family: var(--font-serif);
  line-height: 1.72;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color 0.2s ease, color 0.2s ease;
}

button,
input,
select,
textarea,
code,
pre,
table,
th,
td {
  font-family: var(--font-serif);
}

.stat-val,
.ledger-table td,
.telemetry-strip {
  font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   Sticky Publication Masthead
   ========================================================================== */
.masthead {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-height);
  background: color-mix(in srgb, var(--bg-page) 90%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-subtle);
}

.masthead::before {
  content: "";
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(
    90deg,
    var(--c-pine) 0% 24%,
    var(--c-teal) 24% 48%,
    var(--c-mint) 48% 68%,
    var(--c-lemon) 68% 82%,
    var(--c-sky) 82% 100%
  );
}

.masthead-inner {
  max-width: 1340px;
  height: 100%;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.masthead-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.journal-tag {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  background: var(--accent-primary-soft);
  color: var(--accent-primary);
  border: 1px solid color-mix(in srgb, var(--accent-primary) 28%, transparent);
  white-space: nowrap;
}

.masthead-title {
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.masthead-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.btn-explorer-nav {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  padding: 7px 13px;
  border-radius: var(--radius-sm);
  background: var(--accent-primary);
  color: #ffffff;
  border: 1px solid var(--accent-primary);
  transition: background 0.15s ease, transform 0.12s ease;
  white-space: nowrap;
}

[data-theme="dark"] .btn-explorer-nav {
  color: #08101c;
}

.btn-explorer-nav:hover {
  background: var(--accent-primary-hover);
  transform: translateY(-1px);
}

.lang-switcher {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-surface);
}

.lang-btn {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 6px 10px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.lang-btn+.lang-btn {
  border-left: 1px solid var(--border-subtle);
}

.lang-btn.active {
  background: var(--text-primary);
  color: var(--bg-page);
}

.theme-btn {
  appearance: none;
  border: 1px solid var(--border-strong);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.theme-btn:hover {
  color: var(--text-primary);
  border-color: var(--text-primary);
}

/* ==========================================================================
   Hero / Paper Frontmatter
   ========================================================================== */
.paper-hero {
  border-bottom: 1px solid var(--border-subtle);
  background: linear-gradient(180deg, #d8efec 0%, #eaf7f5 50%, var(--bg-page) 100%);
  padding: 68px 28px 56px;
}

[data-theme="dark"] .paper-hero {
  background: linear-gradient(180deg, #062b2d 0%, #051e20 55%, var(--bg-page) 100%);
}

.hero-container {
  max-width: 980px;
  margin: 0 auto;
}

.hero-kicker {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 16px;
}

.paper-title {
  font-family: var(--font-serif);
  font-size: clamp(2.0rem, 3.5vw, 2.75rem);
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -0.015em;
  margin: 0 0 20px;
  color: var(--c-pine);
}

[data-theme="dark"] .paper-title {
  color: var(--c-mint);
}

.paper-authors {
  font-family: var(--font-sans);
  font-size: 0.92rem;
  color: var(--text-secondary);
  margin: 0 0 32px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  align-items: center;
}

.paper-authors .affil {
  color: var(--accent-copper);
  font-size: 0.85rem;
}

/* Abstract Block (Zero Math Symbols per Principle 2.5) */
.abstract-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-left: 4px solid var(--c-pine);
  border-top: 2px solid var(--c-mint);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 26px 32px;
  margin-bottom: 18px;
}

[data-theme="dark"] .abstract-box {
  border-left-color: var(--c-sky);
  border-top-color: var(--c-teal);
}

.abstract-label {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--c-pine);
  background: rgba(254, 238, 48, 0.42);
  padding: 2px 10px;
  border-radius: var(--radius-sm);
  margin: 0 0 12px;
}

[data-theme="dark"] .abstract-label {
  color: #041718;
  background: var(--c-lemon);
}

.abstract-text {
  margin: 0;
  font-size: 1.02rem;
  line-height: 1.74;
  color: var(--text-primary);
}

/* Hero CTA & Deep-Link Bar */
.hero-cta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin-bottom: 4px;
}

.btn-hero-3d {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 700;
  text-decoration: none;
  padding: 12px 22px;
  border-radius: var(--radius-md);
  background: var(--accent-primary);
  color: #ffffff;
  box-shadow: var(--shadow-md);
  transition: background 0.15s ease, transform 0.15s ease;
}

[data-theme="dark"] .btn-hero-3d {
  color: #08101c;
}

.btn-hero-3d:hover {
  background: var(--accent-primary-hover);
  transform: translateY(-1.5px);
}

.btn-hero-secondary {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  padding: 11px 18px;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.btn-hero-secondary:hover {
  background: var(--bg-subtle);
  border-color: var(--text-primary);
}

/* Quick Fly-To Strip */
.flyto-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
}

.flyto-strip-label {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-right: 4px;
}

/* Inline 1-Click 3D Fly-To Badges (Used Everywhere in Text & Tables) */
.fly-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 600;
  line-height: 1.3;
  text-decoration: none;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  background: var(--accent-primary-soft);
  color: var(--accent-primary);
  border: 1px solid color-mix(in srgb, var(--accent-primary) 30%, transparent);
  vertical-align: baseline;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  white-space: nowrap;
}

.fly-badge:hover {
  background: var(--accent-primary);
  color: #ffffff;
  border-color: var(--accent-primary);
}

[data-theme="dark"] .fly-badge:hover {
  color: #08101c;
}

.fly-badge.copper {
  background: var(--accent-copper-soft);
  color: var(--accent-copper);
  border-color: color-mix(in srgb, var(--accent-copper) 32%, transparent);
}

.fly-badge.copper:hover {
  background: var(--accent-copper);
  color: #ffffff;
}

[data-theme="dark"] .fly-badge.copper:hover {
  color: #08101c;
}

.fly-badge.emerald {
  background: var(--accent-emerald-soft);
  color: var(--accent-emerald);
  border-color: color-mix(in srgb, var(--accent-emerald) 32%, transparent);
}

.fly-badge.emerald:hover {
  background: var(--accent-emerald);
  color: #ffffff;
}

[data-theme="dark"] .fly-badge.emerald:hover {
  color: #08101c;
}

/* Calm editorial inline 3D links inside prose (zero pill clutter) */
.prose .fly-badge,
.prose .fly-badge.copper,
.prose .fly-badge.emerald {
  background: transparent;
  border: none;
  border-bottom: 1px solid color-mix(in srgb, var(--accent-primary) 38%, transparent);
  border-radius: 0;
  padding: 0 1px;
  font-family: var(--font-sans);
  font-size: 0.93em;
  font-weight: 600;
  color: var(--accent-primary);
}

.prose .fly-badge:hover,
.prose .fly-badge.copper:hover,
.prose .fly-badge.emerald:hover {
  background: var(--accent-primary-soft);
  color: var(--accent-primary-hover);
  border-bottom-color: var(--accent-primary);
}

/* ==========================================================================
   Main Editorial Layout (Sticky Left TOC + Reading Column + Wide Figures)
   ========================================================================== */
.workspace-grid {
  max-width: 1280px;
  margin: 0 auto;
  padding: 56px 28px 104px;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 64px;
  align-items: start;
}

.toc-sidebar {
  position: sticky;
  top: calc(var(--header-height) + 28px);
  font-family: var(--font-sans);
}

.toc-heading {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-muted);
  margin: 0 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-subtle);
}

.toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.toc-link {
  display: block;
  font-size: 0.82rem;
  line-height: 1.4;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 6px 10px;
  border-left: 2px solid transparent;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.toc-link:hover {
  color: var(--text-primary);
  background: var(--bg-subtle);
}

.toc-link.active {
  color: var(--accent-primary);
  font-weight: 700;
  border-left-color: var(--c-teal);
  background: var(--accent-primary-soft);
}

[data-theme="dark"] .toc-link.active {
  border-left-color: var(--c-lemon);
}

.toc-summary-card {
  margin-top: 28px;
  padding: 16px;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-top: 3px solid var(--c-teal);
  box-shadow: var(--shadow-sm);
  font-size: 0.78rem;
}

.toc-summary-card .stat-row {
  display: flex;
  justify-content: space-between;
  padding: 5px 0;
}

.toc-summary-card .stat-val {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--accent-primary);
}

/* Article Body */
.article-main {
  min-width: 0;
}

.paper-section {
  margin-bottom: 84px;
  padding-bottom: 64px;
  border-bottom: 1px solid var(--border-subtle);
}

.paper-section:last-of-type {
  border-bottom: none;
}

.prose {
  max-width: 740px;
}

.sec-num {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--accent-copper);
  display: block;
  margin-bottom: 8px;
}

.paper-section h2 {
  font-family: var(--font-serif);
  font-size: clamp(1.52rem, 2.3vw, 1.92rem);
  line-height: 1.26;
  font-weight: 700;
  margin: 0 0 22px;
  color: var(--c-pine);
  max-width: 820px;
}

[data-theme="dark"] .paper-section h2 {
  color: var(--c-mint);
}

.paper-section h3 {
  font-family: var(--font-serif);
  font-size: 1.22rem;
  line-height: 1.38;
  font-weight: 700;
  margin: 42px 0 14px;
  color: var(--text-primary);
}

.prose p {
  margin: 0 0 20px;
  font-size: 1.06rem;
  line-height: 1.78;
  color: var(--text-primary);
}

.prose ul,
.prose ol {
  margin: 0 0 20px;
  padding-left: 24px;
  font-size: 1.04rem;
}

.prose li {
  margin-bottom: 10px;
}

code {
  font-family: var(--font-mono);
  font-size: 0.86em;
  background: var(--bg-code);
  padding: 2px 5px;
  border-radius: 3px;
}

/* ==========================================================================
   Mathematical Equations (Unboxed per Principle 3.5; Named per Principle 3.4)
   ========================================================================== */
math {
  font-family: var(--font-math);
  font-size: 1.05em;
}

.eq-display {
  max-width: 760px;
  margin: 22px 0;
  padding: 12px 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  overflow-x: auto;
}

.eq-display math {
  font-size: 1.14rem;
  margin: 0 auto;
}

.eq-name {
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-style: italic;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ==========================================================================
   Publication Figures, Animated GIFs & Photo Grids (<=5-line Captions, 9.1)
   ========================================================================== */
.pub-figure {
  margin: 38px 0 46px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.figure-frame {
  position: relative;
  background: #ffffff;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.figure-frame.light-paper-fig {
  background: #ffffff;
  padding: 16px 20px;
}

.figure-frame img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 620px;
  object-fit: contain;
  cursor: zoom-in;
  transition: transform 0.2s ease;
}

.zoom-hint {
  position: absolute;
  right: 12px;
  bottom: 12px;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  background: rgba(22, 25, 29, 0.72);
  color: #f8fafc;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.16s ease;
}

.figure-frame:hover .zoom-hint {
  opacity: 1;
}

.pub-caption {
  padding: 15px 22px;
  font-family: var(--font-sans);
  font-size: 0.855rem;
  line-height: 1.58;
  color: var(--text-secondary);
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-surface);
}

.pub-caption strong {
  color: var(--text-primary);
  font-weight: 700;
}

.fig-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  margin: 28px 0 34px;
}

.fig-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin: 28px 0 34px;
}

.fig-grid-2 .pub-figure,
.fig-grid-3 .pub-figure {
  margin: 0;
  display: flex;
  flex-direction: column;
}

.fig-grid-2 .pub-caption,
.fig-grid-3 .pub-caption {
  flex: 1;
}

/* Graceful Animated Fallback when GIF is rendering/absent */
.gif-fallback-card {
  width: 100%;
  min-height: 230px;
  padding: 28px 24px;
  background: radial-gradient(circle at 25% 30%, #142238 0%, #080d14 75%);
  color: #dce6f5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 12px;
  font-family: var(--font-sans);
}

.gif-fallback-card[hidden] {
  display: none !important;
}

.gif-orbit-pulse {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  border: 1.5px dashed rgba(99, 164, 244, 0.55);
  position: relative;
  animation: spinOrbit 9s linear infinite;
}

.gif-orbit-pulse::after {
  content: "";
  position: absolute;
  top: -4px;
  left: 50%;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #f0825b;
  box-shadow: 0 0 10px #f0825b;
}

@keyframes spinOrbit {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

/* ==========================================================================
   Interactive HTML5 <canvas> Scientific Micro-Widgets
   ========================================================================== */
.widget-card {
  margin: 32px 0 38px;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.widget-header {
  padding: 16px 20px;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.widget-title-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.widget-kicker {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-primary);
}

.widget-title {
  font-family: var(--font-sans);
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.widget-toolbar {
  padding: 12px 20px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  font-family: var(--font-sans);
}

.btn-group {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ctrl-btn {
  appearance: none;
  border: 1px solid var(--border-strong);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.79rem;
  font-weight: 600;
  padding: 6px 11px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.14s ease, border-color 0.14s ease, color 0.14s ease;
}

.ctrl-btn:hover {
  background: var(--bg-subtle);
  border-color: var(--text-primary);
}

.ctrl-btn.active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #ffffff;
}

[data-theme="dark"] .ctrl-btn.active {
  color: #08101c;
}

.ctrl-btn.copper-active.active {
  background: var(--accent-copper);
  border-color: var(--accent-copper);
  color: #ffffff;
}

[data-theme="dark"] .ctrl-btn.copper-active.active {
  color: #08101c;
}

.canvas-stage {
  position: relative;
  background: var(--bg-canvas);
  width: 100%;
}

.canvas-stage canvas {
  display: block;
  width: 100%;
  height: auto;
  cursor: crosshair;
}

.slider-bar {
  padding: 14px 20px;
  background: var(--bg-subtle);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  font-family: var(--font-sans);
  font-size: 0.82rem;
}

.slider-bar label {
  font-weight: 600;
  color: var(--text-secondary);
}

.slider-bar input[type="range"] {
  flex: 1;
  min-width: 180px;
  accent-color: var(--accent-primary);
  cursor: pointer;
}

.telemetry-strip {
  padding: 11px 20px;
  background: var(--bg-code);
  border-top: 1px solid var(--border-subtle);
  font-family: var(--font-mono);
  font-size: 0.77rem;
  color: var(--text-secondary);
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  align-items: center;
}

.telemetry-strip strong {
  color: var(--text-primary);
}

/* ==========================================================================
   Interactive SVG Capability Decomposition & Synthesis Hypergraph (7.5)
   ========================================================================== */
.hypergraph-wrap {
  margin: 28px 0 34px;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.hypergraph-svg-box {
  width: 100%;
  overflow-x: auto;
  padding: 18px 14px 8px;
  background: var(--bg-surface);
}

.hypergraph-svg {
  display: block;
  width: 100%;
  min-width: 820px;
  height: auto;
  font-family: var(--font-sans);
}

.hg-edge {
  fill: none;
  stroke: var(--border-strong);
  stroke-width: 1.8;
  transition: stroke 0.2s ease, stroke-width 0.2s ease, opacity 0.2s ease;
}

.hg-edge.highlighted {
  stroke: var(--accent-primary);
  stroke-width: 3;
  opacity: 1 !important;
}

.hg-edge.dimmed {
  opacity: 0.2;
}

.hg-hyperedge-hull {
  transition: opacity 0.2s ease, stroke-width 0.2s ease;
}

.hg-node {
  cursor: pointer;
  transition: opacity 0.2s ease, transform 0.15s ease;
}

.hg-node.dimmed {
  opacity: 0.28;
}

.hg-node rect {
  transition: stroke-width 0.15s ease, filter 0.15s ease;
}

.hg-node.active rect,
.hg-node:hover rect {
  stroke-width: 2.6;
}

.hypergraph-inspector {
  padding: 16px 22px;
  background: var(--bg-subtle);
  border-top: 1px solid var(--border-subtle);
  font-family: var(--font-sans);
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.hg-inspector-body {
  flex: 1;
  min-width: 260px;
}

.hg-inspector-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 4px;
}

.hg-inspector-desc {
  font-size: 0.85rem;
  line-height: 1.55;
  color: var(--text-secondary);
  margin: 0;
}

/* ==========================================================================
   Interactive Discovery Data Ledger (44 New Discoveries + 2 Volatiles)
   ========================================================================== */
.ledger-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 20px 0 14px;
  font-family: var(--font-sans);
}

.ledger-search {
  font-family: var(--font-sans);
  font-size: 0.84rem;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-surface);
  color: var(--text-primary);
  min-width: 240px;
}

.ledger-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  box-shadow: var(--shadow-sm);
}

.ledger-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-sans);
  font-size: 0.8rem;
  white-space: nowrap;
}

.ledger-table thead {
  background: var(--bg-subtle);
  border-bottom: 2px solid var(--border-strong);
}

.ledger-table th {
  text-align: left;
  padding: 10px 11px;
  font-weight: 700;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}

.ledger-table th:hover {
  color: var(--text-primary);
}

.ledger-table td {
  padding: 9px 11px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
}

.ledger-table tbody tr:hover {
  background: var(--accent-primary-soft);
}

.mono-cell {
  font-family: var(--font-mono);
  font-size: 0.77rem;
}

.group-pill {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.69rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 3px;
}

.group-etno {
  background: var(--accent-copper-soft);
  color: var(--accent-copper);
}

.group-stereo_kbo {
  background: var(--accent-primary-soft);
  color: var(--accent-primary);
}

.group-euclid_gold {
  background: var(--accent-emerald-soft);
  color: var(--accent-emerald);
}

.group-volatile {
  background: var(--accent-ochre-soft);
  color: var(--accent-ochre);
}

.group-moon_binary {
  background: rgba(129, 210, 227, 0.28);
  color: var(--c-pine);
}

[data-theme="dark"] .group-moon_binary {
  background: rgba(129, 210, 227, 0.18);
  color: var(--c-sky);
}

/* ==========================================================================
   Click-to-Zoom Lightbox Modal
   ========================================================================== */
.lightbox-backdrop {
  position: fixed;
  inset: 0;
  z-index: 900;
  background: rgba(6, 9, 14, 0.9);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px;
}

.lightbox-backdrop[hidden] {
  display: none !important;
}

.lightbox-close {
  position: absolute;
  top: 18px;
  right: 22px;
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(20, 26, 36, 0.85);
  color: #ffffff;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.lightbox-img {
  max-width: 94vw;
  max-height: 78vh;
  object-fit: contain;
  border-radius: var(--radius-sm);
  background: #ffffff;
  box-shadow: var(--shadow-lg);
}

.lightbox-caption {
  margin-top: 14px;
  max-width: 860px;
  font-family: var(--font-sans);
  font-size: 0.88rem;
  line-height: 1.5;
  color: #dde5f0;
  text-align: center;
}

/* Footer */
.paper-footer {
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-subtle);
  padding: 36px 24px;
  font-family: var(--font-sans);
  font-size: 0.84rem;
  color: var(--text-secondary);
}

.footer-inner {
  max-width: 1060px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 16px;
}

/* Responsive Breakpoints */
@media (max-width: 1024px) {
  .workspace-grid {
    grid-template-columns: 1fr;
    gap: 28px;
  }

  .toc-sidebar {
    position: static;
    background: var(--bg-surface);
    padding: 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
  }

  .toc-list {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
  }

  .toc-link {
    border-left: none;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
  }

  .fig-grid-3 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .masthead-title {
    display: none;
  }

  .fig-grid-2 {
    grid-template-columns: 1fr;
  }

  .paper-hero {
    padding: 34px 16px 30px;
  }

  .workspace-grid {
    padding: 24px 16px 64px;
  }
}

/* ==========================================================================
   Audit status: banner, ledger badges, cross-portal links
   ========================================================================== */
.masthead-link {
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 6px 10px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

.masthead-link:hover {
  color: var(--accent-primary);
  border-color: var(--accent-primary);
}

.audit-panel {
  border: 1px solid var(--accent-ochre);
  border-left-width: 5px;
  background: var(--accent-ochre-soft);
  border-radius: var(--radius-md);
  padding: 20px 24px 18px;
}

.audit-panel h2 {
  margin-top: 6px;
}

.audit-panel p {
  font-size: 0.97rem;
}

.audit-link-row,
.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
  align-items: center;
}

.realpix-callout {
  border: 1px solid var(--accent-emerald);
  border-left-width: 5px;
  background: var(--accent-emerald-soft);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin: 18px 0 26px;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text-primary);
}

.toc-summary-card .stat-row-lead .stat-val {
  font-size: 1.15em;
}

.toc-summary-card .stat-row-sep {
  border-top: 1px solid var(--border-subtle);
  margin-top: 6px;
  padding-top: 8px;
}

.audit-badge {
  display: inline-block;
  margin-top: 5px;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  white-space: nowrap;
  border: 1px solid transparent;
}

.audit-badge.audit-survivor {
  color: var(--accent-emerald);
  background: var(--accent-emerald-soft);
  border-color: var(--accent-emerald);
}

.audit-badge.audit-disputed {
  color: var(--accent-copper);
  background: var(--accent-copper-soft);
  border-color: var(--accent-copper);
}

.audit-badge.audit-known {
  color: var(--text-secondary);
  background: var(--bg-subtle);
  border-color: var(--border-strong);
}

.audit-badge.audit-volatile {
  color: var(--accent-ochre);
  background: var(--accent-ochre-soft);
  border-color: var(--accent-ochre);
}

.audit-line {
  margin-top: 3px;
  font-family: var(--font-sans);
  font-size: 0.68rem;
  color: var(--text-muted);
  max-width: 230px;
  line-height: 1.35;
}

.ledger-note {
  font-size: 0.72rem;
  color: var(--text-muted);
  max-width: 300px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ledger-row.audit-disputed-row td,
.ledger-row.audit-known-row td {
  background: var(--bg-subtle);
}

.orbit-open {
  color: var(--text-muted);
  font-style: italic;
}

.orbit-dagger {
  color: var(--accent-copper);
  font-style: normal;
  font-weight: 700;
  margin-left: 1px;
  cursor: help;
}

.ledger-summary {
  font-family: var(--font-sans);
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin: 4px 0 12px;
}

.ledger-legend {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  line-height: 1.55;
  color: var(--text-muted);
  margin-top: 12px;
}

.ctrl-btn.chip-survivor.active {
  background: var(--accent-emerald);
  border-color: var(--accent-emerald);
}

.ctrl-btn.chip-disputed.active {
  background: var(--accent-copper);
  border-color: var(--accent-copper);
}

.ctrl-btn.chip-volatile.active {
  background: var(--accent-ochre);
  border-color: var(--accent-ochre);
}

/* The masthead has a fixed height. On narrow screens the two cross-portal links give way to the
   language and theme controls; the hub and the gallery stay reachable from the hero, the audit
   panel and the footer. */
@media (max-width: 900px) {
  .masthead-link {
    display: none;
  }
}

/* ==========================================================================
   Vibe Discovery Short Main Text + Interactive Companion Layout
   ========================================================================== */
.toc-group-label {
  margin: 10px 0 4px;
  padding: 6px 10px 2px;
  border-top: 1px solid var(--border-subtle);
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.toc-group-label:first-of-type {
  margin-top: 2px;
  padding-top: 2px;
  border-top: none;
}

.toc-sidebar .toc-link {
  padding: 4px 10px;
  font-size: 0.8rem;
  line-height: 1.32;
}

.toc-sidebar .toc-summary-card {
  margin-top: 14px;
  padding: 10px 12px;
  font-size: 0.74rem;
}

.toc-sidebar .toc-summary-card .stat-row {
  padding: 2.5px 0;
}

.toc-sidebar .toc-summary-card .stat-row-sep {
  margin-top: 4px;
  padding-top: 5px;
}

.companion-divider {
  margin: 18px 0 60px;
  display: flex;
  align-items: center;
  gap: 16px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--accent-copper);
}

.companion-divider::before,
.companion-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--c-mint), var(--c-sky));
}

.pub-figure.fig-wide .figure-frame img {
  max-height: 780px;
}

.masthead-inner.masthead-clean {
  justify-content: flex-end;
}

/* Hidden-by-default Companion Data disclosure */
.companion-data-section {
  margin-bottom: 40px;
  padding-bottom: 20px;
  border-bottom: none;
}

.companion-data-details {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  overflow: hidden;
  transition: border-color 0.16s ease;
}

.companion-data-details[open] {
  border-color: var(--border-strong);
}

.companion-data-summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 22px;
  font-family: var(--font-sans);
  font-size: 0.94rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-subtle);
  user-select: none;
  transition: color 0.15s ease, background 0.15s ease;
}

.companion-data-summary::-webkit-details-marker {
  display: none;
}

.companion-data-summary:hover {
  color: var(--text-primary);
}

.companion-data-chevron::before {
  content: "▸";
  display: inline-block;
  font-size: 0.9rem;
  color: var(--text-muted);
  transition: transform 0.16s ease;
}

.companion-data-details[open]>.companion-data-summary {
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-subtle);
}

.companion-data-details[open]>.companion-data-summary .companion-data-chevron::before {
  transform: rotate(90deg);
}

.companion-data-body {
  padding: 24px 22px 26px;
}

.companion-audit-panel {
  margin-top: 28px;
}

/* ==========================================================================
   Standalone Below-the-Filter Hero Box & Detailed Sub-Threshold Section
   ========================================================================== */
.subthreshold-hero-box {
  background: var(--bg-subtle);
  border: 1px solid var(--border-strong);
  border-left: 4px solid var(--c-teal);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 20px 28px;
  margin-bottom: 30px;
}

[data-theme="dark"] .subthreshold-hero-box {
  background: var(--bg-surface);
  border-color: var(--border-strong);
  border-left-color: var(--c-mint);
}

.subthreshold-hero-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.subthreshold-label {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--c-pine);
  background: rgba(188, 237, 216, 0.72);
  border: 1px solid color-mix(in srgb, var(--c-teal) 32%, transparent);
  padding: 2px 10px;
  border-radius: var(--radius-sm);
}

[data-theme="dark"] .subthreshold-label {
  color: #041718;
  background: var(--c-mint);
  border-color: transparent;
}

.subthreshold-jump {
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent-copper);
  text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--accent-copper) 40%, transparent);
  transition: color 0.15s ease, border-color 0.15s ease;
}

.subthreshold-jump:hover {
  color: var(--accent-primary);
  border-bottom-color: var(--accent-primary);
}

.subthreshold-text {
  margin: 0;
  font-size: 0.96rem;
  line-height: 1.7;
  color: var(--text-primary);
}

.subthreshold-kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin: 24px 0 26px;
}

.subthreshold-kpi {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-top: 3px solid var(--c-pine);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

[data-theme="dark"] .subthreshold-kpi {
  border-top-color: var(--c-sky);
}

.subthreshold-kpi-accent {
  background: var(--bg-subtle);
  border-color: var(--border-strong);
  border-top-color: var(--c-teal);
}

[data-theme="dark"] .subthreshold-kpi-accent {
  background: var(--bg-elevated);
  border-top-color: var(--c-mint);
}

.subthreshold-kpi-tag {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.subthreshold-kpi-val {
  font-size: 1.55rem;
  line-height: 1.15;
  color: var(--c-pine);
  font-variant-numeric: tabular-nums;
}

[data-theme="dark"] .subthreshold-kpi-val {
  color: var(--c-mint);
}

.subthreshold-kpi-desc {
  font-size: 0.84rem;
  line-height: 1.5;
  color: var(--text-secondary);
}

.subthreshold-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  box-shadow: var(--shadow-sm);
  margin: 0 0 22px;
}

.subthreshold-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
  line-height: 1.5;
}

.subthreshold-table th {
  text-align: left;
  padding: 11px 14px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-secondary);
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border-strong);
  white-space: nowrap;
}

.subthreshold-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
  vertical-align: top;
}

.subthreshold-table tbody tr:last-child td {
  border-bottom: none;
}

.subthreshold-table .num-col {
  text-align: right;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--c-pine);
}

[data-theme="dark"] .subthreshold-table .num-col {
  color: var(--c-sky);
}

.subthreshold-group-row td {
  background: color-mix(in srgb, var(--c-mint) 26%, var(--bg-surface));
  color: var(--c-pine);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: 8px 14px;
  border-top: 1px solid var(--border-strong);
  border-bottom: 1px solid var(--border-strong);
}

[data-theme="dark"] .subthreshold-group-row td {
  background: color-mix(in srgb, var(--c-teal) 20%, var(--bg-surface));
  color: var(--c-mint);
}

.subthreshold-footnote {
  font-size: 0.94rem;
  color: var(--text-secondary);
}

@media (max-width: 820px) {
  .subthreshold-kpi-grid {
    grid-template-columns: 1fr;
  }

  .subthreshold-hero-box {
    padding: 16px 20px;
  }
}