/* FILE: /style.css */
/* ARCHIVAL OBSERVATORY THEME
   Scope: Component-scoped via :where() prefixes. Uses modern CSS features. */
@import url('/css/fonts.css');
:root {
  --bg-base: #050a05;
  --bg-surface: #0a140a;
  --bg-panel: #0e1a0e;
  --text-primary: #d6f5d6;
  --text-muted: #7fbf7f;
  --accent-ink: #33ff66;
  --accent-line: #1a6b1a;
  --line-dim: #0d3d0d;
  --highlight: #1a4d1a;
  --font-serif: "Georgia", "Times New Roman", serif;
  --font-sans: system-ui, -apple-system, sans-serif;
  --space-xs: clamp(0.25rem, 0.25vw + 0.1rem, 0.5rem);
  --space-md: clamp(0.75rem, 0.75vw + 0.2rem, 1.5rem);
  --space-lg: clamp(1.5rem, 2vw + 0.5rem, 3rem);
  --radius-sm: 4px;
  --transition-fast: 150ms ease;
}

*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: "Courier New", monospace;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }

.site-header {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center;
  padding: var(--space-md); border-bottom: 1px solid var(--accent-line);
  position: sticky; top: 0; background: var(--bg-base); z-index: 100;
}
.brand-title { font-family: "TimeNR", var(--font-serif); font-size: clamp(1.2rem, 2vw, 1.8rem); margin: 0; letter-spacing: 0.08em; }
.main-nav ul { display: flex; gap: var(--space-md); list-style: none; margin: 0; padding: 0; }
.main-nav a { color: var(--text-muted); padding: 0.25rem 0; border-bottom: 1px solid transparent; font-family: "LEDLIGHT", var(--font-sans); font-size: 1.1rem; }
.main-nav a.active { color: var(--text-primary); border-bottom: none; font-family: "Glitch", var(--font-sans); }
.main-nav a.active:hover { text-decoration: none; }

/* ROUTING VIEWS */
.view { display: none; padding: var(--space-md); min-height: 80vh; }
.view.active { display: block; }

/* MAP MODULE */
.map-controls { display: flex; flex-wrap: wrap; gap: var(--space-sm); align-items: center; margin-bottom: var(--space-sm); font-family: "Courier New", monospace; }
.dim-btn { background: transparent; border: 1px solid var(--accent-line); color: var(--text-muted); padding: 0.3rem 0.8rem; cursor: pointer; border-radius: var(--radius-sm); font-family: "Courier New", monospace; }
.dim-btn.active { background: var(--accent-ink); color: var(--bg-base); border-color: var(--accent-ink); }
.map-canvas { container-type: size; width: 100%; height: clamp(500px, 70vh, 800px); background: var(--bg-surface); border: 1px solid var(--accent-line); border-radius: var(--radius-sm); overflow: hidden; position: relative; }
#graph-svg { width: 100%; height: 100%; }
.map-legend { font-size: 0.85rem; color: var(--text-muted); text-align: center; margin-top: var(--space-xs); font-family: "Pixel-LCD-7", var(--font-sans); }
.map-legend .return-link { font-family: "Courier New", monospace; font-size: 0.8rem; display: inline-block; margin-top: 0.4rem; color: var(--accent-ink); text-decoration: none; opacity: 0.7; transition: opacity var(--transition-fast); }
.map-legend .return-link:hover { opacity: 1; text-decoration: underline; }

/* SVG NODES & EDGES */
.graph-edge { stroke: var(--accent-line); stroke-width: 1.5; transition: stroke var(--transition-fast); }
.graph-edge.highlight { stroke: var(--accent-ink); stroke-width: 2; }
.graph-node { cursor: pointer; transition: transform 0.2s; }
.graph-node circle { fill: var(--bg-panel); stroke: var(--text-muted); stroke-width: 2; }
.graph-node text { fill: var(--text-primary); font-size: 15px; letter-spacing: 1.3px; font-family: "F-Stein", var(--font-serif); pointer-events: none; font-weight: bold; }
.graph-node:hover circle { stroke: var(--accent-ink); fill: var(--highlight); }
.graph-node.highlight circle { stroke: var(--accent-ink); fill: var(--accent-ink); opacity: 0.8; }

/* TRAIT EXPLORER */
.trait-panel { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--space-md); }
.filter-group { border: 1px solid var(--accent-line); padding: var(--space-sm); border-radius: var(--radius-sm); }
.filter-group legend { color: var(--accent-ink); font-size: 0.9rem; margin-bottom: var(--space-xs); font-family: "Courier New", monospace; }
.filter-group label { display: block; margin: 0.3rem 0; color: var(--text-muted); cursor: pointer; font-family: "Courier New", monospace; }
.results-list { grid-column: 1 / -1; margin-top: var(--space-md); padding: var(--space-sm); background: var(--bg-surface); border: 1px solid var(--accent-line); }
.result-item { padding: 0.4rem; border-bottom: 1px dashed var(--accent-line); cursor: pointer; font-family: "Courier New", monospace; }
.result-item:hover { color: var(--accent-ink); }

/* COMPARE MODULE */
.compare-ui { max-width: 900px; margin: 0 auto; font-family: "Courier New", monospace; }
.compare-select { width: 100%; padding: 0.5rem; background: var(--bg-panel); color: var(--text-primary); border: 1px solid var(--accent-line); margin-bottom: var(--space-xs); font-family: "Courier New", monospace; }
.table-wrapper { overflow-x: auto; margin-top: var(--space-sm); }
.compare-matrix { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.compare-matrix th, .compare-matrix td { border: 1px solid var(--accent-line); padding: 0.6rem; text-align: left; }
.compare-matrix th { background: var(--bg-panel); color: var(--accent-ink); }

/* TIMELINE MODULE */
.timeline-container { display: flex; flex-direction: column; gap: 2rem; padding: var(--space-md) 0; max-width: 700px; margin: 0 auto; }
.tl-item { display: flex; gap: 1rem; align-items: flex-start; padding: 1rem; background: var(--bg-surface); border-left: 2px solid var(--accent-ink); }
.tl-era { font-family: "Courier New", monospace; color: var(--text-muted); min-width: 140px; }
.tl-content h3 { margin: 0 0 0.3rem; color: var(--text-primary); font-family: "Courier New", monospace; }

/* METHODOLOGY MODULE */
.methodology-content { max-width: 680px; margin: 0 auto; font-family: "Courier New", monospace; }
.methodology-content h2 { font-family: "IBM-Logo", var(--font-sans); font-size: 1.5rem; color: var(--accent-ink); letter-spacing: 0.05em; }
.methodology-content h3 { font-family: "TimeNR", var(--font-serif); font-size: 1.2rem; color: var(--accent-ink); }
.methodology-content .lead { font-size: 1.3rem; color: var(--accent-ink); border-bottom: 1px solid var(--accent-line); padding-bottom: var(--space-sm); font-family: "Glitch", var(--font-serif); }
.methodology-content .note {
  background: #0a120a;
  padding: var(--space-sm) var(--space-md);
  margin-top: var(--space-md);
  border: none;
  border-radius: var(--radius-sm);
  box-shadow: inset 0 0 12px rgba(51, 255, 102, 0.06), 0 0 8px rgba(51, 255, 102, 0.08);
  font-family: "Pixel-LCD-7", var(--font-mono, monospace);
  font-size: 0.85rem;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}
.methodology-content .note::after {
  content: "\005F";
  animation: blink-cursor 0.8s step-end infinite;
  color: var(--accent-ink);
  margin-left: 0.25rem;
}
@keyframes blink-cursor {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* SIDE PANEL MODULE */
.panel {
  position: fixed; top: 0; right: 0; width: min(450px, 100%); height: 100%;
  background: var(--bg-panel); border-left: 1px solid var(--accent-line);
  transform: translateX(100%); transition: transform 250ms ease;
  z-index: 200; overflow-y: auto;
}
.panel[aria-hidden="false"] { transform: translateX(0); }
.panel-inner { padding: var(--space-lg); }
.panel-close { position: absolute; top: var(--space-md); right: var(--space-md); background: none; border: none; color: var(--text-muted); font-size: 1.5rem; cursor: pointer; }
.panel-title { font-family: "TimeNR", var(--font-serif); font-size: 1.6rem; margin: 0 0 0.25rem; color: var(--accent-ink); }
.panel-tradition { display: block; font-size: 0.85rem; color: var(--accent-ink); text-transform: uppercase; letter-spacing: 0.05em; margin-top: -0.5rem; margin-bottom: var(--space-md); font-family: "F-Stein", var(--font-serif); }
.panel-facts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.5rem; font-size: 0.85rem; background: var(--bg-surface); padding: var(--space-sm); border-radius: var(--radius-sm); margin: var(--space-md) 0; }
.panel-facts dt { color: var(--text-muted); }
.panel-facts dd { margin: 0; color: var(--text-primary); }
.panel-why, .panel-similar { margin-top: var(--space-md); }
.similar-pills { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: var(--space-xs); }
.pill { background: var(--highlight); padding: 0.25rem 0.6rem; border-radius: 20px; font-size: 0.8rem; cursor: pointer; font-family: "IBM-Logo", var(--font-sans); }
.pill:hover { background: var(--accent-ink); color: var(--bg-base); }
.panel-sources { margin-top: var(--space-lg); border-top: 1px solid var(--accent-line); padding-top: var(--space-sm); }
.source-list { list-style: none; padding: 0; margin-top: 0.5rem; }
.source-list li { margin-bottom: 0.5rem; font-size: 0.85rem; display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.4rem; }
.source-list a { color: var(--text-muted); word-break: break-all; }
.src-badge { font-size: 0.7rem; padding: 0.1rem 0.4rem; border-radius: 3px; white-space: nowrap; font-family: "Pixel-LCD-7", var(--font-sans); letter-spacing: 0.05em; }
.src-primary { background: #2d3748; color: #a0aec0; border: 1px solid #4a5568; }
.src-scholarly { background: #2a4365; color: #90cdf4; border: 1px solid #2b6cb0; }
.src-reference { background: #22543d; color: #9ae6b4; border: 1px solid #276749; }
.src-modern { background: #44337a; color: #d6bcfa; border: 1px solid #6b46c1; }

@media (max-width: 600px) {
  .site-header { flex-direction: column; align-items: flex-start; }
  .main-nav ul { flex-wrap: wrap; }
  .panel-facts { grid-template-columns: 1fr; }
}