:root {
    --font-body: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
    --font-ui: "Trebuchet MS", "Gill Sans", "Segoe UI", sans-serif;
    --ink: #1f3554;
    --muted: #516987;
    --paper: #edf5ff;
    --paper-soft: #f8fbff;
    --surface: rgba(248, 251, 255, 0.9);
    --surface-strong: rgba(239, 246, 255, 0.97);
    --night: #d9e8ff;
    --night-2: #bdd6fa;
    --accent: #5f8fe8;
    --accent-2: #7eb5ff;
    --gold: #8e6f1e;
    --gold-soft: #c5a445;
    --moss: #4d6c8c;
    --line: rgba(73, 107, 156, 0.18);
    --shadow: 0 18px 45px rgba(54, 91, 138, 0.18);
    --panel-shadow: 0 12px 30px rgba(72, 110, 158, 0.1);
    --body-bg:
        radial-gradient(circle at top left, rgba(126, 181, 255, 0.3), transparent 24rem),
        radial-gradient(circle at 85% 15%, rgba(142, 111, 30, 0.12), transparent 18rem),
        linear-gradient(180deg, #f5f9ff 0, #dce9ff 18rem, var(--paper) 34rem);
    --header-bg: rgba(234, 243, 255, 0.88);
    --header-border: rgba(95, 143, 232, 0.24);
    --header-ink: #26466d;
    --header-link: rgba(38, 70, 109, 0.82);
    --header-link-hover: #8e6f1e;
    --hero-backdrop:
        linear-gradient(115deg, rgba(239, 246, 255, 0.96), rgba(206, 227, 255, 0.92)),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='900' height='500' viewBox='0 0 900 500'%3E%3Crect width='900' height='500' fill='%23d8e9ff'/%3E%3Cg fill='none' stroke='%238e6f1e' stroke-opacity='.18'%3E%3Cpath d='M50 390 C190 260 270 430 410 270 S690 120 850 230'/%3E%3Cpath d='M90 120 H810 M150 170 H720 M220 220 H780 M110 320 H660'/%3E%3Ccircle cx='675' cy='165' r='70'/%3E%3Cpath d='M640 165 h70 M675 130 v70'/%3E%3C/g%3E%3C/svg%3E") center/cover;
    --hero-ink: #203757;
    --hero-muted: rgba(32, 55, 87, 0.82);
    --section-backdrop:
        radial-gradient(circle at 12% 18%, rgba(126, 181, 255, 0.24), transparent 20rem),
        linear-gradient(135deg, #d9e9ff, #b9d5ff);
    --footer-backdrop:
        radial-gradient(circle at 80% 20%, rgba(142, 111, 30, 0.16), transparent 20rem),
        linear-gradient(180deg, #d9e8ff, #bfd5f7);
    --input-bg: rgba(255, 255, 255, 0.96);
    --input-border: rgba(73, 107, 156, 0.24);
    --ghost-bg: rgba(95, 143, 232, 0.08);
    --ghost-border: rgba(95, 143, 232, 0.24);
    --tooltip-bg: rgba(20, 38, 64, 0.96);
    --tooltip-ink: #f4f8ff;
}

:root[data-theme="soft-dark"] {
    --ink: #edf5ff;
    --muted: #b4c8e4;
    --paper: #121b29;
    --paper-soft: #f7fbff;
    --surface: rgba(22, 33, 50, 0.88);
    --surface-strong: rgba(18, 29, 44, 0.96);
    --night: #09111d;
    --night-2: #0f1a2a;
    --accent: #89b7ff;
    --accent-2: #aed0ff;
    --gold: #b7922f;
    --gold-soft: #e0c56b;
    --moss: #7ea1cf;
    --line: rgba(167, 201, 245, 0.16);
    --shadow: 0 18px 45px rgba(0, 0, 0, 0.34);
    --panel-shadow: 0 12px 30px rgba(0, 0, 0, 0.2);
    --body-bg:
        radial-gradient(circle at top left, rgba(91, 138, 214, 0.2), transparent 26rem),
        radial-gradient(circle at 85% 15%, rgba(183, 146, 47, 0.12), transparent 18rem),
        linear-gradient(180deg, #0d1421 0, #101a2a 18rem, #121b29 34rem);
    --header-bg: rgba(8, 16, 28, 0.86);
    --header-border: rgba(137, 183, 255, 0.18);
    --header-ink: #f4f8ff;
    --header-link: rgba(237, 245, 255, 0.82);
    --header-link-hover: #e0c56b;
    --hero-backdrop:
        linear-gradient(115deg, rgba(11, 21, 34, 0.94), rgba(25, 39, 60, 0.9)),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='900' height='500' viewBox='0 0 900 500'%3E%3Crect width='900' height='500' fill='%230d1726'/%3E%3Cg fill='none' stroke='%23e0c56b' stroke-opacity='.2'%3E%3Cpath d='M50 390 C190 260 270 430 410 270 S690 120 850 230'/%3E%3Cpath d='M90 120 H810 M150 170 H720 M220 220 H780 M110 320 H660'/%3E%3Ccircle cx='675' cy='165' r='70'/%3E%3Cpath d='M640 165 h70 M675 130 v70'/%3E%3C/g%3E%3C/svg%3E") center/cover;
    --hero-ink: #f7fbff;
    --hero-muted: rgba(237, 245, 255, 0.82);
    --section-backdrop:
        radial-gradient(circle at 12% 18%, rgba(137, 183, 255, 0.14), transparent 20rem),
        linear-gradient(135deg, #0d1522, #172335);
    --footer-backdrop:
        radial-gradient(circle at 80% 20%, rgba(183, 146, 47, 0.16), transparent 20rem),
        linear-gradient(180deg, #101a2a, #09111d);
    --input-bg: rgba(15, 24, 38, 0.94);
    --input-border: rgba(167, 201, 245, 0.18);
    --ghost-bg: rgba(137, 183, 255, 0.08);
    --ghost-border: rgba(167, 201, 245, 0.18);
    --tooltip-bg: rgba(6, 12, 20, 0.98);
    --tooltip-ink: #f7fbff;
}

:root[data-theme="golden-brown"] {
    --ink: #19314b;
    --muted: #4b6482;
    --paper: #e8f2ff;
    --paper-soft: #f7fbff;
    --surface: rgba(244, 249, 255, 0.92);
    --surface-strong: rgba(230, 241, 255, 0.98);
    --night: #c7e4ff;
    --night-2: #9bd0ff;
    --accent: #4ca5ff;
    --accent-2: #87cbff;
    --gold: #7d6218;
    --gold-soft: #b88d25;
    --moss: #4a77a5;
    --line: rgba(76, 165, 255, 0.2);
    --shadow: 0 18px 45px rgba(54, 112, 181, 0.2);
    --panel-shadow: 0 12px 30px rgba(49, 103, 168, 0.14);
    --body-bg:
        radial-gradient(circle at top left, rgba(135, 203, 255, 0.36), transparent 24rem),
        radial-gradient(circle at 85% 15%, rgba(125, 98, 24, 0.16), transparent 18rem),
        linear-gradient(180deg, #f6fbff 0, #d5ebff 16rem, #c4e2ff 24rem, var(--paper) 34rem);
    --header-bg: rgba(221, 239, 255, 0.9);
    --header-border: rgba(76, 165, 255, 0.28);
    --header-ink: #14304f;
    --header-link: rgba(20, 48, 79, 0.84);
    --header-link-hover: #7d6218;
    --hero-backdrop:
        linear-gradient(115deg, rgba(239, 248, 255, 0.95), rgba(179, 220, 255, 0.95)),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='900' height='500' viewBox='0 0 900 500'%3E%3Crect width='900' height='500' fill='%23d1ebff'/%3E%3Cg fill='none' stroke='%237d6218' stroke-opacity='.18'%3E%3Cpath d='M50 390 C190 260 270 430 410 270 S690 120 850 230'/%3E%3Cpath d='M90 120 H810 M150 170 H720 M220 220 H780 M110 320 H660'/%3E%3Ccircle cx='675' cy='165' r='70'/%3E%3Cpath d='M640 165 h70 M675 130 v70'/%3E%3C/g%3E%3C/svg%3E") center/cover;
    --hero-ink: #163251;
    --hero-muted: rgba(22, 50, 81, 0.82);
    --section-backdrop:
        radial-gradient(circle at 12% 18%, rgba(76, 165, 255, 0.22), transparent 20rem),
        linear-gradient(135deg, #d9efff, #add8ff);
    --footer-backdrop:
        radial-gradient(circle at 80% 20%, rgba(125, 98, 24, 0.16), transparent 20rem),
        linear-gradient(180deg, #d4e9ff, #b4d8ff);
    --input-bg: rgba(255, 255, 255, 0.98);
    --input-border: rgba(76, 165, 255, 0.22);
    --ghost-bg: rgba(76, 165, 255, 0.1);
    --ghost-border: rgba(76, 165, 255, 0.26);
    --tooltip-bg: rgba(17, 40, 66, 0.96);
    --tooltip-ink: #f7fbff;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: auto;
}

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    color: var(--ink);
    background: var(--body-bg);
    font-family: var(--font-body);
    line-height: 1.68;
    text-rendering: optimizeLegibility;
}

body.search-open {
    overflow: hidden;
}

a {
    color: inherit;
}

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

button,
input,
select,
textarea {
    font: inherit;
}

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

.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    padding: 0.9rem clamp(1rem, 4vw, 3rem);
    color: var(--header-ink);
    background: var(--header-bg);
    border-bottom: 1px solid var(--header-border);
    backdrop-filter: blur(14px);
    box-shadow: 0 10px 30px rgba(49, 88, 142, 0.08);
}

.site-header-top {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.7rem;
    min-width: 0;
    color: var(--header-ink);
    text-decoration: none;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 2.35rem;
    height: 2.35rem;
    flex: 0 0 2.35rem;
    color: var(--paper-soft);
    background: linear-gradient(180deg, var(--accent), var(--accent-2));
    border: 2px solid rgba(255, 255, 255, 0.68);
    border-radius: 50%;
    box-shadow: 0 8px 24px rgba(76, 165, 255, 0.24);
    font-weight: 800;
}

.brand-copy {
    display: grid;
    min-width: 0;
}

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

.brand-copy strong {
    font-size: 1.02rem;
    letter-spacing: 0.01em;
}

.brand-copy small {
    color: color-mix(in srgb, var(--header-ink) 66%, white);
    font-family: var(--font-ui);
    font-size: 0.78rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.main-nav,
.site-actions,
.hero-actions,
.chip-row,
.meta-line,
.breadcrumbs,
.section-head,
.article-meta,
.search-panel-head,
.search-toolbar {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex-wrap: wrap;
}

.main-nav {
    margin-left: auto;
}

.main-nav a {
    display: inline-flex;
    align-items: center;
    min-height: 2.2rem;
    padding: 0.42rem 0.7rem;
    color: var(--header-link);
    text-decoration: none;
    font-family: var(--font-ui);
    font-size: 0.88rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border: 1px solid transparent;
    border-radius: 999px;
    transition: color 140ms ease, border-color 140ms ease, background-color 140ms ease, transform 140ms ease;
}

.main-nav a:hover {
    color: var(--header-link-hover);
    border-color: color-mix(in srgb, var(--gold) 32%, transparent);
    background: color-mix(in srgb, var(--surface) 64%, white);
    transform: translateY(-1px);
}

.menu-toggle {
    display: none;
    width: 2.75rem;
    height: 2.75rem;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 0.32rem;
    margin-left: auto;
    color: var(--header-ink);
    background: rgba(255, 255, 255, 0.42);
    border: 1px solid var(--header-border);
    border-radius: 6px;
    cursor: pointer;
}

.menu-toggle span {
    display: block;
    width: 1.25rem;
    height: 2px;
    background: currentColor;
    border-radius: 999px;
    transition: transform 0.18s ease, opacity 0.18s ease;
}

.menu-toggle[aria-expanded="true"] span:nth-child(1) {
    transform: translateY(0.43rem) rotate(45deg);
}

.menu-toggle[aria-expanded="true"] span:nth-child(2) {
    opacity: 0;
}

.menu-toggle[aria-expanded="true"] span:nth-child(3) {
    transform: translateY(-0.43rem) rotate(-45deg);
}

.theme-switcher select,
.search-close,
.search-toolbar input,
.search-type-field select,
input,
select,
textarea {
    width: 100%;
    padding: 0.72rem 0.78rem;
    color: var(--ink);
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 8px;
}

.theme-switcher select {
    width: auto;
    min-height: 2.35rem;
    padding: 0.46rem 0.72rem;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.35rem;
    padding: 0.55rem 0.9rem;
    border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent);
    border-radius: 8px;
    color: var(--ink);
    background: color-mix(in srgb, var(--paper-soft) 86%, white);
    text-decoration: none;
    cursor: pointer;
    transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease, background-color 140ms ease;
}

.button.primary,
.admin-link {
    color: var(--paper-soft);
    background: linear-gradient(180deg, var(--accent), color-mix(in srgb, var(--accent) 74%, var(--gold)));
    border-color: color-mix(in srgb, var(--accent) 70%, var(--gold));
    box-shadow: 0 10px 24px rgba(76, 165, 255, 0.22);
}

.button:hover {
    transform: translateY(-1px);
}

.button.ghost {
    color: var(--header-ink);
    background: var(--ghost-bg);
    border-color: var(--ghost-border);
}

.button.compact {
    min-height: 2rem;
    padding: 0.35rem 0.6rem;
    font-size: 0.9rem;
}

.site-main,
.hero-inner,
.page-title,
.content-band,
.article-header,
.site-footer-inner {
    width: min(1120px, calc(100% - 2rem));
    margin-inline: auto;
}

.site-main {
    flex: 1 0 auto;
    width: 100%;
    margin: 0;
    padding: 0 0 4rem;
}

.hero {
    min-height: 24rem;
    display: flex;
    align-items: end;
    padding: clamp(3rem, 8vw, 6rem) 0;
    color: var(--hero-ink);
    background: var(--hero-backdrop);
    border-bottom: 1px solid color-mix(in srgb, var(--accent) 14%, transparent);
}

.hero h1,
.page-title h1,
.article-header h1,
.site-footer h2,
.section-head h2,
.search-panel-head h2 {
    margin: 0;
    line-height: 1.08;
}

.hero h1 {
    font-size: clamp(2.4rem, 5.5vw, 4.5rem);
    letter-spacing: -0.03em;
}

.hero p:not(.eyebrow) {
    max-width: 32rem;
    font-size: clamp(1rem, 2vw, 1.2rem);
}

.article-header > p:not(.eyebrow),
.section-subtitle {
    max-width: 46rem;
    font-size: clamp(1rem, 2vw, 1.2rem);
}

.hero p:not(.eyebrow),
.article-header > p:not(.eyebrow) {
    color: var(--hero-muted);
}

.hero-actions {
    margin-top: 1.3rem;
}

.eyebrow {
    margin: 0 0 0.45rem;
    color: var(--gold);
    font-family: var(--font-ui);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.page-title,
.content-band,
.article-body,
.home-band {
    position: relative;
    isolation: isolate;
}

.page-title,
.content-band {
    padding: clamp(2rem, 5vw, 4rem) 0;
}

.page-title {
    min-height: 13rem;
    color: var(--hero-ink);
}

.page-title::before,
.article-hero::before,
.site-footer::before {
    content: "";
    position: absolute;
    z-index: -1;
    inset: 0 50%;
    width: 100vw;
    margin-left: -50vw;
}

.page-title::before,
.article-hero::before {
    background: var(--section-backdrop);
}

.content-band::before,
.article-body::before {
    content: "";
    position: absolute;
    z-index: -1;
    inset: 0 50%;
    width: 100vw;
    margin-left: -50vw;
    background: var(--paper);
}

.page-title h1 {
    font-size: clamp(2rem, 4vw, 3.2rem);
    color: var(--hero-ink);
    letter-spacing: -0.02em;
}

.section-subtitle {
    margin: 0.85rem 0 0;
    color: var(--hero-muted);
}

.page-shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 1rem;
    align-items: start;
}

.article-hero {
    position: relative;
    min-height: 16rem;
    display: flex;
    align-items: end;
    padding: clamp(2.5rem, 6vw, 5rem) 0 clamp(2rem, 4vw, 3.5rem);
    color: var(--hero-ink);
    isolation: isolate;
}

.article-header {
    max-width: 820px;
}

.article-header h1 {
    color: var(--hero-ink);
    font-size: clamp(2.35rem, 6vw, 4.8rem);
}

.breadcrumbs {
    margin-bottom: 1rem;
    font-size: 0.92rem;
    color: var(--hero-muted);
}

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

.article-meta {
    margin-top: 0.9rem;
    color: var(--hero-muted);
}

.article-pill {
    margin-top: 1rem;
}

.chip {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    background: color-mix(in srgb, var(--accent) 12%, white);
    border: 1px solid color-mix(in srgb, var(--accent) 18%, transparent);
    color: var(--accent);
    font-size: 0.82rem;
    font-weight: 700;
}

.directory-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1rem;
}

.directory-card,
.related-card,
.side-panel,
.search-panel,
.rich-text,
.article-nav-card {
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.directory-card,
.related-card,
.article-nav-card {
    display: block;
    padding: 1rem;
    background: var(--surface);
    text-decoration: none;
    transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.directory-card:hover,
.related-card:hover,
.article-nav-card:hover {
    border-color: color-mix(in srgb, var(--accent) 42%, transparent);
    box-shadow: 0 16px 36px rgba(56, 104, 171, 0.18);
    transform: translateY(-2px);
}

.directory-card {
    position: relative;
    min-height: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    overflow: hidden;
}

.directory-card::before,
.related-card::before,
.article-nav-card::before,
.side-panel::before,
.rich-text::before {
    content: "";
    position: absolute;
    inset: 0 auto auto 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), var(--gold-soft));
}

.directory-type,
.related-kind,
.article-nav-label,
.article-nav-type {
    display: inline-block;
    margin-bottom: 0.45rem;
    color: var(--gold);
    font-family: var(--font-ui);
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.card-title-row,
.article-title-row {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.directory-card strong,
.related-card strong,
.article-nav-card strong {
    display: block;
    color: var(--ink);
    font-size: 1.12rem;
    line-height: 1.2;
}

.directory-card p,
.related-card span:last-child,
.muted,
.search-empty,
.search-result-snippet {
    color: var(--muted);
}

.directory-card p {
    margin: 0;
    font-size: 1rem;
    line-height: 1.62;
}

.home-section + .home-section,
.character-group + .character-group {
    margin-top: 2.6rem;
}

.section-head {
    justify-content: space-between;
    align-items: end;
    margin-bottom: 1.15rem;
}

.section-head h2 {
    font-size: 1.85rem;
    letter-spacing: -0.02em;
}

.section-link {
    color: var(--gold);
    font-family: var(--font-ui);
    font-size: 0.92rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    text-decoration: none;
}

.image-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    margin: 0 0 1.5rem;
}

.article-image {
    overflow: hidden;
    background: var(--surface);
}

.article-image img {
    width: 100%;
    aspect-ratio: 16 / 10;
    object-fit: cover;
}

.article-body {
    padding: 0;
}

.rich-text {
    position: relative;
    max-width: none;
    margin: 0;
    padding: clamp(1.25rem, 3vw, 2rem);
    background: var(--surface-strong);
    border-left: 4px solid var(--accent);
    box-shadow: var(--panel-shadow);
}

.rich-text h2,
.rich-text h3,
.rich-text h4 {
    margin: 1.8rem 0 0.65rem;
    color: var(--ink);
    letter-spacing: -0.015em;
}

.rich-text p,
.rich-text ul,
.rich-text ol,
.rich-text blockquote,
.table-wrap {
    margin: 0.8rem 0;
}

.rich-text p,
.rich-text li {
    font-size: 1.04rem;
}

.rich-text ul,
.rich-text ol {
    padding-left: 1.2rem;
}

.rich-text blockquote {
    margin-left: 0;
    padding: 1rem 1.1rem;
    border-left: 4px solid var(--gold);
    background: color-mix(in srgb, var(--surface) 82%, white);
    border-radius: 0 12px 12px 0;
}

.rich-text hr {
    border: 0;
    border-top: 1px solid var(--line);
    margin: 1.5rem 0;
}

.rich-text code {
    padding: 0.08rem 0.35rem;
    border-radius: 6px;
    background: color-mix(in srgb, var(--accent) 10%, white);
    font-size: 0.9em;
}

.rich-text img {
    max-width: 100%;
}

.side-panel {
    position: sticky;
    overflow: hidden;
    position: sticky;
    top: 5rem;
    padding: 1.1rem;
    background: var(--surface);
}

.side-panel > * + * {
    margin-top: 1rem;
}

.article-nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    margin-top: 2rem;
}

.article-nav-card.is-empty {
    visibility: hidden;
    pointer-events: none;
}

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 14px;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
}

th,
td {
    padding: 0.85rem 0.9rem;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

thead th {
    background: color-mix(in srgb, var(--surface) 76%, white);
    color: var(--ink);
    font-size: 0.9rem;
}

.xref {
    position: relative;
    color: var(--accent);
    border-bottom: 1px dashed color-mix(in srgb, var(--accent) 40%, transparent);
    text-decoration: none;
}

.search-modal {
    position: fixed;
    inset: 0;
    z-index: 50;
}

.search-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(16, 23, 33, 0.45);
}

.search-panel {
    position: relative;
    width: min(46rem, calc(100% - 1.25rem));
    margin: 4.2rem auto 0;
    padding: 1.1rem;
    background: var(--surface-strong);
}

.search-panel-head {
    justify-content: space-between;
}

.search-panel-head h2 {
    font-size: 1.45rem;
}

.search-toolbar {
    margin: 1rem 0 0.9rem;
    align-items: stretch;
}

.search-toolbar input {
    flex: 1 1 auto;
    min-height: 3rem;
}

.search-type-field {
    display: grid;
    gap: 0.35rem;
    color: var(--muted);
    font-size: 0.82rem;
}

.search-type-field select {
    min-width: 11rem;
    min-height: 3rem;
}

.search-results {
    position: relative;
    padding: 0.6rem;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: color-mix(in srgb, var(--surface) 86%, white);
    max-height: min(26rem, 58vh);
    overflow: auto;
}

.search-result {
    display: block;
    padding: 0.8rem 0.85rem;
    border-radius: 12px;
    text-decoration: none;
}

.search-result + .search-result {
    margin-top: 0.35rem;
}

.search-result:hover {
    background: color-mix(in srgb, var(--accent) 9%, white);
}

.search-result-type {
    display: inline-block;
    margin-bottom: 0.35rem;
    color: var(--gold);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.search-result strong {
    display: block;
    margin-bottom: 0.3rem;
    color: var(--ink);
    font-size: 1rem;
}

.tooltip {
    position: fixed;
    left: 0;
    top: 0;
    width: min(320px, calc(100vw - 1.5rem));
    max-height: min(22rem, calc(100vh - 2rem));
    overflow: auto;
    padding: 0.95rem 1rem;
    border: 1px solid rgba(20, 35, 57, 0.18);
    border-radius: 14px;
    background: var(--tooltip-bg);
    color: var(--tooltip-ink);
    box-shadow: 0 18px 44px rgba(10, 17, 29, 0.3);
    pointer-events: none;
    z-index: 40;
}

.tooltip-type {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: color-mix(in srgb, var(--gold-soft) 72%, white);
}

.tooltip-title {
    margin-top: 0.35rem;
    font-size: 1rem;
    font-weight: 700;
}

.tooltip-summary {
    margin-top: 0.45rem;
    color: rgba(235, 241, 249, 0.82);
    line-height: 1.45;
    font-size: 0.96rem;
}

mark {
    padding: 0 0.18rem;
    border-radius: 4px;
    background: color-mix(in srgb, var(--gold) 28%, white);
    color: inherit;
}

.site-footer {
    position: relative;
    margin-top: auto;
    color: var(--hero-ink);
    isolation: isolate;
}

.site-footer::before {
    background: var(--footer-backdrop);
    border-top: 1px solid var(--header-border);
}

.site-footer-inner {
    padding: clamp(2rem, 5vw, 3rem) 0;
}

.site-footer h2 {
    font-size: clamp(1.35rem, 3vw, 2rem);
}

.site-footer p {
    max-width: 52rem;
    margin: 0.65rem 0 0;
    color: var(--hero-muted);
    font-size: 1.03rem;
}

@media (max-width: 1180px) {
    .site-header-top {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
        gap: 0.75rem;
    }

    .menu-toggle {
        display: inline-flex;
    }

    .main-nav {
        display: none;
        grid-column: 1 / -1;
        width: 100%;
        margin-left: 0;
        padding-top: 0.65rem;
        border-top: 1px solid var(--header-border);
    }

    .nav-open .main-nav {
        display: grid;
        gap: 0.45rem;
    }

    .main-nav a {
        width: 100%;
        min-height: 2.8rem;
        padding: 0.65rem 0.75rem;
        color: var(--header-ink);
        background: color-mix(in srgb, var(--surface) 82%, white);
        border: 1px solid var(--line);
        border-radius: 8px;
        font-size: 1rem;
    }

    .site-actions {
        grid-column: 1 / -1;
        width: 100%;
        justify-content: stretch;
    }

    .site-actions > * {
        flex: 1 1 0;
    }

    .theme-switcher select {
        width: 100%;
    }

    .page-shell {
        grid-template-columns: 1fr;
    }

    .side-panel {
        position: static;
    }
}

@media (max-width: 760px) {
    .site-main,
    .hero-inner,
    .page-title,
    .content-band,
    .article-header,
    .site-footer-inner {
        width: min(1120px, calc(100% - 1rem));
    }

    .hero {
        min-height: 20rem;
    }

    .directory-grid,
    .image-grid,
    .article-nav {
        grid-template-columns: 1fr;
    }

    .section-head,
    .search-panel-head,
    .search-toolbar,
    .hero-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .site-actions {
        flex-direction: column;
    }

    .site-actions > * {
        width: 100%;
    }

    .search-panel {
        width: calc(100% - 0.8rem);
        margin-top: 0.9rem;
    }
}
