:root {
    color-scheme: dark;
    font-family: Inter, "Segoe UI", Arial, sans-serif;
    --bg-1: #09070a;
    --bg-2: #1a0f14;
    --ink: #f5f7ff;
    --muted: #c9b59a;
    --line: rgba(184, 137, 75, 0.36);
    --card: rgba(27, 15, 20, 0.84);
    --accent: #6f1b2f;
    --accent-warm: #d8a251;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    background:
        radial-gradient(circle at 18% 12%, rgba(128, 49, 34, 0.28), transparent 36%),
        radial-gradient(circle at 46% 16%, rgba(111, 27, 47, 0.3), transparent 40%),
        linear-gradient(92deg, #231313 0%, #311717 36%, #3a231e 68%, #5a4132 100%);
}

.home-back {
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 20;
    display: inline-block;
    padding: 10px 14px;
    border-radius: 12px;
    border: 1px solid rgba(216, 162, 81, 0.5);
    background: rgba(35, 19, 19, 0.78);
    color: #f4d7a7;
    text-decoration: none;
    font-size: 14px;
    font-weight: 650;
    line-height: 1;
    backdrop-filter: blur(4px);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.32);
    transition: transform 160ms ease, background-color 160ms ease, border-color 160ms ease;
}

.home-back:hover,
.home-back:focus-visible {
    transform: translateY(-1px);
    background: rgba(53, 27, 24, 0.88);
    border-color: rgba(216, 162, 81, 0.8);
}

.home-back:focus-visible {
    outline: 2px solid rgba(216, 162, 81, 0.7);
    outline-offset: 2px;
}

.page-shell {
    width: min(1680px, calc(100% - 44px));
    margin: 0 auto;
    padding: 62px 0 40px;
}

.page-header {
    margin-bottom: 24px;
    padding: 0;
    border: none;
    background: none;
    box-shadow: none;
    backdrop-filter: none;
}

.page-title {
    margin: 0;
    font-size: clamp(32px, 3.8vw, 50px);
    line-height: 1.08;
    font-weight: 780;
    letter-spacing: 0;
}

.title-main {
    display: inline-block;
    color: #f2d5a4;
    text-shadow: 0 1px 0 rgba(52, 20, 16, 0.8), 0 8px 20px rgba(0, 0, 0, 0.32);
}

.title-main::after {
    content: "";
    display: block;
    margin-top: 8px;
    width: min(280px, 70%);
    height: 1px;
    background: rgba(216, 162, 81, 0.8);
    border-radius: 1px;
}

.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 16px;
    align-items: start;
}

.card-link {
    color: inherit;
    text-decoration: none;
    display: block;
}

.card {
    margin: 0;
    border-radius: 14px;
    overflow: hidden;
    border: 2px solid rgba(184, 137, 75, 0.62);
    background: var(--card);
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.4);
    transform: translateY(0);
    transition: transform 170ms ease, box-shadow 170ms ease, border-color 170ms ease;
}

.card-link:hover .card,
.card-link:focus-visible .card {
    transform: translateY(-8px);
    box-shadow: 0 18px 36px rgba(0, 0, 0, 0.55);
    border-color: rgba(216, 162, 81, 0.92);
}

.card-portrait {
    position: relative;
    overflow: hidden;
    background: #1e1218;
    aspect-ratio: 2 / 3;
}

.card-portrait::before {
    content: "";
    position: absolute;
    inset: 50% auto auto 50%;
    width: 26px;
    height: 26px;
    margin-left: -13px;
    margin-top: -13px;
    border-radius: 50%;
    border: 2px solid rgba(216, 162, 81, 0.2);
    border-top-color: rgba(216, 162, 81, 0.92);
    animation: card-spinner 0.75s linear infinite;
    opacity: 0;
    pointer-events: none;
    z-index: 2;
}

.card-portrait::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(24, 12, 14, 0.4), rgba(24, 12, 14, 0.28));
    opacity: 0;
    pointer-events: none;
    z-index: 1;
}

.card-portrait.is-loading::before,
.card-portrait.is-loading::after {
    opacity: 1;
}

.card img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    filter: brightness(0.92) saturate(0.96);
    transition: transform 220ms ease, filter 220ms ease;
}

@keyframes card-spinner {
    to {
        transform: rotate(360deg);
    }
}

.card-link:hover .card img,
.card-link:focus-visible .card img {
    transform: scale(1.05);
    filter: brightness(1) saturate(1.03);
}

.card-caption {
    position: relative;
    padding: 12px 13px 13px;
    min-height: 86px;
    border-top: 1px solid rgba(184, 137, 75, 0.36);
    background:
        linear-gradient(180deg, rgba(122, 31, 53, 0.28), rgba(122, 31, 53, 0)),
        rgba(23, 13, 18, 0.95);
}

.card-caption::before {
    content: "";
    position: absolute;
    inset: 0 auto auto 0;
    width: 100%;
    height: 2px;
    background: var(--accent-warm);
    opacity: 0.85;
}

.card-title {
    display: block;
    font-size: 17px;
    line-height: 1.2;
    font-weight: 750;
    color: #fff6e6;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    white-space: normal;
    overflow: hidden;
    text-overflow: ellipsis;
    min-height: calc(1.2em * 2);
}

.card-years {
    display: block;
    margin-top: 8px;
    font-size: 14px;
    color: #d6c7ae;
}

.card-link:focus-visible {
    outline: none;
}

.card-link:focus-visible .card {
    box-shadow: 0 0 0 3px rgba(216, 162, 81, 0.4), 0 18px 36px rgba(0, 0, 0, 0.55);
}

@media (max-width: 780px) {
    .home-back {
        top: 10px;
        left: 10px;
        padding: 9px 12px;
        font-size: 13px;
    }

    .page-shell {
        width: min(100% - 16px, 1680px);
        padding-top: 52px;
    }

    .page-header {
        margin-bottom: 16px;
        padding: 14px;
    }

    .gallery {
        grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
        gap: 10px;
    }

    .card-title {
        font-size: 15px;
        line-height: 1.2;
        min-height: calc(1.2em * 2);
    }

    .card-years {
        font-size: 13px;
    }
}
