:root {
    --bg: #5E0006;
    --bg-soft: transparent;
    --panel-strong: rgba(39, 5, 10, 0.76);
    --text: #f0dfe4;
    --text-strong: #fff4f7;
    --line: rgba(255, 240, 245, 0.16);
    --line-soft: rgba(255, 240, 245, 0.14);
    --accent: rgba(255, 244, 247, 0.9);
    --accent-strong: #ffffff;
    --shadow: 0 18px 36px rgba(27, 3, 8, 0.18);
    --gallery-gap: 12px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: Arial, Helvetica, sans-serif;
    line-height: 1.55;
    transition: background-color 0.24s ease, color 0.24s ease;
}

img {
    display: block;
    max-width: 100%;
}

a {
    color: inherit;
}

.site-header,
.site-main,
.site-footer {
    width: min(1220px, calc(100% - 32px));
    margin: 0 auto;
}

.site-header {
    padding: 18px 0 0;
    position: relative;
    z-index: 40;
}

body.category-mode {
    background: #060606;
    color: rgba(255, 244, 247, 0.92);
}

body.category-mode .site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    padding-top: 18px;
}

body.category-mode .site-main {
    padding-top: 0;
}

.header-bar,
.contact-label,
.lightbox-counter {
    font-size: 0.72rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    gap: 16px;
    min-height: 68px;
    padding: 12px 20px;
    background: var(--panel-strong);
    color: #fff;
    border: 1px solid rgba(255, 244, 247, 0.12);
    border-radius: 999px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.site-kicker-button,
.gallery-nav-button {
    border: 0;
    background: transparent;
    color: inherit;
    cursor: pointer;
    font: inherit;
    letter-spacing: inherit;
    text-transform: inherit;
}

.site-kicker-button,
.gallery-nav-button,
.menu-toggle,
.gallery-link,
.gallery-page-button,
.category-thumb,
.contact-card a {
    touch-action: manipulation;
}

.menu-toggle {
    display: none;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--text-strong);
    cursor: pointer;
}

.menu-toggle-line {
    display: block;
    width: 18px;
    height: 1px;
    margin: 4px auto;
    background: currentColor;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.site-kicker-button {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    position: relative;
    font-size: 0.8rem;
    line-height: 1;
    letter-spacing: 0.26em;
    color: var(--text-strong);
}

.gallery-nav {
    display: flex;
    flex-wrap: nowrap;
    justify-content: flex-end;
    gap: 18px;
}

.header-bar.is-nav-collapsed {
    align-items: center;
    flex-wrap: nowrap;
}

.header-bar.is-nav-collapsed .menu-toggle {
    display: inline-block;
}

.header-bar.is-nav-collapsed .gallery-nav {
    display: none;
}

.header-bar.is-nav-collapsed.is-menu-open .gallery-nav {
    display: flex;
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    flex-direction: column;
    align-items: flex-start;
    width: min(320px, 100%);
    padding: 16px 18px;
    border: 1px solid rgba(255, 244, 247, 0.12);
    border-radius: 24px;
    background: rgba(22, 4, 8, 0.96);
    box-shadow: 0 18px 36px rgba(0, 0, 0, 0.28);
    z-index: 60;
}

.gallery-nav-button {
    position: relative;
    padding: 6px 0;
    color: rgba(255, 244, 247, 0.76);
    transition: color 0.2s ease, opacity 0.2s ease;
}

.gallery-nav-button::after,
.site-kicker-button::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -2px;
    height: 1px;
    background: currentColor;
    opacity: 0;
    transform: scaleX(0.35);
    transform-origin: center;
    transition: transform 0.22s ease, opacity 0.22s ease;
}

.gallery-nav-button[aria-pressed="true"],
.site-kicker-button[aria-pressed="true"] {
    color: var(--accent-strong);
}

.gallery-nav-button[aria-pressed="true"]::after,
.site-kicker-button[aria-pressed="true"]::after,
.gallery-nav-button:hover::after,
.gallery-nav-button:focus-visible::after,
.site-kicker-button:hover::after,
.site-kicker-button:focus-visible::after {
    opacity: 1;
    transform: scaleX(1);
}

.gallery-nav-button:hover,
.gallery-nav-button:focus-visible,
.site-kicker-button:hover,
.site-kicker-button:focus-visible {
    color: var(--text-strong);
}

.site-main {
    padding: calc(var(--gallery-gap) * 2) 0 72px;
}

.gallery-section,
.contact-panel {
    padding-top: 0;
}

.gallery-view[hidden] {
    display: none;
}

.gallery-title,
.contact-title {
    color: var(--text-strong);
    font-weight: 400;
    line-height: 1.08;
}

.gallery-title {
    margin-bottom: var(--gallery-gap);
    font-size: clamp(1.4rem, 2.6vw, 2rem);
    text-align: center;
}

.gallery-empty {
    padding: 40px 0;
    color: rgba(255, 244, 247, 0.74);
    text-align: center;
    font-size: 0.82rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.gallery-pagination,
.gallery-page-status,
.gallery-page-button {
    font-size: 0.72rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.gallery-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: calc(var(--gallery-gap) * 1.5) var(--gallery-gap) 0;
}

.gallery-page-status {
    color: rgba(255, 244, 247, 0.78);
}

.gallery-page-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
}

.gallery-page-button {
    border: 1px solid rgba(255, 244, 247, 0.2);
    background: transparent;
    color: var(--text-strong);
    padding: 10px 14px;
    cursor: pointer;
    transition: color 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.gallery-page-button:hover,
.gallery-page-button:focus-visible {
    color: #ffffff;
    border-color: rgba(255, 244, 247, 0.42);
    background: rgba(255, 244, 247, 0.08);
}

.contact-title {
    margin-bottom: 18px;
    font-size: clamp(1.15rem, 2vw, 1.5rem);
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    grid-auto-rows: 82px;
    gap: var(--gallery-gap);
    padding: var(--gallery-gap);
    background: transparent;
}

.gallery-grid-main {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    grid-auto-rows: auto;
}

.gallery-section-category .gallery-grid {
    display: block;
    padding: 0;
}

.gallery-section-category {
    margin-top: calc(var(--gallery-gap) * 0.5);
}

body.category-mode .gallery-section-category {
    margin-top: 0;
    padding-top: calc(var(--gallery-gap) * 1.25);
}

.category-viewer {
    padding: clamp(18px, 2vw, 24px);
    background: rgba(5, 4, 5, 0.82);
    border: 1px solid rgba(255, 244, 247, 0.08);
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.3);
}

.category-stage {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: clamp(300px, 48vw, 680px);
    background: rgba(0, 0, 0, 0.34);
    padding: clamp(16px, 2.4vw, 28px);
}

.category-feature {
    width: 100%;
}

.category-feature-image {
    width: 100%;
    max-height: clamp(280px, 46vw, 640px);
    object-fit: contain;
    margin: 0 auto;
}

.category-strip {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 16px 0 8px;
    scrollbar-width: thin;
}

.category-thumb {
    flex: 0 0 auto;
    width: 92px;
    height: 68px;
    padding: 0;
    border: 1px solid transparent;
    background: transparent;
    cursor: pointer;
    opacity: 0.7;
    transition: transform 0.2s ease, opacity 0.2s ease, border-color 0.2s ease;
}

.category-thumb.is-selected {
    transform: scale(1.04);
    opacity: 1;
    border-color: rgba(255, 244, 247, 0.72);
}

.category-thumb:hover,
.category-thumb:focus-visible {
    opacity: 1;
    border-color: rgba(255, 244, 247, 0.4);
}

.category-thumb-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.category-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding-top: 10px;
}

.category-control-button[disabled] {
    opacity: 0.35;
    cursor: default;
}

.category-status {
    min-width: 72px;
    text-align: center;
}

body.category-mode .category-viewer {
    padding: clamp(14px, 1.8vw, 22px) 0 0;
    background: transparent;
    border: 0;
    box-shadow: none;
}

body.category-mode .category-stage {
    min-height: clamp(360px, 58vh, 760px);
    background: transparent;
    padding: 0;
}

body.category-mode .category-feature-image {
    max-height: min(64vh, 760px);
}

body.category-mode .gallery-title {
    display: none;
}

body.category-mode .contact-panel {
    display: none;
}

.menu-toggle:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 4px;
}

.gallery-item {
    grid-column: span 3;
    grid-row: span 3;
    position: relative;
    overflow: hidden;
    background: transparent;
    border: 0;
    box-shadow: 0 10px 24px rgba(37, 8, 18, 0.22);
}

.gallery-item-main {
    grid-column: span 1;
    grid-row: span 1;
    aspect-ratio: 1;
}

.gallery-item--wide {
    grid-column: span 6;
}

.gallery-item--tall {
    grid-row: span 5;
}

.gallery-link {
    position: relative;
    display: block;
    width: 100%;
    height: 100%;
    text-decoration: none;
}

.thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border: 0;
    transition: transform 0.3s ease, filter 0.3s ease;
}

.gallery-item:hover .thumbnail,
.gallery-link:focus-visible .thumbnail {
    transform: scale(1.03);
    filter: saturate(1.02);
}

.gallery-link:focus-visible,
.contact-card a:focus-visible,
.gallery-nav-button:focus-visible,
.site-kicker-button:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 4px;
}

.contact-card a:hover,
.contact-card a:focus-visible {
    color: var(--accent-strong);
}

.contact-panel {
    margin-top: calc(var(--gallery-gap) * 2);
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
}

.contact-grid {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: 0;
}

.contact-card {
    padding: 0;
    border: 0;
    background: transparent;
}

.contact-link-row {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--text-strong);
}

.contact-link-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border: 1px solid rgba(255, 244, 247, 0.2);
    border-radius: 999px;
    flex-shrink: 0;
}

.contact-link-icon svg,
.footer-contact-link svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.site-footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 0 0 28px;
    color: var(--text);
    font-size: 0.76rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    text-align: center;
}

.footer-contact-icons {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.footer-contact-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border: 1px solid rgba(255, 244, 247, 0.2);
    border-radius: 999px;
    text-decoration: none;
    color: var(--text-strong);
}

@media (max-width: 1024px) {
    .gallery-grid-main {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .gallery-grid {
        grid-template-columns: repeat(8, minmax(0, 1fr));
    }

    .gallery-item {
        grid-column: span 4;
    }

    .gallery-item--wide {
        grid-column: span 8;
    }

    .contact-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    .site-header,
    .site-main,
    .site-footer {
        width: min(100% - 20px, 1220px);
    }

    .header-bar {
        padding: 14px 16px;
        border-radius: 24px;
    }

    .site-footer {
        align-items: center;
        text-align: center;
    }

    .header-bar.is-nav-collapsed .menu-toggle {
        position: absolute;
        top: 50%;
        right: 12px;
        transform: translateY(-50%);
    }

    .header-bar.is-nav-collapsed .gallery-nav {
        justify-content: flex-start;
        gap: 12px;
        width: 100%;
        padding-top: 6px;
    }

    .header-bar.is-nav-collapsed.is-menu-open .gallery-nav {
        display: flex;
        position: absolute;
        top: calc(100% + 10px);
        right: 0;
        flex-direction: column;
        align-items: flex-start;
        width: min(320px, calc(100vw - 20px));
        padding: 16px 18px;
        border: 1px solid rgba(255, 244, 247, 0.12);
        border-radius: 24px;
        background: rgba(22, 4, 8, 0.96);
        box-shadow: 0 18px 36px rgba(0, 0, 0, 0.28);
    }

    .site-kicker-button {
        width: auto;
        text-align: left;
    }

    .gallery-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        grid-auto-rows: 150px;
    }

    .gallery-grid-main {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        grid-auto-rows: auto;
    }

    .gallery-item,
    .gallery-item--wide,
    .gallery-item--tall {
        grid-column: span 1;
        grid-row: span 1;
    }

    .gallery-item--wide {
        grid-column: span 2;
    }

    .gallery-pagination {
        align-items: flex-start;
        flex-direction: column;
    }

    .gallery-page-actions {
        justify-content: flex-start;
    }

    .category-stage {
        min-height: 240px;
    }

    .category-controls {
        flex-wrap: wrap;
    }

    .contact-panel {
        display: none;
    }

    .footer-contact-icons {
        display: flex;
    }
}

@media (max-width: 520px) {
    .site-header {
        padding-top: 10px;
    }

    .gallery-nav {
        gap: 10px;
    }

    .gallery-grid {
        grid-template-columns: 1fr;
        grid-auto-rows: 220px;
    }

    .gallery-grid-main {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        grid-auto-rows: auto;
    }

    .category-thumb {
        width: 78px;
        height: 58px;
    }

    .gallery-item,
    .gallery-item--wide {
        grid-column: span 1;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation: none !important;
        transition-duration: 0.01ms !important;
        transition-delay: 0ms !important;
    }
}
