/* =====================================================================
   Education Foundations Resource Library
   Design system — deep education blue + golden accent, editorial serif
   display (Fraunces) paired with Inter for UI.
   ===================================================================== */

:root {
    /* Blues (structure) */
    --blue-900: #0F2C57;
    --blue-800: #123C7A;
    --blue-700: #14448C;
    --blue-600: #1B5AB0;
    --blue-500: #2E6FD6;
    --blue-050: #EAF1FB;

    /* Gold (single warm accent) */
    --gold-500: #F4B740;
    --gold-600: #E3A21F;
    --gold-100: #FCEFCF;

    /* Ground + ink */
    --ground:   #FBFAF6;
    --surface:  #FFFFFF;
    --ink:      #1A2740;
    --muted:    #5C6B82;
    --line:     #E7E3D8;
    --line-2:   #EFEDE4;

    --focus: #2E6FD6;

    --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
    --font-ui: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

    --radius: 14px;
    --radius-sm: 9px;
    --shadow: 0 1px 2px rgba(15, 44, 87, .04), 0 8px 24px rgba(15, 44, 87, .06);
    --shadow-lg: 0 2px 4px rgba(15, 44, 87, .05), 0 18px 46px rgba(15, 44, 87, .12);

    --container: 1160px;
}

/* ----- Reset-ish ----------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: var(--font-ui);
    color: var(--ink);
    background: var(--ground);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}
img { max-width: 100%; display: block; }
a { color: var(--blue-600); text-decoration: none; }
a:hover { color: var(--blue-800); }

h1, h2, h3 { font-family: var(--font-display); color: var(--blue-900); line-height: 1.12; margin: 0; font-weight: 600; }

.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: 24px; }

.skip-link {
    position: absolute; left: -9999px; top: 0; z-index: 100;
    background: var(--blue-900); color: #fff; padding: 10px 16px; border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; color: #fff; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }

/* ----- Buttons ------------------------------------------------------- */
.btn {
    display: inline-flex; align-items: center; gap: .5rem;
    font-family: var(--font-ui); font-weight: 600; font-size: .95rem;
    padding: .72rem 1.25rem; border-radius: 999px; border: 1.5px solid transparent;
    cursor: pointer; transition: background-color .15s ease, border-color .15s ease, color .15s ease;
    white-space: nowrap;
}
.btn--gold { background: var(--gold-500); color: var(--blue-900); }
.btn--gold:hover { background: var(--gold-600); color: var(--blue-900); }
.btn--blue { background: var(--blue-700); color: #fff; }
.btn--blue:hover { background: var(--blue-800); color: #fff; }
.btn--ghost { background: transparent; color: var(--blue-800); border-color: var(--line); }
.btn--ghost:hover { background: #fff; border-color: var(--blue-500); color: var(--blue-800); }
.btn--lg { padding: .9rem 1.6rem; font-size: 1.02rem; }

/* ----- Header / nav -------------------------------------------------- */
.site-header {
    position: sticky; top: 0; z-index: 40;
    background: rgba(251, 250, 246, .88);
    backdrop-filter: saturate(1.4) blur(8px);
    border-bottom: 1px solid var(--line);
}
.site-header__inner { display: flex; align-items: center; justify-content: space-between; min-height: 76px; gap: 1rem; }

.brand { display: inline-flex; align-items: center; gap: .7rem; color: var(--blue-900); }
.brand:hover { color: var(--blue-900); }
.brand__mark {
    display: grid; place-items: center; width: 42px; height: 42px; flex: none;
    background: var(--blue-800); color: var(--gold-500);
    font-family: var(--font-display); font-weight: 700; font-size: 1.05rem;
    border-radius: 11px; letter-spacing: .01em;
}
.brand__mark--sm { width: 36px; height: 36px; font-size: .9rem; border-radius: 9px; }
.brand__text { display: flex; flex-direction: column; line-height: 1.05; }
.brand__line1 { font-family: var(--font-display); font-weight: 600; font-size: 1.12rem; color: var(--blue-900); }
.brand__line2 { font-family: var(--font-ui); font-weight: 600; font-size: .74rem; letter-spacing: .14em; text-transform: uppercase; color: var(--blue-600); }

.site-nav { display: flex; align-items: center; gap: 1.6rem; }
.site-nav > a { font-weight: 500; color: var(--blue-900); font-size: .96rem; }
.site-nav > a:not(.btn):hover { color: var(--blue-600); }
.site-nav > a[aria-current="page"] { color: var(--blue-600); }

.nav-toggle { display: none; flex-direction: column; gap: 5px; background: none; border: 0; padding: 8px; cursor: pointer; }
.nav-toggle span { width: 24px; height: 2px; background: var(--blue-900); border-radius: 2px; transition: transform .2s ease, opacity .2s ease; }

/* ----- Hero ---------------------------------------------------------- */
.hero { padding: clamp(2.5rem, 6vw, 5rem) 0 clamp(2rem, 4vw, 3rem); }
.hero__eyebrow {
    display: inline-flex; align-items: center; gap: .5rem;
    font-weight: 600; font-size: .82rem; color: var(--blue-700);
    background: var(--blue-050); border: 1px solid #DCE7F8;
    padding: .35rem .8rem; border-radius: 999px; margin-bottom: 1.4rem;
}
.hero__eyebrow::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--gold-500); }
.hero h1 {
    font-size: clamp(2.1rem, 5.2vw, 3.5rem);
    letter-spacing: -0.015em; max-width: 15ch;
}
.hero h1 .warm { color: var(--gold-600); font-style: italic; }
.hero__lead { font-size: clamp(1.05rem, 2vw, 1.22rem); color: var(--muted); max-width: 56ch; margin: 1.2rem 0 1.8rem; }
.hero__actions { display: flex; flex-wrap: wrap; gap: .8rem; align-items: center; }

/* ----- Stage pathway (signature element) ----------------------------- */
.pathway { margin-top: clamp(2.5rem, 5vw, 3.5rem); }
.pathway__head { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: .5rem; margin-bottom: 1.4rem; }
.pathway__head h2 { font-size: 1.5rem; }
.pathway__head p { margin: 0; color: var(--muted); font-size: .98rem; }

.pathway__track {
    display: grid; grid-template-columns: repeat(5, 1fr); gap: 0;
    position: relative;
    counter-reset: stage;
}
/* The connecting progress line runs behind the nodes */
.pathway__track::before {
    content: ""; position: absolute; top: 21px; left: 8%; right: 8%; height: 3px;
    background: linear-gradient(90deg, var(--gold-500), #F6CE7A 60%, var(--line));
    border-radius: 3px; z-index: 0;
}
.stage {
    position: relative; z-index: 1; text-align: center;
    padding: 0 .6rem; color: inherit;
    display: flex; flex-direction: column; align-items: center;
}
.stage__node {
    counter-increment: stage;
    width: 44px; height: 44px; flex: none; display: grid; place-items: center;
    background: var(--surface); border: 3px solid var(--gold-500);
    color: var(--blue-800); font-family: var(--font-display); font-weight: 700; font-size: 1.05rem;
    border-radius: 50%; box-shadow: 0 2px 0 rgba(15,44,87,.05);
    transition: transform .15s ease, border-color .15s ease, background-color .15s ease;
}
.stage__node::before { content: counter(stage); }
.stage__name { margin-top: .8rem; font-weight: 600; font-size: .96rem; color: var(--blue-900); line-height: 1.25; }
.stage__label { margin-top: .3rem; font-size: .82rem; color: var(--muted); line-height: 1.35; }
.stage:hover .stage__node { transform: translateY(-3px); background: var(--gold-100); }
.stage:hover .stage__name { color: var(--blue-600); }

/* ----- Section scaffolding ------------------------------------------ */
.section { padding: clamp(3rem, 6vw, 4.5rem) 0; }
.section--tint { background: var(--surface); border-block: 1px solid var(--line); }
.section__head { max-width: 60ch; margin-bottom: 2.2rem; }
.section__head h2 { font-size: clamp(1.6rem, 3.2vw, 2.1rem); letter-spacing: -0.01em; }
.section__head p { color: var(--muted); font-size: 1.05rem; margin: .8rem 0 0; }

/* ----- Three distinct entry points ---------------------------------- */
.entries { display: grid; grid-template-columns: 1.1fr 1fr 1fr; gap: 1.2rem; }
.entry {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 1.5rem 1.5rem 1.6rem; display: flex; flex-direction: column;
    box-shadow: var(--shadow);
}
.entry__kicker { font-size: .78rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--gold-600); margin-bottom: .55rem; }
.entry h3 { font-size: 1.3rem; margin-bottom: .4rem; }
.entry > p { color: var(--muted); font-size: .96rem; margin: 0 0 1.1rem; }
.entry__body { margin-top: .2rem; }
.entry__foot { margin-top: auto; padding-top: 1.4rem; }
.entry__link { font-weight: 600; color: var(--blue-600); display: inline-flex; align-items: center; gap: .4rem; }
.entry__link:hover { gap: .6rem; color: var(--blue-800); }

/* entry: stage — mini steps */
.ministeps { display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; }
.ministep { font-size: .8rem; font-weight: 600; color: var(--blue-800); background: var(--blue-050); border: 1px solid #DCE7F8; padding: .3rem .55rem; border-radius: 8px; }
.ministep__arrow { color: var(--gold-600); font-weight: 700; }

/* entry: audience — role chips */
.chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.chip {
    font-size: .88rem; font-weight: 600; color: var(--blue-900);
    background: #fff; border: 1.5px solid var(--line); padding: .45rem .8rem; border-radius: 999px;
    transition: border-color .15s ease, background-color .15s ease;
}
.chip:hover { border-color: var(--gold-500); background: var(--gold-100); color: var(--blue-900); }

/* entry: topic — category list */
.catlist { list-style: none; margin: 0; padding: 0; display: grid; gap: .1rem; }
.catlist li { border-top: 1px solid var(--line-2); }
.catlist li:first-child { border-top: 0; }
.catlist a { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .6rem .2rem; color: var(--blue-900); font-weight: 500; font-size: .96rem; }
.catlist a:hover { color: var(--blue-600); }
.catlist .count { font-size: .78rem; font-weight: 600; color: var(--muted); background: var(--ground); border: 1px solid var(--line); border-radius: 999px; padding: .1rem .5rem; }

/* ----- How it works (real 3-step sequence) --------------------------- */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.6rem; counter-reset: step; }
.step { position: relative; padding-top: 3.4rem; }
.step::before {
    counter-increment: step; content: counter(step);
    position: absolute; top: 0; left: 0;
    width: 2.4rem; height: 2.4rem; display: grid; place-items: center;
    font-family: var(--font-display); font-weight: 700; font-size: 1.1rem;
    color: var(--blue-800); background: var(--gold-100); border: 2px solid var(--gold-500); border-radius: 50%;
}
.step h3 { font-size: 1.2rem; margin-bottom: .4rem; }
.step p { color: var(--muted); margin: 0; font-size: .98rem; }

/* ----- Access / CTA band -------------------------------------------- */
.cta-band { background: var(--blue-800); color: #fff; border-radius: var(--radius); padding: clamp(2rem, 4vw, 3rem); box-shadow: var(--shadow-lg); }
.cta-band__grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 2rem; align-items: center; }
.cta-band h2 { color: #fff; font-size: clamp(1.5rem, 3vw, 2rem); }
.cta-band p { color: #CFE0F6; margin: .8rem 0 0; font-size: 1.02rem; max-width: 48ch; }
.cta-band__actions { display: flex; flex-direction: column; gap: .7rem; }
.cta-band .btn--ghost { color: #fff; border-color: rgba(255,255,255,.45); }
.cta-band .btn--ghost:hover { background: rgba(255,255,255,.1); border-color: #fff; color: #fff; }

/* ----- Setup notice (DB not connected) ------------------------------ */
.notice {
    display: flex; gap: .8rem; align-items: flex-start;
    background: var(--gold-100); border: 1px solid #F0D89A; color: #7A5B10;
    padding: .9rem 1.1rem; border-radius: var(--radius-sm); font-size: .92rem; margin-top: 1.5rem;
}
.notice strong { color: #5E4708; }

/* ----- Footer -------------------------------------------------------- */
.site-footer { background: var(--blue-900); color: #C9D6EC; margin-top: 2rem; }
.site-footer__inner { display: flex; justify-content: space-between; gap: 2rem; flex-wrap: wrap; padding-block: 2.6rem; }
.site-footer__brand { display: flex; gap: .8rem; align-items: center; }
.site-footer__brand .brand__mark { background: #16376E; }
.site-footer__name { font-family: var(--font-display); color: #fff; font-weight: 600; margin: 0 0 .2rem; font-size: 1.05rem; }
.site-footer__note { margin: 0; font-size: .9rem; color: #9FB2D4; max-width: 42ch; }
.site-footer__links { display: flex; gap: 1.6rem; align-items: center; }
.site-footer__links a { color: #C9D6EC; font-weight: 500; font-size: .95rem; }
.site-footer__links a:hover { color: #fff; }
.site-footer__base { border-top: 1px solid #1C3B6E; padding-block: 1.2rem; }
.site-footer__base p { margin: 0; font-size: .85rem; color: #7F93B8; }

/* ----- Login (stub page) -------------------------------------------- */
.auth-wrap { max-width: 420px; margin: clamp(2rem, 6vw, 4.5rem) auto; }
.auth-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 2rem; }
.auth-card h1 { font-size: 1.6rem; margin-bottom: .4rem; }
.auth-card > p { color: var(--muted); margin: 0 0 1.5rem; font-size: .96rem; }
.field { margin-bottom: 1.1rem; }
.field label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: .35rem; color: var(--blue-900); }
.field input { width: 100%; padding: .7rem .85rem; border: 1.5px solid var(--line); border-radius: var(--radius-sm); font: inherit; color: var(--ink); background: #fff; }
.field input:focus { border-color: var(--blue-500); outline: none; box-shadow: 0 0 0 3px rgba(46,111,214,.15); }

/* ----- Library page bits -------------------------------------------- */
.page-head { padding: clamp(2rem, 5vw, 3rem) 0 1rem; }
.page-head h1 { font-size: clamp(1.9rem, 4vw, 2.6rem); letter-spacing: -0.01em; }
.page-head p { color: var(--muted); font-size: 1.08rem; max-width: 60ch; margin: .8rem 0 0; }
.empty-state { text-align: center; max-width: 46ch; margin: 2rem auto clamp(3rem,7vw,5rem); }
.empty-state__mark { width: 64px; height: 64px; margin: 0 auto 1.2rem; display: grid; place-items: center; background: var(--gold-100); border: 2px solid var(--gold-500); border-radius: 16px; color: var(--gold-600); font-family: var(--font-display); font-weight: 700; font-size: 1.6rem; }
.empty-state h2 { font-size: 1.4rem; margin-bottom: .5rem; }
.empty-state p { color: var(--muted); margin: 0 0 1.4rem; }

.filterbar { display: flex; flex-wrap: wrap; gap: .5rem; padding-block: 1.4rem; border-block: 1px solid var(--line); margin-bottom: 1.5rem; }
.filterbar .chip { cursor: default; }

/* =====================================================================
   Admin area
   ===================================================================== */
.btn--sm { padding: .45rem .85rem; font-size: .86rem; }

.admin { background: var(--ground); }

.admin-container { padding-block: clamp(2rem, 5vw, 3rem) 4rem; }

/* Hero-style dashboard intro, matching the public home */
.admin-hero { margin-bottom: 2.2rem; }
.admin-hero h1 { font-size: clamp(2rem, 4vw, 2.9rem); letter-spacing: -0.02em; margin: .7rem 0 .5rem; }
.admin-hero p { color: var(--muted); max-width: 62ch; margin: 0; font-size: 1.02rem; }

.admin-main { padding: 0; }

.admin-head { margin-bottom: 1.8rem; }
.admin-head h1 { font-size: 1.9rem; letter-spacing: -0.01em; }
.admin-head p { color: var(--muted); margin: .5rem 0 0; }
.admin-head--row { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.crumb { font-size: .86rem; color: var(--muted); margin: 0 0 .4rem; }
.crumb a { font-weight: 600; }

.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-bottom: 1.8rem; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.3rem 1.4rem; box-shadow: var(--shadow); }
.stat__num { display: block; font-family: var(--font-display); font-weight: 700; font-size: 2.1rem; color: var(--blue-800); line-height: 1; }
.stat__label { display: block; margin-top: .35rem; font-size: .85rem; font-weight: 600; color: var(--muted); }

.admin-cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.2rem; }
.admin-card { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.6rem; box-shadow: var(--shadow); color: var(--ink); }
.admin-card:hover { color: var(--ink); border-color: var(--blue-500); box-shadow: var(--shadow-lg); }
.admin-card .entry__kicker { display: block; margin-bottom: .5rem; }
.admin-card h2 { font-size: 1.35rem; margin-bottom: .4rem; }
.admin-card p { color: var(--muted); margin: 0 0 1rem; font-size: .96rem; }
.admin-card__link { font-weight: 600; color: var(--blue-600); }
.admin-card:hover .admin-card__link { color: var(--blue-800); }
.admin-card--muted { opacity: .72; }
.admin-card--muted:hover { border-color: var(--line); box-shadow: var(--shadow); }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.panel--empty { padding: 2.5rem; text-align: center; }
.panel--empty p { color: var(--muted); margin: 0 0 1.2rem; }
.panel--form { padding: 1.8rem; }

.table { width: 100%; border-collapse: collapse; font-size: .93rem; }
.table th, .table td { text-align: left; padding: .85rem 1.1rem; border-top: 1px solid var(--line-2); vertical-align: middle; }
.table thead th { border-top: 0; background: #FBFCFE; font-size: .76rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.table tbody tr:hover { background: #FAFBFD; }
.muted { color: var(--muted); }

.pill { display: inline-block; font-size: .76rem; font-weight: 600; padding: .18rem .55rem; border-radius: 999px; }
.pill--on { background: #E4F3EA; color: #1C7A46; }
.pill--off { background: #F1E5E5; color: #9A3B3B; }

/* Admin forms */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem; }
.panel--form .field { margin-bottom: 1.2rem; }
.panel--form label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: .35rem; color: var(--blue-900); }
.panel--form input[type=text], .panel--form input[type=email], .panel--form input[type=password], .panel--form select {
    width: 100%; padding: .68rem .8rem; border: 1.5px solid var(--line); border-radius: var(--radius-sm);
    font: inherit; color: var(--ink); background: #fff;
}
.panel--form input:focus, .panel--form select:focus { border-color: var(--blue-500); outline: none; box-shadow: 0 0 0 3px rgba(46,111,214,.15); }
.field .opt { font-weight: 400; color: var(--muted); }
.field-hint { display: block; margin-top: .35rem; font-size: .82rem; color: var(--muted); }
.field-error { display: block; margin-top: .35rem; font-size: .84rem; font-weight: 600; color: #9A3B3B; }
.field--check label { display: flex; align-items: center; gap: .55rem; font-weight: 500; color: var(--ink); }
.field--check input { width: 1.05rem; height: 1.05rem; }
.form-actions { display: flex; gap: .7rem; margin-top: .6rem; }

/* Flash messages */
.flash { padding: .8rem 1.1rem; border-radius: var(--radius-sm); font-size: .93rem; margin-bottom: 1.3rem; border: 1px solid transparent; }
.flash--success { background: #E4F3EA; border-color: #BFE3CD; color: #1C6A3E; }
.flash--error { background: #F7E7E7; border-color: #E6C3C3; color: #9A3B3B; }

@media (max-width: 760px) {
    .stat-grid { grid-template-columns: 1fr; }
    .admin-cards { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .admin-nav { gap: 1rem; font-size: .9rem; }
    .admin-user__name, .admin-user__role { display: none; }
    .table { font-size: .86rem; }
    .table th, .table td { padding: .7rem .7rem; }
}

/* ----- Motion / responsive ------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
    * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

@media (max-width: 900px) {
    .entries { grid-template-columns: 1fr; }
    .steps { grid-template-columns: 1fr; gap: 1.2rem; }
    .cta-band__grid { grid-template-columns: 1fr; }
    .pathway__track { grid-template-columns: repeat(2, 1fr); gap: 1.4rem 1rem; }
    .pathway__track::before { display: none; }
    .stage { flex-direction: row; text-align: left; gap: .9rem; align-items: flex-start; }
    .stage__name { margin-top: 0; }
    .stage__label { margin-top: .2rem; }
}

@media (max-width: 760px) {
    .nav-toggle { display: flex; }
    .site-nav {
        position: absolute; top: 76px; left: 0; right: 0;
        flex-direction: column; align-items: stretch; gap: 0;
        background: var(--ground); border-bottom: 1px solid var(--line);
        padding: .5rem 24px 1rem; display: none;
    }
    .site-nav.is-open { display: flex; }
    .site-nav > a { padding: .8rem 0; border-top: 1px solid var(--line-2); }
    .site-nav > a.btn { margin-top: .7rem; justify-content: center; }
    .site-footer__inner { flex-direction: column; gap: 1.4rem; }
}

@media (max-width: 480px) {
    .pathway__track { grid-template-columns: 1fr; }
    .hero__actions .btn { width: 100%; justify-content: center; }
}

/* Signed-in indicator in the public header */
.nav-user { font-size: .92rem; color: var(--muted); font-weight: 500; }
@media (max-width: 760px) { .nav-user { padding: .4rem 0; } }

/* =====================================================================
   Library listing + resource detail
   ===================================================================== */
.library { padding-bottom: clamp(3rem, 6vw, 5rem); }

.lib-search { display: flex; gap: .6rem; margin: 1.4rem 0 1.2rem; }
.lib-search input[type=search] {
    flex: 1; padding: .7rem .9rem; border: 1.5px solid var(--line);
    border-radius: 999px; font: inherit; color: var(--ink); background: #fff;
}
.lib-search input[type=search]:focus { border-color: var(--blue-500); outline: none; box-shadow: 0 0 0 3px rgba(46,111,214,.15); }

.lib-filters { display: grid; gap: .7rem; padding: 1.2rem 0 .4rem; border-top: 1px solid var(--line); }
.filter-group { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.filter-group__label { font-size: .72rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); width: 78px; flex: none; }
.chip--on { background: var(--blue-800); border-color: var(--blue-800); color: #fff; }
.chip--on:hover { background: var(--blue-900); border-color: var(--blue-900); color: #fff; }

.lib-summary { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin: 1.4rem 0 1rem; padding-top: 1.2rem; border-top: 1px solid var(--line); }
.lib-summary span { color: var(--muted); }
.lib-summary strong { color: var(--blue-900); font-size: 1.05rem; }
.lib-clear { font-weight: 600; font-size: .92rem; }

.rcards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.2rem; }
.rcard {
    display: flex; flex-direction: column; background: var(--surface);
    border: 1px solid var(--line); border-radius: var(--radius); padding: 1.3rem;
    box-shadow: var(--shadow); transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.rcard:hover { border-color: var(--blue-500); box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.rcard__top { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .7rem; }
.rcard__cat { font-size: .7rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--gold-600); }
.rcard__level { font-size: .72rem; font-weight: 600; color: var(--muted); background: var(--ground); border: 1px solid var(--line); border-radius: 999px; padding: .12rem .55rem; }
.rcard__title { font-size: 1.12rem; line-height: 1.25; margin: 0 0 .35rem; }
.rcard__title a { color: var(--blue-900); }
.rcard__title a:hover { color: var(--blue-600); }
.rcard__pub { font-size: .84rem; color: var(--muted); margin: 0 0 .6rem; font-weight: 500; }
.rcard__desc { font-size: .92rem; color: var(--ink); margin: 0 0 1.1rem; line-height: 1.5; }
.rcard__foot { margin-top: auto; display: flex; align-items: baseline; justify-content: space-between; gap: .6rem; padding-top: .6rem; border-top: 1px solid var(--line-2); }
.rcard__link { font-weight: 600; font-size: .9rem; color: var(--blue-600); white-space: nowrap; }
.rcard__link:hover { color: var(--blue-800); }
.rcard__types { font-size: .74rem; color: var(--muted); text-align: right; }

.pager { display: flex; align-items: center; justify-content: center; gap: 1.2rem; margin-top: 2.5rem; }
.pager__status { font-size: .92rem; color: var(--muted); }
.btn.is-disabled { opacity: .45; cursor: default; }

/* Resource detail */
.resource { padding-block: clamp(1.5rem, 4vw, 2.5rem) clamp(3rem, 6vw, 5rem); }
.resource__grid { display: grid; grid-template-columns: 1fr 300px; gap: 2.5rem; align-items: start; }
.resource__title { font-size: clamp(1.7rem, 3.5vw, 2.5rem); letter-spacing: -0.01em; }
.resource__pub { color: var(--muted); font-weight: 500; margin: .6rem 0 0; }
.resource__desc { font-size: 1.12rem; line-height: 1.65; color: var(--ink); margin: 1.4rem 0 0; }
.resource__h { font-size: 1.2rem; margin: 1.8rem 0 .5rem; }
.resource__actions { display: flex; flex-wrap: wrap; gap: .7rem; margin-top: 2rem; }
.resource__facts { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.3rem 1.4rem; position: sticky; top: 96px; }
.fact { padding: .7rem 0; border-top: 1px solid var(--line-2); }
.fact:first-child { border-top: 0; padding-top: 0; }
.fact__k { display: block; font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: .2rem; }
.fact__v { color: var(--blue-900); font-weight: 500; font-size: .95rem; }

@media (max-width: 900px) {
    .rcards { grid-template-columns: repeat(2, 1fr); }
    .resource__grid { grid-template-columns: 1fr; gap: 1.6rem; }
    .resource__facts { position: static; }
}
@media (max-width: 560px) {
    .rcards { grid-template-columns: 1fr; }
    .filter-group__label { width: 100%; }
}

/* =====================================================================
   Admin: resource management
   ===================================================================== */
.row--off td { opacity: .55; }
.row-actions { white-space: nowrap; text-align: right; }
.row-actions a, .row-actions .linkbtn { font-weight: 600; font-size: .86rem; color: var(--blue-600); margin-left: .8rem; }
.row-actions a:hover, .row-actions .linkbtn:hover { color: var(--blue-800); }
.linkbtn { background: none; border: 0; padding: 0; cursor: pointer; font-family: inherit; }
.pill + .pill, td .pill { margin-left: .4rem; }
.table td .pill--off { font-size: .68rem; }

.rform { display: grid; gap: 1.3rem; }
.rform__h { font-size: 1.1rem; margin: 0 0 1.1rem; padding-bottom: .6rem; border-bottom: 1px solid var(--line-2); }
.panel--form textarea { width: 100%; padding: .68rem .8rem; border: 1.5px solid var(--line); border-radius: var(--radius-sm); font: inherit; color: var(--ink); background: #fff; resize: vertical; }
.panel--form textarea:focus { border-color: var(--blue-500); outline: none; box-shadow: 0 0 0 3px rgba(46,111,214,.15); }
.inline-radio { display: inline-flex; align-items: center; gap: .4rem; font-weight: 500 !important; margin-right: 1.2rem; }
.inline-radio input { width: auto; }

.cbset { border: 1px solid var(--line-2); border-radius: var(--radius-sm); padding: .9rem 1.1rem 1.1rem; margin: 0 0 1.1rem; }
.cbset legend { font-size: .78rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 0 .4rem; }
.cbgrid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .5rem 1.2rem; }
.cbgrid--3 { grid-template-columns: repeat(3, 1fr); }
.cbcols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.1rem; }
.cbcols .cbset { margin: 0; }
.cb { display: flex; align-items: center; gap: .5rem; font-size: .92rem; font-weight: 500; color: var(--ink); }
.cb input { width: 1rem; height: 1rem; flex: none; }

@media (max-width: 760px) {
    .cbgrid, .cbgrid--3, .cbcols { grid-template-columns: 1fr; }
}
