@import url('reset.css');
@import url('font.css');
@import url('animation.css');

body{
    font-family: 'IBM Plex Sans', sans-serif;
    flex-wrap: wrap;
    display: flex;
    flex-direction: row;
    align-items: center;
    background-color: #C9C9C9;
}

canvas {
    z-index: 2;
    position: absolute;
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.first-screen{
    display: flex;
    touch-action: pan-down;
    flex-direction: column;
    width: 100%;
    height: 100vh;
    align-items: center;
    justify-content: center;
    position:relative;
    overflow-x: clip;

}
.second-screen{
    position: relative;
    height: 100vh;
    width: 100%;
    overflow-x: clip;
}
.third-screen{
    width: 100%;
    height: 100vh;
    background-color: #ffffff;
    background-position: center;
    background-size: 100% 100%; 
    background-repeat: no-repeat;
    position: relative;
}
.fourth-screen{
    width: 100%;
    height: 100vh;
    position: relative;
    overflow: hidden;
    background-image: url('../assets/images/bg-4.svg');
}
.illustration{
    top: 50%;
    transform: translateY(-50%);
    position:absolute;
    left: 0;
    width: 100%;
    height: auto;
    z-index: 1;
}
.illustration-new-bg{
    position: absolute;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    width: 100%;
    height: 100%;    
    z-index: 1;
}
.illustration-new-figure{
    position: absolute;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    width: 100%;
    height: 154%;    
    z-index: 1;
    pointer-events: none;

}
.illustration-new-mask{
    position: absolute;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    width: 100%;
    height: 100%;    
    z-index: 6;
    pointer-events: none;
}
.illustration-mask{
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 100%;
    height: auto;
    pointer-events: none;
}
.illustration-bottom{
    position:absolute;
    transform: translateY(-100%);
    top: 100%;
    left: 0;
    width: 100%;
    height: auto;
    z-index: 1;
}

.gray-element-1{
    position: absolute;
    width: 71.3vw;
    height: 23.18vw;
    z-index: 29;
}

.rings{
    width: 58.85vw;
    height: 29.43vw;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 30;
}
.elipse-center{
    position: absolute;
    width: 36vw;
    height: 36vw;
    z-index: 1;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}
.elipse-right{
    position: absolute;
    width: 36vw;
    height: 36vw;
    left: 50.1vw;
    z-index: 1;
}
.elipse-left{
    position: absolute;
    width: 36vw;
    height: 36vw;
    left: 13.95vw;
    z-index: 1;
}
.elipse-small-right{
    position: absolute;
    width: 27.29vw;
    height: 27.29vw;
    left: 50vw;
    z-index: 1;
}
.elipse-small-left{
    position: absolute;
    width: 27.29vw;
    height: 27.29vw;
    left: 22.7vw;
    z-index: 1;
}
.bg-nap{
    position: absolute;
    z-index: 40;
    cursor:pointer;
    font-size: 3.28vw;
    height: 2.29vw;
    font-weight: 600;
    color: #3F3F3F;
    background-color: #ffffff;
    padding-bottom: 0.21vw;
    display: flex;
    align-items: flex-end;
}

.stamp{
    position:absolute;
    width: 11.77vw;
    height: 7.6vw;
    pointer-events:none;
    opacity:0; 
    transform: scale(0.5);
    transition: opacity 0.5s, transform 0.5s;
    z-index: 41;
  }


.first-screen img, .first-screen .bg-nap  { pointer-events: none; }


  #nap-word{
    pointer-events: auto;
    cursor: pointer;
    user-select: none;
    font-size:  3.33vw;
    text-box-edge: cap alphabetic;
    text-box-trim: trim-both;
  }

  .active-sleep-box {
    position: absolute;
    width:  42vw;
    height: fit-content;
    background: white;
    font-size: 1.56vw;
    color: #3F3F3F;
    font-weight: 600;
    line-height: 2.03vw;
    letter-spacing: -3%;
    user-select: none;
    z-index: 10;
    cursor: pointer;
    opacity:0; 
    transform: scale(0.5);
    transition: opacity 0.5s, transform 0.5s;
  }

  .substrate{
    width: 74.95vw;
    height: 45.93vw;
    position: absolute;
    position: relative;
    left: 50%;
    top: 100%;
    transform: translate(-50%, -100%);
    z-index: 10;
    background-image: url('../assets/images/subtrate.svg');
    background-position: center;
    background-size: 100% 100%; 
    background-repeat: no-repeat;
    pointer-events: none;
    
  }
  .catastrophe{
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    top: 19.16%;
    font-size: 2.08vw;
    font-weight: 600;
    color: #3F3F3F;
    font-style: italic;
  }
  .catastrophe-img{
    width: 13.91vw;
    height: 8.59vw;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    top: 27.32%;
    mix-blend-mode: multiply;
  }
  .arrow-left{
    width: 2.24vw;
    height: 0.89vw;
    pointer-events: auto;
    cursor: pointer;
  }
  .arrow-right{
    width: 2.24vw;
    height: 0.89vw;
    pointer-events: auto;
    cursor: pointer;
  }
  .switch{
    position: absolute;
    top: 92.74%;
    left: 50%;
    transform: translateX(-50%);
    width: 10.73vw;
    height: 1.98vw;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    font-size: 2.08vw;
    font-style: italic;
    color: #3F3F3F;
  }

    

.top-calendar-text{
    position: relative;
    width: 100%;
    height: 37%;
    font-size: 1.35vw;
    font-weight: 600;
    color: #3F3F3F;
}
.date{
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    left: 0;

}
.month{
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    left: 43.44%;
}
.mid-calendar-text{
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    height: 32.50%;
    font-size: 1.35vw;
    font-weight: 600;
    color: #737373;
}
.bottom-calendar-text{
    position: relative;
    font-size: 2.08vw;
    width: 100%;
    height: 43.12%;
    color: #3F3F3F;
    font-weight: 600;
}
.left-bottom-text{
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    left: 0;
    font-style: italic;
}
.mid-bottom-text{
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    left: 8.45%;
    font-style: italic;
}
.right-bottom-text{
    position: absolute;
    left: 86.75%;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.35vw;
    font-weight: 600;
    color: #3F3F3F;
}
.slide-content { 
    position: relative;
    width: 100%;
    height: 100%; 
}
.calendar-container{
    display:flex;
    flex-direction: column;
    position: absolute;
    position: relative;
    width: 68.39vw;
    height: 6vw;
    left: 50%;
    transform: translateX(-50%);
    top: 8.31%;
}
.inf-button{
    position: absolute;
    width: 14.64vw;
    height: 5.42vw;
    top: 65.84%;
    left: 40.24%;
    pointer-events: auto;
    cursor: pointer;
    transition: transform 0.5s ease-in-out;
}

.inf-button:hover {
    transform: scale(1.12);
}
.info-modal {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: white;
    z-index: 100;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.info-modal.show {
    opacity: 1;
}
.info-modal-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    font-size: 1.3vw;
    color: #A1A1A1;
    font-weight: 500;
    text-align: center;
}
.close-button {
    position: absolute;
    top: 58.8%;
    left: 50%;
    width: 4.9vw;
    height: 1.82vw;
    cursor: pointer;
    transform: translateX(-50%);
    transition: transform 0.5s ease-in-out;
}

.close-button:hover {
    transform: translateX(-50%) scale(1.10);
}
.hidden-text {
    display: none;
}

.info-overlay {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translate(-50%, -100%);
    width: 74.95vw;
    height: 45.94vw;
    background: white;
    z-index: 9;    
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.info-overlay.active {
    opacity: 1;
    pointer-events: auto;
}


.info-text {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    font-size: 1.25vw;
    color: #A1A1A1;
    white-space: nowrap;
    font-weight: 500;
    line-height: 130%;
}

.third-screen {
    width: 100%;
    height: 100vh;
    background-position: center;
    background-size: 100% 100%; 
    background-repeat: no-repeat;
    position: relative;
    overflow: hidden;
}

/* Копируем стили маски со второго экрана */
.third-screen .illustration-new-mask {
    position: absolute;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    width: 100%;
    height: 100%;    
    z-index: 3;
    pointer-events: none;
}

#model-container {
  width: 50%;
  height: 50%;
  overflow: hidden;
  position:absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  filter: saturate(0);
}



.new-images-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 5;
  position: relative;
}

.overlay-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.overlay-left {
  position: absolute;
  left: 14.84375%;
  top: 0;
  width: 35.15625%;
  height: 100%;
}

.overlay-right {
  position: absolute;
  left: 50%;
  top: 0;
  width: 35.15625%;
  height: 100%;
}

/* Текстовый блок, расширяющийся между картинками */
.text-between {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 0;                     /* начальная ширина 0 */
    overflow: hidden;             /* скрываем содержимое пока блок не расширится */
    padding: 0;                   /* начальный отступ 0 */
    z-index: 20;
    text-align: justify;          /* ваше выравнивание */
    display: flex;
    flex-direction: column;
    gap: 0;
    font-family: 'IBM Plex Sans', sans-serif;
    color: #575757;
    font-size: 1.35vw;
    font-weight: 600;
    opacity: 0;
    pointer-events: none;
    transition: width 1.2s cubic-bezier(0.25, 1, 0.5, 1),
                padding 1.2s cubic-bezier(0.25, 1, 0.5, 1),
                opacity 0.3s ease;
}

.text-between.show {
    width: 30vw;                  /* финальная ширина */
    padding: 0.15vw;               /* финальные отступы */
    opacity: 1;
}


.bed-word-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 22;
}

#nap-word-bed {
    cursor:pointer;
    font-size: 2.08vw;
    text-box-edge: cap alphabetic;
    text-box-trim: trim-both;
    font-weight: 600;
    color: #3F3F3F;
    background-color: #ffffff;
    padding-bottom: 0.21vw;
    display: flex;
    align-items: flex-end;
    margin: 0;
}
.gray-element-2{
    width: 77.812vw;
    height: 51.41vw;
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 19;
    transform: translate(-50%, -50%);
    touch-action: none;
    user-select: none;
    pointer-events: none;
}

.girl-left{
    width: 53.33vw;
    height: 31.67vw;
    position: absolute;
    top: 42.13%;
    left: -13.1%;
    z-index: 18;
    pointer-events: none;
}

.girl-right{
    width: 53.33vw;
    height: 31.67vw;
    position: absolute;
    top: 42.13%;
    left: 59.27%;
    z-index: 18;
    pointer-events: none;
}
.overlay-left,
.overlay-right {
    transition: transform 1.2s cubic-bezier(0.25, 1, 0.5, 1);
    will-change: transform;
}

.overlay-left.slide-out {
    transform: translateX(-15vw);
}

.overlay-right.slide-out {
    transform: translateX(15vw);
}




.bg-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

.slide-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
    z-index: 0;
}

.slide-bg.active {
    opacity: 1;
}

/* Контейнер слайдов — позиционируем все слайды друг над другом */
.substrate {
    position: relative;
    /* остальные стили сохраняются */
}


@media (max-width:1024px){
    #canvas-parent canvas {
        width: 100%;
        height: auto;
        object-fit: contain;
    }
    .first-screen{
        width: 100%;
        height: 50vh;
        overflow: hidden;
        touch-action: pan-y; 
    }
    .second-screen{
        width: 100%;
        height: 50vh;
    }
    .third-screen{
        width: 100%;
        height: 50vh;
    }
    .fourth-screen{
        width: 100%;
        height: 50vh;
    }
    .gray-element-2{
        width: 59.812vw;
        height: 55.41vw;
    }
}
@media (max-width:770px){
    .first-screen{
        width: 100%;
        height: 50vh;
    }
    .second-screen{
        width: 100%;
        height: 50vh;
    }
    .third-screen{
        width: 100%;
        height: 50vh;
    }
    .fourth-screen{
        width: 100%;
        height: 50vh;
    }
    .gray-element-2{
        width: 77.812vw;
        height: 51.41vw;
    }
}

@media(max-width: 360px){
    .first-screen{
        width: 100%;
        height: 100vh;
    }
    .second-screen{
        width: 100%;
        height: 100vh;
    }
    .third-screen{
        width: 100%;
        height: 100vh;
    }
    .fourth-screen{
        width: 100%;
        height: 100vh;
    }
    .gray-element-1{
        rotate: 90deg;
    }
    .rings{
    transform: translate(-50%, -50%) rotate(90deg);
    }
    .gray-element-1{
        width: 163.89vw;
        height: 52.78vw;
    }
    .active-sleep-box{
        width:  70vw;
        font-size: 3vw;
        line-height: 3vw;
        letter-spacing: -3%;
    }
    #nap-word{
    font-size:  6vw;
  }
  .bg-nap{
    font-size: 6vw;
    height: 4vw;
    font-weight: 600;
    color: #3F3F3F;
    background-color: #ffffff;
    padding-bottom: 0.21vw;
    display: flex;
    align-items: flex-end;
    }

    .rings{
        width: 166.11vw;
        height: 82.78vw;
    }

    .illustration-new-bg,
    .illustration-new-figure,
    .illustration-new-mask {
        width: 250vw; 
        height: 290vw;         /* высота подстраивается под пропорции */
        object-fit: cover;
    }
    .text-between {
        /* не задаем ширину статически, только при появлении */
        font-size: 4vw; /* адаптивный размер шрифта */
        width: 0;
        padding: 0;
        white-space: normal; /* перенос строк */
        word-wrap: break-word;
    }
    .text-between.show {
        width: 50vw; /* достаточно широкая область для текста */
        padding: 2vw;
    }
    .overlay-left.slide-out {
        transform: translateX(-25vw);
    }
    .overlay-right.slide-out {
        transform: translateX(25vw);
    }
    .gray-element-2{
        width: 203.89vw;
        height: 96.94vw;
        transform:translate(-50%, -50%) rotate(90deg);
    }
    .girl-right{
        width: 111.67vw;
        height: 66.67vw;
        top: 100%;
        transform: translateY(-100%);
    }
    .girl-left{
        width: 111.67vw;
        height: 66.67vw;
        top: 100%;
        transform: translateY(-100%);
        left: -68%;
    }
    #nap-word-bed {
        font-size: 5.5vw;
        padding-bottom: 0.21vw;
        margin: 0;
}

}