/* Base Reset & Fonts */
:root {
    --navigation-height: calc(64px + env(safe-area-inset-bottom, 0px));
    --viewport-height: 100vh;
    --page-height: calc(var(--viewport-height) - var(--navigation-height));
}

@supports (height: 100svh) {
    :root { --viewport-height: 100svh; }
}
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Montserrat', sans-serif;
    color: #4a4540;
    background-color: #d8d2cb;
    min-height: 100vh;
}

body.no-scroll {
    overflow: hidden;
}

/* Card Mobile-First Container */
.container {
    width: 100%;
    max-width: 440px;
    margin: 0 auto;
    background-color: #fdfcf9;
    min-height: 100vh;
    padding-bottom: 90px;
    box-shadow: 0 0 25px rgba(0,0,0,0.12);
    position: relative;
    overflow: hidden;
    text-align: center;
}

/* ========================================= */
/* ENVELOPE & REAL POCKET LAYER ARCHITECTURE */
/* ========================================= */
.envelope-hero {
    position: relative;
    width: 100%;
    height: clamp(480px, 140vw, 570px);
    background: #cad8e6;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: flex-end;
}

.envelope-scene {
    position: relative;
    width: 88%;
    max-width: 370px;
    aspect-ratio: 1;
    margin-bottom: 12px;
    isolation: isolate;
}

/* Shared Envelope Dimensions */
.envelope-pocket-wrapper {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    pointer-events: none;
    line-height: 0;
}

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

/* Layer 1: Envelope Back Liner */
.envelope-back {
    z-index: 1;
    filter: drop-shadow(0 8px 18px rgba(0,0,0,0.18));
}

/* Layer 2: transparent surat artwork between the envelope back and pocket. */
.invitation-card {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translate(-50%, 55%);
    width: 84%;
    aspect-ratio: 853 / 1280;
    filter: drop-shadow(0 5px 7px rgba(0, 0, 0, 0.16));
    z-index: 2; /* Sits BETWEEN Back and Front Flap */
    text-align: center;
    box-sizing: border-box;
    opacity: 0;
    
    /* Smooth, slow emergence: 2.4s ease-out */
    transition: transform 3.2s cubic-bezier(0.16, 1, 0.3, 1), opacity 1.8s ease;
}

/* When door is opened: card pulls upward out of pocket */
.invitation-card.revealed {
    transform: translate(-50%, clamp(-100px, -22vw, -65px));
    opacity: 1;
}

.invitation-paper {
    display: block;
    width: 100%;
    height: 100%;
}

.invitation-card-text {
    position: absolute;
    top: 25%;
    left: 12%;
    right: 12%;
}

.invitation-card .couple-serif {
    font-size: clamp(22px, 6vw, 28px);
}

.invitation-card .sub-lead {
    font-size: 9px;
    letter-spacing: 2px;
}

.invitation-card .wedding-date {
    font-size: 9px;
    letter-spacing: 1px;
    margin-top: 8px;
}

/* Layer 3: Envelope Front Flap & Red Area Borders (Sits in front of card) */
.envelope-front {
    z-index: 3; /* Sits IN FRONT of the card */
    -webkit-clip-path: url(#envelope-pocket-clip);
    clip-path: url(#envelope-pocket-clip);
}

.envelope-clip-definitions {
    position: absolute;
    pointer-events: none;
}

.sub-lead {
    font-size: 11px;
    letter-spacing: 2.5px;
    color: #a47d4e;
    font-weight: 600;
}

.couple-serif {
    font-family: 'Cinzel', serif;
    font-size: 30px;
    color: #a47d4e;
    font-weight: 700;
    margin: 2px 0;
}

.ampersand {
    font-family: 'Alex Brush', cursive;
    font-size: 28px;
    color: #7b94aa;
}

.wedding-date {
    font-size: 11px;
    letter-spacing: 1.5px;
    margin-top: 12px;
    font-weight: 600;
    color: #63615e;
}

.hashtag {
    font-size: 10px;
    color: #8da2b3;
    margin-top: 4px;
}

/* Sections */
.section-padded {
    padding: 40px 20px;
}

.section-card {
    margin: 20px 15px;
    padding: 25px 20px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.04);
    border: 1px solid #f1ece4;
}

.arabic-calligraphy {
    font-size: 20px;
    color: #555;
    margin-bottom: 12px;
}

.salam {
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 4px;
}

.text-sm {
    font-size: 12px;
    color: #777;
}

.divider {
    color: #b79060;
    margin: 15px 0;
}

.parents {
    font-weight: 600;
    font-size: 15px;
    color: #3b3734;
}

/* Couple Showcase */
.couple-showcase {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin: 25px auto 10px auto;
    max-width: 320px;
}

.couple-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 18px;
    width: 100%;
}

.couple-frame {
    width: 105px !important;
    max-width: 105px !important;
    height: 140px !important;
    flex: 0 0 105px !important;
    background: #ffffff;
    padding: 5px;
    border: 3px solid #b79060;
    border-radius: 4px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.14);
    box-sizing: border-box;
}

.frame-left {
    transform: rotate(-3.5deg);
}

.frame-right {
    transform: rotate(3deg);
}

.couple-frame img.couple-img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: top center;
    display: block !important;
    border-radius: 2px;
}

.couple-meta {
    flex: 0 1 auto;
}

.couple-meta.text-left {
    text-align: left;
}

.couple-meta.text-right {
    text-align: right;
}

.couple-fullname {
    font-family: 'Cinzel', serif;
    font-size: 16px;
    color: #a47d4e;
    font-weight: 700;
    line-height: 1.25;
    margin: 0;
}

.couple-bin {
    display: block;
    font-family: 'Cinzel', serif;
    font-size: 13px;
    color: #8c6a3f;
    margin-top: 3px;
}

.couple-connector {
    font-family: 'Alex Brush', cursive;
    font-size: 26px;
    color: #7b94aa;
    text-align: center;
    line-height: 1;
    margin: -6px 0;
}

/* Schedule Section */
.schedule-section {
    text-align: center;
    padding: 35px 20px 30px 20px;
}

.schedule-cursive-title {
    font-family: 'Alex Brush', cursive;
    font-size: 38px;
    font-weight: 400;
    color: #4a4540;
    margin-bottom: 25px;
    letter-spacing: 1px;
}

.vertical-timeline {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 30px;
}

.timeline-step {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.timeline-time {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: #3b3734;
    margin-bottom: 3px;
}

.timeline-event {
    font-size: 13px;
    color: #55504a;
    font-weight: 400;
}

.timeline-line {
    width: 1px;
    height: 30px;
    background-color: #7b756d;
    margin: 10px 0;
}

.countdown-wrapper {
    margin-top: 15px;
    border-top: 1px solid #f1ece4;
    padding-top: 20px;
}

.countdown-wrapper h4 {
    font-family: 'Cinzel', serif;
    font-size: 14px;
    color: #a47d4e;
    margin-bottom: 10px;
}

.countdown-boxes {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 15px;
}

.countdown-boxes div {
    background: #f6f3ee;
    border: 1px solid #e5dfd5;
    padding: 10px 8px;
    border-radius: 8px;
    min-width: 65px;
}

.countdown-boxes span {
    font-size: 20px;
    font-weight: 700;
    display: block;
    color: #7b94aa;
}

.countdown-boxes small {
    font-size: 11px;
    color: #888;
}

/* Location Styles */
.location-heading {
    font-family: 'Cinzel', serif;
    color: #a47d4e;
    margin-bottom: 6px;
}

.venue-name {
    font-size: 16px;
    color: #3b3734;
    margin-bottom: 3px;
}

.map-toggle-bar {
    display: inline-flex;
    background: #ebe5dc;
    padding: 4px;
    border-radius: 30px;
    gap: 4px;
    margin: 16px 0 14px 0;
    border: 1px solid #dfd8cd;
}

.map-btn-switch {
    background: transparent;
    border: none;
    outline: none;
    padding: 7px 18px;
    border-radius: 24px;
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    color: #6d675f;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    transition: all 0.25s ease;
}

.map-btn-switch i {
    font-size: 13px;
}

.map-btn-switch.active {
    background: #738eab;
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(115, 142, 171, 0.35);
}

.map-container-box {
    width: 100%;
    height: 250px;
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
    background: #f7f6f4;
}

.map-container-box iframe {
    width: 100%;
    border: none;
    display: block;
    position: absolute;
    left: 0;
}

#box-google-map iframe {
    top: 0;
    height: 285px;
}

#box-waze-map iframe {
    top: -55px;
    height: 350px;
}

.map-direct-link {
    margin-top: 14px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #738eab;
    color: #ffffff !important;
    text-decoration: none;
    font-size: 12px;
    font-weight: 600;
    padding: 9px 20px;
    border-radius: 20px;
    box-shadow: 0 3px 10px rgba(115, 142, 171, 0.25);
    transition: all 0.2s ease;
}

.map-direct-link:hover {
    background: #5d7792;
    transform: translateY(-1px);
}

.map-direct-link.waze-link {
    background: #2cb5d8;
    box-shadow: 0 3px 10px rgba(44, 181, 216, 0.25);
}

.map-direct-link.waze-link:hover {
    background: #2398b6;
}

/* Attendance Display */
.pax-counter {
    margin: 20px 0;
}

.count-number {
    font-size: 38px;
    font-weight: 700;
    color: #7b94aa;
    display: block;
}

.count-label {
    font-size: 13px;
    color: #888;
}

/* Primary Button */
.btn-primary {
    background-color: #738eab;
    color: #ffffff;
    border: none;
    padding: 12px 28px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(115,142,171,0.3);
    transition: background 0.2s ease;
}

.btn-primary:hover {
    background-color: #5c7590;
}

/* Contact Pills */
.contact-list {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 15px;
}

.contact-pill {
    text-decoration: none;
    background: #8faec4;
    color: #ffffff;
    font-size: 12px;
    padding: 8px 15px;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
}

/* Opener Overlay & Doors */
.opener-overlay {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 440px;
    height: 100vh;
    z-index: 10000;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

.door {
    position: absolute;
    top: 0;
    height: 100%;
    width: 50%;
    background: rgba(255, 255, 255, 0.45);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: transform 1.3s cubic-bezier(0.77, 0, 0.175, 1), opacity 0.9s ease-in-out;
}

.door-left {
    left: 0;
    border-right: 1px solid rgba(183, 144, 96, 0.4);
}

.door-right {
    right: 0;
    border-left: 1px solid rgba(183, 144, 96, 0.4);
}

.opened .door-left {
    transform: translateX(-100%);
    opacity: 0;
}

.opened .door-right {
    transform: translateX(100%);
    opacity: 0;
}

.seal-container {
    position: relative;
    z-index: 10002;
    cursor: pointer;
    text-align: center;
    transition: transform 0.3s ease, opacity 0.4s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.seal-container:hover {
    transform: scale(1.05);
}

.wedding-seal {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.2);
    border: 3px solid #b79060;
    padding: 0;
    object-fit: cover;
    display: block;
    background-color: transparent;
}

.click-hint {
    display: block;
    margin-top: 14px;
    font-size: 11px;
    letter-spacing: 1.5px;
    color: #4a3f35;
    text-transform: uppercase;
    background: rgba(255,255,255,0.85);
    padding: 6px 14px;
    border-radius: 14px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.opened .seal-container {
    opacity: 0;
    transform: scale(1.2);
    pointer-events: none;
}

/* Modal Popup RSVP Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(4px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10005;
    padding: 15px;
}

.modal-box {
    background: #ffffff;
    width: 100%;
    max-width: 380px;
    border-radius: 15px;
    padding: 22px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.25);
    animation: popup 0.3s ease;
}

@keyframes popup {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    border-bottom: 1px solid #f0eae1;
    padding-bottom: 8px;
}

.close-modal {
    background: transparent;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
}

.modal-form {
    text-align: left;
}

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

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 5px;
    color: #444;
}

.form-group input, 
.form-group select, 
.form-group textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #d5cebe;
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
}

.toggle-group {
    display: flex;
    gap: 8px;
}

.toggle-btn {
    flex: 1;
    padding: 8px;
    border: 1px solid #ccc;
    background: #f7f7f7;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.toggle-btn.active {
    background: #738eab;
    color: #fff;
    border-color: #738eab;
}

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 18px;
}

.modal-actions button {
    flex: 1;
    padding: 10px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
}

.btn-secondary {
    background: #eee;
    border: none;
    color: #444;
}

/* Bottom Navigation Bar */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 440px;
    background-color: #b79060;
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 10px 0 8px 0;
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.15);
    z-index: 9999;
}

.nav-item {
    text-decoration: none;
    color: #ffffff;
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 11px;
    font-weight: 500;
    flex: 1;
    text-align: center;
}

.nav-item i {
    font-size: 18px;
    margin-bottom: 3px;
}

/* Floating Music Disk Button */
.music-btn {
    position: fixed;
    top: 20px;
    right: calc(50% - 200px);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #b79060;
    color: #ffffff;
    border: 2px solid #ffffff;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 18px;
    z-index: 9998;
}

@media (max-width: 440px) {
    .music-btn {
        right: 15px;
    }
}

.music-btn.playing i {
    animation: spin 3s linear infinite;
}

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

/* Rotating Wishes Section */
.wishes-section {
    margin-bottom: 30px;
    background: #fffdf9;
    border: 1px solid #ebd9c3;
    min-height: 250px;
}

.wishes-title {
    font-family: 'Cinzel', serif;
    color: #a47d4e;
    font-size: 17px;
    margin-bottom: 16px;
}

.wishes-stage {
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: opacity 0.5s ease-in-out, transform 0.5s ease-in-out;
    opacity: 1;
    transform: translateY(0);
}

.wishes-stage.fade-out {
    opacity: 0;
    transform: translateY(8px);
}

.wish-item {
    background: #fdfaf6;
    border-left: 3px solid #b79060;
    padding: 10px 14px;
    border-radius: 6px;
    text-align: left;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.03);
}

.wish-text {
    font-size: 12px;
    color: #555;
    line-height: 1.45;
    font-style: italic;
    margin-bottom: 4px;
}

.wish-sender {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: #a47d4e;
    text-align: right;
}

@media (prefers-reduced-motion: reduce) {
    .invitation-card { transition: none; }
}

/* The envelope cover snaps to one continuous invitation page. */
body.invitation-view {
    height: 100vh;
    height: var(--viewport-height);
    min-height: 0;
    display: grid;
    grid-template-rows: minmax(0, 1fr) var(--navigation-height);
    overflow: hidden;
}

.invitation-pages {
    height: calc(100vh - var(--navigation-height));
    height: var(--page-height);
    min-height: 0;
    padding-bottom: 0;
    overflow-x: hidden;
    overflow-y: auto;
    scroll-snap-type: y mandatory;
    scroll-behavior: smooth;
    overscroll-behavior-y: contain;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y pinch-zoom;
}

.invitation-pages::-webkit-scrollbar { display: none; }
.no-scroll .invitation-pages,
.modal-open .invitation-pages { overflow-y: hidden; }

.invitation-page {
    min-height: 100%;
    scroll-snap-align: start;
    scroll-snap-stop: always;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 60px 15px 24px;
    position: relative;
}

/* The long second page can scroll freely within its snap area. */
.invitation-details {
    min-height: 100%;
    scroll-snap-align: start;
    scroll-snap-stop: always;
}
.invitation-details > .invitation-page {
    min-height: 0;
    display: block;
    scroll-snap-align: none;
    scroll-snap-stop: normal;
    padding-top: 32px;
    padding-bottom: 68px;
}
.invitation-page > .section-card,
.invitation-page > .page-content {
    width: 100%;
    flex: 0 0 auto;
}
.invitation-page > .section-card { margin: 0; }
.invitation-page.envelope-hero {
    height: auto;
    padding: 0;
    justify-content: flex-end;
}
.invitation-page.envelope-hero .envelope-scene {
    /* The PNG's visible envelope occupies 74% of its transparent canvas. */
    width: 120%;
    width: min(calc((100% - 32px) / 0.74), 550px, calc((var(--page-height) - 136px) / 1.27));
    max-width: none;
    flex: 0 0 auto;
    margin-bottom: 12px;
}
.couple-page { padding-inline: 20px; }
.attendance-page .section-padded { padding: 25px 10px 35px; }
.attendance-page .section-card { margin: 16px 0 0; }
.contact-list { flex-wrap: wrap; }
.countdown-boxes div { min-width: 0; flex: 1; }
.invitation-view .bottom-nav {
    height: var(--navigation-height);
    padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
}
.nav-item.active { color: #fff4cf; }
.nav-item.active i { transform: translateY(-2px); }
.opener-overlay { height: var(--viewport-height); }
.modal-overlay { height: var(--viewport-height); }
.modal-box { max-height: calc(var(--viewport-height) - 30px); overflow-y: auto; }
.seal-container {
    background: none;
    border: 0;
    padding: 0;
    font: inherit;
    -webkit-appearance: none;
    appearance: none;
    touch-action: manipulation;
}

/* A failed script must leave a readable invitation rather than a locked cover. */
.invitation-view:not(.invitation-ready) .opener-overlay { display: none; }
.invitation-view:not(.invitation-ready) .invitation-card {
    opacity: 1;
    transform: translate(-50%, clamp(-100px, -22vw, -65px));
    transition: none;
}
@media (prefers-reduced-motion: reduce) {
    .invitation-pages { scroll-behavior: auto; }
}

/* RSVP validation: ivory paper, warm gold border, and invitation blue. */
.name-validation[hidden] { display: none; }
.name-validation {
    position: relative;
    display: flex;
    align-items: center;
    gap: 9px;
    margin-top: 10px;
    padding: 11px 13px;
    background: #fdfcf9;
    border: 1px solid #d5cebe;
    border-left: 3px solid #738eab;
    border-radius: 8px;
    color: #4a4540;
    font: 500 12px/1.6 'Montserrat', sans-serif;
    box-shadow: 0 4px 12px rgba(74, 69, 64, .06);
}
.name-validation::before {
    content: '';
    position: absolute;
    top: -5px;
    left: 20px;
    width: 8px;
    height: 8px;
    background: #fdfcf9;
    border-top: 1px solid #d5cebe;
    border-left: 1px solid #d5cebe;
    transform: rotate(45deg);
}
.name-validation-icon {
    display: grid;
    place-items: center;
    flex: 0 0 20px;
    height: 20px;
    border: 1px solid #738eab;
    border-radius: 50%;
    color: #738eab;
    font-weight: 600;
}
.modal-form input[aria-invalid='true'] {
    border-color: #738eab;
    outline: none;
    box-shadow: 0 0 0 3px rgba(115, 142, 171, .14);
}
/* One gold divider ends each page after the envelope cover. */
.invitation-page:not(.envelope-hero) { padding-bottom: 68px; }
.invitation-page:not(.envelope-hero)::after {
    content: '';
    position: absolute;
    bottom: 14px;
    left: 50%;
    width: calc(100% - 40px);
    max-width: 380px;
    height: 38px;
    transform: translateX(-50%);
    background: url('../img/page-ornament.svg') center / contain no-repeat;
    pointer-events: none;
}
/* Compact photo gallery with a centre card and angled side cards. */
.invitation-pages { touch-action: pan-y pinch-zoom; }
.gallery-page .gallery-section { padding: 8px 0 12px; border: 0; background: transparent; box-shadow: none; }
.gallery-title { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.photo-track { position: relative; width: 100%; height: clamp(230px, 76vw, 300px); overflow: hidden; cursor: grab; touch-action: pan-y pinch-zoom; user-select: none; }
.photo-track.is-dragging { cursor: grabbing; }
.photo-slide {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 70%;
    max-width: 250px;
    aspect-ratio: 1 / 1.1;
    padding: 5px;
    background: #fdfcf9;
    border: 1px solid #d5cebe;
    border-radius: 8px;
    box-shadow: 0 10px 22px rgba(74, 69, 64, .14);
    transform: translate(calc(-50% + var(--position, 0) * 76%), -50%) perspective(800px) rotateY(calc(var(--position, 0) * -24deg)) scale(var(--scale, 1));
    opacity: var(--opacity, 1);
    transition: transform .7s cubic-bezier(.22, .68, .22, 1), opacity .7s ease;
    will-change: transform;
}
.photo-slide:nth-child(2) { --position: 1; --scale: .82; --opacity: .65; }
.photo-slide:nth-child(3) { --position: -1; --scale: .82; --opacity: .65; }
.photo-slide.is-current { z-index: 2; }
.photo-slot { width: 100%; height: 100%; background: #f3eee6; border: 1px solid #e8dfd2; border-radius: 4px; overflow: hidden; }
.photo-slot img { display: block; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.photo-indicators { display: flex; justify-content: center; gap: 7px; margin-top: 9px; }
.photo-indicator { width: 5px; height: 5px; border-radius: 50%; background: #d5cebe; transition: background .3s ease; }
.photo-indicator.is-active { background: #b79060; }
.photo-track:focus-visible { outline: 2px solid #738eab; outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) { .photo-slide, .photo-indicator { transition: none; } }
/* Reserve a separate navigation row to avoid iOS fixed-element clipping. */
.invitation-view > .invitation-pages {
    grid-row: 1;
    width: 100%;
    height: 100%;
    min-height: 0;
}
.invitation-view > .bottom-nav {
    grid-row: 2;
    position: relative;
    top: auto;
    bottom: auto;
    left: auto;
    transform: none;
    width: 100%;
    max-width: 440px;
    margin-inline: auto;
    min-height: 0;
}
/* Content and viewport changes must not snap readers back to the greeting. */
.invitation-pages.is-reading { scroll-snap-type: none; }

/* Soft, staggered lettering reveal as the invitation leaves the envelope. */
.invitation-card-text > .sub-lead,
.invitation-card-text > .ampersand { display: block; }
.invitation-card-text > :nth-child(1) { --text-delay: .85s; }
.invitation-card-text > :nth-child(2) { --text-delay: 1.45s; }
.invitation-card-text > :nth-child(3) { --text-delay: 2.05s; }
.invitation-card-text > :nth-child(4) { --text-delay: 2.65s; }
.invitation-card-text > :nth-child(5) { --text-delay: 3.25s; }
.invitation-card-text > :nth-child(6) { --text-delay: 3.85s; }
@media (prefers-reduced-motion: no-preference) {
    .invitation-ready .invitation-card-text > * {
        opacity: 0;
        transform: translateY(22px) scale(.92);
        transform-origin: center;
    }
    .invitation-ready .invitation-card.revealed .invitation-card-text > * {
        animation: letter-text-reveal 2.2s cubic-bezier(.25, .46, .45, .94) both;
        animation-delay: var(--text-delay);
    }
}
@keyframes letter-text-reveal {
    from { opacity: 0; transform: translateY(22px) scale(.92); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}