/* Reset et styles globaux */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  color-scheme: light;
}

html[data-theme="sombre"] {
  color-scheme: dark;
}

body {
  background: linear-gradient(160deg, var(--fond-coque) 0%, var(--fond-coque-ombre) 55%, var(--fond-coque) 100%);
  color: var(--texte-coque-primaire);
  font-family: var(--police-texte);
  font-size: 16px;
  line-height: 1.6;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

/* Halo chaud derrière l'en-tête, façon hublot lointain */
body::after {
  content: '';
  position: fixed;
  top: -20%;
  left: 50%;
  transform: translateX(-50%);
  width: 900px;
  height: 700px;
  background: radial-gradient(closest-side, rgba(217, 164, 65, 0.10), transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* Parois panneautées dans les marges, façon coque de station — n'empiètent jamais sur le contenu */
.paroi {
  position: fixed;
  top: 0;
  bottom: 0;
  width: calc((100vw - 960px) / 2);
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(
      90deg,
      transparent calc(50% - 2px),
      var(--paroi-ombre) calc(50% - 2px),
      var(--paroi-ombre) calc(50% - 1px),
      var(--paroi-lumiere) calc(50% - 1px),
      var(--paroi-lumiere) 50%,
      transparent 50%
    );
}

.paroi-gauche { left: 0; }
.paroi-droite { right: 0; }

.paroi::before,
.paroi::after {
  content: '';
  position: absolute;
  left: 10px;
  right: 10px;
  height: 60px;
  background-image: repeating-radial-gradient(
    circle at 9px 9px,
    var(--paroi-rivet) 0 1.4px,
    transparent 1.4px 18px
  );
}

.paroi::before { top: 28px; }
.paroi::after { bottom: 28px; }

@media (max-width: 1040px) {
  .paroi {
    display: none;
  }
}

/* ================= BOUTON DE THÈME ================= */

.bouton-theme-conteneur {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: var(--espace-md);
  position: relative;
  z-index: 1;
}

.bouton-theme {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  background: linear-gradient(160deg, var(--fond-coque-clair) 0%, var(--fond-coque) 45%, var(--fond-coque-ombre) 100%);
  color: var(--texte-coque-secondaire);
  clip-path: polygon(
    9px 0, calc(100% - 9px) 0, 100% 9px,
    100% calc(100% - 9px), calc(100% - 9px) 100%,
    9px 100%, 0 calc(100% - 9px), 0 9px
  );
  border: 1.5px solid color-mix(in srgb, var(--led-vert) 45%, var(--acier-clair));
  filter:
    drop-shadow(0 0 4px color-mix(in srgb, var(--led-vert) 35%, transparent))
    drop-shadow(0 6px 12px rgba(20, 22, 24, 0.25));
  font-family: var(--police-technique);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: filter 0.15s ease, transform 0.15s ease;
}

.bouton-theme:hover {
  transform: translateY(-1px);
  filter:
    drop-shadow(0 0 7px color-mix(in srgb, var(--led-vert) 55%, transparent))
    drop-shadow(0 8px 14px rgba(20, 22, 24, 0.3));
}

.bouton-theme svg {
  width: 15px;
  height: 15px;
}

.icone-lune,
html[data-theme="sombre"] .icone-soleil {
  display: none;
}

html[data-theme="sombre"] .icone-lune {
  display: block;
}

.bouton-theme-exclusif--actif {
  color: var(--led-vert);
  border-color: var(--led-vert);
}

.bouton-don {
  /* Couleur fixe (pas var(--rouge-coque)) : en mode sombre, --rouge-coque
     est un alias de --cat-rouge, que le thème exclusif neutralise vers un
     vert-turquoise unifié (voir components.css, section "THÈME EXCLUSIF —
     GRANDS CADRES"). Le cœur doit rester rouge dans tous les cas, donc on
     n'utilise volontairement pas cette chaîne de variables. */
  color: #d97a5b !important;
  border-color: #d97a5b !important;
}

.texte-mode-clair,
html[data-theme="sombre"] .texte-mode-sombre {
  display: none;
}

html[data-theme="sombre"] .texte-mode-clair {
  display: inline;
}

a {
  color: inherit;
  text-decoration: none;
}

h1, h2, h3 {
  font-weight: 500;
  letter-spacing: 0.01em;
}

img, svg {
  display: block;
  max-width: 100%;
}

button {
  font-family: inherit;
}

:focus-visible {
  outline: 2px solid var(--or-vif);
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

/* ================= BADGE "PER ASPERA AD ASTRA" ================= */
/* Injecté par theme.js sur toutes les pages une fois le Sanctuaire atteint. */

.badge-per-aspera {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 50;
  width: 64px;
  height: 64px;
  display: block;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.4));
  transition: transform 0.2s ease;
}

.badge-per-aspera:hover {
  transform: scale(1.08) rotate(-4deg);
}

.badge-per-aspera img {
  width: 100%;
  height: 100%;
  display: block;
}

@media (max-width: 480px) {
  .badge-per-aspera {
    width: 48px;
    height: 48px;
    right: 10px;
    bottom: 10px;
  }
}
