/* ================================================================
   Swarmonic design system
   Industrial, technical, high-contrast. Reads like instrumentation,
   not like a consumer SaaS landing page.
   ================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

:root {
  --bg:            #07070b;
  --bg-raised:     #0e0e15;
  --bg-panel:      #12121b;
  --bg-hover:      #191924;
  --border:        #23232f;
  --border-bright: #33333f;

  --text:          #e8e8f0;
  --text-dim:      #9a9aab;
  --text-faint:    #767686; /* Layer 0-D D-03: 4.5:1 on bg */

  --accent:        #00e0a4;   /* swarm green — synchronisation, go */
  --accent-dim:    #00a87b;
  --signal:        #4d9fff;   /* protocol blue — data, links */
  --warn:          #ffb020;
  --danger:        #ff4d5e;
  --violet:        #9d7bff;   /* intelligence */

  --mono: 'JetBrains Mono', ui-monospace, monospace;
  --sans: 'Inter', system-ui, -apple-system, sans-serif;

  --radius: 10px;
  --maxw: 1240px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--signal); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 28px; }

/* ── Navigation ─────────────────────────────────────────────── */

nav {
  position: sticky; top: 0; z-index: 100;
  background: rgba(7, 7, 11, 0.88);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
nav .wrap {
  display: flex; align-items: center; justify-content: space-between;
  height: 62px;
}
.brand {
  display: flex; align-items: center; gap: 11px;
  font-weight: 800; font-size: 17px; letter-spacing: -0.3px;
  color: var(--text); text-decoration: none;
}
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 26px; height: 26px; flex-shrink: 0;
}
.nav-links { display: flex; gap: 26px; align-items: center; }
.nav-links a {
  font-size: 13.5px; font-weight: 500; color: var(--text-dim);
}
.nav-links a:hover { color: var(--text); text-decoration: none; }
.nav-links a.active { color: var(--accent); }

/* `.nav-links a` (specificity 0,2,1) outranks `.btn-primary` (0,1,0), so button
   text inside the nav inherited --text-dim and rendered light-grey on green.
   These rules restore the intended contrast. */
.nav-links a.btn { color: var(--text); }
.nav-links a.btn-primary { color: #04120d; }
.nav-links a.btn-danger { color: #fff; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 17px; border-radius: 7px;
  font-size: 13.5px; font-weight: 600;
  border: 1px solid var(--border-bright);
  background: var(--bg-panel); color: var(--text);
  cursor: pointer; transition: all .15s;
}
.btn:hover { background: var(--bg-hover); text-decoration: none; border-color: var(--text-faint); }
.btn-primary {
  background: var(--accent); color: #04120d; border-color: var(--accent);
}
.btn-primary:hover { background: #00f5b3; border-color: #00f5b3; }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: #ff6675; border-color: #ff6675; }

/* ── Hero ───────────────────────────────────────────────────── */

.hero { padding: 96px 0 72px; position: relative; overflow: hidden; }
.hero::before {
  content: ''; position: absolute; inset: 0;
  background:
    radial-gradient(circle at 22% 12%, rgba(0, 224, 164, .09), transparent 42%),
    radial-gradient(circle at 82% 62%, rgba(77, 159, 255, .07), transparent 45%);
  pointer-events: none;
}
.hero .wrap { position: relative; }

/* Ambient cinematic hero video — fades in behind the copy, never demands a click */
.hero-video {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: center 38%;
  opacity: 0; transition: opacity 2.4s ease;
  filter: saturate(.92) brightness(.86);
  pointer-events: none;
}
.hero-video.is-live { opacity: .34; }
.hero-veil {
  position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(180deg, rgba(10,11,15,.86) 0%, rgba(10,11,15,.55) 40%, rgba(10,11,15,.94) 100%),
    radial-gradient(circle at 24% 30%, rgba(10,11,15,.25), transparent 60%);
}
.hero-cine::before { z-index: 1; }
.hero-cine .hero-veil { z-index: 1; }
.hero-cine .wrap { z-index: 2; }

/* Full-width cinematic band between sections */
.media-band {
  position: relative; overflow: hidden;
  width: 100%; max-width: 100%; /* cap aspect-ratio min-height transfer (Layer 0-D D-11) */
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
  min-height: 340px; max-height: 62vh; aspect-ratio: 21 / 8;
}
.media-band-video {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; opacity: 0; transition: opacity 2.4s ease;
  filter: saturate(.96);
}
.media-band-video.is-live { opacity: 1; }
.media-band-veil {
  position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, rgba(10,11,15,.78) 0%, rgba(10,11,15,.12) 42%, rgba(10,11,15,.82) 100%);
}
.media-band-caption {
  position: absolute; inset: auto 0 34px 0;
}
.media-band-caption h2 {
  font-size: 32px; letter-spacing: -1px; margin: 0;
  text-shadow: 0 2px 22px rgba(0,0,0,.65);
}
@media (max-width: 640px) {
  .media-band { aspect-ratio: 4 / 3; }
  .media-band-caption h2 { font-size: 22px; }
}
@media (prefers-reduced-motion: reduce) {
  .hero-video, .media-band-video { opacity: 0 !important; }
}

.eyebrow {
  display: inline-flex; align-items: center; gap: 9px;
  font-family: var(--mono); font-size: 11.5px; font-weight: 600;
  letter-spacing: 1.4px; text-transform: uppercase;
  color: var(--accent);
  border: 1px solid rgba(0, 224, 164, .28);
  background: rgba(0, 224, 164, .07);
  padding: 6px 13px; border-radius: 99px;
  margin-bottom: 26px;
}

h1 {
  font-size: 60px; font-weight: 900; line-height: 1.04;
  letter-spacing: -2.2px; margin-bottom: 22px;
  max-width: 15em;
}
h1 .grad {
  background: linear-gradient(100deg, var(--accent), var(--signal));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.lede {
  font-size: 19.5px; color: var(--text-dim); max-width: 40em;
  margin-bottom: 34px; line-height: 1.62;
}
.hero-actions { display: flex; gap: 13px; flex-wrap: wrap; }

/* ── Sections ───────────────────────────────────────────────── */

section { padding: 74px 0; border-top: 1px solid var(--border); }
.section-label {
  font-family: var(--mono); font-size: 11.5px; font-weight: 600;
  letter-spacing: 1.4px; text-transform: uppercase;
  color: var(--text-faint); margin-bottom: 15px;
}
h2 {
  font-size: 35px; font-weight: 800; letter-spacing: -1.1px;
  margin-bottom: 17px; line-height: 1.16;
}
h3 { font-size: 18px; font-weight: 700; margin-bottom: 9px; letter-spacing: -0.3px; }
.section-lede { font-size: 17px; color: var(--text-dim); max-width: 46em; margin-bottom: 42px; }

/* ── Grid + cards ───────────────────────────────────────────── */

.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

.card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 25px;
}
.card.accent { border-left: 2px solid var(--accent); }
.card.signal { border-left: 2px solid var(--signal); }
.card.violet { border-left: 2px solid var(--violet); }
.card.warn   { border-left: 2px solid var(--warn); }
.card p { color: var(--text-dim); font-size: 14.5px; }
.card-num {
  font-family: var(--mono); font-size: 11.5px; font-weight: 700;
  color: var(--text-dim); margin-bottom: 13px; letter-spacing: 1px; /* Layer 0-D D-03 */
}

/* ── Stats ──────────────────────────────────────────────────── */

.stat-row {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 1px; background: var(--border);
  border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden;
}
.stat { background: var(--bg-panel); padding: 24px 22px; }
.stat .v {
  font-family: var(--mono); font-size: 31px; font-weight: 700;
  color: var(--accent); letter-spacing: -1.2px; line-height: 1.1;
}
.stat .v.signal { color: var(--signal); }
.stat .v.violet { color: var(--violet); }
.stat .k {
  font-size: 12.5px; color: var(--text-faint); margin-top: 7px;
  text-transform: uppercase; letter-spacing: .7px; font-weight: 600;
}

/* ── Tables ─────────────────────────────────────────────────── */

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
thead th {
  text-align: left; padding: 12px 14px;
  font-family: var(--mono); font-size: 10.5px; font-weight: 700;
  letter-spacing: 1px; text-transform: uppercase; color: var(--text-faint);
  background: var(--bg-raised); border-bottom: 1px solid var(--border);
}
tbody td { padding: 11px 14px; border-bottom: 1px solid var(--border); color: var(--text-dim); }
tbody tr:hover td { background: var(--bg-hover); }
tbody td.mono { font-family: var(--mono); font-size: 12.5px; color: var(--text); }
.table-wrap {
  border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
}

/* ── Pills ──────────────────────────────────────────────────── */

.pill {
  display: inline-block; font-family: var(--mono);
  font-size: 10.5px; font-weight: 600; letter-spacing: .6px;
  padding: 3px 9px; border-radius: 5px; text-transform: uppercase;
}
.pill-ok     { background: rgba(0,224,164,.13);  color: var(--accent); }
.pill-signal { background: rgba(77,159,255,.13); color: var(--signal); }
.pill-warn   { background: rgba(255,176,32,.13); color: var(--warn); }
.pill-danger { background: rgba(255,77,94,.14);  color: var(--danger); }
.pill-violet { background: rgba(157,123,255,.14);color: var(--violet); }
.pill-mute   { background: #1c1c26;              color: var(--text-faint); }

/* ── Footer ─────────────────────────────────────────────────── */

footer {
  border-top: 1px solid var(--border); padding: 42px 0;
  color: var(--text-faint); font-size: 13px;
}
footer .wrap { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
footer a { color: var(--text-dim); }

/* ── Notice ─────────────────────────────────────────────────── */

.notice {
  border: 1px solid var(--border-bright);
  background: var(--bg-raised);
  border-left: 2px solid var(--signal);
  border-radius: var(--radius);
  padding: 18px 21px; font-size: 14px; color: var(--text-dim);
}
.notice strong { color: var(--text); }

/* ── Responsive ─────────────────────────────────────────────── */

@media (max-width: 900px) {
  h1 { font-size: 40px; letter-spacing: -1.4px; }
  h2 { font-size: 27px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .stat-row { grid-template-columns: repeat(2, 1fr); }
  .nav-links { gap: 6px; }
  .nav-links a.hide-sm { display: none; }
}

/* ================================================================
   Premium pass (2026-08-03) — "high-ops console" refinement
   Mobile coherence + billion-dollar detail work. No layout rewrites.
   ================================================================ */

/* Precision details everywhere */
::selection { background: rgba(0,224,164,.25); color: var(--text); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.stat .v, .metric .v, td.mono, .mono, .card-num { font-variant-numeric: tabular-nums; }
* { scrollbar-width: thin; scrollbar-color: var(--border-bright) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: var(--border-bright); border-radius: 4px; }
*::-webkit-scrollbar-track { background: transparent; }

/* Hairline signal under the nav — instrumentation, not decoration */
nav::after {
  content: ''; display: block; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(0,224,164,.35) 30%, rgba(77,159,255,.3) 70%, transparent);
  opacity: .5;
}

/* Card + button micro-interaction: quiet, mechanical, no bounce */
.card { transition: border-color .18s ease, transform .18s ease; }
.card:hover { border-color: var(--border-bright); }
.btn:active { transform: translateY(1px); }
.btn-primary { box-shadow: 0 0 0 1px rgba(0,224,164,.25), 0 4px 18px rgba(0,224,164,.12); }

/* Tables never break the viewport — they scroll inside their frame */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-wrap table { min-width: 560px; }

/* ── Mobile nav: two-deck console header (no JS, no hamburger) ── */
@media (max-width: 700px) {
  nav .wrap { flex-wrap: wrap; height: auto; padding-top: 10px; }
  .brand { height: 42px; font-size: 16px; } /* Layer 0-D D-10 */
  .nav-links {
    width: 100%; overflow-x: auto; gap: 6px;
    padding: 2px 0 10px; -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .nav-links::-webkit-scrollbar { display: none; }
  .nav-links a {
    flex-shrink: 0;
    font-family: var(--mono); font-size: 10.5px; font-weight: 600;
    letter-spacing: .9px; text-transform: uppercase;
    padding: 12px 13px; border: 1px solid var(--border); border-radius: 8px; /* Layer 0-D D-10: >=40px tap */
    background: var(--bg-raised); color: var(--text-dim);
  }
  .nav-links a.active { color: var(--accent); border-color: rgba(0,224,164,.4); background: rgba(0,224,164,.06); }
  .nav-links a.hide-sm { display: inline-flex; }  /* scrollable deck: nothing hidden */
  .nav-links a.btn-primary { background: var(--accent); color: #04120d; border-color: var(--accent); }
  .nav-links a.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
}

/* ── Small-phone typography tier ── */
@media (max-width: 640px) {
  .wrap { padding: 0 18px; }
  .card p, .notice { font-size: 15px; } /* Layer 0-D D-05: >=15px body on mobile */
  .hero { padding: 58px 0 48px; }
  h1 { font-size: 33px; letter-spacing: -1.1px; }
  .lede { font-size: 16px; }
  .eyebrow { font-size: 10px; letter-spacing: 1.1px; padding: 5px 11px; }
  h2 { font-size: 23px; letter-spacing: -0.7px; }
  .section-lede { font-size: 15px; }
  section { padding: 52px 0; }
  .hero-actions .btn { padding: 11px 16px; }
  .stat { padding: 18px 16px; }
  .stat .v { font-size: 24px; }
  .card { padding: 19px; }
  footer .wrap { flex-direction: column; gap: 10px; }
  footer a { display: inline-block; padding: 12px 4px; } /* Layer 0-D D-10 */
}
@media (max-width: 400px) {
  h1 { font-size: 29px; }
  .stat-row { grid-template-columns: 1fr 1fr; }
}

/* ── Swarmation playbook ─────────────────────────────────────────────── */
.playbook {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 14px;
}
.play {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 7px;
  padding: 12px 12px 11px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-dim);
  font-family: var(--sans);
  text-align: left;
  cursor: pointer;
  transition: border-color .18s ease, background .18s ease,
              transform .12s ease, box-shadow .25s ease;
}
.play:hover {
  background: var(--bg-hover);
  border-color: var(--border-bright);
  transform: translateY(-1px);
}
.play:active { transform: translateY(0); }
.play-glyph { width: 72px; height: 48px; color: var(--text-dim); flex: none; }
.play-name {
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--text);
}
.play-desc { font-size: 11.5px; line-height: 1.45; color: var(--text-faint); }
.play-state {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .1em;
  color: var(--signal);
  min-height: 12px;
}
.play.pending { border-color: var(--signal); }
.play.active {
  border-color: var(--signal);
  background: var(--bg-hover);
  box-shadow: 0 0 0 1px var(--signal), 0 0 26px rgba(77, 159, 255, .13);
}
.play.active.locked {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), 0 0 26px rgba(0, 224, 164, .15);
}
.play.active.locked .play-state { color: var(--accent); }

/* Robots glide between one-second ticks instead of teleporting. */
#map .bot { transition: transform 1.05s linear; will-change: transform; }

/* Live-play chip pinned over the map. */
.map-body { position: relative; }
.play-chip {
  position: absolute;
  top: 22px;
  left: 22px;
  z-index: 2;
  padding: 5px 11px;
  background: rgba(7, 7, 11, .82);
  border: 1px solid var(--signal);
  border-radius: 6px;
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--signal);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.play-chip.locked {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 18px rgba(0, 224, 164, .18);
}
.legend .legend-slot {
  background: none !important;
  border: 1.5px dashed var(--text-dim);
  border-radius: 3px;
}

@media (max-width: 900px) {
  .playbook { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 700px) {
  /* One-hand deck: swipe sideways through the plays. */
  .playbook {
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    padding: 12px;
    gap: 9px;
  }
  .play { flex: 0 0 168px; }
  .play-chip { top: 18px; left: 18px; font-size: 9.5px; }
}

/* Grid children may not shrink below content width by default — without
   min-width:0 the playbook deck forces the whole page wider than the phone. */
.cols > div { min-width: 0; }
.playbook-panel { min-width: 0; }
.playbook { max-width: 100%; }


/* ── Layer 0-M app-readiness pass (8/3): safe-area + Apple HIG 44px taps ── */
nav { padding-top: env(safe-area-inset-top); }
body { padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
footer { padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
.nav-links a, nav .brand { min-height: 44px; display: inline-flex; align-items: center; }
.footer-links a, .btn, button { min-height: 44px; }
a.card, .hero-ctas a { min-height: 44px; }
