/* =========================
   ОСНОВНЫЕ НАСТРОЙКИ
   ========================= */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: #111;
    color: white;

    font-family: Arial, sans-serif;

    overflow-x: hidden;
}

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

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

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: block;
    margin: 26px auto 0;
    color: rgba(255, 255, 255, .42);
    font-size: 12px;
    text-align: center;
    text-decoration: none;
}

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


/* =========================
   СТРАНИЦА
   ========================= */

.topics-page {
    min-height: 100vh;

    background:
        linear-gradient(
            135deg,
            #1c1c1c 0%,
            #111 55%,
            #0d0d0d 100%
        );

    padding: 70px 40px 80px;
}


/* =========================
   КОНТЕЙНЕР
   ========================= */

.topics-container {
    width: 100%;
    max-width: 1100px;

    margin: 0 auto;
}


/* =========================
   ЗАГОЛОВОК
   ========================= */

.topics-container h1 {
    text-align: center;

    font-size: 48px;

    font-weight: 700;

    letter-spacing: -0.02em;

    margin-bottom: 8px;
}


/* =========================
   ПОДЗАГОЛОВОК
   ========================= */

.subtitle {
    text-align: center;

    font-size: 17px;

    color: rgba(255, 255, 255, 0.58);

    margin-bottom: 48px;
}

.map-shortcut {
    margin: 18px 0 24px;
    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-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 {
    background: rgba(216, 189, 130, .2);
    border-color: #e4ca8b;
    transform: translateY(-1px);
}


/* =========================
   СЕТКА КАРТОЧЕК
   ========================= */

.topics-grid {
    display: grid;

    grid-template-columns: repeat(2, 1fr);

    gap: 16px;
}


/* =========================
   КАРТОЧКА
   ========================= */

.topic-card {

    text-decoration: none;

    color: inherit;

    display: block;
    
    position: relative;

    height: 250px;



    overflow: hidden;

    border-radius: 16px;

    border: 1px solid rgba(255, 255, 255, 0.13);

    cursor: pointer;

    background: #1a1a1a;

    transition:
        transform 0.35s ease,
        border-color 0.35s ease,
        box-shadow 0.35s ease;
}


/* =========================
   ФОТО
   ========================= */

.topic-card img {
    position: absolute;

    inset: 0;

    width: 100%;
    height: 100%;

    object-fit: cover;

    /*
       Немного увеличиваем исходное фото,
       чтобы при hover не появились пустые края.
    */
    transform: scale(1.01);

    transition:
        transform 0.6s ease;
}


/* =========================
   НИЖНЕЕ ЗАТЕМНЕНИЕ
   ========================= */

.card-overlay {
    position: absolute;

    inset: 0;

    /*
       Верх практически не затемняется.
       Затемнение постепенно усиливается
       к нижней части карточки.
    */

    background:
        linear-gradient(
            to bottom,
            rgba(0, 0, 0, 0.02) 35%,
            rgba(0, 0, 0, 0.12) 52%,
            rgba(0, 0, 0, 0.55) 75%,
            rgba(0, 0, 0, 0.88) 100%
        );

    pointer-events: none;
}


/* =========================
   НОМЕР
   ========================= */

.topic-number {
    position: absolute;

    top: 18px;
    right: 20px;

    z-index: 2;

    font-size: 12px;

    color: rgba(255, 255, 255, 0.55);

    letter-spacing: 0.04em;
}


/* =========================
   НАЗВАНИЕ
   ========================= */

.topic-card h2 {
    position: absolute;

    left: 0;
    right: 0;

    bottom: 25px;

    z-index: 2;

    text-align: center;

    font-size: 27px;

    font-weight: 500;

    color: white;

    text-shadow:
        0 2px 12px rgba(0, 0, 0, 0.65);
}


/* =========================
   НАВЕДЕНИЕ
   ========================= */

.topic-card:hover {
    transform: scale(1.025);

    border-color:
        rgba(255, 255, 255, 0.28);

    box-shadow:
        0 18px 45px rgba(0, 0, 0, 0.35);
}


.topic-card:hover img {
    transform: scale(1.055);
}


/* =========================
   ПОСЛЕДНЯЯ КАРТОЧКА
   ========================= */

.topic-card:last-child {
    grid-column: 1 / -1;
}


/* =========================
   АДАПТАЦИЯ
   ========================= */

@media (max-width: 800px) {

    .topics-page {
        padding: 50px 20px 60px;
    }

    .topics-container h1 {
        font-size: 38px;
    }

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

    .topic-card:last-child {
        grid-column: auto;
    }
}


@media (max-width: 500px) {

    .topic-card {
        height: 220px;
    }

    .topic-card h2 {
        font-size: 23px;

        bottom: 22px;
    }

    .topics-container h1 {
        font-size: 32px;
    }

    .subtitle {
        font-size: 15px;

        margin-bottom: 35px;
    }
}

/* =========================
   ПЕРЕХОД МЕЖДУ СТРАНИЦАМИ
   ========================= */

.page-transition {
    position: fixed;

    inset: 0;

    z-index: 9999;

    background: rgba(0, 0, 0, 0.35);

    backdrop-filter: blur(0px);

    opacity: 1;

    pointer-events: none;

    transition:
        opacity 0.35s ease,
        backdrop-filter 0.35s ease;
}


body.page-loaded .page-transition {
    opacity: 0;

    backdrop-filter: blur(0px);
}


body.page-leaving .page-transition {
    opacity: 1;

    backdrop-filter: blur(10px);
}

/* A broad, even veil keeps the Moscow card image clear without a dark band at its foot. */
.moscow-topic .card-overlay {
    background:
        linear-gradient(112deg, rgba(0, 0, 0, 0.34), rgba(0, 0, 0, 0.08) 58%, rgba(0, 0, 0, 0.29)),
        linear-gradient(to bottom, rgba(0, 0, 0, 0.04) 25%, rgba(0, 0, 0, 0.55) 100%);
}

/* Subtopic cards for the Imperial Russia and Soviet Union sections. */
.subject-card {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 24px;
    background:
        radial-gradient(ellipse at 20% 15%, rgba(255, 255, 255, 0.12), transparent 48%),
        linear-gradient(135deg, #34302b, #171717 72%);
}

.subject-card:nth-child(4n + 2) {
    background:
        radial-gradient(ellipse at 80% 20%, rgba(255, 255, 255, 0.11), transparent 45%),
        linear-gradient(135deg, #3d3429, #171717 72%);
}

.subject-card:nth-child(4n + 3) {
    background:
        radial-gradient(ellipse at 15% 75%, rgba(255, 255, 255, 0.10), transparent 48%),
        linear-gradient(135deg, #2e3437, #171717 72%);
}

.subject-card:nth-child(4n) {
    background:
        radial-gradient(ellipse at 85% 75%, rgba(255, 255, 255, 0.10), transparent 45%),
        linear-gradient(135deg, #3a3034, #171717 72%);
}

.subject-card h2 {
    position: relative;
    inset: auto;
    margin: 0 0 6px;
    text-align: left;
}

.subject-card .subject-caption {
    position: relative;
    z-index: 2;
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    line-height: 1.45;
}

.subject-card .topic-number {
    color: rgba(255, 255, 255, 0.48);
}

.section-return {
    display: inline-block;
    margin-bottom: 34px;
    color: rgba(255, 255, 255, 0.68);
    text-decoration: none;
}

.section-return:hover,
.section-return:focus-visible {
    color: #fff;
    text-decoration: underline;
}
