/* ==========================================================================
   ABI Field Index — tactical slate theme
   Dark, low-chroma, military-terminal. No web fonts: system stack only, so the
   first paint is not blocked by a font request.
   ========================================================================== */

:root {
  --ink: #080a09;
  --ink-2: #0d100e;
  --plate: #121614;
  --plate-2: #171c19;
  --line: #242b26;
  --line-hot: #3a443c;
  --text: #d8ded6;
  --text-dim: #8e9a8f;
  --text-faint: #5e6a60;
  --olive: #9aa870;
  --olive-hot: #c3d18e;
  --amber: #c8a24a;
  --rust: #c8452f;
  --cyan: #4fa6a0;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --cut: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 10px 100%, 0 calc(100% - 10px));
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  /* Faint scanline grid — reads as a terminal, costs nothing to paint. */
  background-image:
    linear-gradient(to right, rgba(154,168,112,.045) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(154,168,112,.045) 1px, transparent 1px);
  background-size: 64px 64px;
}

img { max-width: 100%; display: block; }
a { color: var(--olive-hot); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { width: min(1240px, 100% - 40px); margin-inline: auto; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

.brand { color: inherit; text-decoration: none; }
.brand:hover, .brand:focus-visible { text-decoration: none; }
.brand:hover b { color: var(--olive-hot); }
.brand:focus-visible { outline: 1px solid var(--line-hot); outline-offset: 3px; }

/* ---------------------------------------------------------------- top rail */
.rail {
  position: sticky; top: 0; z-index: 50;
  background: rgba(8,10,9,.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.rail-inner {
  display: flex; align-items: center; gap: 22px;
  height: 58px;
}
.brand { display: flex; align-items: baseline; gap: 9px; white-space: nowrap; }
.brand b { font-size: 15px; letter-spacing: .14em; text-transform: uppercase; color: var(--text); }
.brand span { font-family: var(--mono); font-size: 11px; color: var(--olive); letter-spacing: .1em; }

.rail nav { display: flex; gap: 4px; margin-left: auto; flex-wrap: wrap; }
.rail nav a {
  color: var(--text-dim); font-size: 13px; letter-spacing: .04em;
  padding: 7px 11px; border: 1px solid transparent; text-decoration: none;
}
.rail nav a:hover { color: var(--text); border-color: var(--line-hot); background: var(--plate); }
.rail nav a[aria-current="page"] {
  color: var(--ink); background: var(--olive); border-color: var(--olive); font-weight: 600;
}

/* ---------------------------------------------------------------- hero */
.hero { position: relative; padding: 54px 0 34px; border-bottom: 1px solid var(--line); overflow: hidden; }
.hero::after {
  content: ""; position: absolute; inset: auto 0 0 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--olive), transparent); opacity: .5;
}
.eyebrow {
  font-family: var(--mono); font-size: 11px; letter-spacing: .22em; text-transform: uppercase;
  color: var(--olive); margin: 0 0 14px;
}
.hero h1 {
  margin: 0 0 14px; font-size: clamp(30px, 5.2vw, 54px); line-height: 1.03;
  letter-spacing: -.02em; font-weight: 700; text-wrap: balance;
}
.hero h1 em { font-style: normal; color: var(--olive-hot); }
.hero p.lede { margin: 0; max-width: 62ch; color: var(--text-dim); font-size: 16px; }

/* stat strip */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); gap: 1px; margin-top: 30px; background: var(--line); border: 1px solid var(--line); }
.stat { background: var(--ink-2); padding: 14px 16px; }
.stat b { display: block; font-family: var(--mono); font-size: 26px; line-height: 1.1; color: var(--olive-hot); font-variant-numeric: tabular-nums; }
.stat span { display: block; margin-top: 4px; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--text-faint); }

/* ---------------------------------------------------------------- sections */
section { padding: 46px 0; }
section + section { border-top: 1px solid var(--line); }
.sec-head { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; margin-bottom: 6px; }
.sec-head h2 { margin: 0; font-size: 22px; letter-spacing: -.01em; }
.sec-head .tag { font-family: var(--mono); font-size: 11px; letter-spacing: .12em; color: var(--text-faint); text-transform: uppercase; }
.sec-note { margin: 0 0 20px; color: var(--text-dim); font-size: 14px; max-width: 78ch; }

/* portal cards */
.portal { display: grid; grid-template-columns: repeat(auto-fit, minmax(228px, 1fr)); gap: 14px; }
.pcard {
  position: relative; display: block; padding: 20px 18px 18px;
  background: var(--plate); border: 1px solid var(--line);
  clip-path: var(--cut); color: inherit; text-decoration: none;
  transition: background .16s, border-color .16s, transform .16s;
}
.pcard:hover { background: var(--plate-2); border-color: var(--olive); transform: translateY(-2px); text-decoration: none; }
.pcard .k { font-family: var(--mono); font-size: 10px; letter-spacing: .18em; color: var(--olive); }
.pcard h3 { margin: 8px 0 6px; font-size: 17px; }
.pcard p { margin: 0; font-size: 13px; color: var(--text-dim); }
.pcard .n { position: absolute; top: 16px; right: 16px; font-family: var(--mono); font-size: 20px; color: var(--line-hot); }

/* ---------------------------------------------------------------- controls */
.controls {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  padding: 14px; margin-bottom: 14px;
  background: var(--plate); border: 1px solid var(--line); clip-path: var(--cut);
}
.controls input[type="search"], .controls select {
  appearance: none; background: var(--ink-2); color: var(--text);
  border: 1px solid var(--line-hot); padding: 9px 11px; font: inherit; font-size: 14px;
  border-radius: 0; min-width: 0;
}
.controls input[type="search"] { flex: 1 1 240px; }
.controls input[type="search"]:focus, .controls select:focus { outline: 2px solid var(--olive); outline-offset: -2px; }
.controls select { flex: 0 0 auto; cursor: pointer; }
.controls .count { margin-left: auto; font-family: var(--mono); font-size: 12px; color: var(--text-faint); white-space: nowrap; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.chip {
  font-family: var(--mono); font-size: 12px; letter-spacing: .04em;
  padding: 5px 10px; background: var(--ink-2); color: var(--text-dim);
  border: 1px solid var(--line); cursor: pointer; user-select: none;
}
.chip:hover { color: var(--text); border-color: var(--line-hot); }
.chip[aria-pressed="true"] { background: var(--olive); color: var(--ink); border-color: var(--olive); font-weight: 600; }

/* ---------------------------------------------------------------- tables */
.tablewrap { border: 1px solid var(--line); background: var(--ink-2); overflow: auto; max-height: 74vh; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th {
  position: sticky; top: 0; z-index: 2;
  background: #10140f; color: var(--text-dim);
  font-family: var(--mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase;
  text-align: left; font-weight: 500;
  padding: 10px 12px; border-bottom: 1px solid var(--line-hot);
  cursor: pointer; white-space: nowrap;
}
thead th:hover { color: var(--olive-hot); }
thead th[data-sort]::after { content: " \2195"; opacity: .35; font-size: 10px; }
thead th[aria-sort="ascending"]::after { content: " \2191"; opacity: 1; color: var(--olive); }
thead th[aria-sort="descending"]::after { content: " \2193"; opacity: 1; color: var(--olive); }

tbody td { padding: 9px 12px; border-bottom: 1px solid rgba(36,43,38,.7); vertical-align: middle; }
tbody tr:nth-child(even) { background: rgba(255,255,255,.014); }
tbody tr:hover { background: rgba(154,168,112,.075); }
tbody tr:last-child td { border-bottom: 0; }

td.num, th.num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.name-cell { font-weight: 600; color: var(--text); }
.sub { display: block; font-size: 11px; color: var(--text-faint); font-family: var(--mono); }

/* armour-class pips */
.pips { display: inline-flex; gap: 2px; }
.pips i { width: 7px; height: 12px; background: var(--line-hot); display: block; }
.pips i.on { background: var(--olive); }
.pips i.hot { background: var(--rust); }

/* grade badge */
.grade {
  display: inline-block; min-width: 22px; text-align: center;
  font-family: var(--mono); font-size: 11px; font-weight: 700;
  padding: 2px 5px; border: 1px solid currentColor;
}
.g-S { color: #e0c56a; } .g-A { color: var(--olive-hot); } .g-B { color: var(--cyan); }
.g-C { color: var(--text-dim); } .g-D { color: #9b7a56; } .g-E { color: var(--text-faint); }
.tier-S { color: #e0c56a; border-color: #e0c56a; }
.tier-A { color: var(--olive-hot); border-color: var(--olive-hot); }
.tier-B { color: var(--cyan); border-color: var(--cyan); }
.tier-C { color: var(--text-dim); border-color: var(--line-hot); }

.flag { font-family: var(--mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--amber); border: 1px solid rgba(200,162,74,.5); padding: 1px 5px; }

.empty { padding: 40px 16px; text-align: center; color: var(--text-faint); font-family: var(--mono); font-size: 13px; }

/* map pins */
.mapgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.mapcard { background: var(--plate); border: 1px solid var(--line); clip-path: var(--cut); padding: 16px; }
.mapcard h3 { margin: 0 0 2px; font-size: 17px; }
.mapcard .meta { font-family: var(--mono); font-size: 11px; color: var(--text-faint); letter-spacing: .08em; margin-bottom: 12px; }
.pinlist { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.pinlist li { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 7px 9px; background: var(--ink-2); border-left: 2px solid var(--olive); font-size: 13px; }
.pinlist li.miss { border-left-color: var(--amber); }
.pinlist .note { display: block; font-size: 11px; color: var(--text-faint); }
.pinlist .coord { font-family: var(--mono); font-size: 11px; color: var(--text-faint); white-space: nowrap; }

/* footer */
footer { border-top: 1px solid var(--line); padding: 30px 0 44px; color: var(--text-faint); font-size: 13px; }
footer .row { display: flex; gap: 18px; flex-wrap: wrap; justify-content: space-between; }
footer a { color: var(--text-dim); }

/* ---------------------------------------------------------------- map boards */
.mapboard {
  border: 1px solid var(--line); background: var(--ink-2);
  margin-bottom: 26px;
}
.mapboard-head {
  display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap;
  padding: 14px 16px; border-bottom: 1px solid var(--line);
}
.mapboard-head h3 { margin: 0; font-size: 18px; }
.mapboard-head .meta {
  font-family: var(--mono); font-size: 11px; color: var(--text-faint);
  letter-spacing: .08em;
}
.mapboard-head .layers { display: flex; gap: 6px; margin-left: auto; flex-wrap: wrap; }
.mapboard-head .layers button {
  font-family: var(--mono); font-size: 11px; letter-spacing: .06em;
  padding: 4px 9px; background: var(--ink); color: var(--text-dim);
  border: 1px solid var(--line); cursor: pointer;
}
.mapboard-head .layers button[aria-pressed="true"] { color: var(--ink); background: var(--olive); border-color: var(--olive); font-weight: 600; }

.mapcanvas { position: relative; line-height: 0; overflow: hidden; }
.mapcanvas img {
  width: 100%; height: auto; display: block;
  /* Slight desaturation so the olive pins read against busy map art. */
  filter: saturate(.72) brightness(.92);
}
.mapcanvas .layer { position: absolute; inset: 0; line-height: 1; }

.pin {
  position: absolute; transform: translate(-50%, -50%);
  width: 15px; height: 15px; padding: 0; border-radius: 50%;
  background: rgba(8,10,9,.62); border: 2px solid var(--text-dim);
  cursor: pointer; transition: box-shadow .12s, transform .12s;
}
.pin:hover, .pin:focus-visible { transform: translate(-50%, -50%) scale(1.45); outline: none; z-index: 6; }
.pin.ext { border-color: #e2564a; }
.pin.key { border-color: var(--amber); }
.pin.ext:hover, .pin.ext:focus-visible { box-shadow: 0 0 0 4px rgba(226,86,74,.28); }
.pin.key:hover, .pin.key:focus-visible { box-shadow: 0 0 0 4px rgba(200,162,74,.28); }

/* Loot pins are deliberately tiny and non-interactive: at 200+ per map they must
   read as texture, not as 200 clickable targets. */
.pin.loot {
  width: 4px; height: 4px; border: 0; border-radius: 0;
  background: rgba(195,209,142,.6); cursor: default; pointer-events: none;
}
.pin.loot:hover { transform: translate(-50%, -50%); box-shadow: none; }

.mapreadout {
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
  min-height: 42px; padding: 10px 16px;
  border-top: 1px solid var(--line); background: var(--plate);
  font-size: 13px; color: var(--text-dim);
}
.mapreadout b { color: var(--text); font-size: 14px; }
.mapreadout .tag { font-family: var(--mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; border: 1px solid currentColor; padding: 1px 5px; }
.mapreadout .tag.ext { color: #e2564a; }
.mapreadout .tag.key { color: var(--amber); }
.mapreadout .idle { font-family: var(--mono); font-size: 12px; color: var(--text-faint); }

.maplegend {
  display: flex; gap: 16px; flex-wrap: wrap;
  padding: 10px 16px; border-top: 1px solid var(--line);
  font-family: var(--mono); font-size: 11px; color: var(--text-faint);
}
.maplegend span { display: inline-flex; align-items: center; gap: 6px; }
.maplegend i { width: 9px; height: 9px; border: 2px solid; border-radius: 50%; display: block; }
.maplegend i.ext { border-color: #e2564a; }
.maplegend i.key { border-color: var(--amber); }
.maplegend i.loot { width: 4px; height: 4px; border: 0; border-radius: 0; background: rgba(195,209,142,.8); }

.mapnote {
  padding: 12px 16px; border-top: 1px solid var(--line);
  font-size: 13px; color: var(--amber);
}

/* ------------------------------------------------------- homepage visuals */
.videogrid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}
.vcard {
  display: block; border: 1px solid var(--line); background: var(--ink-2);
  text-decoration: none; color: inherit; overflow: hidden;
  transition: border-color .14s, transform .14s;
}
.vcard:hover, .vcard:focus-visible { border-color: var(--line-hot); transform: translateY(-2px); outline: none; }
.vthumb {
  position: relative; aspect-ratio: 16 / 9; background: var(--plate);
  line-height: 0; overflow: hidden;
}
.vthumb img { width: 100%; height: 100%; object-fit: cover; display: block; filter: saturate(.8) brightness(.88); }
.vthumb iframe { width: 100%; height: 100%; border: 0; display: block; }
.vplay {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(180deg, rgba(8,10,9,0) 40%, rgba(8,10,9,.72) 100%);
}
.vplay i {
  width: 46px; height: 46px; border-radius: 50%; border: 2px solid rgba(216,222,214,.85);
  background: rgba(8,10,9,.5); display: grid; place-items: center; font-style: normal;
}
.vplay i::after {
  content: ''; display: block; margin-left: 3px;
  border-style: solid; border-width: 8px 0 8px 13px;
  border-color: transparent transparent transparent rgba(216,222,214,.9);
}
.vmeta { padding: 12px 14px 14px; }
.vmeta .ch {
  font-family: var(--mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--olive);
}
.vmeta h3 { margin: 5px 0 6px; font-size: 15px; line-height: 1.32; }
.vmeta .sub { font-family: var(--mono); font-size: 11px; color: var(--text-faint); }

/* caliber penetration ranking: real bars from ammo.json, clickable rows */
.bars { border: 1px solid var(--line); background: var(--ink-2); }
.barrow {
  display: grid; grid-template-columns: 122px 1fr 156px; gap: 12px; align-items: center;
  padding: 7px 14px; border-top: 1px solid var(--line);
  font-size: 13px; cursor: pointer; width: 100%; text-align: left;
  background: none; color: inherit; border-left: 0; border-right: 0; border-bottom: 0;
}
.barrow:first-child { border-top: 0; }
.barrow:hover, .barrow:focus-visible { background: var(--plate-2); outline: none; }
.barrow[aria-pressed="true"] { background: rgba(154,168,112,.1); }
.barrow .cal { font-family: var(--mono); font-size: 12px; color: var(--text-dim); }
.barrow .track { height: 8px; background: var(--plate-2); position: relative; overflow: hidden; }
.barrow .fill { position: absolute; inset: 0 auto 0 0; background: var(--olive); }
.barrow .fill.s6 { background: var(--olive-hot); }
.barrow .num { font-family: var(--mono); font-size: 11px; color: var(--text-faint); text-align: right; }
.barreadout {
  padding: 13px 14px; border-top: 1px solid var(--line); background: var(--plate);
  font-size: 13px; color: var(--text-dim); min-height: 46px;
}
.barreadout b { color: var(--text); }
.barreadout .pips { margin-left: 4px; }

/* search hits */
#qbody mark { background: rgba(195,209,142,.22); color: var(--olive-hot); padding: 0 1px; }
.qhead { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 10px; }
.qhead .chip { cursor: pointer; }

@media (max-width: 720px) {
  .rail-inner { height: auto; padding: 10px 0; flex-wrap: wrap; gap: 8px; }
  .rail nav { margin-left: 0; }
  .rail nav a { padding: 6px 9px; font-size: 12px; }
  .hero { padding: 34px 0 26px; }
  .controls .count { margin-left: 0; width: 100%; }
  .tablewrap { max-height: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}

/* ---------- dispatches: long-form written guides ---------- */
.dispatch { max-width: 74ch; }
.dispatch .meta {
  display: flex; flex-wrap: wrap; gap: 10px 18px; margin: 0 0 26px;
  font-family: var(--mono); font-size: 11px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--text-faint);
}
.dispatch .meta b { color: var(--olive); font-weight: 600; }
.dispatch h2 {
  margin: 40px 0 14px; font-size: 21px; line-height: 1.28;
  padding-top: 18px; border-top: 1px solid var(--line);
}
.dispatch h2:first-of-type { border-top: 0; padding-top: 0; margin-top: 10px; }
.dispatch h3 { margin: 26px 0 10px; font-size: 16px; color: var(--olive-hot); }
.dispatch p { margin: 0 0 15px; line-height: 1.72; color: var(--text); }
.dispatch p.lede-sm { color: var(--text-dim); }
.dispatch ul, .dispatch ol { margin: 0 0 17px; padding-left: 22px; }
.dispatch li { margin: 0 0 9px; line-height: 1.66; }
.dispatch strong { color: var(--text); }
.dispatch .callout {
  border: 1px solid var(--line); border-left: 3px solid var(--olive);
  background: var(--ink-2); padding: 14px 16px; margin: 0 0 20px;
}
.dispatch .callout p:last-child { margin-bottom: 0; }
.dispatch .callout .lbl {
  display: block; font-family: var(--mono); font-size: 10px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--olive); margin-bottom: 7px;
}
.dispatch table { width: 100%; border-collapse: collapse; margin: 0 0 20px; font-size: 13px; }
.dispatch th, .dispatch td {
  text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top;
}
.dispatch th {
  font-family: var(--mono); font-size: 10px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--text-faint); border-bottom-color: var(--line-hot);
}
.dispatch .next {
  margin: 44px 0 0; padding-top: 20px; border-top: 1px solid var(--line);
  display: flex; flex-wrap: wrap; gap: 10px;
}
.dispatch .next a {
  border: 1px solid var(--line); padding: 9px 13px; text-decoration: none;
  font-family: var(--mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--text-dim);
}
.dispatch .next a:hover, .dispatch .next a:focus-visible { border-color: var(--line-hot); color: var(--text); outline: none; }
.dlist { display: grid; gap: 14px; }
.dcard {
  display: block; border: 1px solid var(--line); background: var(--ink-2);
  padding: 18px 20px; text-decoration: none; color: inherit;
  transition: border-color .14s, transform .14s;
}
.dcard:hover, .dcard:focus-visible { border-color: var(--line-hot); transform: translateY(-2px); outline: none; }
.dcard .kind {
  font-family: var(--mono); font-size: 10px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--olive);
}
.dcard h3 { margin: 7px 0 7px; font-size: 17px; line-height: 1.3; }
.dcard p { margin: 0; color: var(--text-dim); font-size: 13.5px; line-height: 1.6; }
.dcard .foot {
  margin-top: 12px; font-family: var(--mono); font-size: 10.5px;
  letter-spacing: .1em; text-transform: uppercase; color: var(--text-faint);
}
