/* kevmap — pastel mint, minimal, glassy. Semantic tokens unchanged in name.
   Status palette validated (CVD + normal-vision + lightness band) light & dark. */
:root {
  --bg: #f2f9f5;
  --bg-grad-a: #e3f4ea; --bg-grad-b: #eef7fb; --bg-grad-c: #f6f4fb;
  --fg: #16241d; --muted: #5b6f64;
  --line: rgba(22, 36, 29, 0.10);
  --panel: rgba(255, 255, 255, 0.58);
  --panel-solid: #ffffff;
  --panel-border: rgba(255, 255, 255, 0.72);
  --panel-shadow: 0 10px 30px rgba(23, 66, 46, 0.08), 0 1px 2px rgba(23, 66, 46, 0.05);
  --link: #0e7a5f; --code: rgba(22, 36, 29, 0.055);
  --accent: #35a37b;
  --mapped: #14663f; --mapped-bg: #d9f3e6; --mapped-fill: #35a37b;
  --stale: #7a5a10; --stale-bg: #f7ecd1; --stale-fill: #d9a13a;
  --unmapped: #8f3742; --unmapped-bg: #fae3e6; --unmapped-fill: #d9737f;
  --uncovered: #4c3f96; --uncovered-bg: #e9e4fa; --uncovered-fill: #7f7ee0;
  --bar: #57b894;
  --radius: 16px; --radius-s: 10px;
  --maxw: 68rem;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101914;
    --bg-grad-a: #12241b; --bg-grad-b: #101b21; --bg-grad-c: #16151f;
    --fg: #e2eee7; --muted: #93a89c;
    --line: rgba(226, 238, 231, 0.10);
    --panel: rgba(28, 41, 34, 0.55);
    --panel-solid: #182620;
    --panel-border: rgba(226, 238, 231, 0.10);
    --panel-shadow: 0 10px 30px rgba(0, 0, 0, 0.35), 0 1px 2px rgba(0, 0, 0, 0.3);
    --link: #7fd6b4; --code: rgba(226, 238, 231, 0.08);
    --accent: #3aa87e;
    --mapped: #9fe6c5; --mapped-bg: rgba(58, 168, 126, 0.16); --mapped-fill: #3aa87e;
    --stale: #ecd39a; --stale-bg: rgba(187, 140, 44, 0.16); --stale-fill: #bb8c2c;
    --unmapped: #f2b3bd; --unmapped-bg: rgba(207, 96, 118, 0.15); --unmapped-fill: #cf6076;
    --uncovered: #cfc4f6; --uncovered-bg: rgba(136, 120, 222, 0.16); --uncovered-fill: #8878de;
    --bar: #3aa87e;
  }
}
* { box-sizing: border-box; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; color: var(--fg);
  background: var(--bg);
  background-image:
    radial-gradient(48rem 30rem at 8% -4%, var(--bg-grad-a), transparent 60%),
    radial-gradient(44rem 28rem at 100% 6%, var(--bg-grad-b), transparent 55%),
    radial-gradient(50rem 34rem at 50% 110%, var(--bg-grad-c), transparent 60%);
  background-attachment: fixed;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.6;
  font-feature-settings: "kern";
  -webkit-font-smoothing: antialiased;
}
a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 3px; text-decoration-color: color-mix(in srgb, var(--link) 45%, transparent); transition: text-decoration-color 120ms ease; }
a:hover { text-decoration-color: var(--link); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
code, pre, .mono { font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.92em; }
code { background: var(--code); padding: 0.08em 0.4em; border-radius: 6px; }
pre { background: var(--code); padding: 0.9rem 1.1rem; overflow-x: auto; border-radius: var(--radius-s); border: 1px solid var(--line); }
h1 { font-size: clamp(1.45rem, 3.2vw, 1.9rem); line-height: 1.22; margin: 0 0 0.5rem; letter-spacing: -0.022em; font-weight: 700; }
h2 { font-size: 1.28rem; margin: 2.4rem 0 0.7rem; letter-spacing: -0.015em; font-weight: 600; }
h2 .prov { font-weight: 400; letter-spacing: 0; }
h3 { font-size: 1.05rem; margin: 1.5rem 0 0.4rem; letter-spacing: -0.01em; }
p, ul, ol, table { margin: 0.6rem 0; }
ul, ol { padding-left: 1.4rem; }
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 1.2rem; }

/* ---- glassy sticky header ---- */
header.site {
  position: sticky; top: 0; z-index: 40;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
@supports (backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px)) {
  header.site { -webkit-backdrop-filter: blur(18px) saturate(1.6); backdrop-filter: blur(18px) saturate(1.6); }
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  header.site { background: var(--panel-solid); }
}
header.site .wrap { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.3rem 1.1rem; padding-top: 0.75rem; padding-bottom: 0.75rem; }
header.site .brand { font-weight: 700; font-size: 1.1rem; color: var(--fg); text-decoration: none; letter-spacing: -0.02em; }
header.site .brand::before { content: ""; display: inline-block; width: 0.62em; height: 0.62em; border-radius: 3px; background: linear-gradient(135deg, var(--mapped-fill), #6fd0a9); margin-right: 0.45em; }
header.site nav a { color: var(--muted); text-decoration: none; margin-right: 0.85rem; font-size: 0.93rem; padding: 0.22rem 0.55rem; border-radius: 999px; transition: color 120ms ease, background 120ms ease; }
header.site nav a:hover { color: var(--fg); background: var(--code); }
header.site nav a[aria-current] { font-weight: 600; color: var(--mapped); background: var(--mapped-bg); }
main { padding: 2rem 0 3.4rem; }
footer.site { border-top: 1px solid var(--line); color: var(--muted); font-size: 0.85rem; padding: 1.5rem 0 2.6rem; }
footer.site p { margin: 0.35rem 0; }
.lede { font-size: 1.08rem; color: var(--muted); margin: 0 0 1.3rem; max-width: 52rem; }
.muted { color: var(--muted); }
.small { font-size: 0.88rem; }
.prov { color: var(--muted); font-size: 0.85rem; }

/* ---- badges ---- */
.badge {
  display: inline-block; font-size: 0.74rem; font-weight: 600; letter-spacing: 0.03em;
  padding: 0.16em 0.66em; border-radius: 999px; vertical-align: middle; white-space: nowrap;
  text-transform: uppercase; border: 1px solid transparent;
}
.badge.mapped { color: var(--mapped); background: var(--mapped-bg); }
.badge.stale { color: var(--stale); background: var(--stale-bg); }
.badge.unmapped { color: var(--unmapped); background: var(--unmapped-bg); }
.badge.uncovered, .badge.none { color: var(--uncovered); background: var(--uncovered-bg); }
.badge.partial { color: var(--stale); background: var(--stale-bg); }
.badge.full { color: var(--mapped); background: var(--mapped-bg); }
.badge.neutral { color: var(--muted); background: transparent; border-color: var(--line); }
.badge.expl { color: var(--fg); background: transparent; border-color: var(--line); text-transform: none; font-weight: 500; letter-spacing: 0; }

/* ---- glass tiles ---- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: 0.9rem; margin: 1.3rem 0; }
.tile {
  border: 1px solid var(--panel-border); border-radius: var(--radius);
  padding: 1rem 1.05rem; background: var(--panel); box-shadow: var(--panel-shadow);
}
@supports (backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px)) {
  .tile { -webkit-backdrop-filter: blur(14px) saturate(1.4); backdrop-filter: blur(14px) saturate(1.4); }
}
.tile .n { font-size: 1.95rem; font-weight: 700; line-height: 1.08; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.tile .l { color: var(--muted); font-size: 0.85rem; margin-top: 0.3rem; line-height: 1.35; }
.tile.mapped .n { color: var(--mapped); } .tile.stale .n { color: var(--stale); }
.tile.unmapped .n { color: var(--unmapped); } .tile.uncovered .n { color: var(--uncovered); }

/* ---- state bar (2px surface gaps between segments) ---- */
.statebar { display: flex; gap: 2px; height: 12px; border-radius: 999px; overflow: hidden; margin: 0.9rem 0 0.35rem; background: var(--code); }
.statebar span { display: block; height: 100%; border-radius: 2px; }
.statebar span:first-child { border-top-left-radius: 999px; border-bottom-left-radius: 999px; }
.statebar span:last-child { border-top-right-radius: 999px; border-bottom-right-radius: 999px; }
.statebar .mapped { background: var(--mapped-fill); } .statebar .stale { background: var(--stale-fill); } .statebar .unmapped { background: var(--unmapped-fill); }
.legend { display: flex; flex-wrap: wrap; gap: 0.4rem 1.2rem; font-size: 0.87rem; color: var(--muted); }
.legend i { display: inline-block; width: 0.68em; height: 0.68em; border-radius: 3px; margin-right: 0.38em; }

/* ---- tables ---- */
table { border-collapse: collapse; width: 100%; font-size: 0.92rem; }
th, td { text-align: left; padding: 0.45rem 0.6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
tbody tr { transition: background 100ms ease; }
tbody tr:hover { background: var(--code); }
th { font-weight: 600; color: var(--muted); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.scroll {
  overflow-x: auto; border: 1px solid var(--panel-border); border-radius: var(--radius);
  background: var(--panel); box-shadow: var(--panel-shadow); padding: 0.35rem 0.8rem; margin: 0.8rem 0;
}
@supports (backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px)) {
  .scroll { -webkit-backdrop-filter: blur(14px) saturate(1.4); backdrop-filter: blur(14px) saturate(1.4); }
}
.scroll table { margin: 0; }
.scroll tbody tr:last-child td { border-bottom: 0; }

/* ---- key/value ---- */
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 0.35rem 1.3rem; margin: 1rem 0; }
.kv dt { color: var(--muted); font-size: 0.88rem; padding-top: 0.05rem; } .kv dd { margin: 0; }

/* ---- callouts ---- */
.callout {
  border: 1px solid var(--line); border-left: 4px solid var(--line);
  background: var(--panel); padding: 0.85rem 1.1rem; margin: 1.1rem 0;
  border-radius: var(--radius-s); box-shadow: var(--panel-shadow);
}
.callout.unmapped { border-left-color: var(--unmapped-fill); background: linear-gradient(90deg, var(--unmapped-bg), var(--panel) 45%); }
.callout.stale { border-left-color: var(--stale-fill); background: linear-gradient(90deg, var(--stale-bg), var(--panel) 45%); }
.callout.mapped { border-left-color: var(--mapped-fill); background: linear-gradient(90deg, var(--mapped-bg), var(--panel) 45%); }
.callout.uncovered { border-left-color: var(--uncovered-fill); background: linear-gradient(90deg, var(--uncovered-bg), var(--panel) 45%); }
.callout p:first-child { margin-top: 0; } .callout p:last-child { margin-bottom: 0; }

/* ---- detection chain ---- */
.chain { list-style: none; padding: 0; margin: 0.9rem 0; }
.chain > li {
  border: 1px solid var(--panel-border); border-radius: var(--radius);
  padding: 0.85rem 1.05rem; margin: 0.6rem 0; background: var(--panel); box-shadow: var(--panel-shadow);
}
.chain .an { margin: 0.7rem 0 0 0.6rem; padding-left: 0.9rem; border-left: 2px solid color-mix(in srgb, var(--mapped-fill) 45%, transparent); }
.chain .ls { margin: 0.45rem 0 0 0.8rem; }
.chain .ls > div { padding: 0.1rem 0; }

/* ---- sigma rules ---- */
.rule { border-top: 1px solid var(--line); padding: 0.6rem 0.2rem; }
.rule:first-child { border-top: 0; }
.rule .t { font-weight: 600; }
.rule .m { color: var(--muted); font-size: 0.85rem; }
.rule .m b { color: var(--fg); font-weight: 600; }
.tags a, .tags span { margin-right: 0.4rem; }

/* ---- bars ---- */
.bars { margin: 0.9rem 0; }
.bars .row { display: grid; grid-template-columns: 8.5rem 1fr 5rem; align-items: center; gap: 0.65rem; font-size: 0.9rem; padding: 0.14rem 0; }
.bars .row .b { height: 0.85rem; background: var(--bar); border-radius: 4px; min-width: 2px; }
.bars .row .v { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }
.bars.unmapped .row .b { background: var(--unmapped-fill); }

/* ---- filters ---- */
.filters { display: flex; flex-wrap: wrap; gap: 0.5rem 0.9rem; align-items: center; margin: 1rem 0; }
.filters input[type=search], .filters select {
  font: inherit; padding: 0.45rem 0.75rem; border: 1px solid var(--line); border-radius: 999px;
  background: var(--panel); color: var(--fg); box-shadow: var(--panel-shadow);
  transition: border-color 120ms ease;
}
.filters input[type=search]:focus, .filters select:focus { border-color: var(--accent); }
.filters input[type=search] { min-width: 16rem; flex: 1; }
.filters label { font-size: 0.9rem; color: var(--muted); display: inline-flex; align-items: center; gap: 0.35rem; }
.filters input[type=checkbox], input[type=checkbox] { accent-color: var(--accent); }
th[data-sort] { cursor: pointer; user-select: none; }
th[data-sort]::after { content: " ↕"; opacity: 0.35; }
th[data-sort].asc::after { content: " ↑"; opacity: 1; } th[data-sort].desc::after { content: " ↓"; opacity: 1; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr)); gap: 1.2rem; }

/* ---- search ---- */
.search-box { position: relative; max-width: 34rem; margin: 0.4rem 0 0.6rem; }
.search-box input {
  width: 100%; font: inherit; font-size: 1rem; padding: 0.65rem 1rem;
  border: 1px solid var(--panel-border); border-radius: 999px;
  background: var(--panel); color: var(--fg); box-shadow: var(--panel-shadow);
}
@supports (backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px)) {
  .search-box input, #search-results { -webkit-backdrop-filter: blur(18px) saturate(1.5); backdrop-filter: blur(18px) saturate(1.5); }
}
.search-box input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent), var(--panel-shadow); }
#search-results {
  position: absolute; left: 0.6rem; right: 0.6rem; top: calc(100% + 0.35rem);
  background: var(--panel); border: 1px solid var(--panel-border); border-radius: var(--radius);
  box-shadow: var(--panel-shadow); z-index: 50; max-height: 22rem; overflow-y: auto;
  margin: 0; padding: 0.25rem; list-style: none; display: none;
}
#search-results li a { display: block; padding: 0.45rem 0.75rem; text-decoration: none; color: var(--fg); border-radius: var(--radius-s); }
#search-results li a:hover, #search-results li a:focus { background: var(--mapped-bg); }
#search-results .k { color: var(--muted); font-size: 0.78rem; margin-right: 0.5rem; text-transform: uppercase; letter-spacing: 0.04em; }
.skip { position: absolute; left: -999px; } .skip:focus { position: static; }

/* ---- histogram svg ---- */
svg.hist { width: 100%; height: auto; }
svg.hist rect { fill: var(--bar); rx: 3; } svg.hist text { fill: var(--muted); font-size: 11px; } svg.hist line { stroke: var(--line); }

.toc { font-size: 0.9rem; column-width: 16rem; }
.toc ul { margin: 0.2rem 0; }
td a.mono, td .mono { white-space: nowrap; }

@media (max-width: 40rem) {
  .kv { grid-template-columns: 1fr; gap: 0.1rem; } .kv dt { margin-top: 0.55rem; }
  .bars .row { grid-template-columns: 6rem 1fr 3.6rem; }
  header.site nav a { margin-right: 0.4rem; padding: 0.2rem 0.45rem; }
  main { padding-top: 1.3rem; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; }
}
