:root {
  color-scheme: light;
  --bg: #f6f7f3;
  --surface: #ffffff;
  --surface-2: #eef4f1;
  --ink: #20231f;
  --ink-2: #3d453e;
  --muted: #657066;
  --line: #d7ddd4;
  --teal: #0f766e;
  --blue: #2f5f9f;
  --coral: #bf5b45;
  --gold: #8a6d1f;
  --card-bg: #fbfcfa;
  --input-bg: #fbfcfa;
  --chip-flag-bg: #f9ece7;
  --on-accent: #ffffff;
  --shadow: 0 16px 36px rgba(31, 38, 33, 0.08);
  --focus-ring: rgba(15, 118, 110, 0.28);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #14171a;
    --surface: #1b1f24;
    --surface-2: #232a30;
    --ink: #e8ece7;
    --ink-2: #c3cbc2;
    --muted: #94a09a;
    --line: #333a41;
    --teal: #4cc4b6;
    --blue: #84b2ea;
    --coral: #e7917a;
    --gold: #d8bd6a;
    --card-bg: #1f242a;
    --input-bg: #181c20;
    --chip-flag-bg: #3a2622;
    --on-accent: #0c1012;
    --shadow: 0 16px 36px rgba(0, 0, 0, 0.45);
    --focus-ring: rgba(76, 196, 182, 0.4);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #14171a;
  --surface: #1b1f24;
  --surface-2: #232a30;
  --ink: #e8ece7;
  --ink-2: #c3cbc2;
  --muted: #94a09a;
  --line: #333a41;
  --teal: #4cc4b6;
  --blue: #84b2ea;
  --coral: #e7917a;
  --gold: #d8bd6a;
  --card-bg: #1f242a;
  --input-bg: #181c20;
  --chip-flag-bg: #3a2622;
  --on-accent: #0c1012;
  --shadow: 0 16px 36px rgba(0, 0, 0, 0.45);
  --focus-ring: rgba(76, 196, 182, 0.4);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Avenir Next", "Segoe UI", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

body.drawer-open {
  overflow: hidden;
}

button,
input,
select {
  font: inherit;
}

a {
  color: var(--teal);
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 60;
  padding: 10px 14px;
  background: var(--teal);
  color: var(--on-accent);
  font-weight: 800;
  border-radius: 0 0 8px 0;
}

.skip-link:focus {
  left: 0;
}

.app-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 560px);
  gap: 24px;
  align-items: center;
  padding: 24px clamp(16px, 4vw, 48px);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.brand {
  display: flex;
  gap: 16px;
  align-items: center;
  min-width: 0;
}

.brand-mark {
  display: inline-flex;
  flex: 0 0 auto;
  filter: drop-shadow(0 6px 12px rgba(15, 118, 110, 0.25));
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(26px, 3.6vw, 42px);
  line-height: 1.02;
  letter-spacing: 0;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 12px;
}

.site-nav a {
  color: var(--teal);
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
}

.site-nav a:hover {
  text-decoration: underline;
}

h2 {
  margin-bottom: 0;
  font-size: 17px;
  letter-spacing: 0;
}

.header-side {
  display: grid;
  gap: 12px;
  justify-items: end;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(74px, 1fr));
  gap: 10px;
  width: 100%;
}

.summary-grid div {
  min-width: 0;
  padding: 11px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.metric {
  display: block;
  color: var(--teal);
  font-size: 21px;
  font-weight: 800;
  line-height: 1.1;
}

.label {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.ghost-btn {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  padding: 8px 12px;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}

.ghost-btn:hover {
  border-color: var(--teal);
  color: var(--teal);
}

.theme-icon {
  font-size: 14px;
}

.layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 24px;
  padding: 24px clamp(16px, 4vw, 48px) 32px;
}

.filters,
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.filters {
  position: sticky;
  top: 18px;
  align-self: start;
  padding: 18px;
}

.field {
  display: grid;
  gap: 7px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.field-hint {
  margin: -8px 0 16px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

kbd {
  padding: 1px 6px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
}

input,
select {
  width: 100%;
  min-height: 42px;
  padding: 9px 10px;
  color: var(--ink);
  background: var(--input-bg);
  border: 1px solid var(--line);
  border-radius: 6px;
}

input:focus,
select:focus,
button:focus-visible,
a:focus-visible,
.skill-card:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 1px;
}

.checklist {
  display: grid;
  gap: 9px;
  margin: 6px 0 18px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.checklist legend {
  padding: 0 5px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.checklist label {
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--ink);
  font-size: 14px;
}

.checklist input {
  width: 16px;
  min-height: 16px;
}

.secondary {
  width: 100%;
  min-height: 42px;
  color: var(--teal);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
  font-weight: 800;
}

.secondary:hover {
  color: var(--on-accent);
  background: var(--teal);
  border-color: var(--teal);
}

.content {
  display: grid;
  gap: 24px;
  min-width: 0;
}

.panel {
  padding: 18px;
}

.results-panel {
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  margin-bottom: 15px;
}

.muted {
  color: var(--muted);
  font-size: 13px;
}

.bars {
  display: grid;
  gap: 10px;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(130px, 260px) minmax(120px, 1fr) 56px;
  gap: 12px;
  align-items: center;
}

.bar-name {
  overflow: hidden;
  padding: 0;
  color: var(--ink);
  background: none;
  border: 0;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.bar-name:hover {
  color: var(--teal);
  text-decoration: underline;
}

.bar-track {
  height: 12px;
  overflow: hidden;
  background: var(--surface-2);
  border-radius: 999px;
}

.bar-fill {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--teal), var(--blue), var(--coral));
  border-radius: inherit;
}

.bar-value {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.status {
  padding: 18px;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.status.hidden,
.load-more.hidden {
  display: none;
}

.results {
  display: grid;
  gap: 12px;
}

.skill-card {
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card-bg);
  cursor: pointer;
  transition: border-color 0.12s ease, box-shadow 0.12s ease, transform 0.12s ease;
}

.skill-card:hover {
  border-color: var(--teal);
  box-shadow: var(--shadow);
}

@media (prefers-reduced-motion: no-preference) {
  .skill-card:hover {
    transform: translateY(-1px);
  }
}

.skill-topline {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
  margin-bottom: 8px;
}

.skill-name {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 16px;
}

.collection {
  flex: 0 0 auto;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
}

.collection-btn {
  padding: 2px 6px;
  background: none;
  border: 0;
  border-radius: 5px;
  cursor: pointer;
}

.collection-btn:hover {
  background: var(--surface-2);
  text-decoration: underline;
}

.trigger {
  margin-bottom: 10px;
  color: var(--ink-2);
  line-height: 1.45;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.chip.flag {
  background: var(--chip-flag-bg);
  color: var(--coral);
}

.chip.license {
  color: var(--gold);
}

.path {
  display: block;
  margin-top: 9px;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.action {
  padding: 6px 11px;
  color: var(--teal);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.action:hover {
  border-color: var(--teal);
}

.action.ghost {
  background: transparent;
}

.action.copied {
  color: var(--on-accent);
  background: var(--teal);
  border-color: var(--teal);
}

.load-more-wrap {
  margin-top: 16px;
}

.load-more {
  width: 100%;
}

/* ---------- search-term highlight ---------- */

mark {
  padding: 0 1px;
  border-radius: 3px;
  background: #ffe9a6;
  color: #20231f;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) mark {
    background: #6b5a23;
    color: #f4efdd;
  }
}

:root[data-theme="dark"] mark {
  background: #6b5a23;
  color: #f4efdd;
}

/* ---------- active filter chips ---------- */

.active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.active-filters.hidden {
  display: none;
}

.filter-chip {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  padding: 5px 10px;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}

.filter-chip:hover {
  border-color: var(--coral);
  color: var(--coral);
}

.filter-chip-x {
  font-size: 11px;
  opacity: 0.7;
}

.filter-chip.clear-all {
  color: var(--teal);
  background: transparent;
  border-style: dashed;
}

.filter-chip.clear-all:hover {
  color: var(--on-accent);
  background: var(--teal);
  border-style: solid;
}

/* ---------- detail drawer ---------- */

.drawer {
  position: fixed;
  inset: 0;
  z-index: 50;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.16s ease, visibility 0.16s ease;
}

.drawer.open {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}

.drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 12, 14, 0.46);
}

.drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: min(480px, 100%);
  height: 100%;
  padding: 22px clamp(16px, 3vw, 26px) 32px;
  overflow-y: auto;
  background: var(--surface);
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow);
  transform: translateX(100%);
  transition: transform 0.2s ease;
}

.drawer.open .drawer-panel {
  transform: translateX(0);
}

@media (prefers-reduced-motion: reduce) {
  .drawer,
  .drawer-panel {
    transition: none;
  }
}

.drawer-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
  margin-bottom: 16px;
}

.drawer-title {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 20px;
}

.drawer-body {
  display: grid;
  gap: 14px;
}

.meta-row {
  display: grid;
  gap: 5px;
}

.meta-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.meta-value {
  color: var(--ink);
  font-size: 14px;
}

.meta-value a {
  font-weight: 700;
  text-decoration: none;
}

.meta-value a:hover {
  text-decoration: underline;
}

.drawer-trigger {
  margin: 0;
  color: var(--ink-2);
  line-height: 1.5;
}

.path-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.path-wrap .path {
  margin: 0;
  flex: 1 1 auto;
}

.drawer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.app-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 20px;
  padding: 18px clamp(16px, 4vw, 48px) 32px;
  color: var(--muted);
  font-size: 12px;
  border-top: 1px solid var(--line);
}

.app-footer code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

@media (max-width: 900px) {
  .app-header,
  .layout {
    grid-template-columns: 1fr;
  }

  .header-side {
    justify-items: stretch;
  }

  .filters {
    position: static;
  }
}

@media (max-width: 560px) {
  .app-header {
    padding-top: 18px;
  }

  .brand {
    align-items: flex-start;
  }

  .summary-grid {
    grid-template-columns: repeat(auto-fit, minmax(64px, 1fr));
  }

  .bar-row {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .bar-value {
    text-align: left;
  }

  .skill-topline {
    display: grid;
  }
}

/* ---------- AERS flagship banner ---------- */

.flagship {
  display: grid;
  grid-template-columns: minmax(240px, 420px) minmax(0, 1fr);
  gap: 24px;
  align-items: center;
  margin: 20px clamp(16px, 4vw, 48px) 0;
  padding: 18px;
  background: var(--surface);
  border: 2px solid var(--gold);
  border-radius: 10px;
  box-shadow: var(--shadow);
}

.flagship-cover img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 6px;
}

.flagship-body h2 {
  margin-bottom: 8px;
  font-size: clamp(20px, 2.4vw, 28px);
}

.flagship-body p {
  max-width: 72ch;
  color: var(--ink-2);
  line-height: 1.5;
}

.flagship-body .flagship-tag {
  margin-bottom: 6px;
  color: var(--gold);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.flagship-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.flagship-btn {
  padding: 9px 14px;
  border: 1px solid var(--teal);
  border-radius: 6px;
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
}

.flagship-btn.primary {
  background: var(--teal);
  color: var(--on-accent);
}

.flagship-btn:hover {
  text-decoration: underline;
}

.flagship-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin: 16px clamp(16px, 4vw, 48px);
  padding: 12px 16px;
  background: var(--surface);
  border: 2px solid var(--gold);
  border-radius: 8px;
  font-size: 14px;
}

.flagship-strip a {
  font-weight: 800;
}

@media (max-width: 900px) {
  .flagship {
    grid-template-columns: 1fr;
  }
}
