/* Sources de chaque valeur : voir README.md, section « DA et sources ». */

/* Cosmic (Rajesh Rajput) : licence web détenue par Valentin. Fichier repris de l'habillage NodeCG. */
@font-face {
  font-family: "Cosmic";
  src: url("/assets/fonts/Cosmic-VF.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --bleu: #0a5bed;        /* habillage NodeCG : sommaire + écrans d'attente */
  --bleu-fonce: #0846b8;  /* bleu ci-dessus assombri, pour les survols */
  --bleu-trait: #5a8ff2;  /* NodeCG : --outline-stroke des écrans d'attente */
  --blanc: #ffffff;
  --encre: #1c1c24;       /* NodeCG : texte des pastilles (pubs) */
  --corail: #e8704f;      /* mur du décor Dominique (approché) */
  --rouge-live: #fa1350;  /* NodeCG : accent des alertes */
  --rayon: 10px;          /* NodeCG : arrondi des pastilles */
  --ombre: 0 8px 22px rgb(0 0 0 / 0.22); /* NodeCG : ombre des pastilles */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);   /* sortie franche : entrées, appuis */
  --portrait: clamp(64px, 26vw, 96px);          /* largeur du portrait (rétrécit sur très petit écran ou fort zoom) */
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%; text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent; /* pas de flash gris au toucher : chaque élément a son propre retour */
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px max(16px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  background: var(--bleu);
  color: var(--blanc);
  font-family: "Cosmic", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 1.0625rem; /* 17 px par défaut, suit la taille de texte choisie par le visiteur */
  line-height: 1.45;
}

.entete, main, .pied { width: 100%; max-width: 680px; }

.evitement {
  position: absolute; left: 16px; top: -100px;
  padding: 10px 14px; border-radius: var(--rayon);
  background: var(--blanc); color: var(--encre); font-weight: 700;
}
.evitement:focus { top: 16px; }

/* En-tête : décor du stream flouté, logo de Valentin (Figma) centré par-dessus. */
.scene-place { margin: 0 0 18px; aspect-ratio: 16 / 9; } /* garde la place du cadre pendant l'intro */
.scene {
  --teinte: rgb(10 91 237 / 0.22); /* ← voile bleu sur le décor (bleu de l'habillage, 22 %) */
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  border-radius: calc(var(--rayon) * 1.6);
  overflow: hidden;
  isolation: isolate;
  box-shadow: var(--ombre);
  background: var(--bleu-fonce);
}
.scene__fond {
  position: absolute; inset: 0; z-index: -1;
  background: url("/assets/decor-flou.jpg") 50% 50% / cover no-repeat; /* centré : identique en plein écran et pendant le rétrécissement */
}
.scene::after { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--teinte); }
.logo {
  margin: 0;
  width: min(58%, 340px); /* ← taille du logo */
  filter: drop-shadow(0 8px 18px rgb(0 0 0 / 0.25));
  transition: filter 140ms ease;
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}
.logo__ressort { display: block; transform-origin: 50% 60%; } /* animé par logo.js (ressorts) */
.logo__svg { display: block; width: 100%; height: auto; }
/* Effet « boing » (src/logo.js) : appuyé, le logo s'enfonce et son ombre se resserre ; relâché, il rebondit. */
.logo--enfonce { filter: drop-shadow(0 3px 6px rgb(0 0 0 / 0.32)); }
.scene { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }

.sr {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}

/* Intro (src/intro.js) : décor plein écran, logo qui monte, cadre qui prend sa place, puis le site. */
html.intro .scene {
  position: fixed; top: 0; left: 0; z-index: 50;
  width: 100%; height: 100%;
  border-radius: 0; box-shadow: none;
}
html.intro .logo { width: min(62%, 560px); opacity: 0; }
html.intro.intro-go .logo { animation: logo-arrivee 700ms var(--ease-out) 120ms both; }
/* Rétrécissement : piloté par intro.js en transform + clip-path (aucun recalcul de mise en page). */
html.intro body, html.intro-reduit body { touch-action: none; overscroll-behavior: none; }
html.intro-reduit .scene-place { position: relative; z-index: 50; }
html.intro-reduit .scene { box-shadow: none; border-radius: 0; z-index: 50; will-change: transform, clip-path; } /* coins arrondis par clip-path */
html.intro-reduit .logo { will-change: transform; }
html.intro-reduit, html.intro-reduit body { overflow-x: clip; }
@keyframes logo-arrivee {
  from { opacity: 0; transform: translateY(22vh) scale(0.94); }
  to { opacity: 1; transform: none; }
}
/* Le site apparaît élément par élément, 45 ms d'écart (--ordre posé par intro.js).
   « translate » plutôt que « transform » : ne touche pas à l'inclinaison de la bulle ni à l'appui des boutons. */
html.intro-cache [data-revele] { opacity: 0; translate: 0 12px; }
html.intro-fondu [data-revele] {
  transition: opacity 380ms var(--ease-out), translate 380ms var(--ease-out);
  transition-delay: calc(var(--ordre, 0) * 45ms);
}

.titre {
  margin: 0;
  font-size: clamp(2.4rem, 11vw, 4rem);
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1;
}
.accroche {
  margin: 10px 0 0;
  max-width: 34ch;
  font-weight: 500;
}

/* Pendant un live : seul le lecteur ; pas de « Prochain live » (live.js pose body[data-live]). */
body[data-live="oui"] .prochain { display: none; }

/* Lecteur Twitch : chargé dès l'arrivée, montré seulement pendant un live.
   Hors live il reste hors écran (pas display:none) pour que Twitch continue de signaler l'état. */
.live { margin-top: 22px; }
.live[data-etat="attente"] {
  position: absolute; left: -10000px; top: 0;
  width: 640px; height: 360px; overflow: hidden; margin: 0;
}
.live__cadre {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: calc(var(--rayon) * 1.6);
  overflow: hidden;
  background: #0f0f10;
  box-shadow: var(--ombre);
}
.live[data-etat="attente"] .live__cadre { width: 640px; height: 360px; }
.live__lecteur, .live__lecteur iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.live__bouton {
  display: inline-block; margin-top: 12px; touch-action: manipulation;
  color: var(--blanc); font-weight: 700; text-underline-offset: 3px;
}

/* Prochain live : bulle blanche reprise de la bulle « On Air » du logo (queue en bas à gauche,
   texte dans les bleus du logo, légère inclinaison comme les éléments du logo). */
.prochain {
  --bleu-logo: #0c62f3;      /* logo : « Valentin » */
  --bleu-logo-fonce: #0953cf; /* logo : « On Air » */
  position: relative;
  margin: 22px 4px 18px; padding: 18px 22px 18px;
  border-radius: 28px;
  background: var(--blanc); color: var(--encre);
  transform: rotate(-1deg);
  filter: drop-shadow(0 8px 11px rgb(0 0 0 / 0.22)); /* ombre qui suit aussi la queue de la bulle */
}
.prochain::after { /* queue de la bulle, comme sous « On Air » : part de la droite du portrait et pointe vers son visage */
  content: ""; position: absolute; left: calc(var(--portrait) * 0.77); bottom: -15px;
  width: 30px; height: 16px;
  background: var(--blanc);
  clip-path: polygon(0 0, 100% 0, 0 100%);
}
.prochain p { margin: 0; }
.prochain__surtitre {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 0.8rem; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--bleu-logo-fonce);
}
.prochain__relatif:not(:empty) {
  padding: 2px 9px; border-radius: 999px;
  background: var(--bleu-logo); color: var(--blanc);
  text-transform: none; letter-spacing: 0;
}
.prochain__date {
  margin-top: 4px !important;
  font-size: clamp(1.5rem, 6.5vw, 2rem); font-weight: 850; line-height: 1.1;
  letter-spacing: -0.01em; /* grand texte : interlettrage légèrement resserré */
  color: var(--bleu-logo);
}
.prochain__titre {
  margin-top: 4px !important; font-weight: 600; color: var(--encre);
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow: hidden;
}
.prochain__titre[hidden], .prochain__actions[hidden], .prochain__decompte[hidden] { display: none; }
/* Compte à rebours : pastille bleue du logo, chiffres à chasse fixe (ne tremblent pas à chaque seconde). */
.prochain__decompte {
  display: inline-flex; align-items: baseline; flex-wrap: wrap; gap: 2px 8px;
  margin-top: 10px !important; padding: 6px 12px; border-radius: 12px;
  background: var(--bleu-logo); color: var(--blanc);
}
.prochain__decompte-libelle { font-size: 0.8rem; font-weight: 700; opacity: 0.85; }
.prochain__decompte-valeur { font-size: 1.15rem; font-weight: 850; white-space: nowrap; }
.chiffres { display: inline-block; text-align: right; }   /* 1ch = largeur du « 0 », le chiffre le plus large de Cosmic */
.chiffres--1 { min-width: 1ch; }
.chiffres--2 { min-width: 2ch; }
.prochain__actions { margin-top: 10px !important; }
.prochain__lien {
  touch-action: manipulation;
  color: var(--bleu-logo-fonce); font-size: 0.92rem; font-weight: 750;
  text-decoration-thickness: 2px; text-underline-offset: 3px;
}

/* Réseaux */
/* Titres de section (« Retrouvez-moi sur », « Planning ») */
.section-titre { margin: 0 0 10px; font-size: 1.15rem; font-weight: 800; }
.reseaux { margin-top: 26px; }
.prochain + .reseaux { margin-top: 0; } /* le portrait se glisse juste sous la queue de la bulle */
/* Portrait pixel art : posé sur la première carte (le bas du t-shirt passe derrière), regard vers le titre. */
.reseaux__entete { display: flex; align-items: flex-end; gap: 10px; margin-bottom: -8px; }
.reseaux__entete .section-titre { margin: 0 0 18px; }
.portrait {
  flex: none; width: var(--portrait); aspect-ratio: 330 / 300; margin-left: 2px;
  background: url("/assets/portrait.webp") 50% 100% / contain no-repeat;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
.reseaux ul { position: relative; z-index: 1; } /* les cartes passent devant le bas du portrait */
.reseaux ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.reseau {
  display: flex; align-items: center; gap: 14px;
  min-width: 0; min-height: 60px; padding: 12px 18px;
  border-radius: var(--rayon);
  background: var(--blanc); color: var(--encre);
  box-shadow: var(--ombre);
  text-decoration: none;
  touch-action: manipulation;
  -webkit-user-select: none; user-select: none;
  transition: transform 160ms var(--ease-out);
}
.reseau:active { transform: scale(0.97); }
@media (hover: hover) and (pointer: fine) {
  .reseau:hover { transform: translateY(-2px); }
  .reseau:hover:active { transform: translateY(-2px) scale(0.97); }
}
.reseau:focus-visible, .live__bouton:focus-visible, .evitement:focus-visible,
.prochain__lien:focus-visible, .contact__lien:focus-visible {
  outline: 3px solid var(--corail); outline-offset: 3px;
}
.reseau__icone { flex: none; width: 26px; height: 26px; color: var(--bleu); }
.reseau__icone svg { display: block; width: 100%; height: 100%; fill: currentColor; }
.reseau__nom { flex: none; font-weight: 700; font-size: 1.08rem; }
.reseau__lien {
  min-width: 0; margin-left: auto;
  font-size: 0.85rem; font-weight: 600; color: #5b5b66;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; /* sans JS : « … » ; avec reseaux.js : masqué s'il ne tient pas */
}
.reseau__lien[hidden] { display: none; }
.reseau__lien::after { content: " →"; color: var(--bleu); }

/* Pied de page : contact en liens simples, centrés */
.pied { margin-top: auto; padding-top: 40px; font-size: 0.85rem; font-weight: 600; text-align: center; }
.pied p { margin: 6px 0 0; opacity: 0.75; }
.contact { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; column-gap: 6px; }
.contact__lien {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 6px; /* cible de 44 px au doigt, sans cadre */
  color: var(--blanc); font-size: 1rem; font-weight: 700;
  text-decoration: underline; text-decoration-color: rgb(255 255 255 / 0.45);
  text-decoration-thickness: 2px; text-underline-offset: 4px;
  touch-action: manipulation;
  transition: opacity 160ms ease, text-decoration-color 160ms ease;
}
.contact__lien:active { opacity: 0.6; }
.contact__sep { color: rgb(255 255 255 / 0.6); font-weight: 700; } /* point entre les liens, hors soulignement */
@media (hover: hover) and (pointer: fine) {
  .contact__lien:hover { text-decoration-color: var(--blanc); }
}

/* Planning : lignes discrètes, sous les réseaux */
.planning { margin-top: 34px; }
.planning[hidden], .planning__liste[hidden] { display: none; }
.planning__liste { list-style: none; margin: 0; padding: 0; border-top: 1px solid rgb(255 255 255 / 0.25); }
.planning__ligne {
  display: grid; grid-template-columns: 7.2em 7.6em 1fr; gap: 4px 12px; align-items: baseline;
  padding: 11px 2px; border-bottom: 1px solid rgb(255 255 255 / 0.25);
}
.planning__jour { font-weight: 750; }
.planning__heure { font-variant-numeric: tabular-nums; opacity: 0.85; } /* « 20 h 00 » insécable (planning.js) ; coupure possible au tiret */
.planning__quoi { font-weight: 500; min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 480px) {
  .planning__ligne { grid-template-columns: 1fr auto; }
  .planning__quoi { grid-column: 1 / -1; }
}

@media (min-width: 760px) {
  body { padding-top: 40px; }
}

@media (prefers-reduced-motion: reduce) {
  /* Moins d'animations ne veut pas dire aucune : on retire les mouvements, on garde les fondus. */
  *, *::before, *::after { animation: none !important; transition-property: opacity, background-color, border-color, color !important; }
  .reseau:active { transform: none; }
}
