/*
 * WatchGrid — thème "Liquid Glass"
 *
 * Principe : le verre dépoli flotte AU-DESSUS du contenu (la miniature
 * vidéo), pas au-dessus du vide. C'est ce qui distingue un vrai effet de
 * profondeur d'un simple blur+bordure décoratif. Toute surface vitrée porte
 * un voile suffisant pour rester lisible quel que soit le site hôte ou la
 * photo en dessous — voir .impeccable.md.
 *
 * Ces variables sont volontairement redéfinissables par le site hôte
 * (ex: .wg-grid-wrap{--wg-accent:oklch(60% .18 150)}).
 */
.wg-grid-wrap,
.wg-latest-wrap {
  --wg-accent: oklch(58% 0.19 264);
  --wg-accent-strong: oklch(50% 0.2 264);

  /* Neutres légèrement teintés vers l'accent (cohérence subliminale) */
  --wg-ink: oklch(22% 0.02 264);
  --wg-muted: oklch(46% 0.02 264);

  /* Verre — mode clair */
  --wg-glass-bg: oklch(98% 0.005 264 / 0.85);
  --wg-glass-border: oklch(60% 0.02 264 / 0.35);
  --wg-glass-sheen: oklch(100% 0 0 / 0.5);
  --wg-glass-shadow: oklch(30% 0.03 264 / 0.18);
  --wg-scrim: linear-gradient(to top, oklch(15% 0.02 264 / 0.78), oklch(15% 0.02 264 / 0.15) 60%, transparent);
  --wg-text-on-glass: oklch(99% 0.005 264);

  /* Fixé en clair : la page hôte est en thème clair. Laisser "light dark"
     ici fait peindre les contrôles natifs (select, input) selon le mode
     sombre système de CHAQUE navigateur indépendamment des variables
     ci-dessus — d'où le texte illisible gris-sur-gris et le rendu
     incohérent d'un navigateur à l'autre (Safari vs Opera). */
  color-scheme: light;
  font-family: inherit;
  color: var(--wg-ink);
  -webkit-font-smoothing: antialiased;
}

/* ==========================================================
   Barre de filtres — un seul panneau de verre flottant
========================================================== */
.wg-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 10px;
  margin: 0 0 20px;
  border-radius: 22px;
  background: var(--wg-glass-bg);
  border: 1px solid var(--wg-glass-border);
  box-shadow:
    0 12px 32px -12px var(--wg-glass-shadow),
    inset 0 1px 0 var(--wg-glass-sheen);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
}

.wg-bar select,
.wg-bar input {
  border: 0;
  background: transparent;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 14px;
  color: var(--wg-ink);
  transition: background-color 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.wg-bar select:hover,
.wg-bar input:hover { background-color: oklch(50% 0 0 / 0.06); }
.wg-bar select:focus-visible,
.wg-bar input:focus-visible {
  outline: 2px solid var(--wg-accent);
  outline-offset: -1px;
}

.wg-bar select {
  flex: 0 0 auto;
  min-width: 148px;
  max-width: 210px;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%236b7280' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}
.wg-bar select::-ms-expand { display: none; }
.wg-bar input[type="search"] { flex: 1; min-width: 200px; }
.wg-bar input::placeholder { color: var(--wg-muted); }

.wg-bar button {
  padding: 8px 16px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--wg-muted);
  font-size: 14px;
  cursor: pointer;
  transition: background-color 0.25s cubic-bezier(0.16, 1, 0.3, 1), color 0.25s;
}
.wg-bar button:hover { background-color: oklch(50% 0 0 / 0.08); color: var(--wg-ink); }

.wg-count { color: var(--wg-muted); margin: 0 0 12px; font-size: 13px; }
.wg-error { color: oklch(58% 0.19 25); }
.wg-empty { color: var(--wg-muted); }

/* ==========================================================
   Grille de cartes
========================================================== */
.wg-grid {
  display: grid;
  grid-template-columns: repeat(var(--wg-columns, 3), 1fr);
  gap: 20px;
}
@media (max-width: 900px) { .wg-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .wg-grid { grid-template-columns: 1fr; } }

.wg-card > a { display: block; }

.wg-card {
  border-radius: 22px;
  overflow: hidden;
  background: var(--wg-glass-bg);
  border: 1px solid var(--wg-glass-border);
  box-shadow:
    0 16px 40px -18px var(--wg-glass-shadow),
    inset 0 1px 0 var(--wg-glass-sheen);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  transition: transform 0.45s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}
.wg-card:hover,
.wg-card:focus-within {
  transform: translateY(-4px);
  box-shadow:
    0 24px 56px -18px var(--wg-glass-shadow),
    inset 0 1px 0 var(--wg-glass-sheen);
}

/* Miniature dans son ratio d'origine (16:9), non recadrée — la carte
   elle-même porte le verre, pas un panneau flottant par-dessus l'image. */
.wg-card .wg-thumb,
.wg-card .wg-facade {
  display: block;
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
}
.wg-card .wg-thumb { object-fit: cover; transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1); }
.wg-card:hover .wg-thumb { transform: scale(1.04); }

.wg-card-content { padding: 14px 16px 16px; }
.wg-card-title {
  font-weight: 600;
  font-size: 15px;
  line-height: 1.35;
  margin: 0 0 6px;
  color: var(--wg-ink);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.wg-card-meta {
  font-size: 12.5px;
  margin: 0;
  color: var(--wg-muted);
}

/* ==========================================================
   Façade RGPD : bouton de lecture en verre, effet spéculaire
========================================================== */
.wg-facade { background: var(--wg-ink); }
.wg-facade iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.wg-facade-btn {
  display: block;
  position: absolute; inset: 0; width: 100%; height: 100%;
  margin: 0; border: 0; padding: 0; cursor: pointer; background: none;
}
/* L'image est positionnée elle-même plutôt que dimensionnée en % à travers
   le bouton parent : plus fiable pour garantir un cadrage plein cadre
   quelle que soit la résolution source de la miniature. */
.wg-facade-btn img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover; object-position: center;
  display: block;
}

.wg-play-icon {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 60px; height: 60px; border-radius: 50%;
  background: oklch(100% 0 0 / 0.16);
  border: 1px solid oklch(100% 0 0 / 0.5);
  box-shadow: 0 8px 24px -6px oklch(0% 0 0 / 0.4), inset 0 1px 0 oklch(100% 0 0 / 0.5);
  backdrop-filter: blur(10px) saturate(160%);
  -webkit-backdrop-filter: blur(10px) saturate(160%);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.35s;
}
.wg-facade-btn:hover .wg-play-icon,
.wg-facade-btn:focus-visible .wg-play-icon {
  transform: translate(-50%, -50%) scale(1.08);
  background: oklch(100% 0 0 / 0.26);
}
.wg-play-icon::after {
  content: "";
  position: absolute; top: 50%; left: 55%; transform: translate(-50%, -50%);
  border-style: solid; border-width: 9px 0 9px 15px;
  border-color: transparent transparent transparent oklch(99% 0 0);
}

/* ==========================================================
   Voir plus
========================================================== */
.wg-load-more {
  display: block;
  margin: 28px auto 0;
  padding: 12px 26px;
  border: 0;
  border-radius: 999px;
  background: var(--wg-accent);
  color: oklch(99% 0 0);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  box-shadow: 0 10px 24px -8px var(--wg-accent), inset 0 1px 0 oklch(100% 0 0 / 0.3);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.3s;
}
.wg-load-more:hover { background: var(--wg-accent-strong); transform: translateY(-1px); }
.wg-load-more:active { transform: translateY(0); }

/* ==========================================================
   Dernière vidéo
========================================================== */
/* Layout par défaut : composant contenu, pas de pleine largeur de page
   (l'ancien plugin capait à 80% — même intention ici). */
.wg-latest-wrap:not(.wg-layout-side) { max-width: 720px; margin-left: auto; margin-right: auto; }
.wg-latest-body { display: flex; flex-direction: column; gap: 18px; }
.wg-latest-media {
  position: relative; width: 100%; aspect-ratio: 16 / 9;
  border-radius: 26px; overflow: hidden;
  box-shadow: 0 28px 60px -20px oklch(20% 0.02 264 / 0.45);
}
.wg-latest-media iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.wg-latest-text h3 { margin: 0 0 6px; font-weight: 700; font-size: 22px; line-height: 1.3; }
.wg-date { color: var(--wg-muted); margin: 0; font-size: 14px; }

.wg-layout-side .wg-latest-body { flex-direction: row; align-items: center; gap: 44px; }
.wg-layout-side .wg-latest-media { flex: 1.2; }
.wg-layout-side .wg-latest-text { flex: 1; }
@media (max-width: 768px) { .wg-layout-side .wg-latest-body { flex-direction: column; } }

@media (prefers-reduced-motion: reduce) {
  .wg-card, .wg-card .wg-thumb, .wg-load-more, .wg-facade-btn .wg-play-icon {
    transition: none;
  }
}
