/* Tetra Launcher site v2 — inline with the launcher.
   V4 Glow design language, ported verbatim from the app:
   - tokens: src/main.css :root + src/theme/palette.ts NEUTRAL_DARK
   - type: bundled Inter (UI) + JetBrains Mono (data) — same woff2 files the
     app ships, no CDN
   - glow: the app's 5-layer accent halo, applied to the same things the app
     glows (active states, primary actions, live dots, selection)
   - geometry: 8px windows, 6px controls, 3px tags, pills only for status
   Motion: CSS-only, slow and deliberate (marketing page, not the dense app),
   every non-essential animation gated behind prefers-reduced-motion. */

/* ── V4 tokens (canonical Neutral dark) ─────────────────────────── */
:root {
  --font-ui: "Inter", "Segoe UI", system-ui, sans-serif;
  --font-data: "JetBrains Mono", "Fira Code", "Consolas", monospace;

  --bg: #0d0f13;
  --surface: #12151b;
  --surface2: #1a1e26;
  --border: #262b34;
  --border-weak: #1f232c;
  --text: #e7ebf0;
  --muted: #7a8494;
  --muted2: #98a2b2;
  --muted-soft: rgba(152, 162, 178, 0.12);
  --accent: #8fa3bd;
  --accent-soft: rgba(143, 163, 189, 0.14);
  --accent-line: rgba(143, 163, 189, 0.4);
  --accent2: #b0976a;
  --accent2-soft: rgba(176, 151, 106, 0.14);
  --accent2-line: rgba(176, 151, 106, 0.4);
  --success: #4d9a75;
  --warn: #c19a55;
  --warn-soft: rgba(193, 154, 85, 0.14);
  --danger: #b3564d;
  --danger-soft: rgba(179, 86, 77, 0.15);
  --row-hover: rgba(152, 162, 178, 0.06);
  --row-selected: rgba(143, 163, 189, 0.11);
  /* The app's glow at default bloom (0.9) — literal px. */
  --glow: 0 0 2.7px rgba(143, 163, 189, 0.95),
    0 0 7.2px rgba(143, 163, 189, 0.75),
    0 0 16.2px rgba(143, 163, 189, 0.5),
    0 0 30.6px rgba(143, 163, 189, 0.3),
    0 0 54px rgba(143, 163, 189, 0.16);
  --glow-strong: 0 0 3.6px rgba(143, 163, 189, 0.95),
    0 0 9.9px rgba(143, 163, 189, 0.8),
    0 0 22.5px rgba(143, 163, 189, 0.55),
    0 0 43.2px rgba(143, 163, 189, 0.35),
    0 0 76.5px rgba(143, 163, 189, 0.2);
  /* Tighter halo for buttons — the full --glow reads as blur on a large CTA. */
  --glow-btn: 0 0 2px rgba(143, 163, 189, 0.9),
    0 0 7px rgba(143, 163, 189, 0.6),
    0 0 14px rgba(143, 163, 189, 0.35);

  --radius-win: 8px;
  --radius-ctl: 6px;
  --radius-tag: 3px;

  color-scheme: dark;
}

/* ── Bundled typefaces (same woff2 the app ships) ───────────────── */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("./assets/fonts/inter-400.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("./assets/fonts/inter-500.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("./assets/fonts/inter-600.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("./assets/fonts/inter-700.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url("./assets/fonts/inter-800.woff2") format("woff2");
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("./assets/fonts/jetbrainsmono-400.woff2") format("woff2");
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("./assets/fonts/jetbrainsmono-500.woff2") format("woff2");
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("./assets/fonts/jetbrainsmono-600.woff2") format("woff2");
}

/* ── Base ───────────────────────────────────────────────────────── */
* {
  box-sizing: border-box;
}
html {
  scroll-behavior: smooth;
}
html,
body {
  margin: 0;
  padding: 0;
}
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a {
  color: inherit;
  text-decoration: none;
}
img {
  max-width: 100%;
}
::selection {
  background: var(--accent);
  color: #10131a;
}
:focus-visible {
  outline: 2px solid var(--accent-line);
  outline-offset: 2px;
}
.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 28px;
}
section {
  position: relative;
  padding: 96px 0;
}
.font-data {
  font-family: var(--font-data);
  font-variant-numeric: tabular-nums;
}

/* ── Nav ────────────────────────────────────────────────────────── */
header.site-nav {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(13, 15, 19, 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-weak);
}
.site-nav .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  flex-wrap: wrap;
  gap: 8px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.06em;
  color: var(--text);
  /* Full-height hit area — the whole nav strip is clickable. */
  height: 64px;
  padding: 0 2px;
}
.brand img {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  box-shadow: var(--glow);
}
.brand .tetra {
  color: var(--accent);
}
.brand .launcher {
  color: var(--muted2);
  font-weight: 500;
}
nav.links {
  display: flex;
  gap: 28px;
}
nav.links a {
  position: relative;
  color: var(--muted);
  font-family: var(--font-data);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  /* Full-height hit area; underline pinned to the bar's bottom edge. */
  display: inline-flex;
  align-items: center;
  height: 64px;
  padding: 0 2px;
  transition: color 0.15s ease-out;
}
nav.links a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 100%;
  bottom: 0;
  height: 1px;
  background: var(--accent);
  box-shadow: var(--glow);
  transition: right 0.25s ease-out;
}
nav.links a:hover,
nav.links a.active {
  color: var(--text);
}
nav.links a:hover::after,
nav.links a.active::after {
  right: 0;
}

/* ── Type ───────────────────────────────────────────────────────── */
h1,
h2,
h3 {
  font-weight: 800;
  letter-spacing: -0.015em;
  margin: 0 0 18px;
  line-height: 1.08;
}
h1 {
  font-size: clamp(40px, 6vw, 64px);
  letter-spacing: -0.025em;
}
h2 {
  font-size: clamp(28px, 3.6vw, 40px);
}
h3 {
  font-size: 17px;
  font-weight: 700;
}
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-data);
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  margin: 0 0 20px;
  color: var(--accent);
}
.eyebrow::before {
  content: "";
  width: 24px;
  height: 1px;
  background: currentColor;
  box-shadow: var(--glow);
}
p.lede {
  font-size: 17px;
  line-height: 1.7;
  max-width: 560px;
  margin: 0 0 36px;
  color: var(--muted2);
}

/* ── Buttons (the app's JOIN treatment) ─────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 13px 24px;
  border-radius: var(--radius-ctl);
  font-family: var(--font-data);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  border: 1px solid transparent;
  cursor: pointer;
  transition: filter 0.15s ease-out, border-color 0.15s ease-out,
    color 0.15s ease-out, background-color 0.15s ease-out, transform 0.1s ease-out;
}
.btn:active {
  transform: translateY(1px);
}
.btn-primary {
  background: var(--accent);
  color: #10131a;
  border-color: var(--accent);
  box-shadow: var(--glow-btn);
}
.btn-primary:hover {
  filter: brightness(1.1);
}
.btn-outline {
  background: transparent;
  border-color: var(--border);
  color: var(--muted2);
}
.btn-outline:hover {
  border-color: var(--accent-line);
  color: var(--text);
}
.btn[disabled] {
  opacity: 0.4;
  pointer-events: none;
}

/* ── Hero ───────────────────────────────────────────────────────── */
.hero {
  overflow: hidden;
  padding-top: 120px;
  padding-bottom: 140px;
  /* The hero photo under a V4-toned wash — the ruins stay readable as mood
     while text keeps high contrast. Darker on the text side, lighter right,
     using the launcher's own bg/surface rather than the old moss/night
     palette. The bottom layer fades the whole stack into the page bg so the
     photo doesn't end at a hard line. */
  background-image:
    linear-gradient(to bottom, transparent 55%, var(--bg) 100%),
    linear-gradient(100deg, rgba(13, 15, 19, 0.9) 0%, rgba(13, 15, 19, 0.72) 45%, rgba(18, 21, 27, 0.42) 100%),
    url("assets/hero-bg.jpg");
  background-size: cover;
  background-position: center 38%;
}
.hero-content {
  position: relative;
  z-index: 1;
  max-width: 720px;
}
.hero h1 {
  text-wrap: balance;
  margin-bottom: 22px;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.55);
}
.hero h1 .em {
  color: var(--accent);
}
.hero p.lede {
  margin-bottom: 40px;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.5);
}
.hero-cta {
  display: flex;
  align-items: center;
  gap: 22px;
  flex-wrap: wrap;
}
.live-coord {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-data);
  font-size: 13px;
  color: var(--muted2);
  font-variant-numeric: tabular-nums;
}

/* Live pulse — sits next to a number that is true right now. */
.pulse-dot {
  position: relative;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 5px rgba(77, 154, 117, 0.7);
  flex-shrink: 0;
  display: inline-block;
}
.pulse-dot::before {
  content: "";
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  border: 1px solid var(--success);
  animation: pulse-ring 2.2s ease-out infinite;
}
@keyframes pulse-ring {
  0% {
    transform: scale(1);
    opacity: 0.85;
  }
  100% {
    transform: scale(2.4);
    opacity: 0;
  }
}

/* Staggered load-in for the hero column. */
.load-in > * {
  opacity: 0;
  transform: translateY(16px);
  animation: load-in 0.65s ease-out forwards;
}
.load-in > *:nth-child(1) { animation-delay: 0.05s; }
.load-in > *:nth-child(2) { animation-delay: 0.18s; }
.load-in > *:nth-child(3) { animation-delay: 0.31s; }
.load-in > *:nth-child(4) { animation-delay: 0.44s; }
@keyframes load-in {
  to {
    opacity: 1;
    transform: none;
  }
}

/* ── Scroll reveal ─────────────────────────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.55s ease-out, transform 0.55s ease-out;
}
.reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* ── Screenshot carousel (window-framed) ───────────────────────── */
.carousel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-win);
  padding: 12px 12px 16px;
  box-shadow: 0 22px 50px rgba(0, 0, 0, 0.45);
}
.carousel-track {
  display: grid;
  border-radius: 6px;
  border: 1px solid var(--border-weak);
  position: relative;
  overflow: hidden;
  background: var(--bg);
}
.carousel-slide {
  grid-area: 1 / 1;
  opacity: 0;
  visibility: hidden;
  transform: scale(1.035);
  transition: opacity 0.8s ease, transform 1.1s ease, visibility 0s linear 0.8s;
}
.carousel-slide.is-active {
  opacity: 1;
  visibility: visible;
  transform: scale(1);
  transition: opacity 0.8s ease, transform 1.1s ease, visibility 0s linear 0s;
}
.carousel-slide img {
  display: block;
  width: 100%;
}
.carousel-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: rgba(18, 21, 27, 0.7);
  color: var(--muted2);
  font-size: 20px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: border-color 0.15s, color 0.15s, box-shadow 0.15s;
}
.carousel-arrow:hover {
  border-color: var(--accent-line);
  color: var(--accent);
  box-shadow: var(--glow);
}
.carousel-arrow-prev { left: 14px; }
.carousel-arrow-next { right: 14px; }
.carousel-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 13px;
}
.carousel-caption {
  font-family: var(--font-data);
  font-size: 11px;
  letter-spacing: 0.03em;
  color: var(--muted);
  min-height: 1.4em;
}
.carousel-dots {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.carousel-dot {
  /* 25px hit target (WCAG 2.2 AA) with a 7px visible dot centered. */
  width: 25px;
  height: 25px;
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.carousel-dot::after {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: transparent;
  transition: background-color 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.carousel-dot:hover::after,
.carousel-dot.is-active::after {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: var(--glow);
}

/* ── Feature entries ("Field manual") — L2-row vocabulary ───────── */
.entries {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1px;
  background: var(--border-weak);
  border: 1px solid var(--border-weak);
  border-radius: var(--radius-win);
  overflow: hidden;
  margin-top: 10px;
}
.entry {
  background: var(--surface);
  padding: 30px 26px;
  transition: background-color 0.15s, box-shadow 0.15s;
}
.entry:hover {
  background: var(--surface2);
}
.entry .tag {
  display: inline-block;
  font-family: var(--font-data);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  border-radius: var(--radius-tag);
  padding: 3px 8px;
  margin-bottom: 16px;
  box-shadow: var(--glow);
}
.entry h3 {
  margin-bottom: 10px;
}
.entry p {
  color: var(--muted2);
  margin: 0;
  font-size: 14px;
  line-height: 1.65;
}

/* ── Panels ─────────────────────────────────────────────────────── */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-win);
  padding: 30px;
}
.panel h3 {
  margin-bottom: 12px;
}
.panel p {
  color: var(--muted2);
  margin: 0;
  max-width: 880px;
}

/* ── Download builds ────────────────────────────────────────────── */
.platform-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 22px;
  margin-bottom: 24px;
}
.build-group {
  padding: 24px 26px 8px;
}
.build-group h3 {
  font-family: var(--font-data);
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent2);
  margin-bottom: 6px;
}
.build-group .build-group-sub {
  font-family: var(--font-data);
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 18px;
}
.build-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 15px 0;
  border-top: 1px solid var(--border-weak);
}
.build-row:first-of-type {
  border-top: none;
}
.build-row .build-label {
  font-family: var(--font-data);
  font-size: 12.5px;
  color: var(--text);
}
.build-row .build-size {
  color: var(--muted);
  font-size: 11px;
}
.build-row .btn {
  padding: 9px 18px;
  font-size: 11px;
}

/* ── Coordinate readout (join page) ─────────────────────────────── */
.readout {
  font-family: var(--font-data);
  font-size: 14px;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 17px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-ctl);
  margin-bottom: 24px;
  overflow: hidden;
}
.readout span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Stats strip ────────────────────────────────────────────────── */
.stat-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--border-weak);
  border: 1px solid var(--border-weak);
  border-radius: var(--radius-win);
  overflow: hidden;
}
.stat-cell {
  background: var(--surface);
  padding: 22px 26px;
}
.stat-cell .num {
  font-family: var(--font-data);
  font-size: 26px;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  margin-bottom: 4px;
}
.stat-cell .lbl {
  font-family: var(--font-data);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
}

/* ── Footer ─────────────────────────────────────────────────────── */
footer {
  border-top: 1px solid var(--border-weak);
  padding: 40px 0;
  color: var(--muted);
  font-family: var(--font-data);
  font-size: 11.5px;
  letter-spacing: 0.02em;
}
footer a {
  color: var(--muted2);
  text-decoration: underline;
  text-decoration-color: var(--border);
  text-underline-offset: 3px;
  transition: color 0.15s, text-decoration-color 0.15s;
}
footer a:hover {
  color: var(--accent);
  text-decoration-color: var(--accent-line);
}
code {
  background: var(--surface2);
  border: 1px solid var(--border-weak);
  border-radius: var(--radius-tag);
  padding: 2px 6px;
  font-size: 0.9em;
  font-family: var(--font-data);
}

/* ── Motion & accessibility ─────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .pulse-dot::before {
    animation: none;
    opacity: 0.4;
  }
  .load-in > * {
    animation: none;
    opacity: 1;
    transform: none;
  }
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
  .carousel-slide {
    transition: opacity 0.2s linear, visibility 0s linear 0.2s;
    transform: none;
  }
  .carousel-slide.is-active {
    transition: opacity 0.2s linear, visibility 0s linear 0s;
    transform: none;
  }
}

/* ── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .hero-content {
    max-width: 620px;
  }
}
@media (max-width: 640px) {
  section {
    padding: 64px 0;
  }
  .hero {
    padding-top: 72px;
    padding-bottom: 76px;
  }
  .site-nav .container {
    height: 56px;
  }
  .brand {
    height: 56px;
    font-size: 12.5px;
    gap: 8px;
  }
  nav.links {
    gap: 16px;
  }
  nav.links a {
    height: 56px;
    font-size: 10px;
  }
  .container {
    padding: 0 18px;
  }
  .stat-strip {
    grid-template-columns: 1fr;
  }
  .carousel-arrow {
    width: 32px;
    height: 32px;
    font-size: 17px;
  }
}
