:root {
    /* Color Palette */
    --color-olive-petal: #B9B07B;
    --color-raw-sugar: #BA7770;
    --color-golden-clover: #EDCE91;
    --color-artic-daisy: #71744F;

    /* Neaturals */
    --color-bg: #FAF9F6;
    /* Off-white / Pearl */
    --color-text: #2C3531;
    /* Deep charcoal with green hint */
    --color-text-light: #545E58;
    --color-white: #FFFFFF;

    /* Typography */
    --font-serif: 'Cormorant Garamond', serif;
    --font-sans: 'Montserrat', sans-serif;

    /* Formatting */
    --transition: all 0.5s cubic-bezier(0.25, 1, 0.5, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    color: var(--color-text);
    background-color: var(--color-bg);
    line-height: 1.6;
    overflow-x: hidden;
}

h1,
h2,
h3,
h4,
.nav-brand {
    font-family: var(--font-serif);
    font-weight: 400;
}

/* No-scroll helper */
.no-scroll {
    overflow: hidden;
}

/* --- Envelope Overlay --- */
.envelope-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100dvh;
    background-color: var(--color-bg);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 1s ease-in-out, visibility 1s ease-in-out;
}

.envelope-overlay.hide {
    opacity: 0;
    visibility: hidden;
}

.envelope-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
}

.envelope {
    position: relative;
    width: 300px;
    height: 200px;
    background-color: var(--color-olive-petal);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
    border-radius: 4px;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* The Paper Letter Inside */
.envelope-letter {
    position: absolute;
    bottom: 0;
    width: 280px;
    height: 180px;
    margin: 0 auto;
    background-color: white;
    border-radius: 4px;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 1.2s cubic-bezier(0.25, 1, 0.5, 1) 0.5s;
    z-index: 2;
}

.letter-text {
    font-family: var(--font-serif);
    font-size: 1.5rem;
    color: var(--color-text);
    font-style: italic;
    opacity: 0;
    transition: opacity 0.5s ease 1s;
    margin: 0;
}

/* Front folded triangles */
.envelope-front {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-left: 150px solid transparent;
    border-right: 150px solid transparent;
    border-bottom: 120px solid var(--color-olive-petal);
    border-radius: 0 0 4px 4px;
    z-index: 3;
    pointer-events: none;
    filter: drop-shadow(0 -5px 5px rgba(0, 0, 0, 0.05));
}

.envelope-front::before {
    content: '';
    position: absolute;
    top: 0;
    left: -150px;
    width: 0;
    height: 0;
    border-top: 100px solid transparent;
    border-bottom: 100px solid transparent;
    border-left: 150px solid rgba(185, 176, 123, 0.95);
    /* matching olive petal loosely */
    z-index: 4;
}

.envelope-front::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 0;
    border-top: 100px solid transparent;
    border-bottom: 100px solid transparent;
    border-right: 150px solid rgba(185, 176, 123, 0.95);
    z-index: 4;
}

/* Top Flap */
.envelope-flap {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-left: 150px solid transparent;
    border-right: 150px solid transparent;
    border-top: 120px solid var(--color-artic-daisy);
    transform-origin: top;
    transition: transform 0.6s cubic-bezier(0.5, 0, 0.2, 1);
    z-index: 5;
    filter: drop-shadow(0 5px 5px rgba(0, 0, 0, 0.1));
}

/* Wax Seal */
.envelope-seal {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -20px);
    width: 60px;
    height: 60px;
    background-color: var(--color-golden-clover);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: var(--font-serif);
    font-style: italic;
    color: var(--color-text);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2), inset 0 0 8px rgba(0, 0, 0, 0.1);
    z-index: 6;
    transition: opacity 0.3s ease;
}

.envelope-instruction {
    margin-top: 3rem;
    font-family: var(--font-sans);
    letter-spacing: 3px;
    text-transform: uppercase;
    font-size: 0.9rem;
    color: var(--color-text);
    opacity: 0.7;
    animation: pulse 2s infinite;
}

/* --- Envelope Animations --- */
.envelope-wrapper.open .envelope-seal {
    opacity: 0;
}

.envelope-wrapper.open .envelope-flap {
    transform: rotateX(180deg);
    z-index: 1;
    /* drops behind letter */
}

.envelope-wrapper.open .envelope-letter {
    transform: translateY(-80px);
    z-index: 4;
    /* pulls in front of back flap */
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.envelope-wrapper.open .letter-text {
    opacity: 1;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 0.7;
    }

    50% {
        opacity: 0.3;
    }
}

/* Navbar */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    padding: 1.5rem 4rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1000;
    transition: background-color 0.4s ease, padding 0.4s ease;
}

.navbar.scrolled {
    background-color: rgba(250, 249, 246, 0.95);
    backdrop-filter: blur(10px);
    padding: 1rem 4rem;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.05);
}

.nav-brand {
    font-size: 2rem;
    color: var(--color-white);
    text-decoration: none;
    transition: color 0.4s ease;
}

.navbar.scrolled .nav-brand {
    color: var(--color-text);
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 2.5rem;
}

.nav-links a {
    text-decoration: none;
    color: var(--color-white);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: 500;
    transition: color 0.4s ease;
    position: relative;
}

.navbar.scrolled .nav-links a {
    color: var(--color-text);
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 1px;
    background-color: var(--color-artic-daisy);
    transition: width 0.3s ease;
}

.nav-links a:hover::after {
    width: 100%;
}

/* Hamburger Menu Toggle */
.menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 21px;
    cursor: pointer;
    z-index: 1001;
    /* Above mobile menu */
}

.menu-toggle .bar {
    height: 2px;
    width: 100%;
    background-color: var(--color-white);
    border-radius: 2px;
    transition: all 0.3s ease;
}

.navbar.scrolled .menu-toggle .bar {
    background-color: var(--color-text);
}

/* Mobile Menu Active State (Hamburger Animation) */
.menu-toggle.is-active .bar:nth-child(1) {
    transform: translateY(9.5px) rotate(45deg);
}

.menu-toggle.is-active .bar:nth-child(2) {
    opacity: 0;
}

.menu-toggle.is-active .bar:nth-child(3) {
    transform: translateY(-9.5px) rotate(-45deg);
}

/* Hero Section */
.hero {
    height: 100dvh;
    width: 100vw;
    background-image: url('assets/hero.png');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    color: var(--color-white);
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.4));
    z-index: 1;
}

.hero-content {
    position: relative;
    z-index: 2;
    padding: 0 2rem;
    animation: fadeInDown 1.5s ease;
}

.hero-subtitle {
    font-size: 1.2rem;
    letter-spacing: 4px;
    text-transform: uppercase;
    margin-bottom: 1rem;
    font-family: var(--font-sans);
    font-weight: 300;
}

.hero-title {
    font-size: 6rem;
    margin-bottom: 1.5rem;
    line-height: 1.1;
    font-weight: 300;
    font-style: italic;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.hero-date {
    font-size: 1.1rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    font-weight: 400;
}

.scroll-indicator {
    position: absolute;
    bottom: 2rem;
    z-index: 2;
    color: var(--color-white);
    animation: bounce 2s infinite;
    cursor: pointer;
}

/* Sections Common */
.section {
    padding: 8rem 2rem;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

.text-center {
    text-align: center;
}

.max-w-md {
    max-width: 800px;
}

.section-title {
    font-size: clamp(2.5rem, 5vw, 3.5rem);
    color: var(--color-artic-daisy);
    margin-bottom: 1.5rem;
    line-height: 1.2;
}

.section-subtitle {
    font-size: clamp(1rem, 2vw, 1.2rem);
    color: var(--color-golden-clover);
    text-transform: uppercase;
    letter-spacing: 3px;
    margin-bottom: 2rem;
    font-family: var(--font-sans);
}

p {
    margin-bottom: 1.5rem;
    color: var(--color-text-light);
    font-weight: 300;
    font-size: clamp(1rem, 1.5vw, 1.1rem);
    line-height: 1.8;
}

/* Split Layout */
.split-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6rem;
    align-items: center;
}

.split-layout.inverse {
    grid-template-areas: "content image";
}

.split-layout.inverse .content-wrapper {
    grid-area: content;
}

.split-layout.inverse .image-wrapper {
    grid-area: image;
}

.image-wrapper img {
    width: 100%;
    height: auto;
    border-radius: 4px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    transition: transform 0.7s ease;
}

.image-wrapper:hover img {
    transform: scale(1.02);
}

/* Double Image Layout (Our Story) */
.image-wrapper.double-image {
    display: flex;
    flex-direction: column;
    gap: 3rem;
}

/* Dress Code Palette */
.color-desc {
    max-width: 600px;
    margin: 0 auto 4rem auto;
}

.color-palette {
    display: flex;
    justify-content: center;
    gap: 3rem;
    flex-wrap: wrap;
}

.color-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: transform 0.3s ease;
}

.color-card:hover {
    transform: translateY(-10px);
}

.color-swatch {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    margin-bottom: 1.5rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    border: 4px solid var(--color-white);
}

.color-name {
    font-family: var(--font-serif);
    font-size: 1.5rem;
    color: var(--color-text);
    margin-bottom: 0.5rem;
}

.color-hex {
    font-size: 0.9rem;
    color: var(--color-text-light);
    letter-spacing: 1px;
}

/* Venue details */
.venue-details {
    margin-top: 3rem;
    padding: 2rem;
    background-color: var(--color-white);
    border-left: 4px solid var(--color-raw-sugar);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
}

.venue-details p {
    margin-bottom: 0.5rem;
    color: var(--color-text);
}

.venue-details p:last-child {
    margin-bottom: 0;
}

/* Footer */
.footer {
    background-color: var(--color-artic-daisy);
    color: var(--color-white);
    text-align: center;
    padding: 6rem 2rem;
}

.footer h2 {
    font-size: 4rem;
    margin-bottom: 1rem;
    font-style: italic;
}

.footer p {
    color: var(--color-bg);
    opacity: 0.9;
    letter-spacing: 2px;
}

.footer .thank-you {
    margin-top: 2rem;
    font-family: var(--font-serif);
    font-size: 1.5rem;
    text-transform: none;
    letter-spacing: 1px;
    font-style: italic;
}

/* Animations Triggered by Intersecton Observer */
.fade-in {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 1s ease-out, transform 1s ease-out;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

.slide-up {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 1s ease-out, transform 1s ease-out;
}

.slide-up.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Music Control Toggle */
.music-toggle {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: var(--color-olive-petal);
    color: var(--color-white);
    border: none;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    z-index: 1000;
    transition: var(--transition);
    opacity: 1;
    visibility: visible;
}

.music-toggle.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: scale(0.8);
}

.music-toggle:hover:not(.hidden) {
    transform: scale(1.1);
    background-color: var(--color-artic-daisy);
}

.music-toggle.muted {
    background-color: var(--color-raw-sugar);
}

/* Keyframes */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes bounce {

    0%,
    20%,
    50%,
    80%,
    100% {
        transform: translateY(0);
    }

    40% {
        transform: translateY(-15px);
    }

    60% {
        transform: translateY(-7px);
    }
}

/* Responsive */
@media screen and (max-width: 900px) {
    .hero {
        /* iOS Safari has a bug where background-attachment: fixed causes massive scaling */
        background-attachment: scroll;
        background-position: center center;
    }

    .split-layout {
        grid-template-columns: 1fr;
        gap: 3rem;
    }

    .split-layout.inverse {
        grid-template-areas: "image" "content";
    }

    .hero-title {
        font-size: clamp(3.5rem, 10vw, 6rem);
    }

    .hero-subtitle {
        font-size: clamp(0.9rem, 3vw, 1.2rem);
    }

    .section-title {
        font-size: clamp(2.2rem, 8vw, 2.5rem);
    }

    .navbar {
        padding: 1.2rem 1.5rem;
    }

    .navbar.scrolled {
        padding: 1rem 1.5rem;
    }

    .menu-toggle {
        display: flex;
    }

    .nav-links {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 2rem;
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background-color: var(--color-bg);
        transform: translateX(100%);
        transition: transform 0.4s ease-in-out;
        z-index: 1000;
    }

    .nav-links.active {
        transform: translateX(0);
    }

    .nav-links a {
        color: var(--color-text);
        font-size: 1.5rem;
    }

    /* Change menu toggle color when menu is open on transparent bg */
    .menu-toggle.is-active .bar {
        background-color: var(--color-text) !important;
    }

    .section {
        padding: 5rem 1.5rem;
    }

    .color-swatch {
        width: 120px;
        height: 120px;
    }

    .color-palette {
        gap: 2rem;
    }

    .footer {
        padding: 4rem 1.5rem;
    }

    .footer h2 {
        font-size: 3rem;
    }
}

@media screen and (max-width: 480px) {
    .color-swatch {
        width: 100px;
        height: 100px;
    }

    .hero-title {
        font-size: clamp(3rem, 12vw, 4rem);
    }
}