/* Tubesafari - refonte 2026. Dark UI, mobile first. */
:root {
  --ink: #0b0b0e;
  --surface: #14141a;
  --surface-2: #1d1d25;
  --line: #2a2a34;
  --text: #f4f4f7;
  --muted: #9191a0;
  --accent: #ccff3d;
  --accent-ink: #0b0b0e;
  --live: #ff4b3e;
  --radius: 14px;
  --head: 60px;
  --gap: 14px;
  --maxw: 1600px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --font: "Space Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; }

.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 16px; }

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* ---------- header ---------- */
.head {
  position: sticky; top: 0; z-index: 50;
  height: var(--head);
  display: flex; align-items: center;
  background: rgba(11, 11, 14, .88);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.head .wrap { display: flex; align-items: center; gap: 12px; }

.logo {
  display: flex; align-items: center; gap: 8px;
  font-weight: 700; font-size: 17px; letter-spacing: -.02em;
  flex: none;
}
.logo .mark {
  width: 26px; height: 26px; border-radius: 8px;
  background: var(--accent);
  display: grid; place-items: center;
  color: var(--accent-ink);
}
.logo .mark svg { width: 16px; height: 16px; }
.logo b { color: var(--accent); font-weight: 700; }

/* search */
.search { flex: 1 1 auto; min-width: 0; position: relative; }
.search input {
  width: 100%; height: 40px;
  padding: 0 44px 0 40px;
  background: var(--surface-2);
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--text); font: inherit;
  transition: border-color .2s var(--ease), background .2s var(--ease);
}
.search input::placeholder { color: var(--muted); }
.search input:focus { background: var(--surface); border-color: var(--line); outline: none; }
.search .ico { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--muted); pointer-events: none; }
.search .go {
  position: absolute; right: 5px; top: 5px;
  width: 30px; height: 30px; border: 0; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center;
}
.search .go svg { width: 15px; height: 15px; }

.nav { display: none; gap: 4px; flex: none; }
.nav a {
  padding: 8px 12px; border-radius: 10px;
  color: var(--muted); font-weight: 500; font-size: 14px;
  transition: color .15s var(--ease), background .15s var(--ease);
}
.nav a:hover { color: var(--text); background: var(--surface-2); }
.nav a.on { color: var(--accent-ink); background: var(--accent); }
.nav a.live-link { color: var(--text); }
.nav a.live-link::before {
  content: ""; display: inline-block; vertical-align: 1px;
  width: 7px; height: 7px; margin-right: 6px; border-radius: 50%;
  background: var(--live); box-shadow: 0 0 0 0 rgba(255, 75, 62, .7);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  70% { box-shadow: 0 0 0 7px rgba(255, 75, 62, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 75, 62, 0); }
}

.burger { display: grid; place-items: center; width: 38px; height: 38px; flex: none; background: var(--surface-2); border: 0; border-radius: 10px; }
.burger svg { width: 18px; height: 18px; }

@media (min-width: 900px) {
  .nav { display: flex; }
  .burger { display: none; }
  .search { max-width: 520px; margin: 0 auto; }
}

/* mobile drawer */
.drawer {
  position: fixed; inset: var(--head) 0 auto 0; z-index: 49;
  background: var(--surface); border-bottom: 1px solid var(--line);
  padding: 10px 16px 16px;
  display: none; flex-direction: column; gap: 2px;
}
.drawer.open { display: flex; }
.drawer a { padding: 12px 10px; border-radius: 10px; font-weight: 500; }
.drawer a:hover { background: var(--surface-2); }

/* ---------- hero ---------- */
.hero { position: relative; overflow: hidden; border-bottom: 1px solid var(--line); }
.hero::before {
  content: ""; position: absolute; inset: -40% -10% auto -10%; height: 420px;
  background:
    radial-gradient(42% 60% at 22% 40%, rgba(204, 255, 61, .16), transparent 70%),
    radial-gradient(38% 55% at 78% 30%, rgba(255, 75, 62, .13), transparent 70%);
  filter: blur(10px);
  pointer-events: none;
}
/* Bandeau d'arrivee reduit au strict necessaire : une barre de recherche. */
.hero .wrap { position: relative; padding: 30px 16px 26px; text-align: center; }
.hero h1 {
  margin: 0 0 16px;
  font-size: clamp(19px, 2.6vw, 26px);
  line-height: 1.2; letter-spacing: -.025em; font-weight: 700;
}
.hero h1 em { font-style: normal; color: var(--accent); }

.hero-search { max-width: 720px; margin: 0 auto; }
.hero-search input { height: 58px; font-size: 16px; padding-left: 50px; padding-right: 58px; border: 1px solid var(--line); background: var(--surface); }
.hero-search .ico { left: 19px; width: 20px; height: 20px; }
.hero-search .go { width: 46px; height: 46px; right: 6px; top: 6px; }
.hero-search .go svg { width: 18px; height: 18px; }

/* Carte categorie : meme composant que la carte video (meme taille de vignette,
   titre dessous), sans badge de duree. */
.card-title--cat { font-weight: 700; font-size: 16px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 18px; }
.chip {
  padding: 7px 14px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--line);
  color: var(--muted); font-size: 13px; font-weight: 500;
  transition: color .15s var(--ease), border-color .15s var(--ease), transform .15s var(--ease);
}
.chip:hover { color: var(--accent); border-color: var(--accent); transform: translateY(-1px); }

/* ---------- sections ---------- */
section { padding: 34px 0; }
.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.sec-head h2 { margin: 0; font-size: clamp(19px, 2.4vw, 25px); letter-spacing: -.025em; font-weight: 700; }
.sec-head h2 span { color: var(--muted); font-weight: 500; font-size: .62em; margin-left: 10px; letter-spacing: 0; }
.more { color: var(--accent); font-size: 14px; font-weight: 500; white-space: nowrap; }
.more:hover { text-decoration: underline; }

/* ---------- grid + card ---------- */
/* Vignettes volontairement grandes : la video d'abord. 1 colonne sur mobile,
   puis autant de colonnes que la largeur le permet a 340 px mini. */
.grid {
  display: grid; gap: var(--gap);
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
}
@media (min-width: 1000px) { .grid { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); } }

.card { min-width: 0; }

.card-media {
  position: relative; display: block;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface-2);
  touch-action: pan-y;
}
.card-media img {
  width: 100%; height: 100%; object-fit: cover;
}
.card:hover .card-media img { transform: scale(1.035); }
.card-media::after {
  content: ""; position: absolute; inset: 0;
  border: 1px solid rgba(255, 255, 255, .07); border-radius: var(--radius);
  pointer-events: none;
}

.dur {
  position: absolute; right: 7px; bottom: 7px;
  padding: 2px 7px; border-radius: 6px;
  background: rgba(11, 11, 14, .82);
  font-size: 12px; font-weight: 500; font-variant-numeric: tabular-nums;
  backdrop-filter: blur(4px);
  transition: opacity .15s linear;
}

/* Apercu video au survol : la video demarre dans la vignette, sans son. */
.card-media video {
  position: absolute; inset: 0;
  width: 100%; height: 100%; object-fit: cover;
  opacity: 0; transition: opacity .25s linear;
}
.card-media.previewing video { opacity: 1; }
.card-media.previewing img { opacity: 0; }
.card-media img { transition: transform .5s var(--ease), opacity .25s linear; }

.card-title {
  margin: 11px 0 5px;
  font-size: 15px; font-weight: 500; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-title a:hover { color: var(--accent); }
.card-meta { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px; }
.card-meta .src { color: var(--text); opacity: .72; }
.card-meta .sep { width: 3px; height: 3px; border-radius: 50%; background: currentColor; opacity: .5; }

/* ---------- filters ---------- */
.filters { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 20px; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.filters button {
  flex: none; padding: 8px 14px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--line);
  color: var(--muted); font-size: 13.5px; font-weight: 500;
  transition: color .15s var(--ease), background .15s var(--ease);
}
.filters button:hover { color: var(--text); }
.filters button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

/* ---------- page head ---------- */
.phead { padding: 30px 0 4px; }
.crumbs { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 13px; margin-bottom: 10px; }
.crumbs a:hover { color: var(--accent); }
.phead h1 { margin: 0 0 6px; font-size: clamp(24px, 4vw, 38px); letter-spacing: -.03em; font-weight: 700; }
.phead p { margin: 0; color: var(--muted); font-size: 14px; }

/* ---------- video page ---------- */
.player {
  position: relative; width: 100%; aspect-ratio: 16 / 9;
  max-height: 76vh; margin: 0 auto;
  background: #000; border-radius: var(--radius); overflow: hidden;
}
.player iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.vlayout { display: grid; gap: 28px; padding: 20px 0 40px; }
@media (min-width: 1100px) { .vlayout { grid-template-columns: minmax(0, 1fr) 340px; } }
.vmain h1 { margin: 18px 0 12px; font-size: clamp(19px, 2.4vw, 26px); line-height: 1.25; letter-spacing: -.02em; font-weight: 700; }
.vmeta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; color: var(--muted); font-size: 14px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.vmeta .src { color: var(--text); background: var(--surface-2); padding: 4px 10px; border-radius: 8px; font-size: 13px; }
.vtags { display: flex; flex-wrap: wrap; gap: 8px; padding: 16px 0 0; }
.aside h2 { margin: 0 0 14px; font-size: 16px; font-weight: 700; letter-spacing: -.02em; }
.aside .grid { grid-template-columns: 1fr; }
@media (min-width: 560px) and (max-width: 1099px) { .aside .grid { grid-template-columns: repeat(auto-fill, minmax(248px, 1fr)); } }

/* ---------- a-z index ---------- */
.az { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 26px; }
.az a { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 9px; background: var(--surface-2); color: var(--muted); font-size: 13px; font-weight: 500; }
.az a:hover { background: var(--accent); color: var(--accent-ink); }
.letter { margin: 0 0 12px; font-size: 20px; font-weight: 700; color: var(--accent); }
.catlist { columns: 2; column-gap: 24px; margin-bottom: 30px; }
@media (min-width: 700px) { .catlist { columns: 4; } }
@media (min-width: 1100px) { .catlist { columns: 6; } }
.catlist a { display: block; padding: 5px 0; color: var(--muted); font-size: 14px; break-inside: avoid; }
.catlist a:hover { color: var(--accent); }

/* ---------- footer ---------- */
.foot { border-top: 1px solid var(--line); padding: 32px 0 44px; color: var(--muted); font-size: 13px; }
.foot .cols { display: grid; gap: 22px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin-bottom: 28px; }
.foot h3 { margin: 0 0 10px; font-size: 13px; font-weight: 700; color: var(--text); text-transform: uppercase; letter-spacing: .08em; }
.foot a { display: block; padding: 3px 0; }
.foot a:hover { color: var(--accent); }
.foot .legal { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding-top: 20px; border-top: 1px solid var(--line); line-height: 1.6; }
.rta { padding: 4px 9px; border: 1px solid var(--line); border-radius: 6px; font-size: 11px; font-weight: 700; letter-spacing: .06em; }

/* ---------- lecteur maison : zero preroll, zero popunder ---------- */
.player video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }

.player .demo-badge {
  position: absolute; top: 12px; left: 12px; z-index: 3;
  display: flex; align-items: center; gap: 7px;
  padding: 6px 11px; border-radius: 999px;
  background: rgba(11, 11, 14, .72); backdrop-filter: blur(6px);
  border: 1px solid var(--line);
  font-size: 11.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
}
.player .demo-badge b { color: var(--accent); }

/* bouton play central */
.pbig {
  position: absolute; inset: 0; z-index: 2;
  display: grid; place-items: center;
  border: 0; background: transparent; padding: 0;
  transition: opacity .2s var(--ease);
}
.pbig span {
  width: 76px; height: 76px; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .5);
  transition: transform .2s var(--ease);
}
.pbig:hover span { transform: scale(1.07); }
.pbig svg { width: 30px; height: 30px; margin-left: 4px; }
.player.playing .pbig { opacity: 0; pointer-events: none; }

/* barre de controles */
.pctl {
  position: absolute; inset: auto 0 0 0; z-index: 3;
  display: flex; align-items: center; gap: 10px;
  padding: 26px 12px 10px;
  background: linear-gradient(to top, rgba(11, 11, 14, .92), transparent);
  opacity: 0; transform: translateY(6px);
  transition: opacity .2s var(--ease), transform .2s var(--ease);
}
.player:hover .pctl, .player.paused .pctl, .pctl:focus-within { opacity: 1; transform: none; }

.pbtn {
  flex: none; width: 34px; height: 34px; padding: 0;
  display: grid; place-items: center;
  background: transparent; border: 0; border-radius: 9px;
  color: var(--text); opacity: .9;
}
.pbtn:hover { background: rgba(255, 255, 255, .12); opacity: 1; }
.pbtn svg { width: 19px; height: 19px; }

.ptime { flex: none; font-size: 12.5px; font-variant-numeric: tabular-nums; color: var(--text); opacity: .85; }

.pbar {
  flex: 1 1 auto; min-width: 0; position: relative;
  height: 16px; display: flex; align-items: center;
  cursor: pointer; touch-action: none;
}
.pbar .track { position: relative; width: 100%; height: 4px; border-radius: 3px; background: rgba(255, 255, 255, .22); overflow: hidden; }
.pbar .buf { position: absolute; inset: 0 auto 0 0; background: rgba(255, 255, 255, .18); width: 0; }
.pbar .fill { position: absolute; inset: 0 auto 0 0; background: var(--accent); width: 0; }
.pbar .knob {
  position: absolute; top: 50%; left: 0;
  width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%;
  background: var(--accent); transform: scale(0);
  transition: transform .15s var(--ease);
}
.pbar:hover .knob, .pbar:focus-visible .knob { transform: scale(1); }
.pbar .track, .pbar .fill, .pbar .buf { transition: height .15s var(--ease); }
.pbar:hover .track { height: 6px; }

.pvol { flex: none; display: flex; align-items: center; gap: 4px; }
.pvol input {
  width: 0; opacity: 0; height: 4px; padding: 0; margin: 0;
  accent-color: var(--accent); cursor: pointer;
  transition: width .2s var(--ease), opacity .2s var(--ease);
}
.pvol:hover input, .pvol input:focus-visible { width: 72px; opacity: 1; }

@media (max-width: 600px) {
  .pctl { gap: 6px; padding: 22px 8px 8px; }
  .pvol { display: none; }
  .pbig span { width: 62px; height: 62px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
