/* ═══════════════════════════════════════════
   Battleships Architecture — Tactical Design System
   Naval radar aesthetic with SVG flowcharts
   ═══════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;600;700;800&family=Outfit:wght@300;400;500;600&family=Fira+Code:wght@300;400;500;600&display=swap');

:root {
  --bg: #080c12;
  --bg-surface: #0c1219;
  --surface: #0f1923;
  --surface-hi: #142130;
  --border: #1a2940;
  --border-hi: #243b5c;
  --accent: #a5ff11;
  --accent-glow: rgba(165, 255, 17, 0.15);
  --accent-dim: rgba(165, 255, 17, 0.06);
  --green: #3fb950;
  --blue: #58a6ff;
  --red: #f85149;
  --violet: #a371f7;
  --cyan: #39d0d8;
  --pink: #f778ba;
  --orange: #f0883e;
  --amber: #e3b341;
  --text: #b4c0d0;
  --text-dim: #6a7a8e;
  --text-bright: #e4ebf5;
  --font-display: 'Syne', sans-serif;
  --font-body: 'Outfit', sans-serif;
  --font-mono: 'Fira Code', monospace;
  --radius: 12px;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  min-height: 100vh;
}

::selection { background: rgba(165, 255, 17, 0.25); color: #fff; }

code {
  font-family: var(--font-mono);
  background: rgba(165, 255, 17, 0.08);
  color: var(--accent);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.8em;
  border: 1px solid rgba(165, 255, 17, 0.12);
}

strong { color: var(--text-bright); font-weight: 600; }

/* ── RADAR BACKGROUND ── */
.radar-bg {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.radar-ring {
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(165, 255, 17, 0.03);
}
.radar-ring.r1 {
  width: 600px; height: 600px;
  top: -100px; right: -200px;
}
.radar-ring.r2 {
  width: 900px; height: 900px;
  top: -250px; right: -350px;
}
.radar-ring.r3 {
  width: 1200px; height: 1200px;
  top: -400px; right: -500px;
}

.radar-sweep {
  position: absolute;
  top: -100px; right: -200px;
  width: 600px; height: 600px;
  background: conic-gradient(
    from 0deg,
    transparent 0deg,
    rgba(165, 255, 17, 0.04) 30deg,
    transparent 60deg
  );
  border-radius: 50%;
  animation: sweep 8s linear infinite;
  transform-origin: center;
}

@keyframes sweep {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.grid-overlay {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(165, 255, 17, 0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(165, 255, 17, 0.015) 1px, transparent 1px);
  background-size: 60px 60px;
}

/* ── PAGE LAYOUT ── */
.page-wrap {
  position: relative;
  z-index: 1;
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 32px 120px;
}

/* ── HERO ── */
.hero {
  text-align: center;
  padding: 80px 0 60px;
  position: relative;
}

.hero-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 4px;
  color: var(--accent);
  border: 1px solid rgba(165, 255, 17, 0.2);
  padding: 5px 18px;
  border-radius: 20px;
  margin-bottom: 28px;
  background: rgba(165, 255, 17, 0.04);
}

.hero h1 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.4rem, 6vw, 4rem);
  line-height: 1.05;
  color: var(--text-bright);
  letter-spacing: -2px;
  margin-bottom: 16px;
}

.accent-text {
  background: linear-gradient(135deg, #a5ff11 0%, #39d0d8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-sub {
  font-size: 1.05rem;
  color: var(--text-dim);
  max-width: 560px;
  margin: 0 auto 40px;
  line-height: 1.7;
  font-weight: 300;
}

.hero-stats {
  display: flex;
  justify-content: center;
  gap: 32px;
  flex-wrap: wrap;
}

.hero-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.stat-val {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.6rem;
  color: var(--accent);
  text-shadow: 0 0 30px rgba(165, 255, 17, 0.3);
}

.stat-lbl {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-dim);
  letter-spacing: 1px;
  text-transform: uppercase;
}

/* ── SECTIONS ── */
.section {
  margin-bottom: 64px;
  position: relative;
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.section.visible {
  opacity: 1;
  transform: translateY(0);
}

.section-label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 2px;
  margin-bottom: 8px;
  opacity: 0.6;
}

.section h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.8rem;
  color: var(--text-bright);
  letter-spacing: -0.5px;
  margin-bottom: 8px;
}

.section-desc {
  font-size: 0.95rem;
  color: var(--text-dim);
  line-height: 1.7;
  margin-bottom: 28px;
  max-width: 680px;
}

/* ── DIAGRAMS ── */
.diagram-wrap {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  overflow-x: auto;
  position: relative;
}

.diagram-wrap::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.3;
}

svg { width: 100%; height: auto; }

.svg-header {
  font-family: 'Syne', sans-serif;
  font-size: 13px;
  font-weight: 700;
  fill: var(--text-bright);
  letter-spacing: 2px;
}

.svg-label {
  font-family: 'Syne', sans-serif;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 2px;
}

.svg-small {
  font-family: 'Outfit', sans-serif;
  font-size: 12px;
  font-weight: 500;
}

.svg-tiny {
  font-family: 'Outfit', sans-serif;
  font-size: 10px;
  font-weight: 400;
}

.svg-code {
  font-family: 'Fira Code', monospace;
  font-size: 9px;
}

/* ── CALLOUTS ── */
.callout-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 20px;
}

.callout {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  font-size: 0.85rem;
  color: var(--text-dim);
  line-height: 1.6;
}

.callout-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
  margin-top: 1px;
}

/* ── FLOW GRID (Game Flow) ── */
.flow-grid {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.flow-step {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--step-color);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 18px 22px 18px 20px;
  position: relative;
  display: grid;
  grid-template-columns: 36px 1fr;
  grid-template-rows: auto auto;
  column-gap: 14px;
  opacity: 0;
  transform: translateX(-16px);
  transition: opacity 0.4s ease, transform 0.4s ease, border-color 0.2s;
}

.flow-step.visible {
  opacity: 1;
  transform: translateX(0);
}

.flow-step:hover {
  border-color: var(--border-hi);
  border-left-color: var(--step-color);
}

.flow-num {
  grid-row: 1 / 3;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.4rem;
  color: var(--step-color);
  text-shadow: 0 0 20px color-mix(in srgb, var(--step-color) 30%, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
}

.flow-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-bright);
  margin-bottom: 2px;
}

.flow-desc {
  font-size: 0.82rem;
  color: var(--text-dim);
  line-height: 1.6;
}

.flow-connector {
  width: 40px;
  height: 16px;
  display: block;
  margin: -1px auto -1px 16px;
}

.flow-step.final {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: var(--radius);
}

/* ── TRAIT CARDS (CRDT) ── */
.trait-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.trait-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 2px solid var(--tc);
  border-radius: var(--radius);
  padding: 22px 20px;
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.5s ease, transform 0.5s ease, border-color 0.2s, box-shadow 0.2s;
}

.trait-card.visible {
  opacity: 1;
  transform: translateY(0);
}

.trait-card:hover {
  border-color: var(--border-hi);
  border-top-color: var(--tc);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
}

.trait-icon {
  margin-bottom: 12px;
}

.trait-card h3 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
  color: var(--tc);
  margin-bottom: 6px;
}

.trait-card p {
  font-size: 0.82rem;
  color: var(--text-dim);
  line-height: 1.6;
}

.sync-note {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--cyan);
  border-radius: 0 8px 8px 0;
  padding: 14px 18px;
  font-size: 0.85rem;
  color: var(--text-dim);
  line-height: 1.7;
}

/* ── TREE (Project Structure) ── */
.tree {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 28px;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 2;
}

.tree-item { color: var(--text-dim); white-space: nowrap; }
.tree-item.root { color: var(--text-bright); font-weight: 600; }
.tree-item.l1 { padding-left: 16px; }
.tree-item.l2 { padding-left: 32px; font-size: 0.78rem; }

.tree-icon { color: var(--accent); }
.tree-branch { color: var(--border-hi); }
.tree-folder { color: var(--blue); font-weight: 500; }
.tree-dim { color: var(--text-dim); font-size: 0.75rem; opacity: 0.7; }

.tree-tag {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.3px;
  margin-left: 6px;
  vertical-align: middle;
}

.tag-react { background: rgba(88, 166, 255, 0.12); color: var(--blue); }
.tag-rust { background: rgba(240, 136, 62, 0.12); color: var(--orange); }
.tag-test { background: rgba(63, 185, 80, 0.12); color: var(--green); }

/* ── FEATURE GRID ── */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  position: relative;
  overflow: hidden;
  opacity: 0;
  transform: scale(0.95);
  transition: opacity 0.4s ease, transform 0.4s ease, border-color 0.2s, box-shadow 0.2s;
}

.feature-card.visible {
  opacity: 1;
  transform: scale(1);
}

.feature-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 2px;
  background: var(--fc);
  opacity: 0.7;
}

.feature-card:hover {
  border-color: var(--border-hi);
  box-shadow: 0 0 24px rgba(0, 0, 0, 0.3), 0 0 0 1px color-mix(in srgb, var(--fc) 15%, transparent);
}

.feature-card h3 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--fc);
  margin-bottom: 6px;
}

.feature-card p {
  font-size: 0.8rem;
  color: var(--text-dim);
  line-height: 1.6;
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(165, 255, 17, 0.1); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(165, 255, 17, 0.2); }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .page-wrap { padding: 0 16px 80px; }
  .hero { padding: 48px 0 36px; }
  .hero-stats { gap: 20px; }
  .callout-row { grid-template-columns: 1fr; }
  .trait-grid { grid-template-columns: 1fr; }
  .feature-grid { grid-template-columns: 1fr 1fr; }
  .diagram-wrap { padding: 12px; }
  .flow-step { grid-template-columns: 28px 1fr; }
}

@media (max-width: 480px) {
  .feature-grid { grid-template-columns: 1fr; }
  .hero h1 { letter-spacing: -1px; }
  .tree { padding: 16px; overflow-x: auto; }
}
