/* ── College Stats Decoded — design system v2 ──
   Drop-in replacement for style.css. Classes identical; tokens swapped.
   Uses system font stack (Segoe UI / SF Pro / system-ui), cobalt accent,
   mono for numerical values. No Google Fonts required.
*/

:root {
    /* Cobalt + Gold + Aubergine — cool editorial palette */
    --bg:            #f5f7fb;   /* cool near-white with slight blue undertone */
    --bg-card:       #ffffff;
    --bg-subtle:    #eef1f7;
    --bg-nav:        #eef1f7;
    --bg-dark:       #0e1320;   /* cool ink for dark surfaces */
    --text-primary:  #0e1320;
    --text-secondary:#2d3040;
    --text-muted:    #5f6478;
    --accent:        #2e5bff;   /* cobalt */
    --accent-hover:  #1d47d6;
    --accent-light:  rgba(46,91,255,0.06);
    --accent-soft:   rgba(46,91,255,0.12);
    --border:        #e2e5ed;   /* cool-toned border */
    --border-light:  #ebedf2;
    --gold:          #b8862c;
    --gold-light:    rgba(184,134,44,0.08);
    --gold-border:   rgba(184,134,44,0.28);
    --aubergine:     #5b3a5b;
    --aubergine-light: rgba(91,58,91,0.08);
    /* Aliases — existing var(--teal) / var(--olive) calls now remap to new accents */
    --teal:          var(--aubergine);
    --teal-light:    var(--aubergine-light);
    --olive:         var(--gold);
    --olive-light:   var(--gold-light);
    /* School color — set dynamically per profile via JS (default to accent) */
    --school-color:  var(--accent);
    --radius:        10px;
    --radius-sm:     6px;
    --shadow:        0 1px 2px rgba(14,19,32,0.04);
    --shadow-md:     0 4px 20px rgba(14,19,32,0.06);

    /* System font stacks — no Google Fonts */
    --font-ui:   system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Cascadia Mono", monospace;
}

/* ── Base ── */
body {
    font-family: var(--font-ui);
    background: var(--bg);
    color: var(--text-primary);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

/* ── Navbar — LIGHT ── */
.navbar {
    background: var(--bg-nav) !important;
    padding: 0.55rem 1.5rem;
    border-bottom: 1px solid var(--border);
    backdrop-filter: saturate(180%) blur(10px);
}
.navbar-brand {
    font-family: var(--font-ui);
    font-weight: 600;
    font-size: 1.65rem;
    letter-spacing: -0.015em;
    color: var(--text-primary) !important;
    white-space: nowrap;
    margin-right: 1.5rem;
}
.navbar-brand span { color: var(--accent); }
.navbar .nav-link {
    color: var(--text-secondary) !important;
    font-size: 0.82rem;
    font-weight: 500;
    padding: 0.5rem 0.7rem !important;
    transition: color 0.15s;
    white-space: nowrap;
}
.navbar .nav-link:hover { color: var(--text-primary) !important; }
.navbar .nav-link.active {
    color: var(--text-primary) !important;
    position: relative;
}
.navbar .nav-link.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0.7rem;
    right: 0.7rem;
    height: 2px;
    background: var(--accent);
    border-radius: 1px;
}
/* Ask a Question — sole right-side CTA. Filled accent button. */
.navbar .nav-link.nav-cta {
    display: inline-flex;
    align-items: center;
    padding: 7px 16px !important;
    background: var(--accent);
    color: #fff !important;
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: -0.005em;
    border-radius: var(--radius-sm);
    transition: background 0.15s;
}
.navbar .nav-link.nav-cta:hover {
    background: var(--accent-hover);
    color: #fff !important;
}
.navbar .nav-link.nav-cta.active::after {
    display: none; /* no underline on CTA */
}
/* Toggler on light bg */
.navbar-dark .navbar-toggler-icon,
.navbar-toggler-icon {
    filter: invert(1) opacity(0.8);
}

/* ── Sub-nav pills ── */
.nav-pills .nav-link {
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 500;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.35rem 0.85rem;
    transition: all 0.15s;
}
.nav-pills .nav-link:hover {
    background: var(--bg-card);
    color: var(--text-primary);
    border-color: #d4d4d9;
}
.nav-pills .nav-link.active {
    background: var(--accent);
    color: #fff !important;
    border-color: var(--accent);
}

/* ── Dashboard header ── */
.dashboard-header { padding: 2.25rem 0 1.25rem; }
.dashboard-header h1 {
    font-family: var(--font-ui);
    font-size: 1.7rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    margin-bottom: 0.25rem;
}
.dashboard-header p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin: 0;
}

/* ── Cards ── */
.chart-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 1.5rem;
    margin-bottom: 1.25rem;
    position: relative;
    box-shadow: var(--shadow);
    height: calc(100% - 1.25rem); /* fill column so sibling cards match height */
}

/* Make columns flex so chart-card height: 100% works */
.row > [class*="col"] {
    display: flex;
    flex-direction: column;
}

/* ── Share button ── */
.chart-share-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 4px 10px;
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    opacity: 0;
    transition: opacity 0.15s ease, background 0.15s ease, color 0.15s ease;
    white-space: nowrap;
    line-height: 1;
    z-index: 10;
}
.chart-card:hover .chart-share-btn { opacity: 1; }
.chart-share-btn:hover {
    background: var(--bg-subtle);
    color: var(--text-primary);
    border-color: #d4d4d9;
}
.chart-share-btn svg { width: 11px; height: 11px; flex-shrink: 0; }
.chart-share-btn.sharing {
    opacity: 1;
    color: var(--accent);
    border-color: var(--accent);
}
@media (hover: none) {
    .chart-share-btn {
        opacity: 0.6;
        top: 0.75rem;
        right: 0.75rem;
        padding: 5px 11px;
        font-size: 0.72rem;
    }
    .chart-share-btn:active { opacity: 1; background: var(--bg-subtle); }
}
.chart-card h3 {
    font-family: var(--font-ui);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    letter-spacing: -0.005em;
}
/* Override inline-styled source badges ("CDS", "IPEDS") in chart headers.
   profile.html has ~30 of these as inline style spans — !important needed
   to beat inline styles. Gold for archival / source-reference feel. */
.chart-card h3 span[title*="Source"],
.chart-card h3 span[title*="IPEDS"],
.chart-card h3 span[title*="Common Data"] {
    background: var(--gold-light) !important;
    color: var(--gold) !important;
    border: 1px solid var(--gold-border) !important;
    border-radius: 4px !important;
    font-family: var(--font-mono) !important;
    font-weight: 500 !important;
    font-size: 0.62rem !important;
    letter-spacing: 0.06em !important;
    padding: 2px 7px !important;
    text-transform: uppercase !important;
}
.chart-card .subtitle {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 1.15rem;
    line-height: 1.5;
}
.chart-container { min-height: 400px; }

/* ── Stat cards ── */
.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 1.25rem;
    text-align: center;
    margin-bottom: 1rem;
    box-shadow: var(--shadow);
}
.stat-card .stat-value {
    font-family: var(--font-ui);
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    line-height: 1;
}
.stat-card .stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.4rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ── School selector ── */
.school-filter {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 0.9rem 1.25rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow);
}
.school-filter label {
    font-size: 0.82rem;
    font-weight: 600;
    margin-right: 0.75rem;
    color: var(--text-secondary);
}
.school-pill {
    display: inline-flex;
    align-items: center;
    padding: 3px 11px;
    border-radius: 20px;
    color: #fff;
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.15s;
}
.school-pill:hover { opacity: 0.85; }
.school-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    width: 400px;
    max-height: 250px;
    overflow-y: auto;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    z-index: 1000;
}
.school-dropdown-item {
    padding: 9px 14px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.12s;
}
.school-dropdown-item:hover {
    background: var(--accent-light);
    color: var(--accent);
}

/* ── Tables ── */
.results-table {
    font-size: 0.83rem;
    border-collapse: separate;
    border-spacing: 0;
}
.results-table th {
    background: var(--bg-subtle);
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.72rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    position: sticky;
    top: 0;
    text-align: center;
    padding: 0.65rem 0.75rem;
    border: none;
    border-bottom: 1px solid var(--border);
}
.results-table th:first-child { border-radius: var(--radius) 0 0 0; }
.results-table th:last-child  { border-radius: 0 var(--radius) 0 0; }
.results-table td {
    text-align: center;
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}
.results-table tbody tr:hover { background: var(--bg-subtle); }
.results-table tbody tr:last-child td:first-child { border-radius: 0 0 0 var(--radius); }
.results-table tbody tr:last-child td:last-child  { border-radius: 0 0 var(--radius) 0; }

/* ── Hero — soft light-grey panel (cool gradient, dark text) ── */
.hero {
    background: #ffffff;
    color: var(--text-primary);
    padding: 2.5rem 0 2rem;
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
}
.hero-grid {
    display: grid;
    grid-template-columns: 1fr 1.15fr;
    gap: 0.5rem;
    align-items: center;
}
.hero-text { position: relative; z-index: 1; }
.hero-visual { display: flex; align-items: center; justify-content: flex-end; }
.hero-img {
    width: 100%;
    max-width: 100%;
    border-radius: 12px;
    box-shadow: var(--shadow-md);
}
.hero-visual svg {
    width: 100%;
    max-width: 400px;
    opacity: 0.95;
    filter: hue-rotate(210deg) saturate(1.2);
}
.hero-collage {
    width: 100%;
    max-width: 820px;
    height: auto;
    display: block;
    border-radius: 8px;
    /* Subtle shadow gives the "pinned photo" feel on light bg */
    filter: drop-shadow(0 6px 20px rgba(14,19,32,0.08));
}
/* SVG was built for dark bg with white-transparent muted elements.
   Invert those to dark-transparent so they show on the light bg. */
.hero-visual svg rect[fill="rgba(255,255,255,0.05)"] { fill: rgba(14,19,32,0.05) !important; }
.hero-visual svg rect[fill="rgba(255,255,255,0.07)"] { fill: rgba(14,19,32,0.04) !important; }
.hero-visual svg rect[fill="rgba(255,255,255,0.10)"] { fill: rgba(14,19,32,0.07) !important; }
.hero-visual svg rect[fill="rgba(255,255,255,0.12)"] { fill: rgba(14,19,32,0.09) !important; }
.hero-visual svg rect[fill="rgba(255,255,255,0.18)"] { fill: rgba(14,19,32,0.18) !important; }
.hero-visual svg rect[fill="rgba(255,255,255,0.22)"] { fill: rgba(14,19,32,0.25) !important; }
.hero-visual svg rect[stroke="rgba(255,255,255,0.12)"] { stroke: rgba(14,19,32,0.15) !important; }
.hero-visual svg line[stroke="rgba(255,255,255,0.05)"] { stroke: rgba(14,19,32,0.08) !important; }
.hero-visual svg circle[stroke="rgba(255,255,255,0.6)"],
.hero-visual svg circle[stroke="rgba(255,255,255,0.2)"] { stroke: rgba(255,255,255,1) !important; }

.hero h1 {
    font-family: var(--font-ui);
    font-size: 2.5rem;
    font-weight: 600;
    letter-spacing: -0.025em;
    line-height: 1.1;
    margin-bottom: 0.9rem;
    color: var(--text-primary);
}
.hero h1 span { color: var(--accent); }
.hero p {
    font-size: 1rem;
    color: var(--text-secondary);
    max-width: 520px;
    line-height: 1.6;
    text-wrap: pretty;
}
.hero .tagline {
    font-family: var(--font-ui);
    font-size: 1rem;
    font-style: normal;
    color: var(--text-muted);
    margin-top: 0.5rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
    max-width: 420px;
    text-wrap: pretty;
}

/* ── Dashboard link cards ── */
.dash-link {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 1.5rem;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    height: 100%;
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
    box-shadow: var(--shadow);
}
.dash-link:hover {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light), var(--shadow-md);
    color: inherit;
    transform: translateY(-1px);
}
.dash-link h3,
.dash-link-title {
    font-family: var(--font-ui);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.35rem;
    letter-spacing: -0.005em;
}
.dash-link p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 0;
    line-height: 1.55;
}

/* ── Note / callout boxes ── */
.note-box {
    background: var(--accent-light);
    border-radius: var(--radius);
    padding: 0.9rem 1.1rem;
    font-size: 0.84rem;
    color: var(--text-primary);
    margin-bottom: 1.25rem;
    border-left: 3px solid var(--accent);
}
/* Context callout — aubergine accent (editorial insight blocks) */
.context-callout {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-left: 3px solid var(--aubergine);
    border-radius: var(--radius);
    padding: 0.9rem 1.1rem;
    font-size: 0.88rem;
    color: var(--text-secondary);
    margin-bottom: 1.25rem;
    line-height: 1.55;
}
.context-callout .ctx-title {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--aubergine);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.35rem;
}
.context-callout strong { color: var(--text-primary); font-weight: 600; }
.context-callout .ctx-src {
    display: block;
    margin-top: 0.5rem;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-muted);
    font-style: normal;
    letter-spacing: 0.02em;
}
.info-box {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 1.1rem 1.25rem;
    font-size: 0.88rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    box-shadow: var(--shadow);
}
.info-box h2 {
    font-family: var(--font-ui);
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}
.info-box ul { margin: 0; padding-left: 1.25rem; }
.info-box li { margin-bottom: 0.35rem; }
.info-box a {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* ── Query editor ── */
.query-editor {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    min-height: 150px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg-card);
}

/* ── Footer ── */
footer {
    padding: 2rem 0;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.78rem;
    border-top: 1px solid var(--border);
    margin-top: 4rem;
}

/* ── Divider ── */
.section-divider {
    height: 1px;
    background: var(--border);
    margin: 2rem 0;
}

/* ── Form controls ── */
.form-control,
.form-select {
    font-family: var(--font-ui);
    border-color: var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.87rem;
}
.form-control:focus,
.form-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── Profile — NEW: Wikipedia photo hero band ──
   Add this HTML at the top of profile.html content block:
   <div class="profile-photo-hero">
       <img src="{{ wikipedia_photo_url }}" alt="{{ school.name }} campus" />
       <div class="profile-photo-attribution">Photo: Wikimedia Commons / {{ photo_creator }}</div>
   </div>
*/
.profile-photo-hero {
    position: relative;
    height: 240px;
    overflow: hidden;
    background: var(--bg-dark);
}
.profile-photo-hero img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* Duotone: desaturate + tint with cobalt overlay */
    filter: grayscale(0.85) contrast(1.05);
}
.profile-photo-hero::after {
    content: '';
    position: absolute;
    inset: 0;
    background:
        linear-gradient(180deg, rgba(15,17,34,0.1) 0%, rgba(15,17,34,0.5) 100%),
        linear-gradient(135deg, rgba(46,91,255,0.35), rgba(15,17,34,0.15));
    mix-blend-mode: multiply;
    pointer-events: none;
}
.profile-photo-attribution {
    position: absolute;
    bottom: 8px;
    right: 16px;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    letter-spacing: 0.02em;
    color: rgba(255,255,255,0.7);
    z-index: 2;
    text-shadow: 0 1px 3px rgba(0,0,0,0.4);
}

/* ── Profile Page ── */
.profile-header {
    background: var(--bg-card);
    padding: 1.75rem 0 1.5rem;
    border-bottom: 1px solid var(--border);
}
.profile-school-name {
    font-family: var(--font-ui);
    font-size: 2rem;
    font-weight: 600;
    letter-spacing: -0.025em;
    margin-bottom: 0.25rem;
    padding-left: 14px;
    border-left: 4px solid var(--school-color);
    color: var(--text-primary);
    line-height: 1.15;
}
.profile-meta {
    font-size: 0.83rem;
    color: var(--text-muted);
    margin-bottom: 1.25rem;
    padding-left: 18px;
}
/* Horizontal unified strip — gap+background trick gives clean 1px dividers
   on ALL sides that wrap correctly when metrics flow to multiple rows. */
.key-metrics-row {
    display: grid;
    grid-template-columns: repeat(var(--metric-cols, 6), 1fr);
    gap: 1px;
    background: var(--border);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    position: relative;
    margin-bottom: 2rem;
}
.key-metric {
    background: var(--bg-card);
    text-align: left;
    border: none;
    border-radius: 0;
    box-shadow: none;
    padding: 14px 18px;
    min-height: 104px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 0;
}
/* Force uniform primary text on metric values — overrides per-school inline
   color from profile.html (e.g., acceptance rate styled with SCHOOL_COLOR). */
.key-metric .metric-value { color: var(--text-primary) !important; }
.metric-label {
    font-family: var(--font-ui);
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.4rem;
    font-weight: 500;
    line-height: 1.3;
    text-align: left;
    min-height: 2rem;
}
.metric-value {
    font-family: var(--font-ui);
    font-size: 1.55rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    line-height: 1;
    display: block;
    text-align: left;
    width: auto;
    flex: 0 0 auto;
    margin-bottom: 0.4rem;
}
/* metric-year is rendered as a SIBLING to .key-metric cells (not a child).
   In the original design it was absolute-positioned below the strip; in v2
   we span it full-width as a caption row at the bottom of the strip. */
.key-metrics-row > .metric-year {
    grid-column: 1 / -1;
    background: var(--bg-subtle);
    border-top: 1px solid var(--border);
    padding: 8px 18px;
    font-family: var(--font-mono);
    font-size: 0.66rem;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    text-align: right;
    position: static;
    right: auto;
    bottom: auto;
    margin: 0;
}
/* Legacy selector kept so stray .metric-year elements elsewhere still look right */
.metric-year {
    font-family: var(--font-mono);
    font-size: 0.66rem;
    color: var(--text-muted);
    letter-spacing: 0.02em;
    text-transform: uppercase;
}
/* Year + source label inside .key-metric (below the value) */
.metric-source {
    font-family: var(--font-mono);
    font-size: 0.66rem;
    color: var(--text-muted);
    margin-top: 0;
    font-style: normal;
    line-height: 1.3;
    text-align: left;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}
.metric-mini {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.75rem;
    text-align: center;
    box-shadow: var(--shadow);
}
.metric-mini .metric-val {
    font-family: var(--font-ui);
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
}
.metric-mini .metric-lbl {
    font-family: var(--font-ui);
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
    line-height: 1.3;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ── Sticky section nav ── */
.profile-toc {
    position: sticky;
    top: 0;
    background: rgba(250, 250, 250, 0.92);
    backdrop-filter: saturate(180%) blur(10px);
    padding: 0.55rem 0;
    border-bottom: 1px solid var(--border);
    z-index: 100;
}
.profile-toc .container { position: relative; }
.profile-toc .container::before,
.profile-toc .container::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 28px;
    pointer-events: none;
    z-index: 2;
}
.profile-toc .container::before {
    left: 0;
    background: linear-gradient(to right, var(--bg) 0%, rgba(250,250,250,0) 100%);
}
.profile-toc .container::after {
    right: 0;
    background: linear-gradient(to left, var(--bg) 0%, rgba(250,250,250,0) 100%);
}
.profile-toc nav {
    display: flex;
    gap: 1.5rem;
    overflow-x: auto;
    font-size: 0.83rem;
    scroll-behavior: smooth;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding: 0 4px;
}
.profile-toc nav::-webkit-scrollbar { display: none; }
.profile-toc a {
    color: var(--text-secondary);
    text-decoration: none;
    white-space: nowrap;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid transparent;
    transition: color 0.15s, border-color 0.15s;
    font-weight: 500;
}
.profile-toc a:hover,
.profile-toc a.active {
    color: var(--text-primary);
    border-bottom-color: var(--accent);
}

/* ── Profile content ── */
.profile-content {
    padding-top: 2rem;
    padding-bottom: 4rem;
}
.profile-section {
    margin-bottom: 3rem;
    scroll-margin-top: 60px;
}
.profile-section h2 {
    font-family: var(--font-ui);
    font-size: 1.15rem;
    font-weight: 600;
    letter-spacing: -0.015em;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}
.profile-section > .subtitle {
    font-size: 0.84rem;
    color: var(--text-muted);
    margin-bottom: 1.25rem;
}

/* ── Navbar search dropdown ── */
.nav-search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    z-index: 1000;
    max-height: 300px;
    overflow-y: auto;
    margin-top: 4px;
}
.nav-search-item {
    padding: 8px 12px;
    font-size: 0.82rem;
    color: var(--text-primary);
    cursor: pointer;
    border-bottom: 1px solid var(--border-light);
}
.nav-search-item:last-child { border-bottom: none; }
.nav-search-item:hover {
    background: var(--accent-light);
    color: var(--accent);
}

/* ── Tabular numbers everywhere ── */
.metric-value,
.metric-val,
.stat-value,
.results-table td,
.metric-year,
.metric-source { font-variant-numeric: tabular-nums; }

/* ── Responsive: Tablet ── */
@media (max-width: 992px) {
    .hero h1 { font-size: 2rem; }
    .hero-grid { gap: 2rem; }
    .profile-school-name { font-size: 1.7rem; }
    .key-metrics-row { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 0.6rem; }
    .metric-value { font-size: 1.25rem; }
}

/* ── Responsive: Mobile ── */
@media (max-width: 768px) {
    .hero { padding: 2.5rem 0 2rem; margin-bottom: 1.5rem; }
    .hero h1 { font-size: 1.65rem; line-height: 1.2; }
    .hero p { font-size: 0.95rem; }
    .hero .tagline { font-size: 0.95rem; }
    .hero-grid { grid-template-columns: 1fr; gap: 1.25rem; }
    .hero-visual { max-width: 240px; margin: 0 auto; }

    .navbar { padding: 0.5rem 1rem; }
    .navbar-brand { font-size: 0.95rem; margin-right: 0; }
    .navbar .nav-link { font-size: 0.85rem; padding: 0.6rem 0.25rem !important; }
    .collapse.navbar-collapse { padding-top: 0.5rem; }
    .navbar-collapse .navbar-nav { gap: 0; }
    .navbar-collapse .nav-link { border-bottom: 1px solid var(--border-light); }

    .profile-photo-hero { height: 180px; }

    .profile-header { padding: 1.25rem 0 1rem; }
    .profile-school-name { font-size: 1.4rem; padding-left: 12px; }
    .profile-meta { font-size: 0.8rem; padding-left: 16px; margin-bottom: 1rem; }

    .key-metrics-row { grid-template-columns: repeat(2, 1fr); gap: 1px; }
    .key-metric {
        padding: 0.9rem 0.95rem;
        min-height: 92px;
        border: none;
    }
    .metric-label { font-size: 0.6rem; letter-spacing: 0.04em; margin-bottom: 0.3rem; }
    .metric-value { font-size: 1.2rem; margin-bottom: 0.35rem; }
    .metric-year { font-size: 0.6rem; }

    .profile-toc { padding: 0.45rem 0; }
    .profile-toc nav { gap: 0.75rem; font-size: 0.78rem; -webkit-overflow-scrolling: touch; padding: 0 0.5rem; }
    .profile-toc a { padding-bottom: 0.35rem; }

    .profile-content { padding-top: 1.25rem; padding-bottom: 2rem; }
    .profile-section { margin-bottom: 2rem; scroll-margin-top: 50px; }
    .profile-section h2 { font-size: 1rem; }
    .profile-section > .subtitle { font-size: 0.8rem; margin-bottom: 1rem; }

    .chart-card { padding: 1rem; margin-bottom: 0.75rem; }
    .chart-card h3 { font-size: 0.88rem; }
    /* Charts keep their defined heights on mobile so legends have room */
    .chart-card [id^="chart-"] { min-height: 280px; }
    /* Chart header rows (title + toggle buttons) wrap gracefully on small screens */
    .chart-header-row { flex-wrap: wrap !important; gap: 0.4rem 0.5rem !important; }
    .chart-header-row .chart-header-title { flex: 1 1 auto; min-width: 0; }
    .chart-header-row .chart-header-btns { flex-shrink: 0; }

    .profile-section .col-lg-6 { flex: 0 0 100%; max-width: 100%; }

    .school-dropdown { width: calc(100vw - 2rem); }

    .dash-link { padding: 1.1rem; }
    .dash-link h3 { font-size: 0.95rem; }
    .dash-link p { font-size: 0.82rem; }

    .info-box { padding: 0.9rem 1rem; font-size: 0.82rem; }
    .info-box h2 { font-size: 0.92rem; }

    footer { padding: 1.5rem 0; margin-top: 2rem; font-size: 0.75rem; }

    .results-table { font-size: 0.75rem; }
    .results-table th { font-size: 0.68rem; padding: 0.5rem; }
    .results-table td { padding: 0.45rem 0.5rem; }
}

/* ── Responsive: Small phones ── */
@media (max-width: 380px) {
    .hero h1 { font-size: 1.4rem; }
    .hero p { font-size: 0.88rem; }
    .profile-school-name { font-size: 1.25rem; }
    .key-metrics-row { grid-template-columns: repeat(2, 1fr); gap: 0.45rem; }
    .key-metric { padding: 0.7rem 0.35rem; }
    .metric-value { font-size: 0.95rem; }
    .metric-label { font-size: 0.57rem; }
    .chart-card { padding: 0.75rem; }
    .profile-toc nav { gap: 0.6rem; font-size: 0.72rem; }
}

/* ── PWA: Safe area insets ── */
@supports (padding: env(safe-area-inset-top)) {
    .navbar { padding-top: calc(0.5rem + env(safe-area-inset-top)); }
    body { padding-bottom: env(safe-area-inset-bottom); }
}

/* ── Touch-friendly tap targets ── */
@media (pointer: coarse) {
    .profile-toc a { min-height: 44px; display: flex; align-items: center; }
    .navbar .nav-link { min-height: 44px; display: flex; align-items: center; }
    .school-dropdown-item { min-height: 44px; display: flex; align-items: center; }
    .nav-search-item { min-height: 44px; display: flex; align-items: center; }
}

/* ── Footer ── */
.site-footer {
    margin-top: 3rem;
    border-top: 1px solid var(--border);
    background: var(--bg-card);
    padding: 1.5rem 0;
    font-size: 0.78rem;
    color: var(--text-muted);
}
.footer-inner {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1.5rem;
    flex-wrap: wrap;
}
.footer-left {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.footer-brand-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.footer-brand {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}
.footer-beta {
    display: inline-block;
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    background: #1a56db;
    color: #fff;
    border-radius: 3px;
    padding: 1px 5px;
}
.footer-copy {
    color: var(--text-muted);
}
.footer-right {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    text-align: right;
}
.footer-sources a, .footer-link {
    color: var(--text-muted);
    text-decoration: underline;
    text-underline-offset: 2px;
}
.footer-sources a:hover, .footer-link:hover {
    color: var(--text-primary);
}
.footer-link {
    font-weight: 600;
}
@media (max-width: 600px) {
    .footer-inner { flex-direction: column; }
    .footer-right { text-align: left; }
}

/* ── Source data badge (CDS / IPEDS) ── */
.src-badge {
    display: inline-block;
    margin-left: 8px;
    padding: 1px 7px;
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    background: rgba(184,134,44,0.08);
    color: #8a6220;
    border: 1px solid rgba(184,134,44,0.30);
    border-radius: 3px;
    vertical-align: middle;
    cursor: default;
}
