@import url('https://fonts.googleapis.com/css2?family=Teko:wght@400;500;600;700&family=IBM+Plex+Sans:wght@400;500;600&family=JetBrains+Mono:wght@400;500;700&display=swap');

:root{
  --bg-void: #0a0c08;
  --bg-panel: #12160f;
  --bg-panel-alt: #191f14;
  --border-hairline: #2b3423;
  --text-primary: #dfe3d1;
  --text-muted: #7d8871;
  --accent-anomaly: #9fef6a;
  --accent-anomaly-dim: #5f8a45;
  --accent-rust: #c1682e;
  --accent-danger: #8a3226;
}

*{ box-sizing: border-box; }
html{ scroll-behavior: smooth; }
body{
  margin:0;
  background: var(--bg-void);
  color: var(--text-primary);
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 16px;
  line-height: 1.6;
  position: relative;
  overflow-x: hidden;
}

::selection{ background: var(--accent-anomaly-dim); color: #06110a; }

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

:focus-visible{
  outline: 2px solid var(--accent-anomaly);
  outline-offset: 3px;
}

h1,h2,h3{
  font-family: 'Teko', sans-serif;
  font-weight: 600;
  letter-spacing: 0.02em;
  margin: 0;
  text-transform: uppercase;
}

.mono{ font-family: 'JetBrains Mono', monospace; }

/* --- grain overlay --- */
.grain{
  position: fixed; inset:0; pointer-events:none; z-index: 500;
  opacity: 0.06; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.vignette{
  position: fixed; inset:0; pointer-events:none; z-index: 400;
  box-shadow: inset 0 0 18vw 4vw rgba(0,0,0,0.75);
}

.scanline{
  position: fixed; left:0; right:0; height: 2px; z-index: 450;
  background: linear-gradient(to bottom, transparent, rgba(159,239,106,0.05), transparent);
  animation: scan 7s linear infinite;
  pointer-events: none;
}
@keyframes scan{
  0%{ top:-2%; }
  100%{ top: 102%; }
}

/* --- top status bar / nav --- */
.statusbar{
  position: fixed; top:0; left:0; right:0; z-index: 600;
  display:flex; justify-content: space-between; align-items:center;
  padding: 8px 20px;
  background: rgba(10,12,8,0.85);
  border-bottom: 1px solid var(--border-hairline);
  backdrop-filter: blur(3px);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}
.statusbar .dot{
  display:inline-block; width:6px; height:6px; border-radius:50%;
  background: var(--accent-anomaly); margin-right:6px;
  box-shadow: 0 0 6px var(--accent-anomaly);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse{ 0%,100%{ opacity:1;} 50%{ opacity:0.35; } }

nav.statusbar a{ color: var(--text-muted); margin-left: 18px; }
nav.statusbar a:hover, nav.statusbar a.active{ color: var(--accent-anomaly); }

/* --- page header (for non-home pages) --- */
.pagehead{
  padding: 130px 8vw 60px;
  border-bottom: 1px solid var(--border-hairline);
  background: linear-gradient(180deg, #0a0c08 0%, #0d100a 60%, #0a0c08 100%);
}
.pagehead .eyebrow{ margin-bottom: 14px; }
.pagehead h1{ font-size: clamp(2.8rem, 8vw, 5.5rem); line-height: 0.95; }

/* --- hero (home page only) --- */
.hero{
  min-height: 100vh;
  display:flex; flex-direction:column; justify-content:center; align-items:flex-start;
  padding: 120px 8vw 80px;
  position: relative;
  background:
    radial-gradient(600px circle at var(--mx,50%) var(--my,40%), rgba(159,239,106,0.07), transparent 60%),
    linear-gradient(180deg, #0a0c08 0%, #0d100a 60%, #0a0c08 100%);
}
.hero::before{
  content:"";
  position:absolute; inset:0;
  background-image: repeating-linear-gradient(0deg, rgba(255,255,255,0.015) 0px, transparent 1px, transparent 3px);
  pointer-events:none;
}
.eyebrow{
  font-family:'JetBrains Mono', monospace;
  font-size: 12px;
  letter-spacing: 0.25em;
  color: var(--accent-rust);
  margin-bottom: 18px;
}
.eyebrow::before{ content:"// "; color: var(--text-muted); }

.hero h1{
  font-size: clamp(3.5rem, 11vw, 8.5rem);
  line-height: 0.92;
  color: var(--text-primary);
  text-shadow: 0 0 30px rgba(159,239,106,0.15);
}
.hero h1 span{ color: var(--accent-anomaly); }

.hero .tagline{
  max-width: 640px;
  font-size: 1.15rem;
  color: var(--text-muted);
  margin-top: 22px;
}

.cta-row{ display:flex; gap: 16px; margin-top: 38px; flex-wrap: wrap; }
.btn{
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  letter-spacing: 0.08em;
  padding: 14px 26px;
  border: 1px solid var(--accent-anomaly);
  color: var(--accent-anomaly);
  background: transparent;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  display:inline-block;
}
.btn:hover{ background: var(--accent-anomaly); color: #06100a; }
.btn.alt{
  border-color: var(--border-hairline);
  color: var(--text-muted);
}
.btn.alt:hover{ background: var(--bg-panel-alt); color: var(--text-primary); }

.detector{
  position:absolute; bottom: 60px; right: 8vw;
  font-family:'JetBrains Mono', monospace;
  font-size: 12px; color: var(--text-muted);
  border: 1px solid var(--border-hairline);
  padding: 12px 16px;
  background: rgba(18,22,15,0.6);
  min-width: 220px;
}
.detector .row{ display:flex; justify-content:space-between; margin-top:4px; }
.detector .val{ color: var(--accent-anomaly); }

/* --- section shell --- */
section{ padding: 100px 8vw; position: relative; }
.section-head{ margin-bottom: 56px; max-width: 720px; }
.section-head .eyebrow{ margin-bottom: 10px; }
.section-head h2{ font-size: clamp(2.2rem, 5vw, 3.6rem); }
.section-head p{ color: var(--text-muted); margin-top: 14px; }

hr.hairline{ border:none; border-top: 1px solid var(--border-hairline); margin: 0; }

/* --- briefing --- */
.briefing{ background: var(--bg-panel); }
.briefing-grid{
  display:grid; grid-template-columns: repeat(3, 1fr); gap: 1px;
  background: var(--border-hairline);
  border: 1px solid var(--border-hairline);
}
.briefing-item{
  background: var(--bg-panel);
  padding: 30px 26px;
}
.briefing-item .num{
  font-family:'JetBrains Mono', monospace;
  color: var(--accent-rust); font-size: 12px; letter-spacing:0.1em;
}
.briefing-item h3{ font-size: 1.6rem; margin-top: 10px; color: var(--text-primary); }
.briefing-item p{ color: var(--text-muted); font-size: 0.94rem; margin-top: 10px; }

/* --- factions --- */
.faction-grid{
  display:grid; grid-template-columns: repeat(auto-fit, minmax(260px,1fr));
  gap: 18px;
}
.faction-card{
  border: 1px solid var(--border-hairline);
  background: var(--bg-panel-alt);
  padding: 26px;
  position: relative;
  overflow:hidden;
  transition: border-color 0.25s;
}
.faction-card:hover{ border-color: var(--accent-anomaly-dim); }
.faction-card .tag{
  font-family:'JetBrains Mono', monospace;
  font-size: 10px; letter-spacing:0.15em; color: var(--text-muted);
}
.faction-card h3{ font-size: 1.9rem; margin-top: 8px; }
.faction-card p{ color: var(--text-muted); font-size: 0.92rem; margin-top: 10px; }
.faction-card.empty{
  border-style:dashed; display:flex; align-items:center; justify-content:center; min-height:160px;
}
.faction-card.empty p{ text-align:center; margin:0; }
.faction-card.empty .tag{ display:block; margin-bottom:8px; }

/* --- systems --- */
.systems{ background: var(--bg-panel); }
.systems-list{ display:flex; flex-direction:column; }
.sys-row{
  display:grid; grid-template-columns: 90px 1fr 1.4fr;
  gap: 30px;
  padding: 28px 0;
  border-top: 1px solid var(--border-hairline);
  align-items: start;
}
.sys-row:last-child{ border-bottom: 1px solid var(--border-hairline); }
.sys-row .idx{ font-family:'JetBrains Mono', monospace; color: var(--accent-rust); font-size: 13px; }
.sys-row h3{ font-size: 1.7rem; }
.sys-row p{ color: var(--text-muted); font-size: 0.94rem; }
.sys-row.placeholder{ border-top-style:dashed; }
.sys-row.placeholder h3, .sys-row.placeholder .idx{ color: var(--text-muted); }
.sys-row.placeholder p{ color: var(--text-muted); }

/* --- rules --- */
.rules-list{ display:flex; flex-direction:column; }
.rule-row{
  display:grid; grid-template-columns: 60px 1fr;
  gap: 24px;
  padding: 22px 0;
  border-top: 1px solid var(--border-hairline);
}
.rule-row:last-child{ border-bottom: 1px solid var(--border-hairline); }
.rule-row .idx{ font-family:'JetBrains Mono', monospace; color: var(--accent-rust); font-size: 13px; padding-top: 3px; }
.rule-row h3{ font-size: 1.3rem; letter-spacing: 0.01em; }
.rule-row p{ color: var(--text-muted); font-size: 0.94rem; margin-top: 6px; }
.rules-footnote{
  margin-top: 26px; font-family:'JetBrains Mono', monospace; font-size: 11px;
  color: var(--text-muted); letter-spacing: 0.05em;
}

@media (max-width: 760px){
  .sys-row{ grid-template-columns: 1fr; gap: 8px; }
  .rule-row{ grid-template-columns: 1fr; gap: 6px; }
  .briefing-grid{ grid-template-columns: 1fr; }
  .detector{ position: static; margin-top: 40px; width: 100%; }
}

/* --- connect panel --- */
.connect{
  background:
    linear-gradient(180deg, rgba(159,239,106,0.04), transparent 30%),
    var(--bg-void);
  border-top: 1px solid var(--border-hairline);
  border-bottom: 1px solid var(--border-hairline);
}
.connect-panel{
  border: 1px solid var(--border-hairline);
  background: var(--bg-panel);
  max-width: 720px;
}
.connect-panel .head{
  display:flex; justify-content:space-between; align-items:center;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-hairline);
  font-family:'JetBrains Mono', monospace;
  font-size: 11px; letter-spacing:0.15em; color: var(--text-muted);
}
.connect-panel .body{ padding: 24px 20px; }
.kv{
  display:flex; justify-content:space-between;
  padding: 12px 0;
  border-bottom: 1px dashed var(--border-hairline);
  font-family:'JetBrains Mono', monospace; font-size: 13px;
}
.kv:last-child{ border-bottom:none; }
.kv .k{ color: var(--text-muted); }
.kv .v{ color: var(--accent-anomaly); }

/* --- footer --- */
footer{
  padding: 50px 8vw 40px;
  display:flex; justify-content:space-between; align-items:center; flex-wrap:wrap; gap:16px;
  font-family:'JetBrains Mono', monospace; font-size: 11px; color: var(--text-muted);
  border-top: 1px solid var(--border-hairline);
}

@media (prefers-reduced-motion: reduce){
  .scanline, .statusbar .dot{ animation: none; }
  html{ scroll-behavior: auto; }
}
