:root {
    --bg: #f3f5f9;
    --surface: #ffffff;
    --surface-soft: #eef2f7;
    --text: #12213a;
    --muted: #6b7892;
    --border: #dbe2ec;
    --accent: #315efb;
    --accent-soft: #eef3ff;
    --shadow: 0 18px 48px rgba(18, 33, 58, 0.08);
    --radius: 22px;
    --container: min(1180px, calc(100vw - 48px));
    --chrome-container: min(1600px, calc(100vw - 32px));
}

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

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: "Manrope", sans-serif;
    line-height: 1.6;
}

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

img {
    display: block;
    max-width: 100%;
}

.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
}

.skip-link:focus {
    left: 16px;
    top: 16px;
    z-index: 100;
    padding: 10px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
}

.site-shell {
    width: var(--container);
    margin: 0 auto;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 30;
    width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    background: rgba(243, 245, 249, 0.92);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid rgba(219, 226, 236, 0.9);
}

.site-header__inner {
    width: var(--chrome-container);
    margin: 0 auto;
    padding: clamp(12px, 2vw, 18px) 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: clamp(14px, 2vw, 24px);
}

.brand-mark {
    display: inline-flex;
    align-items: baseline;
    gap: clamp(8px, 1.5vw, 10px);
    flex-wrap: wrap;
}

.brand-mark__label {
    font-family: "Cormorant Garamond", serif;
    font-size: clamp(1.65rem, 3vw, 2.1rem);
    font-weight: 700;
    color: var(--text);
    line-height: 1;
}

.brand-mark__name {
    color: var(--muted);
    font-size: clamp(0.72rem, 1.3vw, 0.9rem);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.site-nav {
    display: flex;
    align-items: center;
    gap: clamp(8px, 1vw, 12px);
    flex-wrap: wrap;
}

.site-nav a,
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: clamp(38px, 4vw, 44px);
    padding: clamp(8px, 1vw, 10px) clamp(12px, 1.8vw, 18px);
    border-radius: 999px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.75);
    color: var(--text);
    font-size: clamp(0.82rem, 1.2vw, 0.95rem);
    font-weight: 600;
    transition: 180ms ease;
    white-space: nowrap;
}

.site-nav a:hover,
.site-nav a.is-active,
.button:hover {
    border-color: #bfd0ff;
    background: var(--accent-soft);
    color: var(--accent);
}

.main-content {
    padding: 40px 0 56px;
}

.section-grid,
.search-panel,
.page-header,
.article-layout,
.site-footer {
    margin-top: 28px;
}

.section-heading {
    margin-bottom: 20px;
}

.section-heading h1,
.section-heading h2,
.page-header h1,
.article-hero h1,
.site-footer h2 {
    margin: 0;
    color: var(--text);
    line-height: 1.15;
}

.section-heading h1,
.page-header h1,
.article-hero h1 {
    font-size: clamp(2rem, 4vw, 3rem);
}

.section-heading h2,
.site-footer h2,
.article-hero h2 {
    font-size: clamp(1.45rem, 2vw, 2rem);
}

.section-heading p,
.page-header__lead,
.article-hero__summary,
.site-footer__lead,
.search-panel p {
    margin: 10px 0 0;
    color: var(--muted);
}

.eyebrow,
.card-chip,
.toc-panel__label,
.site-footer__section-title {
    margin: 0 0 10px;
    color: var(--accent);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.card-chip {
    display: inline-flex;
    align-items: center;
    padding: 5px 10px;
    border-radius: 999px;
    background: var(--accent-soft);
}

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
}

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

.article-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.article-card__link {
    display: flex;
    flex-direction: column;
    min-height: 100%;
}

.article-card__image-wrap {
    min-height: 220px;
    padding: 28px;
    background:
        linear-gradient(180deg, rgba(49, 94, 251, 0.1), rgba(49, 94, 251, 0.03)),
        linear-gradient(135deg, #dce6ff, #eef2fb 48%, #fdfdff);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.article-card__poster-text {
    font-family: "Cormorant Garamond", serif;
    font-size: clamp(1.3rem, 2.2vw, 2rem);
    font-weight: 700;
    line-height: 1.06;
    color: #18294b;
    max-width: 20ch;
}

.article-card__body {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 12px;
    padding: 22px 22px 20px;
}

.article-card__title {
    margin: 0;
    font-size: 1.5rem;
    line-height: 1.18;
    color: var(--text);
}

.article-card__excerpt,
.article-card__body p {
    margin: 0;
    color: var(--muted);
    font-size: 0.98rem;
}

.article-card__meta {
    margin-top: auto;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    color: #7b88a3;
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.article-card__cta {
    margin-top: auto;
    color: var(--accent);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.page-header,
.search-panel,
.toc-panel,
.author-panel,
.faq-panel,
.empty-state,
.prose,
.article-hero,
.article-sidebar > div {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.page-header,
.search-panel,
.faq-panel,
.empty-state {
    padding: 28px;
}

.search-form {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 14px;
    align-items: end;
}

.search-form label {
    display: grid;
    gap: 8px;
    color: var(--text);
    font-weight: 600;
}

.search-form input {
    width: 100%;
    min-height: 48px;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #fbfcfe;
    color: var(--text);
}

.article-layout {
    background: transparent;
}

.article-hero {
    padding: 28px;
}

.article-hero__grid {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 24px;
    align-items: stretch;
}

.article-hero__media {
    min-height: 260px;
    border-radius: 18px;
    background:
        linear-gradient(180deg, rgba(49, 94, 251, 0.08), rgba(49, 94, 251, 0.03)),
        linear-gradient(135deg, #dce6ff, #eef2fb 48%, #fdfdff);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 28px;
    text-align: center;
}

.article-hero__meta,
.breadcrumbs,
.search-pagination__summary {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    color: var(--muted);
    font-size: 0.88rem;
}

.search-pagination {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    margin-top: 24px;
}

.search-pagination__current,
.search-pagination__ellipsis {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    padding: 12px 16px;
    border-radius: 999px;
    border: 1px solid var(--border);
}

.search-pagination__current {
    background: var(--accent);
    color: #11100d;
    font-weight: 700;
}

.search-pagination__ellipsis {
    color: var(--muted);
    background: rgba(255, 255, 255, 0.04);
}

.article-body {
    display: grid;
    grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
    gap: 24px;
    margin-top: 28px;
}

.article-sidebar {
    display: grid;
    gap: 20px;
}

.toc-panel,
.author-panel {
    padding: 20px;
}

.toc-panel ul,
.author-panel ul {
    margin: 0;
    padding-left: 18px;
    color: var(--muted);
}

.toc-panel li,
.author-panel li {
    margin: 0 0 10px;
}

.prose {
    padding: 28px;
}

.prose h2,
.prose h3,
.prose p,
.prose ul,
.prose ol {
    margin-top: 0;
    color: var(--text);
}

.prose p,
.prose li,
.prose details {
    color: var(--muted);
}

.prose table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: #fbfcfe;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.prose thead th {
    background: #f4f7fc;
    color: var(--text);
    font-size: 1.05rem;
    font-weight: 800;
}

.prose th,
.prose td {
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
    line-height: 1.55;
}

.prose tbody tr:last-child td {
    border-bottom: 0;
}

.prose th:first-child,
.prose td:first-child {
    width: 22%;
}

.prose th:nth-child(2),
.prose td:nth-child(2) {
    width: 39%;
}

.prose th:nth-child(3),
.prose td:nth-child(3) {
    width: 39%;
}

.prose td {
    color: var(--muted);
    font-size: 1rem;
}

.site-footer {
    margin-top: 56px;
    width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    padding: clamp(28px, 4vw, 40px) 0 clamp(22px, 3vw, 28px);
    border-top: 1px solid var(--border);
}

.site-footer__top {
    display: grid;
    width: var(--chrome-container);
    margin: 0 auto;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: clamp(24px, 4vw, 48px) clamp(28px, 8vw, 96px);
    align-items: start;
    justify-content: stretch;
}

.site-footer__group {
    display: grid;
    gap: 12px;
}

.site-footer__section-title {
    color: var(--text);
    margin-bottom: 8px;
}

.site-footer__links {
    display: grid;
    gap: 12px;
}

.site-footer__links a {
    color: var(--muted);
    font-size: clamp(0.92rem, 1.2vw, 1rem);
    font-weight: 500;
}

.site-footer__links a:hover {
    color: var(--accent);
}

.site-footer__bottom {
    width: var(--chrome-container);
    margin-left: auto;
    margin-right: auto;
    margin-top: clamp(24px, 3vw, 32px);
    padding-top: clamp(14px, 2vw, 18px);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    align-items: center;
    color: var(--muted);
    font-size: clamp(0.82rem, 1vw, 0.88rem);
}

@media (max-width: 960px) {
    .site-header__inner,
    .article-body,
    .article-hero__grid,
    .search-form,
    .site-footer__bottom {
        grid-template-columns: 1fr;
    }

    .site-header__inner,
    .site-footer__bottom {
        display: grid;
    }

    .site-header__inner {
        justify-content: start;
    }

    .site-nav {
        width: 100%;
        justify-content: flex-start;
    }

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

    .site-footer__top {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        justify-content: start;
    }
}

@media (max-width: 680px) {
    :root {
        --container: min(100vw - 24px, 1180px);
        --chrome-container: min(100vw - 24px, 1600px);
    }

    .article-grid,
    .site-footer__top {
        grid-template-columns: 1fr;
    }

    .site-nav a,
    .button {
        min-height: 40px;
        padding: 8px 12px;
    }

    .main-content {
        padding-top: 28px;
    }

    .page-header,
    .search-panel,
    .faq-panel,
    .empty-state,
    .article-hero,
    .prose {
        padding: 22px;
    }

    .prose table,
    .prose thead,
    .prose tbody,
    .prose tr,
    .prose th,
    .prose td {
        display: block;
        width: 100%;
    }

    .prose table {
        border-radius: 18px;
    }

    .prose thead {
        display: none;
    }

    .prose tr {
        padding: 14px 16px;
        border-bottom: 1px solid var(--border);
    }

    .prose tr:last-child {
        border-bottom: 0;
    }

    .prose th,
    .prose td {
        padding: 6px 0;
        border: 0;
    }
}
