:root {
    --knowledge-bg: var(--site-bg);
    --knowledge-surface: var(--site-surface-elevated);
    --knowledge-surface-soft: var(--site-surface);
    --knowledge-border: var(--site-border);
    --knowledge-text: var(--site-cream);
    --knowledge-text-soft: var(--site-cream-soft);
    --knowledge-accent: var(--site-accent);
    --knowledge-accent-strong: var(--site-accent-strong);
    --knowledge-radius: var(--site-radius-lg);
    --knowledge-shadow: var(--site-shadow-md);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: var(--site-font-body);
    background:
        radial-gradient(circle at top left, rgba(var(--site-amber-rgb), 0.12), transparent 30%),
        radial-gradient(circle at bottom right, rgba(var(--site-bronze-rgb), 0.10), transparent 34%),
        var(--knowledge-bg);
    color: var(--knowledge-text);
}

a {
    color: inherit;
}

.knowledge-skip-link {
    position: absolute;
    left: 16px;
    top: -48px;
    z-index: 200;
    padding: 10px 14px;
    border-radius: 12px;
    background: var(--knowledge-accent);
    color: #000;
    font-weight: 700;
    text-decoration: none;
}

.knowledge-skip-link:focus {
    top: 16px;
}

.knowledge-shell {
    min-height: 100vh;
    padding: 24px 20px 48px;
}

.knowledge-wrap {
    max-width: 1240px;
    margin: 0 auto;
}

.knowledge-topbar,
.knowledge-hero,
.knowledge-filters,
.knowledge-card,
.knowledge-section,
.knowledge-empty {
    border: 1px solid var(--knowledge-border);
    border-radius: var(--knowledge-radius);
    background: linear-gradient(180deg, rgba(var(--site-amber-rgb), 0.08), rgba(0, 0, 0, 0) 24%), var(--knowledge-surface);
    box-shadow: var(--knowledge-shadow);
}

.knowledge-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    padding: 18px 20px;
}

.knowledge-brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}

.knowledge-brand-mark {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(145deg, rgba(var(--site-amber-rgb), 0.95), rgba(var(--site-bronze-rgb), 0.82));
    color: var(--site-black);
    font-family: var(--site-font-display);
    font-weight: 700;
    box-shadow: 0 16px 32px rgba(var(--site-amber-rgb), 0.2);
}

.knowledge-brand-copy strong,
.knowledge-brand-copy span {
    display: block;
}

.knowledge-brand-copy strong {
    font-size: 1rem;
    font-family: var(--site-font-display);
}

.knowledge-brand-copy span {
    color: var(--knowledge-text-soft);
    font-size: 0.82rem;
    margin-top: 3px;
}

.knowledge-topbar-actions {
    display: inline-flex;
    align-items: center;
    gap: 12px;
}

.theme-toggle {
    background: var(--knowledge-surface-soft);
    border: 1px solid var(--knowledge-border);
    border-radius: 999px;
    padding: 4px;
    display: inline-flex;
}

.theme-toggle button {
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: var(--knowledge-text-soft);
    cursor: pointer;
}

.theme-toggle button.active {
    background: var(--knowledge-accent);
    color: #000;
}

.knowledge-button,
.knowledge-pagination a,
.knowledge-pagination span {
    min-height: 44px;
    padding: 0 18px;
    border: 1px solid var(--knowledge-border);
    border-radius: 14px;
    background: transparent;
    color: var(--knowledge-text);
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.2s ease, transform 0.2s ease, background 0.2s ease;
}

.knowledge-button:hover,
.knowledge-button:focus-visible,
.knowledge-pagination a:hover,
.knowledge-pagination a:focus-visible {
    border-color: var(--knowledge-accent);
    transform: translateY(-1px);
}

.knowledge-button--primary {
    background: var(--knowledge-accent);
    border-color: transparent;
    color: #000;
}

.knowledge-button:focus-visible,
.theme-toggle button:focus-visible,
.knowledge-brand:focus-visible,
.knowledge-input:focus-visible,
.knowledge-select:focus-visible,
.knowledge-chip:focus-visible,
.knowledge-collection-card:focus-visible,
.knowledge-link:focus-visible {
    outline: 2px solid var(--knowledge-accent);
    outline-offset: 3px;
}

.knowledge-hero,
.knowledge-filters,
.knowledge-section,
.knowledge-empty {
    padding: 24px;
    margin-bottom: 24px;
}

.knowledge-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(var(--site-cream-rgb), 0.07);
    border: 1px solid rgba(var(--site-cream-rgb), 0.08);
    color: var(--knowledge-text-soft);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.knowledge-hero h1 {
    margin: 18px 0 10px;
    font-family: var(--site-font-display);
    font-size: clamp(2.2rem, 4vw, 3.6rem);
    line-height: 1.02;
}

.knowledge-hero p,
.knowledge-section-heading p,
.knowledge-filters-top p,
.knowledge-empty {
    margin: 0;
    color: var(--knowledge-text-soft);
    line-height: 1.7;
}

.knowledge-stats {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 12px;
    margin-top: 24px;
}

.knowledge-stat {
    padding: 16px 18px;
    border-radius: 20px;
    background: rgba(var(--site-cream-rgb), 0.06);
    border: 1px solid rgba(var(--site-cream-rgb), 0.08);
}

.knowledge-stat strong,
.knowledge-stat span {
    display: block;
}

.knowledge-stat strong {
    font-size: 1.3rem;
    line-height: 1.15;
    margin-bottom: 6px;
}

.knowledge-stat span {
    color: var(--knowledge-text-soft);
    font-size: 0.82rem;
}

.knowledge-section-heading {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 16px;
}

.knowledge-section-heading h2,
.knowledge-filters-top h2 {
    margin: 0 0 6px;
    font-size: 1.15rem;
}

.knowledge-collection-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.knowledge-collection-card {
    display: block;
    padding: 18px;
    border-radius: 18px;
    border: 1px solid rgba(var(--site-cream-rgb), 0.08);
    background: rgba(var(--site-cream-rgb), 0.04);
    text-decoration: none;
}

.knowledge-collection-card strong,
.knowledge-collection-card span {
    display: block;
}

.knowledge-collection-card strong {
    margin-bottom: 6px;
}

.knowledge-collection-card span {
    color: var(--knowledge-text-soft);
    font-size: 0.9rem;
}

.knowledge-collection-card.is-active {
    border-color: rgba(var(--site-amber-rgb), 0.28);
    background: rgba(var(--site-amber-rgb), 0.09);
}

.knowledge-filters-top,
.knowledge-results-bar {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
}

.knowledge-filter-grid {
    display: grid;
    grid-template-columns: minmax(0, 2fr) repeat(4, minmax(160px, 1fr)) auto;
    gap: 12px;
    align-items: end;
}

.knowledge-field label {
    display: block;
    margin-bottom: 6px;
    color: var(--knowledge-text-soft);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.knowledge-input,
.knowledge-select {
    width: 100%;
    min-height: 46px;
    padding: 0 14px;
    border-radius: 14px;
    border: 1px solid rgba(var(--site-cream-rgb), 0.08);
    background: var(--knowledge-surface-soft);
    color: var(--knowledge-text);
    font-family: inherit;
    font-size: 0.94rem;
}

.knowledge-results-bar {
    margin-top: 20px;
    color: var(--knowledge-text-soft);
    font-size: 0.9rem;
    flex-wrap: wrap;
}

.knowledge-results-copy strong {
    color: var(--knowledge-text);
}

.knowledge-chip-row,
.knowledge-badge-row,
.knowledge-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.knowledge-chip,
.knowledge-badge,
.knowledge-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    text-decoration: none;
    border: 1px solid rgba(var(--site-cream-rgb), 0.08);
}

.knowledge-chip {
    background: rgba(var(--site-cream-rgb), 0.06);
    color: var(--knowledge-text-soft);
}

.knowledge-chip span {
    color: var(--knowledge-accent);
}

.knowledge-chip.is-active,
.knowledge-chip:hover {
    background: rgba(var(--site-amber-rgb), 0.11);
    color: var(--knowledge-accent);
    border-color: rgba(var(--site-amber-rgb), 0.18);
}

.knowledge-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

.knowledge-card {
    padding: 22px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.knowledge-card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
}

.knowledge-badge {
    background: rgba(var(--site-cream-rgb), 0.08);
    color: var(--knowledge-text-soft);
}

.knowledge-badge--topic,
.knowledge-badge--collection {
    background: rgba(var(--site-amber-rgb), 0.12);
    color: var(--knowledge-accent);
    border-color: rgba(var(--site-amber-rgb), 0.18);
}

.knowledge-card h3 {
    margin: 0;
    font-size: 1.12rem;
    line-height: 1.35;
}

.knowledge-meta,
.knowledge-detail-list,
.knowledge-tag {
    color: var(--knowledge-text-soft);
    font-size: 0.86rem;
}

.knowledge-detail-list {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.knowledge-card p {
    margin: 0;
    color: var(--knowledge-text-soft);
    line-height: 1.65;
    flex: 1;
}

.knowledge-trust-note {
    padding: 14px;
    border-radius: 16px;
    background: rgba(var(--site-cream-rgb), 0.05);
    border: 1px solid rgba(var(--site-cream-rgb), 0.08);
    color: var(--knowledge-text-soft);
    line-height: 1.6;
}

.knowledge-trust-note strong {
    color: var(--knowledge-text);
}

.knowledge-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--knowledge-accent);
    font-weight: 700;
    text-decoration: none;
}

.knowledge-pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-top: 24px;
}

.knowledge-pagination .is-current {
    background: var(--knowledge-accent);
    color: #000;
    border-color: transparent;
}

.knowledge-pagination .is-disabled,
.knowledge-pagination .is-ellipsis {
    color: var(--knowledge-text-soft);
    cursor: default;
}

.knowledge-empty {
    text-align: center;
    border-style: dashed;
    background: rgba(var(--site-cream-rgb), 0.04);
}

@media (max-width: 1100px) {
    .knowledge-stats,
    .knowledge-grid,
    .knowledge-collection-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .knowledge-filter-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    .knowledge-shell {
        padding: 16px 12px 32px;
    }

    .knowledge-topbar,
    .knowledge-topbar-actions,
    .knowledge-filters-top,
    .knowledge-results-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .knowledge-stats,
    .knowledge-grid,
    .knowledge-filter-grid,
    .knowledge-collection-grid {
        grid-template-columns: 1fr;
    }
}
