:root {
    --text-bg: #CFCFCF;
    --text-fg: #000000;
    --bg-color: #ffffff;
    --bg-cream: #F3EDE8;
    --accent-blue: #217DFF;
    --transition-speed: 0.3s;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body,
html {
    font-family: 'Inter', sans-serif;
    background-color: #ffffff;
    /* Цвет фона совпадает с цветом контента */
    overflow-x: hidden;
    /* Prevent horizontal scroll on mobile */
    max-width: 100%;
    /* Ensure strict physical boundary */
    color: var(--text-fg);
    margin: 0;
    padding: 0;
}

.page-wrapper {
    max-width: 1920px;
    margin: 0 auto;
    background-color: var(--bg-cream);
    overflow-x: hidden;
    /* Force clipping to screen boundaries */
    width: 100%;
}

.section {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 5vw;
    position: relative;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    background-color: var(--bg-cream);
}

.section-intro {
    background-color: var(--text-fg);
    color: var(--bg-color);
}

.section-intro h1 {
    font-size: 8rem;
    line-height: 0.95;
    text-transform: uppercase;
    font-weight: 800;
    text-align: center;
    max-width: 1000px;
}

/* Анимация 1: Проявление цвета текста */
.section-text-color {
    padding: 10vh 5vw;
}

.styled-box-container {
    position: relative;
    width: 100%;
    max-width: 100%;
    /* Maximum stretch */
    margin: 0 auto;
}

.styled-box {
    padding: 1rem 0;
    /* Minimal padding now that there are no numbers/borders */
    position: relative;
    width: 100%;
}

.styled-label {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: #333;
}

.reveal-text-container {
    position: relative;
    width: 100%;
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.reveal-line {
    position: relative;
    white-space: normal;
    /* Allow wrapping for long lines */
}

.reveal-text-bg,
.reveal-text-fg {
    font-size: clamp(1.2rem, 2.2vw, 2rem);
    font-weight: 700;
    line-height: 1.4;
    text-transform: none;
    white-space: nowrap;
    /* Enforce single lines on desktop */
}

@media (max-width: 1024px) {

    .reveal-text-bg,
    .reveal-text-fg {
        white-space: normal;
        /* Allow wrapping on tablets/mobile */
        text-wrap: balance;
    }
}

.reveal-text-bg {
    color: rgba(0, 0, 0, 0.1);
    /* Very subtle grey */
}

.reveal-text-fg {
    color: #222;
    /* Dark near-black */
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    clip-path: polygon(0 0, 0 0, 0 100%, 0 100%);
    z-index: 1;
}

/* Анимация 2: Появление текста снизу */
.section-text-appear {
    padding: 10vh 5vw;
    background-color: var(--bg-cream);
}

.section2-content {
    display: flex;
    align-items: flex-end;
    /* Moved lower per request */
    gap: 4rem;
    max-width: 1400px;
    width: 100%;
}

.section2-image {
    flex: 0 0 40%;
}

.section2-image img {
    width: 100%;
    max-width: 100%;
    /* Failsafe */
    height: auto;
    display: block;
    /* Remove bottom phantom spacing */
    object-fit: cover;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

.section2-text-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.styled-box-container.small-box {
    max-width: 100%;
}

.styled-box-container.small-box .styled-box {
    padding: 1rem 0;
}

.appear-mask {
    overflow: hidden;
    /* Вернули маску для эффекта появления "из линии" */
    display: block;
    width: 100%;
}

.appear-text {
    font-size: clamp(1rem, 1.2vw, 1.2rem);
    font-weight: 500;
    line-height: 1.3;
    /* Уменьшили межстрочный интервал по просьбе */
    text-transform: none;
    color: #000;
    /* Трансформация теперь применяется к отдельным словам в JS */
}

.appear-word {
    display: inline-block;
    opacity: 0;
    /* Гарантируем невидимость до старта */
    transform: translateY(110%);
    will-change: transform, opacity;
}

.learn-more-btn {
    align-self: flex-start;
    background-color: #1A1815;
    color: white;
    border: none;
    padding: 1rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease;
    text-transform: none;
}

.learn-more-btn:hover {
    background-color: #A9472C;
}

/* Анимация 3: Окно с изображением */
.section-image-window {
    height: 100vh;
    padding: 0;
    overflow: hidden;
}

.section-window {
    width: 100%;
    height: 100vh;
    padding: 0 !important;
    overflow: hidden;
    position: relative;
    background: #A9472C;
    /* Фон всей секции вокруг маски */
}

.window-frame {
    width: 100%;
    height: 100%;
    position: relative;
    background: #A9472C;
    /* Фон внутри окна (за маской) */

    /* Используем маску для проявления слайдера под ней. Не используем preserveAspectRatio='none', чтобы избежать искажений фигуры */
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cpath d='M 25 95 L 75 95 L 75 35 Q 75 5 50 5 Q 25 5 25 35 Z' fill='black'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cpath d='M 25 95 L 75 95 L 75 35 Q 75 5 50 5 Q 25 5 25 35 Z' fill='black'/%3E%3C/svg%3E");
    -webkit-mask-size: 300px;
    mask-size: 300px;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
    will-change: mask-size, -webkit-mask-size;
}

.slider-container {
    width: 100%;
    height: 100%;
    position: relative;
}

.slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.slide.active {
    opacity: 1;
}

.slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* Заполнение всей области (от края до края) */
}

.reveal-top-bar {
    position: absolute;
    top: 5%;
    left: 0;
    width: 100%;
    padding: 0 8%;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    color: white;
    z-index: 999;
    pointer-events: none;
}

.reveal-mask-top {
    overflow: hidden;
    display: block;
}

.reveal-mask-top.right-align {
    text-align: right;
}

.reveal-text-anim.top-text {
    font-size: clamp(0.9rem, 1.2vw, 1.2rem);
    font-weight: 400;
    opacity: 0.85;
    letter-spacing: 0.02em;
    display: block;
}

.reveal-wrapper-white {
    position: absolute;
    bottom: 10%;
    left: 8%;
    /* Чуть левее по просьбе */
    color: white;
    z-index: 999;
    max-width: 90vw;
    /* Увеличили, чтобы длинное слово не обрезалось */
}

.reveal-mask-title {
    overflow: hidden;
    display: block;
}

.reveal-mask-desc {
    overflow: hidden;
    display: block;
    max-width: 600px;
    /* Сохранили 600px для описания, чтобы был красивый перенос */
}

.reveal-mask-title {
    margin-bottom: 1rem;
}

.reveal-text-anim {
    display: block;
    transform: translateY(110%);
    will-change: transform;
}

.reveal-text-anim.title {
    font-size: clamp(2.5rem, 5vw, 5.5rem);
    line-height: 1.1;
    font-weight: 800;
}

.reveal-text-anim.desc {
    font-size: clamp(1rem, 1.8vw, 1.4rem);
    line-height: 1.5;
    font-weight: 500;
    opacity: 0.9;
}

.section-spacer {
    height: 100px;
    background-color: #A9472C;
    /* Переходный блок к 4-й секции */
    width: 100%;
}

/* Анимация 4: Морфинг фигур */
.section-morphing {
    max-width: 1920px;
    margin: 0 auto;
    height: 100vh;
    /* GSAP автоматически добавит высоту прокрутки через pin-spacer */
    padding: 0;
    position: relative;
    background-color: transparent;
    color: #E6D5B8;
    overflow: visible;
}

.morph-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #1A1815;
    z-index: -1;
}

.morph-sticky {
    position: relative;
    /* Фиксацию (pinning) берет на себя GSAP */
    height: 100vh;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 4%;
    z-index: 1;
    overflow: hidden;
}

.morph-text-column {
    width: 25%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    /* Заголовок сверху, описание снизу */
    padding: 6vh 0;
    position: relative;
    transform: translateY(-3vh);
    /* Смещено только по вертикали для центровки относительно SVG */
}

.morph-label {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    opacity: 0.6;
    font-weight: 600;
}

.morph-text-wrap {
    position: relative;
    min-height: 180px;
}

.morph-item {
    position: absolute;
    bottom: 0;
    left: 0;
    opacity: 0;
    pointer-events: none;
    width: 100%;
}

.morph-item.active {
    opacity: 1;
    pointer-events: auto;
}

.morph-item h3 {
    font-size: clamp(1.4rem, 2vw, 2rem);
    margin-bottom: 0.75rem;
    line-height: 1.2;
    font-weight: 700;
}

.morph-item p {
    font-size: clamp(0.85rem, 1.1vw, 1rem);
    line-height: 1.6;
    opacity: 0.75;
}

.morph-svg-wrap {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
}

.morph-svg {
    width: 100%;
    max-width: 1000px;
    height: auto;
    overflow: visible;
}

.shape-path {
    fill: currentColor;
    /* По умолчанию используется цвет #E6D5B8 */
}

.morph-numbers-corner {
    position: absolute;
    top: 4vh;
    right: 4%;
    pointer-events: none;
}

.morph-num {
    position: absolute;
    top: 0;
    right: 0;
    font-size: clamp(6rem, 12vw, 14rem);
    font-weight: 900;
    line-height: 1;
    opacity: 0;
    color: currentColor;
    user-select: none;
}

.footer-spacer {
    background-color: #fafafa;
}

/* --- Адаптивность (Медиа-запросы) --- */

/* Планшеты (768px) */
@media (max-width: 768px) {
    .styled-box {
        padding: 2rem 0;
    }

    .section2-content {
        flex-direction: column;
        align-items: flex-start;
        /* Reset desktop flex-end alignment */
        gap: 2rem;
        width: 100%;
    }

    .section2-image {
        flex: 0 0 auto;
        width: 100%;
        max-width: 100%;
        /* Prevent flexbox intrinsic width overflow */
        min-width: 0;
    }

    .section2-text-wrap {
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }

    .reveal-text-bg,
    .reveal-text-fg {
        font-size: clamp(2.2rem, 8vw, 4rem);
    }

    .appear-text {
        font-size: clamp(2rem, 9vw, 4rem);
    }

    /* Animation 3: Window */
    .reveal-top-bar {
        padding: 0 5%;
        flex-direction: column;
        gap: 0.5rem;
    }

    .reveal-mask-top.right-align {
        align-self: flex-end;
        text-align: right;
    }

    .reveal-wrapper-white {
        left: 5%;
        bottom: 10%;
        max-width: 80%;
    }

    /* Animation 4: Morphing */
    .morph-sticky {
        flex-direction: column;
        justify-content: center;
        padding: 40px 20px;
        gap: 5vh;
    }

    .morph-text-column {
        width: 100%;
        height: auto;
        order: 3;
        padding: 0;
        text-align: left;
    }

    .morph-svg-wrap {
        width: 100%;
        order: 2;
    }

    .morph-numbers-corner {
        position: relative;
        top: 0;
        right: 0;
        order: 1;
        align-self: flex-end;
        height: 80px;
        margin-bottom: -20px;
    }

    .morph-num {
        font-size: 6rem;
    }

    .morph-label {
        font-size: 0.75rem;
        margin-bottom: 5px;
    }

    .morph-text-wrap {
        min-height: 120px;
    }
}

/* Мобильные устройства (цель — 393px, как указано в ТЗ) */
@media (max-width: 480px) {

    .reveal-text-bg,
    .reveal-text-fg {
        font-size: 1.4rem;
        line-height: 1.5;
    }

    .styled-box-container {
        padding: 0;
        /* Align with image, removed extra 5% padding */
    }

    .appear-text {
        font-size: 1.2rem;
        /* Significantly smaller as requested */
        line-height: 1.4;
    }

    /* Анимация 3: Окно (Правка: текст меньше, смещен левее и ниже) */
    .window-frame {
        mask-size: 180px;
    }

    .reveal-wrapper-white {
        left: 5%;
        bottom: 6vh;
        max-width: 90%;
    }

    /* Animation 4: Morphing Numbers */
    .morph-num {
        font-size: 4rem;
    }

    .morph-sticky {
        gap: 2vh;
    }
}

/* Desktop Stretch (up to 1920px, focus on 1440px) */
@media (min-width: 1440px) {
    .styled-box-container {
        max-width: 90%;
        /* Allows it to stretch nicely on 1440px and 1920px */
    }

    .reveal-text-bg,
    .reveal-text-fg {
        font-size: 2.5rem;
        /* Bigger for desktop */
    }
}