:root {
    --color-oro: #B28D42;
    --color-oro-soft: #D4AF37;
    --color-crema: #FCFAF7;
    --color-texto: #2D2D2D;
    --font-serif: 'Playfair Display', serif;
    --font-sans: 'Montserrat', sans-serif;
}

html { scroll-behavior: smooth; }

body {
    font-family: var(--font-sans);
    background-color: var(--color-crema);
    color: var(--color-texto);
    -webkit-tap-highlight-color: transparent;
    overflow-x: hidden;
    padding-bottom: calc(5.75rem + env(safe-area-inset-bottom));
}

.serif { font-family: var(--font-serif); }

.hidden { display: none !important; }

body.intro-lock {
    overflow: hidden;
}

.invitation-intro {
    position: fixed;
    inset: 0;
    z-index: 2600;
    display: grid;
    place-items: center;
    padding: 0;
    --intro-ratio: 0.5625;
    background: #14110f;
    opacity: 1;
    visibility: visible;
    overflow: hidden;
    transition: opacity 0.9s ease, visibility 0.9s ease;
}

.invitation-intro.is-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    animation: none;
}

.intro-video-shell {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    z-index: 2;
    padding: 0;
}

.intro-video {
    display: block;
    pointer-events: none;
    user-select: none;
}

.intro-video-backdrop {
    position: absolute;
    inset: -4%;
    z-index: 0;
    width: 108%;
    height: 108%;
    object-fit: cover;
    filter: blur(22px) saturate(0.94) brightness(0.62);
    transform: scale(1.06);
    opacity: 0.74;
}

.intro-video-main {
    width: min(100vw, calc(100dvh * var(--intro-ratio)));
    height: min(100dvh, calc(100vw / var(--intro-ratio)));
    max-width: 100%;
    max-height: 100dvh;
    object-fit: contain;
    border-radius: clamp(0px, 2.2vw, 18px);
    box-shadow: 0 28px 70px rgba(0, 0, 0, 0.34);
    background: #14110f;
}

.intro-vignette {
    position: absolute;
    inset: 0;
    z-index: 3;
    pointer-events: none;
    background:
        linear-gradient(180deg, rgba(20, 17, 15, 0.32), transparent 28%, transparent 62%, rgba(20, 17, 15, 0.52)),
        radial-gradient(circle at 50% 45%, transparent 42%, rgba(20, 17, 15, 0.32) 100%);
}

@media (orientation: landscape) and (max-height: 620px) {
    .intro-video-main {
        width: min(100vw, calc(100dvh * var(--intro-ratio)));
        height: min(100dvh, calc(100vw / var(--intro-ratio)));
    }
}

.hero-section,
.section-band,
.location-section,
.rsvp-section,
.gift-section,
.guestbook-section,
.gallery-section {
    scroll-margin-top: 1rem;
}

.mobile-nav {
    position: fixed;
    left: 50%;
    bottom: max(0.75rem, env(safe-area-inset-bottom));
    transform: translateX(-50%);
    z-index: 900;
    width: min(calc(100% - 1.5rem), 430px);
    min-height: 64px;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.25rem;
    padding: 0.45rem;
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid rgba(178, 141, 66, 0.16);
    border-radius: 999px;
    box-shadow: 0 18px 42px rgba(45, 45, 45, 0.14);
    backdrop-filter: blur(18px);
}

.mobile-nav-link {
    min-width: 0;
    min-height: 52px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    border-radius: 999px;
    color: #78716c;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    text-decoration: none;
}

.mobile-nav-link i {
    color: var(--color-oro);
    font-size: 0.95rem;
}

.mobile-nav-link:active,
.mobile-nav-link:focus-visible {
    background: rgba(178, 141, 66, 0.1);
    outline: none;
}

.hero-frame {
    border: 12px solid white;
    box-shadow: 0 30px 60px -12px rgba(178, 141, 66, 0.15), 0 18px 36px -18px rgba(0, 0, 0, 0.2);
    position: relative;
    overflow: hidden;
    background: #fff;
    border-radius: 24px;
}

.image-viewport,
.location-viewport {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
    background: #fdfdfd;
}

#hero-img,
#img-cer,
#img-cel {
    max-width: none;
    position: absolute;
    user-select: none;
    touch-action: auto;
    transition: opacity 0.5s ease;
    width: auto;
    height: 100%;
    left: 0;
    top: 0;
}

body.admin-mode #hero-img,
body.admin-mode #img-cer,
body.admin-mode #img-cel { cursor: move; }

.gold-divider {
    height: 1px;
    background: radial-gradient(circle, var(--color-oro) 0%, transparent 80%);
    width: 80%;
    margin: 3rem auto;
    opacity: 0.4;
}

.btn-premium {
    background: white;
    color: var(--color-oro);
    border: 1px solid rgba(178, 141, 66, 0.3);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 100px;
    display: inline-flex;
}

.btn-premium:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(178, 141, 66, 0.15);
    border-color: var(--color-oro);
}

.admin-panel {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 1000;
    display: none;
    gap: 0.75rem;
    flex-direction: column;
}

body.admin-mode .admin-panel { display: flex; }

@media (max-width: 767px) {
    .admin-panel {
        bottom: calc(6rem + env(safe-area-inset-bottom));
        right: 1rem;
    }
}

.btn-admin {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: white;
    color: var(--color-oro);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    border: 1px solid #f0f0f0;
}

.admin-main-btn {
    background: #1f1f1f;
    color: white;
    border-color: #1f1f1f;
}

.admin-settings-panel {
    width: min(100%, 560px);
    max-height: min(86vh, 720px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid rgba(255, 255, 255, 0.65);
    border-radius: 28px 28px 0 0;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.22);
    backdrop-filter: blur(18px);
}

.admin-settings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.25rem 1.25rem 1rem;
    border-bottom: 1px solid #f1eee9;
}

.admin-settings-header h3 {
    font-size: 1.6rem;
    color: #27211b;
}

.admin-kicker {
    margin-bottom: 0.25rem;
    color: var(--color-oro);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.24em;
    text-transform: uppercase;
}

.admin-icon-btn {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #f7f4ef;
    color: #766b60;
}

.admin-settings-body {
    overflow-y: auto;
    padding: 1.25rem;
    display: grid;
    gap: 1rem;
}

.admin-grid-2 {
    display: grid;
    gap: 1rem;
    grid-template-columns: 1fr;
}

.admin-field {
    display: grid;
    gap: 0.45rem;
}

.admin-field label {
    color: #766b60;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.admin-field input {
    width: 100%;
    min-height: 48px;
    padding: 0.85rem 1rem;
    border: 1px solid #eee7dd;
    border-radius: 14px;
    background: #fff;
    color: #2d2d2d;
    font-size: 0.9rem;
    outline: none;
}

.admin-field input:focus {
    border-color: rgba(178, 141, 66, 0.62);
    box-shadow: 0 0 0 3px rgba(178, 141, 66, 0.1);
}

.admin-settings-actions {
    display: flex;
    gap: 0.75rem;
    padding: 1rem 1.25rem 1.25rem;
    border-top: 1px solid #f1eee9;
}

.admin-primary-btn,
.admin-secondary-btn {
    flex: 1;
    min-height: 50px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.admin-primary-btn {
    background: #202020;
    color: white;
}

.admin-secondary-btn {
    background: #f6f1ea;
    color: #7a6c5e;
}

.glass-modal {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.message-card {
    background: white;
    border-radius: 20px;
    padding: 1.5rem;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.02);
    border: 1px solid #f7f7f7;
}

.gallery-item-container {
    position: relative;
    aspect-ratio: var(--photo-ratio, 1 / 1);
    overflow: hidden;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    background: #fff;
}

.gallery-item-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.33, 1, 0.68, 1);
}

.gallery-item-container.fit-natural img {
    position: static;
    object-fit: contain;
    display: block;
}

.gallery-item-container.fit-natural #img-cer,
.gallery-item-container.fit-natural #img-cel {
    position: static;
    width: 100% !important;
    height: auto !important;
    max-width: 100%;
}

.gallery-item-container.fit-natural .location-viewport {
    position: static;
}

.upload-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s;
    color: white;
    z-index: 10;
    pointer-events: none;
}

body.admin-mode .gallery-item-container:hover .upload-overlay { opacity: 1; }

#toast {
    position: fixed;
    bottom: calc(5.5rem + env(safe-area-inset-bottom));
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    opacity: 0;
    visibility: hidden;
    background: #333;
    color: white;
    padding: 1rem 2rem;
    border-radius: 99px;
    font-size: 0.875rem;
    z-index: 2000;
    pointer-events: none;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.2s ease, visibility 0.2s ease;
}

#toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    visibility: visible;
}

.loading-dots::after {
    content: '.';
    animation: dots 1.5s steps(5, end) infinite;
}

@keyframes dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60% { content: '...'; }
    80%, 100% { content: ''; }
}

.drop-active {
    outline: 4px dashed var(--color-oro) !important;
    outline-offset: -8px;
    background: rgba(178, 141, 66, 0.2) !important;
}

.admin-phone-tag {
    display: none;
    background: rgba(0, 0, 0, 0.2);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 10px;
    margin-left: 4px;
}

body.admin-mode .admin-phone-tag { display: inline-block; }

.msg-admin-actions {
    display: none;
    gap: 10px;
    margin-top: 10px;
    border-top: 1px solid #f0f0f0;
    padding-top: 10px;
}

body.admin-mode .msg-admin-actions { display: flex; }

.photo-delete-btn,
.photo-download-btn {
    position: absolute;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    z-index: 20;
}

.photo-delete-btn { top: 5px; right: 5px; background: rgba(239, 68, 68, 0.9); color: white; }
.photo-download-btn { bottom: 5px; right: 5px; background: rgba(178, 141, 66, 0.9); color: white; }
body.admin-mode .photo-delete-btn,
body.admin-mode .photo-download-btn { display: flex; }

.admin-bulk-download {
    display: none;
    margin-bottom: 20px;
}

body.admin-mode .admin-bulk-download { display: inline-block; }

.gift-card {
    width: min(100%, 360px);
    padding: clamp(1.5rem, 7vw, 3rem) !important;
    border-radius: clamp(24px, 8vw, 40px) !important;
}

.gift-actions {
    display: grid;
    gap: 0.85rem;
}

.gift-method-btn {
    width: 100%;
    min-height: 54px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    border: 1px solid rgba(178, 141, 66, 0.22);
    border-radius: 999px;
    background: #2d2d2d;
    color: #fff;
    font-size: clamp(0.62rem, 2.8vw, 0.72rem);
    font-weight: 800;
    letter-spacing: 0.14em;
    line-height: 1.15;
    text-transform: uppercase;
    text-align: center;
    box-shadow: 0 16px 34px rgba(45, 45, 45, 0.12);
    touch-action: manipulation;
    transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.gift-method-btn span {
    min-width: 0;
    overflow-wrap: anywhere;
}

.gift-method-btn[data-panel="transfer-panel"] {
    background: #fff;
    color: var(--color-oro);
}

.gift-method-btn:active {
    transform: translateY(1px);
}

.gift-panel {
    padding: clamp(0.75rem, 4vw, 1rem);
    border: 1px solid #eee7dd;
    border-radius: 22px;
    background: #faf8f4;
}

.bizum-options {
    display: grid;
    gap: 0.75rem;
    margin-bottom: 0.95rem;
}

.bizum-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 0.9rem;
    border: 1px solid #eee7dd;
    border-radius: 16px;
    background: #fff;
    text-align: left;
}

.bizum-option input {
    accent-color: var(--color-oro);
}

.bizum-option span {
    min-width: 0;
    display: grid;
    gap: 0.1rem;
}

.bizum-option strong {
    color: #2d2d2d;
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.bizum-option em {
    color: #78716c;
    font-family: monospace;
    font-size: 0.72rem;
    font-style: normal;
}

.gift-copy-btn {
    width: 100%;
    min-height: 46px;
    padding: 0.75rem 1rem;
    border-radius: 999px;
    background: #fff;
    color: var(--color-oro);
    border: 1px solid rgba(178, 141, 66, 0.24);
    font-size: clamp(0.6rem, 2.6vw, 0.68rem);
    font-weight: 800;
    letter-spacing: 0.12em;
    line-height: 1.15;
    text-transform: uppercase;
    overflow-wrap: anywhere;
    touch-action: manipulation;
}

.transfer-details {
    display: grid;
    gap: 0.75rem;
    margin: 0 0 0.95rem;
    text-align: left;
}

.transfer-details div {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: 0.75rem;
    row-gap: 0.35rem;
    align-items: center;
    padding: 0.85rem 0.9rem;
    border: 1px solid #eee7dd;
    border-radius: 16px;
    background: #fff;
}

.transfer-details dt {
    grid-column: 1 / 2;
    margin-bottom: 0.2rem;
    color: #2d2d2d;
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.transfer-details dd {
    grid-column: 1 / 2;
    margin: 0;
    color: #78716c;
    font-family: monospace;
    font-size: 0.72rem;
    overflow-wrap: anywhere;
}

.transfer-copy-btn {
    grid-column: 2 / 3;
    grid-row: 1 / span 2;
    min-height: 36px;
    padding: 0.55rem 0.75rem;
    border-radius: 999px;
    background: #faf8f4;
    color: var(--color-oro);
    border: 1px solid rgba(178, 141, 66, 0.22);
    font-size: 0.58rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    touch-action: manipulation;
}

@media (max-width: 360px) {
    .transfer-details div {
        grid-template-columns: 1fr;
    }

    .transfer-copy-btn {
        grid-column: 1;
        grid-row: auto;
        width: 100%;
    }
}

.counter-box {
    display: flex;
    flex-direction: column;
    padding: 1rem;
    background: white;
    border-radius: 1.5rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    min-width: 0;
    min-height: 86px;
}

.counter-label {
    font-size: 7px;
    text-transform: uppercase;
    font-weight: 700;
    color: rgb(214 211 209);
    margin-top: 0.25rem;
}

.wa-button {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(12px);
    padding: 1.5rem;
    border-radius: 1.5rem;
    font-weight: 700;
    font-size: 10px;
    letter-spacing: 0.1em;
    border: 1px solid rgba(255, 255, 255, 0.1);
    text-transform: uppercase;
    transition: background 0.2s ease;
}

.wa-button:hover { background: rgba(255, 255, 255, 0.1); }

.editable[contenteditable="true"] {
    outline: 1px dashed rgba(178, 141, 66, 0.45);
    outline-offset: 4px;
}

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

.reveal { animation: fadeIn 0.8s ease forwards; }

@media (max-width: 380px) {
    .hero-frame { border-width: 8px; border-radius: 20px; }
    .mobile-nav { width: calc(100% - 1rem); }
    .mobile-nav-link { font-size: 8px; }
    .counter-box { padding: 0.75rem 0.45rem; }
    #days, #hours, #minutes, #seconds { font-size: 1.55rem; }
}

@media (min-width: 768px) {
    body { padding-bottom: 0; }
    .mobile-nav { display: none; }
    #toast { bottom: 2rem; }
    .admin-settings-panel { border-radius: 28px; }
    .admin-grid-2 { grid-template-columns: 1fr 1fr; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    body.intro-lock { overflow: auto; }
    .invitation-intro { display: none; }
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
