/* ==========================================================================
 * VALORANT — « Protocole »  ·  theme.css
 * HUD tactique : angles chanfreinés à 45°, filets fins à graduations,
 * losange (spike), balayages rouges nets. Aucune image officielle :
 * tout est dessiné en CSS / SVG.
 * ========================================================================== */

:root {
  /* Couleurs */
  --ink: #0F1923;      /* fond */
  --steel: #1C2733;    /* panneaux */
  --line: #2E3B48;     /* filets */
  --bone: #ECE8E1;     /* texte */
  --strike: #FF4655;   /* rouge attaque — accent principal */
  --defend: #3FE0C5;   /* turquoise défense — rare, états positifs */
  --mist: #8B978F;     /* libellés */

  --ink-a: rgba(15, 25, 35, .9);
  --steel-a: rgba(28, 39, 51, .92);
  --strike-a: rgba(255, 70, 85, .18);

  /* Typo */
  --f-display: 'Big Shoulders Display', 'Bahnschrift', 'Arial Narrow', Impact, sans-serif;
  --f-body: 'Barlow Semi Condensed', 'Bahnschrift', 'Segoe UI', Arial, sans-serif;
  --f-num: 'Barlow Condensed', 'Bahnschrift SemiCondensed', 'Arial Narrow', sans-serif;

  /* Mouvement */
  --ease: cubic-bezier(.7, 0, .2, 1);       /* sec, tactique */
  --ease-out: cubic-bezier(.16, .84, .3, 1);

  --ch: 14px;          /* taille du chanfrein */
}

body {
  font-family: var(--f-body);
  font-weight: 500;
  color: var(--bone);
}

/* ---------- Chanfreins ---------- */
.vp-cham {   /* coin haut-gauche + bas-droit */
  clip-path: polygon(var(--ch) 0, 100% 0, 100% calc(100% - var(--ch)), calc(100% - var(--ch)) 100%, 0 100%, 0 var(--ch));
}
.vp-cham-r { /* coin haut-droit + bas-gauche */
  clip-path: polygon(0 0, calc(100% - var(--ch)) 0, 100% var(--ch), 100% 100%, var(--ch) 100%, 0 calc(100% - var(--ch)));
}
.vp-cham-br { /* uniquement bas-droit */
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - var(--ch)), calc(100% - var(--ch)) 100%, 0 100%);
}

/* ---------- Libellés & chiffres ---------- */
.vp-label {
  font-family: var(--f-num);
  font-weight: 600;
  font-size: 20px;              /* plancher de lisibilité (≈13 px en 720p) */
  line-height: 1;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--mist);
}
.vp-num {
  font-family: var(--f-num);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: .01em;
}
.vp-display {
  font-family: var(--f-display);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: -.005em;
  line-height: .86;
}

/* ---------- Losange (spike) ---------- */
.vp-dia {
  display: inline-block;
  width: .5em;
  height: .5em;
  transform: rotate(45deg);
  background: var(--strike);
  flex: none;
}
.vp-dia.is-hollow { background: none; box-shadow: inset 0 0 0 2px currentColor; }

/* Pastille « en direct » */
.vp-pip {
  display: inline-block;
  width: 10px; height: 10px;
  background: var(--strike);
  transform: rotate(45deg);
  animation: vp-pip 1.6s steps(1, end) infinite;
  flex: none;
}
@keyframes vp-pip { 0%, 60% { opacity: 1; } 61%, 100% { opacity: .25; } }

/* Filet horizontal gradué */
.vp-rule {
  position: relative;
  height: 1px;
  background: var(--line);
}
.vp-rule::after {
  content: '';
  position: absolute;
  left: 0; right: 0; top: 1px;
  height: 6px;
  background: repeating-linear-gradient(90deg, var(--line) 0 1px, transparent 1px 24px);
}

/* ==========================================================================
 * Terrain de fond (scènes pleines) : courbes de niveau + grille + repères
 * ========================================================================== */
.vp-field {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background:
    radial-gradient(ellipse 70% 60% at 50% 42%, rgba(28, 39, 51, .9), rgba(15, 25, 35, 0) 70%),
    var(--ink);
}
.vp-topo {
  position: absolute;
  inset: -40px;
  background: url('topo.svg') center / cover no-repeat;
  animation: vp-topo 90s ease-in-out infinite alternate;
  will-change: transform;
}
@keyframes vp-topo { from { transform: translate3d(-20px, 10px, 0); } to { transform: translate3d(20px, -14px, 0); } }

.vp-grid {
  position: absolute;
  inset: 0;
  background:
    /* croix aux intersections */
    radial-gradient(circle at 0 0, rgba(236, 232, 225, .22) 0 1.5px, transparent 2px) 0 0 / 192px 108px,
    linear-gradient(rgba(46, 59, 72, .45) 1px, transparent 1px) 0 0 / 100% 108px,
    linear-gradient(90deg, rgba(46, 59, 72, .45) 1px, transparent 1px) 0 0 / 192px 100%;
}
.vp-vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 80% 75% at 50% 50%, transparent 55%, rgba(5, 10, 15, .75) 100%);
}

/* Repères de carte qui dérivent lentement */
.vp-callouts { position: absolute; inset: 0; }
.vp-callout {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--f-num);
  font-weight: 700;
  font-size: 20px;
  letter-spacing: .2em;
  color: rgba(139, 151, 143, .55);
  animation: vp-drift 46s ease-in-out infinite alternate;
  will-change: transform;
}
.vp-callout::before {
  content: '';
  width: 8px; height: 8px;
  border: 1px solid currentColor;
}
.vp-callout small {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .12em;
  color: rgba(139, 151, 143, .35);
}
.vp-callout.is-hot { color: rgba(255, 70, 85, .7); }
.vp-callout.is-hot::before { background: currentColor; animation: vp-ping 3.2s var(--ease) infinite; }
.vp-callout:nth-child(2n) { animation-duration: 58s; animation-direction: alternate-reverse; }
.vp-callout:nth-child(3n) { animation-duration: 64s; }
@keyframes vp-drift { from { transform: translate3d(-14px, 8px, 0); } to { transform: translate3d(18px, -10px, 0); } }
@keyframes vp-ping { 0%, 70%, 100% { box-shadow: 0 0 0 0 rgba(255, 70, 85, .6); } 35% { box-shadow: 0 0 0 10px rgba(255, 70, 85, 0); } }

/* Coins de cadre (scènes pleines) */
.vp-corners i {
  position: absolute;
  width: 36px; height: 36px;
  border: 0 solid rgba(236, 232, 225, .5);
}
.vp-corners i:nth-child(1) { left: 40px; top: 40px; border-left-width: 2px; border-top-width: 2px; }
.vp-corners i:nth-child(2) { right: 40px; top: 40px; border-right-width: 2px; border-top-width: 2px; }
.vp-corners i:nth-child(3) { left: 40px; bottom: 40px; border-left-width: 2px; border-bottom-width: 2px; }
.vp-corners i:nth-child(4) { right: 40px; bottom: 40px; border-right-width: 2px; border-bottom-width: 2px; }

/* Lectures de bord (petites infos dans les marges) */
.vp-edge {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: 560px;             /* ne passe jamais sous le module central */
  font-family: var(--f-num);
  font-weight: 600;
  font-size: 20px;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--mist);
  white-space: nowrap;
}
.vp-edge b { color: var(--bone); font-weight: 700; }
.vp-edge > b, .vp-edge > span:not(.vp-dia):not(.vp-pip) { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.vp-edge > b { flex-shrink: 0; max-width: 100%; }   /* la valeur en gras (pseudo…) passe avant le reste */

/* ==========================================================================
 * Composants partagés
 * ========================================================================== */

/* Onglet rouge (titre de phase) */
.vp-tab {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 10px 28px 9px;
  background: var(--strike);
  color: var(--ink);
  font-family: var(--f-display);
  font-weight: 800;
  font-size: 34px;
  line-height: 1;
  letter-spacing: .14em;
  text-transform: uppercase;
  --ch: 12px;
}

/* Soulignement rouge qui se trace */
.vp-strike {
  position: relative;
  height: 14px;
  background: var(--strike);
  transform-origin: 0 50%;
  clip-path: polygon(0 0, 100% 0, calc(100% - 14px) 100%, 0 100%);
}
.vp-strike::after { /* bord d'attaque lumineux */
  content: '';
  position: absolute;
  top: 0; bottom: 0; right: 0;
  width: 60px;
  background: linear-gradient(90deg, transparent, #fff);
  opacity: 0;
}
.vp-strike.is-in { animation: vp-strike-in 900ms var(--ease) both; }
.vp-strike.is-in::after { animation: vp-strike-glint 900ms var(--ease) both; }
@keyframes vp-strike-in { from { clip-path: polygon(0 0, 0 0, 0 100%, 0 100%); } to { clip-path: polygon(0 0, 100% 0, calc(100% - 14px) 100%, 0 100%); } }
@keyframes vp-strike-glint { 0% { opacity: 1; right: 100%; } 85% { opacity: 1; right: 0; } 100% { opacity: 0; right: 0; } }

/* Liste de réseaux */
.vp-soc {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}
.vp-soc-ico {
  display: grid;
  place-items: center;
  width: 44px; height: 44px;
  flex: none;
  background: var(--line);
  color: var(--bone);
  font-size: 24px;
  --ch: 8px;
}
.vp-soc-txt { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.vp-soc-lab { font-family: var(--f-num); font-weight: 600; font-size: 18px; letter-spacing: .2em; text-transform: uppercase; color: var(--mist); line-height: 1; }
.vp-soc-hdl { font-family: var(--f-body); font-weight: 600; font-size: 26px; line-height: 1.05; color: var(--bone); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ==========================================================================
 * Rotation de textes (OK.rotate) : balayage net plutôt que flou
 * ========================================================================== */
@keyframes vp-wipe-in {
  from { clip-path: inset(-30% 100% -30% 0); transform: translateX(-10px); }
  to   { clip-path: inset(-30% 0 -30% 0); transform: none; }
}
@keyframes vp-wipe-out {
  from { clip-path: inset(-30% 0 -30% 0); transform: none; }
  to   { clip-path: inset(-30% 0 -30% 100%); transform: translateX(10px); }
}
.ok-in  { animation: vp-wipe-in  var(--ok-dur, 450ms) var(--ease) both; }
.ok-out { animation: vp-wipe-out var(--ok-dur, 450ms) var(--ease) both; }

/* Balayages qui CONSERVENT les chanfreins (un clip-path d'animation remplace celui du chanfrein) */
@keyframes vp-cham-in {
  from { clip-path: polygon(0 0, 0 0, 0 calc(100% - var(--ch)), 0 100%, 0 100%, 0 var(--ch)); }
  to   { clip-path: polygon(var(--ch) 0, 100% 0, 100% calc(100% - var(--ch)), calc(100% - var(--ch)) 100%, 0 100%, 0 var(--ch)); }
}
@keyframes vp-cham-r-in {
  from { clip-path: polygon(0 0, 0 0, 0 var(--ch), 0 100%, 0 100%, 0 calc(100% - var(--ch))); }
  to   { clip-path: polygon(0 0, calc(100% - var(--ch)) 0, 100% var(--ch), 100% 100%, var(--ch) 100%, 0 calc(100% - var(--ch))); }
}
@keyframes vp-cham-l-in { /* pour les blocs chanfreinés côté droit qu'on fait entrer depuis la droite */
  from { clip-path: polygon(100% 0, 100% 0, 100% var(--ch), 100% 100%, 100% 100%, 100% calc(100% - var(--ch))); }
  to   { clip-path: polygon(0 0, calc(100% - var(--ch)) 0, 100% var(--ch), 100% 100%, var(--ch) 100%, 0 calc(100% - var(--ch))); }
}

@keyframes vp-cham-mid-in { /* ouverture depuis le centre, chanfreins conservés */
  from { clip-path: polygon(50% 0, 50% 0, 50% calc(100% - var(--ch)), 50% 100%, 50% 100%, 50% var(--ch)); }
  to   { clip-path: polygon(var(--ch) 0, 100% 0, 100% calc(100% - var(--ch)), calc(100% - var(--ch)) 100%, 0 100%, 0 var(--ch)); }
}

/* Contour sur les diagonales des chanfreins.
   Un contour en box-shadow inset est coupé par le clip-path : la diagonale resterait nue.
   .vp-ol redessine ce bout de trait (couleur --ol, épaisseur --olw). */
.vp-ol { position: relative; --ol: var(--line); --olw: 1px; }
.vp-ol::before {
  content: '';
  position: absolute; inset: 0;
  pointer-events: none;
  background:
    linear-gradient(135deg, transparent 50%, var(--ol) 50% calc(50% + var(--olw)), transparent 0) 0 0 / var(--ch) var(--ch) no-repeat,
    linear-gradient(135deg, transparent calc(50% - var(--olw)), var(--ol) 0 50%, transparent 0) 100% 100% / var(--ch) var(--ch) no-repeat;
}
.vp-ol.vp-cham-r::before {
  background:
    linear-gradient(45deg, transparent calc(50% - var(--olw)), var(--ol) 0 50%, transparent 0) 100% 0 / var(--ch) var(--ch) no-repeat,
    linear-gradient(45deg, transparent 50%, var(--ol) 50% calc(50% + var(--olw)), transparent 0) 0 100% / var(--ch) var(--ch) no-repeat;
}
.vp-ol.vp-cham-br::before {
  background: linear-gradient(135deg, transparent calc(50% - var(--olw)), var(--ol) 0 50%, transparent 0) 100% 100% / var(--ch) var(--ch) no-repeat;
}

/* Rangée paginée (VP.pager) : chaque élément garde sa largeur naturelle */
.vp-pager { display: flex; flex-wrap: nowrap; overflow: hidden; }
.vp-pager > * { flex: none; max-width: 100%; }

/* Repères de carte masqués quand ils chevauchent le contenu (VP.declutter) */
.vp-callout.is-off { visibility: hidden; }

/* Entrées échelonnées génériques */
@keyframes vp-rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes vp-wipe { from { clip-path: inset(-20% 100% -20% -10%); } to { clip-path: inset(-20% -10% -20% -10%); } } /* état final ouvert : rien n'est rogné */
@keyframes vp-fade { from { opacity: 0; } to { opacity: 1; } }
.vp-enter { animation: vp-rise 700ms var(--ease-out) both; animation-delay: var(--d, 0ms); }
.vp-enter-wipe { animation: vp-wipe 650ms var(--ease) both; animation-delay: var(--d, 0ms); }

/* Mouvements réduits : fondus simples, pas de dérive */
@media (prefers-reduced-motion: reduce) {
  .ok-in  { animation: ok-fade-in var(--ok-dur, 450ms) linear both; }
  .ok-out { animation: ok-fade-out var(--ok-dur, 450ms) linear both; }
  .vp-topo, .vp-callout { animation: none !important; }
  .vp-enter, .vp-enter-wipe { animation-name: vp-fade; }
}
html.ok-reduced .vp-topo, html.ok-reduced .vp-callout { animation: none !important; }

/* Aperçu sur iPhone (html.ok-leger, posé par OK.fitStage) : le WebKit d'iOS garde le texte zoomé au-dessus de ~9 px,
   la scène y est donc réduite par zoom 0,45 + scale(), et chaque calque composé coûte ~6× plus de mémoire qu'en zoom
   pur. La carte et les repères ne dérivent plus (sans calque animé dessous, grille et vignette plein cadre ne
   deviennent plus des calques) ; un flash fini ne reste pas un calque ; le grain argentique (invisible à cette
   taille) est retiré. Entrées, chrono, messages et photo de classe restent animés. */
html.ok-leger .vp-topo, html.ok-leger .vp-callout { animation: none; will-change: auto; }
html.ok-leger .cp-flash { display: none; }
html.ok-leger .cp-flash.go, html.ok-leger .cp-flash.snap { display: block; }
html.ok-leger .cp-grain, html.ok-leger .cp-veil, html.ok-leger .cp-vig { display: none; }
/* photo de classe : une rangée ou un retardataire posé ne reste pas un calque (la fin de leur entrée = leur style de
   base) ; ses canvas sont peints par le processeur (starting-page.js, ctx2d) : sinon voiles, chrono et pseudo
   posés dessus deviendraient des calques à la taille de la scène */
html.ok-leger .cp-row.in { opacity: 1; animation-fill-mode: backwards; }
html.ok-leger .cp-row > .cp-late { animation-fill-mode: backwards; }
