/* ================================================================
   TIMA RADAR — "CONSOLE" DESIGN SYSTEM v5
   Mission-control dashboard aesthetic. Every section is a module.
   Display: Chakra Petch · Body: IBM Plex Sans · Data: JetBrains Mono
   ================================================================ */

:root {
  /* Surfaces */
  --void:    #04060a;
  --panel:   #090e15;
  --panel-2: #0d141d;
  --grid:    #121d2c;
  --edge:    #1c2b3f;
  --edge-hi: #2c445f;

  /* Text */
  --txt-1: #e9f2f9;
  --txt-2: #92a7b9;
  --txt-3: #4f6579;

  /* Signal colors */
  --green:     #2bff88;
  --green-dim: #12b25c;
  --red:       #ff3355;
  --amber:     #ffad33;
  --cyan:      #35d6ff;

  --f-display: 'Chakra Petch', 'Trebuchet MS', sans-serif;
  --f-body: 'IBM Plex Sans', 'Segoe UI', sans-serif;
  --f-mono: 'JetBrains Mono', 'Consolas', monospace;

  --maxw: 1220px;
  --r: 6px;
}

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

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

body {
  background: var(--void);
  color: var(--txt-2);
  font-family: var(--f-body);
  font-size: 15px;
  line-height: 1.65;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Global fine-grid backdrop */
body::before {
  content: '';
  position: fixed; inset: 0; z-index: -2;
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 56px 56px;
  opacity: 0.35;
}
/* Vignette so the grid recedes */
body::after {
  content: '';
  position: fixed; inset: 0; z-index: -1;
  background: radial-gradient(ellipse at 50% 0%, transparent 0%, var(--void) 82%);
  pointer-events: none;
}

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

a { color: inherit; }
::selection { background: rgba(43, 255, 136, .28); color: var(--txt-1); }
:focus-visible { outline: 2px solid var(--green); outline-offset: 3px; border-radius: 2px; }

/* ----------------------------------------------------------------
   STATUS LED
   ---------------------------------------------------------------- */
.led {
  display: inline-block;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 10px rgba(43, 255, 136, .8);
  animation: led-pulse 2.2s ease-in-out infinite;
  flex: none;
}
.led.red   { background: var(--red);   box-shadow: 0 0 10px rgba(255, 51, 85, .8); }
.led.amber { background: var(--amber); box-shadow: 0 0 10px rgba(255, 173, 51, .8); }
@keyframes led-pulse { 50% { opacity: .45; } }

/* ----------------------------------------------------------------
   TOP BAR
   ---------------------------------------------------------------- */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
  background: rgba(4, 6, 10, .85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--edge);
}
.topbar-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 60px; gap: 20px;
}
.brand {
  display: flex; align-items: center; gap: 12px;
  text-decoration: none;
}
.brand .sig {
  font-family: var(--f-display);
  font-weight: 700; font-size: 17px; letter-spacing: 3px;
  color: var(--txt-1); text-transform: uppercase;
}
.brand .sub {
  font-family: var(--f-mono);
  font-size: 9px; letter-spacing: 2px; color: var(--txt-3);
  text-transform: uppercase;
  border-left: 1px solid var(--edge);
  padding-left: 12px;
}
.topnav { display: flex; align-items: center; gap: 24px; }
.topnav a.link {
  font-family: var(--f-mono);
  font-size: 12px; letter-spacing: 1px; text-transform: uppercase;
  color: var(--txt-3); text-decoration: none;
  transition: color .15s;
}
.topnav a.link:hover { color: var(--green); }

.btn-launch {
  font-family: var(--f-display);
  font-weight: 600; font-size: 13px; letter-spacing: 2px;
  text-transform: uppercase; text-decoration: none;
  color: var(--void); background: var(--green);
  padding: 9px 18px;
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
  transition: filter .15s, box-shadow .15s;
  box-shadow: 0 0 20px rgba(43, 255, 136, .25);
}
.btn-launch:hover { filter: brightness(1.15); box-shadow: 0 0 30px rgba(43, 255, 136, .5); }

@media (max-width: 720px) {
  .brand .sub, .topnav a.hide-sm { display: none; }
  .topnav { gap: 14px; }
}

/* ----------------------------------------------------------------
   MODULE HEADER — every section announces itself like a subsystem
   ---------------------------------------------------------------- */
.module-head {
  display: flex; align-items: center; gap: 14px;
  font-family: var(--f-mono);
  font-size: 11px; letter-spacing: 2px; text-transform: uppercase;
  color: var(--txt-3);
  margin-bottom: 26px;
}
.module-head .id { color: var(--green); font-weight: 600; }
.module-head .rule { flex: 1; height: 1px; background: linear-gradient(90deg, var(--edge), transparent); }
.module-head .stat { display: flex; align-items: center; gap: 8px; white-space: nowrap; }

/* ----------------------------------------------------------------
   TYPE
   ---------------------------------------------------------------- */
.h-hero {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: clamp(38px, 5.6vw, 68px);
  line-height: 1.04;
  letter-spacing: -0.5px;
  color: var(--txt-1);
  text-transform: uppercase;
}
.h-1 {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: clamp(28px, 3.8vw, 44px);
  line-height: 1.08;
  color: var(--txt-1);
  text-transform: uppercase;
}
.h-2 {
  font-family: var(--f-display);
  font-weight: 600;
  font-size: clamp(20px, 2.4vw, 26px);
  line-height: 1.15;
  color: var(--txt-1);
  text-transform: uppercase;
}
.lede { font-size: clamp(15px, 1.8vw, 17.5px); line-height: 1.7; max-width: 64ch; color: var(--txt-2); }
.green { color: var(--green); }
.red   { color: var(--red); }
.amber { color: var(--amber); }

/* ----------------------------------------------------------------
   PANELS — bordered console modules with corner ticks
   ---------------------------------------------------------------- */
.panel {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: var(--r);
}
.panel .p-head {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--edge);
  font-family: var(--f-mono);
  font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--txt-3);
}
.panel .p-head .grow { flex: 1; }
.panel .p-body { padding: 20px; }

/* corner ticks */
.ticks::before, .ticks::after {
  content: '';
  position: absolute; width: 10px; height: 10px;
  border-color: var(--green); border-style: solid;
  opacity: .7;
}
.ticks::before { top: -1px; left: -1px; border-width: 2px 0 0 2px; }
.ticks::after  { bottom: -1px; right: -1px; border-width: 0 2px 2px 0; }

/* ----------------------------------------------------------------
   TELEMETRY ROWS + COUNTERS
   ---------------------------------------------------------------- */
.tele-row {
  display: flex; align-items: baseline; justify-content: space-between; gap: 16px;
  padding: 13px 0;
}
.tele-row + .tele-row { border-top: 1px dashed var(--edge); }
.tele-row .t-label {
  font-family: var(--f-mono);
  font-size: 10.5px; letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--txt-3);
}
.tele-row .t-value {
  font-family: var(--f-mono);
  font-size: 20px; font-weight: 700;
  color: var(--txt-1);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.tele-row .t-value .unit { font-size: 12px; color: var(--txt-3); font-weight: 400; }

.meter { height: 4px; background: var(--grid); border-radius: 2px; overflow: hidden; margin-top: 6px; }
.meter span {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, var(--green-dim), var(--green));
  transition: width 1.6s cubic-bezier(.2, .7, .3, 1);
}
.meter.hot span { background: linear-gradient(90deg, var(--amber), var(--red)); }

/* ----------------------------------------------------------------
   BIG STAT BLOCKS
   ---------------------------------------------------------------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 18px;
}
.stat {
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: var(--r);
  padding: 26px 24px;
  position: relative;
  overflow: hidden;
}
.stat::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, var(--green), transparent 60%);
}
.stat.alert::before { background: linear-gradient(90deg, var(--red), transparent 60%); }
.stat .s-value {
  font-family: var(--f-display);
  font-weight: 700; font-size: clamp(34px, 4vw, 46px); line-height: 1;
  color: var(--txt-1);
  font-variant-numeric: tabular-nums;
}
.stat.alert .s-value { color: var(--red); }
.stat .s-label {
  font-family: var(--f-mono);
  font-size: 10.5px; letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--green);
  margin: 12px 0 8px;
}
.stat.alert .s-label { color: var(--red); }
.stat .s-note { font-size: 13px; color: var(--txt-3); line-height: 1.55; }

/* ----------------------------------------------------------------
   BUTTONS
   ---------------------------------------------------------------- */
.cta-row { display: flex; gap: 14px; flex-wrap: wrap; }
.btn-solid {
  font-family: var(--f-display);
  font-weight: 600; font-size: 15px; letter-spacing: 2px;
  text-transform: uppercase; text-decoration: none;
  color: var(--void); background: var(--green);
  padding: 15px 30px;
  clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
  box-shadow: 0 0 26px rgba(43, 255, 136, .25);
  transition: filter .15s, box-shadow .15s;
}
.btn-solid:hover { filter: brightness(1.12); box-shadow: 0 0 40px rgba(43, 255, 136, .5); }
.btn-line {
  font-family: var(--f-display);
  font-weight: 600; font-size: 15px; letter-spacing: 2px;
  text-transform: uppercase; text-decoration: none;
  color: var(--txt-1); background: transparent;
  border: 1px solid var(--edge-hi);
  padding: 14px 30px;
  transition: border-color .15s, background .15s, color .15s;
}
.btn-line:hover { border-color: var(--green); color: var(--green); background: rgba(43, 255, 136, .04); }
.btn-line.danger:hover { border-color: var(--red); color: var(--red); background: rgba(255, 51, 85, .04); }

/* ----------------------------------------------------------------
   SECTIONS / GRIDS
   ---------------------------------------------------------------- */
.module { padding: 96px 0; }
.module + .module { border-top: 1px solid var(--edge); }

.cols-2 {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 56px; align-items: center;
}
.cols-2.top { align-items: start; }
@media (max-width: 920px) { .cols-2 { grid-template-columns: 1fr; gap: 38px; } }

/* Prevent grid blowout: children may shrink below content min-width */
.cols-2 > *, .doc-layout > *, .hero-grid > *, .console-stack > * { min-width: 0; }
.table-scroll { overflow-x: auto; }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
}

/* Threat table (hero + demos) */
.threat-table { width: 100%; border-collapse: collapse; }
.threat-table th {
  font-family: var(--f-mono);
  font-size: 9.5px; letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--txt-3); text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--edge);
}
.threat-table td {
  font-family: var(--f-mono);
  font-size: 12px;
  padding: 9px 10px;
  border-bottom: 1px solid var(--grid);
  color: var(--txt-2);
  font-variant-numeric: tabular-nums;
}
.threat-table tr:last-child td { border-bottom: none; }
.threat-table .score-hi  { color: var(--red);   font-weight: 700; }
.threat-table .score-med { color: var(--amber); font-weight: 700; }
.threat-table .score-lo  { color: var(--green); }

.badge {
  font-family: var(--f-mono);
  font-size: 9px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase;
  padding: 3px 8px; border-radius: 3px;
  white-space: nowrap;
}
.badge.hi  { color: var(--red);   background: rgba(255, 51, 85, .1);  border: 1px solid rgba(255, 51, 85, .4); }
.badge.med { color: var(--amber); background: rgba(255, 173, 51, .08); border: 1px solid rgba(255, 173, 51, .35); }
.badge.lo  { color: var(--green); background: rgba(43, 255, 136, .07); border: 1px solid rgba(43, 255, 136, .3); }

/* Data tables (technical) */
.table-frame {
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: var(--r);
  overflow-x: auto;
  margin: 26px 0;
}
table.data { width: 100%; border-collapse: collapse; min-width: 560px; text-align: left; }
table.data th {
  font-family: var(--f-mono);
  font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--txt-3);
  background: rgba(4, 6, 10, .6);
  padding: 12px 18px;
  border-bottom: 1px solid var(--edge);
}
table.data td {
  padding: 13px 18px; font-size: 13px;
  border-bottom: 1px solid var(--grid);
  font-family: var(--f-mono); color: var(--txt-2);
}
table.data tr:last-child td { border-bottom: none; }
table.data td:first-child { font-family: var(--f-body); font-weight: 500; color: var(--txt-1); }
td.ok  { color: var(--green); }
td.hot { color: var(--red); font-weight: 700; }
td.warm{ color: var(--amber); }

/* Steps / pipeline */
.pipe { display: flex; flex-direction: column; }
.pipe-step { display: flex; gap: 16px; padding: 15px 0; }
.pipe-step + .pipe-step { border-top: 1px dashed var(--edge); }
.pipe-step .idx {
  flex: none;
  font-family: var(--f-mono); font-size: 11px; font-weight: 700;
  color: var(--green);
  width: 34px; height: 34px;
  border: 1px solid var(--edge-hi);
  display: flex; align-items: center; justify-content: center;
  margin-top: 2px;
}
.pipe-step strong {
  display: block;
  font-family: var(--f-display); font-size: 15px; font-weight: 600;
  letter-spacing: 1px; text-transform: uppercase;
  color: var(--txt-1); margin-bottom: 4px;
}
.pipe-step span { font-size: 13px; color: var(--txt-3); }

/* Code */
pre {
  background: var(--void);
  border: 1px solid var(--edge);
  border-radius: var(--r);
  padding: 18px;
  overflow-x: auto;
  font-family: var(--f-mono);
  font-size: 12.5px; line-height: 1.6;
  color: #d6e4ef;
  margin: 22px 0;
}
pre .c { color: var(--txt-3); }
pre .g { color: var(--green); }

/* Callout */
.callout {
  border: 1px solid rgba(255, 51, 85, .4);
  background: rgba(255, 51, 85, .05);
  border-radius: var(--r);
  padding: 20px 22px;
  margin: 32px 0;
}
.callout h4 {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--f-mono);
  font-size: 11px; letter-spacing: 2px; text-transform: uppercase;
  color: var(--red); margin-bottom: 8px;
}
.callout p { font-size: 13.5px; color: var(--txt-2); }

/* CTA block / footer */
.cta-module {
  border-top: 1px solid var(--edge);
  background:
    radial-gradient(640px 320px at 50% 0%, rgba(43, 255, 136, .06), transparent 70%),
    var(--panel);
  padding: 100px 0; text-align: center;
}
.contact-chip {
  display: inline-flex; align-items: center; gap: 12px;
  font-family: var(--f-mono); font-size: 15px;
  color: var(--green); text-decoration: none;
  background: var(--void);
  border: 1px solid var(--edge);
  padding: 16px 32px; margin-top: 32px;
  clip-path: polygon(12px 0, 100% 0, 100% calc(100% - 12px), calc(100% - 12px) 100%, 0 100%, 0 12px);
  transition: border-color .15s, box-shadow .15s;
}
.contact-chip:hover { border-color: var(--green); box-shadow: 0 0 26px rgba(43, 255, 136, .18); }

.footer { border-top: 1px solid var(--edge); padding: 40px 0; }
.footer-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  font-family: var(--f-mono);
  font-size: 11px; letter-spacing: .5px; color: var(--txt-3);
}
.footer a { color: var(--txt-3); text-decoration: none; }
.footer a:hover { color: var(--green); }

/* ----------------------------------------------------------------
   TECH DOC LAYOUT
   ---------------------------------------------------------------- */
.doc-layout {
  display: grid; grid-template-columns: 250px 1fr;
  gap: 56px; padding: 64px 0 110px;
}
@media (max-width: 900px) {
  .doc-layout { grid-template-columns: 1fr; }
  .doc-toc { display: none; }
}
.doc-toc { position: sticky; top: 96px; height: fit-content; }
.doc-toc .t-head {
  font-family: var(--f-mono);
  font-size: 10px; letter-spacing: 2px; text-transform: uppercase;
  color: var(--txt-3); margin-bottom: 16px;
}
.doc-toc a {
  display: block; font-family: var(--f-mono);
  font-size: 12px; text-decoration: none;
  color: var(--txt-3);
  padding: 7px 0 7px 14px;
  border-left: 1px solid var(--edge);
  transition: color .12s, border-color .12s;
}
.doc-toc a:hover { color: var(--green); border-left-color: var(--green); }

.doc-section { margin-bottom: 68px; scroll-margin-top: 100px; }
.doc-section h2 {
  font-family: var(--f-display);
  font-weight: 600; font-size: 24px; letter-spacing: .5px;
  text-transform: uppercase;
  color: var(--txt-1);
  padding-bottom: 10px;
  border-bottom: 1px solid var(--edge);
  margin-bottom: 22px;
}
.doc-section p { font-size: 14.5px; margin-bottom: 18px; max-width: 74ch; }
.doc-section ul { margin: 0 0 18px 20px; font-size: 14.5px; }
.doc-section li { margin-bottom: 9px; }
.doc-section strong { color: var(--txt-1); font-weight: 600; }

/* Utility */
.mt-1 { margin-top: 12px; } .mt-2 { margin-top: 22px; } .mt-3 { margin-top: 34px; } .mt-4 { margin-top: 48px; }
.center { text-align: center; }
.center .lede { margin-left: auto; margin-right: auto; }

/* ----------------------------------------------------------------
   v5.1 ADDITIONS — live-console states for interior pages
   ---------------------------------------------------------------- */

/* Flywheel: sequential active step */
.pipe-step .idx { transition: background .3s, color .3s, border-color .3s, box-shadow .3s; }
.pipe-step strong { transition: color .3s; }
.pipe-step.active .idx {
  background: var(--green);
  color: var(--void);
  border-color: var(--green);
  box-shadow: 0 0 16px rgba(43, 255, 136, .45);
}
.pipe-step.active strong { color: var(--green); }

/* Scrollspy TOC */
.doc-toc a.active {
  color: var(--green);
  border-left-color: var(--green);
}

/* Meter value pair rows (performance readouts) */
.meter-row { padding: 12px 0; }
.meter-row + .meter-row { border-top: 1px dashed var(--edge); }
.meter-row .m-top {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 7px;
}
.meter-row .m-label {
  font-family: var(--f-mono);
  font-size: 10.5px; letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--txt-3);
}
.meter-row .m-val {
  font-family: var(--f-mono);
  font-size: 16px; font-weight: 700;
  color: var(--txt-1);
  font-variant-numeric: tabular-nums;
}
.meter-row .m-val.hot { color: var(--red); }
