/* ScholarshipFinderAI — handwritten, dependency-free CSS.
   Mobile-first, fast, no render-blocking frameworks. */

:root {
    /* Brand: refined indigo. Single considered accent (no "AI gradient"). */
    --brand: #5654a0;          /* indigo accent (links/secondary) */
    --brand-dark: #2b2a63;     /* deep indigo */
    --brand-strong: #3b3a86;   /* solid CTA fill — strong contrast on white */
    --sky: #ccccff;
    --sky-bg: #eef0fb;         /* faint indigo-tinted surface for panels/banners */
    --sky-border: #d9daf1;
    --ink: #1d1c3b;            /* tinted near-black (deep indigo) for headings */
    --ink-soft: #44436a;       /* body text */
    --muted: #6f6e92;
    --line: #e6e6f1;           /* single cool gray family */
    --bg: #f7f7fb;
    --card: #ffffff;
    --full: #15803d;
    --partial: #b45309;
    --radius-sm: 10px;
    --radius: 14px;
    --radius-lg: 22px;         /* softer on big containers, tighter on inner */
    /* Colored shadows (carry the indigo hue, single light source) */
    --shadow: 0 1px 2px rgba(29, 28, 59, .05), 0 14px 32px -12px rgba(59, 58, 134, .16);
    --shadow-brand: 0 10px 24px -8px rgba(59, 58, 134, .42);
    --shadow-hover: 0 2px 4px rgba(29, 28, 59, .06), 0 22px 44px -16px rgba(59, 58, 134, .26);
    --grad: linear-gradient(135deg, #5654a0 0%, #2b2a63 100%); /* legacy token; used sparingly */
    --font: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-display: "Outfit", "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
    margin: 0;
    font-family: var(--font);
    color: var(--ink-soft);
    background:
        radial-gradient(1100px 460px at 50% -120px, var(--sky-bg) 0%, rgba(247,247,251,0) 70%),
        var(--bg);
    background-attachment: fixed;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}
a { color: var(--brand); text-decoration: none; transition: color .15s; }
a:hover { color: var(--brand-dark); text-decoration: underline; text-underline-offset: 2px; }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.15; color: var(--ink); letter-spacing: -.02em; text-wrap: balance; }
.container { max-width: 1140px; margin: 0 auto; padding: 0 22px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.accent { color: var(--brand); }

/* Tabular figures wherever data/amounts appear (skill: no proportional numerals in data) */
.card-facts dd, .fact-value, .cat-links .count, .results-head h1, .hero-meta, .admin-head h1 { font-variant-numeric: tabular-nums; }

/* Visible keyboard focus everywhere (a11y) */
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 6px; }

/* Header */
.site-header { background: rgba(255,255,255,.86); backdrop-filter: saturate(140%) blur(10px); -webkit-backdrop-filter: saturate(140%) blur(10px); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; border-top: 3px solid var(--brand-strong); }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { display: flex; align-items: center; gap: 8px; font-size: 1.15rem; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand-logo { display: block; width: 40px; height: 40px; flex: 0 0 auto; }
.footer-brand .brand-logo { width: 36px; height: 36px; }
.brand-name strong { color: var(--brand); }

/* Skip link (a11y) — hidden until focused */
.skip-link { position: absolute; left: -9999px; top: 0; background: var(--brand); color: #fff; padding: 10px 14px; border-radius: 0 0 8px 0; z-index: 100; }
.skip-link:focus { left: 0; }

/* Primary nav */
.site-nav { display: flex; align-items: center; gap: 4px; }
.site-nav a { color: var(--ink-soft); padding: 8px 12px; font-weight: 500; border-radius: 8px; font-size: .95rem; }
.site-nav a:hover { color: var(--brand); background: var(--sky-bg); text-decoration: none; }
.site-nav a[aria-current="page"] { color: var(--brand); font-weight: 600; }
.site-nav .nav-cta { background: var(--brand-strong); color: #fff; padding: 9px 16px; margin-left: 8px; box-shadow: var(--shadow-brand); }
.site-nav .nav-cta:hover { background: #322f72; color: #fff; transform: translateY(-1px); }

/* Hamburger toggle — hidden on desktop */
.nav-toggle { display: none; flex-direction: column; gap: 5px; background: none; border: none; cursor: pointer; padding: 8px; border-radius: 8px; }
.nav-toggle-bar { display: block; width: 24px; height: 2px; background: var(--ink); border-radius: 2px; transition: transform .2s, opacity .2s; }
.nav-toggle.is-active .nav-toggle-bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.is-active .nav-toggle-bar:nth-child(2) { opacity: 0; }
.nav-toggle.is-active .nav-toggle-bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Hero */
.hero {
    padding: 64px 0 36px; text-align: center;
    background: radial-gradient(900px 380px at 50% -60px, var(--sky-bg) 0%, var(--bg) 70%);
}
.hero h1 { font-size: clamp(2.4rem, 5.6vw, 3.6rem); font-weight: 800; margin: 0 0 14px; letter-spacing: -.035em; }
.lede { max-width: 620px; margin: 0 auto 28px; font-size: 1.15rem; color: var(--ink-soft); }
.hero-meta { margin-top: 16px; }

/* Finder card / forms */
.finder-card {
    background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg);
    box-shadow: var(--shadow); padding: 28px; max-width: 760px; margin: 0 auto; text-align: left;
}
.finder-card .grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.finder-card label, .filter-bar label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: .9rem; color: var(--ink-soft); }
.finder-card label.full { margin-top: 16px; }
input, select, textarea {
    font: inherit; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm);
    background: #fff; color: var(--ink); width: 100%; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(86,84,160,.18); }

/* Buttons */
.btn { display: inline-block; font-family: var(--font-display); font-weight: 600; letter-spacing: -.01em; cursor: pointer; border: none; border-radius: 10px; padding: 12px 20px; font-size: 1rem; transition: transform .15s ease, box-shadow .2s ease, background-color .15s ease; }
.btn-primary { background: var(--brand-strong); color: #fff; box-shadow: var(--shadow-brand); }
.btn-primary:hover { background: #322f72; transform: translateY(-2px); box-shadow: 0 14px 30px -8px rgba(59,58,134,.5); text-decoration: none; }
.btn-primary:active { transform: translateY(0) scale(.985); }
.btn-lg { width: 100%; margin-top: 20px; padding: 15px; font-size: 1.05rem; }
.btn-link { background: none; color: var(--brand); padding: 8px 0; }

/* AI search box */
.ai-search { max-width: 760px; margin: 0 auto; text-align: left; }
.ai-search textarea {
    font: inherit; width: 100%; padding: 14px 16px; border: 2px solid var(--brand);
    border-radius: var(--radius); resize: vertical; background: #fff; box-shadow: var(--shadow);
}
.ai-search textarea:focus { outline: 2px solid var(--brand); }
.ai-label { display: block; font-weight: 700; color: var(--brand-dark); margin-bottom: 8px; }
.ai-search .btn-lg { margin-top: 14px; }
.or-divider { max-width: 760px; margin: 28px auto 20px; text-align: center; position: relative; }
.or-divider::before { content: ""; position: absolute; top: 50%; left: 0; right: 0; height: 1px; background: var(--line); }
.or-divider span { position: relative; background: var(--bg); padding: 0 14px; color: var(--muted); font-size: .85rem; }

.ai-banner {
    display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
    background: var(--sky-bg); border: 1px solid var(--sky-border); border-radius: var(--radius);
    padding: 14px 16px; margin-bottom: 20px; font-style: italic; color: var(--ink-soft);
}
.ai-chip { font-style: normal; font-weight: 700; background: var(--brand); color: #fff; padding: 4px 10px; border-radius: 999px; font-size: .75rem; }

/* Features */
.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; padding: 48px 20px; }
.feature h3 { margin: 0 0 8px; font-size: 1.1rem; }
.feature p { margin: 0; color: var(--ink-soft); }

/* Results */
.results-page { padding: 32px 0 64px; }
.filter-bar { display: flex; flex-wrap: wrap; gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 24px; }
.filter-bar select, .filter-bar input { width: auto; flex: 1 1 140px; }
.filter-bar .btn { flex: 0 0 auto; }
.results-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 20px; }
.results-head h1 { font-size: 1.4rem; margin: 0; }

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 22px; display: flex; flex-direction: column; transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease; }
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); border-color: var(--sky-border); }
.card-top { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.badge { font-size: .72rem; font-weight: 700; padding: 4px 9px; border-radius: 999px; text-transform: uppercase; letter-spacing: .03em; }
.badge-full { background: #dcfce7; color: var(--full); }
.badge-partial { background: #fef3c7; color: var(--partial); }
.badge-varies, .badge-light { background: var(--sky-bg); color: var(--brand-dark); }
.card-title { font-size: 1.15rem; margin: 0 0 4px; }
.card-provider { color: var(--muted); font-size: .85rem; margin: 0 0 12px; }
.card-facts { display: flex; gap: 24px; margin: 0 0 12px; }
.card-facts dt { font-size: .7rem; text-transform: uppercase; color: var(--muted); letter-spacing: .04em; }
.card-facts dd { margin: 2px 0 0; font-weight: 600; font-size: .9rem; }
.card-elig { color: var(--ink-soft); font-size: .9rem; margin: 0 0 14px; flex: 1; }
.why-match { background: var(--sky-bg); border-left: 3px solid var(--brand); padding: 10px 12px; border-radius: 8px; font-size: .9rem; margin: 0 0 14px; flex: 1; }
.empty { background: var(--card); border: 1px dashed var(--line); border-radius: var(--radius); padding: 40px; text-align: center; }

/* Detail */
.detail { padding: 28px 0 64px; max-width: 760px; }
.back-link { display: inline-block; margin-bottom: 16px; }
.detail-head h1 { font-size: clamp(1.6rem, 4vw, 2.2rem); margin: 8px 0 4px; }
.detail-provider { color: var(--muted); margin: 0 0 20px; }
.detail-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 16px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 28px; }
.detail-facts > div { display: flex; flex-direction: column; gap: 4px; }
.fact-label { font-size: .72rem; text-transform: uppercase; color: var(--muted); letter-spacing: .04em; }
.fact-value { font-weight: 700; }
.detail-section { margin-bottom: 28px; }
.detail-section h2 { font-size: 1.2rem; border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.detail-cta { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-top: 8px; }
.elig-list { padding-left: 20px; }
.elig-list li { margin-bottom: 6px; }
.tag-cloud { display: flex; flex-wrap: wrap; gap: 8px; }
.tag { background: var(--sky-bg); color: var(--brand-dark); padding: 5px 12px; border-radius: 999px; font-size: .85rem; }

/* Category / browse pages + internal links */
.popular-cats { padding: 8px 20px 8px; }
.popular-cats h2, .related-cats h2, .browse-group h2 { font-size: 1.15rem; margin: 24px 0 14px; }
.cat-links { display: flex; flex-wrap: wrap; gap: 10px; }
.cat-links a {
    background: var(--card); border: 1px solid var(--line); border-radius: 999px;
    padding: 8px 16px; font-size: .92rem; font-weight: 500; color: var(--ink-soft);
    box-shadow: var(--shadow); transition: border-color .15s, color .15s;
}
.cat-links a:hover { border-color: var(--brand); color: var(--brand); text-decoration: none; }
.cat-links .count { background: var(--sky-bg); color: var(--brand-dark); border-radius: 999px; padding: 1px 8px; font-size: .78rem; margin-left: 4px; }
.cat-links .cat-all { background: var(--sky-bg); color: var(--brand-dark); border-color: var(--sky-border); font-weight: 600; }

.category-page, .browse-page { padding: 28px 0 64px; }
.crumbs { font-size: .85rem; color: var(--muted); margin-bottom: 12px; }
.category-page h1, .browse-page h1 { font-size: clamp(1.6rem, 4vw, 2.2rem); margin: 0 0 12px; }
.category-intro { max-width: 760px; color: var(--ink-soft); font-size: 1.05rem; margin-bottom: 24px; }
.lede-sm { max-width: 680px; margin-bottom: 24px; }
.related-cats { margin-top: 40px; border-top: 1px solid var(--line); padding-top: 8px; }
.browse-group { margin-bottom: 28px; }

/* Footer */
.site-footer { border-top: 1px solid var(--line); background: var(--card); margin-top: 56px; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 32px; padding: 48px 20px 36px; }
.footer-brand .brand { font-size: 1.1rem; }
.footer-blurb { color: var(--ink-soft); font-size: .92rem; margin: 14px 0 0; max-width: 340px; }
.footer-col { display: flex; flex-direction: column; }
.footer-col h4 { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 0 0 14px; }
.footer-col a { color: var(--ink-soft); font-size: .92rem; padding: 5px 0; }
.footer-col a:hover { color: var(--brand); }
.footer-bottom { border-top: 1px solid var(--line); }
.footer-bottom-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; padding: 20px; }
.footer-bottom p { margin: 0; font-size: .85rem; }
.footer-bottom .muted { max-width: 560px; }

.static-page { padding: 36px 0 64px; max-width: 720px; }
.static-page h1 { font-size: clamp(1.7rem, 4vw, 2.3rem); margin: 0 0 20px; }
.static-body { color: var(--ink-soft); font-size: 1.05rem; }
.static-body h2 { font-size: 1.2rem; margin: 28px 0 8px; color: var(--ink); }
.static-body p { margin: 0 0 14px; }

/* ---- Admin ---- */
.admin-bar { background: var(--ink); border-top: 3px solid transparent; border-image: var(--grad) 1; }
.admin-bar-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 60px; flex-wrap: wrap; }
.admin-bar .brand-name { color: #fff; font-size: 1rem; }
.admin-bar .brand-name strong { color: var(--sky); }
.admin-tag { background: rgba(255,255,255,.15); color: #fff; font-size: .65rem; padding: 2px 7px; border-radius: 999px; vertical-align: middle; text-transform: uppercase; letter-spacing: .05em; }
.admin-nav { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.admin-nav a { color: #c7cbe8; font-size: .9rem; font-weight: 500; }
.admin-nav a:hover { color: #fff; }
.admin-nav .admin-logout { color: #ffb4b4; }
.admin-main { padding: 28px 20px 80px; }

.admin-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.admin-head h1 { font-size: 1.5rem; margin: 0; }

.admin-login { max-width: 380px; margin: 60px auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 32px; }
.admin-login h1 { margin: 0 0 20px; font-size: 1.4rem; }
.admin-login label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: .9rem; margin-bottom: 16px; }

.admin-alert { border-radius: 10px; padding: 12px 16px; margin: 0 0 20px; font-size: .92rem; }
.admin-alert.ok { background: #dcfce7; color: var(--full); }
.admin-alert.error { background: #fee2e2; color: #b91c1c; }
.admin-alert.warn { background: #fef3c7; color: #92400e; }
.admin-alert.warn ul { margin: 8px 0 0; padding-left: 20px; }
.admin-alert.conf-high { background: #dcfce7; color: var(--full); }
.admin-alert.conf-medium { background: #fef3c7; color: #92400e; }
.admin-alert.conf-low { background: #fee2e2; color: #b91c1c; }

.admin-extract { background: var(--sky-bg); border: 1px solid var(--sky-border); border-radius: var(--radius); padding: 20px; margin-bottom: 24px; }
.admin-extract h2 { margin: 0 0 6px; font-size: 1.1rem; }
.admin-extract-row { display: flex; gap: 10px; margin: 12px 0; }
.admin-extract-row input { flex: 1; }
.admin-extract textarea { width: 100%; font: inherit; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; }
.admin-or { text-align: center; color: var(--muted); margin: 20px 0; }

.admin-table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.admin-table th, .admin-table td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); font-size: .9rem; vertical-align: top; }
.admin-table th { background: var(--sky-bg); font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.admin-table tr:last-child td { border-bottom: none; }
.pill { display: inline-block; font-size: .72rem; font-weight: 700; padding: 3px 9px; border-radius: 999px; }
.pill.ok { background: #dcfce7; color: var(--full); }
.pill.warn { background: #fee2e2; color: #b91c1c; }
.pill.status-published { background: #dcfce7; color: var(--full); }
.pill.status-draft { background: #fef3c7; color: #92400e; }
.pill.status-expired { background: #e5e7eb; color: #6b7280; }

.admin-form fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin: 0 0 20px; background: var(--card); display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.admin-form legend { font-weight: 700; color: var(--brand-dark); padding: 0 8px; }
.legend-note { font-weight: 400; color: var(--muted); font-size: .82rem; }
.admin-form label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: .85rem; color: var(--ink-soft); }
.admin-form label.wide { grid-column: 1 / -1; }
.admin-form textarea { font: inherit; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; resize: vertical; }
.tag-hint { font-weight: 400; color: var(--muted); font-size: .78rem; }
.admin-actions { display: flex; align-items: center; gap: 16px; }

@media (max-width: 640px) {
    .admin-form fieldset { grid-template-columns: 1fr; }
    .admin-extract-row { flex-direction: column; }
}

.error-page { padding: 80px 0; text-align: center; }
.error-page h1 { font-size: 2rem; }

/* Responsive */
@media (max-width: 860px) {
    /* Collapse primary nav into a hamburger dropdown */
    .nav-toggle { display: flex; }
    .site-nav {
        display: none; position: absolute; top: 100%; left: 0; right: 0;
        flex-direction: column; align-items: stretch; gap: 2px;
        background: var(--card); border-bottom: 1px solid var(--line);
        box-shadow: var(--shadow); padding: 10px 16px 16px;
    }
    .site-nav.is-open { display: flex; }
    .site-nav a { padding: 13px 12px; font-size: 1rem; }
    .site-nav .nav-cta { margin: 8px 0 0; text-align: center; }
    .footer-grid { grid-template-columns: 1fr 1fr; gap: 28px; }
    .footer-brand { grid-column: 1 / -1; }
}

@media (max-width: 640px) {
    .finder-card .grid { grid-template-columns: 1fr; }
    .features { grid-template-columns: 1fr; padding: 32px 20px; }
    .header-inner { height: 58px; }
    .footer-grid { grid-template-columns: 1fr; gap: 24px; padding: 36px 20px 28px; }
    .footer-bottom-inner { flex-direction: column; }
    .hero h1 { letter-spacing: -.025em; }
}

/* ---- Redesign polish: detail / results / category page types ---- */
/* Readable measure (~65–68ch) for prose blocks (skill: constrain body text) */
.category-intro, .lede-sm, .static-body p, .detail-section p, .detail-provider { max-width: 68ch; }

/* Facts panel + filter bar become proper elevated surfaces */
.detail-facts { box-shadow: var(--shadow); border-radius: var(--radius-lg); }
.filter-bar { border-radius: var(--radius-lg); box-shadow: var(--shadow); }

/* Detail CTA + eligibility detailing */
.detail-cta .btn-primary { box-shadow: var(--shadow-brand); }
.elig-list li { margin-bottom: 8px; }
.elig-list li::marker { color: var(--brand); }
.detail-section h2, .related-cats h2, .browse-group h2, .popular-cats h2 { letter-spacing: -.015em; }

/* Result/category card titles: color shift on hover instead of underline */
.card-title a { transition: color .15s; }
.card-title a:hover { color: var(--brand); text-decoration: none; }

/* Tags + category chips: smooth, refined */
.tag { transition: background .15s, color .15s; }
.tag:hover { background: var(--sky); color: var(--brand-dark); }
.cat-links a { transition: transform .15s, border-color .15s, color .15s; }
.cat-links a:hover { transform: translateY(-1px); }
.why-match { border-radius: var(--radius-sm); }
.crumbs a { transition: color .15s; }
.crumbs a:hover { color: var(--brand); }
