/* ============================================================
   STEP Agentic AI Repository — scoped stylesheet
   ------------------------------------------------------------
   EVERY rule is scoped under `.step-repo-app`. Nothing here may
   style bare `body`, `*`, `html`, or generic theme elements —
   this file is loaded inside a host WordPress theme (GMU CARE)
   and MUST NOT leak into the surrounding page.

   Rules:
   - No global element selectors (body, *, h1, a, button …) at the
     top level. Element rules must be prefixed: `.step-repo-app h2`.
   - CSS custom properties are declared on `.step-repo-app`, not
     on `:root`, so they don't override theme tokens.
   - If you add a selector, it starts with `.step-repo-app`.
   The build test (tests/) enforces this automatically.
   ============================================================ */

.step-repo-app {
  --accent: #4f46e5;
  --accent-soft: #c7d2fe;
  --ink: #0f172a;
  --slate: #334155;
  --muted: #64748b;
  --faint: #94a3b8;
  --line: #e2e8f0;
  --line-soft: #f1f5f9;
  --page-bg: #f8fafc;

  font-family: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-align: left;
}

.step-repo-app *,
.step-repo-app *::before,
.step-repo-app *::after { box-sizing: border-box; }

.step-repo-app ::selection { background: var(--accent-soft); }

.step-repo-app button,
.step-repo-app input,
.step-repo-app select,
.step-repo-app textarea { font-family: inherit; }

.step-repo-app button:focus-visible,
.step-repo-app input:focus-visible,
.step-repo-app select:focus-visible,
.step-repo-app textarea:focus-visible,
.step-repo-app a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@keyframes stepRepoFadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------- Header (repository sub-nav, not a site header) ---------- */

.step-repo-app .site-header {
  position: static;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  margin-bottom: 20px;
}
.step-repo-app .site-header__inner {
  max-width: 1280px; margin: 0 auto; padding: 12px 18px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
}
.step-repo-app .brand { display: flex; align-items: center; gap: 10px; cursor: pointer; border: none; background: none; padding: 0; text-align: left; }
.step-repo-app .brand__mark {
  width: 34px; height: 34px; border-radius: 9px; background: var(--accent);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 13px; letter-spacing: .02em; flex-shrink: 0;
}
.step-repo-app .brand__name { font-weight: 700; font-size: 15px; color: var(--ink); line-height: 1.2; }
.step-repo-app .brand__sub { font-weight: 500; font-size: 11px; color: var(--faint); }

.step-repo-app .site-nav { display: flex; gap: 2px; background: var(--line-soft); padding: 3px; border-radius: 10px; }
.step-repo-app .site-nav__btn {
  border: none; cursor: pointer; padding: 8px 14px; border-radius: 8px;
  font-size: 13px; font-weight: 700; background: transparent; color: var(--muted);
}
.step-repo-app .site-nav__btn.is-active { background: #fff; color: var(--ink); }

/* ---------- Layout helpers ---------- */

.step-repo-app .page { max-width: 1280px; margin: 0 auto; padding: 4px 0 40px; }
.step-repo-app .page--narrow { max-width: 800px; }
.step-repo-app .page--reading { max-width: 760px; }

.step-repo-app .page-title { font-size: 26px; font-weight: 800; margin: 0 0 6px; line-height: 1.25; color: var(--ink); }
.step-repo-app .page-lede { font-size: 15px; color: var(--muted); margin: 0; max-width: 640px; line-height: 1.5; }

.step-repo-app .card-panel {
  background: #fff; border: 1px solid var(--line);
  border-radius: 14px; padding: 20px 22px; margin-bottom: 16px;
}
.step-repo-app .panel-heading {
  font-size: 12px; font-weight: 800; letter-spacing: .04em;
  text-transform: uppercase; color: var(--faint); margin-bottom: 14px;
}

.step-repo-app .chip {
  display: inline-block; padding: 4px 10px; border-radius: 999px;
  font-size: 11.5px; font-weight: 700; white-space: nowrap;
}

/* ---------- Browse toolbar ---------- */

.step-repo-app .browse-toolbar { display: flex; gap: 12px; align-items: center; margin-bottom: 18px; flex-wrap: wrap; }
.step-repo-app .search-wrap { position: relative; flex: 1; min-width: 220px; }
.step-repo-app .search-input {
  width: 100%; padding: 11px 14px 11px 38px; border-radius: 10px;
  border: 1px solid var(--line); background: #fff; font-size: 14px; color: var(--ink);
}
.step-repo-app .search-icon {
  position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
  color: var(--faint); font-size: 14px; pointer-events: none;
}
.step-repo-app .sort-select {
  padding: 11px 14px; border-radius: 10px; border: 1px solid var(--line);
  background: #fff; font-size: 13px; font-weight: 600; color: var(--slate);
}
.step-repo-app .filters-toggle {
  display: none;
  padding: 11px 16px; border-radius: 10px; border: 1px solid var(--line);
  background: #fff; font-size: 13px; font-weight: 700; color: var(--ink);
  cursor: pointer; white-space: nowrap;
}

/* ---------- Active filter chips ---------- */

.step-repo-app .active-chips { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 18px; }
.step-repo-app .active-chip {
  display: flex; align-items: center; gap: 6px; border: none; cursor: pointer;
  padding: 6px 10px 6px 12px; border-radius: 999px; font-size: 12px; font-weight: 700;
  white-space: nowrap; flex-shrink: 0;
}
.step-repo-app .clear-all-link {
  border: none; background: none; cursor: pointer; font-size: 12px; font-weight: 700;
  color: var(--muted); text-decoration: underline; padding: 6px 4px;
}

/* ---------- Browse grid ---------- */

.step-repo-app .browse-grid { display: grid; grid-template-columns: 260px 1fr; gap: 28px; align-items: start; }

.step-repo-app .facet-sidebar {
  /* No max-height/overflow here on purpose (v1.4.2): the facet list is a fixed
     size driven by the schema (15 sectors + 7 more controlled-vocab groups),
     not by case count, so capping it just added a second, nested scrollbar.
     Left as a plain sticky column, it tracks the page scroll and naturally
     stops being sticky once its own bottom edge reaches the end of the grid. */
  position: sticky; top: 12px; background: #fff; border: 1px solid var(--line);
  border-radius: 14px; padding: 18px;
}
.step-repo-app .facet-sidebar__title { font-size: 13px; font-weight: 800; color: var(--ink); margin-bottom: 10px; }
.step-repo-app .facet-group { border-top: 1px solid var(--line-soft); padding: 10px 0; }
.step-repo-app .facet-group__toggle {
  width: 100%; display: flex; justify-content: space-between; align-items: center;
  background: none; border: none; cursor: pointer; padding: 2px 0;
}
.step-repo-app .facet-group__label { font-size: 13.5px; font-weight: 700; color: var(--slate); }
.step-repo-app .facet-group__chevron { font-size: 11px; color: var(--faint); }
.step-repo-app .facet-values { display: flex; flex-direction: column; gap: 2px; margin-top: 6px; }
.step-repo-app .facet-value {
  display: flex; align-items: center; gap: 8px; border: none; background: transparent;
  cursor: pointer; padding: 6px 8px; border-radius: 8px; text-align: left; width: 100%;
}
.step-repo-app .facet-value__swatch { width: 14px; height: 14px; border-radius: 4px; flex-shrink: 0; }
.step-repo-app .facet-value__label { flex: 1; font-size: 13.5px; font-weight: 600; color: var(--slate); }
.step-repo-app .facet-value__count { font-size: 11px; color: var(--faint); font-weight: 700; }
.step-repo-app .facet-value.is-dimmed { opacity: .4; }

.step-repo-app .result-count { font-size: 14px; color: var(--muted); font-weight: 600; margin-bottom: 14px; }

.step-repo-app .cards-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.step-repo-app .case-card {
  border: 1px solid var(--line); border-radius: 14px; background: #fff; padding: 18px;
  cursor: pointer; transition: box-shadow .15s, border-color .15s;
  animation: stepRepoFadeIn .2s ease; text-align: left; width: 100%;
}
.step-repo-app .case-card:hover { box-shadow: 0 6px 20px rgba(15,23,42,.08); border-color: var(--accent-soft); }
.step-repo-app .case-card__top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.step-repo-app .case-card__title { font-size: 16px; font-weight: 700; color: var(--ink); line-height: 1.35; }
.step-repo-app .case-card__meta { font-size: 13.5px; color: var(--faint); margin-top: 4px; }
.step-repo-app .case-card__chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }

.step-repo-app .no-results {
  text-align: center; padding: 60px 20px; border: 1px dashed var(--line);
  border-radius: 14px; background: #fff;
}
.step-repo-app .no-results__title { font-size: 15px; font-weight: 700; color: var(--slate); margin-bottom: 6px; }
.step-repo-app .no-results__sub { font-size: 13px; color: var(--faint); margin-bottom: 14px; }

.step-repo-app .btn-accent {
  border: none; cursor: pointer; padding: 9px 16px; border-radius: 9px;
  font-size: 13px; font-weight: 700; background: var(--accent); color: #fff;
}
.step-repo-app .btn-secondary {
  border: 1px solid var(--line); cursor: pointer; padding: 8px 14px; border-radius: 9px;
  font-size: 12.5px; font-weight: 700; background: #fff; color: var(--slate);
}
.step-repo-app .btn-link-back {
  border: none; background: none; cursor: pointer; padding: 6px 0;
  font-size: 13px; font-weight: 700; color: var(--accent); margin-bottom: 18px;
}

/* ---------- Mobile filter drawer ---------- */

.step-repo-app .drawer-overlay { position: fixed; inset: 0; background: rgba(15,23,42,.4); z-index: 50; }
.step-repo-app .drawer {
  position: absolute; top: 0; left: 0; bottom: 0; width: 86%; max-width: 340px;
  background: #fff; padding: 18px; overflow-y: auto; box-shadow: 8px 0 30px rgba(0,0,0,.15);
}
.step-repo-app .drawer__head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.step-repo-app .drawer__title { font-size: 15px; font-weight: 800; }
.step-repo-app .drawer__close {
  border: none; background: var(--line-soft); width: 30px; height: 30px;
  border-radius: 8px; cursor: pointer; font-size: 15px;
}
.step-repo-app .drawer__apply {
  width: 100%; margin-top: 16px; border: none; cursor: pointer; padding: 12px;
  border-radius: 10px; font-size: 14px; font-weight: 700; background: var(--accent); color: #fff;
}

/* ---------- Case detail ---------- */

.step-repo-app .detail-badges { margin-bottom: 8px; display: flex; gap: 8px; flex-wrap: wrap; }
.step-repo-app .detail-meta { font-size: 15.5px; color: var(--muted); margin-bottom: 4px; }
.step-repo-app .detail-stamp { font-size: 14px; color: var(--faint); margin-bottom: 28px; }
.step-repo-app .detail-field-label { font-size: 14px; font-weight: 700; color: var(--muted); margin-bottom: 6px; }
.step-repo-app .detail-narrative { font-size: 15.5px; line-height: 1.6; color: var(--slate); margin: 6px 0 0; }
.step-repo-app .detail-option { margin-bottom: 16px; }
.step-repo-app .detail-option:last-child { margin-bottom: 0; }

.step-repo-app .ref-row { display: flex; gap: 10px; font-size: 15.5px; line-height: 1.6; color: var(--slate); margin-bottom: 10px; }
.step-repo-app .ref-row:last-child { margin-bottom: 0; }
.step-repo-app .ref-num { color: var(--faint); font-weight: 700; }
.step-repo-app .ref-src { color: var(--muted); }
.step-repo-app .ref-row a { color: var(--accent); }

.step-repo-app .notes-panel { background: #fdfaf3; border: 1px solid #f0e6c8; border-radius: 14px; padding: 20px 22px; margin-bottom: 16px; }
.step-repo-app .notes-panel .panel-heading { color: #a16207; margin-bottom: 12px; }
.step-repo-app .notes-text { font-size: 15.5px; line-height: 1.6; color: #57534e; margin: 0; font-style: italic; }

.step-repo-app .cite-panel { background: var(--page-bg); border: 1px solid var(--line); border-radius: 14px; padding: 20px 22px; }
.step-repo-app .cite-box {
  font-size: 15px; line-height: 1.6; color: var(--slate); background: #fff;
  border: 1px solid var(--line); border-radius: 10px; padding: 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  word-break: break-word;
}
.step-repo-app .cite-panel .btn-secondary { margin-top: 12px; }

/* ---------- Schema & Legend ---------- */

.step-repo-app .schema-note {
  background: #eef2ff; border: 1px solid var(--accent-soft); border-radius: 12px;
  padding: 14px 16px; font-size: 14px; color: #3730a3; font-weight: 600; margin-bottom: 28px;
}
.step-repo-app .schema-group { margin-bottom: 26px; }
.step-repo-app .schema-group h2 { font-size: 15px; font-weight: 800; margin: 0 0 12px; color: var(--ink); }
.step-repo-app .schema-rows { display: flex; flex-direction: column; gap: 8px; }
.step-repo-app .schema-row {
  display: flex; gap: 12px; align-items: flex-start; background: #fff;
  border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px;
}
.step-repo-app .schema-row .chip { font-size: 12px; flex-shrink: 0; }
.step-repo-app .schema-row p { font-size: 14px; line-height: 1.5; color: #475569; margin: 2px 0 0; }

.step-repo-app .legend-group { margin-bottom: 22px; }
.step-repo-app .legend-group h2 {
  font-size: 13px; font-weight: 800; color: var(--muted);
  text-transform: uppercase; letter-spacing: .04em; margin: 0 0 10px;
}
.step-repo-app .legend-values { display: flex; flex-wrap: wrap; gap: 8px; }
.step-repo-app .legend-item { display: flex; flex-direction: column; gap: 4px; }
.step-repo-app .legend-item .chip { padding: 5px 12px; font-size: 12.5px; }
.step-repo-app .legend-def { font-size: 12px; color: var(--faint); max-width: 180px; line-height: 1.4; }

/* ---------- About ---------- */

.step-repo-app .about-body p { font-size: 15.5px; line-height: 1.7; color: var(--slate); margin: 0 0 20px; }
.step-repo-app .about-body h2 { font-size: 15px; font-weight: 800; margin: 26px 0 10px; color: var(--ink); }
.step-repo-app .about-body ul { font-size: 15px; line-height: 1.8; color: #475569; margin: 0 0 20px; padding-left: 20px; }
.step-repo-app .about-body .body-sm { font-size: 15px; line-height: 1.7; color: #475569; }
.step-repo-app .team-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 24px; }
.step-repo-app .team-card { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.step-repo-app .team-card__name { font-size: 14.5px; font-weight: 700; color: var(--ink); }
.step-repo-app .team-card__role { font-size: 12.5px; color: var(--muted); }
.step-repo-app .suggest-btn {
  display: inline-block; text-decoration: none; padding: 10px 18px; border-radius: 9px;
  font-size: 13.5px; font-weight: 700; background: var(--accent); color: #fff;
}

/* ---------- Footer ---------- */

.step-repo-app .site-footer { border-top: 1px solid var(--line); margin-top: 24px; }
.step-repo-app .site-footer__inner {
  max-width: 1280px; margin: 0 auto; padding: 18px 2px;
  font-size: 12px; color: var(--faint); line-height: 1.6;
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.step-repo-app .site-footer a { color: var(--muted); }

/* ---------- Insights ---------- */

.step-repo-app .insight-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.step-repo-app .insight-stat { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; }
.step-repo-app .insight-stat__num { font-size: 26px; font-weight: 800; color: var(--ink); line-height: 1.1; }
.step-repo-app .insight-stat__label { font-size: 13px; color: var(--muted); font-weight: 600; margin-top: 4px; }

.step-repo-app .insight-bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.step-repo-app .insight-bar-row__label { flex: 0 0 190px; font-size: 13px; font-weight: 600; color: var(--slate); }
.step-repo-app .insight-bar-row__track { flex: 1; height: 16px; background: var(--line-soft); border-radius: 8px; overflow: hidden; }
.step-repo-app .insight-bar-row__fill { height: 100%; border-radius: 8px; }
.step-repo-app .insight-bar-row__count { flex: 0 0 64px; font-size: 11.5px; color: var(--faint); font-weight: 700; text-align: right; }

.step-repo-app .insight-stack__track { flex: 1; height: 16px; border-radius: 8px; overflow: hidden; display: flex; background: var(--line-soft); }
.step-repo-app .insight-stack__seg { height: 100%; }
.step-repo-app .insight-legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 12px; }
.step-repo-app .insight-legend__item { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--slate); }

.step-repo-app .insight-cols { display: flex; gap: 18px; align-items: flex-end; padding-top: 8px; }
.step-repo-app .insight-col { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.step-repo-app .insight-col__num { font-size: 12px; font-weight: 700; color: var(--slate); }
.step-repo-app .insight-col__bar { width: 38px; border-radius: 6px 6px 0 0; background: var(--accent); }
.step-repo-app .insight-col__label { font-size: 11px; color: var(--faint); font-weight: 600; white-space: nowrap; }

/* ---------- Responsive ---------- */

@media (max-width: 899px) {
  .step-repo-app .browse-grid { grid-template-columns: 1fr; }
  .step-repo-app .facet-sidebar { display: none; }
  .step-repo-app .filters-toggle { display: block; }
  .step-repo-app .cards-grid { grid-template-columns: 1fr; }
  .step-repo-app .insight-stats { grid-template-columns: repeat(2, 1fr); }
  .step-repo-app .insight-bar-row__label { flex-basis: 120px; }

  /* v1.4.2: keep the Filters entry point reachable while scrolling a long
     card list. The toolbar (search + sort + Filters button) is a normal-flow
     row above the cards, so it was scrolling away with everything else on
     mobile — pin it to the top of the viewport instead. Sticky, not fixed,
     so it doesn't need extra top-padding hacks elsewhere on the page; it
     simply stops scrolling once it reaches the top of its container. */
  .step-repo-app .browse-toolbar {
    position: sticky; top: 0; z-index: 20; background: #fff;
    padding: 10px 0; margin: -10px 0 18px; border-bottom: 1px solid var(--line);
  }
}

@media (min-width: 900px) {
  .step-repo-app .drawer-overlay { display: none !important; }
}

@media print {
  .step-repo-app .site-header,
  .step-repo-app .site-footer,
  .step-repo-app .filters-toggle,
  .step-repo-app .btn-link-back { display: none; }
}

/* ============================================================
   v1.1.1 — Host-theme neutralization
   ------------------------------------------------------------
   The GMU theme styles `main#site-content button` (and .button, …)
   with GMU green background, white text, and UPPERCASE at ID-level
   specificity (1,0,2), which overrode our class-scoped button styles
   and made the nav + Filters sidebar unreadable (green-on-green).
   These rules re-assert the repository's intended appearance scoped
   to the #step-repo-app id, so they win on specificity WITHOUT
   !important — which keeps the app's dynamic inline chip/facet colors
   (active selections) working.
   ============================================================ */
#step-repo-app .site-nav { background: var(--line-soft); }
#step-repo-app .site-nav__btn {
  background: transparent; color: var(--muted);
  border: 0; box-shadow: none; border-radius: 8px;
  padding: 8px 14px; font-size: 13px; font-weight: 700;
  text-transform: none; letter-spacing: normal;
}
#step-repo-app .site-nav__btn:hover { background: #fff; color: var(--ink); }
#step-repo-app .site-nav__btn.is-active { background: #fff; color: var(--ink); }
#step-repo-app .brand { background: none; border: 0; box-shadow: none; padding: 0; text-transform: none; }
#step-repo-app .facet-group__toggle { background: none; border: 0; box-shadow: none; padding: 2px 0; text-transform: none; letter-spacing: normal; }
#step-repo-app .facet-group__label { color: var(--slate); }
#step-repo-app .facet-group__chevron { color: var(--faint); }
#step-repo-app .facet-value {
  background: transparent; color: var(--slate);
  border: 0; box-shadow: none; border-radius: 8px; padding: 6px 8px;
  text-transform: none; letter-spacing: normal;
}
#step-repo-app .facet-value__label { color: var(--slate); font-weight: 600; }
#step-repo-app .facet-value__count { color: var(--faint); }
#step-repo-app .active-chip { border: 0; box-shadow: none; text-transform: none; }
#step-repo-app .clear-all-link { background: none; color: var(--muted); border: 0; box-shadow: none; text-transform: none; }
#step-repo-app .filters-toggle { background: #fff; color: var(--ink); border: 1px solid var(--line); box-shadow: none; text-transform: none; }
#step-repo-app .btn-accent { background: var(--accent); color: #fff; border: 0; box-shadow: none; text-transform: none; }
#step-repo-app .btn-secondary { background: #fff; color: var(--slate); border: 1px solid var(--line); box-shadow: none; text-transform: none; }
#step-repo-app .btn-link-back { background: none; color: var(--accent); border: 0; box-shadow: none; text-transform: none; }
#step-repo-app .drawer__close { background: var(--line-soft); border: 0; box-shadow: none; }
#step-repo-app .drawer__apply { background: var(--accent); color: #fff; border: 0; box-shadow: none; text-transform: none; }
#step-repo-app .sort-select { background: #fff; color: var(--slate); border: 1px solid var(--line); text-transform: none; }
#step-repo-app .search-input { background: #fff; color: var(--ink); border: 1px solid var(--line); }
#step-repo-app .suggest-btn { background: var(--accent); color: #fff; text-transform: none; }

/* ============================================================
   v1.3.0 — Schema tab: Sector | Industry table
   Scoped under #step-repo-app so the GMU theme's table/th/td
   styling (ID-level specificity) cannot hijack it.
   ============================================================ */
#step-repo-app .schema-table {
  width: 100%; border-collapse: collapse; background: #fff;
  border: 1px solid var(--line); border-radius: 12px; overflow: hidden;
  margin: 0;
}
#step-repo-app .schema-table th {
  text-align: left; font-size: 12px; font-weight: 800;
  text-transform: uppercase; letter-spacing: .04em; color: var(--faint);
  background: var(--line-soft); padding: 11px 16px;
  border: 0; border-bottom: 1px solid var(--line);
}
#step-repo-app .schema-table td {
  padding: 12px 16px; font-size: 13.5px; color: var(--slate);
  background: #fff; vertical-align: top;
  border: 0; border-bottom: 1px solid var(--line-soft);
}
#step-repo-app .schema-table tr:last-child td { border-bottom: 0; }
#step-repo-app .schema-table__sector { font-weight: 700; color: var(--ink); width: 38%; }
#step-repo-app .schema-table__industry { color: var(--muted); }

/* v1.4 — About team member links (id-scoped to beat theme link color) */
#step-repo-app a.team-card__name { color: var(--accent); text-decoration: none; }
#step-repo-app a.team-card__name:hover { text-decoration: underline; }
