:root {
    --bg:           #ffffff;
    --text:         #111111;
    --text-muted:   #767676;
    --border:       #ececec;
    --tab-bg:       #f4f4f2;
    --tab-active:   #111111;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
}

/* ==================== TOP BANNER (с фото-обложкой проекта) ==================== */

#topBanner {
    position: relative;
}

#topBanner.has-cover {
    background-size: cover;
    background-position: center;
    transition: background-image .2s ease;
    height: 50vh;
    min-height: 340px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

#topBanner.has-cover .hero-heading {
    padding-top: 16px;
}

#topBanner.has-cover .hero-watermark {
    font-size: clamp(48px, 10vw, 110px);
}

#topBanner.has-cover::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, rgba(0,0,0,0.55), rgba(0,0,0,0.62) 60%, rgba(0,0,0,0.7));
    z-index: 0;
}

#topBanner > * {
    position: relative;
    z-index: 1;
}

#topBanner.has-cover .hero-watermark { color: rgba(255,255,255,0.14); }

#topBanner.has-cover .section-tab {
    background: rgba(255,255,255,0.14);
    color: #fff;
    border-color: rgba(255,255,255,0.35);
}
#topBanner.has-cover .section-tab.active {
    background: #fff;
    color: #111;
    border-color: #fff;
}

#topBanner.has-cover .btn-back {
    background: rgba(255,255,255,0.14);
    color: #fff;
}

#topBanner.has-cover .project-header h2 {
    color: #fff;
    text-shadow: 0 2px 10px rgba(0,0,0,0.4);
}

#topBanner.has-cover .category-chip {
    background: rgba(255,255,255,0.14);
    color: #fff;
    border-color: rgba(255,255,255,0.35);
}
#topBanner.has-cover .category-chip.active {
    background: #fff;
    color: #111;
    border-color: #fff;
}

/* ==================== HERO HEADING ==================== */

.hero-heading {
    position: relative;
    text-align: center;
    padding: 32px 20px 0;
    overflow: hidden;
}

.hero-watermark {
    font-size: clamp(64px, 14vw, 160px);
    font-weight: 700;
    color: #f1f1ee;
    line-height: 1.05;
    user-select: none;
    overflow-wrap: break-word;
}

/* ==================== SECTION NAV ==================== */

.section-tabs {
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: center;
    gap: 10px;
    padding: 8px 20px 0;
}

.section-tab {
    background: #fbfbfa;
    color: var(--text);
    padding: 10px 22px;
    border-radius: 999px;
    font-size: 13px;
    border: 1px solid #e5e5e2;
}

.section-tab.active {
    background: var(--tab-active);
    color: #fff;
    border-color: var(--tab-active);
}

/* ==================== PROJECT GRID (mosaic tiles) ==================== */

.projects-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0;
    padding: 28px 4px 60px;
}

.project-card {
    position: relative;
    aspect-ratio: 4/3;
    overflow: hidden;
    background: #f2f2f0;
    cursor: pointer;
}

.project-card-thumb {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .5s ease;
}

.project-card:hover .project-card-thumb {
    transform: scale(1.045);
}

.project-card-body {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0,0,0,0.32);
    color: #fff;
    text-align: center;
}

.project-card-title {
    font-size: clamp(28px, 4vw, 44px);
    font-weight: 100;
    margin: 0;
    line-height: 1.15;
    text-shadow: 0 2px 14px rgba(0,0,0,0.55);
}

/* ==================== PROJECT DETAIL / GALLERY ==================== */

.project-header {
    padding: 28px 24px 10px;
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.btn-back {
    background: var(--tab-bg);
    color: var(--text);
    padding: 8px 16px;
    border-radius: 999px;
    font-size: 13px;
}

.project-header h2 {
    margin: 0;
    font-size: 24px;
    font-weight: 500;
}

.category-chips {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 0 24px 24px;
}

.category-chip {
    background: var(--tab-bg);
    border: 1px solid #e5e5e2;
    color: var(--text);
    padding: 12px 22px;
    border-radius: 999px;
    font-size: 15px;
    font-weight: 500;
    letter-spacing: .02em;
}

.category-chip.active {
    background: var(--tab-active);
    color: #fff;
}

.photo-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0;
    padding: 0 4px 24px;
}

.video-tile {
    position: relative;
    aspect-ratio: 16/9;
    background: #000;
    overflow: hidden;
    border-radius: 0;
    grid-column: 1 / -1;
}

.video-tile iframe,
.video-tile video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: none;
}

.photo-tile {
    position: relative;
    overflow: hidden;
    background: #f2f2f0;
    aspect-ratio: 4/3;
}

.photo-tile img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    cursor: zoom-in;
    transition: transform .5s ease;
}

.photo-tile:hover img { transform: scale(1.045); }

.photo-tile .photo-category-tag {
    position: absolute;
    left: 12px;
    bottom: 12px;
    background: rgba(0,0,0,0.55);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    padding: 4px 10px;
    border-radius: 999px;
}

/* ==================== LIGHTBOX ==================== */

#lightbox {
    position: fixed;
    inset: 0;
    background: rgba(10,10,10,0.96);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 8px;
}

#lightbox.open { display: flex; }

#lightbox img {
    max-width: 100%;
    max-height: 100%;
    border-radius: 2px;
    touch-action: none;
    will-change: transform;
}

#lightbox img.zoom-anim {
    transition: transform .2s ease;
}

#lightbox .lightbox-close,
#lightbox .lightbox-nav {
    position: absolute;
    z-index: 10;
    background: rgba(20,20,20,0.55);
    border: 1px solid rgba(255,255,255,0.25);
    box-shadow: 0 2px 10px rgba(0,0,0,0.35);
    color: #fff;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}
#lightbox .lightbox-close:hover,
#lightbox .lightbox-nav:hover { background: rgba(20,20,20,0.8); }

#lightbox .lightbox-close { top: 20px; right: 20px; }
#lightbox .lightbox-prev { left: 20px; top: 50%; transform: translateY(-50%); }
#lightbox .lightbox-next { right: 20px; top: 50%; transform: translateY(-50%); }

/* ==================== LOADING / EMPTY ==================== */

.loading, .empty-state {
    padding: 80px 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
}

/* ==================== LOADING RAIN ==================== */

.loading-rain {
    position: relative;
    height: min(72vh, 680px);
    overflow: hidden;
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    grid-template-rows: 1fr;
    gap: 4px;
    padding: 0 4px;
    -webkit-mask-image: linear-gradient(to bottom, transparent, #000 6%, #000 94%, transparent);
            mask-image: linear-gradient(to bottom, transparent, #000 6%, #000 94%, transparent);
}

.rain-lane {
    position: relative;
    overflow: hidden;
    height: 100%;
}

.rain-lane img {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    aspect-ratio: 3/4;
    object-fit: cover;
    border-radius: 3px;
    animation-name: rain-fall;
    animation-timing-function: linear;
    animation-iteration-count: infinite;
    filter: blur(1px);
    will-change: transform;
}

@keyframes rain-fall {
    from { transform: translateY(-350%); }
    to   { transform: translateY(650%); }
}

body.is-loading .loading-rain {
    position: fixed;
    inset: 0;
    z-index: 100;
    height: 100vh;
    height: 100dvh;
}

@media (max-width: 640px) {
    .loading-rain { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 640px) {
    .projects-grid, .photo-grid { grid-template-columns: 1fr; }
    .project-header, .category-chips { padding-left: 16px; padding-right: 16px; }
}
