/* Bloc ajouté à la page projet After TV (scripts/poser-after-tv.mjs, interaction dans after-tv.js).
   Fiche technique : encre sur blanc, filets plutôt qu'ombres, chiffres tabulaires, la seule couleur vient des loops.
   Pas de kit de composants sur ce site : tout ce qui suit est local à la page et préfixé atv-. */

.atv {
  --atv-encre: oklch(20% 0 0);
  --atv-encre-douce: oklch(45% 0 0);
  --atv-filet: oklch(20% 0 0 / 0.16);
  --atv-attente: oklch(93% 0 0);
  --atv-scene: oklch(13% 0 0);
  --atv-papier: oklch(99% 0 0);
  --atv-ease: cubic-bezier(0.23, 1, 0.32, 1);
  --atv-court: 160ms;
  --atv-moyen: 200ms;
  --atv-marge: 6vw;
  padding: clamp(3rem, 6vw, 6rem) var(--atv-marge) clamp(2rem, 4vw, 4rem);
  font-family: aktiv-grotesk, sans-serif;
  color: var(--atv-encre);
  display: grid;
  row-gap: clamp(4rem, 8vw, 8rem);
}
.atv [hidden] { display: none !important; }
.atv-bloc { max-width: 72rem; min-width: 0; }

.atv .atv-titre { margin: 0; font-size: clamp(1.9rem, 4vw, 3.4rem); font-weight: 700; line-height: 1.05; letter-spacing: -0.01em; text-wrap: balance; overflow-wrap: break-word; }
.atv .atv-texte { margin: 1.1em 0 0; font-size: clamp(1rem, 1.3vw, 1.15rem); line-height: 1.6; max-width: 42rem; text-wrap: pretty; }
.atv .atv-note { margin: 1rem 0 0; color: var(--atv-encre-douce); font-size: 0.875rem; line-height: 1.5; max-width: 40rem; text-wrap: pretty; }
.atv .atv-action { margin: clamp(2rem, 3vw, 2.5rem) 0 0; font-size: 1.05rem; font-weight: 600; }
.atv .atv-action a { color: inherit; text-underline-offset: 0.2em; display: inline-flex; align-items: center; gap: 0.35em; min-height: 44px; }
.atv .atv-sous-titre { margin: 0 0 1.25rem; font-size: 1.1rem; font-weight: 700; line-height: 1.3; }

.atv button { font: inherit; letter-spacing: normal; text-transform: none; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.atv button:focus-visible, .atv a:focus-visible { outline: 2px solid var(--atv-encre); outline-offset: 3px; }

/* 1. Ouverture : texte à gauche, chiffres à droite. */
.atv-intro { display: grid; gap: clamp(2rem, 4vw, 4rem); }
@media (min-width: 64rem) { .atv-intro { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); align-items: end; } }
.atv-chiffres { margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 1.25rem; }
.atv-chiffres > div { display: flex; flex-direction: column; border-top: 1px solid var(--atv-filet); padding: 0.9rem 0 1.25rem; }
.atv-chiffres dd { order: -1; margin: 0; font-size: clamp(1.6rem, 3vw, 2.5rem); font-weight: 700; line-height: 1; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.atv-chiffres dt { margin-top: 0.5rem; font-size: 0.875rem; line-height: 1.4; color: var(--atv-encre-douce); }
.atv-intro .atv-note { margin-top: 0.25rem; }

/* 2. Tags : capture, puis matrice (collante sur grand écran) à côté des loops. */
.atv-capture { margin: clamp(1.5rem, 3vw, 2.5rem) 0 0; }
.atv-capture img { display: block; width: 100%; height: auto; border-radius: 6px; background: #0f1113; }
.atv-capture figcaption { margin-top: 0.75rem; color: var(--atv-encre-douce); font-size: 0.875rem; max-width: 42rem; }

.atv-tags-corps { display: grid; gap: clamp(2.5rem, 5vw, 4rem); margin-top: clamp(3rem, 5vw, 4.5rem); }
@media (min-width: 64rem) {
  .atv-tags-corps { grid-template-columns: minmax(0, 22rem) minmax(0, 1fr); }
  .atv-filtre { position: sticky; top: 6rem; align-self: start; }
}

.atv-matrice { width: 100%; border-collapse: separate; border-spacing: 3px; table-layout: fixed; margin: 0 -3px; font-variant-numeric: tabular-nums; }
.atv-matrice caption { caption-side: top; text-align: left; padding: 0 3px 0.9rem; font-size: 0.875rem; line-height: 1.5; color: var(--atv-encre-douce); }
.atv-matrice th { font-size: 0.75rem; font-weight: 600; line-height: 1.2; text-align: left; vertical-align: bottom; padding: 0 0 0.35rem; }
.atv-matrice thead th:first-child { width: 3.9rem; }
.atv-matrice thead th:first-child { color: var(--atv-encre-douce); font-weight: 400; }
.atv-matrice tbody th { vertical-align: middle; padding: 0 0.4rem 0 0; }
.atv-matrice th span { display: block; font-weight: 400; color: var(--atv-encre-douce); margin-top: 0.15rem; }
.atv-matrice td {
  height: 48px; padding: 0; text-align: center; font-weight: 600; font-size: 0.95rem; border-radius: 3px;
  background: oklch(var(--atv-l, 95%) 0 0);
  color: var(--atv-encre);
}
.atv-matrice td.atv-sombre { color: var(--atv-papier); }
.atv-cellule {
  display: block; width: 100%; height: 100%; min-height: 48px; padding: 0; border: 0; border-radius: 3px;
  background: transparent; color: inherit; font-weight: inherit;
  transition: transform var(--atv-court) var(--atv-ease), box-shadow var(--atv-court) var(--atv-ease);
}
.atv-cellule:active { transform: scale(0.97); }
.atv-cellule[aria-pressed="true"] { box-shadow: inset 0 0 0 3px currentColor; }
@media (hover: hover) { .atv-cellule:hover { box-shadow: inset 0 0 0 1px currentColor; } .atv-cellule[aria-pressed="true"]:hover { box-shadow: inset 0 0 0 3px currentColor; } }
.atv .atv-statut { margin: 1rem 0 0; min-height: 3em; font-size: 0.95rem; line-height: 1.5; }
.atv-lien { display: inline-flex; align-items: center; min-height: 44px; padding: 0; border: 0; background: none; color: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 0.2em; }

.atv-grille {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: clamp(1.5rem, 2.5vw, 2rem) clamp(1rem, 2vw, 1.5rem);
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 14.5rem), 1fr));
}
.atv-loop { min-width: 0; transition: opacity var(--atv-moyen) var(--atv-ease); }
.atv-loop[data-ecarte] { opacity: 0.25; }
.atv-ecran { position: relative; }
.atv-ecran video { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: var(--atv-attente); border-radius: 4px; }
.atv-lire { position: absolute; inset: 0; border: 0; padding: 0; background: none; border-radius: 4px; }
/* Signe lecture, visible seulement à l'arrêt. */
.atv-lire::after {
  content: ""; position: absolute; left: 0.6rem; bottom: 0.6rem; width: 1.9rem; height: 1.9rem; border-radius: 50%;
  background: oklch(13% 0 0 / 0.72) no-repeat 56% 50% / 0.7rem 0.8rem
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 7 8'%3E%3Cpath d='M0 0l7 4-7 4z' fill='%23fff'/%3E%3C/svg%3E");
  transition: opacity var(--atv-court) var(--atv-ease), transform var(--atv-court) var(--atv-ease);
}
.atv-lire[aria-pressed="true"]::after { opacity: 0; transform: scale(0.9); }
.atv-lire:active::after { transform: scale(0.94); }
.atv-lire:focus-visible { outline-offset: 2px; }

.atv .atv-nom { margin: 0.7rem 0 0.4rem; font-size: 1rem; font-weight: 700; line-height: 1.3; }
.atv-tags { margin: 0; display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 0.75rem; row-gap: 0.15rem; font-size: 0.875rem; line-height: 1.4; }
.atv-tags > div { display: contents; }
.atv-tags dt { color: var(--atv-encre-douce); }
.atv-tags dd { margin: 0; }
.atv .atv-mesures { margin: 0.5rem 0 0; padding-top: 0.5rem; border-top: 1px solid var(--atv-filet); font-size: 0.8rem; line-height: 1.5; color: var(--atv-encre-douce); font-variant-numeric: tabular-nums; }
.atv-pastille { display: inline-block; width: 0.7em; height: 0.7em; margin-right: 0.3em; border-radius: 50%; vertical-align: -0.05em; background: oklch(68% 0.15 var(--atv-h)); }
.atv-pastille-neutre { background: none; box-shadow: inset 0 0 0 1px var(--atv-encre-douce); }

/* Petit écran : vignette à gauche, fiche à droite, pour que les 9 loops tiennent dans un défilement court. */
@media (max-width: 40rem) {
  .atv-grille { grid-template-columns: minmax(0, 1fr); }
  .atv-loop { display: grid; grid-template-columns: 8.5rem minmax(0, 1fr); column-gap: 0.9rem; align-items: start; }
  .atv .atv-nom { margin-top: 0; }
  .atv-matrice th { font-size: clamp(0.66rem, 2.9vw, 0.75rem); }
  .atv-matrice thead th:first-child { width: 3.2rem; }
}

/* 3. Simulateur : scène à gauche, commandes à droite. */
.atv-console { display: grid; gap: clamp(1.5rem, 3vw, 2.5rem); margin-top: clamp(1.75rem, 3vw, 2.5rem); }
@media (min-width: 64rem) { .atv-console { grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); align-items: start; } }
.atv-scene { position: relative; aspect-ratio: 16 / 9; background: var(--atv-scene); border-radius: 4px; overflow: hidden; isolation: isolate; }
.atv-calque { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity var(--atv-moyen) var(--atv-ease); }
.atv-calque[data-plein] { opacity: 1; }
.atv-calque-ecran { mix-blend-mode: screen; }
.atv .atv-attente { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; padding: 1rem; text-align: center; color: oklch(80% 0 0); font-size: 0.95rem; }
.atv-flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
/* Deux flashs par seconde : sous la limite de trois par seconde (WCAG 2.3.1). */
.atv-scene[data-strobo="on"] .atv-flash { animation: atv-flash 500ms steps(1, end) infinite; }
@keyframes atv-flash { 0% { opacity: 0.8; } 12% { opacity: 0; } 100% { opacity: 0; } }
.atv .atv-calques { margin: 0.6rem 0 0; min-height: 1.5em; font-size: 0.875rem; color: var(--atv-encre-douce); font-variant-numeric: tabular-nums; }

.atv-commandes { display: grid; gap: 1.5rem; }
.atv .atv-etiquette { margin: 0 0 0.5rem; font-size: 0.75rem; line-height: 1.2; letter-spacing: 0.1em; text-transform: uppercase; color: var(--atv-encre-douce); }
.atv-segments { display: flex; border: 1px solid var(--atv-encre); border-radius: 4px; overflow: hidden; }
.atv-segments button {
  flex: 1 1 0; min-width: 0; min-height: 44px; padding: 0 0.5rem; border: 0; background: var(--atv-papier); color: var(--atv-encre); font-weight: 600;
  transition: background-color var(--atv-court) var(--atv-ease), color var(--atv-court) var(--atv-ease), transform var(--atv-court) var(--atv-ease);
}
.atv-segments button + button { border-left: 1px solid var(--atv-encre); }
.atv-segments button[aria-pressed="true"] { background: var(--atv-encre); color: var(--atv-papier); }
.atv-segments button:active { transform: scale(0.97); }
.atv-segments button:focus-visible { outline-offset: -4px; outline-color: currentColor; }

.atv-options { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.atv-bascule, .atv-tirage {
  display: inline-flex; align-items: center; gap: 0.5rem; min-height: 44px; padding: 0 0.9rem;
  border: 1px solid var(--atv-filet); border-radius: 4px; background: var(--atv-papier); color: var(--atv-encre); font-weight: 600;
  transition: border-color var(--atv-court) var(--atv-ease), transform var(--atv-court) var(--atv-ease);
}
.atv-bascule::before { content: ""; width: 0.65rem; height: 0.65rem; border-radius: 2px; box-shadow: inset 0 0 0 1.5px currentColor; transition: background-color var(--atv-court) var(--atv-ease); }
.atv-bascule[aria-pressed="true"] { border-color: var(--atv-encre); }
.atv-bascule[aria-pressed="true"]::before { background: currentColor; }
.atv-bascule:active:not(:disabled), .atv-tirage:active:not(:disabled) { transform: scale(0.97); }
.atv-bascule:disabled, .atv-tirage:disabled { color: var(--atv-encre-douce); border-style: dashed; cursor: not-allowed; }
.atv-options + .atv-note { margin-top: 0.5rem; }
.atv-resultat { border-top: 1px solid var(--atv-filet); padding-top: 1rem; min-height: 5.5rem; }
.atv-resultat p { margin: 0; font-size: 1rem; line-height: 1.5; font-weight: 600; }
.atv-resultat .atv-note { margin-top: 0.4rem; font-weight: 400; }

@media (prefers-reduced-motion: reduce) {
  .atv-scene .atv-flash { animation: none !important; }
  .atv-loop, .atv-calque, .atv-cellule, .atv-segments button, .atv-bascule, .atv-tirage, .atv-lire::after { transition: none; }
}
@media (forced-colors: active) {
  .atv-cellule[aria-pressed="true"], .atv-segments button[aria-pressed="true"] { outline: 3px solid Highlight; }
}
