/* ==========================================
   CUNÉGONDE - Site de naissance
   Pastel doux, joyeux, familial
   ========================================== */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,700;1,400&family=Nunito:wght@300;400;600;700;800&display=swap');

:root {
    --pink:      #f9a8c9;
    --pink-dark: #e8789f;
    --peach:     #ffd6b3;
    --mint:      #b3e8d8;
    --lilac:     #d4b3f0;
    --yellow:    #ffe59e;
    --sky:       #b3d9f7;
    --cream:     #fff9f5;
    --text:      #4a3540;
    --text-light:#9b7e8a;
    --white:     #ffffff;

    /* États du budget */
    --budget-broke:  #ff8fa3;
    --budget-tight:  #ffb347;
    --budget-ok:     #77dd77;
    --budget-jackpot:#ffd700;
}

* { margin:0; padding:0; box-sizing:border-box; }

body {
    font-family: 'Nunito', sans-serif;
    background: var(--cream);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ── Particules flottantes ─────────────── */
#particles {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 0;
}

/* ── Hero section ──────────────────────── */
.hero {
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem 6rem;
    background: linear-gradient(160deg, #fff0f7 0%, #fce8f3 30%, #f0f0ff 70%, #e8f5ff 100%);
    text-align: center;
    z-index: 1;
}

.hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 20% 20%, rgba(249,168,201,0.25) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(179,217,247,0.25) 0%, transparent 50%),
        radial-gradient(circle at 60% 10%, rgba(212,179,240,0.2) 0%, transparent 40%);
    pointer-events: none;
}

/* ── Echo photo ────────────────────────── */
.echo-wrapper {
    position: relative;
    margin-bottom: 2rem;
}

.echo-ring {
    width: 220px;
    height: 220px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--pink), var(--lilac), var(--sky));
    padding: 5px;
    box-shadow:
        0 0 0 8px rgba(249,168,201,0.2),
        0 0 0 16px rgba(249,168,201,0.1),
        0 20px 60px rgba(232,120,159,0.3);
    animation: float 4s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0) rotate(-1deg); }
    50%       { transform: translateY(-18px) rotate(1deg); }
}

.echo-ring img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    display: none;
}

.echo-ring img.loaded { display: block; }

.echo-placeholder {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: rgba(255,255,255,0.6);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 3rem;
    color: var(--text-light);
    font-family: 'Playfair Display', serif;
    font-style: italic;
    font-size: 0.9rem;
    text-align: center;
    padding: 1.5rem;
    line-height: 1.6;
}

.echo-placeholder .echo-emoji {
    font-size: 3rem;
    font-style: normal;
}

@keyframes wiggle {
    0%, 100% { transform: rotate(-5deg); }
    50%       { transform: rotate(5deg); }
}

/* ── Titre ─────────────────────────────── */
.title-main {
    font-family: 'Playfair Display', serif;
    font-size: clamp(2.5rem, 8vw, 4.5rem);
    font-weight: 700;
    color: var(--text);
    line-height: 1.1;
    margin-bottom: 0.5rem;
}

.title-main em {
    font-style: italic;
    color: var(--pink-dark);
}

.subtitle {
    font-size: clamp(0.9rem, 2.5vw, 1.1rem);
    color: var(--text-light);
    font-weight: 400;
    margin-bottom: 2.5rem;
    letter-spacing: 0.02em;
}

/* ── Countdown ─────────────────────────── */
.countdown-strip {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
}

.time-block {
    background: white;
    border-radius: 20px;
    padding: 1.25rem 1.5rem;
    min-width: 90px;
    box-shadow:
        0 4px 20px rgba(232,120,159,0.15),
        0 1px 3px rgba(0,0,0,0.05);
    border: 2px solid rgba(249,168,201,0.3);
    position: relative;
    overflow: hidden;
    transition: transform 0.2s ease;
}

.time-block::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--pink), var(--lilac));
}

.time-block:hover { transform: translateY(-4px); }

.time-block .value {
    display: block;
    font-size: clamp(2rem, 5vw, 2.8rem);
    font-weight: 800;
    color: var(--pink-dark);
    line-height: 1;
    margin-bottom: 0.35rem;
    font-family: 'Nunito', sans-serif;
    transition: transform 0.2s ease;
}

.time-block .label {
    display: block;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--text-light);
    font-weight: 700;
}

.due-date-note {
    font-size: 0.85rem;
    color: var(--text-light);
    font-style: italic;
    margin-bottom: 2rem;
}

/* ── Séparateur ────────────────────────── */
.section-divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 3rem 2rem 2rem;
    max-width: 700px;
    margin: 0 auto;
}

.section-divider::before,
.section-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(232,120,159,0.4), transparent);
}

.section-divider span {
    font-family: 'Playfair Display', serif;
    font-size: 1.3rem;
    color: var(--pink-dark);
    white-space: nowrap;
    font-style: italic;
}

/* ── Section cards ─────────────────────── */
.cards-section {
    position: relative;
    z-index: 1;
    padding: 0 0 4rem;
}

.cards-intro {
    text-align: center;
    padding: 0 1.5rem;
    margin-bottom: 2rem;
}

.cards-intro h2 {
    font-family: 'Playfair Display', serif;
    font-size: clamp(1.5rem, 4vw, 2.2rem);
    color: var(--text);
    margin-bottom: 0.5rem;
}

.cards-intro p {
    color: var(--text-light);
    font-size: 0.95rem;
    line-height: 1.6;
}

/* ── Scroll horizontal ─────────────────── */
.cards-scroll-hint {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.78rem;
    color: var(--text-light);
    margin-bottom: 1.25rem;
    animation: pulse 2.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.5; }
    50%       { opacity: 1; }
}

.cards-track-wrapper {
    overflow-x: auto;
    overflow-y: visible;
    padding: 1.5rem 1.5rem 2rem 1.5rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    cursor: grab;
}

.cards-track-wrapper:active { cursor: grabbing; }
.cards-track-wrapper::-webkit-scrollbar { display: none; }

.cards-track {
    display: flex;
    gap: 1rem;
    width: max-content;
    padding: 0.5rem 2rem 0.5rem 0.5rem;
}

/* ── Séparateur de mois ────────────────── */
.month-separator {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 32px;
    flex-shrink: 0;
    gap: 0.5rem;
}

.month-separator .month-line {
    width: 1px;
    flex: 1;
    min-height: 40px;
    background: linear-gradient(to bottom, transparent, rgba(232,120,159,0.3), transparent);
}

.month-separator .month-label {
    font-family: 'Playfair Display', serif;
    font-size: 0.75rem;
    font-style: italic;
    color: var(--pink-dark);
    writing-mode: vertical-rl;
    text-orientation: mixed;
    letter-spacing: 2px;
    opacity: 0.7;
}

/* ── Flip card ─────────────────────────── */
.flip-card {
    width: 200px;
    height: 300px;
    flex-shrink: 0;
    perspective: 900px;
    cursor: pointer;
}

.flip-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transition: transform 0.55s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 18px;
}

.flip-card.flipped .flip-card-inner {
    transform: rotateY(180deg);
}

.flip-card-front,
.flip-card-back {
    position: absolute;
    inset: 0;
    border-radius: 18px;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 0.5rem;
    box-shadow:
        0 4px 20px rgba(0,0,0,0.08),
        0 1px 4px rgba(0,0,0,0.04);
}

/* Recto */
.flip-card-front {
    background: white;
    border: 2px solid rgba(249,168,201,0.25);
    gap: 0.4rem;
}

.flip-card-front .card-day-num {
    font-size: 2.2rem;
    font-weight: 800;
    line-height: 1;
    color: var(--text);
}

.flip-card-front .card-month {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--text-light);
    font-weight: 700;
}

.flip-card-front .card-hint-emoji {
    font-size: 1.3rem;
    margin-top: 0.3rem;
}

.flip-card-front .card-zone-bar {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 5px;
    border-radius: 0 0 16px 16px;
}

/* Zones — couleur de la barre basse */
.flip-card.zone-broke  .flip-card-front { border-color: rgba(255,143,163,0.4); }
.flip-card.zone-broke  .card-zone-bar   { background: linear-gradient(90deg, #ff8fa3, #ffb3c1); }
.flip-card.zone-broke  .card-day-num    { color: #e8789f; }

.flip-card.zone-tight  .flip-card-front { border-color: rgba(255,179,71,0.4); }
.flip-card.zone-tight  .card-zone-bar   { background: linear-gradient(90deg, #ffb347, #ffd180); }
.flip-card.zone-tight  .card-day-num    { color: #cc8a00; }

.flip-card.zone-ok     .flip-card-front { border-color: rgba(119,221,119,0.4); }
.flip-card.zone-ok     .card-zone-bar   { background: linear-gradient(90deg, #77dd77, #aaeebb); }
.flip-card.zone-ok     .card-day-num    { color: #3a9a3a; }

.flip-card.zone-jackpot .flip-card-front { border-color: rgba(255,215,0,0.5); }
.flip-card.zone-jackpot .card-zone-bar  { background: linear-gradient(90deg, #ffd700, #ffe97a); }
.flip-card.zone-jackpot .card-day-num   { color: #b38a00; }

.flip-card.zone-jackpot .flip-card-front {
    background: linear-gradient(160deg, #fffdf0, #fff8d0);
}

/* Verso */
.flip-card-back {
    background: white;
    transform: rotateY(180deg);
    gap: 0.4rem;
    text-align: center;
    justify-content: flex-start;
    padding: 1rem 0.6rem 0.75rem;
    overflow: hidden;
}

.flip-card.zone-broke  .flip-card-back { background: linear-gradient(160deg, #fff5f7, #ffe8ed); }
.flip-card.zone-tight  .flip-card-back { background: linear-gradient(160deg, #fffbf0, #fff3d6); }
.flip-card.zone-ok     .flip-card-back { background: linear-gradient(160deg, #f5fff5, #e8f8e8); }
.flip-card.zone-jackpot .flip-card-back { background: linear-gradient(160deg, #fffdf0, #fff8d0); }

.back-emoji {
    font-size: 1.8rem;
    line-height: 1;
    flex-shrink: 0;
}

.back-budget {
    font-size: 1.3rem;
    font-weight: 800;
    line-height: 1;
    color: var(--text);
}

.back-label {
    font-size: 0.55rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-light);
    font-weight: 700;
    line-height: 1.2;
    text-align: center;
}

.back-msg {
    font-size: 0.62rem;
    color: var(--text-light);
    line-height: 1.45;
    text-align: center;
    margin-top: 0.3rem;
    overflow: auto;
}

.back-msg strong { color: var(--text); }

.back-divider {
    width: 30px;
    height: 1px;
    background: rgba(0,0,0,0.1);
    flex-shrink: 0;
}

/* Hover effet sur recto */
.flip-card:not(.flipped) .flip-card-front {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.flip-card:not(.flipped):hover .flip-card-front {
    transform: translateY(-4px);
    box-shadow:
        0 12px 32px rgba(232,120,159,0.2),
        0 2px 8px rgba(0,0,0,0.06);
}

/* ── Légende ────────────────────────────── */
.cards-legend {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
    padding: 0 1.5rem;
    margin-top: 0.5rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.75rem;
    color: var(--text-light);
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 3px;
    flex-shrink: 0;
}

.legend-dot.broke   { background: #ff8fa3; }
.legend-dot.tight   { background: #ffb347; }
.legend-dot.ok      { background: #77dd77; }
.legend-dot.jackpot { background: #ffd700; }

/* Profils anniversaire (dans le verso des cartes spéciales) */
.back-bday-faces {
    display: flex;
    gap: 3px;
    justify-content: center;
    margin-top: 0.2rem;
}

.back-bday-face {
    font-size: 1.1rem;
}

/* ── Footer ─────────────────────────────── */
footer {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 2rem 1rem 3rem;
    color: var(--text-light);
    font-size: 0.8rem;
    line-height: 1.8;
}

footer .heart { color: var(--pink-dark); }

/* ── Responsive ─────────────────────────── */
@media (max-width: 540px) {
    .hero { padding: 2rem 0.75rem 4rem; }

    .echo-ring { width: 180px; height: 180px; }

    .countdown-strip { gap: 0.6rem; }
    .time-block { min-width: 72px; padding: 1rem; border-radius: 16px; }
    .time-block .value { font-size: 1.8rem; }

    .calendar-grid-wrapper { padding: 1.25rem; border-radius: 20px; }
    .cal-day { border-radius: 8px; font-size: 0.82rem; min-height: 38px; }
    .cal-day .day-emoji { font-size: 0.65rem; }

    .result-card { padding: 1.5rem 1rem; }
    .birthday-profiles { gap: 0.75rem; }
    .bday-avatar { width: 52px; height: 52px; font-size: 1.4rem; }

    .calendar-legend { gap: 0.6rem; }
}

@media (max-width: 380px) {
    .cal-days { gap: 4px; }
    .cal-day { min-height: 34px; font-size: 0.78rem; }
    .time-block { min-width: 60px; padding: 0.8rem 0.5rem; }
}

/* ── Bulle photo anniversaire ──────────── */
.bday-bubble {
    position: fixed;
    z-index: 9999;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
    opacity: 0;
    transform: scale(0.85);
}

.bday-bubble.visible {
    opacity: 1;
    transform: scale(1);
}

.bday-bubble-inner {
    background: white;
    border-radius: 20px;
    padding: 0.75rem;
    box-shadow: 0 12px 40px rgba(0,0,0,0.15), 0 2px 8px rgba(0,0,0,0.08);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    width: 180px;
}

.bday-bubble-inner::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    border: 10px solid transparent;
    border-top-color: white;
    border-bottom: none;
}

.bday-bubble img {
    width: 130px;
    height: 130px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--pink);
}

.bday-bubble .bubble-emoji-fallback {
    width: 130px;
    height: 130px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--pink), var(--lilac));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
}

.bday-bubble .bubble-name {
    font-size: 0.85rem;
    font-weight: 800;
    color: var(--text);
}

.bday-bubble .bubble-date {
    font-size: 0.7rem;
    color: var(--text-light);
}