:root {
    --bg-color: #fdf0d5;
    --text-color: #252422;
    --accent-color: #eb5e28;
    --side-padding: 4vw; 
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth; 
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'Funnel Display', sans-serif;
    overflow-x: hidden;
}

/* --- STICKY HEADER --- */
.sticky-wrapper {
    position: sticky;
    top: 0;
    z-index: 100;
    background-color: var(--bg-color);
    padding: 1.5rem var(--side-padding) 0; 
    width: 100%;
}

.main-header {
    margin-bottom: 1rem;
    text-align: left;
}

.title {
    font-weight: 800;
    font-size: clamp(1.5rem, 4vw, 6rem);
    line-height: 1.1;
    letter-spacing: -0.02em;
    white-space: nowrap; 
}

.dot {
    color: var(--accent-color);
    margin: 0 0.2em;
    display: inline-block;
    vertical-align: middle;
    font-size: 0.8em;
}

/* --- FILTERS --- */
.filters-container {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding-bottom: 10px;
    margin-bottom: 15px; 
}

.filter-item {
    font-weight: 400;
    font-size: clamp(0.8rem, 1.8vw, 1.8rem);
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94), color 0.3s ease;
    user-select: none;
    white-space: nowrap; 
}

.filter-item:hover {
    transform: translateY(-4px);
    color: var(--accent-color);
}

.sliding-line {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background-color: var(--accent-color);
    transition: left 0.4s cubic-bezier(0.645, 0.045, 0.355, 1), 
                width 0.4s cubic-bezier(0.645, 0.045, 0.355, 1);
    will-change: left, width;
}

.header-separator {
    width: 100%;
    height: 1px;
    background-color: rgba(37, 36, 34, 0.15); 
    margin-bottom: 0;
}

.section-separator {
    width: 100%;
    height: 1px;
    background-color: rgba(37, 36, 34, 0.15); 
    margin: 3rem 0; 
}

/* --- ГАЛЕРЕЯ --- */
.content-container {
    padding: 2rem var(--side-padding) 4rem; 
}

.portfolio-section {
    width: 100%;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    column-gap: 15px;
    row-gap: 30px;
    width: 100%;
    /* align-items: start;  <-- УБРАЛ ЭТО, чтобы вернулось нормальное выравнивание */
}

.grid-item {
    width: 100%;
    display: flex;
    flex-direction: column;
    min-width: 0; /* Чтобы сетка не ломалась от больших картинок */
}

/* Рамки */
.img-frame {
    width: 100%;
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    background-color: rgba(37, 36, 34, 0.1);
    cursor: default; 
    margin-bottom: 8px; 
}

.img-frame.vertical {
    aspect-ratio: 5 / 7;
}

.img-frame.horizontal {
    aspect-ratio: 7 / 5;
}

/* Изображения */
.gallery-img {
    width: 100%;
    height: 100%;
    object-fit: cover; 
    object-position: center center; /* По умолчанию центр */
    display: block;
    transition: transform 0.4s ease;
    cursor: zoom-in;
}

.img-frame:hover .gallery-img {
    transform: scale(1.05);
}

/* --- ПОДПИСИ --- */
.caption {
    font-family: 'Funnel Display', sans-serif;
    font-weight: 400;
    font-size: clamp(0.6rem, 0.7vw, 0.9rem); 
    color: var(--text-color);
    opacity: 0.8;
    white-space: nowrap; 
    overflow: hidden;
    text-overflow: ellipsis; 
    padding-left: 2px;
}

/* --- LIGHTBOX --- */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(37, 36, 34, 0.95);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    overflow: hidden;
}

.lightbox.active {
    opacity: 1;
    pointer-events: auto;
}

#lightbox-img {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    user-select: none;
    pointer-events: auto;
    cursor: grab;
    transform-origin: center center;
    will-change: transform;
}

#lightbox-img:active {
    cursor: grabbing;
}

.lightbox-close {
    position: absolute;
    top: 30px;
    right: 40px;
    font-size: 3rem;
    color: #fdf0d5;
    cursor: pointer;
    z-index: 1001;
    line-height: 1;
    transition: color 0.2s ease, transform 0.2s ease;
}

.lightbox-close:hover {
    color: var(--accent-color);
    transform: rotate(15deg);
}