/* USA PT — base tokens, shell, header, controls */

:root {
  /* type */
  --font-display: 'Clash Grotesk', 'Satoshi', system-ui, sans-serif;
  --font-body: 'Satoshi', system-ui, -apple-system, sans-serif;
  --text-xs: clamp(0.75rem, 0.72rem + 0.15vw, 0.8125rem);
  --text-sm: clamp(0.8125rem, 0.78rem + 0.2vw, 0.9375rem);
  --text-base: clamp(0.9375rem, 0.9rem + 0.2vw, 1rem);
  --text-lg: clamp(1.0625rem, 1rem + 0.5vw, 1.375rem);
  --text-xl: clamp(1.375rem, 1.1rem + 1.2vw, 2rem);

  /* spacing */
  --space-1: .25rem; --space-2: .5rem; --space-3: .75rem; --space-4: 1rem;
  --space-5: 1.25rem; --space-6: 1.5rem; --space-8: 2rem; --space-10: 2.5rem;
  --space-12: 3rem; --space-16: 4rem; --space-20: 5rem;

  --radius: 10px;
  --radius-sm: 7px;
  --maxw: 1360px;

  /* brand accents (identical in both themes) */
  --accent-lighthouse: #24b8cf;
  --accent-redwood: #e8623a;
  --accent-grip: #8b7cf6;
  --accent-elevate: #9fd356;
  --accent-corp: #8d97a5;

  /* status */
  --st-active: #35c07e;
  --st-closed: #e0576a;
  --st-draft: #e5a53a;
  --st-open: #4d9bf0;
}

[data-theme="dark"] {
  --bg: #0a0b0d;
  --bg-2: #101215;
  --surface: #14171b;
  --surface-2: #191d22;
  --line: #2a2f36;
  --line-soft: #21262c;
  --text: #eef1f4;
  --text-2: #a4adb8;
  --text-3: #6f7883;
  --ink-mix: 92%;
  --ink-with: #ffffff;
  --shadow: 0 1px 0 rgba(255,255,255,.03), 0 10px 30px -12px rgba(0,0,0,.7);
  --shadow-hover: 0 1px 0 rgba(255,255,255,.05), 0 18px 40px -14px rgba(0,0,0,.85);
  --chip: #1c2126;
}

[data-theme="light"] {
  --bg: #f6f7f9;
  --bg-2: #eef0f4;
  --surface: #ffffff;
  --surface-2: #f4f6f8;
  --line: #d7dce3;
  --line-soft: #e4e8ed;
  --text: #14171b;
  --text-2: #58616d;
  --text-3: #838c98;
  --ink-mix: 62%;
  --ink-with: #0c1014;
  --shadow: 0 1px 2px rgba(16,20,26,.05), 0 8px 22px -14px rgba(16,20,26,.25);
  --shadow-hover: 0 2px 4px rgba(16,20,26,.07), 0 16px 34px -16px rgba(16,20,26,.35);
  --chip: #eef1f5;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.5;
  color: var(--text);
  background:
    radial-gradient(900px 420px at 12% -8%, color-mix(in oklab, var(--accent-lighthouse) 11%, transparent), transparent 70%),
    radial-gradient(760px 380px at 92% -4%, color-mix(in oklab, var(--accent-elevate) 9%, transparent), transparent 70%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; letter-spacing: -.015em; margin: 0; }
p { margin: 0; }
a { color: inherit; }
button { font: inherit; }
input, button { font-family: var(--font-body); }

.shell { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: clamp(var(--space-4), 3vw, var(--space-10)); }

.skip { position: absolute; left: -9999px; }
.skip:focus { left: var(--space-4); top: var(--space-4); z-index: 50; background: var(--surface); padding: var(--space-2) var(--space-3); border-radius: var(--radius-sm); }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 30;
  backdrop-filter: blur(14px);
  background: color-mix(in oklab, var(--bg) 82%, transparent);
  border-bottom: 1px solid var(--line-soft);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); padding-block: var(--space-4); }
.brandmark { display: flex; align-items: center; gap: var(--space-4); min-width: 0; }
.logo { width: 44px; height: 32px; flex: none; color: var(--text); }
.logo.sm { width: 33px; height: 24px; opacity: .7; }
.brandmark-text h1 {
  font-size: var(--text-lg); font-weight: 700; text-transform: uppercase; letter-spacing: .02em; line-height: 1.15;
}
.brandmark-text h1 .dash { color: var(--accent-lighthouse); }
.datanote { font-size: var(--text-xs); color: var(--text-3); margin-top: 2px; }

.header-actions { display: flex; gap: var(--space-2); flex: none; }
.icon-btn, .btn {
  display: inline-flex; align-items: center; gap: var(--space-2);
  background: var(--surface); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-3); font-size: var(--text-sm); font-weight: 500;
  cursor: pointer; transition: background .18s ease, border-color .18s ease, transform .18s ease;
}
.icon-btn:hover, .btn:hover { background: var(--surface-2); border-color: color-mix(in oklab, var(--text-3) 60%, var(--line)); }
.icon-btn:active, .btn:active { transform: translateY(1px); }
.icon-btn svg { width: 17px; height: 17px; }
[data-theme="dark"] .i-sun { display: block; } [data-theme="dark"] .i-moon { display: none; }
[data-theme="light"] .i-sun { display: none; } [data-theme="light"] .i-moon { display: block; }
.btn-label { display: none; }
@media (min-width: 640px) { .btn-label { display: inline; } }

:focus-visible { outline: 2px solid var(--accent-lighthouse); outline-offset: 2px; }

/* ---------- summary ---------- */
.summary {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1px; background: var(--line-soft);
  border: 1px solid var(--line-soft); border-radius: var(--radius);
  overflow: hidden; margin-top: var(--space-8);
}
.stat { background: var(--surface); padding: var(--space-5) var(--space-5); display: flex; flex-direction: column; gap: 2px; }
.stat-num { font-family: var(--font-display); font-size: var(--text-xl); font-weight: 600; line-height: 1; letter-spacing: -.02em; }
.stat-label { font-size: var(--text-xs); color: var(--text-3); text-transform: uppercase; letter-spacing: .09em; font-weight: 500; }
@media (max-width: 767px) {
  .summary { grid-template-columns: 1fr 1fr; }
  .summary .stat:last-child { grid-column: 1 / -1; }
  .stat { padding: var(--space-4); }
}

/* ---------- controls ---------- */
.controls {
  margin-top: var(--space-6);
  background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius);
  padding: var(--space-5); display: grid; gap: var(--space-4);
}
.control-row { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; }
.search-wrap { position: relative; flex: 1 1 320px; display: flex; align-items: center; }
.i-search { position: absolute; left: 12px; width: 17px; height: 17px; color: var(--text-3); pointer-events: none; }
#search {
  width: 100%; padding: var(--space-3) var(--space-3) var(--space-3) 38px;
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  font-size: var(--text-sm);
}
#search::placeholder { color: var(--text-3); }
#search:focus { border-color: var(--accent-lighthouse); outline: none; }
.clear-btn { position: absolute; right: 6px; background: none; border: 0; color: var(--text-3); font-size: var(--text-xs); cursor: pointer; padding: var(--space-2); }
.clear-btn:hover { color: var(--text); }
.tree-actions { display: flex; gap: var(--space-2); }

.filter-row { display: flex; flex-wrap: wrap; gap: var(--space-5) var(--space-8); }
.filter-group { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-2); }
.filter-legend { font-size: var(--text-xs); text-transform: uppercase; letter-spacing: .09em; color: var(--text-3); font-weight: 600; margin-right: var(--space-1); }
.chip {
  display: inline-flex; align-items: center; gap: var(--space-2);
  background: var(--chip); border: 1px solid var(--line); border-radius: 999px;
  padding: 6px 12px; font-size: var(--text-xs); font-weight: 600; color: var(--text-2);
  cursor: pointer; transition: all .16s ease; white-space: nowrap;
}
.chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--dot, var(--text-3)); flex: none; }
.chip .n { font-variant-numeric: tabular-nums; color: var(--text-3); font-weight: 500; }
.chip:hover { border-color: var(--text-3); color: var(--text); }
.chip[aria-pressed="true"] { background: color-mix(in oklab, var(--dot, var(--text-3)) 16%, var(--surface)); border-color: color-mix(in oklab, var(--dot, var(--text-3)) 55%, var(--line)); color: var(--text); }
.chip[aria-pressed="true"] .n { color: var(--text-2); }
.result-note { font-size: var(--text-xs); color: var(--text-3); }

/* ---------- sections ---------- */
.section { margin-top: var(--space-16); }
.section-head { margin-bottom: var(--space-6); max-width: 62ch; }
.section-head h2 { font-size: var(--text-lg); text-transform: uppercase; letter-spacing: .04em; }
.section-head p { font-size: var(--text-sm); color: var(--text-2); margin-top: var(--space-2); }

/* ---------- unmapped ---------- */
.unmapped-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--space-4); }
.unmapped-card {
  background: var(--surface); border: 1px solid var(--line-soft); border-left: 3px solid var(--st-draft);
  border-radius: var(--radius-sm); padding: var(--space-4); display: grid; gap: 4px;
}
.unmapped-card .nm { font-family: var(--font-display); font-weight: 600; font-size: var(--text-base); }
.unmapped-card .tt { font-size: var(--text-sm); color: var(--text-2); }
.unmapped-card .sc, .unmapped-card a { font-size: var(--text-xs); color: var(--text-3); }
.unmapped-card a { color: var(--accent-lighthouse); text-decoration: none; overflow-wrap: anywhere; }
.unmapped-card a:hover { text-decoration: underline; }

/* ---------- footer ---------- */
.site-footer { margin-top: var(--space-20); border-top: 1px solid var(--line-soft); background: color-mix(in oklab, var(--bg-2) 70%, transparent); }
.footer-inner { display: flex; gap: var(--space-4); align-items: flex-start; padding-block: var(--space-8); }
.footer-inner p { font-size: var(--text-xs); color: var(--text-3); max-width: 80ch; }

/* .stat and .chip set an explicit display, which beats the UA stylesheet's rule for the
   HTML hidden attribute — without this, hiding an empty category has no visual effect. */
[hidden] { display: none !important; }
