:root {
    --paper: #f8f9fa;
    --surface: #ffffff;
    --ink: #202122;
    --muted: #54595d;
    --line: #c8ccd1;
    --link: #3366cc;
    --link-hover: #1f4ba8;
    --accent: #eaecf0;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    color: var(--ink);
    background: linear-gradient(180deg, #fbfbfc 0%, #f3f4f6 100%);
}

a {
    color: var(--link);
    text-decoration: none;
}

a:hover {
    color: var(--link-hover);
    text-decoration: underline;
}

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

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.wiki-shell {
    min-height: 100vh;
}

.wiki-header {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 1.5rem;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.96);
    position: sticky;
    top: 0;
    z-index: 20;
    backdrop-filter: blur(10px);
}

.wiki-brand {
    display: flex;
    min-width: 0;
    align-items: center;
}

.wiki-mark {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    max-width: min(420px, 100%);
    color: var(--ink);
    text-decoration: none;
}

.wiki-mark img {
    width: 86px;
    height: auto;
    flex: 0 0 86px;
}

.wiki-mark:hover {
    text-decoration: none;
}

.wiki-wordmark {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.wiki-wordmark-main {
    font-size: 2rem;
    line-height: 1;
    font-weight: 700;
    letter-spacing: 0.01em;
    color: #111;
}

.wiki-wordmark-dot {
    color: #404244;
}

.wiki-wordmark-accent {
    color: #4f8f2f;
    font-style: italic;
}

.wiki-wordmark-tagline {
    margin-top: 0.15rem;
    color: var(--muted);
    font-size: 0.88rem;
    letter-spacing: 0.02em;
}

.wiki-search {
    display: flex;
    gap: 0.5rem;
    width: min(460px, 100%);
}

.wiki-tools {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: min(640px, 100%);
    justify-content: flex-end;
}

.wiki-search input,
.filter-bar input,
.filter-bar select,
.language-switcher select {
    width: 100%;
    border: 1px solid var(--line);
    background: var(--surface);
    padding: 0.72rem 0.85rem;
    font: inherit;
}

.wiki-search button,
.filter-bar button {
    border: 1px solid #a2a9b1;
    background: var(--paper);
    color: var(--ink);
    font: inherit;
    padding: 0.72rem 1rem;
    cursor: pointer;
    white-space: nowrap;
}

.language-switcher {
    min-width: 140px;
}

.wiki-layout {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    gap: 0;
    align-items: start;
}

.wiki-sidebar {
    min-height: calc(100vh - 78px);
    padding: 1.5rem 1rem 3rem 1.5rem;
    border-right: 1px solid var(--line);
    background: rgba(248, 249, 250, 0.85);
}

.sidebar-block + .sidebar-block {
    margin-top: 1.4rem;
}

.sidebar-block h2 {
    margin: 0 0 0.65rem;
    font-size: 0.95rem;
    font-family: Arial, Helvetica, sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
}

.sidebar-block nav,
.sidebar-list {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.sidebar-block nav a,
.sidebar-list a {
    display: flex;
    justify-content: space-between;
    gap: 0.8rem;
    padding: 0.35rem 0.45rem;
    border-radius: 2px;
}

.sidebar-block nav a:hover,
.sidebar-list a:hover {
    background: var(--accent);
    text-decoration: none;
}

.sidebar-list small {
    color: var(--muted);
}

.wiki-content {
    padding: 1.5rem 2rem 3rem;
    max-width: 1160px;
}

.wiki-footer {
    padding: 1rem 1.5rem 1.5rem;
    border-top: 1px solid var(--line);
    background: rgba(248, 249, 250, 0.92);
    color: var(--muted);
    font-size: 0.92rem;
    line-height: 1.6;
}

.wiki-footer p {
    margin: 0;
}

.wiki-footer p + p {
    margin-top: 0.35rem;
}

.hero,
.page-head,
.content-section,
.entry-page {
    background: var(--surface);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
}

.hero {
    display: flex;
    justify-content: space-between;
    gap: 2rem;
    padding: 1.5rem;
}

.hero h1,
.page-head h1,
.entry-header h1 {
    margin: 0 0 0.4rem;
    font-size: clamp(2rem, 3vw, 2.7rem);
    font-weight: 400;
}

.hero p,
.page-head p,
.results-meta,
.entry-body,
.term-detail {
    font-size: 1.03rem;
    line-height: 1.7;
}

.hero-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(120px, 1fr));
    gap: 1rem;
    min-width: 280px;
}

.hero-meta div {
    padding: 1rem;
    background: var(--paper);
    border: 1px solid var(--line);
    text-align: center;
}

.hero-meta strong {
    display: block;
    font-size: 1.9rem;
    font-weight: 400;
}

.hero-meta span {
    color: var(--muted);
}

.content-section,
.entry-page {
    margin-top: 1.5rem;
    padding: 1.25rem 1.5rem 1.5rem;
}

.section-heading,
.entry-header,
.page-head {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: start;
}

.page-head {
    padding: 1.25rem 1.5rem;
    margin-bottom: 1rem;
}

.alphabet-index {
    display: flex;
    gap: 1.25rem;
    align-items: start;
    margin-bottom: 1rem;
    padding: 1.2rem 1.35rem;
    border: 1px solid var(--line);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.alphabet-label {
    min-width: 170px;
    padding-top: 0.35rem;
    color: var(--muted);
    font-size: 1rem;
    font-family: Arial, Helvetica, sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.alphabet-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    flex: 1;
}

.alphabet-links a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.9rem;
    min-height: 2.9rem;
    padding: 0.6rem 0.8rem;
    border: 1px solid #aeb4bc;
    background: #f5f7fa;
    color: var(--ink);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 1.08rem;
    font-weight: 700;
    line-height: 1;
    text-decoration: none;
    border-radius: 3px;
}

.alphabet-links a:first-child {
    min-width: auto;
    padding-inline: 1rem;
}

.alphabet-links a.is-active,
.alphabet-links a:hover {
    background: #dce8ff;
    border-color: #7fa3e6;
    color: #123e93;
    text-decoration: none;
}

.alphabet-links a.is-active {
    box-shadow: inset 0 0 0 1px #5d83cb;
}

.filter-bar {
    display: flex;
    gap: 0.6rem;
    align-items: center;
    width: min(620px, 100%);
}

.article-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.article-card,
.term-card {
    border: 1px solid var(--line);
    background: var(--surface);
}

.article-card img {
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-bottom: 1px solid var(--line);
}

.article-card-body,
.term-card {
    padding: 1rem;
}

.article-card h2,
.article-card h3,
.term-card h2 {
    margin: 0 0 0.35rem;
    font-size: 1.2rem;
    font-weight: 400;
}

.latin {
    margin: 0 0 0.75rem;
    color: var(--muted);
    font-style: italic;
}

.latin.large {
    font-size: 1.08rem;
}

.eyebrow {
    margin: 0 0 0.45rem;
    color: var(--muted);
    font-size: 0.9rem;
    font-family: Arial, Helvetica, sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.list-rows {
    display: grid;
    gap: 0.55rem;
}

.list-row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 0.85rem;
    border: 1px solid var(--line);
    background: #fbfbfb;
}

.list-row span {
    color: var(--muted);
}

.results-meta {
    margin: 0 0 1rem;
    color: var(--muted);
}

.pagination {
    margin-top: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--line);
}

.entry-layout {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    gap: 1.5rem;
    margin-top: 1rem;
}

.infobox {
    border: 1px solid var(--line);
    background: #f8f9fa;
    align-self: start;
}

.infobox img {
    border-bottom: 1px solid var(--line);
}

.infobox dl {
    margin: 0;
    padding: 0;
}

.infobox div {
    padding: 0.8rem 1rem;
    border-bottom: 1px solid var(--line);
}

.infobox div:last-child {
    border-bottom: 0;
}

.infobox dt {
    margin: 0 0 0.3rem;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
}

.infobox dd {
    margin: 0;
}

.wiki-text p,
.wiki-text li {
    line-height: 1.72;
}

.wiki-text img {
    margin: 1rem auto;
    border: 1px solid var(--line);
    background: #fff;
    padding: 0.25rem;
}

.back-link {
    align-self: center;
    font-family: Arial, Helvetica, sans-serif;
}

.lead {
    font-size: 1.1rem;
    color: var(--muted);
}

.muted {
    color: var(--muted);
}

@media (max-width: 1080px) {
    .wiki-layout {
        grid-template-columns: 1fr;
    }

    .wiki-sidebar {
        min-height: auto;
        border-right: 0;
        border-bottom: 1px solid var(--line);
        padding: 1rem 1.25rem;
    }

    .wiki-content {
        padding: 1.25rem;
    }

    .wiki-footer {
        padding-inline: 1.25rem;
    }
}

@media (max-width: 760px) {
    .wiki-header,
    .hero,
    .page-head,
    .alphabet-index,
    .entry-header,
    .filter-bar,
    .entry-layout {
        grid-template-columns: 1fr;
        display: grid;
    }

    .wiki-search,
    .filter-bar,
    .wiki-tools {
        width: 100%;
    }

    .wiki-mark {
        max-width: min(360px, 100%);
        gap: 0.65rem;
    }

    .wiki-mark img {
        width: 72px;
        height: auto;
        flex-basis: 72px;
    }

    .wiki-wordmark-main {
        font-size: 1.7rem;
    }

    .hero-meta {
        min-width: 0;
    }

    .alphabet-label {
        min-width: 0;
        padding-top: 0;
    }

    .entry-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 520px) {
    .wiki-mark {
        max-width: 280px;
    }

    .wiki-mark img {
        width: 60px;
        height: auto;
        flex-basis: 60px;
    }

    .wiki-wordmark-main {
        font-size: 1.45rem;
    }

    .wiki-wordmark-tagline {
        font-size: 0.76rem;
    }
}
