.resources-page {
    --bg-dark: #fff;
    --resource-ink: var(--text-main, #172033);
    --resource-muted: #626d7b;
    --resource-line: #dfe3e8;
    --resource-blue: var(--primary-dark, #005bbf);
    background: #fff;
}

.resources-main {
    padding-top: calc(var(--header-height, 80px) + 24px);
    padding-bottom: 64px;
    min-height: 70svh;
    color: var(--resource-ink);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Malgun Gothic", "Apple SD Gothic Neo", sans-serif;
}

.resources-title {
    margin: 0 0 28px;
    font-family: inherit;
    font-size: 32px;
    font-weight: 700;
    line-height: 1.4;
    letter-spacing: -0.045em;
    color: var(--resource-ink);
}

.resources-toolbar {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    border-bottom: 1px solid var(--resource-line);
}

.resource-categories {
    display: flex;
    flex-wrap: wrap;
    column-gap: 24px;
    min-width: 0;
}

.resource-category {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 48px;
    min-height: 48px;
    padding: 14px 2px;
    margin-bottom: -1px;
    border-bottom: 2px solid transparent;
    color: var(--resource-muted);
    font-size: 15px;
    line-height: 1.5;
    font-weight: 600;
    overflow-wrap: anywhere;
    transition: color 150ms ease, border-color 150ms ease;
}

.resource-category.is-active {
    border-bottom-color: var(--resource-blue);
    color: var(--resource-blue);
}

.resource-category-count {
    min-width: 22px;
    padding: 1px 6px;
    border-radius: 4px;
    background: var(--bg-card-hover, #f1f5f9);
    color: var(--resource-muted);
    font-size: 12px;
    line-height: 1.6;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    text-align: center;
}

.resource-category.is-active .resource-category-count {
    background: var(--primary-dim);
    color: var(--resource-blue);
}

.resource-search {
    display: flex;
    flex: 0 0 380px;
    gap: 8px;
    margin-bottom: 12px;
}

.resource-search-field {
    display: flex;
    align-items: center;
    flex: 1;
    gap: 8px;
    min-width: 0;
    padding: 0 12px;
    border: 1px solid #c9cfd7;
    border-radius: 8px;
    color: var(--resource-muted);
}

.resource-search-field input {
    min-width: 0;
    width: 100%;
    height: 46px;
    border: 0;
    border-radius: 8px;
    color: var(--resource-ink);
    font: inherit;
    font-size: 16px;
    outline: none;
}

.resource-search-field input::placeholder {
    color: var(--resource-muted) !important;
    opacity: 1;
}

.resource-search-field:focus-within {
    border-color: var(--resource-blue);
    outline: 2px solid var(--resource-blue);
    outline-offset: 2px;
}

.resource-search svg,
.resource-download svg {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.resource-search button {
    flex-shrink: 0;
    min-height: 48px;
    padding: 0 20px;
    border: 1px solid var(--resource-blue) !important;
    border-radius: 8px;
    background: var(--resource-blue) !important;
    box-shadow: none !important;
    transform: none;
    color: #fff;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.resources-main :is(a, button):focus-visible {
    outline: 2px solid var(--resource-blue);
    outline-offset: 4px;
}

.resources-main :is(a, button) {
    scroll-margin-block: calc(var(--header-height, 80px) + 16px) 24px;
}

.resources-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 48px;
    margin: 12px 0 4px;
    color: var(--resource-muted);
    font-size: 14px;
    line-height: 1.6;
}

.resources-summary p {
    min-width: 0;
    overflow-wrap: anywhere;
}

.resources-summary strong {
    margin-left: 5px;
    color: var(--resource-blue);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.resource-reset {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    min-height: 48px;
    color: var(--resource-blue);
    text-decoration: underline;
    text-underline-offset: 4px;
}

.resource-list {
    margin: 0;
    padding: 0;
    border-top: 1px solid var(--resource-line);
    list-style: none;
}

.resource-row {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr) 176px;
    align-items: center;
    gap: 24px;
    min-height: 128px;
    padding: 24px 16px;
    border-bottom: 1px solid var(--resource-line);
}

.resource-format {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 60px;
    color: var(--resource-blue);
}

.resource-format svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    fill: none;
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.resource-format-paper {
    fill: var(--surface, #fff);
    stroke: #bfd0e3;
}

.resource-format-fold {
    fill: #eaf3ff;
    stroke: #bfd0e3;
}

.resource-format-detail {
    stroke: #91abc9;
}

.resource-format span {
    position: absolute;
    left: 0;
    bottom: 7px;
    min-width: 40px;
    padding: 3px 5px;
    border-radius: 4px;
    background: var(--resource-blue);
    color: #fff;
    box-shadow: 0 2px 4px rgba(0, 91, 191, 0.14);
    font-size: 11px;
    font-weight: 700;
    line-height: 1.4;
    letter-spacing: 0.04em;
    text-align: center;
}

.resource-document { min-width: 0; }

.resource-kind {
    display: block;
    margin-bottom: 4px;
    color: var(--resource-blue);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.6;
    overflow-wrap: anywhere;
}

.resource-document-title {
    font-family: inherit;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.6;
    letter-spacing: -0.015em;
    color: var(--resource-ink);
    word-break: keep-all;
    overflow-wrap: anywhere;
}

.resource-description {
    margin-top: 6px;
    color: var(--resource-muted);
    font-size: 14px;
    line-height: 1.65;
    word-break: keep-all;
    overflow-wrap: anywhere;
}

.resource-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 12px;
    margin-top: 10px;
    color: var(--resource-muted);
    font-size: 12px;
    line-height: 1.6;
    font-variant-numeric: tabular-nums;
}

.resource-file {
    padding-left: 12px;
    border-left: 1px solid var(--resource-line);
}

.resource-date,
.resource-file { overflow-wrap: anywhere; }

.resource-actions {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    text-align: center;
}

.resource-download {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
    padding: 10px 12px;
    border: 1px solid var(--border-active);
    border-radius: 8px;
    background: var(--primary-dim);
    color: var(--resource-blue);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.5;
    transition: background-color 150ms ease, border-color 150ms ease;
}

.resource-download.requires-login {
    border-color: var(--resource-line);
    background: var(--surface, #fff);
    color: var(--resource-muted);
}

.resource-download-count {
    color: var(--resource-muted);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}

.resource-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

.resource-notice {
    margin-top: 20px;
    padding: 14px 16px;
    border: 1px solid var(--resource-line);
    border-left: 3px solid var(--resource-blue);
    border-radius: 4px;
    font-size: 14px;
    overflow-wrap: anywhere;
}

.resources-empty {
    padding: 64px 20px;
    border-block: 1px solid var(--resource-line);
    text-align: center;
}

.resources-empty p {
    margin-bottom: 8px;
    font-size: 18px;
    font-weight: 600;
}

.resources-empty > span {
    color: var(--resource-muted);
    font-size: 14px;
}

.resources-empty a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: fit-content;
    min-height: 48px;
    margin: 24px auto 0;
    padding: 10px 20px;
    border: 1px solid var(--resource-line);
    border-radius: 8px;
    color: var(--resource-blue);
    font-size: 14px;
    font-weight: 600;
}

@media (hover: hover) {
    .resource-category:hover { color: var(--resource-blue); }

    .resource-row:hover,
    .resource-row:focus-within { background: #fafbfc; }

    .resource-download:hover,
    .resources-empty a:hover {
        border-color: var(--resource-blue);
        background: var(--primary-dim);
        color: var(--resource-blue);
    }

    .resource-search button:hover { background: #0c509b !important; }
}

.resource-download:active,
.resources-empty a:active { background: var(--bg-card-hover); }

@media (max-width: 900px) {
    .resources-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
        border: 0;
    }

    .resource-categories { border-bottom: 1px solid var(--resource-line); }

    .resource-search {
        flex-basis: auto;
        width: 100%;
        margin-bottom: 0;
    }

    .resource-row {
        gap: 20px;
        padding-inline: 0;
    }
}

@media (max-width: 600px) {
    .resources-main {
        padding-top: calc(var(--header-height, 80px) + 20px);
        padding-bottom: 32px;
    }

    .resources-title {
        margin-bottom: 20px;
        font-size: 27px;
    }

    .resource-categories { column-gap: 20px; }
    .resource-category { font-size: 14px; }

    .resource-row {
        grid-template-columns: 40px minmax(0, 1fr);
        align-items: start;
        gap: 16px 14px;
        padding-block: 24px;
    }

    .resource-format {
        width: 40px;
        height: 50px;
        margin-top: 4px;
    }

    .resource-format span {
        min-width: 34px;
        bottom: 6px;
        padding: 2px 4px;
        font-size: 10px;
    }
    .resource-document-title { word-break: normal; }

    .resource-actions {
        grid-column: 1 / -1;
        flex-direction: row-reverse;
        justify-content: space-between;
        align-items: center;
        gap: 12px;
    }

    .resource-download {
        min-width: 164px;
        max-width: 68%;
        padding-inline: 10px;
        font-size: 13px;
    }

    .resource-download-count {
        text-align: left;
        overflow-wrap: anywhere;
    }

    .resources-page .pub-chatbot-panel {
        max-height: calc(100dvh - 120px - env(safe-area-inset-bottom, 0px));
        bottom: calc(20px + env(safe-area-inset-bottom, 0px));
    }
}

@media (max-width: 1360px) {
    /* Keep the support launcher in the footer flow when there is no side gutter. */
    .resources-page .pub-chatbot-toggle {
        position: static;
        margin: 0 20px 24px auto;
    }
}

@media (prefers-reduced-motion: reduce) {
    .resources-main :is(a, button) { transition: none; }
}
