/* ===========================
   Reset & Base
   =========================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

h1, h2, h3, h4, h5, h6, p, nav, ul, ol, li {
    margin: 0;
    padding: 0;
}

html {
    height: 100%;
    overflow-x: hidden;
    background-color: var(--page-bg-color, transparent);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
}

body {
    height: 100%;
    overflow-x: hidden;
    font-family: 'Lato', sans-serif;
    color: #ffffff;
    background-color: var(--page-bg-color, transparent);
}

/* ===========================
   Fixed Background Layer (bodyBg image applied here by JS)
   =========================== */
#page-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    background-color: var(--page-bg-color, transparent);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

/* ===========================
   Top Banner — fixed, flex row: [left panel] [title] [right panel]
   =========================== */
#top-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background-color: transparent;
    display: flex;
    align-items: stretch;
    gap: 0;
    padding: 0;
    overflow: hidden;
    /* height set dynamically by JS (bannerHeight vh) */
}

.banner-side {
    flex-shrink: 0;
    aspect-ratio: 1;        /* square: width = height of banner */
    margin: 0;
    padding: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.banner-center {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
}

.top-banner-title {
    margin: 0;
    /* font-family, font-size, color, padding, text-align all set by JS */
    font-family: 'Playfair Display', Georgia, serif;
    color: #ffffff;
    line-height: 1.2;
}

.top-banner-countdown {
    margin: 0;
    line-height: 1.3;
    /* font-size, color, font-family, text-align set by JS */
}

/* ===========================
   Scrollable Content Container
   margin-top and padding-bottom injected by JS
   =========================== */
.invitation-container {
    position: relative;
    z-index: 10;
}

/* ===========================
   Dynamic Sections
   =========================== */
.section {
    position: relative;
    display: block;
    min-height: 200px;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.section.visible {
    opacity: 1;
    transform: translateY(0);
}

.section-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 2rem;
    color: #ffffff;
    margin-bottom: 14px;
    line-height: 1.2;
    width: 100%;
}

.section-content {
    font-family: 'Lato', sans-serif;
    font-size: 1rem;
    color: #ffffff;
    line-height: 1.7;
    width: 100%;
    max-width: 640px;
}

/* ===========================
   Footer Bar — fixed at bottom, flex row: [left panel] [nav] [right panel]
   JS moves .bottom-nav inside #page-footer on first render
   =========================== */
#page-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 500;
    background-color: transparent;
    display: flex;
    align-items: stretch;
    gap: 0;
    padding: 0;
    /* height set dynamically by JS (footerHeight vh) */
}

.footer-side {
    flex-shrink: 0;
    aspect-ratio: 1;        /* square: width = height of footer bar */
    margin: 0;
    padding: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

/* ===========================
   Bottom Navigation — flex child inside #page-footer
   =========================== */
.bottom-nav {
    flex: 1;
    margin: 0;
    padding: 2px 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    overflow: visible;
    background-color: transparent;
}

.nav-item {
    position: relative;
    z-index: 500;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 6px 18px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 6px;
    color: #ffffff;
    font-family: 'Lato', sans-serif;
    font-size: 0.85rem;
    font-weight: 400;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s, border-color 0.2s;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.65);
}

.nav-icon {
    font-size: 1rem;
    line-height: 1;
}

.nav-label {
    font-size: 0.8rem;
    line-height: 1;
}

/* ===========================
   RSVP Panel — slides up from bottom
   =========================== */
.rsvp-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 2000;
    background-color: transparent;
    border-radius: 16px 16px 0 0;
    transform: translateY(100%);
    transition: transform 0.35s ease;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.4);
}

.rsvp-panel::before,
.tab-popup-content::before {
    content: '';
    position: absolute;
    inset: 0;
    background-color: var(--rsvp-bg-color, transparent);
    background-image: var(--popup-bg-img, none);
    background-size: cover;
    background-position: center top;
    background-repeat: no-repeat;
    opacity: 0.85;
    border-radius: inherit;
    pointer-events: none;
    z-index: -1;
}

.rsvp-panel.active {
    transform: translateY(0);
}

.rsvp-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    flex-shrink: 0;
}

.rsvp-header h2 {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.25rem;
    color: #ffffff;
    font-weight: 600;
}

.close-btn {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 1.6rem;
    line-height: 1;
    padding: 2px 8px;
    border-radius: 4px;
    cursor: pointer;
    transition: color 0.2s, background 0.2s;
}

.close-btn:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
}

.rsvp-content {
    overflow-y: auto;
    padding: 20px;
    flex: 1;
}

.rsvp-description {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.75);
    margin-bottom: 20px;
    line-height: 1.55;
}

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

.form-group label {
    display: block;
    font-size: 0.82rem;
    color: rgba(255, 255, 255, 0.65);
    margin-bottom: 6px;
    font-weight: 400;
    letter-spacing: 0.02em;
}

.form-group input {
    width: 100%;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 8px;
    color: #ffffff;
    font-size: 1rem;
    font-family: 'Lato', sans-serif;
    outline: none;
    transition: border-color 0.2s, background 0.2s;
}

.form-group input::placeholder {
    color: rgba(255, 255, 255, 0.35);
}

.form-group input:focus {
    border-color: rgba(255, 255, 255, 0.55);
    background: rgba(255, 255, 255, 0.12);
}

.btn-primary {
    width: 100%;
    padding: 12px;
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 8px;
    color: #ffffff;
    font-size: 1rem;
    font-family: 'Lato', sans-serif;
    font-weight: 600;
    cursor: pointer;
    letter-spacing: 0.03em;
    transition: background 0.2s, border-color 0.2s;
}

.btn-primary:hover {
    background: rgba(255, 255, 255, 0.28);
    border-color: rgba(255, 255, 255, 0.6);
}

/* ===========================
   Guest List
   =========================== */
.guest-item {
    padding: 14px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.guest-item:last-child {
    border-bottom: none;
}

.guest-name {
    font-size: 1rem;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 10px;
}

.guest-controls {
    display: flex;
    gap: 8px;
    justify-content: center;
    align-items: stretch;
}

.guest-controls .status-btn,
.guest-controls .pref-btn {
    flex: 1;
}

.status-btn {
    flex: 1;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.65);
    font-size: 0.82rem;
    font-family: 'Lato', sans-serif;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.status-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
}

.status-btn.active.yes {
    background: rgba(40, 180, 80, 0.8);
    border-color: rgba(40, 180, 80, 0.95);
    color: #ffffff;
}

.status-btn.active.no {
    background: rgba(210, 45, 45, 0.8);
    border-color: rgba(210, 45, 45, 0.95);
    color: #ffffff;
}

.status-btn:disabled,
.pref-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}

.rsvp-closed-msg {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.5);
    text-align: center;
    margin: 0 0 12px;
    font-style: italic;
}

.pref-btn {
    padding: 7px 10px;
    border-radius: 6px;
    border: 1px solid rgba(0, 190, 190, 0.8);
    background: rgba(0, 180, 180, 0.65);
    color: #ffffff;
    font-size: 0.82rem;
    font-family: 'Lato', sans-serif;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.pref-btn.pref-vegetarian {
    background: rgba(40, 180, 80, 0.8);
    border-color: rgba(40, 180, 80, 0.95);
    color: #ffffff;
}

.pref-btn.pref-non-vegetarian {
    background: rgba(139, 90, 43, 0.8);
    border-color: rgba(139, 90, 43, 0.95);
    color: #ffffff;
}

/* ===========================
   Tab Popup — fullscreen overlay with slide-up sheet
   =========================== */
.tab-popup {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: transparent;
    display: flex;
    align-items: flex-end;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.tab-popup.active {
    opacity: 1;
    pointer-events: all;
}

.tab-popup-content {
    background-color: transparent;
    border-radius: 16px 16px 0 0;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    padding: 20px;
    position: relative;
    transform: translateY(100%);
    transition: transform 0.35s ease;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.tab-popup.active .tab-popup-content {
    transform: translateY(0);
}

.tab-popup-content > .close-btn {
    position: absolute;
    top: 14px;
    right: 16px;
}

.tab-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.25rem;
    color: #ffffff;
    margin-bottom: 16px;
    padding-right: 36px;
    line-height: 1.3;
}

.tab-content {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.88);
    line-height: 1.65;
    white-space: pre-wrap;
}

.tab-iframe-container {
    width: 100%;
    overflow: hidden;
}

.tab-iframe-container iframe {
    width: 100%;
    border: none;
    display: block;
}

.tab-backdrop-img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 8px;
    margin-top: 12px;
}

/* ===========================
   Landscape — cap at 1440px
   =========================== */
@media (orientation: landscape) {
    #top-banner,
    #page-footer,
    .rsvp-panel {
        left: max(0px, calc(50vw - 720px));
        right: max(0px, calc(50vw - 720px));
    }

    .invitation-container {
        max-width: 1440px;
        margin-left: auto;
        margin-right: auto;
    }
}
