:root {
  --bg: #F6F3EC;
  --surface: #FFFFFF;
  --surface-warm: #FAF8F3;
  --surface-well: #F2EFE7;
  --ink: #1C1917;
  --ink-2: #44403C;
  --muted: #78716C;
  --border: #E5DFD3;
  --border-strong: #D1C8B8;
  --accent: #C2410C;
  --accent-dark: #9A3412;
  --accent-soft: #FFF7ED;
  --ochre-bg: #FFFBEB;
  --ochre-border: #FDE68A;
  --ochre-ink: #92400E;
  --radius: 10px;
  --radius-sm: 6px;
  --serif: Georgia, "Iowan Old Style", "Palatino Linotype", "Times New Roman", serif;
  --sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0);
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 22px;
}

/* ---- Sticky Editorial Topbar ---- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(253, 251, 247, 0.94);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 10px 22px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

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

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--ink);
  color: #FAF8F3;
  font-family: var(--serif);
  font-size: 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0.03em;
}

.brand-title {
  font-family: var(--serif);
  font-size: 17px;
  color: var(--ink);
  line-height: 1.15;
}

.brand-sub {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.01em;
}

.archive-select-wrap {
  flex: 0 1 290px;
  min-width: 210px;
}

.archive-select {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  padding: 6px 10px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
}

.nav-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  background: #EFEBE1;
  padding: 3px;
  border-radius: 8px;
  flex-wrap: wrap;
}

.nav-tab {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--ink-2);
  font-family: var(--sans);
  font-size: 12.5px;
  font-weight: 550;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.14s, color 0.14s, box-shadow 0.14s;
  white-space: nowrap;
}

.nav-tab:hover { color: var(--ink); background: rgba(255,255,255,0.55); }
.nav-tab.active {
  background: var(--surface);
  color: var(--accent);
  box-shadow: 0 1px 3px rgba(28,25,23,0.09);
}

/* ---- Denominator Ribbon ---- */
.denom-strip {
  background: var(--surface-warm);
  border-bottom: 1px solid var(--border);
  padding: 8px 0;
}

.denom-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.denom-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  color: var(--ink-2);
}

.denom-chip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 11.5px;
}

.denom-chip b {
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.text-btn {
  appearance: none;
  border: none;
  background: none;
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 2px 4px;
  white-space: nowrap;
  flex-shrink: 0;
}
.text-btn:hover { text-decoration: underline; }

.about-drawer {
  padding-top: 10px;
  padding-bottom: 4px;
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.55;
  border-top: 1px dashed var(--border);
  margin-top: 8px;
}

/* ---- Main & Views ---- */
.main-content {
  padding-top: 18px;
  padding-bottom: 56px;
}

.view { display: none; }
.view.active { display: block; }

/* ---- Editorial Banners & Hero ---- */
.hero-card {
  background: linear-gradient(180deg, #FFFFFF 0%, #FAF7F0 100%);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px 28px 22px;
  box-shadow: 0 2px 8px rgba(28, 25, 23, 0.04);
  margin-bottom: 22px;
}

.hero-kicker {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 6px;
}

.hero-title {
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 400;
  letter-spacing: -0.015em;
  line-height: 1.18;
  margin: 0 0 10px 0;
  color: var(--ink);
}

.hero-lead {
  font-size: 14.5px;
  color: var(--ink-2);
  max-width: 900px;
  margin: 0 0 18px 0;
  line-height: 1.58;
}

.method-ribbon {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.method-pill {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 12.5px;
  color: var(--ink-2);
  line-height: 1.42;
}

.method-pill span {
  display: inline-block;
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid #FED7AA;
  padding: 1px 5px;
  border-radius: 4px;
  margin-right: 5px;
}

/* ---- Case Study Chapters ---- */
.cs-chapters {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.cs-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 24px;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
  box-shadow: 0 1px 4px rgba(28, 25, 23, 0.035);
}

.cs-step-kicker {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 4px;
}

.cs-title {
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 400;
  margin: 0 0 8px 0;
  color: var(--ink);
  line-height: 1.25;
}

.cs-body {
  font-size: 13.5px;
  color: var(--ink-2);
  line-height: 1.6;
  margin: 0 0 12px 0;
}

.cs-takeaway {
  background: var(--surface-warm);
  border-left: 3px solid var(--accent);
  padding: 9px 12px;
  border-radius: 0 6px 6px 0;
  font-size: 12.5px;
  color: var(--ink);
  margin-bottom: 14px;
}

.cs-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.cs-evidence {
  background: var(--surface-warm);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 12px;
}

.cs-ev-head {
  font-size: 11.5px;
  font-weight: 650;
  color: var(--ink-2);
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.cs-mini-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.cs-mini-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px;
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s, border-color 0.12s;
}

.cs-mini-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 5px 14px rgba(28, 25, 23, 0.09);
}

.cs-mini-img {
  width: 100%;
  height: 92px;
  background: var(--surface-well);
  border-radius: 4px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cs-mini-img img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.cs-mini-cap {
  margin-top: 5px;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cs-mini-era {
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---- Guide Banner ---- */
.guide-banner {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 9px;
  padding: 11px 16px;
  margin-bottom: 14px;
  display: flex;
  align-items: baseline;
  gap: 11px;
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.5;
}

.guide-badge {
  background: #FEF3C7;
  color: var(--ochre-ink);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 4px;
  white-space: nowrap;
  flex-shrink: 0;
}

.guide-banner code {
  background: #F3EFE6;
  padding: 1px 5px;
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink);
}

/* ---- Presets & Controls ---- */
.preset-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.preset-label {
  font-size: 12px;
  font-weight: 650;
  color: var(--muted);
}

.preset-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.preset-chip {
  appearance: none;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 550;
  padding: 5px 11px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.14s;
}

.preset-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.preset-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #FFFFFF;
}

.note-callout {
  background: var(--ochre-bg);
  border: 1px solid var(--ochre-border);
  border-radius: 8px;
  padding: 8px 13px;
  font-size: 12.5px;
  color: #78350F;
  margin-bottom: 12px;
  line-height: 1.48;
}

.control-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 15px;
  margin-bottom: 14px;
  display: flex;
  gap: 14px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1 1 180px;
  min-width: 0;
}

.field.grow-2 { flex: 2.4 1 320px; }
.field.compact { flex: 0 0 auto; }
.field.align-end { justify-content: flex-end; }
.field.slider-field { flex: 1 1 240px; }

.field label {
  font-size: 11.5px;
  font-weight: 650;
  color: var(--ink-2);
}

.field input[type="text"],
.field input[type="number"],
.field select {
  width: 100%;
  background: var(--surface-warm);
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  padding: 7px 10px;
  font-size: 13px;
  font-family: var(--sans);
  color: var(--ink);
  transition: border-color 0.15s, background 0.15s;
}

.field input:focus, .field select:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
}

.input-action-row {
  display: flex;
  gap: 7px;
}

.input-action-row input { flex: 1; }

.slider-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.mono-pill {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid #FED7AA;
  padding: 1px 7px;
  border-radius: 999px;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
  cursor: pointer;
}

.slider-hint {
  font-size: 11px;
  color: var(--muted);
}

/* ---- Buttons ---- */
.btn-primary {
  appearance: none;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #FFFFFF;
  font-family: var(--sans);
  font-size: 12.5px;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 7px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.14s, transform 0.1s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}
.btn-primary:hover { background: var(--accent-dark); }
.btn-primary.small { padding: 5px 10px; font-size: 12px; }
.btn-primary.full { width: 100%; }

.btn-ghost {
  appearance: none;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink-2);
  font-family: var(--sans);
  font-size: 12.5px;
  font-weight: 550;
  padding: 7px 12px;
  border-radius: 7px;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.14s, color 0.14s, background 0.14s;
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.btn-ghost.small { padding: 4px 10px; font-size: 11.5px; }
.btn-ghost.full { width: 100%; }

.pager-inline {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-icon {
  width: 32px;
  height: 32px;
  border: 1px solid var(--border-strong);
  background: var(--surface-warm);
  border-radius: 7px;
  font-size: 17px;
  line-height: 1;
  color: var(--ink);
  cursor: pointer;
}
.btn-icon:hover { border-color: var(--accent); color: var(--accent); }
.page-readout {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-2);
  min-width: 52px;
  text-align: center;
}

/* ---- Charts Grid ---- */
.charts-row {
  display: grid;
  gap: 14px;
  margin-bottom: 14px;
}

.two-col-clusters { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); }
.two-col-equal { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.two-col-axes { grid-template-columns: minmax(0, 1.35fr) minmax(0, 0.95fr); }

.charts-right-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: 0 1px 3px rgba(28, 25, 23, 0.035);
  min-width: 0;
}

.chart-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 8px;
}

.chart-title {
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 400;
  color: var(--ink);
  margin: 0;
  line-height: 1.25;
}

.chart-sub {
  font-size: 11.5px;
  color: var(--muted);
  margin: 2px 0 0 0;
}

.d3-box {
  width: 100%;
  position: relative;
}

.d3-box svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-top: 8px;
  font-size: 11.5px;
  color: var(--ink-2);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}

/* ---- Calibration 3-Step Switcher ---- */
.calibration-bar {
  margin-bottom: 12px;
}

.band-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.band-card {
  appearance: none;
  text-align: left;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 9px;
  padding: 10px 13px;
  cursor: pointer;
  transition: all 0.14s;
  font-family: var(--sans);
}

.band-card:hover {
  border-color: var(--border-strong);
  background: var(--surface-warm);
}

.band-card.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 2px 8px rgba(194, 65, 12, 0.10);
}

.band-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 650;
  color: var(--ink);
  margin-bottom: 4px;
}

.band-num {
  width: 19px;
  height: 19px;
  border-radius: 50%;
  background: var(--ink-2);
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.band-card.active .band-num { background: var(--accent); }

.band-default-tag {
  margin-left: auto;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: #FFEDD5;
  color: var(--accent-dark);
  padding: 1px 6px;
  border-radius: 4px;
}

.band-desc {
  font-size: 12px;
  color: var(--ink-2);
  line-height: 1.42;
}

/* ---- Gallery & Photo Cards ---- */
.gallery-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.status-line {
  font-size: 13px;
  color: var(--ink-2);
  margin-bottom: 10px;
}

.gallery-toolbar .status-line { margin-bottom: 0; }

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(186px, 1fr));
  gap: 12px;
}

.photo-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 8px;
  cursor: pointer;
  transition: transform 0.14s ease, box-shadow 0.14s ease, border-color 0.14s ease;
  box-shadow: 0 1px 2px rgba(28, 25, 23, 0.04);
  min-width: 0;
}

.photo-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 8px 20px rgba(28, 25, 23, 0.09);
}

.photo-well {
  position: relative;
  width: 100%;
  height: 146px;
  background: var(--surface-well);
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.photo-well img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}

.photo-zoom-hint {
  position: absolute;
  right: 6px;
  bottom: 6px;
  background: rgba(28, 25, 23, 0.72);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  opacity: 0;
  transition: opacity 0.14s;
}

.photo-card:hover .photo-zoom-hint { opacity: 1; }

.photo-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 7px;
  gap: 6px;
}

.photo-badge {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 650;
  color: #fff;
  padding: 1.5px 6px;
  border-radius: 4px;
  max-width: 132px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.photo-idx {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--muted);
}

.photo-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.photo-sub {
  font-size: 11px;
  color: var(--muted);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cat-section {
  margin-bottom: 18px;
}

.cat-section-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 13.5px;
  font-weight: 650;
  color: var(--ink);
}

/* ---- Twins Feature Layout ---- */
.twins-top-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.35fr);
  gap: 14px;
  margin-bottom: 14px;
}

.seed-feature-card {
  display: flex;
  gap: 14px;
  align-items: center;
  cursor: pointer;
}

.seed-feature-card:hover { border-color: var(--accent); }

.seed-thumb {
  width: 150px;
  height: 150px;
  background: var(--surface-well);
  border-radius: 7px;
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.seed-thumb img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.seed-info h3 {
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 400;
  margin: 4px 0 6px;
  line-height: 1.3;
}

.seed-jump-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--ink-2);
}

.seed-jump-wrap input {
  width: 78px;
  padding: 4px 7px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  font-family: var(--mono);
  font-size: 12px;
}

/* ---- D3 Hover Thumbnail Tooltip ---- */
.dot-tooltip {
  position: fixed;
  z-index: 80;
  pointer-events: none;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  padding: 7px;
  width: 210px;
  box-shadow: 0 12px 30px rgba(28, 25, 23, 0.22);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dot-tooltip img {
  width: 100%;
  height: 132px;
  object-fit: contain;
  background: var(--surface-well);
  border-radius: 5px;
}

.tt-title {
  font-size: 11.5px;
  font-weight: 650;
  color: var(--ink);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tt-sub { font-size: 10.5px; color: var(--muted); }
.tt-metric {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
}

/* ---- Full-Scale Archival Lightbox ---- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(18, 16, 14, 0.86);
  backdrop-filter: blur(6px);
}

.lightbox-shell {
  position: relative;
  z-index: 2;
  width: min(1240px, 96vw);
  height: min(860px, 90vh);
  background: #141210;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}

.lb-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 5;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.lb-close:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

.lb-stage {
  position: relative;
  background: #141210;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.lb-img-wrap {
  flex: 1;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 56px;
  cursor: zoom-in;
}

.lb-img-wrap img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}

.lb-img-wrap.zoomed {
  display: block;
  cursor: zoom-out;
  padding: 20px;
}

.lb-img-wrap.zoomed img {
  max-width: none;
  max-height: none;
  width: auto;
  height: auto;
  display: block;
  margin: 0 auto;
}

.lb-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(20, 18, 16, 0.72);
  color: #fff;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  z-index: 3;
}
.lb-nav:hover { background: var(--accent); border-color: var(--accent); }
.lb-prev { left: 14px; }
.lb-next { right: 14px; }

.lb-stage-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 18px;
  background: rgba(255, 255, 255, 0.05);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  color: #D6D3CD;
  font-size: 12px;
}

.lb-stage-btn {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 11.5px;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
}
.lb-stage-btn:hover { background: var(--accent); border-color: var(--accent); }

.lb-sidebar {
  background: #FAF8F3;
  color: var(--ink);
  padding: 22px 20px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  border-left: 1px solid var(--border);
}

.lb-kicker {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  padding-right: 36px;
}

.lb-title {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 400;
  line-height: 1.3;
  margin: 6px 0 12px 0;
  color: var(--ink);
}

.lb-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.lb-pill {
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 3px 8px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-2);
}

.lb-pill.accent {
  background: var(--accent-soft);
  border-color: #FED7AA;
  color: var(--accent-dark);
  font-weight: 700;
}

.lb-desc-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 5px;
}

.lb-desc {
  font-size: 12.5px;
  color: var(--ink-2);
  line-height: 1.55;
  margin: 0 0 20px 0;
  flex: 1;
}

.lb-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: auto;
}

/* ---- Loading Toast ---- */
.loading-toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 90;
  background: var(--ink);
  color: #FAF8F3;
  font-size: 12.5px;
  font-weight: 550;
  padding: 9px 14px;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
}

/* ---- D3 Brush Styling ---- */
.selection {
  fill: rgba(194, 65, 12, 0.14) !important;
  stroke: #C2410C !important;
  stroke-width: 1.5px !important;
}

@media (max-width: 1020px) {
  .two-col-clusters, .two-col-equal, .two-col-axes, .cs-card, .twins-top-grid {
    grid-template-columns: 1fr;
  }
  .method-ribbon, .band-cards {
    grid-template-columns: 1fr;
  }
  .lightbox-shell {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto;
  }
}
