.gallery-page {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: #0a0e0f;
    color: var(--white);
}

.gallery-hero {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    padding: 150px clamp(24px, 7vw, 96px) 48px;
    background:
        linear-gradient(to bottom, transparent 40%, #0a0e0f 100%),
        radial-gradient(ellipse at 82% 18%, rgba(0, 171, 162, 0.18), transparent 34rem),
        linear-gradient(145deg, #121719 0%, #090c0e 60%, #111719 100%);
}

.gallery-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background:
        radial-gradient(circle, rgba(102, 206, 200, 0.16) 1px, transparent 1.5px),
        repeating-linear-gradient(132deg, transparent 0 112px, rgba(164, 222, 219, 0.035) 113px 114px, transparent 115px 190px);
    background-size: 24px 24px, auto;
    mask-image: linear-gradient(to bottom, #000 0%, rgba(0, 0, 0, 0.5) 65%, transparent 100%);
    pointer-events: none;
}

.gallery-hero .container,
.gallery-section .container {
    width: min(100%, 1240px);
    max-width: 1240px;
    margin: 0 auto;
}

.gallery-kicker {
    margin: 0 0 12px;
    color: #54cbc3;
    font-family: 'Montserrat', system-ui, -apple-system, "Segoe UI", sans-serif;
    font-size: 0.72rem;
    font-weight: 800;
    line-height: 1.5;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.gallery-hero h1 {
    max-width: 24ch;
    margin: 0;
    color: #f7f9f9;
    font-family: 'Korataki', system-ui, sans-serif;
    font-size: 2.5rem;
    font-weight: 800;
    line-height: 1.05;
    letter-spacing: -0.05em;
    overflow-wrap: normal;
    word-break: normal;
}

.gallery-hero .hero-subtitle {
    margin: 20px 0 0;
    color: rgba(235, 243, 243, 0.74);
    font-family: 'Montserrat', system-ui, -apple-system, "Segoe UI", sans-serif;
    font-size: clamp(1rem, 1.6vw, 1.15rem);
    font-weight: 500;
    line-height: 1.7;
}

.gallery-section {
    flex: 1;
    padding: 20px clamp(20px, 5vw, 72px) 100px;
}

.gallery-folder-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: clamp(16px, 2vw, 26px);
}

.gallery-folder-card {
    display: block;
    min-width: 0;
    color: var(--white);
    text-decoration: none;
}

.gallery-folder-visual {
    position: relative;
    isolation: isolate;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: #172022;
}

.gallery-folder-visual::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, transparent 35%, rgba(5, 12, 13, 0.88) 100%);
    pointer-events: none;
}

.gallery-folder-visual img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.gallery-folder-card:hover img,
.gallery-folder-card:focus-visible img {
    transform: scale(1.035);
}

.gallery-folder-meta {
    position: absolute;
    z-index: 1;
    right: 0;
    bottom: 0;
    left: 0;
    padding: clamp(18px, 2.5vw, 28px);
    font-family: 'Montserrat', system-ui, -apple-system, "Segoe UI", sans-serif;
}

.gallery-folder-meta p {
    margin: 0 0 6px;
    color: #7de1da;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.gallery-folder-meta h2 {
    margin: 0;
    font-family: 'Montserrat', system-ui, -apple-system, "Segoe UI", sans-serif;
    font-size: clamp(1.1rem, 1.8vw, 1.6rem);
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: -0.02em;
    overflow-wrap: normal;
    word-break: normal;
    font-size: clamp(0.95rem, 4vw, 1.25rem);
}

.gallery-folder-meta > span {
    display: inline-block;
    margin-top: 12px;
    color: rgba(255, 255, 255, 0.82);
    font-size: 0.75rem;
    font-weight: 600;
}

.gallery-folder-meta > span span {
    margin-left: 4px;
    color: #7de1da;
}

.gallery-folder-card:focus-visible,
.gallery-image-card:focus-visible,
.gallery-back-link:focus-visible,
.gallery-modal button:focus-visible {
    outline: 2px solid #54cbc3;
    outline-offset: 4px;
}

.gallery-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 28px;
    font-family: 'Montserrat', system-ui, -apple-system, "Segoe UI", sans-serif;
}

.gallery-back-link {
    display: inline-block;
    padding: 10px 0;
    color: #7de1da;
    font-size: 0.85rem;
    font-weight: 700;
    text-decoration: none;
}

.gallery-back-link::before {
    content: "←";
    margin-right: 10px;
}

.gallery-back-link:hover {
    color: var(--white);
}

.gallery-toolbar .gallery-folder-meta {
    position: static;
    padding: 0;
    color: rgba(235, 243, 243, 0.65);
    font-size: 0.85rem;
}

.gallery-detail-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.gallery-image-card {
    display: block;
    width: 100%;
    padding: 0;
    overflow: hidden;
    border: 0;
    background: #172022;
    cursor: pointer;
}

.gallery-image-card img {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.gallery-image-card:hover img,
.gallery-image-card:focus-visible img {
    transform: scale(1.035);
}

.gallery-empty {
    padding: 44px 24px;
    border: 1px solid rgba(215, 235, 234, 0.12);
    color: rgba(235, 243, 243, 0.72);
    font-family: 'Montserrat', system-ui, -apple-system, "Segoe UI", sans-serif;
    text-align: center;
}

body.gallery-modal-open {
    overflow: hidden;
}

.gallery-modal {
    position: fixed;
    inset: 0;
    display: none;
    z-index: 4000;
}

.gallery-modal.is-open {
    display: block;
}

.gallery-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
    backdrop-filter: blur(6px);
}

.gallery-modal-panel {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: min(94vw, 1400px);
    height: 90vh;
    margin: 5vh auto;
    overflow: hidden;
    background: #080b0c;
}

.gallery-modal-panel img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.gallery-modal-close,
.gallery-modal-nav {
    position: absolute;
    z-index: 2;
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    background: rgba(6, 12, 13, 0.75);
    color: var(--white);
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.gallery-modal-close:hover,
.gallery-modal-nav:hover {
    border-color: var(--accent);
    background: rgba(0, 100, 95, 0.85);
}

.gallery-modal-close {
    top: 16px;
    right: 16px;
}

.gallery-modal-nav {
    top: 50%;
    transform: translateY(-50%);
}

.gallery-modal-prev {
    left: 16px;
}

.gallery-modal-next {
    right: 16px;
}

.gallery-modal-caption {
    position: absolute;
    z-index: 1;
    right: 0;
    bottom: 0;
    left: 0;
    padding: 32px 24px 18px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.85));
    font-family: 'Montserrat', system-ui, -apple-system, "Segoe UI", sans-serif;
    text-align: center;
    pointer-events: none;
}

.gallery-modal-caption h3 {
    margin: 0 0 4px;
    font-family: 'Montserrat', system-ui, -apple-system, "Segoe UI", sans-serif;
    font-size: 1rem;
}

.gallery-modal-caption p {
    color: rgba(235, 243, 243, 0.72);
    font-size: 0.85rem;
}

@media (max-width: 900px) {
    .gallery-folder-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .gallery-detail-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 600px) {
    .gallery-hero {
        padding: 124px 20px 32px;
    }

    .gallery-hero h1 {
        font-size: clamp(1.4rem, 7vw, 1.9rem);
        overflow-wrap: normal;
        word-break: normal;
    }

    .gallery-section {
        padding: 12px 16px 72px;
    }

    .gallery-folder-grid {
        gap: 10px;
    }

    .gallery-folder-visual {
        aspect-ratio: 4 / 5;
    }

    .gallery-folder-meta {
        padding: 14px;
    }

    .gallery-folder-meta h2 {
        font-size: 1rem;
    }

    .gallery-folder-meta > span {
        font-size: 0.68rem;
    }

    .gallery-detail-grid {
        gap: 8px;
    }

    .gallery-modal-panel {
        width: 100%;
        height: 100%;
        margin: 0;
        touch-action: pan-y;
    }

    .gallery-modal-close,
    .gallery-modal-nav {
        width: 42px;
        height: 42px;
    }

    .gallery-modal-prev {
        left: 8px;
    }

    .gallery-modal-next {
        right: 8px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .gallery-page *,
    .gallery-page *::before,
    .gallery-page *::after {
        transition-duration: 0.01ms !important;
    }
}
