/* =========================================================
   Nirvana Valley — page d'accueil
   ========================================================= */

body.is-loading {
  overflow: hidden;
}

/* ---------- Écran de chargement ---------- */
.loader {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  color: var(--texte-papier);
  background:
    radial-gradient(circle at 50% 42%, rgba(255, 237, 178, 0.24), rgba(33, 13, 5, 0.66) 45%, rgba(10, 5, 3, 0.98)),
    url("../assets/images/fond-farwest.webp") center / cover no-repeat,
    linear-gradient(180deg, #dfab65, #6d3519 58%, var(--encre));
  transition: opacity 720ms ease, visibility 720ms ease;
}

body.site-ready .loader {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.loader-lignes {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at center, transparent 0 34%, rgba(0, 0, 0, 0.52) 78%),
    repeating-linear-gradient(0deg, rgba(255, 230, 170, 0.08) 0 1px, transparent 1px 5px),
    repeating-linear-gradient(90deg, rgba(48, 20, 9, 0.12) 0 2px, transparent 2px 18px);
  mix-blend-mode: multiply;
}

.loader-carte {
  position: relative;
  z-index: 1;
  width: min(420px, calc(100vw - 42px));
  display: grid;
  justify-items: center;
  gap: 18px;
  padding: clamp(26px, 6vw, 42px);
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 241, 183, 0.45), transparent 40%),
    repeating-linear-gradient(9deg, rgba(105, 62, 29, 0.08) 0 2px, transparent 2px 8px),
    linear-gradient(180deg, rgba(255, 232, 172, 0.94), rgba(194, 125, 58, 0.92));
  border: 2px solid #5e2b15;
  border-radius: 7px 12px 8px 10px;
  clip-path: polygon(2% 3%, 98% 0, 100% 24%, 97% 98%, 69% 96%, 47% 100%, 18% 97%, 0 91%, 3% 55%, 0 21%);
  box-shadow:
    0 28px 70px rgba(0, 0, 0, 0.56),
    inset 0 0 0 2px rgba(255, 245, 198, 0.28),
    inset 0 0 34px rgba(80, 35, 14, 0.3);
  animation: carte-entree 650ms cubic-bezier(.2, .8, .2, 1) both;
}

.loader-logo {
  width: clamp(96px, 22vw, 140px);
  height: auto;
  filter: drop-shadow(0 8px 12px rgba(60, 25, 8, 0.45));
}

/* Barillet du revolver */
.barillet {
  position: relative;
  width: clamp(96px, 18vw, 130px);
  aspect-ratio: 1;
  border: 5px solid #1f120d;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, #160d09 0 14%, transparent 15%),
    radial-gradient(circle at 35% 30%, rgba(255, 241, 195, 0.4), transparent 20%),
    linear-gradient(135deg, #f5d184, #8b4c25 46%, #2c170c);
  box-shadow:
    inset 0 0 0 8px rgba(48, 23, 12, 0.72),
    inset 0 0 28px rgba(0, 0, 0, 0.46),
    0 12px 22px rgba(0, 0, 0, 0.4);
  animation: barillet-tourne 0.58s linear infinite;
}

body.shot-fired .barillet {
  animation: none;
  transform: rotate(38deg);
}

.barillet span {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 23%;
  aspect-ratio: 1;
  border: 3px solid rgba(19, 10, 6, 0.86);
  border-radius: 50%;
  background: radial-gradient(circle, #110906 0 42%, #593016 43% 100%);
  transform: translate(-50%, -50%) rotate(calc(var(--i) * 60deg)) translateY(-142%);
  box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.64);
}

.barillet span:nth-child(1) { --i: 0; }
.barillet span:nth-child(2) { --i: 1; }
.barillet span:nth-child(3) { --i: 2; }
.barillet span:nth-child(4) { --i: 3; }
.barillet span:nth-child(5) { --i: 4; }
.barillet span:nth-child(6) { --i: 5; }

.loader-texte {
  margin: 0;
  color: var(--texte-papier);
  font-family: var(--police-titre);
  font-size: clamp(1.05rem, 3.6vw, 1.6rem);
  letter-spacing: 0.08em;
  text-shadow: 0 1px 0 rgba(255, 240, 190, 0.78);
}

.loader-texte::after {
  content: "";
  display: inline-block;
  width: 1.7em;
  text-align: left;
  animation: points-chargement 1s steps(4, end) infinite;
}

.loader-barre {
  position: relative;
  width: min(270px, 76vw);
  height: 12px;
  overflow: hidden;
  border: 2px solid rgba(64, 29, 12, 0.86);
  border-radius: 999px;
  background: #6c3519;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.36);
}

.loader-barre span {
  position: absolute;
  inset: 0;
  transform-origin: left center;
  transform: scaleX(0);
  background: linear-gradient(90deg, #5f2c14, #d99440 45%, #ffe19a);
  animation: progression 2.25s cubic-bezier(.25, .78, .3, 1) forwards;
}

.coup-de-feu {
  position: absolute;
  inset: 0;
  z-index: 2;
  opacity: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 48%, rgba(255, 255, 232, 1) 0 6%, rgba(255, 194, 70, 0.9) 7% 15%, rgba(116, 38, 12, 0.42) 16% 30%, transparent 31%),
    linear-gradient(90deg, transparent 42%, rgba(255, 242, 183, 0.9) 50%, transparent 58%),
    linear-gradient(0deg, transparent 43%, rgba(255, 242, 183, 0.62) 50%, transparent 57%);
}

body.shot-fired .coup-de-feu {
  animation: eclair 520ms ease-out forwards;
}

/* ---------- Scène principale ---------- */
.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: clamp(24px, 5vw, 64px) clamp(16px, 5vw, 64px) 110px;
  background:
    linear-gradient(180deg, rgba(18, 9, 5, 0.06), rgba(18, 9, 5, 0.54)),
    radial-gradient(circle at center, rgba(255, 196, 93, 0.22), rgba(26, 10, 3, 0.62) 68%),
    url("../assets/images/fond-farwest.webp") center / cover no-repeat;
  isolation: isolate;
  transition: opacity 650ms ease, transform 650ms ease;
}

body.is-loading .hero {
  opacity: 0;
  transform: scale(1.06) translateY(18px);
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.42), transparent 26%, transparent 74%, rgba(0, 0, 0, 0.42)),
    repeating-linear-gradient(0deg, rgba(255, 232, 173, 0.04) 0 1px, transparent 1px 5px);
  pointer-events: none;
}

.poussiere {
  position: absolute;
  inset: auto auto 9% -12%;
  width: 44vw;
  height: 80px;
  z-index: -1;
  background: linear-gradient(90deg, transparent, rgba(255, 213, 139, 0.18), transparent);
  filter: blur(14px);
  animation: poussiere 9s linear infinite;
}

.poussiere-2 {
  bottom: 19%;
  animation-duration: 13s;
  animation-delay: -5s;
  opacity: 0.7;
}

.impacts {
  position: absolute;
  inset: 0;
  z-index: 2;
  overflow: hidden;
  pointer-events: none;
}

.impact {
  position: absolute;
  width: clamp(36px, 4.4vw, 62px);
  aspect-ratio: 1;
  background: url("../assets/images/impact-balle.webp") center / contain no-repeat;
  filter: sepia(0.22) saturate(0.86) drop-shadow(0 0 4px rgba(24, 8, 3, 0.62));
  transform: translate(-50%, -50%) rotate(var(--turn));
  animation: impact 520ms cubic-bezier(.18, .9, .2, 1) both;
}

/* Cowboy en arrière-plan */
.cowboy {
  position: absolute;
  left: clamp(485px, 29.5vw, 560px);
  bottom: clamp(82px, 10.5vh, 118px);
  z-index: 0;
  width: clamp(92px, 8vw, 132px);
  aspect-ratio: 2 / 3;
  opacity: 0.78;
  filter: sepia(0.28) saturate(0.86) contrast(0.95) brightness(0.78) drop-shadow(0 12px 16px rgba(0, 0, 0, 0.48));
  pointer-events: none;
}

.cowboy img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center bottom;
  transition: opacity 360ms ease, transform 480ms ease;
}

.cowboy-tir {
  opacity: 0;
  transform: translateY(8px) scale(0.98);
}

.cowboy.is-shooting .cowboy-dos {
  opacity: 0;
  transform: translateY(8px) scale(0.98);
}

.cowboy.is-shooting .cowboy-tir {
  opacity: 1;
  transform: scale(1.02);
}

/* ---------- Contenu central ---------- */
.contenu {
  position: relative;
  z-index: 3;
  width: min(940px, 100%);
  display: grid;
  justify-items: center;
  gap: clamp(16px, 3vw, 28px);
  text-align: center;
}

.logo {
  width: clamp(120px, 18vw, 180px);
  height: auto;
  filter: drop-shadow(0 12px 18px rgba(0, 0, 0, 0.55)) drop-shadow(0 0 22px rgba(255, 183, 74, 0.25));
}

.surtitre {
  margin: 0;
  color: var(--vert);
  font-size: clamp(0.95rem, 2.3vw, 1.15rem);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.65);
}

h1 {
  margin: 0;
  width: 100%;
  display: grid;
  grid-template-columns: minmax(34px, 1fr) auto minmax(34px, 1fr);
  align-items: center;
  gap: clamp(6px, 1.2vw, 16px);
  color: var(--or-clair);
  font-family: var(--police-titre);
  font-size: clamp(2rem, 7vw, 4.9rem);
  font-weight: 400;
  line-height: 1.08;
  white-space: nowrap;
  text-shadow: 0 4px 0 #6a2d19, 0 10px 24px rgba(0, 0, 0, 0.62);
}

.titre-pistolet {
  width: clamp(48px, 12vw, 150px);
  height: auto;
  filter: sepia(0.28) drop-shadow(0 3px 0 rgba(65, 28, 12, 0.86)) drop-shadow(0 8px 10px rgba(0, 0, 0, 0.48));
}

.titre-pistolet-gauche {
  justify-self: end;
  transform: rotate(-8deg);
}

.titre-pistolet-droite {
  justify-self: start;
  transform: rotate(8deg);
}

/* Gros boutons parchemin */
.actions {
  width: min(520px, 100%);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(14px, 3vw, 22px);
}

.bouton-western {
  position: relative;
  min-height: 72px;
  display: grid;
  place-items: center;
  padding: 14px 20px;
  color: #2b170d;
  font-family: var(--police-titre);
  font-size: clamp(1.08rem, 3.2vw, 1.55rem);
  line-height: 1;
  text-decoration: none;
  background:
    radial-gradient(circle at 50% 112%, rgba(91, 42, 19, 0.24), transparent 45%),
    repeating-linear-gradient(8deg, rgba(105, 62, 29, 0.08) 0 2px, transparent 2px 7px),
    linear-gradient(180deg, #ffe8ac, #d69a50 54%, #b87336);
  border: 2px solid var(--bois);
  border-radius: 6px 11px 7px 10px;
  box-shadow:
    0 8px 0 #3a1b0e,
    0 18px 28px rgba(0, 0, 0, 0.36),
    inset 0 0 0 2px rgba(255, 238, 178, 0.28),
    inset 0 0 22px rgba(77, 35, 14, 0.28);
  clip-path: polygon(2% 7%, 96% 2%, 99% 24%, 97% 95%, 78% 98%, 52% 95%, 24% 99%, 1% 92%, 3% 62%, 0 31%);
  text-shadow: 0 1px 0 rgba(255, 239, 184, 0.75);
  animation: flottement 2.5s ease-in-out infinite;
  transition: transform 180ms ease, filter 180ms ease;
}

.bouton-western:nth-child(2) {
  border-radius: 10px 5px 12px 7px;
  clip-path: polygon(1% 4%, 24% 2%, 54% 5%, 98% 1%, 96% 36%, 100% 69%, 96% 97%, 62% 94%, 38% 99%, 3% 94%, 0 58%, 4% 28%);
  animation-delay: -1.2s;
}

.bouton-western::after {
  content: "";
  position: absolute;
  inset: 9px;
  border: 1px dashed rgba(70, 31, 13, 0.56);
  border-radius: 5px 9px 6px 8px;
  pointer-events: none;
}

.bouton-western:hover,
.bouton-western:focus-visible {
  filter: brightness(1.08);
  transform: translateY(-6px) scale(1.04) rotate(-1deg);
}

.bouton-western:active {
  transform: translateY(4px) scale(0.99);
}

.bouton-western small {
  display: block;
  margin-top: 6px;
  font-family: var(--police-western);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  opacity: 0.75;
}

/* ---------- Coins bas : réseaux + audio ---------- */
.reseaux,
.audio {
  position: fixed;
  bottom: clamp(14px, 3vw, 28px);
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 12px;
}

.reseaux {
  left: clamp(14px, 3vw, 28px);
}

.audio {
  right: clamp(14px, 3vw, 28px);
  padding: 8px 12px;
  background:
    radial-gradient(circle at 28% 24%, rgba(255, 225, 147, 0.2), transparent 42%),
    linear-gradient(180deg, rgba(88, 42, 19, 0.92), rgba(32, 15, 9, 0.92));
  border: 2px solid rgba(255, 210, 118, 0.8);
  border-radius: var(--arrondi);
  box-shadow: 0 4px 0 #241008, 0 8px 16px rgba(0, 0, 0, 0.3);
}

.reseau {
  width: 48px;
  height: 48px;
  padding: 0;
}

.reseau svg {
  width: 26px;
  height: 26px;
  fill: currentColor;
}

.audio-bouton {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  padding: 0;
  color: var(--or-clair);
  background: rgba(36, 16, 8, 0.46);
  border: 1px solid rgba(255, 230, 158, 0.58);
  border-radius: 6px;
}

.audio-icone {
  width: 15px;
  height: 18px;
  border-left: 5px solid currentColor;
  border-right: 5px solid currentColor;
}

.audio-bouton.is-paused .audio-icone {
  width: 0;
  height: 0;
  border-top: 9px solid transparent;
  border-bottom: 9px solid transparent;
  border-left: 15px solid currentColor;
  border-right: 0;
}

.volume {
  width: clamp(96px, 14vw, 150px);
  accent-color: var(--or);
}

/* ---------- Animations ---------- */
@keyframes flottement {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -3px; }
}

@keyframes poussiere {
  from { transform: translateX(0); }
  to { transform: translateX(150vw); }
}

@keyframes barillet-tourne {
  to { transform: rotate(360deg); }
}

@keyframes carte-entree {
  from { opacity: 0; transform: translateY(18px) scale(0.96); }
  to { opacity: 1; transform: none; }
}

@keyframes progression {
  0% { transform: scaleX(0); }
  58% { transform: scaleX(0.72); }
  82% { transform: scaleX(0.9); }
  100% { transform: scaleX(1); }
}

@keyframes points-chargement {
  0% { content: ""; }
  25% { content: "."; }
  50% { content: ".."; }
  75%, 100% { content: "..."; }
}

@keyframes eclair {
  0% { opacity: 0; transform: scale(0.92); }
  16% { opacity: 1; transform: scale(1.04); }
  100% { opacity: 0; transform: scale(1.22); }
}

@keyframes impact {
  0% { opacity: 0; transform: translate(-50%, -50%) rotate(var(--turn)) scale(2.2); filter: brightness(2); }
  45% { opacity: 1; transform: translate(-50%, -50%) rotate(var(--turn)) scale(0.86); filter: brightness(1.35); }
  100% { opacity: 0.82; transform: translate(-50%, -50%) rotate(var(--turn)) scale(1); filter: brightness(1); }
}

/* ---------- Responsive ---------- */
@media (max-width: 580px) {
  .cowboy {
    left: 10%;
    bottom: 94px;
    width: 82px;
  }

  .actions {
    grid-template-columns: 1fr;
  }

  .bouton-western {
    min-height: 66px;
  }

  .volume {
    width: 84px;
  }
}
