/* =========================================================================
   TIMELINE.ONLINE — Monument Theme (Hall of Liberty inspired)
   Editorial gravitas over modern minimalism.
   - White canvas, warm near-black text, shadow-as-border.
   - Playfair Display Black 900 for the hero (English monument).
   - Pretendard for Korean UI/labels, Noto Serif KR for Korean body.
   - Geist Mono for stats / numeric labels.
   - Single accent: blue link (#0072f5). Everything else grayscale.
   - Museum-label effects: hairline ink rules fading at both ends, kicker
     with wide letter-spacing, pillar list with vertical hairlines.
   ========================================================================= */

/* ---------- Tokens ---------- */
:root {
  /* Color */
  --bg: #ffffff;
  --bg-elevated: #ffffff;
  --surface: #ffffff;
  --surface-tint: #fafafa;
  --surface-hover: #fafafa;
  --border: #ebebeb;
  --border-subtle: #f0f0f0;
  --border-shadow: rgba(0, 0, 0, 0.08);
  --border-shadow-strong: rgba(0, 0, 0, 0.16);
  --text: #171717;
  --text-secondary: #4d4d4d;
  --text-tertiary: #666666;
  --text-muted: #808080;
  --text-disabled: #b3b3b3;
  --link: #0072f5;
  --focus: hsla(212, 100%, 48%, 1);
  --focus-ring: rgba(147, 197, 253, 0.5);
  --accent: #171717;
  --accent-text: #ffffff;
  --shadow-color: rgba(0, 0, 0, 0.06);

  /* Typography (dual-script monument system) */
  --font-sans: "Pretendard", "Inter", -apple-system, BlinkMacSystemFont,
    "Segoe UI", Roboto, sans-serif;
  --font-serif: "Noto Serif KR", "Playfair Display", Georgia,
    "Times New Roman", serif;
  --font-display: "Playfair Display", "Times New Roman", Georgia, serif;
  --font-mono: "Geist Mono", "JetBrains Mono", ui-monospace, SFMono-Regular,
    Menlo, Monaco, Consolas, monospace;

  /* Spacing (4px base, doubling then extending) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;
  --space-20: 80px;
  --space-24: 96px;

  /* Radii */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-pill: 9999px;

  /* Motion */
  --transition-fast: 150ms ease;
  --transition-base: 220ms ease;
  --transition-slow: 350ms ease;
}

/* ---------- Theme: Dark ---------- */
[data-theme="dark"] {
  --bg: #0e0e0e;
  --bg-elevated: #161616;
  --surface: #1a1a1a;
  --surface-tint: #1f1f1f;
  --surface-hover: #232323;
  --border: #2a2a2a;
  --border-subtle: #232323;
  --text: #f5f5f5;
  --text-secondary: #c8c8c8;
  --text-tertiary: #9a9a9a;
  --text-muted: #7a7a7a;
  --text-disabled: #4a4a4a;
  --link: #5eaaff;
  --focus: hsla(212, 100%, 60%, 1);
  --focus-ring: rgba(94, 170, 255, 0.35);
  --accent: #f5f5f5;
  --accent-text: #0e0e0e;
  --shadow-color: rgba(0, 0, 0, 0.5);
}

/* ---------- Theme: Sepia ---------- */
[data-theme="sepia"] {
  --bg: #f5ecdb;
  --bg-elevated: #f9f1e2;
  --surface: #faf2e2;
  --surface-tint: #efe4cf;
  --surface-hover: #ebdfc8;
  --border: #d6c5a3;
  --border-subtle: #e3d4b3;
  --text: #3b2a17;
  --text-secondary: #5a4427;
  --text-tertiary: #6d563a;
  --text-muted: #8a7350;
  --text-disabled: #b6a787;
  --link: #a14a14;
  --focus: hsla(25, 80%, 40%, 1);
  --focus-ring: rgba(161, 74, 20, 0.3);
  --accent: #3b2a17;
  --accent-text: #faf2e2;
  --shadow-color: rgba(75, 50, 20, 0.1);
}

/* ---------- Reset & base ---------- */
* {
  box-sizing: border-box;
}

html {
  font-size: var(--type-base, 16px);
}

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-wrap: pretty;
  font-feature-settings: "liga" 1, "tnum" 1;
  transition: background var(--transition-base), color var(--transition-base);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

a {
  color: var(--link);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* =========================================================================
   MASTHEAD — compact header for graph view
   ========================================================================= */

.masthead {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  z-index: 10;
}

.masthead-inner {
  max-width: 100%;
  margin: 0 auto;
  padding: var(--space-6) var(--space-5) var(--space-4);
  text-align: center;
}

.kicker {
  margin: 0 0 var(--space-2);
  font-family: var(--font-sans);
  font-size: 0.625rem;
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--text);
  font-feature-settings: "liga" 1, "kern" 1, "dlig" 1;
}

.lede {
  margin: var(--space-2) auto 0;
  max-width: 38ch;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: 0.01em;
  color: var(--text);
}

.ink-rule {
  height: 1px;
  margin: var(--space-4) auto;
  background: linear-gradient(
    to right,
    transparent 0%,
    rgba(23, 23, 23, 0.18) 20%,
    rgba(23, 23, 23, 0.18) 80%,
    transparent 100%
  );
  max-width: 720px;
}

.ink-rule--bottom {
  max-width: 480px;
  margin-top: var(--space-4);
  margin-bottom: var(--space-4);
}

[data-theme="dark"] .ink-rule,
[data-theme="sepia"] .ink-rule {
  background: linear-gradient(
    to right,
    transparent 0%,
    currentColor 20%,
    currentColor 80%,
    transparent 100%
  );
  opacity: 0.25;
}

/* Stats bar — compact */
.stats-bar {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 8px;
  margin-bottom: var(--space-3);
}

.stats-number {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.5px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.stats-dot {
  color: var(--text-muted);
  font-size: 0.875rem;
  line-height: 1;
}

.stats-label {
  font-family: var(--font-sans);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text-muted);
}

.stats-sep {
  display: inline-block;
  width: 1px;
  height: 18px;
  background: var(--border);
  margin: 0 var(--space-3);
}

/* Pillars */
.pillars {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0;
  max-width: 760px;
  margin: 0 auto var(--space-3);
}

.pillar {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 0 16px;
  position: relative;
  cursor: pointer;
  background: none;
  border: none;
  transition: opacity var(--transition-fast);
}

.pillar:hover {
  opacity: 0.6;
}

.pillar[aria-pressed="true"] .pillar-ko {
  color: var(--text);
  font-weight: 700;
}

.pillar[aria-pressed="true"] .pillar-en {
  color: var(--text-muted);
}

.pillar-ko {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.04em;
  color: var(--text);
}

.pillar-en {
  font-family: var(--font-mono);
  font-size: 0.5rem;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.pillar-sep {
  width: 1px;
  height: 24px;
  background: rgba(23, 23, 23, 0.12);
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
}

.pillar:last-child .pillar-sep {
  display: none;
}

[data-theme="dark"] .pillar-sep,
[data-theme="sepia"] .pillar-sep {
  background: rgba(245, 245, 245, 0.12);
}

/* Toolbar */
.toolbar {
  margin: var(--space-1) auto var(--space-2);
  max-width: 400px;
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
  align-items: center;
}

.search-wrap {
  position: relative;
  flex: 1 1 240px;
  min-width: 180px;
}

.search-wrap .icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.search-wrap input {
  width: 100%;
  padding: 10px 14px 10px 38px;
  border: none;
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text);
  font-size: 0.875rem;
  box-shadow: 0 0 0 1px var(--border-shadow);
  transition: box-shadow var(--transition-fast);
}

.search-wrap input::placeholder {
  color: var(--text-disabled);
}

.search-wrap input:focus {
  outline: none;
  box-shadow: 0 0 0 2px var(--focus), 0 0 0 4px var(--focus-ring);
}

.meta {
  margin: 0 0 var(--space-2);
  font-size: 0.72rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}

.meta-sep {
  margin: 0 var(--space-2);
}

/* =========================================================================
   GRAPH CONTAINER — full viewport SVG canvas
   ========================================================================= */

.graph-container {
  flex: 1 1 auto;
  position: relative;
  overflow: hidden;
  background: var(--bg);
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

.graph-container:active {
  cursor: grabbing;
}

.graph-container .loading,
.graph-container .empty {
  text-align: center;
  padding: var(--space-16) var(--space-5);
  color: var(--text-muted);
  font-family: var(--font-sans);
}

#graph-svg {
  display: block;
}

/* ---------- Year axis ---------- */

.graph-year-label {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 900;
  fill: var(--text);
  opacity: 0.08;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}

.graph-year-line {
  stroke: var(--text);
  stroke-opacity: 0.06;
  stroke-width: 1;
  pointer-events: none;
}

/* ---------- Edges ---------- */

.graph-edge {
  fill: none;
  stroke-width: 1.5;
  pointer-events: none;
}

.graph-edge--caused_by {
  stroke: var(--text);
  stroke-opacity: 0.3;
  stroke-width: 1.8;
}

.graph-edge--related {
  stroke: var(--text-muted);
  stroke-opacity: 0.15;
  stroke-dasharray: 4 3;
}

/* ---------- Nodes ---------- */

.graph-node {
  cursor: pointer;
}

.graph-node circle {
  fill: var(--surface);
  stroke: var(--text);
  stroke-width: 2;
  transition: r var(--transition-fast), fill var(--transition-fast),
    stroke-width var(--transition-fast);
}

.graph-node.root circle {
  fill: var(--text);
  stroke: var(--text);
}

.graph-node.hover circle {
  stroke-width: 3;
  fill: var(--surface-tint);
}

.graph-node.selected circle {
  fill: var(--link);
  stroke: var(--link);
}

.graph-node.dimmed {
  opacity: 0.25;
}

.graph-node.dimmed circle {
  fill: var(--surface);
  stroke: var(--text-disabled);
  stroke-width: 1;
}

.graph-node-ring {
  fill: none;
  stroke: var(--link);
  stroke-width: 1.5;
  opacity: 0.4;
  animation: node-ring-pulse 1.5s ease-out;
}

@keyframes node-ring-pulse {
  0%   { stroke-opacity: 0.6; r: 16px; }
  100% { stroke-opacity: 0; r: 28px; }
}

.graph-node-label {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  fill: var(--text-secondary);
  pointer-events: none;
  transition: fill var(--transition-fast), font-weight var(--transition-fast);
}

.graph-node.hover .graph-node-label {
  fill: var(--text);
  font-weight: 700;
}

.graph-node.selected .graph-node-label {
  fill: var(--link);
  font-weight: 700;
}

.graph-node.dimmed .graph-node-label {
  fill: var(--text-disabled);
  font-weight: 400;
}

/* =========================================================================
   CARD PANEL — slide-in side panel for event details
   ========================================================================= */

.card-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: min(440px, 100vw);
  height: 100vh;
  background: var(--bg-elevated);
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.08),
    0 0 0 1px var(--border);
  z-index: 200;
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform var(--transition-base);
  display: flex;
  flex-direction: column;
}

.card-panel.open {
  transform: translateX(0);
}

.card-close {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 1px var(--border-shadow);
  transition: color var(--transition-fast), background var(--transition-fast);
  z-index: 10;
}

.card-close:hover {
  color: var(--text);
  background: var(--surface-tint);
}

.card-content {
  padding: var(--space-8) var(--space-6) var(--space-12);
}

/* Card header */
.card-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
  margin-bottom: var(--space-3);
}

.card-date {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
}

.card-category {
  font-family: var(--font-sans);
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.2em 0.6em;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-shadow-strong);
  color: var(--text);
  background: transparent;
}

/* Card title */
.card-title {
  margin: 0 0 var(--space-3);
  font-family: var(--font-sans);
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.5px;
  color: var(--text);
}

.card-summary {
  margin: 0 0 var(--space-4);
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.6;
}

/* Card body */
.card-body {
  margin-bottom: var(--space-5);
}

.card-body p,
.card-body li {
  font-family: var(--font-serif);
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.8;
}

.card-body h3,
.card-body h2,
.card-body h1 {
  font-family: var(--font-sans);
  margin: var(--space-4) 0 var(--space-2);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.2px;
  color: var(--text);
}

.card-body ul,
.card-body ol {
  padding-left: var(--space-5);
  margin: var(--space-2) 0;
}

.card-body a {
  word-break: break-word;
}

/* Card relations */
.card-relations {
  margin-top: var(--space-6);
  padding-top: var(--space-4);
  border-top: 1px dashed var(--border);
}

.rel-group {
  margin-top: var(--space-3);
}

.rel-heading {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 var(--space-2) 0;
}

.rel-count {
  display: inline-block;
  min-width: 1.4rem;
  padding: 0.05em 0.4em;
  text-align: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-elevated);
  text-transform: none;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
}

.card-relations ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.rel-item {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: var(--space-2) var(--space-3);
  align-items: start;
  padding: var(--space-2) var(--space-3);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-left-width: 3px;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
}

.rel-item--cause { border-left-color: var(--text); }
.rel-item--effect { border-left-color: var(--text-muted); }
.rel-item--related { border-left-color: var(--text-disabled); }
.rel-item--mention { border-left-color: var(--border); }

.rel-confidence {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  align-self: center;
  white-space: nowrap;
}

.conf-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

/* Traffic light: high=green, medium=amber, low=red */
.rel-confidence[data-conf="high"] .conf-dot--on { background: #34c759; }
.rel-confidence[data-conf="high"] .conf-dot--off { background: var(--border); }
.rel-confidence[data-conf="medium"] .conf-dot--on { background: #ffcc00; }
.rel-confidence[data-conf="medium"] .conf-dot--off { background: var(--border); }
.rel-confidence[data-conf="low"] .conf-dot--on { background: #ff3b30; }
.rel-confidence[data-conf="low"] .conf-dot--off { background: var(--border); }

[data-theme="dark"] .rel-confidence[data-conf="high"] .conf-dot--off { background: var(--border); }
[data-theme="dark"] .rel-confidence[data-conf="medium"] .conf-dot--off { background: var(--border); }
[data-theme="dark"] .rel-confidence[data-conf="low"] .conf-dot--off { background: var(--border); }

.rel-link {
  display: flex;
  flex-direction: row;
  align-items: baseline;
  gap: 0.5rem;
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  line-height: 1.4;
  flex-wrap: wrap;
  min-width: 0;
}

.rel-link-title {
  flex: 1 1 auto;
  min-width: 0;
}

.rel-link:hover,
.rel-link:focus {
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 2px;
  outline: none;
}

.rel-link--missing {
  color: var(--text-muted);
  font-style: italic;
  font-weight: 500;
}

.rel-date {
  flex: 0 0 auto;
  font-size: 0.72rem;
  font-weight: 400;
  color: var(--text-muted);
  font-family: var(--font-mono);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.rel-evidence {
  grid-column: 1 / -1;
  margin: 0.25rem 0 0 0;
  padding-left: 0.6rem;
  border-left: 2px solid var(--border);
  font-family: var(--font-serif);
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--text-secondary);
}

/* Card sources */
.card-sources {
  margin-top: var(--space-5);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border-subtle);
}

.card-sources h4 {
  margin: 0 0 var(--space-3);
  font-family: var(--font-sans);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--text-muted);
}

.card-sources ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.card-sources li {
  margin-bottom: var(--space-2);
}

.card-sources a {
  display: inline-flex;
  align-items: baseline;
  gap: var(--space-2);
  color: var(--text);
  text-decoration: none;
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 500;
}

.card-sources a::before {
  content: "→";
  color: var(--text-muted);
  font-weight: 500;
}

.card-sources a:hover {
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.card-source-url {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.1rem;
  font-family: var(--font-mono);
}

/* Inline wikilinks */
.wikilink {
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  padding-bottom: 1px;
  transition: border-color var(--transition-fast), color var(--transition-fast);
}

.wikilink:hover,
.wikilink:focus {
  color: var(--link);
  border-bottom-color: var(--link);
  outline: none;
}

.wikilink--missing {
  color: var(--text-muted);
  font-style: italic;
  border-bottom-style: dashed;
  cursor: help;
}

/* Search highlight */
mark {
  background: rgba(0, 114, 245, 0.12);
  color: inherit;
  padding: 0 0.15em;
  border-radius: 2px;
}

[data-theme="sepia"] mark {
  background: rgba(161, 74, 20, 0.15);
}

/* =========================================================================
   COLOPHON
   ========================================================================= */

.colophon {
  flex-shrink: 0;
  text-align: center;
  padding: var(--space-3) var(--space-5);
  color: var(--text-muted);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  border-top: 1px solid var(--border);
  background: var(--bg);
}

/* =========================================================================
   TWEAKS (bottom-right floating panel)
   ========================================================================= */

.tweaks-toggle {
  position: fixed;
  right: var(--space-5);
  bottom: var(--space-5);
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 1px var(--border-shadow-strong),
    0 4px 12px rgba(0, 0, 0, 0.08);
  transition: color var(--transition-fast), transform var(--transition-fast);
  z-index: 100;
}

.tweaks-toggle:hover {
  color: var(--text);
  transform: rotate(30deg);
}

.tweaks-panel {
  position: fixed;
  right: var(--space-5);
  bottom: calc(var(--space-5) + 56px);
  width: min(280px, calc(100vw - var(--space-8)));
  background: var(--surface);
  border: none;
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: 0 0 0 1px var(--border-shadow-strong),
    0 12px 40px rgba(0, 0, 0, 0.12);
  z-index: 100;
  opacity: 0;
  transform: translateY(12px) scale(0.98);
  pointer-events: none;
  transition: opacity var(--transition-base),
    transform var(--transition-base);
}

.tweaks-panel.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.tweaks-panel fieldset {
  border: none;
  padding: 0;
  margin: 0 0 var(--space-4);
}

.tweaks-panel fieldset:last-child {
  margin-bottom: 0;
}

.tweaks-panel legend {
  font-family: var(--font-sans);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: var(--space-2);
}

.segmented {
  display: flex;
  border: 1px solid var(--border-shadow);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.segmented label {
  flex: 1;
  text-align: center;
  padding: var(--space-2) var(--space-1);
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  background: var(--surface);
  color: var(--text-secondary);
  transition: background var(--transition-fast), color var(--transition-fast);
}

.segmented label:has(input:checked) {
  background: var(--text);
  color: var(--bg);
}

.segmented input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.tweaks-panel input[type="range"] {
  width: 100%;
  accent-color: var(--text);
}

/* =========================================================================
   RESPONSIVE
   ========================================================================= */

@media (max-width: 768px) {
  .masthead-inner {
    padding: var(--space-4) var(--space-4) var(--space-3);
  }

  .kicker {
    font-size: 0.5625rem;
    letter-spacing: 0.32em;
  }

  .title {
    font-size: clamp(1.5rem, 8vw, 2rem);
  }

  .lede {
    font-size: 0.8125rem;
  }

  .pillars {
    gap: 0;
  }

  .pillar {
    padding: 0 10px;
  }

  .pillar-sep {
    height: 20px;
  }

  .stats-bar {
    flex-wrap: wrap;
    gap: 4px;
  }

  .stats-sep {
    display: none;
  }

  .stats-number {
    font-size: 1rem;
  }

  .stats-label {
    font-size: 0.625rem;
  }

  .ink-rule {
    margin: var(--space-3) auto;
  }

  .card-panel {
    width: 100vw;
  }

  .tweaks-panel {
    right: var(--space-3);
    bottom: calc(var(--space-3) + 56px);
  }

  .tweaks-toggle {
    right: var(--space-3);
    bottom: var(--space-3);
  }

  .pillar-sep {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}