/* ==========================================================================
   Yalla Dahab · thème « Plongée » (essai)
   Le site est une descente en apnée : plus on fait défiler, plus l'eau devient
   profonde et sombre, et des créatures fluorescentes s'allument en chemin.
   Mode clair = plongée de jour (lagon turquoise -> bleu), mode sombre = plongée
   de nuit (bleu nuit -> abysses, bioluminescence).
   Ce fichier se charge APRÈS style.css et ne fait que redéfinir des couleurs
   et ajouter le décor : aucune fonction du site n'est modifiée.
   ========================================================================== */

:root {
  --bg: #eefaf9;
  --surface: #ffffff;
  --surface-2: #e6f5f7;
  --ink: #0b2433;
  --muted: #4b6676;
  --line: #cfe6ec;
  --primary: #0a6f8c;
  --primary-strong: #07566d;
  --primary-soft: #d9f0f5;
  --on-primary: #ffffff;
  --accent: #e0574a;
  --accent-strong: #c4443a;
  --accent-soft: #fde5e1;
  --on-accent: #ffffff;
  --header-bg: rgba(238, 250, 249, .78);
  --shadow: 0 1px 2px rgba(6, 40, 60, .05), 0 8px 24px rgba(6, 40, 60, .08);
  --shadow-hover: 0 2px 4px rgba(6, 40, 60, .06), 0 16px 38px rgba(6, 60, 90, .16), 0 0 0 1px rgba(10, 160, 200, .25);
  /* eau : de la surface (haut de page) vers le fond (bas de page) */
  --water: linear-gradient(180deg, #eefaf9 0, #d9f1f4 900px, #bfe3ec 40%, #98cde0 72%, #6eaecb 92%, #4b8fb2 100%);
  --abyss: #04121f;
  /* couleurs des créatures */
  --neon-cyan: #00a9cc;
  --neon-pink: #e0309f;
  --neon-lime: #4fae00;
  --neon-violet: #7b4dff;
  --neon-amber: #f0a000;
  --neon-glow: .85;
  --creature-opacity: 1;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #082236;
    --surface: #0b2438;
    --surface-2: #11324b;
    --ink: #e4f4f8;
    --muted: #95b4c5;
    --line: #1a3d58;
    --primary: #5fe3ff;
    --primary-strong: #9defff;
    --primary-soft: #0e3a53;
    --on-primary: #022130;
    --accent: #ff7d8e;
    --accent-strong: #ffa3af;
    --accent-soft: #3d1621;
    --on-accent: #2b0710;
    --photo-chip: rgba(4, 22, 36, .8);
    --header-bg: rgba(6, 30, 48, .78);
    --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 8px 24px rgba(0, 0, 0, .3);
    --shadow-hover: 0 2px 4px rgba(0, 0, 0, .4), 0 16px 38px rgba(0, 0, 0, .45), 0 0 0 1px rgba(95, 227, 255, .45), 0 0 26px rgba(95, 227, 255, .22);
    --water: linear-gradient(180deg, #0b3550 0, #092a42 900px, #061d31 40%, #031322 75%, #020a14 100%);
    --abyss: #01060c;
    --neon-cyan: #45f3ff;
    --neon-pink: #ff4fd8;
    --neon-lime: #b6ff3b;
    --neon-violet: #a98bff;
    --neon-amber: #ffd04a;
    --neon-glow: 1;
    --creature-opacity: 1;
  }
}

:root[data-theme="dark"] {
  --bg: #082236;
  --surface: #0b2438;
  --surface-2: #11324b;
  --ink: #e4f4f8;
  --muted: #95b4c5;
  --line: #1a3d58;
  --primary: #5fe3ff;
  --primary-strong: #9defff;
  --primary-soft: #0e3a53;
  --on-primary: #022130;
  --accent: #ff7d8e;
  --accent-strong: #ffa3af;
  --accent-soft: #3d1621;
  --on-accent: #2b0710;
  --photo-chip: rgba(4, 22, 36, .8);
  --header-bg: rgba(6, 30, 48, .78);
  --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 8px 24px rgba(0, 0, 0, .3);
  --shadow-hover: 0 2px 4px rgba(0, 0, 0, .4), 0 16px 38px rgba(0, 0, 0, .45), 0 0 0 1px rgba(95, 227, 255, .45), 0 0 26px rgba(95, 227, 255, .22);
  --water: linear-gradient(180deg, #0b3550 0, #092a42 900px, #061d31 40%, #031322 75%, #020a14 100%);
  --abyss: #01060c;
  --neon-cyan: #45f3ff;
  --neon-pink: #ff4fd8;
  --neon-lime: #b6ff3b;
  --neon-violet: #a98bff;
  --neon-amber: #ffd04a;
  --neon-glow: 1;
  --creature-opacity: 1;
}

/* ---------- L'eau qui s'assombrit ---------- */
html { background: var(--abyss); }
body { position: relative; background: var(--water); min-height: 100vh; overflow-x: hidden; }
main, #site-footer { position: relative; z-index: 1; }

.btn:hover { box-shadow: 0 6px 18px rgba(10, 111, 140, .3); }
:root[data-theme="dark"] .btn:hover { box-shadow: 0 0 0 1px rgba(95, 227, 255, .5), 0 0 22px rgba(95, 227, 255, .35); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn:hover { box-shadow: 0 0 0 1px rgba(95, 227, 255, .5), 0 0 22px rgba(95, 227, 255, .35); } }

/* Logo : même dessin, couleurs de l'eau */
.logo-mark rect { fill: #0a6f8c; }
.logo-mark circle { fill: #ff7d6b; }
.logo-mark path + path { stroke: #7fe6f5; }

/* ---------- Bandeau d'accueil : sous la surface ---------- */
.hero {
  background:
    radial-gradient(ellipse 70% 55% at 70% -10%, rgba(190, 250, 255, .55), transparent 65%),
    linear-gradient(180deg, #19a6bd 0%, #0c6d92 45%, #083f63 80%, #062c4a 100%);
}
:root[data-theme="dark"] .hero {
  background:
    radial-gradient(ellipse 70% 55% at 70% -10%, rgba(120, 220, 255, .28), transparent 65%),
    linear-gradient(180deg, #0f5a78 0%, #0a3c5c 45%, #06243d 80%, #041829 100%);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .hero {
    background:
      radial-gradient(ellipse 70% 55% at 70% -10%, rgba(120, 220, 255, .28), transparent 65%),
      linear-gradient(180deg, #0f5a78 0%, #0a3c5c 45%, #06243d 80%, #041829 100%);
  }
}
.hero > .container { position: relative; z-index: 2; }
.search-box { box-shadow: 0 24px 60px rgba(2, 20, 36, .45); }

/* rayons de soleil qui traversent l'eau */
.ocean-rays {
  position: absolute; inset: -20% -10% 0; z-index: 0; pointer-events: none; opacity: .5;
  background:
    linear-gradient(100deg, transparent 0 18%, rgba(255, 255, 255, .16) 20%, transparent 24% 38%, rgba(255, 255, 255, .1) 40%, transparent 43% 58%,
      rgba(255, 255, 255, .14) 61%, transparent 65% 76%, rgba(255, 255, 255, .08) 78%, transparent 81%);
  -webkit-mask-image: linear-gradient(180deg, #000 0%, transparent 85%); mask-image: linear-gradient(180deg, #000 0%, transparent 85%);
  transform-origin: 50% 0; animation: ocean-rays 14s ease-in-out infinite alternate;
}
@keyframes ocean-rays { from { transform: skewX(-6deg) translateX(-2%); } to { transform: skewX(6deg) translateX(2%); } }

/* bulles */
.ocean-bubbles { position: absolute; inset: 0; z-index: 1; pointer-events: none; overflow: hidden; }
.ocean-bubbles i {
  position: absolute; bottom: -20px; width: var(--s, 8px); height: var(--s, 8px); border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, .55); background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, .6), transparent 45%);
  animation: ocean-bubble var(--d, 9s) linear infinite; animation-delay: var(--w, 0s); opacity: 0;
}
@keyframes ocean-bubble {
  0% { transform: translate(0, 0); opacity: 0; }
  10% { opacity: .9; }
  50% { transform: translate(10px, -50vh); }
  90% { opacity: .7; }
  100% { transform: translate(-6px, -100vh); opacity: 0; }
}

/* l'apnéiste qui descend le long de la corde */
.ocean-diver {
  position: absolute; z-index: 1; pointer-events: none; top: 0; bottom: 0; inset-inline-end: 7%; width: 120px;
}
.ocean-diver .rope { position: absolute; top: 0; bottom: 0; left: 50%; border-left: 2px dashed rgba(255, 255, 255, .35); }
.ocean-diver svg {
  position: absolute; left: 50%; top: 3%; width: 64px; margin-left: -37px; overflow: visible;
  filter: drop-shadow(0 0 10px rgba(127, 230, 245, .25));
  animation: ocean-dive 9s ease-in-out infinite alternate;
}
@keyframes ocean-dive { from { transform: translateY(-4%); } to { transform: translateY(14%); } }
@media (max-width: 860px) { .ocean-diver { inset-inline-end: 2%; opacity: .55; } }
@media (max-width: 560px) { .ocean-diver { width: 70px; inset-inline-end: -10px; opacity: .4; } .ocean-diver svg { width: 46px; margin-left: -26px; } }
.ocean-diver .kick { animation: ocean-kick 2.4s ease-in-out infinite alternate; transform-box: fill-box; transform-origin: 50% 100%; }
@keyframes ocean-kick { from { transform: rotate(-7deg); } to { transform: rotate(7deg); } }
.ocean-diver .breath { animation: ocean-pulse 3s ease-in-out infinite; }

/* ---------- Créatures fluorescentes ---------- */
.ocean-life { position: absolute; inset: 0; z-index: 2; pointer-events: none; overflow: hidden; }
:root[data-theme="dark"] .ocean-life { mix-blend-mode: screen; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .ocean-life { mix-blend-mode: screen; } }
.creature {
  position: absolute; width: var(--w, 150px); color: var(--c, var(--neon-cyan));
  opacity: 0; transform: scale(.92);
  transition: opacity 1.6s ease, transform 1.6s ease;
}
/* dans la marge à côté du contenu ; sur petit écran, à moitié sortie du bord */
.creature { --edge: max(calc(var(--w, 150px) * -.5), calc((100% - 1160px) / 2 - var(--w, 150px) * .72)); }
.creature[data-side="start"] { inset-inline-start: var(--edge); }
.creature[data-side="end"] { inset-inline-end: var(--edge); }
.creature.lit { opacity: var(--creature-opacity); transform: none; animation: ocean-flash 1.4s ease-out 1; }
.creature svg {
  display: block; width: 100%; height: auto; overflow: visible;
  fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round;
  filter: drop-shadow(0 0 3px currentColor) drop-shadow(0 0 calc(12px * var(--neon-glow)) currentColor);
}
.creature .fill { fill: currentColor; fill-opacity: .12; }
.creature .dot { fill: currentColor; stroke: none; }
.creature .soft { opacity: .55; }
/* la bioluminescence s'allume par à-coups, comme une vraie méduse */
@keyframes ocean-flash {
  0% { opacity: 0; } 18% { opacity: 1; } 30% { opacity: .25; } 45% { opacity: 1; } 60% { opacity: .5; } 100% { opacity: var(--creature-opacity); }
}
.creature.lit .move { animation: var(--anim) var(--dur, 7s) ease-in-out infinite alternate; transform-box: fill-box; transform-origin: 50% 0; }
.creature.lit .pulse { animation: ocean-pulse 2.6s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.creature.lit .sway { animation: ocean-sway 3.2s ease-in-out infinite alternate; transform-box: fill-box; transform-origin: 50% 0; }
.creature.lit .flap { animation: ocean-flap 2.8s ease-in-out infinite alternate; transform-box: fill-box; transform-origin: 50% 50%; }
@keyframes ocean-bob { from { transform: translateY(0); } to { transform: translateY(26px); } }
@keyframes ocean-glide { from { transform: translate(0, 0) rotate(-3deg); } to { transform: translate(-30px, 18px) rotate(3deg); } }
@keyframes ocean-swim { from { transform: translateX(0); } to { transform: translateX(60px); } }
@keyframes ocean-pulse { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }
@keyframes ocean-sway { from { transform: skewX(-6deg); } to { transform: skewX(6deg); } }
.creature .thin { stroke-width: 1.3; }
.creature .hair { stroke-width: .9; }
.creature .thick { stroke-width: 3.4; }
.creature[data-art="school"].lit .move { animation-direction: normal; animation-timing-function: linear; transform-origin: 50% 50%; }
.creature.lit .wiggle { animation: ocean-wiggle 1.1s ease-in-out infinite alternate; transform-box: fill-box; transform-origin: 20% 50%; }
.creature.lit .row-l { animation: ocean-row-l 2.6s ease-in-out infinite alternate; transform-box: fill-box; transform-origin: 100% 60%; }
.creature.lit .row-r { animation: ocean-row-r 2.6s ease-in-out infinite alternate; transform-box: fill-box; transform-origin: 0 60%; }
.creature .d1 { animation-delay: -.4s !important; } .creature .d2 { animation-delay: -1.1s !important; }
.creature .d3 { animation-delay: -1.8s !important; } .creature .d4 { animation-delay: -2.5s !important; }
@keyframes ocean-wiggle { from { transform: rotate(-5deg); } to { transform: rotate(5deg); } }
@keyframes ocean-row-l { from { transform: rotate(-14deg); } to { transform: rotate(10deg); } }
@keyframes ocean-row-r { from { transform: rotate(14deg); } to { transform: rotate(-10deg); } }
@keyframes ocean-school {
  0% { transform: translateX(0) scaleX(1); } 46% { transform: translateX(-80px) scaleX(1); }
  50% { transform: translateX(-80px) scaleX(-1); } 96% { transform: translateX(0) scaleX(-1); } 100% { transform: translateX(0) scaleX(1); }
}
@keyframes ocean-flap { from { transform: scaleY(1); } to { transform: scaleY(.82); } }
[dir="rtl"] .creature[data-flip] svg { transform: scaleX(-1); }

/* téléphone : créatures plus petites, qui dépassent du bord de l'écran */
@media (max-width: 760px) {
  .creature { --w: var(--wm, 100px); --edge: calc(var(--w) * -.42); }
}

/* ---------- Profondimètre ---------- */
.depth-gauge {
  position: fixed; z-index: 20; inset-inline-end: 14px; bottom: 16px;
  display: flex; align-items: center; gap: 8px; padding: 7px 12px 7px 10px; border-radius: 999px;
  background: rgba(4, 26, 42, .72); color: #c9f6ff; font-size: .8rem; font-weight: 700; font-variant-numeric: tabular-nums;
  border: 1px solid rgba(95, 227, 255, .35); box-shadow: 0 0 18px rgba(69, 243, 255, .18);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); pointer-events: none; direction: ltr;
}
.depth-gauge .arrow { width: 14px; height: 14px; color: #45f3ff; }
.depth-gauge .zone { font-weight: 500; opacity: .75; }
@media (max-width: 1599px) { .depth-gauge .zone { display: none; } }
@media (max-width: 560px) { .depth-gauge { bottom: 12px; inset-inline-end: 10px; } }

/* corde verticale avec l'apnéiste, sur grand écran */
.depth-rail { display: none; }
@media (min-width: 1280px) {
  .depth-rail {
    display: block; position: fixed; z-index: 5; inset-inline-end: 26px; top: 96px; bottom: 70px; width: 2px;
    background: repeating-linear-gradient(180deg, rgba(10, 111, 140, .35) 0 6px, transparent 6px 12px); pointer-events: none;
  }
  :root[data-theme="dark"] .depth-rail { background: repeating-linear-gradient(180deg, rgba(95, 227, 255, .3) 0 6px, transparent 6px 12px); }
  .depth-rail i {
    position: absolute; left: -5px; top: 0; width: 12px; height: 12px; border-radius: 50%; background: #45f3ff;
    box-shadow: 0 0 10px #45f3ff, 0 0 22px #45f3ff; transform: translateY(calc(var(--p, 0) * (100vh - 178px)));
  }
}
@media (min-width: 1280px) and (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .depth-rail { background: repeating-linear-gradient(180deg, rgba(95, 227, 255, .3) 0 6px, transparent 6px 12px); }
}

/* ---------- Abysses : le pied de page ---------- */
#site-footer { background: var(--abyss); color: #b9d4e0; border-top: 0; margin-top: 260px; }
#site-footer::before {
  content: ""; position: absolute; left: 0; right: 0; bottom: 100%; height: 300px; pointer-events: none;
  background: linear-gradient(180deg, rgba(4, 18, 31, 0) 0%, rgba(4, 18, 31, .12) 25%, rgba(4, 18, 31, .4) 50%, rgba(4, 18, 31, .78) 75%, var(--abyss) 100%);
}
#site-footer a { color: #8eeaff; }
#site-footer strong { color: #fff; }
.abyss-note { margin: 0 0 8px; font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; color: #45f3ff; opacity: .8; }

/* ---------- Mouvement réduit : tout reste allumé mais immobile ---------- */
@media (prefers-reduced-motion: reduce) {
  .ocean-rays, .ocean-bubbles i, .ocean-diver svg, .ocean-diver .kick, .ocean-diver .breath, .creature, .creature.lit, .creature.lit * { animation: none !important; transition: none !important; }
  .ocean-bubbles { display: none; }
  .creature { opacity: var(--creature-opacity); transform: none; }
}

#site-footer { padding: 80px 0 64px; }
#site-footer .footer-inner { position: relative; z-index: 1; }
.abyss-life { z-index: 0 !important; top: -250px; bottom: auto; height: 330px; }
.abyss-up { font-weight: 600; font-size: .9rem; }

/* téléphone : les créatures passent derrière les cartes et n'apparaissent que dans les espaces libres */
@media (max-width: 760px) { .ocean-life { z-index: 0; } }
/* la baudroie nage vers le centre de la page */
.abyss-life .creature svg { transform: scaleX(-1); }
[dir="rtl"] .abyss-life .creature svg { transform: none; }
