:root {
    --bg: #08203d;
    --bg-soft: #0d315d;
    --panel: #f8fbff;
    --panel-strong: #ffffff;
    --text: #132033;
    --muted: #64748b;
    --line: #d8e3f0;
    --brand: #0f5fa8;
    --brand-dark: #083b72;
    --accent: #19a7ce;
    --accent-soft: #d9f3fb;
    --chip: #e8f2ff;
    --shadow: 0 24px 80px rgba(0, 0, 0, 0.25);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    min-height: 100%;
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.6;
}

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

a:hover,
a:focus {
    color: var(--brand-dark);
    text-decoration: underline;
}

img {
    max-width: 100%;
}

.skip-link {
    position: absolute;
    left: -999px;
    top: 12px;
    z-index: 100;
    padding: 8px 12px;
    background: var(--panel-strong);
    color: var(--brand-dark);
}

.skip-link:focus {
    left: 12px;
}

.site-shell {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    gap: 28px;
    max-width: 1360px;
    min-height: 100vh;
    margin: 0 auto;
    padding: 28px;
}

.site-sidebar {
    position: sticky;
    top: 28px;
    align-self: start;
    min-height: calc(100vh - 56px);
    padding: 28px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(13, 49, 93, 0.96), rgba(8, 32, 61, 0.96));
    color: #e5f2ff;
    box-shadow: var(--shadow);
}

.profile {
    display: block;
    color: #ffffff;
    text-align: center;
}

.profile:hover {
    color: #ffffff;
    text-decoration: none;
}

.profile-photo {
    display: block;
    width: 112px;
    height: 112px;
    margin: 0 auto;
    object-fit: cover;
    border: 3px solid rgba(255, 255, 255, 0.32);
    border-radius: 999px;
    background: #ffffff;
}

.profile-name {
    display: block;
    margin-top: 18px;
    font-size: 1.45rem;
    font-weight: 760;
    line-height: 1.2;
}

.profile-title,
.profile-affiliation {
    display: block;
    color: #bdd7f0;
    text-align: center;
}

.profile-title {
    margin-top: 6px;
    font-size: 0.98rem;
}

.profile-affiliation {
    margin: 18px 0 0;
}

.sidebar-section {
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.16);
}

.sidebar-section h2 {
    margin: 0 0 12px;
    color: #ffffff;
    font-size: 0.82rem;
    letter-spacing: 0;
    text-transform: uppercase;
}

.sidebar-links {
    margin: 0;
    padding: 0;
    list-style: none;
}

.sidebar-links li + li {
    margin-top: 8px;
}

.sidebar-links a {
    color: #dbf7ff;
}

.site-main {
    min-width: 0;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 18px;
    padding: 10px 4px;
    color: #ffffff;
}

.language-switcher {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
}

.language-switcher a {
    display: inline-flex;
    width: 34px;
    height: 34px;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    font-size: 1.1rem;
}

.language-switcher a:hover,
.language-switcher a:focus {
    background: rgba(255, 255, 255, 0.16);
    text-decoration: none;
}

.book-qa-chat {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 80;
    width: min(440px, calc(100vw - 32px));
    color: var(--text);
}

.book-qa-chat__toggle,
.book-qa-chat__send,
.book-qa-chat__expand,
.book-qa-chat__close {
    font: inherit;
    cursor: pointer;
}

.book-qa-chat__toggle {
    display: block;
    margin-left: auto;
    padding: 12px 18px;
    border: 1px solid rgba(255, 255, 255, 0.24);
    border-radius: 8px;
    background: var(--accent);
    color: #ffffff;
    box-shadow: 0 16px 44px rgba(0, 0, 0, 0.28);
    font-weight: 740;
}

.book-qa-chat__toggle:hover,
.book-qa-chat__toggle:focus {
    background: #1389aa;
}

.book-qa-chat__panel {
    position: absolute;
    right: 0;
    bottom: calc(100% + 12px);
    width: min(520px, calc(100vw - 32px));
    max-height: calc(100vh - 120px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel-strong);
    box-shadow: 0 18px 70px rgba(0, 0, 0, 0.32);
}

.book-qa-chat__panel[hidden] {
    display: none;
}

.book-qa-chat__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
    background: var(--panel);
}

.book-qa-chat__header h2 {
    margin: 0;
    font-size: 1rem;
    line-height: 1.25;
}

.book-qa-chat__header p {
    margin: 3px 0 0;
    color: var(--muted);
    font-size: 0.82rem;
    line-height: 1.35;
}

.book-qa-chat__header-actions {
    display: flex;
    flex: 0 0 auto;
    gap: 8px;
}

.book-qa-chat__expand,
.book-qa-chat__close {
    flex: 0 0 auto;
    width: 32px;
    height: 32px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    color: var(--muted);
    font-size: 1.35rem;
    line-height: 1;
}

.book-qa-chat__expand {
    font-size: 1rem;
}

.book-qa-chat--expanded {
    inset: 24px;
    width: auto;
}

.book-qa-chat--expanded .book-qa-chat__toggle {
    display: none;
}

.book-qa-chat--expanded .book-qa-chat__panel {
    position: fixed;
    inset: 24px;
    width: auto;
    max-height: none;
}

.book-qa-chat--expanded .book-qa-chat__messages {
    min-height: 0;
    max-height: none;
}

.book-qa-chat__messages {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 10px;
    min-height: 300px;
    max-height: min(60vh, 540px);
    overflow-y: auto;
    padding: 16px;
    background: #eef6fb;
}

.book-qa-chat__message {
    max-width: 92%;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    font-size: 0.92rem;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.book-qa-chat__message p {
    margin: 0;
}

.book-qa-chat__message--user {
    align-self: flex-end;
    border-color: #c7e9f3;
    background: var(--accent-soft);
}

.book-qa-chat__message--bot,
.book-qa-chat__message--status {
    align-self: flex-start;
}

.book-qa-chat__message--status {
    color: var(--muted);
}

.book-qa-chat__form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    padding: 12px;
    border-top: 1px solid var(--line);
    background: #ffffff;
}

.book-qa-chat__input {
    width: 100%;
    min-height: 56px;
    max-height: 150px;
    resize: vertical;
    padding: 9px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--text);
    font: inherit;
    line-height: 1.35;
}

.book-qa-chat__input:focus {
    border-color: var(--accent);
    outline: 2px solid rgba(25, 167, 206, 0.22);
}

.book-qa-chat__send {
    align-self: end;
    min-height: 56px;
    padding: 0 14px;
    border: 1px solid var(--brand);
    border-radius: 8px;
    background: var(--brand);
    color: #ffffff;
    font-weight: 720;
}

.book-qa-chat__send:disabled,
.book-qa-chat__input:disabled {
    cursor: wait;
    opacity: 0.72;
}

.site-name {
    color: #ffffff;
    font-size: 1.42rem;
    font-weight: 750;
    line-height: 1.15;
}

.site-name:hover {
    color: #ffffff;
}

.topnav {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.topnav a {
    padding: 7px 10px;
    border-radius: 8px;
    color: #d9ecff;
    font-size: 0.94rem;
}

.topnav a:hover,
.topnav a:focus {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    text-decoration: none;
}

.content-panel {
    min-height: calc(100vh - 140px);
    padding: 38px;
    border-radius: 22px;
    background: var(--panel);
    box-shadow: var(--shadow);
}

.site-footer {
    padding: 18px 4px 0;
    color: #bdd7f0;
    font-size: 0.86rem;
}

.hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 220px;
    gap: 34px;
    align-items: center;
    padding-bottom: 28px;
    border-bottom: 1px solid var(--line);
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--brand);
    font-size: 0.8rem;
    font-weight: 760;
    letter-spacing: 0;
    text-transform: uppercase;
}

.hero h1,
.page-title h1 {
    margin: 0;
    color: #07182d;
    font-size: clamp(2rem, 4vw, 3.4rem);
    line-height: 1.08;
    letter-spacing: 0;
}

.lead {
    max-width: 760px;
    color: #334155;
    font-size: 1.05rem;
}

.lead p {
    margin: 14px 0 0;
}

.hero-photo {
    width: 220px;
    max-height: 210px;
    object-fit: contain;
    border-radius: 18px;
    padding: 18px;
    background: #ffffff;
    box-shadow: 0 14px 35px rgba(8, 32, 61, 0.18);
}

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

.quick-card {
    display: flex;
    min-height: 128px;
    flex-direction: column;
    justify-content: space-between;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--panel-strong);
    color: var(--text);
}

.quick-card:hover,
.quick-card:focus {
    border-color: var(--accent);
    text-decoration: none;
    transform: translateY(-1px);
}

.quick-card span {
    color: var(--brand);
    font-size: 0.76rem;
    font-weight: 760;
    text-transform: uppercase;
}

.quick-card strong {
    display: block;
    margin-top: 12px;
    font-size: 1.08rem;
}

.quick-card small {
    display: block;
    margin-top: 8px;
    color: var(--muted);
}

.section-block {
    margin-top: 34px;
}

.section-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 12px;
}

.section-heading h2,
.article-content h2,
.article-content h3 {
    color: #0b2545;
    letter-spacing: 0;
}

.section-heading h2 {
    margin: 0;
    font-size: 1.35rem;
}

.compact-list {
    display: grid;
    gap: 10px;
}

.compact-list article {
    padding: 16px 0;
    border-bottom: 1px solid var(--line);
}

.compact-list time {
    display: block;
    color: var(--muted);
    font-size: 0.84rem;
}

.compact-list a {
    font-size: 1.05rem;
    font-weight: 720;
}

.compact-list p {
    margin: 6px 0 0;
    color: var(--muted);
}

.page-layout {
    max-width: 940px;
    margin: 0 auto;
}

.page-title {
    margin-bottom: 28px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--line);
}

.page-title time {
    display: inline-block;
    margin-top: 12px;
    color: var(--muted);
    font-size: 0.9rem;
}

.article-content {
    color: var(--text);
}

.article-content p {
    margin: 1rem 0;
}

.article-content ul,
.article-content ol {
    padding-left: 1.4rem;
}

.article-content li + li {
    margin-top: 0.32rem;
}

.article-content table,
.data-table {
    width: 100%;
    margin: 1.2rem 0 1.8rem;
    border-collapse: collapse;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--panel-strong);
    font-size: 0.95rem;
}

.article-content thead,
.data-table thead {
    background: var(--brand-dark);
    color: #ffffff;
}

.article-content th,
.article-content td,
.data-table th,
.data-table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

.article-content tbody tr:nth-child(even),
.data-table tbody tr:nth-child(even) {
    background: #f1f7ff;
}

.article-content tbody tr:last-child td,
.data-table tbody tr:last-child td {
    border-bottom: 0;
}

.badge,
.article-content code.badge {
    display: inline-block;
    padding: 2px 8px;
    border: 1px solid #b9d8f7;
    border-radius: 999px;
    background: var(--chip);
    color: var(--brand-dark);
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 700;
}

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag-list span,
.tag-list a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 9px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.09);
    color: #e5f2ff;
    font-size: 0.84rem;
}

.tag-list-large a {
    border-color: var(--line);
    background: var(--panel-strong);
    color: var(--brand);
}

.search-box {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.search-box input {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    font: inherit;
}

.search-box button {
    min-height: 44px;
    padding: 10px 18px;
    border: 0;
    border-radius: 10px;
    background: var(--brand);
    color: #ffffff;
    font: inherit;
    font-weight: 720;
    cursor: pointer;
}

.search-results {
    display: grid;
    gap: 14px;
}

.search-result {
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--panel-strong);
}

.search-result a {
    font-size: 1.06rem;
    font-weight: 760;
}

.search-result p {
    margin: 6px 0 0;
    color: var(--muted);
}

@media (max-width: 980px) {
    .site-shell {
        grid-template-columns: 1fr;
        padding: 18px;
    }

    .site-sidebar {
        position: static;
        min-height: 0;
    }

    .topbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .topnav {
        justify-content: flex-start;
    }
}

@media (max-width: 680px) {
    .content-panel {
        padding: 22px;
        border-radius: 16px;
    }

    .hero {
        grid-template-columns: 1fr;
    }

    .hero-photo {
        width: 112px;
    }

    .quick-grid {
        grid-template-columns: 1fr;
    }

    .article-content {
        overflow-x: auto;
    }

    .article-content table,
    .data-table {
        min-width: 620px;
    }

    .search-box {
        flex-direction: column;
    }

    .book-qa-chat {
        right: 12px;
        bottom: 12px;
        width: calc(100vw - 24px);
    }

    .book-qa-chat__panel {
        width: calc(100vw - 24px);
        max-height: calc(100vh - 96px);
    }

    .book-qa-chat__messages {
        min-height: 240px;
        max-height: 52vh;
    }

    .book-qa-chat__form {
        grid-template-columns: 1fr;
    }

    .book-qa-chat__send {
        width: 100%;
    }

    .book-qa-chat--expanded {
        inset: 12px;
    }

    .book-qa-chat--expanded .book-qa-chat__panel {
        inset: 12px;
        width: auto;
        max-height: none;
    }
}
