:root {
    --cream: #f5f0e8;
    --beige: #ded1bd;
    --dark: #273028;
    --brown: #765b45;
    --text: #2c2924;

    --serif: "Cormorant Garamond", Georgia, serif;
    --sans: "Montserrat", Arial, sans-serif;
    --script: "Great Vibes", cursive;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    color: var(--text);
    background: var(--cream);
    font-family: var(--sans);
    font-size: 15px;
    line-height: 1.6;
}

body.intro-active {
    overflow: hidden;
}

img {
    display: block;
    max-width: 100%;
}

button {
    font: inherit;
}

section {
    position: relative;
    overflow: hidden;
}


/* =========================================
   ЭКРАН ЗАГРУЗКИ
   ========================================= */

.intro-screen {
    position: fixed;
    inset: 0;
    z-index: 1000;
    overflow: hidden;
    pointer-events: none;

    background:
        radial-gradient(
            circle at 50% 45%,
            rgba(255, 248, 237, 0.36),
            transparent 34%
        ),
        linear-gradient(
            135deg,
            #d5c0a7 0%,
            #c8b096 48%,
            #d9c8b3 100%
        );

    animation: intro-fade-out 0.65s 2.55s
        cubic-bezier(0.76, 0, 0.24, 1)
        forwards;
}

.intro-screen::before,
.intro-screen::after {
    content: "";
    position: absolute;
    pointer-events: none;
}

.intro-screen::before {
    inset: 0;
    opacity: 0.18;

    background-image:
        radial-gradient(
            rgba(83, 59, 41, 0.35) 0.7px,
            transparent 0.7px
        );

    background-size: 5px 5px;
    mix-blend-mode: multiply;
}

.intro-screen::after {
    top: 50%;
    left: 50%;
    width: min(90vw, 540px);
    height: min(90vw, 540px);

    border: 1px solid rgba(255, 250, 240, 0.28);
    border-radius: 50%;

    opacity: 0;
    transform: translate(-50%, -50%) scale(0.7);

    animation: intro-halo 1.2s 0.35s ease-out forwards;
}

.intro-envelope {
    position: absolute;
    inset: 0;
    overflow: hidden;
}


/* Лист бумаги */

.intro-paper {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 2;

    width: min(76vw, 430px);
    height: min(54vh, 290px);

    background:
        linear-gradient(
            135deg,
            rgba(255, 255, 255, 0.7),
            transparent 43%
        ),
        linear-gradient(
            315deg,
            rgba(199, 164, 132, 0.12),
            transparent 55%
        ),
        #f8f0e4;

    box-shadow:
        0 20px 35px rgba(78, 55, 38, 0.16),
        0 0 0 1px rgba(255, 250, 242, 0.45);

    opacity: 0;
    transform: translate(-50%, -50%) scale(0.84) rotate(-1deg);

    animation: intro-paper-in 0.95s 0.15s
        cubic-bezier(0.22, 1, 0.36, 1)
        forwards;
}

.intro-paper::before {
    content: "";

    position: absolute;
    inset: 14px;

    border: 1px solid rgba(145, 107, 77, 0.2);
}


/* Надпись на листе */

.intro-letter-text {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 4;

    width: 90%;

    color: #75533e;
    font-family: var(--script);
    font-size: clamp(32px, 7vw, 58px);
    line-height: 1.05;
    text-align: center;

    opacity: 0;
    transform: translate(-50%, -50%) translateY(12px);

    animation: intro-letter-text-in 1s 1.35s
        cubic-bezier(0.22, 1, 0.36, 1)
        forwards;
}


/* Боковые части конверта */

.intro-left,
.intro-right {
    position: absolute;
    top: 0;
    z-index: 3;

    width: 51%;
    height: 100%;

    background:
        linear-gradient(
            145deg,
            rgba(255, 255, 255, 0.16),
            transparent 44%
        ),
        #d5c0a7;

    box-shadow:
        0 0 35px rgba(94, 63, 39, 0.1);
}

.intro-left {
    left: 0;
    transform-origin: left center;

    animation: intro-left-open 1.45s 0.75s
        cubic-bezier(0.76, 0, 0.18, 1)
        forwards;
}

.intro-right {
    right: 0;
    transform-origin: right center;

    animation: intro-right-open 1.45s 0.75s
        cubic-bezier(0.76, 0, 0.18, 1)
        forwards;
}


/* Декоративные линии */

.intro-left::after,
.intro-right::after {
    content: "";

    position: absolute;
    top: 50%;

    width: 180px;
    height: 1px;

    background: rgba(255, 248, 237, 0.25);
}

.intro-left::after {
    right: 25px;
    transform: rotate(-35deg);
}

.intro-right::after {
    left: 25px;
    transform: rotate(35deg);
}


/* Печать */

.intro-seal {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 5;

    width: 66px;
    height: 66px;

    border: 1px solid rgba(255, 239, 219, 0.85);
    border-radius: 50%;

    background:
        radial-gradient(
            circle at 35% 30%,
            #c39b78,
            #a77b5c 72%
        );

    box-shadow:
        0 8px 22px rgba(70, 44, 27, 0.2),
        inset 0 0 0 5px rgba(255, 255, 255, 0.08);

    opacity: 0;
    transform: translate(-50%, -50%) scale(0.55);

    animation:
        intro-seal-in 0.7s 0.65s
            cubic-bezier(0.22, 1, 0.36, 1)
            forwards,
        intro-seal-out 0.65s 1.52s ease-in forwards;
}

.intro-seal::before,
.intro-seal::after {
    content: "";

    position: absolute;
    top: 50%;
    left: 50%;

    background: rgba(255, 241, 222, 0.7);
    transform: translate(-50%, -50%);
}

.intro-seal::before {
    width: 27px;
    height: 1px;
}

.intro-seal::after {
    width: 1px;
    height: 27px;
}

.intro-seal span {
    position: absolute;
    top: 50%;
    left: 50%;

    width: 30px;
    height: 30px;

    border: 1px solid rgba(255, 241, 222, 0.7);
    border-radius: 50%;

    transform: translate(-50%, -50%);
}


/* Анимации экрана загрузки */

@keyframes intro-paper-in {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.84) rotate(-1deg);
    }

    100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1) rotate(0);
    }
}

@keyframes intro-letter-text-in {
    0% {
        opacity: 0;
        filter: blur(4px);
        transform: translate(-50%, -50%) translateY(12px);
    }

    100% {
        opacity: 1;
        filter: blur(0);
        transform: translate(-50%, -50%) translateY(0);
    }
}

@keyframes intro-halo {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.7);
    }

    45% {
        opacity: 0.75;
    }

    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(1.05);
    }
}

@keyframes intro-seal-in {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.55) rotate(-12deg);
    }

    70% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.08) rotate(3deg);
    }

    100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1) rotate(0);
    }
}

@keyframes intro-seal-out {
    from {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }

    to {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.75);
    }
}

@keyframes intro-left-open {
    0% {
        opacity: 1;
        transform: translateX(0) rotate(0);
    }

    52% {
        opacity: 1;
        transform: translateX(-12%) rotate(-2deg);
    }

    100% {
        opacity: 0;
        transform: translateX(-108%) rotate(-6deg);
    }
}

@keyframes intro-right-open {
    0% {
        opacity: 1;
        transform: translateX(0) rotate(0);
    }

    52% {
        opacity: 1;
        transform: translateX(12%) rotate(2deg);
    }

    100% {
        opacity: 0;
        transform: translateX(108%) rotate(6deg);
    }
}

@keyframes intro-fade-out {
    0% {
        opacity: 1;
    }

    100% {
        opacity: 0;
        visibility: hidden;
    }
}


/* =========================================
   ГЛАВНЫЙ ЭКРАН
   ========================================= */

.hero {
    min-height: 100svh;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 50px 20px;

    color: #fffaf1;
    background-image: url("images/hero-bg.jpg");
    background-position: center;
    background-size: cover;
}

.hero-overlay {
    position: absolute;
    inset: 0;

    background: linear-gradient(
        rgba(22, 29, 23, 0.3),
        rgba(22, 29, 23, 0.78)
    );
}

.hero-content {
    position: relative;
    z-index: 1;

    width: 100%;
    max-width: 760px;

    text-align: center;
    opacity: 0;
    transform: translateY(25px);
}

body.intro-finished .hero-content {
    animation: hero-appear 1.2s 0.15s forwards;
}

.polaroid {
    width: min(260px, 67vw);

    margin: 0 auto 42px;
    padding: 11px 11px 13px;

    background: #fffdf7;
    box-shadow: 0 22px 50px rgba(0, 0, 0, 0.3);

    transform: rotate(-4deg);
}

.polaroid-image {
    position: relative;
    overflow: hidden;
}

.polaroid-image img {
    width: 100%;
    aspect-ratio: 0.82;
    object-fit: cover;
}

.polaroid-date {
    position: absolute;
    right: 10px;
    bottom: 10px;
    left: 10px;

    padding: 7px 4px;

    color: #fff;
    background: rgba(28, 28, 23, 0.55);

    font-family: var(--serif);
    font-size: 20px;
    line-height: 1;
}

.hero-names {
    display: flex;
    flex-direction: column;

    margin: 0;

    font-family: var(--serif);
    font-size: clamp(58px, 13vw, 125px);
    font-weight: 400;
    line-height: 0.78;
    letter-spacing: -0.04em;
}

.hero-names span:nth-child(2) {
    margin: 12px 0;

    font-family: var(--script);
    font-size: 0.52em;
    line-height: 0.5;
}


/* =========================================
   ПИСЬМО
   ========================================= */

.invitation {
    padding: 75px 20px 90px;

    background: var(--cream);
    text-align: center;
}

.invitation-title {
    margin: 0 auto 55px;

    color: var(--brown);
    font-family: var(--serif);
    font-size: clamp(48px, 9vw, 88px);
    font-weight: 400;
    line-height: 1;
}

.envelope-wrapper {
    display: flex;
    justify-content: center;
}

.envelope {
    position: relative;

    width: min(440px, 91vw);
    height: 290px;

    overflow: hidden;
    cursor: pointer;
    isolation: isolate;
}

.envelope-back {
    position: absolute;
    inset: 0;
    z-index: 1;

    background: #a68b70;
    box-shadow: 0 25px 40px rgba(47, 35, 26, 0.2);
}

.letter {
    position: absolute;
    top: 40px;
    right: 8%;
    left: 8%;
    z-index: 3;

    height: 220px;
    overflow: hidden;

    padding: 15px 20px;

    color: #332c25;
    background: #fffaf0;
    box-shadow: 0 5px 16px rgba(44, 30, 20, 0.18);

    opacity: 0;
    transform: translateY(85%);

    transition:
        opacity 0.65s ease,
        transform 0.85s cubic-bezier(0.22, 1, 0.36, 1);
}

.letter-content {
    font-family: var(--serif);
    font-size: 16px;
    line-height: 1.08;
    text-align: left;
}

.letter-content p {
    margin: 0 0 8px;
}

.letter-greeting {
    font-size: 24px;
}

.letter-signature {
    margin-top: 12px !important;
    text-align: right;
}

.envelope-front {
    position: absolute;
    inset: 0;
    z-index: 4;

    pointer-events: none;

    clip-path: polygon(
        0 58%,
        50% 35%,
        100% 58%,
        100% 100%,
        0 100%
    );

    background: #b69b7f;
}

.envelope-flap {
    position: absolute;
    inset: 0;
    z-index: 5;

    pointer-events: none;

    clip-path: polygon(
        0 0,
        100% 0,
        50% 62%
    );

    background: #c4ab91;
    transform-origin: top center;

    transition:
        transform 0.8s ease,
        z-index 0s linear 0.4s;
}

.envelope-button {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 8;

    padding: 12px 21px;

    border: 1px solid rgba(255, 255, 255, 0.8);

    color: #fff;
    background: rgba(79, 57, 41, 0.88);

    cursor: pointer;

    font-size: 10px;
    letter-spacing: 0.14em;
    text-transform: uppercase;

    transform: translate(-50%, -50%);
    transition: opacity 0.3s ease;
}

.envelope.is-open .letter {
    z-index: 6;
    opacity: 1;
    transform: translateY(0);
}

.envelope.is-open .envelope-flap {
    z-index: 2;
    transform: rotateX(180deg);
}

.envelope.is-open .envelope-button {
    visibility: hidden;
    opacity: 0;
}


/* =========================================
   ОБЩИЕ ЗАГОЛОВКИ
   ========================================= */

.section-title {
    margin: 0;

    font-family: var(--serif);
    font-size: clamp(48px, 9vw, 90px);
    font-weight: 400;
    line-height: 0.95;
}


/* =========================================
   ПЛАН ДНЯ
   ========================================= */

.timing {
    padding: 90px 20px;

    color: var(--cream);
    background-image: url("images/timing-bg.jpg");
    background-position: center;
    background-size: cover;
}

.timing-overlay {
    position: absolute;
    inset: 0;

    background: rgba(27, 36, 29, 0.87);
}

.timing-content {
    position: relative;
    z-index: 1;

    max-width: 850px;
    margin: 0 auto;
}

.timeline {
    max-width: 780px;
    margin: 70px auto 0;
}

.timeline-item {
    display: grid;
    grid-template-columns: 105px 18px 1fr;
    gap: 16px;

    min-height: 135px;

    opacity: 0;
    transform: translateX(-40px);

    transition:
        opacity 0.8s ease,
        transform 0.8s ease;
}

.timeline-item.is-visible {
    opacity: 1;
    transform: translateX(0);
}

.timeline-item time {
    color: #dcc8ae;
    font-family: var(--serif);
    font-size: 21px;
    line-height: 1.1;
}

.timeline-line {
    position: relative;

    width: 1px;
    height: 100%;

    background: rgba(255, 255, 255, 0.28);
}

.timeline-line span {
    position: absolute;
    top: 4px;
    left: 50%;

    width: 9px;
    height: 9px;

    border: 1px solid #dcc8ae;
    border-radius: 50%;

    background: var(--dark);
    transform: translateX(-50%);
}

.timeline-description {
    padding-bottom: 25px;
}

.timeline-description h3 {
    margin: 0 0 7px;

    color: #f0e2d0;
    font-family: var(--serif);
    font-size: 31px;
    font-weight: 500;
    line-height: 1;
}

.timeline-description p {
    max-width: 500px;
    margin: 0;

    color: #c2beb4;
    font-size: 13px;
}


/* =========================================
   ДРЕСС-КОД
   ========================================= */

.dress-code {
    padding: 48px 20px;
    background: var(--beige);
}

.dress-code-content {
    max-width: 760px;
    margin: 0 auto;
}

.dress-code .section-title {
    margin-bottom: 20px;
    color: var(--brown);
}

.dress-code p {
    margin: 0;
    font-size: 15px;
    line-height: 1.75;
}


/* =========================================
   ДЕТАЛИ
   ========================================= */

.details {
    padding: 80px 20px;
    background: var(--cream);
}

.details > .section-title {
    margin-bottom: 55px;

    color: var(--brown);
    text-align: center;
}

.details-grid {
    display: grid;
    gap: 55px;

    max-width: 1050px;
    margin: 0 auto;
}

.detail-card img {
    width: 100%;
    aspect-ratio: 1.25;
    object-fit: cover;
}

.detail-card p {
    max-width: 550px;
    margin: 22px auto 0;

    color: #70675d;
    font-size: 14px;
    line-height: 1.7;
}


/* =========================================
   МЕСТО ВСТРЕЧИ
   ========================================= */

.location {
    min-height: 570px;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 75px 20px;

    color: var(--cream);
    text-align: center;

    background-image: url("images/location-bg.jpg");
    background-position: center;
    background-size: cover;
}

.location-overlay {
    position: absolute;
    inset: 0;
    background: rgba(26, 35, 28, 0.8);
}

.location-content {
    position: relative;
    z-index: 1;
}

.location .section-title {
    margin-bottom: 28px;
}

.location-address {
    margin: 0 0 35px;

    color: #eee5d8;
    font-family: var(--serif);
    font-size: clamp(27px, 5vw, 39px);
    line-height: 1.15;
}

.map-button {
    display: inline-block;

    padding: 13px 21px;

    border: 1px solid rgba(255, 255, 255, 0.75);

    color: var(--cream);
    font-size: 10px;
    letter-spacing: 0.12em;
    text-decoration: none;
    text-transform: uppercase;
}


/* =========================================
   ТАЙМЕР
   ========================================= */

.countdown {
    padding: 42px 20px 32px;

    background: var(--beige);
    text-align: center;
}

.countdown .section-title {
    margin-bottom: 28px;

    color: var(--brown);
    font-size: clamp(42px, 8vw, 70px);
}

.timer {
    display: flex;
    align-items: flex-start;
    justify-content: center;

    gap: clamp(6px, 2vw, 22px);
}

.timer-item {
    min-width: 58px;
}

.timer-item strong {
    display: block;

    color: var(--brown);
    font-family: var(--serif);
    font-size: clamp(38px, 7vw, 64px);
    font-weight: 500;
    line-height: 1;
}

.timer-item span {
    display: block;
    margin-top: 5px;

    color: #817365;
    font-size: 8px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.timer-divider {
    color: var(--brown);
    font-family: var(--serif);
    font-size: 31px;
    line-height: 1;
}


/* =========================================
   ПРОЧИЕ АНИМАЦИИ И АДАПТИВ
   ========================================= */

@keyframes hero-appear {
    from {
        opacity: 0;
        transform: translateY(25px) scale(0.97);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@media (min-width: 700px) {
    .invitation,
    .timing,
    .details {
        padding-top: 105px;
        padding-bottom: 105px;
    }

    .details-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 70px;
    }

    .detail-card:nth-child(2) {
        margin-top: 70px;
    }
}

@media (max-width: 520px) {
    .hero {
        background-image: url("images/hero-bg-mobile.jpg");
    }

    .timing {
        background-image: url("images/timing-bg-mobile.jpg");
    }

    .intro-paper {
        width: 82vw;
        height: 34vh;
    }

    .intro-letter-text {
        width: 88%;
        font-size: clamp(31px, 9vw, 48px);
    }

    .timeline-item {
        grid-template-columns: 80px 15px 1fr;
        gap: 9px;
    }

    .timeline-item time {
        font-size: 17px;
    }

    .timeline-description h3 {
        font-size: 25px;
    }

    .timeline-description p {
        font-size: 12px;
    }

    .letter {
        top: 35px;
        right: 7%;
        left: 7%;
        height: 220px;
        padding: 13px 15px;
    }

    .letter-content {
        font-size: 13px;
    }

    .letter-greeting {
        font-size: 21px;
    }

    .timer {
        gap: 5px;
    }

    .timer-item {
        min-width: 47px;
    }

    .timer-item strong {
        font-size: 35px;
    }

    .timer-divider {
        font-size: 25px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}