/* Shared visual theme + NewCatalogList's full page structure (appbar, hero, rails/pager,
   card-layout tweaks) — consolidated here so there's a single stylesheet instead of splitting
   the shared card/theme rules from the page-specific ones. Catalog.razor only uses the shared
   card/theme portion; NewCatalogList.razor uses all of it. Link this file directly from any
   page that wants the look; it's scoped in practice because Blazor adds/removes the <link> tag
   with the page component that rendered it. */

:root {
    --ink: #1a2433;
    --ink-soft: #4a5566;
    --ink-faint: #8893a4;
    --paper: #ffffff;
    --paper-2: #f4f6fa;
    --rule: #dde3ec;
    --accent: #1f4e8c;
    --accent-deep: #143862;
    --accent-soft: #dbe6f4;
    --display: 'Roboto', system-ui, -apple-system, sans-serif;
    --sans: 'Roboto', system-ui, -apple-system, sans-serif;
    --label: 'Montserrat', 'Roboto', system-ui, sans-serif;
    --hero-grad-1: var(--accent);
    --hero-grad-2: var(--accent-deep);
    --hero-eyebrow: #9fc0ec;
    --hero-em: #FBC611;
    --hero-cta: #FBC611;
    --hero-cta-text: #143862;
    --hero-text: #fff;
    --hero-text-soft: rgba(255,255,255,0.78);
    --hero-text-meta: rgba(255,255,255,0.65);
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--sans);
    color: var(--ink);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    background: var(--paper);
}

/* ---------- empty state ---------- */
.empty {
    text-align: center;
    padding: 80px 20px;
    color: var(--ink-faint);
    border: 1.5px dashed var(--rule);
    border-radius: 12px;
    margin: 24px 0;
    background: var(--paper-2);
}

.empty h3 {
    font-family: var(--display);
    font-weight: 700;
    font-size: 24px;
    letter-spacing: -0.02em;
    color: var(--ink);
    margin: 0 0 8px;
}

.empty p {
    margin: 0 0 16px;
}

/* ---------- card ---------- */
/* .card / .card-body / .card-title also exist as Bootstrap's own card component classes, and
   Bootstrap loads globally in this app — the doubled selector (.card.card etc.) bumps
   specificity just enough to win the conflicting properties without renaming anything. */
.card.card {
    background: #fff;
    border: 1px solid var(--ink);
    border-radius: 10px;
    padding: 0;
    display: flex;
    flex-direction: column;
    min-height: 360px;
    cursor: pointer;
    transition: transform 140ms ease, box-shadow 140ms ease;
    position: relative;
    overflow: hidden;
}

.card-media {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: var(--accent-soft);
    overflow: hidden;
    border-bottom: 1px solid var(--ink);
    flex-shrink: 0;
}

.card-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 320ms ease;
}

.card:hover .card-media img {
    transform: scale(1.03);
}

.card-media-fallback {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    background: repeating-linear-gradient(135deg, rgba(0,0,0,0.04) 0 10px, transparent 10px 20px), var(--accent-soft);
    color: var(--accent-deep);
    font-family: var(--display);
    font-weight: 700;
    letter-spacing: -0.01em;
    text-align: center;
    padding: 12px;
    font-size: 14px;
    line-height: 1.3;
}

.card-media-fallback small {
    display: block;
    font-family: var(--label);
    font-weight: 600;
    font-size: 10px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    opacity: 0.75;
    margin-bottom: 6px;
}

.card-body.card-body {
    padding: 18px 20px 20px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.card:hover {
    transform: translate(-2px, -2px);
    box-shadow: 4px 4px 0 var(--ink);
}

.card:hover .card-cta {
    color: #c89800;
}

.card:hover .card-cta .arrow {
    transform: translateX(3px);
}

.card-acronym {
    position: absolute;
    top: 12px;
    right: 12px;
    font-family: var(--label);
    font-weight: 700;
    font-size: 10px;
    letter-spacing: 0.1em;
    color: #fff;
    background: rgba(20, 36, 51, 0.85);
    backdrop-filter: blur(4px);
    text-transform: uppercase;
    border-radius: 999px;
    padding: 5px 11px;
    white-space: nowrap;
    z-index: 2;
}

.card-title.card-title {
    font-family: var(--display);
    font-weight: 700;
    font-size: 18px;
    line-height: 1.25;
    letter-spacing: -0.015em;
    color: var(--ink);
    margin: 0 0 8px;
}

.card-desc {
    color: var(--ink-soft);
    font-size: 14px;
    line-height: 1.5;
    margin: 0;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-foot {
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px dashed var(--rule);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
}

.card-sub {
    color: var(--ink-faint);
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-cta {
    color: #FBC611;
    font-weight: 600;
    font-size: 13px;
    letter-spacing: 0.01em;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    transition: color 120ms;
}

.card-cta .arrow {
    display: inline-block;
    transition: transform 160ms ease;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    font: inherit;
    cursor: pointer;
}

/* ---------- top app bar (matches Razor app chrome) ---------- */
.appbar {
    background: #fff;
/*    box-shadow: 0 1px 0 rgba(20, 56, 98, 0.04);*/
    padding: 12px 32px;
    display: flex;
    align-items: center;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 50;
}

    .appbar .logo {
        width: 40px;
        height: 40px;
        display: grid;
        place-items: center;
        flex-shrink: 0;
    }

        .appbar .logo img {
            max-width: 100%;
            max-height: 100%;
            object-fit: contain;
            display: block;
        }
        /* placeholder if image fails to load */
        .appbar .logo.broken {
            background: var(--accent);
            color: #fff;
            border-radius: 50%;
            font-family: var(--display);
            font-weight: 900;
            font-size: 14px;
        }

            .appbar .logo.broken::before {
                content: "R1";
            }

    .appbar .brand {
        font-family: var(--display);
        font-weight: 700;
        font-size: 16px;
        letter-spacing: -0.01em;
    }

        .appbar .brand small {
            display: block;
            font-family: var(--label);
            font-weight: 600;
            font-size: 10px;
            color: var(--ink-faint);
            letter-spacing: 0.12em;
            text-transform: uppercase;
            margin-top: 2px;
        }

    .appbar nav {
        margin-left: 24px;
        display: flex;
        gap: 4px;
    }

        .appbar nav a {
            padding: 7px 12px;
            border-radius: 6px;
            font-size: 14px;
            color: var(--ink-soft);
            font-weight: 500;
        }

            .appbar nav a:hover {
                background: var(--paper-2);
                color: var(--ink);
            }

            .appbar nav a.on {
                background: var(--ink);
                color: #fff;
            }

    .appbar .spacer {
        flex: 1;
    }

    .appbar .iconbtn {
        width: 36px;
        height: 36px;
        border-radius: 50%;
        border: 1px solid var(--rule);
        background: #fff;
        display: grid;
        place-items: center;
        color: var(--ink-soft);
    }

        .appbar .iconbtn:hover {
            color: var(--ink);
            border-color: var(--ink);
        }

        .appbar .iconbtn .badge {
            position: absolute;
            margin-top: -22px;
            margin-left: 14px;
            background: var(--accent);
            color: #fff;
            font-size: 10px;
            font-weight: 700;
            border-radius: 999px;
            padding: 0 5px;
            min-width: 16px;
            text-align: center;
            line-height: 16px;
        }

/* ---------- page frame ---------- */
.page {
    max-width: 1320px;
    margin: 0 auto;
    padding: 25px 25px 80px;
}

/* ---------- hero ---------- */
.hero {
    display: grid;
    grid-template-columns: 1.05fr 0.95fr;
    gap: 56px;
    align-items: end;
    padding: 56px 56px 48px;
    margin-bottom: 48px;
    background: radial-gradient(120% 100% at 100% 0%, rgba(255,255,255,0.06), transparent 55%), linear-gradient(180deg, var(--hero-grad-1) 0%, var(--hero-grad-2) 100%);
    border-radius: 16px;
    color: var(--hero-text);
    box-shadow: 0 1px 0 rgba(20, 56, 98, 0.08);
    position: relative;
    overflow: hidden;
}
    /* subtle diagonal sheen */
    .hero::before {
        content: "";
        position: absolute;
        inset: 0;
        background-image: repeating-linear-gradient(135deg, rgba(255,255,255,0.025) 0 1px, transparent 1px 48px);
        pointer-events: none;
    }

    .hero > * {
        position: relative;
    }

    .hero .eyebrow {
        font-family: var(--label);
        font-size: 11px;
        letter-spacing: 0.18em;
        text-transform: uppercase;
        color: var(--hero-eyebrow);
        font-weight: 800;
        margin-bottom: 14px;
    }

    .hero h1 {
        font-family: var(--display);
        font-weight: 900;
        font-size: clamp(40px, 5.4vw, 64px);
        line-height: 1;
        letter-spacing: -0.025em;
        margin: 0 0 16px;
        color: var(--hero-text);
    }

        .hero h1 em {
            font-style: normal;
            color: var(--hero-em);
            font-weight: 900;
        }

    .hero p {
        margin: 0;
        font-size: 16px;
        color: var(--hero-text-soft);
        max-width: 480px;
        line-height: 1.55;
    }

        .hero p strong, .hero #totalServices {
            color: var(--hero-text);
            font-weight: 600;
        }

    .hero .controls {
        display: flex;
        flex-direction: column;
        gap: 16px;
    }
    /* search & pills sit ON navy — give them light treatment */
    .hero .search {
        border-color: transparent;
        box-shadow: 0 2px 0 rgba(0,0,0,0.18);
    }

        .hero .search:focus-within {
            box-shadow: 0 0 0 3px rgba(240, 199, 90, 0.45);
        }

        .hero .search button.go {
            background: var(--hero-cta);
            color: var(--hero-cta-text);
        }

            .hero .search button.go:hover {
                background: var(--hero-text);
                color: var(--hero-cta-text);
            }

    .hero .pill {
        background: rgba(255,255,255,0.08);
        border-color: rgba(255,255,255,0.4);
        color: rgba(255,255,255,0.92);
    }

        .hero .pill:hover {
            background: rgba(255,255,255,0.18);
            border-color: rgba(255,255,255,0.7);
        }

        .hero .pill.on {
            background: var(--hero-cta);
            color: var(--hero-cta-text);
            border-color: var(--hero-cta);
        }

    .hero .meta-row {
        color: var(--hero-text-meta);
    }

        .hero .meta-row strong {
            color: var(--hero-text);
        }

.search {
    display: flex;
    background: #fff;
    border: 1px solid var(--ink);
    border-radius: 999px;
    overflow: hidden;
    box-shadow: 3px 3px 0 var(--ink);
    transition: box-shadow 120ms, transform 120ms;
}

    .search:focus-within {
        box-shadow: 4px 4px 0 var(--accent);
    }

    .search svg {
        color: var(--ink-faint);
    }

    .search .icon {
        display: grid;
        place-items: center;
        padding-left: 18px;
    }

    .search input {
        flex: 1;
        border: 0;
        background: transparent;
        padding: 14px 16px;
        font: inherit;
        font-size: 15px;
        color: var(--ink);
        outline: none;
    }

        .search input::placeholder {
            color: var(--ink-faint);
        }

    .search .clear {
        background: transparent;
        border: 0;
        color: var(--ink-faint);
        padding: 0 10px;
        display: none;
    }

    .search.has-text .clear {
        display: grid;
        place-items: center;
    }

    .search button.go {
        background: var(--ink);
        color: #fff;
        border: 0;
        padding: 0 22px;
        font-weight: 600;
        font-size: 14px;
        letter-spacing: 0.02em;
    }

        .search button.go:hover {
            background: var(--accent);
        }

.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.pill {
    background: transparent;
    border: 1px solid var(--ink);
    color: var(--ink);
    border-radius: 999px;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 500;
    transition: background 120ms, color 120ms, border-color 120ms;
}

    .pill:hover {
        background: var(--paper-2);
    }

    .pill.on {
        background: var(--ink);
        color: var(--paper);
        border-color: var(--ink);
    }

.meta-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: var(--ink-faint);
}

    .meta-row strong {
        color: var(--ink);
        font-weight: 600;
    }

/* Cards/List toggle sits on the dark hero banner — Radzen's default SelectBar
   colors are tuned for a light background and are barely legible here, so they're
   overridden just within .hero. */
.hero .rz-selectbar .rz-button {
    background-color: rgba(255, 255, 255, 0.08);
    color: var(--hero-text-soft);
}

    .hero .rz-selectbar .rz-button:not(.rz-state-active):not(.rz-state-disabled):hover {
        background-color: rgba(255, 255, 255, 0.16);
        color: var(--hero-text);
    }

    .hero .rz-selectbar .rz-button.rz-state-active {
        background-color: var(--hero-cta);
        color: var(--hero-cta-text);
    }

/* .empty lives in css/catalog-theme.css */

/* ---------- rails ---------- */
.rail {
    margin-bottom: 64px;
    scroll-margin-top: 80px;
}

.rail-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 8px;
    padding-bottom: 12px;
    border-bottom: 2px solid #C90000;
}

    .rail-head h2 {
        font-family: var(--display);
        font-weight: 700;
        font-size: 26px;
        line-height: 1.15;
        letter-spacing: -0.02em;
        margin: 0;
        color: var(--ink);
        display: flex;
        align-items: baseline;
        gap: 14px;
        flex-wrap: wrap;
    }

        .rail-head h2 .count {
            font-family: var(--label);
            font-weight: 600;
            font-size: 10px;
            color: var(--ink-faint);
            letter-spacing: 0.12em;
            text-transform: uppercase;
            border: 1px solid var(--rule);
            border-radius: 999px;
            padding: 4px 10px;
            position: relative;
            top: -2px;
        }

    .rail-head .see-all {
        font-size: 14px;
        color: var(--accent);
        font-weight: 600;
        white-space: nowrap;
        display: inline-flex;
        align-items: center;
        gap: 4px;
    }

        .rail-head .see-all:hover {
            color: var(--accent-deep);
        }

.rail-sub {
    color: var(--ink-soft);
    font-size: 15px;
    margin: 0 0 24px;
    max-width: 720px;
}

.rail-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

/* .card / .card-media / .card-body / .card-title / .card-desc / .card-foot / .card-cta /
   .card-acronym live in css/catalog-theme.css */

/* ---------- per-rail pager ---------- */
.rail-foot {
    margin-top: 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.pager {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--ink-faint);
}

    .pager .pg {
        width: 32px;
        height: 32px;
        border-radius: 50%;
        border: 1px solid var(--rule);
        background: #fff;
        color: var(--ink);
        display: grid;
        place-items: center;
        font-size: 13px;
        font-weight: 500;
    }

        .pager .pg:hover {
            border-color: var(--ink);
        }

        .pager .pg:disabled {
            opacity: 0.35;
            cursor: not-allowed;
        }

    .pager .dots {
        display: flex;
        align-items: center;
        flex-wrap: wrap;
        gap: 4px;
        margin: 0 6px;
        max-width: min(420px, 55vw);
    }

    .pager .dot {
        width: 22px;
        height: 4px;
        border-radius: 2px;
        background: var(--rule);
        border: 0;
        padding: 0;
        flex-shrink: 0;
    }

        .pager .dot.on {
            background: var(--ink);
        }

    /* Was 4px tall with an 11px glyph inside — the "···" poked out above its own box.
       Sized to actually fit its text and centered with the dots via .dots' align-items. */
    .pager .dot-ellipsis {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 18px;
        height: 11px;
        font-size: 11px;
        line-height: 1;
        color: var(--ink-faint);
        letter-spacing: -1px;
        flex-shrink: 0;
    }

/* Footer markup/CSS moved to FooterComponent.razor + FooterComponent.razor.css —
   this page no longer renders its own <footer>, MainLayout appends the shared one. */

@media (max-width: 1080px) {
    .rail-row {
        grid-template-columns: repeat(2, 1fr);
    }

    .hero {
        grid-template-columns: 1fr;
        gap: 32px;
        align-items: stretch;
        padding: 40px 36px;
    }
}

@media (max-width: 640px) {
    .appbar nav {
        display: none;
    }

    .rail-row {
        grid-template-columns: 1fr;
    }

    .page {
        padding: 28px 18px 60px;
    }

    .hero {
        padding: 32px 24px;
        border-radius: 12px;
    }
}

/* ============================================================
   TWEAKS — palette variants (mood)
   ============================================================ */
/* "navy"  → defaults in :root */

body[data-palette="scholarly"] {
    --ink: #1f1a14;
    --ink-soft: #4a3f30;
    --ink-faint: #948770;
    --paper: #f6f3ec;
    --paper-2: #efeadd;
    --rule: #d9d3c4;
    --accent: #c8623a;
    --accent-deep: #8a3e1f;
    --accent-soft: #f0d9cc;
    --hero-grad-1: #c8623a;
    --hero-grad-2: #8a3e1f;
    --hero-eyebrow: #f1d29a;
    --hero-em: #f6e7c8;
    --hero-cta: #f6f3ec;
    --hero-cta-text: #8a3e1f;
}

body[data-palette="crisp"] {
    --ink: #0a0a0a;
    --ink-soft: #3a3a3a;
    --ink-faint: #888;
    --paper: #fafafa;
    --paper-2: #f0f0f0;
    --rule: #d4d4d4;
    --accent: #d63d1f;
    --accent-deep: #a92c12;
    --accent-soft: #fbe0d9;
    --hero-grad-1: #0a0a0a;
    --hero-grad-2: #2a2a2a;
    --hero-eyebrow: #d63d1f;
    --hero-em: #d63d1f;
    --hero-cta: #d63d1f;
    --hero-cta-text: #fff;
}

/* ============================================================
   TWEAKS — hero treatment
   ============================================================ */
/* "panel" → defaults already applied to .hero */

body[data-hero="open"] .hero {
    padding: 12px 0 36px;
    margin-bottom: 36px;
    background: none;
    box-shadow: none;
    border-radius: 0;
    border-bottom: 1px solid var(--rule);
    color: var(--ink);
}

    body[data-hero="open"] .hero::before {
        display: none;
    }

    body[data-hero="open"] .hero .eyebrow {
        color: var(--accent);
    }

    body[data-hero="open"] .hero h1 {
        color: var(--ink);
    }

        body[data-hero="open"] .hero h1 em {
            color: var(--accent-deep);
        }

    body[data-hero="open"] .hero p {
        color: var(--ink-soft);
    }

        body[data-hero="open"] .hero p strong,
        body[data-hero="open"] .hero #totalServices {
            color: var(--ink);
        }

    body[data-hero="open"] .hero .meta-row {
        color: var(--ink-faint);
    }

        body[data-hero="open"] .hero .meta-row strong {
            color: var(--ink);
        }

    body[data-hero="open"] .hero .search {
        border-color: var(--ink);
        box-shadow: 3px 3px 0 var(--ink);
    }

        body[data-hero="open"] .hero .search:focus-within {
            box-shadow: 4px 4px 0 var(--accent);
        }

        body[data-hero="open"] .hero .search button.go {
            background: var(--ink);
            color: var(--paper);
        }

            body[data-hero="open"] .hero .search button.go:hover {
                background: var(--accent);
            }

    body[data-hero="open"] .hero .pill {
        background: transparent;
        border-color: var(--ink);
        color: var(--ink);
    }

        body[data-hero="open"] .hero .pill:hover {
            background: var(--paper-2);
        }

        body[data-hero="open"] .hero .pill.on {
            background: var(--ink);
            color: var(--paper);
            border-color: var(--ink);
        }

/* ============================================================
   Cards / List view toggle (CatalogViewToggle component sets the
   "catalog-list-view" class on the page's <main> — no JS involved,
   this is a pure CSS re-skin of the same rail/card markup)
   ============================================================ */
.catalog-list-view .card {
    min-height: 0;
    background: transparent;
    border: 0;
    border-top: 1px solid var(--rule);
    border-radius: 0;
    padding: 0;
}

    .catalog-list-view .card:first-child {
        border-top: 1.5px solid var(--ink);
    }

.catalog-list-view .rail-row {
    grid-template-columns: 1fr;
    gap: 0;
}

.catalog-list-view .card-media {
    position: static;
    aspect-ratio: auto;
    height: 0;
    background: transparent;
    border: 0;
    overflow: visible;
}

    .catalog-list-view .card-media img,
    .catalog-list-view .card-media-fallback {
        display: none !important;
    }

/* Acronym badge is normally positioned relative to the image area — with no image
   in list view, it's re-anchored to the card itself instead, floating in the empty
   gutter (.card-body's first grid column) at the left of each row. */
.catalog-list-view .card-acronym {
    position: absolute;
    left: 0;
    right: auto;
    top: 50%;
    transform: translateY(-50%);
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.catalog-list-view .card-body {
    padding: 18px 0;
    display: grid;
    grid-template-columns: 52px 1fr 200px;
    grid-template-rows: auto auto;
    column-gap: 20px;
    row-gap: 2px;
    align-items: center;
}

.catalog-list-view .card-title {
    grid-column: 2;
    grid-row: 1;
    font-family: var(--display);
    font-weight: 700;
    font-size: 20px;
    line-height: 1.25;
    letter-spacing: -0.02em;
    margin: 0;
}

.catalog-list-view .card-desc {
    grid-column: 2;
    grid-row: 2;
    font-size: 13px;
    -webkit-line-clamp: 1;
    margin-top: 2px;
}

.catalog-list-view .card-foot {
    grid-column: 3;
    grid-row: 1 / span 2;
    align-self: center;
    min-width: 0;
    width: 100%;
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
    flex-direction: column;
    align-items: flex-end;
    text-align: right;
    gap: 4px;
}

.catalog-list-view .card-sub {
    display: block;
    width: 100%;
    white-space: normal;
    overflow: visible;
    -webkit-line-clamp: initial;
    -webkit-box-orient: initial;
}

.catalog-list-view .card:hover {
    background: var(--paper-2);
    transform: none;
    box-shadow: none;
}

@media (max-width: 720px) {
    .catalog-list-view .card-body {
        grid-template-columns: 1fr;
        gap: 4px;
        padding: 18px 0 18px 44px;
    }

    .catalog-list-view .card-title,
    .catalog-list-view .card-desc,
    .catalog-list-view .card-foot {
        grid-column: 1;
        grid-row: auto;
    }

    .catalog-list-view .card-foot {
        align-items: flex-start;
        text-align: left;
    }
}
