/* =========================================================================
   ShuleWiki 2026 — public design system
   Ported from the Claude Design handoff (ShuleWiki Public Core).
   Mobile-first (412px Android), scales up to a two-column desktop.
   Everything is namespaced under .sw so it can coexist with the legacy
   Bootstrap 3 chrome during the migration.
   ========================================================================= */

:root {
  /* Grounds */
  --sw-ground: #E9E6DB;   /* page behind the app */
  --sw-paper:  #F6F4EC;   /* screen / surface */
  --sw-card:   #ffffff;
  --sw-ink-panel: #14201A; /* dark feature cards */

  /* Ink */
  --sw-ink:    #14201A;
  --sw-muted:  #5F6B65;
  --sw-faint:  #8A948E;
  --sw-on-dark-soft: #A9C9B8;
  --sw-on-dark-mute: #C9D6CE;

  /* Lines */
  --sw-border:  #DDD8CA;
  --sw-hair:    #E6E2D6;
  --sw-dashed:  #B9B3A3;

  /* Brand + 5-word performance scale */
  --sw-forest:     #0F4C3A;  /* Excellent / brand / links / primary */
  --sw-verygood:   #1E7A57;  /* Very good */
  --sw-amber:      #E8A317;  /* Good / attention */
  --sw-amber-ink:  #B58900;  /* Good as text on white */
  --sw-fair:       #D0763A;  /* Fair */
  --sw-weak:       #B93A2B;  /* Weak / negative */

  --sw-forest-hover: #1E7A57;
  --sw-tint:      #E7EFE9;   /* trust / info tint */
  --sw-tint-ink:  #2E3F36;
  --sw-mark:      #F4E3B0;   /* search highlight */
  --sw-amber-tint:#FBF3DC;

  /* Type */
  --sw-display: 'Bricolage Grotesque', system-ui, sans-serif;
  --sw-body: 'Lexend', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;

  /* Radius */
  --sw-r-sm: 8px;
  --sw-r:    12px;
  --sw-r-lg: 14px;
  --sw-r-xl: 16px;
}

/* ---- Root scope ---------------------------------------------------------- */
.sw {
  margin: 0;
  background: var(--sw-ground);
  color: var(--sw-ink);
  font-family: var(--sw-body);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}
.sw *, .sw *::before, .sw *::after { box-sizing: border-box; }
.sw a { color: var(--sw-forest); text-decoration: none; }
.sw a:hover { color: var(--sw-forest-hover); text-decoration: underline; }
.sw img { max-width: 100%; }
.sw button { font-family: var(--sw-body); cursor: pointer; }

/* The screen surface — one per page, mobile column that centres on desktop */
.sw-app {
  background: var(--sw-paper);
  min-height: 100vh;
  max-width: 480px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}
.sw-app--wide { max-width: 1200px; }

/* Generic content padding */
.sw-pad   { padding: 16px; }
.sw-pad-x { padding-left: 16px; padding-right: 16px; }

/* ---- Typography helpers -------------------------------------------------- */
.sw-display { font-family: var(--sw-display); font-weight: 800; letter-spacing: -0.02em; color: var(--sw-ink); }
.sw-num     { font-family: var(--sw-display); font-weight: 800; letter-spacing: -0.02em; }
.sw-eyebrow { font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--sw-muted); }
.sw-muted   { color: var(--sw-muted); }
.sw-faint   { color: var(--sw-faint); }
.sw-h1 { font-family: var(--sw-display); font-weight: 800; font-size: 38px; line-height: 1.02; letter-spacing: -0.03em; text-wrap: pretty; }
.sw-h2 { font-family: var(--sw-display); font-weight: 800; font-size: 26px; line-height: 1.08; letter-spacing: -0.02em; text-wrap: pretty; }
.sw-h3 { font-family: var(--sw-display); font-weight: 700; font-size: 18px; line-height: 1.15; }

/* ---- Top bar / header ---------------------------------------------------- */
.sw-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; min-height: 56px;
}
.sw-brand { display: flex; align-items: center; gap: 8px; }
.sw-brand__mark {
  width: 22px; height: 22px; background: var(--sw-forest); border-radius: 5px;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-family: var(--sw-display); font-weight: 800; font-size: 13px;
}
.sw-brand__name { font-family: var(--sw-display); font-weight: 800; font-size: 20px; letter-spacing: -0.02em; color: var(--sw-ink); }
.sw-topnav { display: flex; gap: 6px; }
.sw-topnav a {
  font-size: 13px; font-weight: 500; color: var(--sw-muted);
  padding: 8px 10px; min-height: 44px; display: flex; align-items: center;
}
.sw-topnav a.is-active { color: var(--sw-forest); }

/* Back / icon buttons (44px touch target) */
.sw-iconbtn { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; flex: none; }

/* Breadcrumb */
.sw-crumbs { font-size: 12px; color: var(--sw-muted); }
.sw-crumbs a { color: var(--sw-muted); }

/* ---- Simple / Numbers toggle -------------------------------------------- */
.sw-modebar {
  position: sticky; top: 0; z-index: 5;
  padding: 10px 12px 8px; background: var(--sw-paper);
  display: flex; justify-content: center;
}
.sw-toggle {
  display: flex; align-items: center; gap: 2px;
  background: #fff; border: 1px solid var(--sw-border); border-radius: 22px; padding: 3px;
}
.sw-toggle__btn {
  height: 36px; padding: 0 18px; border: 0; border-radius: 18px;
  font-size: 14px; font-weight: 600; background: transparent; color: var(--sw-muted);
}
[data-sw-mode="simple"] .sw-toggle__btn[data-mode="simple"],
[data-sw-mode="data"]   .sw-toggle__btn[data-mode="data"] {
  background: var(--sw-ink); color: #fff;
}

/* Mode visibility — toggled by data-sw-mode on <html> */
[data-sw-mode="data"]   .sw-only-simple { display: none !important; }
[data-sw-mode="simple"] .sw-only-data   { display: none !important; }

/* ---- Cards --------------------------------------------------------------- */
.sw-card {
  background: var(--sw-card); border: 1px solid var(--sw-border);
  border-radius: var(--sw-r); padding: 14px;
}
.sw-card--lg { border-radius: var(--sw-r-lg); padding: 18px; }
.sw-card--dark { background: var(--sw-ink-panel); color: #fff; border: 0; border-radius: var(--sw-r-lg); padding: 16px 18px; }
.sw-card--dark .sw-eyebrow { color: var(--sw-on-dark-soft); }
.sw-card--tint { background: var(--sw-tint); color: var(--sw-tint-ink); border: 0; border-radius: 10px; }
.sw-card-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sw-card-grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }

/* ---- Buttons ------------------------------------------------------------- */
.sw-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 48px; padding: 0 18px; border: 0; border-radius: var(--sw-r-sm);
  font-size: 15px; font-weight: 600; text-align: center;
}
.sw-btn--primary { background: var(--sw-forest); color: #fff; font-family: var(--sw-display); font-weight: 700; }
.sw-btn--primary:hover { color: #fff; text-decoration: none; }
.sw-btn--amber { background: var(--sw-amber); color: var(--sw-ink); font-family: var(--sw-display); font-weight: 700; }
.sw-btn--amber:hover { color: var(--sw-ink); text-decoration: none; }
.sw-btn--light { background: #fff; color: var(--sw-ink); }
.sw-btn--light:hover { color: var(--sw-ink); text-decoration: none; }
.sw-btn--outline { background: transparent; border: 1.5px solid var(--sw-ink); color: var(--sw-ink); }
.sw-btn--onhero-solid { background: #fff; color: var(--sw-ink); }
.sw-btn--onhero-ghost { background: transparent; border: 1.5px solid rgba(255,255,255,0.7); color: #fff; font-weight: 500; }
.sw-btn--block { display: flex; width: 100%; }
.sw-btn--tall { height: 56px; font-size: 17px; }

/* ---- Chips / badges ------------------------------------------------------ */
.sw-chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 40px; padding: 0 14px; border-radius: 20px;
  font-size: 14px; border: 1.5px solid var(--sw-dashed); color: var(--sw-ink); background: transparent;
}
.sw-chip.is-on { background: var(--sw-ink); color: #fff; border-color: var(--sw-ink); font-weight: 500; }
.sw-chip--amber.is-on { background: var(--sw-amber); color: var(--sw-ink); border-color: var(--sw-amber); font-weight: 600; }

/* Scale badge — the coloured verdict pill */
.sw-badge {
  display: inline-flex; align-items: center; white-space: nowrap;
  padding: 6px 12px; border-radius: 16px; font-size: 13px; font-weight: 600;
}
.sw-badge--sm { padding: 3px 9px; border-radius: 12px; font-size: 12px; }
.sw-badge--excellent { background: var(--sw-forest);   color: #fff; }
.sw-badge--very-good  { background: var(--sw-verygood); color: #fff; }
.sw-badge--good       { background: var(--sw-amber);    color: var(--sw-ink); }
.sw-badge--fair       { background: var(--sw-fair);     color: #fff; }
.sw-badge--weak       { background: var(--sw-weak);     color: #fff; }
.sw-badge--none       { background: transparent; color: var(--sw-muted); border: 1px dashed var(--sw-dashed); }

/* Small uppercase tag on hero */
.sw-tag {
  font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
  background: rgba(255,255,255,0.18); padding: 4px 8px; border-radius: 4px; color: #fff;
}

/* ---- Search field -------------------------------------------------------- */
.sw-searchbar { display: flex; align-items: center; gap: 8px; padding: 8px 12px; min-height: 64px; }
.sw-input {
  flex: 1; display: flex; align-items: center; gap: 10px;
  background: #fff; border: 2px solid var(--sw-ink); border-radius: 10px;
  padding: 0 14px; height: 52px; font-size: 17px; color: var(--sw-ink); width: 100%;
}
.sw-input input { border: 0; outline: 0; flex: 1; font: inherit; color: inherit; background: transparent; min-width: 0; }
.sw-input input::placeholder { color: var(--sw-faint); }

/* ---- School list rows ---------------------------------------------------- */
.sw-list { display: flex; flex-direction: column; }
.sw-row {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px; min-height: 64px;
  border-bottom: 1px solid var(--sw-hair); color: inherit;
}
.sw-row:hover { text-decoration: none; background: rgba(0,0,0,0.015); }
.sw-row__main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.sw-row__name { font-size: 16px; font-weight: 600; color: var(--sw-ink); }
.sw-row__meta { font-size: 13px; color: var(--sw-muted); }
.sw-row__gpa  { font-family: var(--sw-display); font-weight: 700; font-size: 18px; text-align: right; }
.sw-row--card {
  background: #fff; border: 1px solid var(--sw-border); border-radius: var(--sw-r);
  padding: 14px; min-height: 72px; margin-bottom: 8px;
}
.sw-list--cards { padding: 0 12px; }
mark.sw-hl { background: var(--sw-mark); color: inherit; border-radius: 2px; }

/* ---- Hero (school header with per-school accent) ------------------------ */
.sw-hero {
  margin: 0 12px; border-radius: var(--sw-r-lg); padding: 18px;
  display: flex; flex-direction: column; gap: 12px; color: #fff;
  background: var(--sw-forest); /* default accent; overridden per school */
}
.sw-hero__tags { display: flex; gap: 6px; flex-wrap: wrap; }
.sw-hero__title { font-family: var(--sw-display); font-weight: 800; font-size: 30px; line-height: 1.02; letter-spacing: -0.025em; }
.sw-hero__sub { font-size: 14px; opacity: 0.9; line-height: 1.45; }
.sw-hero__actions { display: flex; gap: 8px; align-items: center; margin-top: 2px; }
.sw-hero__actions .sw-btn { height: 44px; flex: 1; }

/* ---- Tabs ---------------------------------------------------------------- */
.sw-tabs { display: flex; padding: 0 12px; margin-top: 14px; border-bottom: 1px solid var(--sw-border); overflow: auto; }
.sw-tab { padding: 12px; min-height: 44px; font-size: 14px; color: var(--sw-muted); white-space: nowrap; }
.sw-tab.is-active { color: var(--sw-ink); font-weight: 600; border-bottom: 2.5px solid var(--sw-ink); }
.sw-tab:hover { text-decoration: none; }

/* Segmented (CSEE / ACSEE) control */
.sw-seg { display: flex; background: var(--sw-hair); border-radius: 9px; padding: 3px; flex: 1; }
.sw-seg__opt { flex: 1; text-align: center; padding: 9px 0; min-height: 40px; font-size: 14px; color: var(--sw-muted); border-radius: 7px; }
.sw-seg__opt.is-active { background: #fff; font-weight: 600; color: var(--sw-ink); box-shadow: 0 1px 2px rgba(0,0,0,0.08); }
.sw-selectish {
  display: flex; align-items: center; gap: 6px; background: #fff; border: 1px solid var(--sw-border);
  border-radius: 9px; padding: 0 12px; min-height: 46px; font-size: 14px; font-weight: 600; color: var(--sw-ink);
}

/* ---- Big stat / metric --------------------------------------------------- */
.sw-stat__label { font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--sw-muted); }
.sw-stat__value { font-family: var(--sw-display); font-weight: 800; font-size: 40px; letter-spacing: -0.03em; line-height: 1; color: var(--sw-forest); }
.sw-stat__value--ink { color: var(--sw-ink); }
.sw-delta-up   { font-size: 12px; color: var(--sw-verygood); font-weight: 600; }
.sw-delta-down { font-size: 12px; color: var(--sw-weak); font-weight: 600; }

/* ---- Division bar -------------------------------------------------------- */
.sw-divbar { display: flex; height: 14px; border-radius: 4px; overflow: hidden; }
.sw-divbar--sm { height: 10px; }
.sw-divbar > span { display: block; }
.sw-div-I   { background: var(--sw-forest); }
.sw-div-II  { background: var(--sw-verygood); }
.sw-div-III { background: var(--sw-amber); }
.sw-div-IV  { background: var(--sw-fair); }
.sw-div-0   { background: var(--sw-weak); }
.sw-divlegend { display: flex; justify-content: space-between; font-size: 12px; color: var(--sw-muted); }

/* Progress bar (subject) */
.sw-track { height: 6px; background: var(--sw-hair); border-radius: 3px; overflow: hidden; }
.sw-track--lg { height: 8px; border-radius: 4px; background: var(--sw-hair); }
.sw-track > span { display: block; height: 100%; }

/* ---- Source / trust note ------------------------------------------------- */
.sw-source {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px;
  background: var(--sw-tint); border-radius: 10px; font-size: 12px; color: var(--sw-tint-ink); line-height: 1.5;
}
.sw-source svg { flex: none; margin-top: 2px; }

/* ---- Empty / dashed note ------------------------------------------------- */
.sw-note-dashed {
  border: 1px dashed var(--sw-dashed); border-radius: var(--sw-r);
  padding: 12px 14px; font-size: 13px; color: var(--sw-muted); line-height: 1.5;
}
.sw-legendcard { background: #fff; border: 1px solid var(--sw-border); border-radius: var(--sw-r); padding: 12px 14px; }

/* ---- Interest capture (dark lead form) ----------------------------------- */
.sw-interest {
  background: var(--sw-ink-panel); color: #fff; border-radius: var(--sw-r-lg);
  padding: 18px 16px; display: flex; flex-direction: column; gap: 14px;
}
.sw-interest__title { font-family: var(--sw-display); font-weight: 700; font-size: 20px; line-height: 1.15; }
.sw-interest__sub { font-size: 13px; color: var(--sw-on-dark-mute); line-height: 1.45; }
.sw-interest__chips { display: flex; flex-wrap: wrap; gap: 8px; }
.sw-interest__phone { display: flex; gap: 8px; }
.sw-phone-field {
  display: flex; align-items: center; gap: 8px; background: #fff; border-radius: var(--sw-r-sm);
  padding: 0 12px; height: 52px; flex: 1; color: var(--sw-ink); font-size: 16px;
}
.sw-phone-field input { border: 0; outline: 0; font: inherit; color: inherit; flex: 1; min-width: 0; }
.sw-phone-field .cc { color: var(--sw-muted); }

/* ---- Trend stair (simple) ------------------------------------------------ */
.sw-stair { display: grid; grid-template-columns: 52px 1fr; gap: 12px; align-items: center; min-height: 56px; }
.sw-stair__year { font-family: var(--sw-display); font-weight: 800; font-size: 18px; color: var(--sw-ink); }
.sw-stair__bar { display: flex; align-items: center; gap: 10px; color: #fff; border-radius: 12px; padding: 12px 14px; }

/* ---- Person dots (simple summary) ---------------------------------------- */
.sw-dots { display: grid; grid-template-columns: repeat(5, 12px); gap: 3px; flex: none; margin-top: 3px; }
.sw-dots span { width: 12px; height: 12px; border-radius: 50%; background: var(--sw-hair); }
.sw-dots span.on { background: var(--sw-forest); }

/* ---- Misc utilities ------------------------------------------------------ */
.sw-stack { display: flex; flex-direction: column; }
.sw-gap6 { gap: 6px; } .sw-gap8 { gap: 8px; } .sw-gap10 { gap: 10px; } .sw-gap12 { gap: 12px; } .sw-gap14 { gap: 14px; } .sw-gap16 { gap: 16px; }
.sw-row-flex { display: flex; align-items: center; }
.sw-between { display: flex; align-items: center; justify-content: space-between; }
.sw-spacer { flex: 1; }
.sw-mt-auto { margin-top: auto; }
.sw-hr { border: 0; border-top: 1px solid var(--sw-hair); margin: 0; }
.sw-footer { padding: 16px 20px 24px; border-top: 1px solid var(--sw-border); font-size: 12px; color: var(--sw-muted); line-height: 1.5; }

/* ---- Desktop app nav (wide screens only) --------------------------------- */
.sw-deskbar { display: none; }         /* shown on desktop only */
.sw-deskbar__inner {
  max-width: 1160px; margin: 0 auto; width: 100%;
  display: flex; align-items: center; justify-content: space-between;
  gap: 28px; padding: 0 40px; height: 64px;
}
.sw-deskbar__left { display: flex; align-items: center; gap: 28px; flex: 1; min-width: 0; }
.sw-deskbar__search {
  display: flex; align-items: center; gap: 10px; background: #fff; border: 1.5px solid var(--sw-dashed);
  border-radius: 9px; padding: 0 12px; height: 40px; max-width: 360px; flex: 1; color: var(--sw-ink);
}
.sw-deskbar__search input { border: 0; outline: 0; background: transparent; font: inherit; color: inherit; flex: 1; min-width: 0; }
.sw-deskbar__search input::placeholder { color: var(--sw-faint); }
.sw-deskbar__nav { display: flex; align-items: center; gap: 22px; font-size: 14px; font-weight: 500; }
.sw-deskbar__nav a { color: var(--sw-ink); }
.sw-deskbar__nav a.muted { color: var(--sw-muted); }

/* Home: swap the mobile column for the full desktop landing page >=900px */
.sw-home-desk { display: none; }
@media (min-width: 1000px) {
  .sw-home-desk { display: block; }
  .sw-home-mob { display: none; }
}
.sw-home-desk__inner { max-width: 1512px; margin: 0 auto; }
.sw-home-desk a:hover { text-decoration: none; }

/* Two-column school body (main + sidebar), stacked on mobile */
.sw-school-2col { display: flex; flex-direction: column; gap: 12px; }
.sw-school-2col .col-side { display: flex; flex-direction: column; gap: 12px; }

/* Center + cap the reading width of narrative/simple blocks on wide screens */
.sw-limit { width: 100%; }

/* ---- Desktop refinements ------------------------------------------------- */
@media (min-width: 760px) {
  .sw-app { max-width: 700px; }
  .sw-h1 { font-size: 44px; }
}

@media (min-width: 860px) {
  .sw-deskbar { display: block; border-bottom: 1px solid var(--sw-border); background: var(--sw-paper); }
  .sw-mobbar { display: none; }
}

@media (min-width: 1040px) {
  .sw-app--school { max-width: 1160px; }
  .sw-app--school .sw-hero { margin: 0 40px; padding: 26px 28px 22px; }
  .sw-app--school .sw-hero__title { font-size: 40px; }
  .sw-app--school .sw-tabs { padding: 0 40px; margin-top: 18px; }
  .sw-app--school .sw-modebar { justify-content: flex-start; padding-left: 40px; }

  /* Summary body becomes hero-width main column + fixed sidebar */
  .sw-app--school .sw-school-2col {
    display: grid; grid-template-columns: minmax(0,1fr) 340px; gap: 24px;
    align-items: start; padding-left: 40px; padding-right: 40px;
  }
  .sw-app--school .sw-school-2col .col-main { display: flex; flex-direction: column; gap: 12px; }

  /* Non-summary school tabs: cap the single reading column */
  .sw-app--school .sw-limit { max-width: 760px; margin-left: 40px; }

  /* Home hero + tools side by side */
  .sw-home-grid { display: grid; grid-template-columns: minmax(0,1.1fr) minmax(0,0.9fr); gap: 40px; align-items: start; }
}
