/* ===========================
   1. ОБЩИЕ НАСТРОЙКИ
=========================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    overflow-y: auto; /* Разрешаем вертикальный скролл */
}

html {
    scroll-behavior: smooth;
}

body {
    background: #f7f3ee;
    color: #40362f;
    font-family: 'Manrope', sans-serif;
}

img {
    width: 100%;
    display: block;
    transition: transform .6s ease;
}

img:hover {
    transform: scale(1.02);
}

h2 {
    font-family: 'Cormorant Garamond', serif;
    font-size: 48px;
    font-weight: 400;
    text-align: center;
    margin-bottom: 50px;
    position: relative;
}

h2::after {
    content: "";
    display: block;
    width: 70px;
    height: 2px;
    background: #c6ab86;
    margin: 20px auto 0;
}

p {
    line-height: 1.8;
    max-width: 620px;
    margin-left: auto;
    margin-right: auto;
}

/* ==========================================
   2. HERO (ПЕРВЫЙ ЭКРАН)
========================================== */
.hero {
    position: relative;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: url("images/hero.jpg") center center/cover no-repeat;
    background-attachment: scroll; /* Важно для плавности! */
    animation: heroZoom 20s ease-in-out infinite alternate;
    overflow: hidden; /* Убираем лишние скроллы */
    will-change: background-size; /* Оптимизация анимации */
    transform: translateZ(0); /* Включаем GPU ускорение */
    -webkit-backface-visibility: hidden;
        backface-visibility: hidden; /* стандартное свойство */

}

.hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(rgba(0,0,0,.20), rgba(0,0,0,.45));
    /* УБРАЛ backdrop-filter: blur(2px) — это тормозит! */
    pointer-events: none;
}

.hero-content {
    position: relative;
    z-index: 5;
    width: min(90%, 520px);
    padding: 60px 42px;
    border-radius: 32px;
    background: rgba(255,255,255,.08);
    /* Оставил blur для красоты, но если всё ещё лагает — убери эти 2 строки: */
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(255,255,255,.18);
    color: #fff;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    will-change: transform; /* Оптимизация */
    transform: translateZ(0);
}

.hero-content > *:not(.scroll) {
    opacity: 0;
    transform: translateY(30px);
    animation: fadeUp 1s forwards;
}

.hero-content > *:not(.scroll):nth-child(1) { animation-delay: .3s; }
.hero-content > *:not(.scroll):nth-child(2) { animation-delay: .6s; }
.hero-content > *:not(.scroll):nth-child(3) { animation-delay: .9s; }
.hero-content > *:not(.scroll):nth-child(4) { animation-delay: 1.2s; }

.date {
    font-size: 15px;
    letter-spacing: 4px;
    text-transform: uppercase;
    opacity: .85;
    margin-bottom: 24px;
}

.hero h1 {
    font-family: "Cormorant Garamond", serif;
    font-size: 104px;
    font-weight: 400;
    line-height: .92;
    margin: 0 auto 28px;
}

.hero h1 span {
    display: block;
    width: 100%;
    text-align: center;
    opacity: 0;
    transform: translateX(-8px);
    animation: titleUp .9s forwards;
}

.hero h1 span:nth-child(1) { animation-delay: .8s; }
.hero h1 span:nth-child(2) { animation-delay: 1s; }
.hero h1 span:nth-child(3) { animation-delay: 1.2s; }

.amp {
    font-size: 42px;
    margin: 8px 0;
    opacity: .85;
}

.time {
    font-size: 24px;
    letter-spacing: 3px;
    margin-bottom: 26px;
    opacity: .95;
}

.invite {
    font-size: 18px;
    line-height: 1.8;
    opacity: .9;
}

.scroll {
    width: 40px;
    height: 40px;
    margin: 55px auto 0;
    display: flex;
    justify-content: center;
    align-items: center;
    animation: scrollMove 2s ease-in-out infinite;
}

.scroll svg {
    width: 26px;
    height: 26px;
    display: block;
}

@keyframes heroZoom {
    from { background-size: 100%; }
    to { background-size: 110%; }
}

@keyframes titleUp {
    to { opacity: 1; transform: none; }
}

@keyframes fadeUp {
    to { opacity: 1; transform: translateY(0); }
}

@keyframes scrollMove {
    0% { transform: translateY(0); opacity: .55; }
    50% { transform: translateY(12px); opacity: 1; }
    100% { transform: translateY(0); opacity: .55; }
}

/* ===========================
   3. МУЗЫКА
=========================== */
.music-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 48px;
    height: 48px;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: white;
    cursor: pointer;
    z-index: 10000;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.music-toggle:hover {
    transform: scale(1.08);
    background: rgba(255,255,255,0.25);
}

.music-toggle.is-playing {
    background: rgba(255,255,255,0.3);
    border-color: rgba(255,255,255,0.5);
    box-shadow: 0 0 15px rgba(255,255,255,0.3);
}

.music-toggle svg {
    pointer-events: none;
}

.music-toggle svg path {
    stroke: #fff;
    transition: stroke 0.3s;
}

/* ===========================
   4. ИСТОРИЯ
=========================== */
.story {
    padding: 110px 24px;
    background: #faf8f5;
    text-align: center;
}

.story-grid {
    display: flex;
    flex-direction: column;
    gap: 50px;
    margin-top: 60px;
    align-items: center;
}

.story-item {
    width: 290px;
    background: white;
    padding: 16px;
    border-radius: 10px;
    box-shadow: 0 18px 45px rgba(0,0,0,.12);
    transition: .45s;
    opacity: 0;
    transform: translateY(40px);
}

.story-item.show {
    opacity: 1;
    transform: translateY(0);
}

.story-item:nth-child(1) { transform: rotate(-5deg); }
.story-item:nth-child(2) { transform: rotate(5deg); }
.story-item:hover { transform: rotate(0deg) scale(1.03); }

.story-item img {
    width: 100%;
    aspect-ratio: 3/4;
    object-fit: cover;
    border-radius: 4px;
}

.story-item h3 {
    font-family: 'Cormorant Garamond', serif;
    font-size: 36px;
    font-weight: 500;
    margin-top: 18px;
}

/* ===========================
   5. TIMELINE (НАШ ДЕНЬ)
=========================== */
.timeline {
    position: relative;
    padding: 140px 30px;
    background: #fbf9f6;
    overflow: hidden;
}

.timeline h2 {
    font-family: 'Cormorant Garamond', serif;
    font-size: 52px;
    font-weight: 500;
    text-align: center;
    color: #493d34;
    margin-bottom: 18px;
}

.timeline h2::after {
    content: "";
    display: block;
    width: 70px;
    height: 2px;
    margin: 22px auto 0;
    background: #cbb28d;
}

.timeline-line {
    position: relative;
    z-index: 2;
    max-width: 520px;
    margin: 0 auto;
    padding-left: 45px;
}

.timeline-line::before {
    content: "";
    position: absolute;
    left: 8px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #d8c4a5;
}

.event {
    position: relative;
    padding-bottom: 45px;
    opacity: 0;
    transform: translateY(35px);
    animation: showEvent .7s forwards;
}

.event:nth-child(1) { animation-delay: .15s; }
.event:nth-child(2) { animation-delay: .35s; }
.event:nth-child(3) { animation-delay: .55s; }
.event:nth-child(4) { animation-delay: .75s; }
.event:nth-child(5) { animation-delay: .95s; }

.circle {
    position: absolute;
    left: -45px;
    top: 8px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #b99a74;
    border: 4px solid #fff;
    box-shadow: 0 0 0 3px rgba(185,154,116,.18);
}

.content {
    background: #fff;
    border-radius: 20px;
    padding: 22px 26px;
    box-shadow: 0 18px 40px rgba(0,0,0,.08);
    transition: .35s;
}

.event:hover .content {
    transform: translateY(-5px);
    box-shadow: 0 25px 45px rgba(0,0,0,.10);
}

.content h4 {
    font-family: "Cormorant Garamond", serif;
    font-size: 30px;
    color: #9b7b58;
    margin-bottom: 8px;
}

.content p {
    font-size: 17px;
    color: #5e5349;
    line-height: 1.6;
}

@keyframes showEvent {
    to { opacity: 1; transform: none; }
}

/* ===========================
   6. CEREMONY & VENUE
=========================== */
.ceremony, .venue {
    padding: 120px 30px;
    text-align: center;
}

.ceremony { background: #fff; }
.venue { background: #fbf9f6; }

.ceremony h2, .venue h2 {
    font-family: "Cormorant Garamond", serif;
    font-size: 54px;
    font-weight: 400;
    color: #4b3f35;
    margin-bottom: 50px;
}

.ceremony img, .venue img {
    width: 100%;
    max-width: 720px;
    display: block;
    margin: 35px auto;
    border-radius: 28px;
    object-fit: cover;
    box-shadow: 0 20px 50px rgba(0,0,0,.12);
    transition: .4s;
}

.ceremony img:hover, .venue img:hover {
    transform: translateY(-6px);
}

.ceremony h3 {
    margin-top: 34px;
    font-family: "Cormorant Garamond", serif;
    font-size: 36px;
    font-weight: 400;
    line-height: 1.35;
    color: #4f4339;
}

.address {
    margin: 18px auto 35px;
    max-width: 420px;
    font-size: 17px;
    line-height: 1.8;
    color: #86786c;
}

.venue p:first-of-type {
    margin-top: 36px;
    font-family: "Cormorant Garamond", serif;
    font-size: 40px;
    color: #493d34;
}

.venue p:last-of-type {
    margin-top: 10px;
    margin-bottom: 36px;
    color: #85786b;
    font-size: 17px;
    line-height: 1.7;
}

.route-btn {
    display: inline-block;
    margin-top: 30px;
    padding: 16px 34px;
    border-radius: 100px;
    background: #b89776;
    color: white;
    text-decoration: none;
    font-weight: 600;
    transition: .35s;
}

.route-btn:hover {
    transform: translateY(-4px);
    box-shadow: 0 15px 35px rgba(184,151,118,.35);
}

/* ===========================
   7. DRESS CODE
=========================== */
.dress {
    padding: 130px 30px;
    background: #fbf9f6;
    text-align: center;
}

.dress h2 {
    font-family: "Cormorant Garamond", serif;
    font-size: 54px;
    font-weight: 400;
    color: #4b3f35;
    margin-bottom: 28px;
}

.dress-text {
    max-width: 420px;
    margin: 0 auto 55px;
    font-size: 17px;
    line-height: 1.8;
    color: #7d7065;
}

.colors {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 22px;
    margin-bottom: 70px;
}

.color {
    width: 74px;
    height: 74px;
    border-radius: 50%;
    transition: .35s;
    box-shadow: inset 0 8px 14px rgba(255,255,255,.35), 0 12px 24px rgba(0,0,0,.08);
}

.color:hover {
    transform: translateY(-8px) scale(1.08);
}

.c1 { background: #3b0505; }
.c2 { background: #160b04; }
.c3 { background: #000000fd; }
.c4 { background: #012207fd; }
.c5 { background: #09052c; }

.looks-title {
    margin: 70px 0 25px;
    font-family: 'Cormorant Garamond', serif;
    font-size: 36px;
    font-weight: 500;
    color: #54483d;
}

.looks-slider {
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    scroll-snap-type: x mandatory;
    cursor: grab;
}

.looks-slider::-webkit-scrollbar { display: none; }

.looks-track {
    display: flex;
    gap: 20px;
    width: max-content;
    margin: 0 auto;
    padding: 0 30px;
}

.looks-track img {
    width: 220px;
    aspect-ratio: 3/4;
    flex: 0 0 auto;
    object-fit: cover;
    border-radius: 22px;
    scroll-snap-align: center;
    box-shadow: 0 18px 38px rgba(0,0,0,.10);
    transition: .35s;
    cursor: zoom-in;
}

.looks-track img:hover {
    transform: translateY(-6px);
    box-shadow: 0 28px 50px rgba(0,0,0,.15);
}

/* ===========================
   8. ПОЖЕЛАНИЯ, ФОТО, ТАЙМЕР
=========================== */
.gift {
    text-align: center;
    background: #f7f3ee;
    padding: 120px 30px;
}

.gift h2 {
    font-family: "Cormorant Garamond", serif;
    font-size: 54px;
    font-weight: 400;
    color: #4b3f35;
    margin-bottom: 50px;
}

.gift p {
    max-width: 650px;
    margin: auto;
    font-size: 18px;
}

.couple {
    display: flex;
    justify-content: center;
    margin: 50px 0;
    padding: 0 20px;
}

.couple img {
    width: 300px;
    max-width: 75vw;
    height: auto;
    border-radius: 28px;
    overflow: hidden;
    box-shadow: 0 12px 35px rgba(0,0,0,.18);
    display: block;
}

.countdown {
    background: white;
    text-align: center;
    padding: 120px 30px;
}

.countdown h2 {
    font-family: "Cormorant Garamond", serif;
    font-size: 54px;
    font-weight: 400;
    color: #4b3f35;
    margin-bottom: 50px;
}

.timer {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 18px;
    max-width: 420px;
    margin: 50px auto 0;
}

.time-box {
    padding: 30px 15px;
    border-radius: 24px;
    background: rgba(255,255,255,.65);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    box-shadow: 0 15px 40px rgba(0,0,0,.08);
    transition: .35s;
}

.time-box:hover { transform: translateY(-6px); }

.time-box span {
    display: block;
    font-size: 52px;
    font-family: 'Cormorant Garamond', serif;
    margin-bottom: 10px;
}

.time-box small {
    letter-spacing: 2px;
    text-transform: uppercase;
    font-size: 12px;
    color: #8d7a69;
}

/* ===========================
   СНЕГ (ТОЛЬКО НА ПЕРВОМ ЭКРАНЕ)
=========================== */
.snow {
    position: absolute; /* Было fixed, меняем на absolute */
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh; /* Только высота первого экрана */
    pointer-events: none;
    z-index: 10; /* Ниже чем hero-content (у него z-index: 5) */
    overflow: hidden;
}

.snow span {
    position: absolute;
    top: -10px;
    width: 6px;
    height: 6px;
    background: white;
    border-radius: 50%;
    opacity: .8;
    animation: snow linear infinite;
    box-shadow: 0 0 8px rgba(255,255,255,.8);
}

@keyframes snow {
    0% { transform: translateY(-10px); }
    100% { transform: translateY(110vh); }
}

/* ===========================
   ВИДЕО КОНВЕРТ
=========================== */
#intro {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #f5f0e8;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 999999;
    cursor: pointer;
    overflow: hidden;
}

#intro video {
    width: 100%;
    height: 100%;
    object-fit: contain; /* На компе — на весь экран, как было */
    border-radius: 0;
}

#intro.fade-out {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.8s ease;
}

/* МОБИЛЬНАЯ ВЕРСИЯ — видео поменьше */
@media(max-width: 768px) {
    #intro video {
        width: 100%;
        height: 100%;
        object-fit: cover;
        border-radius: 0;
    }

    @media(max-width: 768px) {
    .hero {
        background-size: 130% 130% !important; /* Увеличиваем фон на 30% */
        background-position: center center !important;
    }
}
}
/* ===========================
   11. ЛАЙТБОКС
=========================== */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.lightbox.active {
    opacity: 1;
    visibility: visible;
}

.lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    transition: background 0.4s ease;
}

.lightbox-close {
    position: absolute;
    top: 24px;
    right: 24px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease, background 0.3s ease;
}

.lightbox-close:hover {
    transform: scale(1.1);
    background: rgba(255, 255, 255, 0.25);
}

.lightbox-content {
    position: relative;
    z-index: 5;
    max-width: 90%;
    max-height: 90vh;
    transform: scale(0.85);
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.lightbox.active .lightbox-content {
    transform: scale(1);
}

.lightbox-content img {
    max-width: 100%;
    max-height: 85vh;
    border-radius: 20px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
    object-fit: contain;
    display: block;
}

/* ==========================================
   12. АДАПТАЦИЯ ПОД МОБИЛЬНЫЕ (до 768px)
========================================== */
@media(max-width: 768px) {
    h2 { font-size: 36px; margin-bottom: 30px; }
    h2::after { width: 50px; margin: 15px auto 0; }

    .hero h1 { font-size: 56px; margin: 0 auto 20px; }
    .hero .amp { font-size: 32px; }
    .hero-content { padding: 40px 25px; width: 90%; }
    .date { font-size: 13px; letter-spacing: 3px; }
    .time { font-size: 20px; }
    .invite { font-size: 16px; }

    .timeline, .ceremony, .venue, .dress, .gift, .countdown {
        padding: 80px 20px !important;
    }

    .timeline-line { padding-left: 30px !important; max-width: 100% !important; }
    .circle { left: -30px !important; width: 14px !important; height: 14px !important; border-width: 3px !important; }
    .timeline-line::before { left: 7px !important; }
    .content { padding: 18px 20px !important; }
    .content h4 { font-size: 24px !important; }
    .content p { font-size: 15px !important; }

    .ceremony img, .venue img { max-width: 100% !important; border-radius: 20px !important; }
    .ceremony h3 { font-size: 28px !important; }
    .address { font-size: 15px !important; }
    .venue p:first-of-type { font-size: 32px !important; }

    .color { width: 45px !important; height: 45px !important; }
    .colors { gap: 15px !important; flex-wrap: nowrap !important; justify-content: center !important; }
    .looks-track img { width: 180px !important; }

    .route-btn { padding: 14px 28px !important; font-size: 15px !important; }
    .time-box { padding: 20px 10px !important; }
    .time-box span { font-size: 40px !important; }
    .time-box small { font-size: 10px !important; }
    .music-toggle { width: 42px !important; height: 42px !important; top: 15px !important; right: 15px !important; }

    /* Мобильный конверт */
    .envelope-new { width: 320px; height: 224px; }
    .card-names { font-size: 26px; }
    .card-text { font-size: 11px; }
}

@media(max-width: 480px) {
    .hero h1 { font-size: 44px; }
    .hero .amp { font-size: 26px; }
    h2 { font-size: 30px; }
    .timeline-line { padding-left: 25px !important; }
    .circle { left: -25px !important; width: 12px !important; height: 12px !important; }
    .timeline-line::before { left: 6px !important; }
    .content h4 { font-size: 22px !important; }
    .content p { font-size: 14px !important; }
}

.looks-slider {
    position: relative;
    padding-bottom: 30px;
}

.swipe-hint {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 4px;
    background: #b89776;
    border-radius: 2px;
    pointer-events: none;
    z-index: 10;
    opacity: 0.7;
    animation: swipeHint 2s ease-in-out infinite;
    transition: opacity 0.5s ease;
}

@keyframes swipeHint {
    0%, 100% {
        transform: translateX(-50%) translateX(0);
        opacity: 0.5;
    }
    50% {
        transform: translateX(-50%) translateX(15px);
        opacity: 1;
    }
}

.swipe-hint.hidden {
    opacity: 0;
    pointer-events: none;
}

@media(min-width: 769px) {
    .swipe-hint {
        display: none;
    }
}