:root {
    /* PALETTE: Sage & Champagne Refined */
    --bg-color: #f3f2ef; 
    --card-bg: #ffffff;
    --text-color: #4a4a44; /* Soft Charcoal */
    --text-light: #7a7a76;
    --accent-color: #7b9b7a; /* Sage */
    --highlight: #c29a7a; /* Champagne/Gold */
    --border-color: #e6e6e6;
}

/* RESET & BASE */
* { box-sizing: border-box; }

body {
    font-family: 'Libre Baskerville', 'Georgia', serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    padding: 0;
    line-height: 1.8;
    -webkit-font-smoothing: antialiased;
}

/* LAYOUT CONTAINER */
.wedding-container {
    max-width: 850px;
    margin: 60px auto 80px;
    padding: 70px 60px;
    background-color: var(--card-bg);
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.05);
    border-radius: 2px;
    position: relative;
    text-align: center;
}

/* Corner Decorations */
.corner-decoration {
    position: absolute;
    top: 0;
    width: 250px;
    height: auto;
    pointer-events: none;
    z-index: 0;
    opacity: 0.8;
}

.corner-tl { left: 0; }
.corner-tr { right: 0; }

header {
    position: relative;
    z-index: 1;
    margin-bottom: 50px;
}

h1 {
    font-family: 'Playfair Display', serif;
    font-size: 3.8rem;
    font-weight: 400;
    font-style: italic;
    color: var(--text-color);
    margin: 0 0 0.4em 0;
    line-height: 1.1;
    letter-spacing: -0.02em;
}

.header-details {
    font-family: 'Libre Baskerville', serif;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.2em;
    color: var(--highlight);
    margin: 0;
    line-height: 2;
}

.header-details span {
    font-style: italic;
    text-transform: none;
    letter-spacing: 0.05em;
    color: var(--accent-color);
}

/* NAVIGATION */
nav {
    margin-top: 30px;
    padding: 20px 0;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 20px;
}

nav a {
    font-family: 'Playfair Display', serif;
    text-decoration: none;
    color: var(--text-color);
    font-size: 1rem;
    font-style: italic;
    letter-spacing: 0.02em;
    transition: color 0.3s ease;
    white-space: nowrap;
}

nav a:hover { color: var(--accent-color); }

nav a.active {
    color: var(--accent-color);
    border-bottom: 1px solid var(--accent-color);
}

/* MAIN CONTENT */
main {
    text-align: left;
    max-width: 90%;
    margin: 0 auto;
}

h2 {
    font-family: 'Playfair Display', serif;
    font-weight: 400;
    color: var(--text-color);
    margin-top: 1.5em;
    margin-bottom: 1em;
    text-align: center;
    letter-spacing: 0.05em;
    font-size: 2rem;
    position: relative;
    display: table;
    margin-left: auto;
    margin-right: auto;
}

h2::after {
    content: "";
    display: block;
    width: 40px;
    height: 1px;
    background: var(--highlight);
    margin: 15px auto 0;
}

h3, h4 {
    font-family: 'Playfair Display', serif;
    font-weight: 400;
    color: var(--accent-color);
    margin-top: 1.5em;
    margin-bottom: 1em;
    text-align: left;
    letter-spacing: 0.05em;
}

h3 {
    font-size: 1.5rem;
    color: var(--text-color);
}

h4 {
    font-size: 1.2rem;
    color: var(--text-color);
}

.subheading {
    text-align: center;
    font-family: 'Libre Baskerville', serif;
    font-style: italic;
    color: var(--text-color);
    margin-top: -15px;
    margin-bottom: 30px;
    font-size: 0.95rem;
}

p {
    font-size: 1.05rem;
    margin-bottom: 1.8em;
    color: var(--text-color);
}

a {
    color: var(--accent-color);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-bottom 0.3s;
}

a:hover { border-bottom: 1px solid var(--accent-color); }

ul, ol {
    padding-left: 20px;
    margin-bottom: 2em;
}

li { margin-bottom: 0.8em; }

/* BANNER */
.wedding-banner {
    margin: 0 0 50px 0;
    position: relative;
    overflow: hidden;
    border-radius: 2px;
}

.wedding-banner img {
    width: 100%;
    height: auto;
    display: block;
}

/* BUTTONS */
.btn {
    display: inline-block;
    background-color: var(--accent-color);
    color: #fff !important;
    padding: 16px 45px;
    border-radius: 3px;
    font-family: 'Libre Baskerville', serif;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    text-decoration: none;
    border: none;
    transition: all 0.3s ease;
    margin-top: 20px;
    cursor: pointer;
}

.btn:hover {
    background-color: var(--text-color);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.btn-small {
    display: inline-block;
    border: 1px solid var(--accent-color);
    color: var(--accent-color);
    padding: 10px 25px;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    text-decoration: none;
    transition: all 0.3s;
}

.btn-small:hover {
    background-color: var(--accent-color);
    color: #fff;
}

/* FORM STYLING */
.rsvp-form {
    text-align: left;
    margin-top: 30px;
}

.form-group { margin-bottom: 25px; }

.form-group label {
    display: block;
    font-family: 'Playfair Display', serif;
    font-size: 1.1rem;
    margin-bottom: 8px;
    color: var(--text-color);
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="number"],
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 14px;
    font-family: 'Libre Baskerville', serif;
    border: 1px solid #ccc;
    border-radius: 0;
    font-size: 1rem;
    background: #ffffff;
    transition: all 0.3s ease;
    color: var(--text-color);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    border-color: var(--highlight);
    outline: none;
}

.checkbox-group { margin-top: 10px; }

.checkbox-label {
    display: flex;
    align-items: center;
    font-size: 0.95rem;
    margin-bottom: 10px;
    cursor: pointer;
}

.checkbox-label input {
    margin-right: 15px;
    width: 18px;
    height: 18px;
    accent-color: var(--accent-color);
}

.hidden-event {
    display: none;
    padding: 20px;
    background-color: #f9fdf9;
    border: 1px dashed var(--accent-color);
    margin-bottom: 25px;
    border-radius: 4px;
}

.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
    vertical-align: middle;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* PAGE SPECIFIC SECTIONS */
.rsvp-section {
    max-width: 600px;
    margin: 40px auto;
    padding: 60px 50px;
    background-color: #f9f8f6; /* Subtle warm background */
    position: relative;
    border: 1px solid var(--border-color);
}

.rsvp-section::before, .rsvp-section::after {
    content: "";
    position: absolute;
    width: 40px;
    height: 40px;
    border: 2px solid var(--highlight);
    pointer-events: none;
    z-index: 1;
}

.rsvp-section::before {
    top: -1px; left: -1px;
    border-right: none; border-bottom: none;
}

.rsvp-section::after {
    bottom: -1px; right: -1px;
    border-left: none; border-top: none;
}

.rsvp-deadline {
    font-family: 'Playfair Display', serif;
    font-size: 1.2rem;
    font-style: italic;
    color: var(--text-color);
    margin-bottom: 30px;
    text-align: center;
}

.venue-section {
    text-align: center;
    margin-bottom: 60px;
    border: 1px solid var(--border-color);
    padding: 50px 40px;
    border-radius: 2px;
}

.venue-section-warm {
    background-color: #f3f0eb; /* Warmer, slightly darker background */
    border-color: #e2ddd3;
}

.venue-name {
    font-family: 'Playfair Display', serif;
    font-size: 2rem;
    color: var(--text-color);
    margin-bottom: 5px;
}

.venue-location {
    font-family: 'Libre Baskerville', serif;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.2em;
    color: var(--highlight);
    margin-bottom: 30px;
}

.venue-address {
    font-style: italic;
    font-size: 0.95rem;
    color: var(--text-light);
    margin: 20px 0;
}

.decorative-divider {
    width: 60px;
    height: 1px;
    background: var(--highlight);
    margin: 40px auto;
}

.registry-grid, .hotel-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
    margin-top: 40px;
}

.registry-card, .hotel-card {
    background: #fff;
    border: 1px solid var(--border-color);
    padding: 40px 30px;
    text-decoration: none;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: inherit;
}

.registry-card:hover, .hotel-card:hover {
    transform: translateY(-5px);
    border-color: var(--highlight);
    box-shadow: 0 15px 35px rgba(0,0,0,0.06);
}

.registry-name, .hotel-card strong {
    font-family: 'Playfair Display', serif;
    font-size: 1.4rem;
    color: var(--text-color);
    margin-bottom: 10px;
    text-align: center;
}

/* PHOTO GRID */
.photo-grid {
    display: flex;
    gap: 12px;
    margin: 50px auto;
    max-width: 1000px;
    align-items: flex-start;
}

.photo-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.photo-item {
    position: relative;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    transition: transform 0.4s ease, box-shadow 0.4s ease, opacity 0.4s ease;
    background-color: #fff;
    cursor: pointer;
    width: 100%;
    container-type: inline-size; /* Enable container queries */
}

.photo-item img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
}

.photo-caption {
    position: absolute;
    top: 100%; left: 0; right: 0;
    background: #fff;
    color: var(--text-color);
    padding: 10px 15px;
    /* Auto-scale font size based on container width */
    font-size: clamp(0.65rem, 4.5cqw, 0.85rem); 
    font-family: 'Libre Baskerville', serif;
    font-style: italic;
    opacity: 0;
    transition: all 0.3s ease;
    transform: translateY(-10px);
    pointer-events: none;
    border-radius: 0 0 8px 8px;
    text-align: center;
    z-index: 10;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    border: 1px solid var(--border-color);
    border-top: none;
    max-height: 120px; /* Prevent spilling vertically */
    overflow-y: auto;
    scrollbar-width: thin;
    text-wrap: pretty;
}

.photo-item.focused {
    transform: scale(1.8);
    z-index: 100;
}

.photo-item.focused .photo-caption {
    opacity: 1;
    transform: translateY(0);
}

.gallery-hint {
    text-align: center;
    font-family: 'Libre Baskerville', serif;
    font-style: italic;
    font-size: 0.85rem;
    color: var(--text-light);
    margin: 40px 0 -20px;
    letter-spacing: 0.05em;
}

.photo-grid.has-focused .photo-item:not(.focused) {
    opacity: 0.3;
    filter: grayscale(0.6) blur(2px);
    pointer-events: none;
}

/* ACTIVITY GRID */
.activity-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 50px;
}

.activity-card {
    position: relative;
    overflow: hidden;
    border-radius: 2px;
    margin-bottom: 20px; /* Space between cards in masonry column */
}

.activity-card img {
    width: 100%; height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.activity-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.activity-overlay span {
    color: #fff;
    font-family: 'Playfair Display', serif;
    font-size: 1.2rem;
    font-style: italic;
    transform: translateY(10px);
    transition: transform 0.3s ease;
}

.activity-card:hover .activity-overlay { opacity: 1; }
.activity-card:hover .activity-overlay span { transform: translateY(0); }
.activity-card:hover img { transform: scale(1.05); }

/* MENU */
.menu-container {
    max-width: 600px;
    margin: 40px auto;
    text-align: center;
    padding: 60px 40px;
    background-color: #f9f8f6;
    border: 1px solid var(--border-color);
    position: relative;
}

.menu-section {
    margin-bottom: 50px;
}

.menu-section h3 {
    text-align: center;
    color: var(--text-color);
    font-size: 1.8rem;
    margin-bottom: 30px;
    position: relative;
    display: inline-block;
}

.menu-section h3::after {
    content: "";
    display: block;
    width: 30px;
    height: 1px;
    background: var(--highlight);
    margin: 10px auto 0;
}

.menu-item {
    font-family: 'Playfair Display', serif;
    font-size: 1.25rem;
    color: var(--text-color);
    margin-bottom: 5px;
}

.menu-item-desc, .menu-desc {
    font-family: 'Libre Baskerville', serif;
    font-style: italic;
    color: var(--text-light);
    margin-bottom: 20px;
    font-size: 0.9rem;
}

.highlight-section {
    background-color: #f3f0eb;
    padding: 40px 30px;
    border: 1px double var(--border-color);
    margin: 40px 0;
}

.menu-note {
    font-family: 'Libre Baskerville', serif;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--highlight);
    margin-bottom: 30px;
}

.entree-choice h4 {
    text-align: center;
    font-family: 'Libre Baskerville', serif;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.15em;
    color: var(--accent-color);
    margin-top: 30px;
    margin-bottom: 10px;
}

/* SCHEDULE */
.schedule-container {
    max-width: 500px;
    margin: 0 auto 40px;
}

.timeline, .timeline-md ul {
    list-style: none;
    padding: 0;
}

.timeline li, .timeline-md ul li {
    padding: 10px 0;
    border-bottom: 1px solid #f0f0f0;
    display: grid;
    grid-template-columns: 100px 1fr;
    gap: 10px;
    text-align: left;
}

.timeline .time, .timeline-md ul li strong:first-child {
    font-weight: bold;
    color: var(--accent-color);
    font-style: italic;
}

/* FOOTER */
footer {
    margin-top: 80px;
    padding: 40px 0;
    border-top: 1px solid var(--border-color);
    text-align: center;
}

footer p {
    font-size: 0.95rem;
    color: var(--text-color);
    margin: 5px 0;
}

.copyright {
    font-size: 0.8rem !important;
    color: var(--text-light) !important;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.footer-trees {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

.footer-trees img {
    width: 100%;
    height: auto;
    max-height: 80vh;
    object-fit: cover;
    object-position: 40% top;
    display: block;
}

/* Background Flourishes */
.bg-flourish {
    position: fixed;
    top: 50%;
    width: 600px;
    height: 600px;
    background-size: contain;
    background-repeat: no-repeat;
    opacity: 0.1;
    z-index: -1;
    pointer-events: none;
}

.bg-flourish-left {
    left: -150px;
    transform: translateY(-50%) rotate(-15deg);
    background-image: url('images/wedding_tl.webp');
}

.bg-flourish-right {
    right: -150px;
    transform: translateY(-50%) rotate(15deg);
    background-image: url('images/wedding_tr.webp');
}

/* RESPONSIVE */
@media (max-width: 800px) {
    .bg-flourish { display: none; }
    
    .wedding-container {
        padding: 60px 20px 40px; /* Further increased top padding */
        margin: 0;
        box-shadow: none;
    }

    .corner-decoration {
        width: 100px; /* Even smaller decorations */
        top: 10px; /* Move down to frame the text */
    }

    h1 { font-size: 2.4rem; }

    main {
        max-width: 100%;
    }

    .photo-grid { 
        flex-direction: column;
        gap: 12px;
        margin: 20px auto;
    }

    .photo-column {
        width: 100%;
        flex: none;
        gap: 12px;
    }

    .photo-item.focused { transform: scale(1.05); }
    
    .activity-overlay {
        opacity: 1;
        background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
        align-items: flex-end;
        padding-bottom: 20px;
    }
    
    .activity-overlay span { transform: translateY(0); }

    /* RSVP Form adjustments */
    .rsvp-section { padding: 40px 20px; }
    .form-group label { font-size: clamp(0.9rem, 4vw, 1.1rem); }
    .form-group input, .form-group textarea, .form-group select { 
        padding: 10px; 
        font-size: 16px; /* Prevents iOS zoom */
    }
    .form-group p { font-size: clamp(0.7rem, 3vw, 0.85rem) !important; }
    
    /* Ensure long placeholders don't overwhelm the box */
    ::placeholder {
        font-size: 0.85em;
        opacity: 0.7;
    }
}