/* ==========================================================================
   ORBITIS — Shared Editorial & Scientific Layout Stylesheet
   ========================================================================== */

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background-color: var(--bg-paper);
  color: var(--ink-primary);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection {
  background: rgba(158, 42, 59, 0.18);
  color: var(--ink-primary);
}

a {
  color: var(--garnet);
  text-decoration: none;
  transition: color var(--duration-fast) ease, border-color var(--duration-fast) ease;
}

a:hover {
  color: var(--garnet-deep);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--ochre);
  outline-offset: 3px;
}

img {
  max-width: 100%;
  display: block;
}

h1, h2, h3, h4 {
  margin: 0;
  color: var(--ink-primary);
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.025em;
}

p {
  margin: 0;
}

code,
pre,
.mono {
  font-family: var(--font-mono);
}

.tabular {
  font-variant-numeric: tabular-nums;
}

.container {
  width: min(var(--max-width), calc(100% - var(--gutter) * 2));
  margin-inline: auto;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Top Navigation ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(250, 246, 238, 0.90);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 68px;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink-primary);
  text-decoration: none;
  flex-shrink: 0;
}

.brand-link:hover {
  color: var(--ink-primary);
}

.brand-mark {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
}

.brand-wordmark {
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1;
}

.nav-wrap {
  display: flex;
  align-items: center;
  gap: clamp(14px, 2.4vw, 30px);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: clamp(14px, 2vw, 26px);
}

.site-nav a {
  color: var(--ink-secondary);
  font-size: 14.5px;
  font-weight: 500;
  padding: 6px 0;
  position: relative;
  white-space: nowrap;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--ink-primary);
}

.site-nav a[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -2px;
  height: 2px;
  background: var(--garnet);
  border-radius: 2px;
}

.lang-toggle {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  background: var(--bg-card);
  padding: 2px;
  gap: 2px;
  flex-shrink: 0;
}

.lang-toggle button {
  border: 0;
  background: transparent;
  color: var(--ink-secondary);
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
  transition: background var(--duration-fast) ease, color var(--duration-fast) ease;
}

.lang-toggle button[aria-pressed="true"] {
  background: var(--bg-dark);
  color: var(--ink-on-dark);
}

/* ---------- Eyebrows, Badges, Buttons ---------- */

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--garnet);
}

.eyebrow::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--garnet);
  flex-shrink: 0;
}

.eyebrow.ochre {
  color: var(--ochre-deep);
}

.eyebrow.ochre::before {
  background: var(--ochre);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.05em;
  padding: 4px 11px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-strong);
  background: var(--bg-vellum);
  color: var(--ink-secondary);
}

.pill.garnet {
  background: var(--garnet-soft);
  border-color: rgba(158, 42, 59, 0.28);
  color: var(--garnet);
}

.pill.ochre {
  background: var(--ochre-soft);
  border-color: rgba(200, 109, 45, 0.30);
  color: var(--ochre-deep);
}

.pill.dark {
  background: var(--bg-dark-elevated);
  border-color: var(--border-dark);
  color: var(--solar-amber);
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 14.5px;
  font-weight: 600;
  border: 1px solid var(--border-strong);
  background: var(--bg-card);
  color: var(--ink-primary);
  transition: transform var(--duration-fast) var(--ease-out),
              background var(--duration-fast) ease,
              border-color var(--duration-fast) ease,
              box-shadow var(--duration-fast) ease;
}

.btn:hover {
  border-color: var(--ink-primary);
  color: var(--ink-primary);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.btn.primary {
  background: var(--garnet);
  border-color: var(--garnet);
  color: #FFFDF9;
}

.btn.primary:hover {
  background: var(--garnet-deep);
  border-color: var(--garnet-deep);
  color: #FFFDF9;
}

.btn.dark-btn {
  background: var(--bg-dark);
  border-color: var(--bg-dark);
  color: var(--ink-on-dark);
}

.btn.dark-btn:hover {
  background: #3F242C;
  color: var(--ink-on-dark);
}

.btn.ghost-dark {
  background: transparent;
  border-color: var(--border-dark);
  color: var(--ink-on-dark);
}

.btn.ghost-dark:hover {
  border-color: var(--solar-amber);
  color: var(--solar-amber);
  background: rgba(242, 166, 90, 0.08);
}

.btn.sm {
  min-height: 36px;
  padding: 6px 14px;
  font-size: 13px;
}

/* ---------- Sections & Editorial Structure ---------- */

.section {
  padding: clamp(56px, 7.5vw, 96px) 0;
  border-top: 1px solid var(--border-subtle);
}

.section.no-border {
  border-top: 0;
}

.section.vellum {
  background: var(--bg-vellum);
}

.section.dark-band {
  background: var(--bg-dark);
  color: var(--ink-on-dark);
  border-top: 1px solid var(--border-dark);
}

.section.dark-band h2,
.section.dark-band h3,
.section.dark-band h4 {
  color: var(--ink-on-dark);
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: clamp(28px, 4vw, 44px);
}

.section-head-copy {
  max-width: 680px;
}

.section-head h2 {
  font-size: clamp(28px, 3.6vw, 44px);
  line-height: 1.16;
  margin-top: 10px;
}

.section-lead {
  color: var(--ink-secondary);
  font-size: clamp(15.5px, 1.3vw, 17.5px);
  line-height: 1.7;
  margin-top: 12px;
}

.dark-band .section-lead {
  color: var(--ink-on-dark-muted);
}

/* ---------- Hero Layout (Home) ---------- */

.hero {
  padding: clamp(44px, 6.2vw, 84px) 0 clamp(52px, 6.8vw, 88px);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: clamp(28px, 5vw, 68px);
  align-items: center;
}

.hero-title {
  font-size: clamp(38px, 5.1vw, 66px);
  line-height: 1.08;
  letter-spacing: -0.032em;
  margin: 16px 0 18px;
}

.hero-title em {
  font-style: italic;
  color: var(--garnet);
  font-weight: 500;
}

.hero-desc {
  font-size: clamp(16px, 1.35vw, 18.5px);
  color: var(--ink-secondary);
  line-height: 1.72;
  max-width: 560px;
  margin-bottom: 28px;
}

.hero-meta-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 34px;
  padding-top: 22px;
  border-top: 1px solid var(--border-subtle);
}

.metric-cell .metric-num {
  font-family: var(--font-display);
  font-size: clamp(24px, 2.5vw, 31px);
  font-weight: 700;
  color: var(--ink-primary);
  line-height: 1.1;
}

.metric-cell .metric-label {
  font-size: 12.5px;
  color: var(--ink-muted);
  margin-top: 4px;
  line-height: 1.45;
}

/* ---------- Interactive Astrolabe Stage (Dark Card) ---------- */

.stage-card {
  background: var(--bg-dark);
  color: var(--ink-on-dark);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-dark);
  padding: 20px 22px 18px;
  box-shadow: var(--shadow-stage);
  position: relative;
  overflow: hidden;
}

.stage-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 75% 24%, rgba(158, 42, 59, 0.28), transparent 56%);
  pointer-events: none;
}

.stage-head {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(212, 188, 181, 0.16);
}

.stage-title {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-on-dark-muted);
}

.stage-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--solar-amber);
  white-space: nowrap;
  flex-shrink: 0;
}

.stage-status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--solar-amber);
  box-shadow: 0 0 10px rgba(242, 166, 90, 0.65);
}

.stage-status.aligned {
  color: var(--blush-rose);
}

.stage-status.aligned::before {
  background: var(--blush-rose);
  box-shadow: 0 0 10px rgba(240, 168, 179, 0.65);
}

.hero-canvas {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1.08;
  cursor: grab;
  touch-action: pan-y;
}

.hero-canvas:active {
  cursor: grabbing;
}

.stage-footer {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 12px;
  border-top: 1px solid rgba(212, 188, 181, 0.16);
}

.stage-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 12px;
  color: var(--ink-on-dark-muted);
}

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

.legend-dot i {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.legend-dot.rose i {
  background: var(--blush-rose);
}

.legend-dot.amber i {
  background: var(--solar-amber);
}

/* ---------- Cards & Grids ---------- */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: clamp(22px, 2.8vw, 30px);
  box-shadow: var(--shadow-sm);
}

.card-hover {
  transition: transform var(--duration-med) var(--ease-out),
              border-color var(--duration-fast) ease,
              box-shadow var(--duration-med) var(--ease-out);
}

.card-hover:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}

.series-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 20px;
}

.series-featured {
  grid-column: span 12;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.95fr);
  gap: clamp(24px, 3.6vw, 48px);
  align-items: center;
  border: 1px solid var(--border-strong);
  background: linear-gradient(135deg, #FFFDF9 0%, #FBF3E8 100%);
  position: relative;
  overflow: hidden;
}

.series-featured::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--garnet) 0%, var(--ochre) 65%, transparent 100%);
}

.series-sub {
  grid-column: span 6;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
}

.series-index {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--ink-muted);
}

.series-card-title {
  font-size: clamp(24px, 2.5vw, 34px);
  line-height: 1.18;
  margin-top: 8px;
}

.series-sub .series-card-title {
  font-size: clamp(21px, 2vw, 25px);
}

.series-card-sub {
  color: var(--ink-secondary);
  margin-top: 10px;
  font-size: 15px;
  line-height: 1.68;
}

.mini-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.mini-stat {
  background: var(--bg-paper);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
}

.mini-stat .k {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.mini-stat .v {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  color: var(--garnet);
  line-height: 1.15;
  margin-top: 4px;
}

.mini-stat .d {
  font-size: 12.5px;
  color: var(--ink-secondary);
  margin-top: 4px;
  line-height: 1.45;
}

/* ---------- 4-Step Logical Chain ---------- */

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

.chain-step {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 22px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chain-num {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--garnet);
  letter-spacing: 0.1em;
}

.chain-step h3 {
  font-size: 19px;
  line-height: 1.28;
}

.chain-step p {
  font-size: 14px;
  color: var(--ink-secondary);
  line-height: 1.62;
}

/* ---------- Paper Page (/face) Specifics ---------- */

.paper-hero {
  padding: clamp(40px, 5.4vw, 72px) 0 clamp(34px, 4.5vw, 56px);
}

.paper-title {
  font-size: clamp(32px, 4.2vw, 54px);
  line-height: 1.13;
  letter-spacing: -0.028em;
  max-width: 960px;
  margin: 16px 0 18px;
}

.author-list {
  font-size: 16px;
  color: var(--ink-primary);
  font-weight: 500;
  margin-bottom: 6px;
}

.affiliation-line {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink-muted);
  letter-spacing: 0.04em;
  margin-bottom: 24px;
}

.claim-banner {
  margin-top: 30px;
  padding: 20px 24px;
  border-left: 3px solid var(--garnet);
  background: var(--bg-card);
  border-top: 1px solid var(--border-subtle);
  border-right: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.claim-banner .label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--garnet);
  margin-bottom: 6px;
}

.claim-banner p {
  font-family: var(--font-display);
  font-size: clamp(17.5px, 1.6vw, 21px);
  line-height: 1.55;
  color: var(--ink-primary);
}

/* Interactive 2D Playground on /face */

.playground-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.16fr) minmax(0, 0.94fr);
  gap: clamp(22px, 3.6vw, 44px);
  align-items: start;
}

.playground-canvas {
  display: block;
  width: 100%;
  aspect-ratio: 1.38;
  margin: 8px 0;
  touch-action: pan-y;
}

.ctrl-card {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.ctrl-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.ctrl-head h3 {
  font-size: 20px;
}

.text-btn {
  border: 0;
  background: transparent;
  color: var(--garnet);
  font-size: 13px;
  font-weight: 600;
  padding: 4px 6px;
}

.text-btn:hover {
  color: var(--garnet-deep);
  text-decoration: underline;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  background: var(--bg-vellum);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.segmented button {
  border: 0;
  background: transparent;
  color: var(--ink-secondary);
  font-size: 13.5px;
  font-weight: 600;
  padding: 9px 10px;
  border-radius: 7px;
  transition: background var(--duration-fast) ease, color var(--duration-fast) ease;
}

.segmented button[aria-pressed="true"] {
  background: var(--bg-dark);
  color: var(--ink-on-dark);
}

.slider-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 14px;
  font-weight: 600;
}

.slider-head output {
  font-family: var(--font-mono);
  font-size: 18px;
  color: var(--garnet);
}

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

.range-ticks {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-muted);
}

.score-bars {
  display: grid;
  gap: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
}

.score-row {
  display: grid;
  grid-template-columns: 7.4em minmax(40px, 1fr) 4.4em;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.score-row .score-val {
  font-family: var(--font-mono);
  font-weight: 600;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.score-track {
  position: relative;
  height: 6px;
  border-radius: var(--radius-pill);
  background: var(--bg-vellum);
  overflow: hidden;
}

.score-zero {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--border-strong);
  z-index: 1;
}

.score-fill {
  position: absolute;
  top: 0;
  bottom: 0;
  background: var(--garnet);
  border-radius: var(--radius-pill);
}

.score-row.is-target .score-fill {
  background: var(--ochre);
}

.check-inline {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: var(--ink-on-dark-muted);
  cursor: pointer;
}

.check-inline input {
  accent-color: var(--blush-rose);
  width: 15px;
  height: 15px;
}

/* ---------- Benchmark Tabs & Tables ---------- */

.tab-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 14px;
}

.tab-btn {
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  color: var(--ink-secondary);
  font-size: 13.5px;
  font-weight: 600;
  padding: 9px 15px;
  border-radius: var(--radius-pill);
  transition: all var(--duration-fast) ease;
}

.tab-btn:hover {
  border-color: var(--border-strong);
  color: var(--ink-primary);
}

.tab-btn[aria-selected="true"] {
  background: var(--garnet);
  border-color: var(--garnet);
  color: #FFFDF9;
}

.protocol-note {
  font-size: 13.5px;
  color: var(--ink-secondary);
  background: var(--bg-vellum);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 20px;
  line-height: 1.6;
}

.data-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-card);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.data-table th,
.data-table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border-subtle);
  text-align: right;
  white-space: nowrap;
}

.data-table th:first-child,
.data-table td:first-child {
  text-align: left;
  font-weight: 600;
  color: var(--ink-primary);
}

.data-table thead th {
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-muted);
  background: var(--bg-vellum);
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.data-table td.hi-garnet {
  color: var(--garnet);
  font-weight: 700;
}

.data-table td.hi-ochre {
  color: var(--ochre-deep);
  font-weight: 600;
}

.data-table td.muted-cell {
  color: var(--ink-muted);
}

.bar-grid {
  display: grid;
  gap: 14px;
  margin-bottom: 24px;
}

.bar-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px 18px;
}

.bar-card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.bar-card-title {
  font-weight: 600;
  font-size: 15px;
  color: var(--ink-primary);
}

.bar-card-sub {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-muted);
}

.bar-series {
  display: grid;
  gap: 7px;
}

.bar-line {
  display: grid;
  grid-template-columns: 15.8em minmax(0, 1fr) 9.4em;
  align-items: center;
  gap: 12px;
  font-size: 13px;
}

.bar-line-label {
  color: var(--ink-secondary);
}

.bar-rail {
  height: 9px;
  background: var(--bg-vellum);
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: var(--radius-pill);
  transition: width 420ms var(--ease-out);
}

.bar-fill.old { background: #7C6A64; }
.bar-fill.direct { background: #D2B8AB; }
.bar-fill.proc { background: var(--garnet); }
.bar-fill.mlp { background: var(--ochre); }
.bar-fill.new { background: var(--bg-dark); }

.bar-val {
  font-family: var(--font-mono);
  font-size: 12.5px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--ink-primary);
}

/* ---------- Code, Math & Citation ---------- */

.formula-box {
  background: var(--bg-dark);
  color: var(--ink-on-dark);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  font-family: var(--font-mono);
  font-size: 14.5px;
  line-height: 1.8;
  overflow-x: auto;
  border: 1px solid var(--border-dark);
}

.formula-box .hl-rose { color: var(--blush-rose); }
.formula-box .hl-amber { color: var(--solar-amber); }
.formula-box .hl-muted { color: var(--ink-on-dark-muted); }

.code-shell {
  background: var(--bg-dark);
  border: 1px solid var(--border-dark);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.code-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-dark);
  background: var(--bg-dark-elevated);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-on-dark-muted);
}

.code-shell pre {
  margin: 0;
  padding: 18px 20px;
  overflow-x: auto;
  color: var(--ink-on-dark);
  font-size: 13px;
  line-height: 1.65;
}

.copy-btn {
  border: 1px solid var(--border-dark);
  background: transparent;
  color: var(--ink-on-dark);
  font-family: var(--font-mono);
  font-size: 11.5px;
  padding: 4px 11px;
  border-radius: var(--radius-sm);
  transition: border-color var(--duration-fast) ease, color var(--duration-fast) ease;
}

.copy-btn:hover {
  border-color: var(--solar-amber);
  color: var(--solar-amber);
}

/* ---------- Brand Manual Page (/brand) ---------- */

.brand-showcase-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.logo-tile {
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  padding: 36px 28px 22px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 26px;
  min-height: 220px;
}

.logo-tile.light { background: var(--bg-paper); }
.logo-tile.white { background: #FFFFFF; }
.logo-tile.dark { background: var(--bg-dark); border-color: var(--border-dark); color: var(--ink-on-dark); }
.logo-tile.garnet { background: var(--garnet); border-color: var(--garnet); color: #FFFDF9; }

.logo-tile-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 92px;
}

.logo-tile-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  padding-top: 14px;
  border-top: 1px solid rgba(128, 100, 96, 0.22);
}

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

.swatch-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.swatch-chip {
  height: 112px;
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 12px 14px;
  cursor: pointer;
  border: 0;
  width: 100%;
  text-align: left;
  transition: opacity var(--duration-fast) ease;
}

.swatch-chip:hover {
  opacity: 0.94;
}

.swatch-hex {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.swatch-copy-hint {
  font-family: var(--font-mono);
  font-size: 10.5px;
  opacity: 0.82;
}

.swatch-meta {
  padding: 14px;
  display: grid;
  gap: 4px;
}

.swatch-name {
  font-weight: 700;
  font-size: 14.5px;
}

.swatch-token {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--garnet);
}

.swatch-role {
  font-size: 12.5px;
  color: var(--ink-secondary);
  line-height: 1.45;
  margin-top: 2px;
}

.anatomy-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: 28px;
  align-items: center;
}

.two-col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
}

.three-col {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 60;
  background: var(--bg-dark);
  color: var(--ink-on-dark);
  border: 1px solid var(--solar-amber);
  font-family: var(--font-mono);
  font-size: 12.5px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms var(--ease-out);
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* ---------- Footer ---------- */

.site-footer {
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-vellum);
  padding: 44px 0 48px;
}

.footer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) repeat(2, minmax(0, 0.8fr));
  gap: 28px;
  align-items: start;
}

.footer-col h4 {
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 12px;
}

.footer-links {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 8px;
  font-size: 14px;
}

.footer-links a {
  color: var(--ink-secondary);
}

.footer-links a:hover {
  color: var(--garnet);
}

.footer-bottom {
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-muted);
}

/* ---------- Responsive Breakpoints ---------- */

@media (max-width: 960px) {
  .hero-grid,
  .series-featured,
  .playground-grid,
  .anatomy-grid,
  .footer-grid {
    grid-template-columns: 1fr;
  }

  .chain-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .series-sub {
    grid-column: span 12;
  }

  .three-col {
    grid-template-columns: 1fr;
  }

  .swatch-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .header-inner {
    flex-wrap: wrap;
    padding: 10px 0 8px;
    gap: 10px;
  }

  .nav-wrap {
    display: contents;
  }

  .lang-toggle {
    order: 1;
  }

  .site-nav {
    order: 2;
    flex-basis: 100%;
    padding-top: 8px;
    border-top: 1px solid var(--border-subtle);
    gap: 18px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .site-nav::-webkit-scrollbar {
    display: none;
  }

  .site-nav a {
    font-size: 13.5px;
    padding: 4px 0 6px;
  }

  .brand-showcase-grid,
  .two-col,
  .chain-grid {
    grid-template-columns: 1fr;
  }

  .hero-meta-strip {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .bar-line {
    grid-template-columns: 9.2em minmax(0, 1fr) 8.4em;
    font-size: 12px;
  }
}

@media (max-width: 480px) {
  .swatch-grid {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
