:root {
    --bg: #101316;
    --panel: #171b1f;
    --panel-strong: #20262a;
    --line: rgba(236, 240, 242, 0.16);
    --text: #f5f7f8;
    --muted: #aab4b9;
    --accent: #1fbf9f;
    --accent-strong: #e34d4d;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Inter", "Segoe UI", sans-serif;
}

body {
    min-height: 100vh;
    color: var(--text);
    background: var(--bg);
}

body.is-locked {
    overflow: hidden;
}

.page-bg {
    position: fixed;
    inset: 0;
    z-index: -1;
    background:
        linear-gradient(135deg, rgba(31, 191, 159, 0.14), transparent 34%),
        linear-gradient(315deg, rgba(227, 77, 77, 0.13), transparent 38%),
        #101316;
}

.container {
    width: min(1180px, 94%);
    margin: 0 auto;
}

header {
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(16, 19, 22, 0.78);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
}

.logo {
    font-size: 1.2rem;
    font-weight: 700;
}

nav ul {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 12px;
}

nav a {
    color: var(--text);
    text-decoration: none;
    transition: all 0.3s ease;
    font-weight: 600;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    padding: 8px 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1;
}

nav a:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.16);
    transform: scale(1.05);
}

nav a:active {
    transform: scale(0.97);
}

nav a.active {
    background: #fff;
    color: #111;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    border-color: rgba(255, 255, 255, 0.9);
}

main {
    padding: 20px 0 34px;
}

.catalog-hero {
    background: rgba(23, 27, 31, 0.86);
    border: 1px solid var(--line);
    border-radius: 8px;
    text-align: center;
    padding: 26px;
    margin-bottom: 14px;
}

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

.catalog-hero h1 {
    font-size: clamp(1.8rem, 3vw, 2.6rem);
    margin-bottom: 8px;
}

.catalog-hero p:not(.eyebrow) {
    color: var(--muted);
    margin: 0 auto 16px;
    max-width: 620px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border-radius: 8px;
    text-decoration: none;
    color: #0d1112;
    font-weight: 800;
    background: var(--accent);
}

.catalog-grid {
    position: relative;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    perspective: 1200px;
}

.catalog-item {
    min-height: 420px;
    transition: opacity 0.28s ease, filter 0.28s ease;
}

.catalog-grid.has-active .catalog-item:not(.is-active) {
    opacity: 0.2;
    filter: blur(4px);
    pointer-events: none;
}

.card {
    position: relative;
    width: 100%;
    height: 420px;
    border-radius: 8px;
    cursor: pointer;
    perspective: 1200px;
    transition:
        transform 0.3s ease,
        box-shadow 0.3s ease,
        opacity 0.3s ease,
        width 0.5s ease,
        height 0.5s ease,
        top 0.5s ease,
        left 0.5s ease;
    z-index: 1;
    will-change: transform;
}

.card.previewing:not(.active) {
    transform: scale(1.05);
    z-index: 10;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.card.active {
    position: fixed;
    top: var(--start-top);
    left: var(--start-left);
    width: var(--start-width);
    height: var(--start-height);
    z-index: 1000;
    transform: translate(0, 0);
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.5);
    cursor: default;
}

.card.active.expanded {
    top: 50%;
    left: 50%;
    width: 80vw;
    height: 80vh;
    transform: translate(-50%, -50%);
}

.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 8px;
    transform-style: preserve-3d;
    transition: transform 0.8s ease;
}

.card.active.flipped .card-inner {
    transform: rotateY(-180deg);
}

.card-front,
.card-back {
    position: absolute;
    inset: 0;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    backface-visibility: hidden;
}

.card-front img,
.card-front video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-front video {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.card.previewing .card-front video,
.card.active .card-front video {
    opacity: 1;
}

.card-front::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 26%, rgba(0, 0, 0, 0.84) 100%);
}

.front-copy {
    position: absolute;
    left: 18px;
    right: 18px;
    bottom: 18px;
    z-index: 1;
    display: grid;
    gap: 8px;
}

.front-copy span,
.card-kicker {
    color: var(--accent);
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0;
}

.front-copy h3,
.card-back h3 {
    font-size: clamp(1.25rem, 2.2vw, 2.1rem);
    line-height: 1.12;
}

.front-copy p,
.card-back p,
.card-back li {
    color: rgba(245, 247, 248, 0.84);
    line-height: 1.55;
}

.card-back {
    transform: rotateY(180deg);
    padding: clamp(22px, 5vw, 60px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 16px;
    background:
        linear-gradient(135deg, rgba(31, 191, 159, 0.12), transparent 36%),
        linear-gradient(315deg, rgba(227, 77, 77, 0.14), transparent 42%),
        var(--panel-strong);
}

.card-back ul {
    display: grid;
    gap: 10px;
    padding-left: 20px;
    max-width: 720px;
}

.close-card {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 3;
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.34);
    color: #fff;
    cursor: pointer;
    font-weight: 800;
    padding: 10px 14px;
}

.close-card:hover {
    background: var(--accent-strong);
}

.catalog-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.35s ease;
    z-index: 900;
    pointer-events: none;
}

.catalog-overlay.visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

@media (prefers-reduced-motion: reduce) {
    .card,
    .card-inner,
    .card-front video,
    .catalog-item,
    .catalog-overlay {
        transition: none;
    }
}

@media (hover: none), (pointer: coarse) {
    .card.previewing:not(.active) {
        transform: none;
        box-shadow: none;
    }
}

@media (max-width: 980px) {
    .catalog-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    nav {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    nav ul {
        flex-wrap: wrap;
    }

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

    .catalog-item {
        min-height: 380px;
    }

    .card {
        height: 380px;
    }

    .card.active {
        width: 92vw;
        height: 82vh;
    }

    .card-back {
        justify-content: flex-start;
        overflow: auto;
        padding-top: 72px;
    }
}
