* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body.study-page {
    margin: 0;
    min-height: 100vh;
    background: #111;
    color: #f2f2f2;
    font-family: Arial, Helvetica, sans-serif;
    line-height: 1.65;
}

:root {
    --study-accent: #f2d394;
}

.study-page strong,
.study-page b,
.study-page em,
.study-page .study-term,
.study-page .study-date {
    color: var(--study-accent);
}

.study-page .study-term,
.study-page .study-date {
    font-weight: 700;
}

a[href^="http://"]:link,
a[href^="http://"]:visited,
a[href^="https://"]:link,
a[href^="https://"]:visited {
    color: #d8bd82;
}

a[href^="http://"]:hover,
a[href^="https://"]:hover {
    color: #f0d99f;
}

.source-register-link {
    display: inline-block;
    margin: 20px 0 0;
    color: #9c927e;
    font-size: 12px;
    text-decoration: none;
}

.source-register-link:hover,
.source-register-link:focus-visible {
    color: #d8bd82;
    text-decoration: underline;
}

.study-shell {
    width: min(1040px, calc(100% - 40px));
    margin: 0 auto;
    padding: 26px 0 72px;
}

.study-back {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    margin-bottom: 22px;
    color: #aaa;
    text-decoration: none;
    font-size: 14px;
    transition: color .2s ease;
}

.study-back:hover,
.study-back:focus-visible {
    color: #fff;
}

.map-shortcut {
    margin: 16px 0 22px;
    text-align: center;
}

.map-shortcut a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 10px 16px;
    border: 1px solid rgba(216, 189, 130, .62);
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(216, 189, 130, .18), rgba(216, 189, 130, .08));
    color: #e7d09a;
    text-decoration: none;
    font-size: 14px;
    font-weight: 700;
    box-shadow: 0 5px 18px rgba(0, 0, 0, .2);
    transition: background .2s ease, border-color .2s ease, transform .2s ease;
}

.map-shortcut a:hover,
.map-shortcut a:focus-visible {
    border-color: #e4ca8b;
    background: rgba(216, 189, 130, .2);
    transform: translateY(-1px);
}

.study-hero {
    position: relative;
    min-height: 300px;
    display: flex;
    align-items: flex-end;
    overflow: hidden;
    border: 1px solid #303030;
    border-radius: 18px;
    background: #1a1a1a;
}

.study-hero img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: .5;
}

.study-hero::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0,0,0,.08) 10%, rgba(0,0,0,.86) 100%);
}

.study-hero-copy {
    position: relative;
    z-index: 1;
    max-width: 790px;
    padding: 34px 38px;
}

.study-kicker {
    margin: 0 0 7px;
    color: #d1b985;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .14em;
    text-transform: uppercase;
}

.study-hero h1 {
    margin: 0;
    font-size: clamp(32px, 5vw, 52px);
    line-height: 1.08;
    letter-spacing: -.035em;
}

.study-period {
    display: inline-block;
    margin-top: 15px;
    color: #d0d0d0;
    font-size: 14px;
}

.study-intro {
    margin: 22px 0 34px;
    padding: 19px 22px;
    border: 1px solid #2c2c2c;
    border-radius: 14px;
    background: #171717;
    color: #d1d1d1;
}

.study-intro p,
.study-block p {
    margin: 0 0 12px;
}

.study-intro p:last-child,
.study-block p:last-child {
    margin-bottom: 0;
}

.study-section-title {
    margin: 36px 0 16px;
    font-size: 25px;
    line-height: 1.2;
    letter-spacing: -.02em;
}

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

.study-block {
    min-width: 0;
    padding: 22px;
    border: 1px solid #2d2d2d;
    border-radius: 14px;
    background: linear-gradient(145deg, #1b1b1b, #151515);
}

.study-block h2,
.study-block h3 {
    margin: 0 0 12px;
    font-size: 19px;
    line-height: 1.3;
}

.study-block h3 {
    font-size: 16px;
}

.study-block ul,
.study-block ol {
    margin: 0;
    padding-left: 20px;
    color: #d0d0d0;
}

.study-toc ol {
    columns: 2;
    column-gap: 38px;
}

.study-toc li {
    break-inside: avoid;
}

.study-toc a {
    color: #e6d2a3;
    text-decoration: none;
}

.study-toc a:hover,
.study-toc a:focus-visible {
    color: #fff;
    text-decoration: underline;
}

.study-block li + li {
    margin-top: 6px;
}

.study-wide {
    grid-column: 1 / -1;
}

.study-term {
    color: var(--study-accent);
    font-weight: 700;
}

.study-date {
    color: var(--study-accent);
    font-weight: 700;
    white-space: nowrap;
}

.study-callout {
    margin: 18px 0 0;
    padding: 15px 18px;
    border-left: 3px solid #b79b63;
    border-radius: 0 10px 10px 0;
    background: #20201e;
    color: #e1dfd8;
}

.study-table-wrap {
    overflow-x: auto;
    border: 1px solid #303030;
    border-radius: 12px;
}

.study-table {
    width: 100%;
    border-collapse: collapse;
    background: #171717;
    font-size: 14px;
}

.study-table th,
.study-table td {
    padding: 13px 15px;
    border-bottom: 1px solid #303030;
    text-align: left;
    vertical-align: top;
}

.study-table th {
    color: #e6d2a3;
    font-size: 12px;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.study-table tr:last-child td {
    border-bottom: 0;
}

.study-figure {
    margin: 18px 0;
    padding: 12px;
    border: 1px solid #303030;
    border-radius: 14px;
    background: #171717;
}

.study-figure img {
    display: block;
    width: 100%;
    max-height: 680px;
    object-fit: contain;
    border-radius: 8px;
    background: #101010;
}

.study-figure figcaption {
    margin: 10px 4px 2px;
    color: #aaa;
    font-size: 13px;
}

.study-figure-grid .study-figure {
    margin: 0;
}

.study-figure-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin: 18px 0;
}

.study-figure-grid .study-figure img {
    max-height: 340px;
}

.study-subtitle {
    margin: 24px 0 8px;
    font-size: 21px;
    line-height: 1.3;
}

@media (max-width: 700px) {
    .study-figure-grid {
        grid-template-columns: 1fr;
    }
}

.study-region {
    --region-color: #d1b985;
    --region-tint: rgba(209, 185, 133, .10);
    margin: 34px 0;
    padding: 22px;
    border: 1px solid var(--region-color);
    border-left-width: 6px;
    border-radius: 16px;
    background: linear-gradient(115deg, var(--region-tint), #151515 52%);
}

.region-novgorod {
    --region-color: #77c9e8;
    --region-tint: rgba(64, 155, 190, .15);
}

.region-vladimir {
    --region-color: #d4ad69;
    --region-tint: rgba(174, 121, 49, .15);
}

.region-galicia {
    --region-color: #bba0df;
    --region-tint: rgba(126, 89, 174, .16);
}

.region-horde {
    --region-color: #e7a06a;
    --region-tint: rgba(190, 99, 48, .15);
}

.region-moscow {
    --region-color: #d89bb4;
    --region-tint: rgba(161, 77, 111, .15);
}

.region-lithuania {
    --region-color: #9ebf8a;
    --region-tint: rgba(88, 134, 72, .15);
}

.study-region-title {
    margin: 0 0 18px;
    padding: 0 0 12px;
    border-bottom: 1px solid rgba(255, 255, 255, .2);
    color: var(--region-color);
    font-size: clamp(22px, 3vw, 29px);
    line-height: 1.2;
}

.study-region .study-grid {
    gap: 14px;
}

.lithuanian-context {
    margin: 0 0 16px;
}

.lithuanian-rulers {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 12px;
    margin: 18px 0;
}

.lithuanian-rulers figure {
    min-width: 0;
    margin: 0;
    overflow: hidden;
    border: 1px solid #5a4a21;
    border-radius: 12px;
    background: #222;
}

.lithuanian-rulers img {
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    object-position: top center;
}

.lithuanian-rulers figcaption {
    display: grid;
    gap: 7px;
    padding: 12px;
    color: #d0d0d0;
    font-size: 13px;
    line-height: 1.45;
}

.lithuanian-rulers figcaption strong {
    color: #f1d47f;
    font-size: 14px;
}

.lithuanian-note {
    margin: 0;
    color: #c5c5c5;
    font-size: 14px;
}

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

.study-timeline article {
    padding: 15px 16px;
    border: 1px solid #2d2d2d;
    border-radius: 12px;
    background: #171717;
}

.study-timeline p {
    margin: 5px 0 0;
    color: #c8c8c8;
    font-size: 14px;
}

.study-footer {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid #2b2b2b;
}

.study-footer a {
    color: #d4c08f;
    text-decoration: none;
}

.study-footer a:hover,
.study-footer a:focus-visible {
    color: #fff;
    text-decoration: underline;
}

.study-note {
    color: #919191;
    font-size: 13px;
}

@media (max-width: 680px) {
    .study-shell {
        width: min(100% - 26px, 560px);
        padding-top: 18px;
    }

    .study-hero {
        min-height: 250px;
    }

    .study-hero-copy {
        padding: 25px 22px;
    }

    .study-grid,
    .study-timeline,
    .lithuanian-rulers {
        grid-template-columns: 1fr;
    }

    .study-toc ol {
        columns: 1;
    }

    .study-wide {
        grid-column: auto;
    }

    .study-section-title {
        font-size: 22px;
    }

    .study-block {
        padding: 19px;
    }

    .study-footer {
        flex-direction: column;
    }
}
