/* ════════════════════════════════════════════════
   FELIZ DÍA DE LA MADRE — Diseño editorial refinado
   Paleta: crema marfil / verde musgo / dorado envejecido
   ════════════════════════════════════════════════ */

/* ── Tokens ──────────────────────────────────── */
:root {
    --crema:       #f5f0e8;
    --crema-oscura:#ede6d6;
    --marfil:      #faf7f2;
    --verde:       #3d5a47;
    --verde-claro: #5a7a63;
    --dorado:      #b8976a;
    --dorado-claro:#d4b896;
    --dorado-suave:#e8d9c4;
    --texto:       #2c2218;
    --texto-suave: #6b5b4e;
    --sombra:      rgba(44, 34, 24, 0.18);
}

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

/* ── Body ────────────────────────────────────── */
body {
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--verde);
    background-image: url('img/fondo.png');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    font-family: 'Cormorant Garamond', 'Georgia', serif;
    overflow-x: hidden;
    position: relative;
}

/* ── Pantalla final ──────────────────────────── */
.fin-screen {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    z-index: 20;
    transition: opacity 1.2s ease;
}

.fin-screen.visible {
    opacity: 1;
    pointer-events: auto;
}

.fin-objetos {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 90%;
}

#confettiCanvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 21;
}

/* ── Grano de papel ──────────────────────────── */
.grain {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    opacity: 0.035;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    background-size: 180px 180px;
}

/* ── Escena principal ────────────────────────── */
.scene {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 20px;
    min-height: 100dvh;
}

/* ════════════════════════════════════════════════
   SOBRE
   ════════════════════════════════════════════════ */
.sobre-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 32px;
    transition: opacity 0.5s ease, transform 0.5s ease;
    margin-top: 0;
}

.sobre-wrapper.cerrar {
    opacity: 0;
    transform: translateY(-12px) scale(0.96);
    pointer-events: none;
}

/* Etiqueta "Para Mamá" */
.etiqueta {
    display: flex;
    align-items: center;
    gap: 14px;
    color: #6b1a2a;
    letter-spacing: 0.25em;
    font-family: 'Cinzel', serif;
    font-size: 1rem;
    font-weight: 800;
    text-transform: uppercase;
    text-shadow: 0 1px 3px rgba(255,255,255,0.5);
}

.etiqueta-linea {
    display: block;
    width: 40px;
    height: 1px;
    background: #6b1a2a;
    opacity: 0.5;
}

/* Sobre */
.sobre-container {
    position: relative;
}

.sobre {
    position: relative;
    width: 300px;
    height: 210px;
    cursor: pointer;
    filter: drop-shadow(0 20px 40px rgba(0,0,0,0.4));
    transition: transform 0.25s ease, filter 0.25s ease;
}

.sobre {
    animation: pulseSobre 2.2s ease-in-out infinite;
}

.sobre:hover {
    animation: none;
    transform: translateY(-5px);
    filter: drop-shadow(0 28px 50px rgba(0,0,0,0.5));
}

.sobre:active {
    animation: none;
    transform: translateY(0px);
}

@keyframes pulseSobre {
    0%, 100% { transform: translateY(0px) scale(1);    filter: drop-shadow(0 20px 40px rgba(0,0,0,0.4)); }
    50%       { transform: translateY(-6px) scale(1.03); filter: drop-shadow(0 28px 50px rgba(0,0,0,0.5)); }
}

/* Cuerpo del sobre */
.sobre-cuerpo {
    position: absolute;
    inset: 0;
    border-radius: 4px;
    background: var(--crema);
    overflow: hidden;
}

.sobre-cuerpo::before {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 50%;
    background: var(--dorado-suave);
    clip-path: polygon(0 100%, 50% 0%, 100% 100%);
}

.sobre-v-izq, .sobre-v-der, .sobre-base { display: none; }

/* Sello central */
.sobre-sello {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 4;
}

.sello-img {
    width: 86px;
    height: 86px;
    object-fit: contain;
    border-radius: 50%;
    background: white;
    padding: 8px;
    border: 1.5px solid var(--dorado-claro);
    box-shadow: 0 4px 16px var(--sombra);
    animation: pulseSello 3s ease-in-out infinite;
}

@keyframes pulseSello {
    0%, 100% { transform: scale(1); }
    50%       { transform: scale(1.04); }
}

/* Solapa superior */
.sobre-flap {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 55%;
    z-index: 3;
    transform-origin: top center;
    transition: transform 0.75s cubic-bezier(0.4, 0, 0.2, 1);
    perspective: 800px;
}

.sobre-flap-inner {
    position: absolute;
    inset: 0;
    clip-path: polygon(0 0, 100% 0, 50% 100%);
    border-radius: 4px 4px 0 0;
    background: linear-gradient(160deg, var(--crema) 0%, var(--dorado-suave) 100%);
}

.sobre.abierto .sobre-flap {
    transform: perspective(800px) rotateX(-178deg);
}

/* Hint */
.sobre-hint {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-weight: 800;
    font-size: 1.45rem;
    color: #6b1a2a;
    letter-spacing: 0.04em;
    text-shadow: 0 1px 3px rgba(255,255,255,0.5);
    animation: pulsar 2.5s ease-in-out infinite;
}

.hint-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #6b1a2a;
    animation: parpadeoDot 2.5s ease-in-out infinite;
}

@keyframes parpadeoDot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: 0.3; transform: scale(0.5); }
}

@keyframes pulsar {
    0%, 100% { opacity: 0.9; }
    50%       { opacity: 0.4; }
}

/* ════════════════════════════════════════════════
   TARJETA
   ════════════════════════════════════════════════ */
.card {
    position: relative;
    background: var(--marfil);
    border-radius: 2px;
    padding: 52px 44px 48px;
    width: 100%;
    text-align: center;
    box-shadow:
        0 2px 0 var(--dorado),
        0 -2px 0 var(--dorado),
        0 40px 90px rgba(0,0,0,0.55),
        inset 0 0 0 1px rgba(184,151,106,0.2);
    display: block;
    opacity: 0;
    overflow: visible;
    background-image:
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 27px,
            rgba(184,151,106,0.05) 27px,
            rgba(184,151,106,0.05) 28px
        );
}

/* Wrapper tarjeta */

.card.visible {
    animation: aparecer 0.85s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.card.visible.mostrar {
    opacity: 1;
}

@keyframes aparecer {
    from { opacity: 0; transform: translateY(30px) scale(0.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Orlas decorativas */
.card-orla {
    position: absolute;
    left: 18px;
    right: 18px;
    height: 16px;
    background-image: repeating-linear-gradient(
        90deg,
        var(--dorado) 0px, var(--dorado) 3px,
        transparent 3px, transparent 7px,
        var(--dorado-claro) 7px, var(--dorado-claro) 9px,
        transparent 9px, transparent 13px
    );
    opacity: 0.3;
}

.card-orla.top { top: 18px; }
.card-orla.bottom { bottom: 18px; }

/* ── Wrapper tarjeta + imagen flotante ─────── */
.card-wrapper {
    display: none;
    flex-direction: column;
    align-items: center;
    width: 92vw;
    max-width: 400px;
    position: relative;
    margin-top: 0;
}

.card-wrapper.visible {
    display: flex;
    animation: aparecer 0.85s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* ── Header ──────────────────────────────────── */
.card-header {
    margin-bottom: 30px;
}

.card-eyebrow {
    font-family: 'Cinzel', serif;
    font-size: 0.58rem;
    letter-spacing: 0.38em;
    text-transform: uppercase;
    color: var(--dorado);
    margin-bottom: 18px;
}

.title {
    font-family: 'Cormorant Garamond', serif;
    font-size: clamp(2rem, 8vw, 2.9rem);
    font-weight: 300;
    line-height: 1.15;
    color: var(--verde);
    letter-spacing: -0.01em;
}

.title em {
    font-style: italic;
    font-weight: 400;
    color: var(--dorado);
}

.title-ornament {
    margin-top: 18px;
    color: var(--dorado-claro);
    font-size: 0.75rem;
    letter-spacing: 0.5em;
    opacity: 0.7;
}

/* ── Mensaje ──────────────────────────────────── */
.mensaje {
    font-family: 'EB Garamond', 'Cormorant Garamond', serif;
    font-style: italic;
    font-size: 1.1rem;
    line-height: 1.75;
    color: var(--texto-suave);
    margin-bottom: 30px;
    padding: 0 8px;
}

/* ── De parte ─────────────────────────────────── */
.de-parte {
    margin-bottom: 34px;
    padding: 20px 24px;
    border-top: 1px solid var(--dorado-suave);
    border-bottom: 1px solid var(--dorado-suave);
}

.de-parte-label {
    font-family: 'Cinzel', serif;
    font-size: 0.57rem;
    letter-spacing: 0.32em;
    text-transform: uppercase;
    color: var(--dorado);
    margin-bottom: 10px;
}

.nombre-nino {
    display: block;
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.65rem;
    font-weight: 400;
    font-style: italic;
    color: var(--verde);
    line-height: 1.2;
}

/* ── Reproductor ──────────────────────────────── */
.player-section {
    margin-top: 4px;
}

.player-label {
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: 'Cinzel', serif;
    font-size: 0.57rem;
    letter-spacing: 0.32em;
    text-transform: uppercase;
    color: var(--texto-suave);
    margin-bottom: 18px;
    white-space: nowrap;
}

.player-label-linea {
    flex: 1;
    height: 1px;
    background: var(--dorado-suave);
}

.player {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--crema-oscura);
    border-radius: 100px;
    padding: 8px 18px 8px 8px;
    border: 1px solid rgba(184,151,106,0.4);
}

/* Botón play */
.btn-play {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: var(--verde);
    color: var(--crema);
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px rgba(61, 90, 71, 0.45);
    transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
}

.btn-play:hover {
    background: var(--verde-claro);
    box-shadow: 0 6px 20px rgba(61, 90, 71, 0.55);
}

.btn-play:active {
    transform: scale(0.9);
}

.play-svg {
    width: 20px;
    height: 20px;
}

.play-svg.hidden {
    display: none;
}

/* Barra de progreso */
.progress-wrap {
    flex: 1;
    height: 4px;
    background: rgba(184,151,106,0.2);
    border-radius: 99px;
    cursor: pointer;
    position: relative;
}

.progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--verde), var(--dorado));
    border-radius: 99px;
    transition: width 0.25s linear;
}

.progress-thumb {
    position: absolute;
    top: 50%;
    left: 0%;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--verde);
    transform: translate(-50%, -50%) scale(0);
    transition: transform 0.2s ease, left 0.25s linear;
}

.progress-wrap:hover .progress-thumb {
    transform: translate(-50%, -50%) scale(1);
}

/* Tiempo */
.tiempo {
    font-family: 'Cinzel', serif;
    font-size: 0.62rem;
    color: var(--texto-suave);
    min-width: 32px;
    text-align: right;
    letter-spacing: 0.05em;
}

/* ── Error card ──────────────────────────────── */
.error-card {
    padding: 48px 32px;
    text-align: center;
    color: var(--verde);
}

.error-card h2 {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.8rem;
    font-weight: 300;
    margin-bottom: 12px;
}

.error-card p {
    font-size: 1rem;
    color: var(--texto-suave);
    font-style: italic;
    line-height: 1.6;
}
