/* ─────────────────────────────────────────────
   LiveWire — Shared Stylesheet
   Design tokens mirror the Android app's palette in MainActivity.kt
   (COLOR_BACKGROUND, COLOR_POWER, COLOR_COPPER, COLOR_SOURCE, …) exactly,
   so the site reads as the same product as the game.
   ───────────────────────────────────────────── */

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

:root {
  /* ── Substrate — the board itself (COLOR_BACKGROUND / _TOP / _MID) ── */
  --substrate:      #050B16;
  --substrate-hi:   #0D182B;
  --substrate-mid:  #07111F;

  /* ── Panel & cell surfaces (COLOR_BOARD, COLOR_CELL, COLOR_TRAY) ── */
  --panel:          #0F1D2F;
  --panel-hi:       #1B3048;
  --cell:           #142438;
  --cell-hi:        #1B3046;
  --edge:           #39536F;   /* COLOR_PANEL_EDGE */
  --grid:           #2A4057;   /* COLOR_GRID */

  /* ── Signal colours — the game's electrical vocabulary ── */
  --current:        #39E7CC;   /* COLOR_POWER      — live current, primary accent */
  --current-hi:     #96FFEC;   /* COLOR_POWER_HIGHLIGHT */
  --current-glow:   rgba(48, 240, 210, 0.55);
  --copper:         #D79F57;   /* COLOR_COPPER     — unpowered traces, structure */
  --copper-hi:      #FFD185;
  --source:         #3E8DFF;   /* COLOR_SOURCE     — batteries */
  --control:        #FACC15;   /* COLOR_CONTROL    — yellow control signal */
  --goal:           #F4B650;   /* COLOR_GOAL_HIGHLIGHT — lamps and loads */
  --checkpoint:     #A78BFA;   /* COLOR_CHECKPOINT */

  /* ── Ink ── */
  --ink:            #ECF4FA;   /* COLOR_TEXT_PRIMARY */
  --ink-mid:        #CBD7E3;   /* COLOR_TRAY_TEXT */
  --ink-dim:        #8AA2BC;
  --ink-faint:      #68829D;   /* COLOR_LEGEND */

  /* ── Type ── */
  --font-display: 'Chakra Petch', 'IBM Plex Sans', sans-serif;
  --font-body:    'IBM Plex Sans', system-ui, sans-serif;
  --font-mono:    'IBM Plex Mono', ui-monospace, monospace;

  --type-display:    clamp(2.8rem, 6.5vw, 4.6rem);
  --type-headline:   clamp(1.9rem, 3.6vw, 2.6rem);
  --type-title:      1.375rem;
  --type-body-lg:    1.0625rem;
  --type-body:       1rem;
  --type-small:      0.875rem;
  --type-label:      0.75rem;

  /* ── Geometry — mirrors the board's rounded cells ── */
  --radius-sm:   6px;
  --radius-md:   10px;
  --radius-lg:   16px;
  --radius-xl:   22px;
  --radius-pill: 100px;

  --shadow-panel: 0 18px 48px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(112, 151, 179, 0.10);
  --shadow-lift:  0 14px 34px rgba(0, 0, 0, 0.5);
  --glow-current: 0 0 24px rgba(57, 231, 204, 0.35);

  --max-w: 1120px;
  --section-gap: 112px;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  font-size: var(--type-body);
  line-height: 1.7;
  color: var(--ink-mid);
  background: var(--substrate);
  /* Etched substrate: a faint copper grid over a deep radial wash, so the page
     reads as the same PCB the game is played on. */
  background-image:
    radial-gradient(ellipse 90% 60% at 50% -10%, rgba(57, 231, 204, 0.07) 0%, transparent 60%),
    radial-gradient(ellipse 70% 50% at 100% 20%, rgba(62, 141, 255, 0.06) 0%, transparent 60%),
    linear-gradient(180deg, var(--substrate-hi) 0%, var(--substrate) 46%);
  background-repeat: no-repeat;
  background-attachment: fixed;
  overflow-x: hidden;
}

img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }

::selection { background: rgba(57, 231, 204, 0.28); color: var(--ink); }

:focus-visible {
  outline: 2px solid var(--current);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* ── Utilities ── */
.container {
  width: 100%;
  max-width: var(--max-w);
  margin-inline: auto;
  padding-inline: 24px;
}

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

/* Silkscreen label — the tiny printed text on a real circuit board */
.silkscreen {
  font-family: var(--font-mono);
  font-size: var(--type-label);
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

/* ── Navigation ── */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(5, 11, 22, 0.82);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid rgba(57, 83, 111, 0.45);
}

.nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  height: 72px;
}

.nav__logo {
  display: flex;
  align-items: center;
  gap: 11px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.2rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink);
  flex-shrink: 0;
}

.nav__logo-img {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  object-fit: contain;
  flex-shrink: 0;
}

.nav__links {
  display: flex;
  align-items: center;
  gap: 30px;
}

.nav__links a {
  font-family: var(--font-mono);
  font-size: var(--type-label);
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-dim);
  transition: color 0.2s ease;
}

.nav__links a:hover { color: var(--current); }

.nav__cta {
  color: var(--substrate) !important;
  background: var(--current);
  padding: 10px 20px;
  border-radius: var(--radius-pill);
  font-weight: 600 !important;
  transition: box-shadow 0.2s ease, transform 0.2s ease !important;
}

.nav__cta:hover {
  color: var(--substrate) !important;
  box-shadow: var(--glow-current);
  transform: translateY(-1px);
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 15px 26px;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.95rem;
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.btn:hover { transform: translateY(-2px); }

.btn--primary {
  background: linear-gradient(180deg, var(--current-hi) 0%, var(--current) 62%);
  color: #04121A;
}

.btn--primary:hover { box-shadow: 0 12px 34px rgba(57, 231, 204, 0.32); }

.btn--ghost {
  background: rgba(20, 36, 56, 0.7);
  border-color: var(--grid);
  color: var(--ink);
}

.btn--ghost:hover { border-color: var(--copper); color: var(--copper-hi); }

.btn__icon { width: 24px; height: 24px; flex-shrink: 0; }

.btn__text { display: flex; flex-direction: column; line-height: 1.2; text-align: left; }

.btn__sub {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 400;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.72;
}

/* ── Trace divider — a copper trace with solder pads, as on the board ── */
.trace-rule {
  display: flex;
  align-items: center;
  gap: 0;
  height: 1px;
  border: 0;
  background: linear-gradient(90deg, transparent, rgba(215, 159, 87, 0.45) 18%, rgba(215, 159, 87, 0.45) 82%, transparent);
  position: relative;
}

.trace-rule::before,
.trace-rule::after {
  content: '';
  position: absolute;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--copper);
  box-shadow: 0 0 0 2px rgba(5, 11, 22, 1), 0 0 0 3px rgba(215, 159, 87, 0.3);
  top: 50%;
  transform: translateY(-50%);
}

.trace-rule::before { left: 16%; }
.trace-rule::after  { right: 16%; }

/* ── Footer ── */
.footer {
  border-top: 1px solid rgba(57, 83, 111, 0.4);
  background: linear-gradient(180deg, rgba(7, 17, 31, 0) 0%, rgba(7, 17, 31, 0.9) 100%);
  padding: 56px 0 40px;
  margin-top: var(--section-gap);
}

.footer__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 26px;
  text-align: center;
}

.footer__logo {
  display: flex;
  align-items: center;
  gap: 11px;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink);
}

.footer__logo-img {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  object-fit: contain;
}

.footer__links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px 28px;
}

.footer__links a {
  font-family: var(--font-mono);
  font-size: var(--type-label);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-dim);
  transition: color 0.2s ease;
}

.footer__links a:hover { color: var(--current); }

.footer__copy {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
  max-width: 60ch;
}

/* ── Animation ── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(26px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes currentFlow {
  to { stroke-dashoffset: -1000; }
}

@keyframes pulseGlow {
  0%, 100% { opacity: 0.55; }
  50%      { opacity: 1; }
}

.fade-up { animation: fadeUp 0.75s cubic-bezier(0.22, 1, 0.36, 1) both; }
.fade-up--d1 { animation-delay: 0.08s; }
.fade-up--d2 { animation-delay: 0.18s; }
.fade-up--d3 { animation-delay: 0.30s; }
.fade-up--d4 { animation-delay: 0.42s; }
.fade-up--d5 { animation-delay: 0.54s; }

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

/* ── Responsive ── */
@media (max-width: 860px) {
  :root { --section-gap: 72px; }
  .nav__links { display: none; }
  .nav__inner { height: 64px; }
}
