/* Refonte « Portails » : les univers du site. layout() pose body.dz-amb-<ambiance>.
   Chaque ambiance définit ses variables ; la règle commune les branche sur les jetons du site,
   si bien que barre, cartes, titres et boutons changent d'univers sans toucher aux composants.
   Textures en SVG intégré (data:) : aucun fichier à télécharger, rien venu d'ailleurs. */

body.dz-amb-hall {
  --amb-bg: #070d15;
  --amb-surface: #0f1a28;
  --amb-surface-2: #16253a;
  --amb-line: #22364f;
  --amb-text: #f4f7fb;
  --amb-muted: #9fb1c6;
  --amb-accent: #4f8fd1;
  --amb-button: #2c5f8d;
  --amb-link: #a9cdf5;
  --amb-particle: #a9cdf5;
  --amb-title-font: "Rajdhani", "Bahnschrift Condensed", "Arial Narrow", sans-serif;
  --amb-texture: radial-gradient(ellipse 70% 50% at 50% -10%, rgb(79 143 209 / 22%), transparent 70%), url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .66 0 0 0 0 .8 0 0 0 0 .96 0 0 0 .05 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Front : carte d'état-major, courbes de niveau, bleu Warden et kaki. */
body.dz-amb-front {
  --amb-bg: #0c120f;
  --amb-surface: #162019;
  --amb-surface-2: #1f2b22;
  --amb-line: #2e3d31;
  --amb-text: #eef0e6;
  --amb-muted: #b8c1aa;
  --amb-accent: #8fb4d9;
  --amb-button: #4d5c34;
  --amb-link: #b4cde6;
  --amb-particle: #d8cfa8;
  --amb-title-font: "Rajdhani", "Bahnschrift Condensed", "Arial Narrow", sans-serif;
  --amb-texture: repeating-radial-gradient(circle at 78% 30%, transparent 0 34px, rgb(216 207 168 / 6%) 34px 35px), repeating-linear-gradient(90deg, transparent 0 79px, rgb(143 180 217 / 6%) 79px 80px), repeating-linear-gradient(0deg, transparent 0 79px, rgb(143 180 217 / 6%) 79px 80px), url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.75' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .85 0 0 0 0 .8 0 0 0 0 .65 0 0 0 .07 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Forge : bois sombre, métal chaud, braises. */
body.dz-amb-forge {
  --amb-bg: #110a06;
  --amb-surface: #1e130b;
  --amb-surface-2: #2a1b10;
  --amb-line: #43301d;
  --amb-text: #f6e7c8;
  --amb-muted: #d4b58a;
  --amb-accent: #f0a04b;
  --amb-button: #8a4518;
  --amb-link: #f5bd7c;
  --amb-particle: #ff9a3c;
  --amb-title-font: "Cinzel", Georgia, "Times New Roman", serif;
  --amb-texture: radial-gradient(ellipse 60% 45% at 50% 105%, rgb(255 122 26 / 20%), transparent 70%), repeating-linear-gradient(90deg, transparent 0 3px, rgb(246 231 200 / 2%) 3px 4px), url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='260' height='260'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.02 .6' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .55 0 0 0 0 .3 0 0 0 0 .12 0 0 0 .12 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Bohême : parchemin, enluminures, vert et or. */
body.dz-amb-boheme {
  --amb-bg: #0f140c;
  --amb-surface: #1a2214;
  --amb-surface-2: #232d1b;
  --amb-line: #39432b;
  --amb-text: #efe6c8;
  --amb-muted: #c9bd92;
  --amb-accent: #c9a24a;
  --amb-button: #6e5718;
  --amb-link: #e3c676;
  --amb-particle: #e7d48a;
  --amb-title-font: "Alegreya SC", Georgia, "Times New Roman", serif;
  --amb-texture: radial-gradient(ellipse 80% 60% at 50% 0%, rgb(201 162 74 / 14%), transparent 70%), url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.5' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .9 0 0 0 0 .85 0 0 0 0 .65 0 0 0 .08 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Branchement des ambiances sur les jetons du site. */
body[class*="dz-amb-"] {
  --dz-night: var(--amb-bg);
  --dz-surface: var(--amb-surface);
  --dz-surface-2: var(--amb-surface-2);
  --dz-line: var(--amb-line);
  --dz-text: var(--amb-text);
  --dz-muted: var(--amb-muted);
  --dz-warden-bright: var(--amb-accent);
  --dz-warden: var(--amb-button);
  --dz-sky: var(--amb-link);
  background-color: var(--amb-bg);
}

/* La texture sur une couche fixe : un fond « fixed » serait redessiné à chaque défilement (et ignoré sur iPhone). */
body[class*="dz-amb-"]::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image: var(--amb-texture);
  pointer-events: none;
}

/* La police de l'univers ne touche que les titres : barre, boutons et pastilles gardent Rajdhani. */
body[class*="dz-amb-"] :is(h1, h2, h3) {
  font-family: var(--amb-title-font);
}

/* Les univers à empattements gardent des titres lisibles : pas de capitales serrées. */
body.dz-amb-forge :is(h1, h2, h3),
body.dz-amb-boheme :is(h1, h2, h3) {
  letter-spacing: 0.5px;
  hyphens: auto;
}

/* Cinzel et Alegreya SC sont larges : sur un petit téléphone, un mot comme « Communauté » tient sur sa ligne. */
@media (max-width: 420px) {
  body.dz-amb-forge h1,
  body.dz-amb-boheme h1 {
    font-size: 2rem;
  }
}
