:root {
    --sage: #8B9E7B;
    --sage-light: #A8B99A;
    --sage-dark: #6B7E5B;
    --rust: #C4663E;
    --rust-light: #D4876A;
    --rust-dark: #A44A28;
    --espresso: #3D2B1F;
    --espresso-light: #5D4B3F;
    --tan: #E8DFD0;
    --tan-light: #F5F1EB;
    --tan-dark: #D4C9B8;
    --cream: #FDFBF7;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; font-size: 16px; }
body { font-family: 'Jost', sans-serif; background-color: var(--cream); color: var(--espresso); overflow-x: hidden; line-height: 1.6; }
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--tan-light); }
::-webkit-scrollbar-thumb { background: var(--sage); border-radius: 4px; }
.serif { font-family: 'Cormorant Garamond', serif; }
h1, h2, h3 { font-family: 'Cormorant Garamond', serif; font-weight: 300; }

/* Save the Date mode - hide full site content */
body.save-the-date-mode .rsvp-only,
body.save-the-date-mode .full-site-only { display: none !important; }

/* Loading */
.loading-overlay { position: fixed; inset: 0; background: var(--cream); display: flex; align-items: center; justify-content: center; z-index: 9999; transition: opacity 0.5s; }
.loading-overlay.hidden { opacity: 0; pointer-events: none; }
.loading-spinner { width: 40px; height: 40px; border: 2px solid var(--tan); border-top-color: var(--sage); border-radius: 50%; animation: spin 1s linear infinite; }

/* Nav */
nav { position: fixed; top: 0; left: 0; width: 100%; z-index: 1000; padding: 1.5rem 3rem; display: flex; justify-content: space-between; align-items: center; transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1); }
nav.scrolled { background: rgba(253, 251, 247, 0.95); backdrop-filter: blur(10px); padding: 1rem 3rem; box-shadow: 0 2px 30px rgba(61, 43, 31, 0.08); }
.nav-logo { font-family: 'Cormorant Garamond', serif; font-size: 1.4rem; font-weight: 400; letter-spacing: 0.15em; color: var(--espresso); text-decoration: none; }
.nav-links { display: flex; gap: 2.5rem; list-style: none; }
.nav-links a { text-decoration: none; color: var(--espresso); font-size: 0.85rem; font-weight: 400; letter-spacing: 0.1em; text-transform: uppercase; position: relative; transition: color 0.3s; }
.nav-links a::after { content: ''; position: absolute; bottom: -4px; left: 0; width: 0; height: 1px; background: var(--rust); transition: width 0.3s; }
.nav-links a:hover::after { width: 100%; }
.mobile-menu-btn { display: none; flex-direction: column; gap: 6px; cursor: pointer; padding: 10px; }
.mobile-menu-btn span { width: 28px; height: 1.5px; background: var(--espresso); transition: all 0.3s; }

/* Hero */
.hero { min-height: 100vh; display: grid; grid-template-columns: 1fr 1.2fr; position: relative; overflow: hidden; }
.hero-content { display: flex; flex-direction: column; justify-content: center; padding: 8rem 4rem 10rem 6rem; position: relative; z-index: 2; }
.hero-date { font-size: 0.8rem; letter-spacing: 0.3em; text-transform: uppercase; color: var(--rust); margin-bottom: 1.5rem; opacity: 0; animation: fadeSlideUp 1s 0.3s forwards; }
.hero-names { font-size: clamp(3rem, 6vw, 5.5rem); font-weight: 300; line-height: 1.1; margin-bottom: 2rem; opacity: 0; animation: fadeSlideUp 1s 0.5s forwards; }
.hero-names .ampersand { display: block; font-size: 0.5em; color: var(--sage); margin: 0.5rem 0 0.5rem 2rem; font-style: italic; }
.hero-tagline { font-size: 1.1rem; color: var(--espresso-light); max-width: 400px; margin-bottom: 3rem; opacity: 0; animation: fadeSlideUp 1s 0.7s forwards; }
.hero-cta { display: inline-flex; align-items: center; gap: 1rem; background: var(--espresso); color: var(--cream); padding: 1.2rem 2.5rem; text-decoration: none; font-size: 0.85rem; letter-spacing: 0.15em; text-transform: uppercase; transition: all 0.4s; opacity: 0; animation: fadeSlideUp 1s 0.9s forwards; position: relative; overflow: hidden; }
.hero-cta::before { content: ''; position: absolute; top: 0; left: -100%; width: 100%; height: 100%; background: var(--rust); transition: left 0.4s; z-index: -1; }
.hero-cta:hover::before { left: 0; }
.hero-cta svg { width: 20px; transition: transform 0.3s; }
.hero-cta:hover svg { transform: translateX(5px); }
.hero-visual { position: relative; background: var(--tan); overflow: hidden; }
.hero-image { position: absolute; inset: 0; background: linear-gradient(135deg, var(--sage-light) 0%, var(--tan) 50%, var(--rust-light) 100%); opacity: 0.3; }
.hero-image-main { position: absolute; top: 10%; right: 5%; width: 75%; height: 80%; background: var(--tan-dark); border-radius: 200px 200px 0 0; overflow: hidden; animation: heroImageReveal 1.2s 0.2s forwards; transform: translateY(100px); opacity: 0; background-size: cover; background-position: center; }
.hero-image-main::before { content: 'Your Photo Here'; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-family: 'Cormorant Garamond', serif; font-size: 1.5rem; color: var(--espresso-light); font-style: italic; background: linear-gradient(180deg, var(--sage-light) 0%, var(--tan) 100%); }
.hero-image-main[style*="background-image"]::before { content: none; }
.hero-accent-shape { position: absolute; bottom: -50px; left: -50px; width: 250px; height: 250px; border: 1px solid var(--rust); border-radius: 50%; opacity: 0.3; animation: floatSlow 8s ease-in-out infinite; }
.hero-scroll-indicator { position: absolute; bottom: 2.5rem; left: 6rem; display: flex; align-items: center; gap: 1rem; font-size: 0.7rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--espresso-light); opacity: 0; animation: fadeIn 1s 1.5s forwards; }
.scroll-line { width: 50px; height: 1px; background: var(--espresso-light); position: relative; overflow: hidden; }
.scroll-line::after { content: ''; position: absolute; top: 0; left: -100%; width: 100%; height: 100%; background: var(--rust); animation: scrollPulse 2s ease-in-out infinite; }

/* Save the Date */
.save-date { padding: 10rem 4rem; position: relative; overflow: hidden; }
.save-date-bg { position: absolute; top: 0; right: 0; width: 60%; height: 100%; background: var(--tan); clip-path: polygon(20% 0, 100% 0, 100% 100%, 0% 100%); z-index: -1; }
.save-date-content { max-width: 1400px; margin: 0 auto; display: grid; grid-template-columns: 1fr 1fr; gap: 6rem; align-items: center; }
.save-date-text { opacity: 0; transform: translateY(40px); transition: all 0.8s; }
.save-date-text.visible { opacity: 1; transform: translateY(0); }
.section-label { display: inline-flex; align-items: center; gap: 1rem; font-size: 0.75rem; letter-spacing: 0.25em; text-transform: uppercase; color: var(--rust); margin-bottom: 2rem; }
.section-label::before { content: ''; width: 40px; height: 1px; background: var(--rust); }
.save-date h2 { font-size: clamp(2.5rem, 4vw, 4rem); line-height: 1.15; margin-bottom: 2rem; }
.countdown { display: flex; gap: 2rem; margin-top: 3rem; }
.countdown-item { text-align: center; }
.countdown-number { font-family: 'Cormorant Garamond', serif; font-size: 3.5rem; font-weight: 300; color: var(--sage-dark); line-height: 1; }
.countdown-label { font-size: 0.7rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--espresso-light); margin-top: 0.5rem; }
.calendar-buttons { display: flex; gap: 1rem; margin-top: 3rem; flex-wrap: wrap; }
.calendar-btn { background: var(--sage); color: var(--cream); border: none; padding: 1rem 2rem; font-family: 'Jost', sans-serif; font-size: 0.9rem; cursor: pointer; transition: all 0.3s; display: inline-flex; align-items: center; gap: 0.75rem; box-shadow: 0 4px 15px rgba(139, 158, 123, 0.3); }
.calendar-btn:hover { background: var(--sage-dark); transform: translateY(-2px); box-shadow: 0 6px 20px rgba(139, 158, 123, 0.4); }
.calendar-btn svg { flex-shrink: 0; }
.save-date-visual { position: relative; opacity: 0; transform: translateX(40px); transition: all 0.8s 0.2s; }
.save-date-visual.visible { opacity: 1; transform: translateX(0); }
.date-card { background: var(--cream); padding: 4rem; box-shadow: 0 30px 80px rgba(61, 43, 31, 0.1); position: relative; }
.date-card::before { content: ''; position: absolute; top: -20px; right: -20px; width: 100px; height: 100px; border: 1px solid var(--sage); border-radius: 50%; opacity: 0.5; }
.date-card-month { font-size: 0.8rem; letter-spacing: 0.3em; text-transform: uppercase; color: var(--rust); margin-bottom: 0.5rem; }
.date-card-day { font-family: 'Cormorant Garamond', serif; font-size: 8rem; font-weight: 300; line-height: 1; color: var(--espresso); }
.date-card-year { font-family: 'Cormorant Garamond', serif; font-size: 2rem; color: var(--sage-dark); margin-top: 0.5rem; }
.date-card-venue { margin-top: 2rem; padding-top: 2rem; border-top: 1px solid var(--tan); font-size: 0.9rem; color: var(--espresso-light); }
.date-card-venue strong { display: block; font-size: 1.1rem; font-weight: 500; color: var(--espresso); margin-bottom: 0.25rem; }

/* RSVP */
.rsvp { padding: 10rem 4rem; background: var(--espresso); color: var(--cream); position: relative; overflow: hidden; }
.rsvp::before { content: ''; position: absolute; top: -200px; left: -200px; width: 600px; height: 600px; border: 1px solid rgba(168, 185, 154, 0.1); border-radius: 50%; }
.rsvp::after { content: ''; position: absolute; bottom: -100px; right: -100px; width: 400px; height: 400px; border: 1px solid rgba(196, 102, 62, 0.15); border-radius: 50%; }
.rsvp-content { max-width: 900px; margin: 0 auto; position: relative; z-index: 1; }
.rsvp .section-label { color: var(--rust-light); }
.rsvp .section-label::before { background: var(--rust-light); }
.rsvp h2 { font-size: clamp(2.5rem, 4vw, 3.5rem); margin-bottom: 1rem; text-align: center; }
.rsvp-subtitle { text-align: center; color: var(--tan); margin-bottom: 4rem; font-size: 1.1rem; }
.rsvp-welcome { text-align: center; margin-bottom: 2rem; padding: 2rem; background: rgba(139, 158, 123, 0.15); border: 1px solid rgba(139, 158, 123, 0.3); }
.rsvp-welcome h3 { font-size: 1.8rem; margin-bottom: 0.5rem; color: var(--cream); }
.rsvp-welcome p { color: var(--tan); font-size: 1rem; }

.rsvp-no-code { text-align: center; padding: 3rem; background: rgba(255, 255, 255, 0.03); border: 1px solid rgba(255, 255, 255, 0.08); }
.rsvp-no-code h3 { font-size: 2rem; margin-bottom: 1rem; color: var(--cream); }
.rsvp-no-code p { color: var(--tan); margin-bottom: 2rem; }
.rsvp-no-code > div { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }
.rsvp-no-code input { background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1); padding: 1rem 1.5rem; color: var(--cream); font-family: 'Jost', sans-serif; font-size: 1rem; min-width: 200px; }
.rsvp-no-code input::placeholder { color: rgba(232,223,208,0.4); }
.rsvp-no-code input:focus { outline: none; border-color: var(--sage); background: rgba(255,255,255,0.08); }
.rsvp-no-code button { background: var(--rust); color: var(--cream); border: none; padding: 1rem 2rem; font-family: 'Jost', sans-serif; font-size: 0.85rem; letter-spacing: 0.1em; text-transform: uppercase; cursor: pointer; transition: background 0.3s; }
.rsvp-no-code button:hover { background: var(--rust-dark); }

.rsvp-form { background: rgba(255, 255, 255, 0.03); backdrop-filter: blur(10px); padding: 3rem; border: 1px solid rgba(255, 255, 255, 0.08); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; margin-bottom: 1.5rem; }
.form-group { position: relative; }
.form-group.full-width { grid-column: 1 / -1; }
.form-group label { display: block; font-size: 0.75rem; letter-spacing: 0.15em; text-transform: uppercase; color: var(--tan); margin-bottom: 0.75rem; }
.form-group input, .form-group select, .form-group textarea { width: 100%; background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.1); padding: 1rem 1.25rem; color: var(--cream); font-family: 'Jost', sans-serif; font-size: 1rem; transition: all 0.3s; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { outline: none; border-color: var(--sage); background: rgba(255, 255, 255, 0.08); }
.form-group input::placeholder, .form-group textarea::placeholder { color: rgba(232, 223, 208, 0.4); }
.form-group select { cursor: pointer; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23E8DFD0' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 1rem center; }
.form-group select option { background: var(--espresso); color: var(--cream); }

.attendance-options { display: flex; gap: 1rem; margin-bottom: 2rem; }
.attendance-option { flex: 1; position: relative; }
.attendance-option input { position: absolute; opacity: 0; cursor: pointer; }
.attendance-option label { display: flex; flex-direction: column; align-items: center; padding: 2rem; border: 1px solid rgba(255, 255, 255, 0.1); cursor: pointer; transition: all 0.3s; text-transform: none; letter-spacing: normal; }
.attendance-option label .attendance-icon { display: flex; align-items: center; justify-content: center; width: 50px; height: 50px; border-radius: 50%; background: rgba(255, 255, 255, 0.05); margin-bottom: 0.75rem; transition: all 0.3s; }
.attendance-option label .attendance-icon svg { stroke: var(--tan); transition: all 0.3s; }
.attendance-option input:checked + label { background: rgba(139, 158, 123, 0.2); border-color: var(--sage); }
.attendance-option input:checked + label .attendance-icon { background: rgba(139, 158, 123, 0.3); }
.attendance-option input:checked + label .attendance-icon svg { stroke: var(--sage-light); }

.guest-meals { margin-top: 2rem; padding-top: 2rem; border-top: 1px solid rgba(255,255,255,0.1); }
.guest-meal-entry { margin-bottom: 2rem; padding-bottom: 1.5rem; border-bottom: 1px solid rgba(255,255,255,0.05); }
.guest-meal-entry:last-child { border-bottom: none; margin-bottom: 0; }
.guest-meal-entry h5 { font-family: 'Cormorant Garamond', serif; font-size: 1.3rem; font-weight: 400; margin-bottom: 1rem; color: var(--sage-light); }
.meal-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.meal-option { position: relative; }
.meal-option input { position: absolute; opacity: 0; }
.meal-option label { display: block; padding: 1.5rem; border: 1px solid rgba(255, 255, 255, 0.1); cursor: pointer; transition: all 0.3s; text-transform: none; letter-spacing: normal; }
.meal-option label strong { display: block; font-weight: 500; margin-bottom: 0.25rem; }
.meal-option label span { font-size: 0.85rem; color: var(--tan-dark); }
.meal-option input:checked + label { background: rgba(196, 102, 62, 0.2); border-color: var(--rust); }

.submit-btn { width: 100%; background: var(--rust); color: var(--cream); border: none; padding: 1.25rem 2rem; font-family: 'Jost', sans-serif; font-size: 0.9rem; letter-spacing: 0.15em; text-transform: uppercase; cursor: pointer; margin-top: 2rem; transition: all 0.4s; position: relative; overflow: hidden; }
.submit-btn::before { content: ''; position: absolute; top: 0; left: -100%; width: 100%; height: 100%; background: var(--sage-dark); transition: left 0.4s; z-index: -1; }
.submit-btn:hover::before { left: 0; }
.submit-btn:disabled { opacity: 0.7; cursor: not-allowed; }
.form-message { margin-top: 1.5rem; padding: 1.5rem; text-align: center; }
.form-message.success { background: rgba(139, 158, 123, 0.2); border: 1px solid var(--sage); color: var(--cream); }
.form-message.error { background: rgba(196, 102, 62, 0.2); border: 1px solid var(--rust); color: var(--cream); }

/* Info */
.info { padding: 10rem 4rem; position: relative; }
.info-header { text-align: center; max-width: 700px; margin: 0 auto 6rem; }
.info h2 { font-size: clamp(2.5rem, 4vw, 3.5rem); margin-bottom: 1rem; }
.info-subtitle { color: var(--espresso-light); font-size: 1.1rem; }
.info-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2rem; max-width: 1200px; margin: 0 auto; }
.info-card { background: var(--tan-light); padding: 3rem; position: relative; overflow: hidden; opacity: 0; transform: translateY(30px); transition: all 0.6s; }
.info-card.visible { opacity: 1; transform: translateY(0); }
.info-card:nth-child(2) { transition-delay: 0.1s; }
.info-card:nth-child(3) { transition-delay: 0.2s; }
.info-card::before { content: ''; position: absolute; top: 0; left: 0; width: 4px; height: 0; background: var(--rust); transition: height 0.6s 0.3s; }
.info-card.visible::before { height: 100%; }
.info-card-icon { width: 50px; height: 50px; display: flex; align-items: center; justify-content: center; background: var(--sage); color: var(--cream); border-radius: 50%; margin-bottom: 1.5rem; }
.info-card-icon svg { stroke: var(--cream); }
.info-card h3 { font-size: 1.8rem; margin-bottom: 1rem; }
.info-card p { color: var(--espresso-light); font-size: 0.95rem; line-height: 1.7; }
.info-card a { display: inline-block; color: var(--rust); text-decoration: none; font-size: 0.85rem; margin-top: 1.5rem; font-weight: 500; transition: padding-left 0.3s; }
.info-card a:hover { padding-left: 0.5rem; }

/* Registry */
.registry { padding: 10rem 4rem; background: linear-gradient(180deg, var(--tan-light) 0%, var(--cream) 100%); position: relative; overflow: hidden; }
.registry-decoration { position: absolute; font-family: 'Cormorant Garamond', serif; font-size: 20rem; font-weight: 300; color: var(--tan); opacity: 0.5; top: -5rem; right: -3rem; line-height: 1; z-index: 0; }
.registry-content { max-width: 1000px; margin: 0 auto; position: relative; z-index: 1; }
.registry-header { text-align: center; margin-bottom: 4rem; }
.registry h2 { font-size: clamp(2.5rem, 4vw, 3.5rem); margin-bottom: 1rem; }
.registry-subtitle { color: var(--espresso-light); font-size: 1.1rem; max-width: 500px; margin: 0 auto; }
.registry-cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 2rem; }
.registry-card { background: var(--cream); padding: 3rem; text-align: center; box-shadow: 0 20px 60px rgba(61, 43, 31, 0.08); position: relative; overflow: hidden; transition: transform 0.4s, box-shadow 0.4s; }
.registry-card:hover { transform: translateY(-5px); box-shadow: 0 30px 80px rgba(61, 43, 31, 0.12); }
.registry-card::after { content: ''; position: absolute; bottom: 0; left: 0; width: 100%; height: 3px; background: linear-gradient(90deg, var(--sage) 0%, var(--rust) 100%); transform: scaleX(0); transition: transform 0.4s; }
.registry-card:hover::after { transform: scaleX(1); }
.registry-card-logo { height: 60px; display: flex; align-items: center; justify-content: center; margin-bottom: 1.5rem; font-family: 'Cormorant Garamond', serif; font-size: 1.8rem; font-weight: 500; color: var(--espresso); }
.registry-card p { color: var(--espresso-light); font-size: 0.95rem; margin-bottom: 1.5rem; }
.registry-btn { display: inline-block; background: transparent; border: 1px solid var(--espresso); color: var(--espresso); padding: 0.9rem 1.8rem; text-decoration: none; font-size: 0.8rem; letter-spacing: 0.12em; text-transform: uppercase; transition: all 0.3s; }
.registry-btn:hover { background: var(--espresso); color: var(--cream); }

/* Gallery */
.gallery { padding: 10rem 4rem; background: var(--espresso); position: relative; overflow: hidden; }
.gallery::-webkit-scrollbar { display: none; }
.gallery { -ms-overflow-style: none; scrollbar-width: none; }
.gallery::before { content: 'Our Story'; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); font-family: 'Cormorant Garamond', serif; font-size: clamp(8rem, 15vw, 18rem); font-weight: 300; color: rgba(255, 255, 255, 0.03); white-space: nowrap; pointer-events: none; }
.gallery-header { text-align: center; margin-bottom: 5rem; position: relative; z-index: 1; position: sticky; top: 80px; background: var(--espresso); padding: 2rem 0; z-index: 10; }
.gallery .section-label { color: var(--rust-light); }
.gallery .section-label::before { background: var(--rust-light); }
.gallery h2 { font-size: clamp(2.5rem, 4vw, 3.5rem); color: var(--cream); margin-bottom: 1rem; }
.gallery-subtitle { color: var(--tan); font-size: 1.1rem; }
.gallery-grid { max-width: 1400px; margin: 0 auto; position: relative; z-index: 1; }

/* GridStack container - prevent scrollbars */
.grid-stack {
    overflow: visible !important;
}

/* GridStack item content styling */
.gallery-grid .grid-stack-item {
    overflow: hidden !important;
}

.gallery-grid .grid-stack-item > .grid-stack-item-content {
    overflow: hidden !important;
}

.gallery-grid .grid-stack-item-content {
    background: var(--espresso-light);
    overflow: hidden;
    cursor: pointer;
    background-size: cover !important;
    background-position: center !important;
    transition: transform 0.3s, box-shadow 0.3s;
    position: absolute !important;
    top: 4px !important;
    left: 4px !important;
    right: 4px !important;
    bottom: 4px !important;
    width: calc(100% - 8px) !important;
    height: calc(100% - 8px) !important;
}

.gallery-grid .grid-stack-item:hover .grid-stack-item-content {
    transform: scale(1.02);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    z-index: 2;
}

.gallery-grid .grid-stack-item-content::before {
    content: 'Photo';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.2rem;
    color: var(--tan);
    font-style: italic;
    background: linear-gradient(135deg, var(--sage-dark) 0%, var(--espresso-light) 100%);
    opacity: 0.7;
    transition: opacity 0.4s;
}

.gallery-grid .grid-stack-item-content[style*="background-image"]::before { content: none; }
.gallery-grid .grid-stack-item:hover .grid-stack-item-content::before { opacity: 0.9; }

/* Hide GridStack UI elements on main page */
.gallery-grid .ui-resizable-handle { display: none !important; }
.gallery-grid .grid-stack-placeholder { display: none !important; }

/* Mobile Carousel (hidden on desktop) */
.gallery-carousel { display: none; }

/* Legacy gallery-item support (will be replaced by GridStack) */
.gallery-item { display: none; }

/* Dynamic layout pattern that repeats every 12 photos */
/* Row 1: Large landscape + 2 portraits */
.gallery-item:nth-child(12n+1) { grid-column: span 7; grid-row: span 3; } /* Large landscape feature */
.gallery-item:nth-child(12n+2) { grid-column: span 5; grid-row: span 4; } /* Tall portrait */
/* Row 2: 3 medium portraits */
.gallery-item:nth-child(12n+3) { grid-column: span 4; grid-row: span 3; } /* Portrait */
.gallery-item:nth-child(12n+4) { grid-column: span 4; grid-row: span 3; } /* Portrait */
.gallery-item:nth-child(12n+5) { grid-column: span 4; grid-row: span 3; } /* Portrait */
/* Row 3: Portrait + landscape */
.gallery-item:nth-child(12n+6) { grid-column: span 5; grid-row: span 4; } /* Tall portrait */
.gallery-item:nth-child(12n+7) { grid-column: span 7; grid-row: span 2; } /* Landscape */
/* Row 4: Small portraits + medium landscape */
.gallery-item:nth-child(12n+8) { grid-column: span 3; grid-row: span 3; } /* Small portrait */
.gallery-item:nth-child(12n+9) { grid-column: span 3; grid-row: span 3; } /* Small portrait */
.gallery-item:nth-child(12n+10) { grid-column: span 6; grid-row: span 2; } /* Medium landscape */
/* Row 5: Large feature landscape */
.gallery-item:nth-child(12n+11) { grid-column: span 8; grid-row: span 3; } /* Large landscape */
.gallery-item:nth-child(12n+12) { grid-column: span 4; grid-row: span 3; } /* Portrait */

/* Footer */
footer { background: var(--espresso); color: var(--cream); padding: 4rem; text-align: center; border-top: 1px solid rgba(255, 255, 255, 0.1); }
.footer-names { font-family: 'Cormorant Garamond', serif; font-size: 2.5rem; font-weight: 300; margin-bottom: 1rem; }
.footer-date { color: var(--tan); font-size: 0.9rem; letter-spacing: 0.2em; margin-bottom: 2rem; }
.footer-links { display: flex; justify-content: center; gap: 2rem; margin-bottom: 2rem; }
.footer-links a { color: var(--tan); text-decoration: none; font-size: 0.85rem; transition: color 0.3s; }
.footer-links a:hover { color: var(--rust-light); }
.footer-credit { font-size: 0.75rem; color: var(--espresso-light); }

/* Lightbox Gallery */
#lightbox { display: none; position: fixed; inset: 0; background: rgba(0, 0, 0, 0.95); z-index: 10000; align-items: center; justify-content: center; padding: 2rem; }
#lightbox-img { max-width: 90%; max-height: 90vh; object-fit: contain; box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5); }
.lightbox-close { position: absolute; top: 1rem; right: 1rem; background: none; border: none; color: var(--cream); font-size: 3rem; cursor: pointer; width: 50px; height: 50px; display: flex; align-items: center; justify-content: center; transition: transform 0.3s; }
.lightbox-close:hover { transform: scale(1.2); }
.lightbox-prev, .lightbox-next { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(255, 255, 255, 0.1); border: none; color: var(--cream); font-size: 3rem; cursor: pointer; width: 60px; height: 60px; display: flex; align-items: center; justify-content: center; transition: all 0.3s; }
.lightbox-prev:hover, .lightbox-next:hover { background: rgba(255, 255, 255, 0.2); }
.lightbox-prev { left: 1rem; }
.lightbox-next { right: 1rem; }
.lightbox-counter { position: absolute; bottom: 2rem; left: 50%; transform: translateX(-50%); background: rgba(0, 0, 0, 0.5); padding: 0.5rem 1rem; border-radius: 20px; color: var(--cream); font-size: 0.9rem; }

/* Animations */
@keyframes fadeSlideUp { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes heroImageReveal { to { opacity: 1; transform: translateY(0); } }
@keyframes floatSlow { 0%, 100% { transform: translate(0, 0) rotate(0deg); } 50% { transform: translate(20px, -20px) rotate(5deg); } }
@keyframes scrollPulse { 0% { left: -100%; } 50% { left: 100%; } 100% { left: 100%; } }
@keyframes spin { to { transform: rotate(360deg); } }

/* Responsive */
@media (max-width: 1024px) {
    .hero { grid-template-columns: 1fr; min-height: auto; }
    .hero-content { padding: 10rem 3rem 6rem; text-align: center; }
    .hero-names .ampersand { margin: 0.5rem auto; }
    .hero-tagline { margin: 0 auto 3rem; }
    .hero-cta { margin: 0 auto; }
    .hero-visual { height: 60vh; }
    .hero-scroll-indicator { display: none; }
    .save-date-content { grid-template-columns: 1fr; gap: 4rem; }
    .save-date-bg { clip-path: none; width: 100%; }
    .info-grid { grid-template-columns: 1fr; }
    .registry-cards { grid-template-columns: 1fr; }
    /* Mobile-optimized gallery with 6-photo repeating pattern */
    .gallery-grid {
        grid-template-columns: repeat(4, 1fr);
        grid-auto-rows: 120px;
        gap: 0.75rem;
    }

    /* Reset all desktop nth-child rules */
    .gallery-item:nth-child(12n+1),
    .gallery-item:nth-child(12n+2),
    .gallery-item:nth-child(12n+3),
    .gallery-item:nth-child(12n+4),
    .gallery-item:nth-child(12n+5),
    .gallery-item:nth-child(12n+6),
    .gallery-item:nth-child(12n+7),
    .gallery-item:nth-child(12n+8),
    .gallery-item:nth-child(12n+9),
    .gallery-item:nth-child(12n+10),
    .gallery-item:nth-child(12n+11),
    .gallery-item:nth-child(12n+12) {
        grid-column: auto;
        grid-row: auto;
    }

    /* Mobile 6-photo repeating pattern */
    .gallery-item:nth-child(6n+1) { grid-column: span 4; grid-row: span 2; } /* Full width landscape */
    .gallery-item:nth-child(6n+2) { grid-column: span 2; grid-row: span 3; } /* Left portrait */
    .gallery-item:nth-child(6n+3) { grid-column: span 2; grid-row: span 2; } /* Right small */
    .gallery-item:nth-child(6n+4) { grid-column: span 2; grid-row: span 1; } /* Small square */
    .gallery-item:nth-child(6n+5) { grid-column: span 2; grid-row: span 2; } /* Portrait */
    .gallery-item:nth-child(6n+6) { grid-column: span 2; grid-row: span 2; } /* Portrait */
    .meal-options { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    nav { padding: 1rem 1.5rem; }
    .nav-links { display: none; position: absolute; top: 100%; left: 0; width: 100%; background: var(--cream); flex-direction: column; padding: 2rem; gap: 1.5rem; box-shadow: 0 20px 40px rgba(61, 43, 31, 0.1); }
    .nav-links.active { display: flex; }
    .mobile-menu-btn { display: flex; }
    .hero-content { padding: 8rem 1.5rem 4rem; }
    .save-date, .rsvp, .info, .registry, .gallery { padding: 6rem 1.5rem; }
    .gallery-header { top: 60px; padding: 1.5rem 0; }
    .form-row { grid-template-columns: 1fr; }
    .attendance-options { flex-direction: column; }
    .countdown { justify-content: center; flex-wrap: wrap; }
    .date-card { padding: 2.5rem; }
    .date-card-day { font-size: 5rem; }
    .rsvp-form { padding: 2rem 1.5rem; }
    .footer-links { flex-direction: column; gap: 1rem; }

    /* Hide GridStack on mobile, show carousel */
    .gallery-grid { display: none !important; }
    .gallery-carousel {
        display: block;
        position: relative;
        max-width: 100%;
        overflow: hidden;
        margin: 0 auto;
    }

    .gallery-carousel-track {
        display: flex;
        transition: transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
        touch-action: pan-y pinch-zoom;
    }

    .gallery-carousel-slide {
        flex: 0 0 100%;
        padding: 0 0.75rem;
        box-sizing: border-box;
    }

    .gallery-carousel-slide-content {
        background: var(--espresso-light);
        aspect-ratio: 4/3;
        background-size: cover;
        background-position: center;
        cursor: pointer;
        position: relative;
        overflow: hidden;
    }

    .gallery-carousel-dots {
        display: flex;
        justify-content: center;
        gap: 0.5rem;
        margin-top: 1.5rem;
    }

    .gallery-carousel-dot {
        width: 8px;
        height: 8px;
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.3);
        border: none;
        padding: 0;
        cursor: pointer;
        transition: all 0.3s;
    }

    .gallery-carousel-dot.active {
        background: var(--sage);
        width: 24px;
        border-radius: 4px;
    }
}
