/* Hommage à Jean-Claude WIPIER — « Entre ciel et mer, à jamais dans nos cœurs » */

:root {
    --or: #d9b36a;
    --or-doux: rgba(217, 179, 106, .55);
    --ambre: #ffb15a;
    --nuit: #070b1f;
    --texte: #f4efe6;
    --texte-doux: #cfd6ea;
    --serif: 'Cormorant', 'Cormorant Garamond', Georgia, serif;
    --main: 'Caveat', 'Segoe Script', 'Brush Script MT', cursive;
}

*{
    box-sizing: border-box;
    scroll-behavior: smooth;
    margin: 0;
    padding: 0;
}

html { background: var(--nuit); }

body{
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: var(--nuit);
    font-family: var(--serif);
    font-size: 1.35rem;
    color: var(--texte);
    position: relative;
    overflow-x: hidden;
}

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ───────────── Décor ───────────── */
#scene {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    background: #060b24 url('../images/fond.webp') center 55% / cover no-repeat;
}

/* Étoiles qui scintillent, uniquement dans la partie haute (le ciel de la photo) */
#stars { position: absolute; inset: 0 0 48% 0; }
.star {
    position: absolute;
    width: var(--s, 2px); height: var(--s, 2px);
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 0 calc(var(--s, 2px) * 2.5) rgba(255, 255, 255, .8);
    opacity: .2;
    animation: twinkle var(--d, 6s) ease-in-out var(--dl, 0s) infinite;
}

/* Voile sombre : garantit la lisibilité des textes quelle que soit la zone du décor */
#veil {
    position: fixed; inset: 0; z-index: 1; pointer-events: none;
    background:
        radial-gradient(ellipse 80% 70% at 50% 42%, rgba(4, 6, 20, .62), rgba(4, 6, 20, .25) 70%, transparent),
        linear-gradient(to bottom, rgba(4, 6, 20, .35), rgba(4, 6, 20, .1) 40%, rgba(4, 6, 20, .3));
}

#particles { position: fixed; inset: 0; pointer-events: none; z-index: 1; }
.particle {
    position: absolute;
    width: 2px; height: 2px;
    background: rgba(255, 236, 200, .45);
    border-radius: 50%;
    animation: float 22s linear infinite;
}

/* ───────────── Contenu ───────────── */
main {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 900px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2.2rem;
    padding: clamp(1.5rem, 5vw, 3.5rem) 1.2rem 3rem;
}

#index-text { width: 100%; text-align: center; }
#index-text > * { opacity: 0; animation: fadeIn 1.4s ease-out var(--delay, 0s) forwards; }

h1 {
    font-weight: 600;
    font-size: clamp(2rem, 5.2vw, 3.2rem);
    letter-spacing: .02em;
    text-shadow: 0 2px 14px rgba(0, 0, 0, .55);
    margin-bottom: .4rem;
}
.date { font-size: clamp(1.25rem, 3vw, 1.55rem); color: var(--or); letter-spacing: .08em; }
.dash { margin: 0 .35em; }

.orn { display: flex; align-items: center; justify-content: center; gap: .8rem; margin: .8rem auto; max-width: 380px; color: var(--or); }
.orn span { flex: 1; height: 1px; background: linear-gradient(to right, transparent, var(--or-doux), transparent); }
.orn i { font-style: normal; font-size: 1rem; text-shadow: 0 0 10px rgba(217, 179, 106, .7); }
.orn.heart i { color: #e8a0a8; text-shadow: 0 0 10px rgba(232, 160, 168, .6); }

.je-taime {
    font-family: var(--main);
    font-weight: 700;
    font-size: clamp(2.2rem, 6vw, 3.3rem);
    line-height: 1.05;
    margin: .2rem 0 .8rem;
    color: #fff;
    text-shadow: 0 0 18px rgba(255, 200, 140, .55), 0 2px 10px rgba(0, 0, 0, .5);
}
.message { font-style: italic; font-size: clamp(1.25rem, 3.4vw, 1.55rem); margin-bottom: .6rem; }
.citation { font-style: italic; color: var(--texte-doux); max-width: 34rem; margin: 0 auto; font-size: clamp(1.3rem, 3.2vw, 1.55rem); }

/* Photographie : cœur de la page */
#index-image { width: 100%; display: flex; justify-content: center; animation: fadeIn 2.4s ease-out both; }
.frame { position: relative; display: inline-block; max-width: 100%; }
.halo {
    position: absolute; inset: -14% -18%;
    background: radial-gradient(ellipse at center, rgba(255, 200, 130, .45), rgba(255, 160, 90, .14) 45%, transparent 70%);
    filter: blur(14px);
    animation: respiration 10s ease-in-out infinite;
    pointer-events: none;
}
.frame > img {
    position: relative;
    display: block;
    max-height: min(74vh, 760px);
    width: auto; height: auto; max-width: 100%;
    border-radius: 18px;
    border: 1px solid var(--or-doux);
    box-shadow: 0 0 0 4px rgba(217, 179, 106, .08), 0 18px 60px rgba(0, 0, 0, .65), 0 0 50px rgba(255, 175, 90, .25);
    object-fit: contain;
}

#souvenir { text-align: center; max-width: 34rem; animation: fadeIn 2.4s ease-out both; }
.phrase { font-style: italic; font-size: clamp(1.25rem, 3.2vw, 1.5rem); line-height: 1.5; margin: .6rem 0 1rem; text-shadow: 0 1px 10px rgba(0, 0, 0, .6); }
.adieu { font-family: var(--main); font-weight: 700; font-size: clamp(1.9rem, 5.4vw, 2.5rem); color: #fff; text-shadow: 0 0 14px rgba(255, 200, 140, .45); }
.annees { color: var(--or); letter-spacing: .18em; margin-top: .4rem; }

/* Boutons */
.actions { display: flex; gap: 1rem; flex-wrap: wrap; justify-content: center; }
.btn {
    font: inherit; font-size: 1.3rem;
    color: #1b1209;
    background: linear-gradient(180deg, #f1d69a, #d9b36a);
    border: 1px solid #f6e3b4;
    border-radius: 999px;
    padding: .7rem 1.7rem;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(217, 179, 106, .25);
    transition: transform .25s ease, box-shadow .25s ease, opacity .25s;
}
.btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 8px 28px rgba(217, 179, 106, .4); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--texte); border-color: var(--or-doux); box-shadow: none; }
button:focus-visible, input:focus-visible, textarea:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }

/* Lecteur */
#player {
    width: min(100%, 560px);
    background: rgba(8, 11, 31, .6);
    border: 1px solid var(--or-doux);
    border-radius: 16px;
    padding: .9rem 1.1rem 1rem;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}
.track { text-align: center; font-size: 1.3rem; margin-bottom: .6rem; }
.track .note { color: var(--or); margin-right: .4rem; }
.track em { color: var(--or); font-style: normal; margin: 0 .2rem; }
.controls { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.round {
    flex: none; width: 46px; height: 46px; border-radius: 50%;
    display: grid; place-items: center;
    background: linear-gradient(180deg, #f1d69a, #d9b36a); border: 0; cursor: pointer;
}
.round svg { width: 22px; height: 22px; fill: #1b1209; }
.round .i-pause { display: none; }
.round.playing .i-play { display: none; }
.round.playing .i-pause { display: block; }
.round.attention { animation: appel 2.4s ease-in-out infinite; }
.time { font-size: 1.1rem; color: var(--texte-doux); min-width: 2.6rem; text-align: center; font-variant-numeric: tabular-nums; }
#seek { flex: 1 1 120px; min-width: 100px; }
.vol { display: flex; align-items: center; gap: .3rem; flex: 0 0 auto; }
.vol svg { width: 20px; height: 20px; fill: var(--or); }
.vol input { width: 80px; }
input[type=range] { accent-color: var(--or); height: 28px; cursor: pointer; }
input[type=range]:disabled { cursor: default; opacity: .6; }
.hint { text-align: center; color: var(--or); font-size: 1rem; margin-top: .5rem; }

/* Message pour Papa */
dialog {
    margin: auto;
    width: min(92vw, 520px);
    border: 1px solid var(--or-doux);
    border-radius: 18px;
    background: rgba(10, 14, 40, .94);
    color: var(--texte);
    padding: 1.5rem 1.4rem 1.3rem;
    box-shadow: 0 20px 80px rgba(0, 0, 0, .7);
}
dialog::backdrop { background: rgba(4, 6, 20, .7); backdrop-filter: blur(3px); }
dialog h2 { font-weight: 600; font-size: 1.7rem; margin-bottom: .4rem; }
dialog .lead { color: var(--texte-doux); font-size: 1.25rem; margin-bottom: .9rem; }
dialog textarea {
    width: 100%; resize: vertical; min-height: 9rem;
    font: inherit; font-size: 1.4rem; line-height: 1.5; color: var(--texte);
    background: rgba(255, 255, 255, .06);
    border: 1px solid var(--or-doux); border-radius: 12px; padding: .8rem .9rem;
}
dialog .row { display: flex; gap: .8rem; justify-content: flex-end; margin-top: .9rem; flex-wrap: wrap; }

#letters { position: fixed; inset: 0; z-index: 90; pointer-events: none; overflow: hidden; }
.letter {
    position: absolute; left: 50%; bottom: 22%;
    width: min(80vw, 420px);
    padding: 1rem 1.2rem;
    background: rgba(255, 244, 220, .93);
    color: #3a2a14;
    font-family: var(--main); font-weight: 700; font-size: 1.4rem; line-height: 1.25;
    border-radius: 6px;
    box-shadow: 0 0 40px rgba(255, 200, 130, .7);
    transform: translateX(-50%);
    max-height: 30vh; overflow: hidden;
    animation: envol 6s cubic-bezier(.3, .1, .3, 1) forwards;
}
.spark {
    position: absolute; width: 5px; height: 5px; border-radius: 50%;
    background: #ffe9b8; box-shadow: 0 0 10px #ffd27a;
    left: var(--x); bottom: var(--y);
    opacity: 0;
    animation: etincelle 5s ease-out var(--dl, 0s) forwards;
}
.sky-note {
    position: fixed; left: 50%; top: 14%; transform: translateX(-50%);
    z-index: 95; max-width: 90vw; text-align: center;
    font-family: var(--main); font-weight: 700; font-size: clamp(1.6rem, 5vw, 2.2rem);
    color: #fff; text-shadow: 0 0 16px rgba(255, 200, 140, .7);
    opacity: 0; pointer-events: none; transition: opacity 1.4s ease;
}
.sky-note.show { opacity: 1; }

/* Animations */
@keyframes fadeIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
@keyframes float { 0% { transform: translateY(100vh); opacity: 0; } 12% { opacity: 1; } 88% { opacity: 1; } 100% { transform: translateY(-100px); opacity: 0; } }
@keyframes twinkle { 0%, 100% { opacity: .18; } 50% { opacity: var(--o, .9); } }
.halo { animation-name: respirationHalo; }
@keyframes respirationHalo { 0%, 100% { opacity: .7; transform: scale(1); } 50% { opacity: 1; transform: scale(1.03); } }
@keyframes appel { 0%, 100% { box-shadow: 0 0 0 0 rgba(217, 179, 106, .6); } 50% { box-shadow: 0 0 0 12px rgba(217, 179, 106, 0); } }
@keyframes envol {
    0% { transform: translateX(-50%) translateY(0) scale(1) rotate(0); opacity: 0; filter: blur(0); }
    8% { opacity: 1; }
    55% { opacity: .9; }
    100% { transform: translateX(-50%) translateY(-95vh) scale(.12) rotate(7deg); opacity: 0; filter: blur(6px); }
}
@keyframes etincelle { 0% { opacity: 0; transform: translateY(0) scale(1); } 15% { opacity: 1; } 100% { opacity: 0; transform: translateY(-80vh) translateX(var(--dx, 0)) scale(.3); } }

/* Mobile : cadrage du décor et boutons empilés */
@media (max-width: 640px) {
    body { font-size: 1.25rem; }
    main { gap: 1.8rem; padding-top: 1.2rem; }
    .frame > img { max-height: 66vh; }
    .actions { flex-direction: column; width: 100%; }
    .actions .btn { width: 100%; }
    #scene { background-position: 28% 60%; } /* garde le coucher de soleil dans le cadre */
    .vol { width: 100%; justify-content: center; }
    .vol input { width: 60%; }
    #player .controls { justify-content: center; }
    dialog .row .btn { flex: 1 1 100%; }
}

/* Respect du réglage système « réduire les animations » : décor figé, envol remplacé par un fondu */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
    #index-text > * { opacity: 1 !important; }
    .star { opacity: .6; }
}
