/* =========================================================
   BODA — estilos
   Paleta: crema, beige, verde oliva suave, blanco roto, dorado
   ========================================================= */

:root {
    --bg: #F7F2E8;
    --bg-soft: #FBF7EE;
    --card: #FFFFFF;
    --border: #E8E1D2;
    --border-soft: #EFE9DC;
    --text: #2A2A2A;
    --text-soft: #4A4A46;
    --muted: #8A847A;
    --olive: #6F7C52;
    --olive-dark: #5A6740;
    --olive-soft: #A8B484;
    --gold: #C4A574;
    --heart: #C97A6A;
    --shadow-sm: 0 1px 2px rgba(80, 70, 50, .04);
    --shadow-md: 0 6px 24px rgba(80, 70, 50, .07);
    --shadow-lg: 0 18px 60px rgba(40, 35, 25, .18);

    --font-display: 'Cormorant Garamond', 'Times New Roman', serif;
    --font-body: 'Inter', system-ui, -apple-system, sans-serif;

    --r-sm: 10px;
    --r-md: 14px;
    --r-lg: 18px;
    --r-xl: 26px;
}

* { box-sizing: border-box; }
*::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    padding: 0;
    background:
        radial-gradient(1200px 600px at 50% -200px, #F1EAD9 0%, transparent 60%),
        var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    min-height: 100vh;
    overflow-x: hidden;
}

button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
img, video { display: block; max-width: 100%; }
input, select, textarea { font-family: inherit; }

/* === Contenedor === */
.app {
    max-width: 720px;
    margin: 0 auto;
    padding: 0 18px 80px;
    position: relative;
}

/* === Header === */
.header {
    position: relative;
    padding: 56px 16px 28px;
    text-align: center;
    isolation: isolate;
}
.header__inner { position: relative; z-index: 1; }

.leaves {
    position: absolute;
    top: 32px;
    height: 200px;
    width: auto;
    z-index: 0;
    opacity: .85;
    pointer-events: none;
}
.leaves--left { left: -8px; transform: scale(.95); }
.leaves--right { right: -8px; transform: scale(.95); }

.header__heart {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
}

.header__kicker {
    margin: 0 0 10px;
    color: var(--muted);
    font-size: 11px;
    letter-spacing: .42em;
    text-transform: uppercase;
    font-weight: 500;
}

.header__names {
    margin: 0;
    font-family: var(--font-display);
    font-style: italic;
    font-weight: 500;
    font-size: clamp(48px, 13vw, 76px);
    line-height: 1;
    color: var(--text);
    letter-spacing: -0.005em;
}
.header__names .amp {
    font-style: italic;
    font-weight: 400;
    color: var(--olive);
    margin: 0 .12em;
}

.header__date {
    margin: 18px 0 0;
    font-size: 12px;
    letter-spacing: .32em;
    color: var(--muted);
    text-transform: uppercase;
    font-weight: 500;
}
.header__countdown {
    margin: 14px 0 0;
    font-family: var(--font-display);
    font-style: italic;
    font-size: 17px;
    color: var(--olive-dark);
}
.header__countdown strong {
    font-style: normal;
    font-weight: 600;
    color: var(--olive);
    margin: 0 2px;
}

/* === Section title === */
.section-title { text-align: center; margin: 22px 0 18px; }
.section-title__flourish,
.section-title__heart {
    display: block;
    margin: 0 auto 6px;
    width: 60px;
    height: 16px;
}
.section-title__heart { width: 30px; height: 22px; }
.section-title h2 {
    margin: 0;
    font-family: var(--font-display);
    font-weight: 500;
    font-size: clamp(24px, 6.4vw, 30px);
    color: var(--text);
    letter-spacing: 0;
}
.section-title p {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 14px;
}

/* === Upload form === */
.upload-form {
    display: grid;
    gap: 10px;
    margin: 6px 0 14px;
    background: var(--card);
    border: 1px solid var(--border-soft);
    border-radius: var(--r-lg);
    padding: 14px 14px 16px;
    box-shadow: var(--shadow-sm);
}
.field { display: grid; gap: 6px; }
.field__label {
    font-size: 11.5px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .12em;
    font-weight: 500;
}
.field__opt { text-transform: none; letter-spacing: 0; opacity: .7; }
.field input[type="text"], .field select {
    width: 100%;
    padding: 11px 13px;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-size: 16px;                 /* 16px evita el auto-zoom de iOS Safari */
    outline: 0;
    transition: border-color .2s, background .2s;
    -webkit-appearance: none;
    appearance: none;
}
.field input:focus, .field select:focus {
    border-color: var(--olive-soft);
    background: #fff;
}
.field__select-wrap {
    position: relative;
}
.field__select-wrap svg {
    position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
    pointer-events: none;
}
.field select {
    padding-right: 36px;
    background-image: none;
    cursor: pointer;
}

/* === Dropzone === */
.dropzone {
    position: relative;
    margin-top: 10px;
    padding: 28px 22px 22px;
    background: var(--card);
    border-radius: var(--r-xl);
    border: 1.5px dashed #D9D2BF;
    text-align: center;
    box-shadow: var(--shadow-sm);
    transition: border-color .25s ease, transform .25s ease, box-shadow .25s ease, background .25s ease;
}
.dropzone.is-dragover {
    border-color: var(--olive);
    background: #FAF8F1;
    transform: scale(1.005);
    box-shadow: var(--shadow-md);
}
.dropzone__icon {
    display: inline-flex;
    width: 64px; height: 64px;
    align-items: center; justify-content: center;
    border-radius: 50%;
    background: #F4EFE0;
    margin-bottom: 14px;
}
.dropzone__title {
    margin: 0 0 4px;
    font-weight: 500;
    color: var(--text);
    font-size: 16px;
}
.dropzone__hint {
    margin: 0 0 18px;
    color: var(--muted);
    font-size: 13.5px;
}
.dropzone__multi {
    margin: 14px 0 0;
    color: var(--muted);
    font-size: 12.5px;
}

/* === Botón === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 13px 22px;
    border-radius: 12px;
    font-weight: 500;
    font-size: 14.5px;
    letter-spacing: .01em;
    cursor: pointer;
    user-select: none;
    transition: transform .15s ease, background .2s ease, box-shadow .2s ease;
    -webkit-tap-highlight-color: transparent;
}
.btn--primary {
    background: var(--olive);
    color: #FBFAF4;
    box-shadow: 0 1px 0 rgba(255,255,255,.4) inset, 0 6px 16px rgba(111, 124, 82, .25);
}
.btn--primary:hover { background: var(--olive-dark); }
.btn--primary:active { transform: translateY(1px); }
.btn--block { width: 100%; padding: 14px 22px; }

/* === Queue / progreso === */
.queue {
    margin-top: 14px;
    display: grid;
    gap: 10px;
}
.queue__item {
    background: var(--card);
    border: 1px solid var(--border-soft);
    border-radius: var(--r-md);
    padding: 10px 12px;
    display: grid;
    grid-template-columns: 44px 1fr auto;
    gap: 12px;
    align-items: center;
    box-shadow: var(--shadow-sm);
    animation: fadeUp .35s ease both;
}
.queue__thumb {
    width: 44px; height: 44px;
    border-radius: 8px;
    background: #F0EADB center/cover no-repeat;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}
.queue__thumb--video::after {
    content: "";
    position: absolute; inset: 0;
    background: rgba(0,0,0,.18);
}
.queue__meta { min-width: 0; }
.queue__name {
    font-size: 13px;
    color: var(--text);
    margin: 0 0 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
}
.queue__bar {
    height: 5px;
    background: #EDE6D5;
    border-radius: 99px;
    overflow: hidden;
}
.queue__fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--olive-soft), var(--olive));
    transition: width .2s ease;
    border-radius: 99px;
}
.queue__status {
    font-size: 11.5px;
    color: var(--muted);
    min-width: 54px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}
.queue__item.is-done .queue__fill { background: var(--olive); }
.queue__item.is-done .queue__status { color: var(--olive); }
.queue__item.is-error .queue__fill { background: #C97A6A; width: 100% !important; }
.queue__item.is-error .queue__status { color: #C97A6A; }
.queue__retry {
    margin-top: 4px;
    font-size: 11.5px;
    color: var(--olive);
    text-decoration: underline;
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
}

/* === Toast === */
.toast {
    margin: 14px auto 0;
    padding: 12px 18px;
    background: #F1EFE6;
    color: var(--olive-dark);
    border: 1px solid #DCD6C4;
    border-radius: 999px;
    font-size: 13.5px;
    font-weight: 500;
    text-align: center;
    max-width: max-content;
    animation: fadeUp .4s ease both;
}

/* === Tabs álbumes === */
.tabs {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 4px 2px 10px;
    margin: 0 -18px 12px;
    padding-left: 18px;
    padding-right: 18px;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
    flex-shrink: 0;
    padding: 8px 16px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text-soft);
    cursor: pointer;
    transition: all .2s ease;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
}
.tab:hover { background: var(--bg-soft); }
.tab.is-active {
    background: var(--olive);
    color: #fff;
    border-color: var(--olive);
    box-shadow: 0 4px 12px rgba(111,124,82,.2);
}

/* === Gallery (grid cuadrado tipo Instagram, pensado para cientos de fotos) === */
.gallery-wrap { margin-top: 28px; }
.gallery {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
}
@media (min-width: 480px) { .gallery { grid-template-columns: repeat(4, 1fr); gap: 5px; } }
@media (min-width: 900px) { .gallery { grid-template-columns: repeat(5, 1fr); gap: 6px; } }
@media (min-width: 1100px) { .gallery { grid-template-columns: repeat(6, 1fr); gap: 8px; } }

.card {
    margin: 0;
    position: relative;
    padding-top: 100%;      /* cuadrado sin depender de aspect-ratio */
    border-radius: 8px;
    overflow: hidden;
    cursor: zoom-in;
    background: #EFE9DC;
    box-shadow: var(--shadow-sm);
    transition: transform .35s ease, box-shadow .35s ease, opacity .35s ease;
    animation: fadeIn .5s ease both;
}
.card.is-hidden { display: none; }
.card:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.card img, .card video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: opacity .4s ease;
}
.card video { background: #1c1c1c; }
.card__play {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}
.card__play svg {
    width: 44px; height: 44px;
    padding: 10px;
    border-radius: 50%;
    background: rgba(0,0,0,.4);
    backdrop-filter: blur(4px);
}

.card__heart {
    position: absolute;
    bottom: 4px; right: 4px;
    z-index: 3;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    min-width: 26px;
    min-height: 22px;
    padding: 4px 7px;
    background: rgba(0, 0, 0, .38);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: 999px;
    color: #fff;
    font-size: 10.5px;
    font-weight: 600;
    cursor: pointer;
    transition: background .2s, transform .15s;
    -webkit-tap-highlight-color: transparent;
}
.card__heart svg { fill: #fff; transition: fill .25s, transform .25s; }
.card__heart:hover { background: rgba(0,0,0,.55); }
.card__heart:active { transform: scale(.92); }
.card__heart.is-liked svg { fill: var(--heart); animation: heartPop .35s ease; }
.card__heart-count:empty { display: none; }
.card__heart.is-liked .card__heart-count { color: #fff; }

.card__guest {
    position: absolute;
    top: 4px; left: 4px;
    z-index: 3;
    padding: 2px 7px;
    background: rgba(255,255,255,.88);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    color: var(--olive-dark);
    font-size: 10px;
    font-weight: 500;
    letter-spacing: .01em;
    border-radius: 999px;
    max-width: calc(100% - 8px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: var(--muted);
    background: var(--card);
    border: 1px dashed var(--border);
    border-radius: var(--r-lg);
}
.empty p { margin: 0; }
.empty__hint { font-size: 13px; margin-top: 6px !important; }

/* === Guestbook === */
.block { margin-top: 40px; }
.card-form {
    display: grid;
    gap: 10px;
    background: var(--card);
    border: 1px solid var(--border-soft);
    border-radius: var(--r-lg);
    padding: 16px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 14px;
}
.card-form input, .card-form textarea {
    width: 100%;
    padding: 11px 13px;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-size: 16px;                 /* 16px evita el auto-zoom de iOS Safari */
    outline: 0;
    transition: border-color .2s, background .2s;
}
.card-form textarea {
    resize: vertical;
    min-height: 84px;
    font-family: inherit;
    line-height: 1.5;
}
.card-form input:focus, .card-form textarea:focus {
    border-color: var(--olive-soft);
    background: #fff;
}

.messages { display: grid; gap: 10px; }
.message {
    background: var(--card);
    border: 1px solid var(--border-soft);
    border-radius: var(--r-md);
    padding: 14px 16px;
    box-shadow: var(--shadow-sm);
    animation: fadeUp .4s ease both;
}
.message__text {
    margin: 0 0 8px;
    color: var(--text);
    font-family: var(--font-display);
    font-style: italic;
    font-size: 17px;
    line-height: 1.5;
}
.message__by {
    margin: 0;
    font-size: 12px;
    color: var(--muted);
    letter-spacing: .08em;
    text-transform: uppercase;
}

.muted-center {
    text-align: center;
    color: var(--muted);
    font-size: 13.5px;
    padding: 12px;
    margin: 0;
}

/* === Footer === */
.footer {
    margin-top: 56px;
    text-align: center;
    padding: 28px 16px 24px;
}
.footer__line {
    display: block;
    width: 40px;
    height: 1px;
    background: var(--olive-soft);
    margin: 0 auto 18px;
}
.footer__msg {
    margin: 0;
    font-family: var(--font-display);
    font-style: italic;
    font-size: 22px;
    color: var(--text);
}
.footer__couple {
    margin: 12px 0 0;
    font-size: 10.5px;
    letter-spacing: .4em;
    text-transform: uppercase;
    color: var(--muted);
}

/* === Modal === */
.modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(20, 18, 14, .9);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    padding: 24px;
    animation: modalIn .25s ease;
    overscroll-behavior: contain;
    touch-action: pan-y;
}
.modal[hidden] { display: none; }
.modal__inner {
    max-width: min(1100px, 96vw);
    max-height: 88vh;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: zoomIn .3s ease;
    user-select: none;
    -webkit-user-select: none;
}
.modal__inner img, .modal__inner video {
    max-width: 100%;
    max-height: 88vh;
    width: auto;
    height: auto;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    object-fit: contain;
    pointer-events: none;
}
.modal__inner video { pointer-events: auto; }
.modal__close, .modal__nav {
    position: absolute;
    width: 48px; height: 48px;
    border-radius: 50%;
    background: rgba(255,255,255,.12);
    color: #fff;
    font-size: 28px;
    line-height: 1;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: background .2s ease, transform .15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}
.modal__close { top: 16px; right: 18px; width: 44px; height: 44px; }
.modal__close:hover, .modal__nav:hover { background: rgba(255,255,255,.22); }
.modal__close:active, .modal__nav:active { transform: scale(.95); }
.modal__nav { top: 50%; transform: translateY(-50%); font-size: 36px; font-family: var(--font-display); }
.modal__nav:active { transform: translateY(-50%) scale(.95); }
.modal__nav--prev { left: 18px; }
.modal__nav--next { right: 18px; }
.modal__nav[disabled] { opacity: .25; pointer-events: none; }
.modal__caption {
    position: absolute;
    bottom: 18px; left: 0; right: 0;
    text-align: center;
    color: rgba(255,255,255,.8);
    font-size: 12.5px;
    letter-spacing: .05em;
    pointer-events: none;
    text-shadow: 0 1px 6px rgba(0,0,0,.5);
}

/* === Animaciones === */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes modalIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes zoomIn {
    from { opacity: 0; transform: scale(.96); }
    to   { opacity: 1; transform: scale(1); }
}
@keyframes heartPop {
    0%   { transform: scale(1); }
    35%  { transform: scale(1.5); }
    100% { transform: scale(1); }
}

/* === Móvil === */
@media (max-width: 480px) {
    .app { padding: 0 14px 60px; }
    .header { padding: 44px 8px 18px; }
    .leaves { height: 170px; top: 28px; }
    .leaves--left { left: -16px; }
    .leaves--right { right: -16px; }
    .header__names { font-size: 56px; }
    .dropzone { padding: 24px 16px 18px; }
    .section-title { margin: 18px 0 14px; }
    .btn { padding: 13px 20px; }
    .footer__msg { font-size: 19px; }
    .tabs { margin: 0 -14px 12px; padding-left: 14px; padding-right: 14px; }
    .modal { padding: 12px; }
    .modal__nav { width: 42px; height: 42px; font-size: 30px; }
    .modal__nav--prev { left: 10px; }
    .modal__nav--next { right: 10px; }
}

@media (max-width: 360px) {
    .leaves { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
