/* LE-RADAR — carte sports aux formats IAB.
   Tokens = identité (style.css) : pourpre, Inter, Source Serif 4, puces CTA. */

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: transparent;
}
a.ad {
  color: inherit;
  text-decoration: none;
  display: flex;
  width: 100%;
  height: 100%;
}

:root {
  --bg: #0e0f12;
  --bg-soft: #181a1e;
  --ink: #f1f2f4;
  --ink-soft: #c2c6cd;
  --muted: #888d96;
  --rule: rgba(255, 255, 255, 0.14);
  --accent: #cf7ec1;
  --live: #c8102e;
  --upcoming: #e8c07a;
  --past: #3d9a6a;
  --sports-tone: #66839e;
  --serif: "Source Serif 4", Georgia, serif;
  --sans: Inter, system-ui, sans-serif;
  --chip: rgba(42, 46, 54, 0.94);
  color-scheme: dark;
}

html[data-theme="light"] {
  --bg: #ffffff;
  --bg-soft: #f6f6f4;
  --ink: #16181c;
  --ink-soft: #44474d;
  --muted: #5f646c;
  --rule: #e7e7e3;
  --accent: #6c2163;
  --upcoming: #9a6900;
  --chip: #ffffff;
  color-scheme: light;
}

.ad {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  height: 100%;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1.5px solid color-mix(in srgb, var(--accent) 58%, var(--rule));
  background:
    linear-gradient(105deg, color-mix(in srgb, var(--sports-tone) 34%, transparent) 0%, transparent 55%),
    var(--chip);
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 0 0 1px color-mix(in srgb, var(--accent) 22%, transparent);
  color: var(--ink);
  font-family: var(--sans);
  animation: ad-rim 3.2s ease-in-out infinite;
}
.ad:hover {
  border-color: color-mix(in srgb, var(--accent) 72%, var(--rule));
  background:
    linear-gradient(105deg, color-mix(in srgb, var(--sports-tone) 40%, transparent) 0%, transparent 55%),
    var(--chip);
}
.ad:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 70%, #fff);
  outline-offset: 2px;
}
html[data-theme="light"] .ad {
  box-shadow:
    0 1px 2px rgba(22, 24, 28, 0.06),
    0 0 0 1px color-mix(in srgb, var(--accent) 16%, transparent);
  animation: ad-rim-light 3.2s ease-in-out infinite;
}
.ad[data-state="live"] {
  border-color: color-mix(in srgb, var(--live) 62%, var(--rule));
  animation: ad-live 2.6s ease-in-out infinite;
}

@keyframes ad-rim {
  0%, 100% {
    border-color: color-mix(in srgb, var(--accent) 52%, rgba(255, 255, 255, 0.2));
    box-shadow: 0 1px 2px rgba(0,0,0,.28), inset 0 1px 0 rgba(255,255,255,.12), 0 0 0 1px color-mix(in srgb, var(--accent) 18%, transparent);
  }
  50% {
    border-color: color-mix(in srgb, var(--accent) 78%, rgba(255, 255, 255, 0.3));
    box-shadow: 0 1px 2px rgba(0,0,0,.28), inset 0 1px 0 rgba(255,255,255,.14), 0 0 0 1px color-mix(in srgb, var(--accent) 36%, transparent), 0 0 10px 0 color-mix(in srgb, var(--accent) 22%, transparent);
  }
}
@keyframes ad-rim-light {
  0%, 100% { box-shadow: 0 1px 2px rgba(22,24,28,.06), 0 0 0 1px color-mix(in srgb, var(--accent) 14%, transparent); }
  50% { box-shadow: 0 1px 2px rgba(22,24,28,.08), 0 0 0 1px color-mix(in srgb, var(--accent) 32%, transparent); }
}
@keyframes ad-live {
  0%, 100% {
    border-color: color-mix(in srgb, var(--live) 55%, rgba(255, 255, 255, 0.18));
    box-shadow: 0 1px 2px rgba(0,0,0,.22), inset 0 1px 0 rgba(255,255,255,.1), 0 0 0 0 rgba(200,16,46,0);
  }
  50% {
    border-color: color-mix(in srgb, #ff3b4a 75%, rgba(255, 255, 255, 0.3));
    box-shadow: 0 1px 2px rgba(0,0,0,.22), inset 0 1px 0 rgba(255,255,255,.14), 0 0 0 2px rgba(200,16,46,.38), 0 0 12px rgba(200,16,46,.22);
  }
}
@keyframes ad-dot {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--upcoming) 50%, transparent); }
  100% { box-shadow: 0 0 0 6px transparent; }
}
@keyframes ad-dot-past {
  0% { box-shadow: 0 0 0 0 rgba(61, 154, 106, 0.55); }
  100% { box-shadow: 0 0 0 7px rgba(61, 154, 106, 0); }
}
@keyframes onairPulse {
  0% { box-shadow: 0 0 0 0 rgba(200, 16, 46, 0.45); }
  100% { box-shadow: 0 0 0 6px transparent; }
}

.ad-top, .ad-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  min-width: 0;
}
.ad-lockup {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 0 1 auto;
}
.ad-logo {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  border-radius: 5px;
}
.ad-word {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.02em;
  color: var(--ink);
}
.ad-tag {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 7px 2px 6px;
  border-radius: 3px;
  background: color-mix(in srgb, var(--accent) 42%, rgba(255, 255, 255, 0.14));
  color: #fff;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 28%, transparent);
}
html[data-theme="light"] .ad-tag {
  color: #fff;
  background: color-mix(in srgb, var(--accent) 82%, #16181c);
}
html[data-theme="light"] .ad-tag[data-lamp="live"] {
  background: var(--live);
}
.ad-tag::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--upcoming);
  animation: ad-dot 1.8s ease-out infinite;
}
.ad-tag[data-lamp="today"]::before { background: var(--live); animation: onairPulse 1.6s ease-out infinite; }
.ad-tag[data-lamp="past"]::before { background: var(--past); animation: ad-dot-past 1.8s ease-out infinite; }
.ad-tag[data-lamp="live"] {
  background: var(--live);
  font-weight: 900;
  box-shadow: none;
}
.ad-tag[data-lamp="live"]::before { background: #fff; animation: onairPulse 1.6s ease-out infinite; }
.ad-tag[data-lamp="brand"] {
  background: rgba(255, 255, 255, 0.12);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
  padding: 3px;
  gap: 0;
}
.ad-tag[data-lamp="brand"]::before { display: none; }
html[data-theme="light"] .ad-tag[data-lamp="brand"] {
  background: color-mix(in srgb, var(--accent) 12%, var(--bg-soft));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 22%, transparent);
}
.ad-tag-logo {
  width: 18px;
  height: 18px;
  display: block;
  border-radius: 4px;
}

.ad-stage {
  position: relative;
  display: grid;
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}
.ad-face {
  grid-area: 1 / 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  transition: none;
}
.ad-face.is-front { z-index: 1; }
.ad-face.is-rolling-out {
  z-index: 1;
  animation: ad-roll-out 0.28s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.ad-face.is-rolling-in {
  z-index: 2;
  animation: ad-roll-in 0.28s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
@keyframes ad-roll-out {
  0% { transform: translateY(0); opacity: 1; }
  55% { opacity: 1; }
  100% { transform: translateY(-70%); opacity: 0; }
}
@keyframes ad-roll-in {
  0% { transform: translateY(70%); opacity: 0; }
  45% { opacity: 1; }
  100% { transform: translateY(0); opacity: 1; }
}

.ad-kicker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.ad-board {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
  min-width: 0;
}
.ad-hero {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1.35rem;
  line-height: 1.15;
  color: var(--ink);
  overflow: hidden;
}
.ad-verb {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: none;
  color: color-mix(in srgb, var(--ink) 50%, transparent);
}
.ad-score {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--serif);
  font-size: 1.7rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--ink);
  text-transform: none;
}
.ad[data-res="W"] .ad-score { color: var(--past); }
.ad[data-res="L"] .ad-score { color: #c45c5c; }
.ad-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.15rem;
  height: 1.15rem;
  padding: 0 4px;
  border-radius: 3px;
  font-family: var(--sans);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #fff;
  background: #2f8f5b;
}
.ad-badge--l { background: #b84848; }
.ad-badge--d { background: #6b7c8c; }
.ad-brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.ad-brand-lockup .ad-logo {
  width: 28px;
  height: 28px;
  border-radius: 7px;
}
.ad-brand-lockup .ad-word {
  font-size: 1.35rem;
}
.ad-brand-long {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1.3;
  color: var(--ink-soft);
}
.ad-sub, .ad-foot, .ad-meta, .ad-school {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  overflow: hidden;
}
.ad-school { font-size: 11px; color: var(--ink-soft); }
.ad-fill {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
}
.ad-ribbon {
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.01em;
  line-height: 1.3;
  color: var(--ink-soft);
  flex: 0 0 auto;
}
.ad-foot { justify-content: space-between; }

@media (prefers-reduced-motion: reduce) {
  .ad, .ad-tag::before { animation: none; }
  .ad-face.is-rolling-out, .ad-face.is-rolling-in { animation: none; opacity: 1; transform: none; }
}

/* 300×250 MPU */
html[data-fmt="300x250"] { width: 300px; height: 250px; }
html[data-fmt="300x250"] .ad { padding: 12px 12px 10px; gap: 8px; }
html[data-fmt="300x250"] .ad-hero { font-size: 1.35rem; }
html[data-fmt="300x250"] .ad-face { gap: 6px; justify-content: flex-start; }
html[data-fmt="300x250"] .ad-ribbon { margin-top: auto; font-size: 11px; }

/* 336×280 */
html[data-fmt="336x280"] { width: 336px; height: 280px; }
html[data-fmt="336x280"] .ad { padding: 14px 14px 12px; gap: 10px; }
html[data-fmt="336x280"] .ad-hero { font-size: 1.5rem; }
html[data-fmt="336x280"] .ad-score { font-size: 2rem; }
html[data-fmt="336x280"] .ad-face { gap: 7px; }
html[data-fmt="336x280"] .ad-ribbon { margin-top: auto; font-size: 12px; }

/* 728×90 leaderboard — trois lignes dans le plateau, plus de vide à droite */
html[data-fmt="728x90"] { width: 728px; height: 90px; }
html[data-fmt="728x90"] .ad {
  flex-direction: row;
  align-items: stretch;
  gap: 12px;
  padding: 8px 12px;
  border-radius: 12px;
}
html[data-fmt="728x90"] .ad-top {
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 4px;
  width: auto;
  flex: 0 0 auto;
  align-self: center;
}
html[data-fmt="728x90"] .ad-tag { margin-left: 0; }
html[data-fmt="728x90"] .ad-word { font-size: 12px; }
html[data-fmt="728x90"] .ad-stage { flex: 1 1 auto; min-width: 0; }
html[data-fmt="728x90"] .ad-face {
  flex-direction: column;
  justify-content: center;
  align-items: stretch;
  gap: 2px;
}
html[data-fmt="728x90"] .ad-board {
  flex-direction: row;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}
html[data-fmt="728x90"] .ad-hero { font-size: 1.2rem; white-space: nowrap; }
html[data-fmt="728x90"] .ad-verb { font-size: 12px; }
html[data-fmt="728x90"] .ad-score { font-size: 1.2rem; }
html[data-fmt="728x90"] .ad-kicker { font-size: 9px; letter-spacing: 0.06em; }
html[data-fmt="728x90"] .ad-fill { flex: 0 1 auto; justify-content: flex-start; gap: 2px; }
html[data-fmt="728x90"] .ad-meta { font-size: 11px; white-space: nowrap; overflow: hidden; }
html[data-fmt="728x90"] .ad-ribbon {
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0;
  white-space: nowrap;
}
html[data-fmt="728x90"] .ad-school,
html[data-fmt="728x90"] .ad-foot { display: none; }
html[data-fmt="728x90"] .ad-brand-lockup .ad-word { font-size: 1.05rem; }
html[data-fmt="728x90"] .ad-brand-long { font-size: 0.78rem; }

/* 320×50 mobile — noms + bandeau sports QC */
html[data-fmt="320x50"] { width: 320px; height: 50px; }
html[data-fmt="320x50"] .ad {
  flex-direction: row;
  align-items: stretch;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 8px;
}
html[data-fmt="320x50"] .ad-top { align-self: center; gap: 5px; }
html[data-fmt="320x50"] .ad-word,
html[data-fmt="320x50"] .ad-foot,
html[data-fmt="320x50"] .ad-brand-long,
html[data-fmt="320x50"] .ad-kicker,
html[data-fmt="320x50"] .ad-meta,
html[data-fmt="320x50"] .ad-school { display: none; }
html[data-fmt="320x50"] .ad-brand-lockup .ad-word { display: inline; font-size: 12px; }
html[data-fmt="320x50"] .ad-brand-lockup .ad-logo { width: 16px; height: 16px; }
html[data-fmt="320x50"] .ad-logo { width: 16px; height: 16px; }
html[data-fmt="320x50"] .ad-tag { font-size: 8px; padding: 1px 5px; }
html[data-fmt="320x50"] .ad-tag-logo { width: 14px; height: 14px; }
html[data-fmt="320x50"] .ad-stage { flex: 1 1 auto; min-width: 0; }
html[data-fmt="320x50"] .ad-face {
  flex-direction: column;
  justify-content: center;
  gap: 1px;
}
html[data-fmt="320x50"] .ad-board { flex-direction: row; align-items: baseline; gap: 5px; }
html[data-fmt="320x50"] .ad-hero { font-size: 12px; font-family: var(--sans); white-space: nowrap; }
html[data-fmt="320x50"] .ad-score { font-size: 12px; font-family: var(--sans); }
html[data-fmt="320x50"] .ad-verb { font-size: 10px; }
html[data-fmt="320x50"] .ad-ribbon {
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
html[data-fmt="320x50"] .ad-badge { min-width: 1rem; height: 1rem; font-size: 8px; }

/* 300×600 half-page */
html[data-fmt="300x600"] { width: 300px; height: 600px; }
html[data-fmt="300x600"] .ad { padding: 18px 16px 16px; gap: 12px; border-radius: 16px; }
html[data-fmt="300x600"] .ad-word { font-size: 16px; }
html[data-fmt="300x600"] .ad-logo { width: 28px; height: 28px; border-radius: 7px; }
html[data-fmt="300x600"] .ad-face { gap: 10px; justify-content: flex-start; }
html[data-fmt="300x600"] .ad-kicker { font-size: 12px; }
html[data-fmt="300x600"] .ad-hero { font-size: 2rem; }
html[data-fmt="300x600"] .ad-score { font-size: 2.4rem; padding: 6px 0; }
html[data-fmt="300x600"] .ad-verb { font-size: 14px; }
html[data-fmt="300x600"] .ad-meta,
html[data-fmt="300x600"] .ad-school { font-size: 13px; line-height: 1.4; }
html[data-fmt="300x600"] .ad-ribbon {
  margin-top: auto;
  font-size: 14px;
  line-height: 1.35;
  color: var(--ink);
}
html[data-fmt="300x600"] .ad-foot { font-size: 12px; }
html[data-fmt="300x600"] .ad-badge { min-width: 1.4rem; height: 1.4rem; font-size: 11px; }

/* 160×600 skyscraper */
html[data-fmt="160x600"] { width: 160px; height: 600px; }
html[data-fmt="160x600"] .ad { padding: 12px 10px 12px; gap: 10px; border-radius: 12px; }
html[data-fmt="160x600"] .ad-top { flex-wrap: wrap; }
html[data-fmt="160x600"] .ad-word { font-size: 11px; }
html[data-fmt="160x600"] .ad-tag { margin-left: 0; }
html[data-fmt="160x600"] .ad-face { gap: 8px; }
html[data-fmt="160x600"] .ad-hero { font-size: 1.15rem; }
html[data-fmt="160x600"] .ad-score { font-size: 1.45rem; }
html[data-fmt="160x600"] .ad-meta,
html[data-fmt="160x600"] .ad-school { font-size: 10px; line-height: 1.35; }
html[data-fmt="160x600"] .ad-ribbon {
  margin-top: auto;
  font-size: 10.5px;
  line-height: 1.35;
  overflow-wrap: break-word;
  word-break: normal;
}
html[data-fmt="160x600"] .ad-foot { font-size: 9px; }

/* Labo focus-group : options A–E (dev/sports-iframe-lab.html). */
html[data-fg="C"] .ad-lockup { display: none; }
html[data-fg="C"] .ad-kicker { display: none; }
html[data-fg="C"] .ad-board--line {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
}
html[data-fg="C"] .ad-hero { font-size: 1.15rem; }
html[data-fg="C"] .ad-foot { display: flex !important; }
html[data-fg="D"] .ad:not([data-state="idle"]) .ad-top .ad-lockup { display: none; }
html[data-fg="D"] .ad:not([data-state="idle"]) .ad-hero { font-size: 1.7rem; }
html[data-fg="D"] .ad:not([data-state="idle"]) .ad-kicker { font-size: 12px; }
