/**
 * InvitKeun — responsif & rapi: kartu, teks, GIF, grid (semua template)
 * Load terakhir sebelum embed.css
 */

/* ——— Tipografi aman (tidak overflow) ——— */
.invitation-fluid,
.invitation-page {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

.event-card,
.gift-card,
.guestbook-compose,
.guestbook-entry,
.story-card,
.premium-couple-card,
.readable-card,
.rsvp-form-card,
.qris-card,
.countdown-cell {
    min-width: 0;
    box-sizing: border-box;
}

.event-card h3,
.event-card p,
.event-card address,
.event-card time,
.story-card p,
.story-card h3,
.guestbook-entry__message,
.guestbook-entry__name,
.premium-couple-card h3,
.premium-couple-card p,
.gift-card__number,
.gift-card__holder-name,
.section-lead,
.band-desc,
.inv-footer-thanks__desc {
    overflow-wrap: anywhere;
    word-break: break-word;
    hyphens: auto;
}

/* ——— Kartu konsisten ——— */
.event-card,
.gift-card,
.guestbook-compose,
.premium-couple-card,
.story-card,
.readable-card,
.rsvp-form-card,
.qris-card {
    width: 100%;
    max-width: 100%;
    margin-inline: auto;
    border-radius: clamp(1rem, 3vw, 1.35rem);
}

.template-surface .event-card,
.template-surface .guestbook-compose,
.template-surface .premium-couple-card {
    padding: clamp(1.1rem, 4vw, 1.5rem);
}

/* Grid anak tidak meluber */
.inv-couple-grid,
.inv-events-grid,
.invitation-gallery-grid,
.gift-cards-grid,
.guestbook-wall,
#countdown .countdown-flow {
    width: 100%;
    min-width: 0;
}

.inv-couple-grid > *,
.inv-events-grid > *,
.invitation-gallery-grid > *,
.gift-cards-grid > * {
    min-width: 0;
    max-width: 100%;
}

/* Countdown — layout final di invitation-couple-consistency.css */
#countdown .countdown-flow {
    width: 100%;
    min-width: 0;
}

/* Galeri */
.invitation-gallery-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: clamp(0.5rem, 2.5vw, 0.85rem);
}

@media (min-width: 640px) {
    .invitation-gallery-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.gallery-item,
.invitation-gallery-grid .aspect-square {
    width: 100%;
    min-width: 0;
    border-radius: 1rem;
    overflow: hidden;
}

/* Buku tamu */
.guestbook-wall {
    display: grid;
    gap: 0.85rem;
}

.guestbook-entry {
    width: 100%;
    max-width: 100%;
    padding: clamp(0.85rem, 3vw, 1.1rem);
    border-radius: 1rem;
    overflow-wrap: anywhere;
}

/* GIF dekorasi — tidak menutupi kartu */
.inv-deco-gif-layer {
    pointer-events: none;
    z-index: 5;
    contain: strict;
}

.inv-deco-gif-item {
    max-width: 5rem;
    height: auto;
    object-fit: contain;
    will-change: transform, opacity;
}

.inv-deco-gif-item img,
img.inv-deco-gif-item {
    width: 100%;
    height: auto;
    display: block;
}

/* Section dekorasi inline */
.template-surface .invitation-fx-canvas:not(.invitation-fx-global) {
    pointer-events: none;
    overflow: hidden;
}

/* QRIS */
.qris-card img {
    max-width: min(100%, 14rem);
    height: auto;
    margin-inline: auto;
    display: block;
}

/* ——— Mobile ——— */
@media (max-width: 767px) {
    .section-flow {
        padding-inline: 0;
    }

    .inv-section__inner,
    .section-inner,
    .section-band-inner {
        width: 100% !important;
        max-width: 100% !important;
        padding-inline: clamp(0.65rem, 3.5vw, 1rem);
    }

    .section-heading-block {
        width: 100%;
        padding-inline: 0.25rem;
    }

    .section-lead,
    .band-desc {
        font-size: clamp(0.78rem, 3.2vw, 0.875rem);
        line-height: 1.55;
        max-width: 100%;
    }

    #couple .premium-couple-card {
        max-width: 100%;
        padding: clamp(1rem, 4vw, 1.35rem) clamp(0.85rem, 3.5vw, 1.15rem) !important;
    }

    #couple .premium-couple-card h3 {
        font-size: clamp(1.35rem, 5vw, 1.75rem) !important;
    }

    #couple .premium-couple-card p:not(.couple-full-name) {
        font-size: clamp(0.72rem, 3vw, 0.8125rem);
        padding-inline: 0.15rem;
    }

    #couple .premium-couple-card .couple-full-name {
        font-size: clamp(1.05rem, 4.5vw, 1.2rem) !important;
        line-height: 1.48;
        padding-inline: 0.25rem;
    }

    .event-card {
        padding: clamp(1rem, 4vw, 1.25rem) !important;
        text-align: center;
    }

    .event-card address,
    .event-card .text-left {
        text-align: center;
    }

    .gift-card {
        max-width: min(100%, 20.5rem);
    }

    .gift-card__number {
        font-size: clamp(0.9rem, 3.8vw, 1.05rem);
        letter-spacing: 0.04em;
    }

    .countdown-value {
        font-size: clamp(1.35rem, 6vw, 1.75rem) !important;
    }

    .countdown-label {
        font-size: 0.58rem !important;
    }

    /* GIF dekorasi — tetap terlihat di mobile */
    .inv-deco-gif-item {
        width: clamp(2rem, 8vw, 3.25rem) !important;
        max-width: 3.25rem !important;
        opacity: 0.72 !important;
    }

    .inv-deco-gif-layer--animated .inv-deco-gif-item {
        opacity: 0.8 !important;
    }

    .inv-deco-gif-item--0 { left: 4%; top: 8%; }
    .inv-deco-gif-item--1 { left: auto; right: 4%; top: 10%; }
    .inv-deco-gif-item--2 { left: 6%; top: auto; bottom: 18%; }
    .inv-deco-gif-item--3 { left: auto; right: 6%; top: auto; bottom: 22%; }
    .inv-deco-gif-item--4 { left: 50%; transform: translateX(-50%); top: 4%; }
    .inv-deco-gif-item--5 { display: none; }

    body.invitation-perf-mobile .inv-deco-gif-item:nth-child(n+4) {
        display: none !important;
    }

    #floatNav .nav-item {
        width: 2.5rem;
        height: 2.5rem;
        min-width: 2.5rem;
    }

    #musicBtn.music-btn--float {
        width: 2.65rem;
        height: 2.65rem;
        right: max(0.75rem, env(safe-area-inset-right, 0px));
        bottom: calc(5.25rem + env(safe-area-inset-bottom, 0px));
    }

    .layout-cards .section-flow {
        margin-inline: 0;
    }

    .hero-name-line {
        font-size: clamp(2rem, 9vw, 2.75rem) !important;
    }

    .inv-hero-couple-names .hero-name-line {
        font-size: clamp(1.85rem, 8.5vw, 2.5rem) !important;
    }
}

@media (max-width: 380px) {
    #floatNav {
        padding-inline: 0.35rem;
        gap: 0.15rem;
    }

    #floatNav .nav-item {
        width: 2.35rem;
        height: 2.35rem;
        min-width: 2.35rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .inv-deco-gif-item,
    .inv-deco-gif-layer--animated .inv-deco-gif-item {
        animation: none !important;
        opacity: 0.35 !important;
    }
}
