/* Grille de webcams embarquee dans les guides.
   Memes tokens que public/guides.css (--bg, --panel, --fg, --muted, --dim,
   --border, --accent). Charge uniquement sur les pages qui portent l'embed. */

.webcams-embed {
  margin: 32px 0;
}

.webcams-embed [hidden],
.wce-overlay [hidden],
.wce-overlay[hidden] {
  display: none !important;
}

.wce {
  display: block;
}

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

/* --- Barre de filtres --- */

.wce-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.wce-chips {
  display: flex;
  gap: 6px;
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: thin;
  padding-bottom: 2px;
  -webkit-overflow-scrolling: touch;
}

.wce-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.wce-chip {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
}

.wce-chip:hover {
  color: var(--fg);
  border-color: var(--accent);
}

.wce-chip:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.wce-chip[aria-pressed="true"] {
  color: #06251f;
  background: var(--accent);
  border-color: var(--accent);
}

.wce-chip-count {
  display: inline-block;
  padding: 0 5px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.1);
  color: inherit;
}

.wce-chip[aria-pressed="true"] .wce-chip-count {
  background: rgba(0, 0, 0, 0.18);
}

.wce-search {
  display: block;
}

.wce-search-input {
  font: inherit;
  font-size: 13px;
  padding: 5px 10px;
  width: 150px;
  max-width: 100%;
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
}

.wce-search-input::placeholder {
  color: var(--dim);
}

.wce-search-input:focus {
  outline: none;
  border-color: var(--accent);
}

.wce-count {
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--dim);
}

/* --- Grille --- */

.wce-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}

.wce-card {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 0 8px;
  font: inherit;
  text-align: left;
  color: var(--fg);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
}

.wce-card:hover {
  border-color: var(--accent);
}

.wce-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.wce-card-media {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #000;
  overflow: hidden;
}

.wce-card-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.wce-card.is-stale .wce-card-img {
  opacity: 0.45;
  filter: grayscale(0.35);
}

.wce-card-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--dim);
  background: var(--code-bg, #1a1a24);
}

.wce-live {
  position: absolute;
  top: 6px;
  left: 6px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 7px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: #fff;
  background: rgba(10, 10, 15, 0.72);
  border-radius: 10px;
}

.wce-live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ef4444;
  animation: wce-pulse 1.8s ease-in-out infinite;
}

@keyframes wce-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.25; }
}

.wce-stale {
  position: absolute;
  bottom: 6px;
  left: 6px;
  padding: 2px 7px;
  font-size: 10px;
  font-weight: 600;
  color: #ffb454;
  background: rgba(10, 10, 15, 0.78);
  border: 1px solid rgba(255, 165, 0, 0.4);
  border-radius: 4px;
}

.wce-stale-inline {
  color: #ffb454;
}

.wce-card-name {
  padding: 6px 10px 0;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
}

.wce-card-provider {
  padding: 0 10px;
  font-size: 11px;
  color: var(--dim);
}

.wce-empty {
  margin: 24px 0;
  padding: 24px;
  text-align: center;
  font-size: 14px;
  color: var(--dim);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.wce-attribution {
  margin: 12px 0 0;
  font-size: 12px;
  line-height: 1.6;
  color: var(--dim);
}

.wce-attribution a {
  color: var(--muted);
}

.wce-attribution a:hover {
  color: var(--fg);
}

.wce-attribution-label {
  color: var(--muted);
}

/* --- Lightbox --- */

body.wce-locked {
  overflow: hidden;
}

.wce-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(6, 6, 10, 0.82);
}

.wce-dialog {
  position: relative;
  width: min(900px, 100%);
  max-height: 100%;
  overflow-y: auto;
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.wce-dialog:focus {
  outline: none;
}

.wce-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  font: inherit;
  font-size: 20px;
  line-height: 1;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
}

.wce-close:hover {
  color: var(--fg);
}

.wce-close:focus-visible,
.wce-nav-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.wce-stage {
  background: #000;
  border-radius: 6px;
  overflow: hidden;
}

.wce-stage-live {
  position: relative;
  width: 100%;
}

.wce-stage-live iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.wce-stage-img {
  position: relative;
  min-height: 120px;
}

.wce-stage-img img {
  display: block;
  width: 100%;
  height: auto;
}

.wce-dialog-title {
  margin: 12px 0 2px;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.3;
}

.wce-dialog-meta {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.wce-dialog-updated {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--dim);
}

.wce-dialog-map {
  display: inline-block;
  margin-top: 8px;
  font-size: 13px;
}

.wce-nav {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.wce-nav-btn {
  font: inherit;
  font-size: 13px;
  padding: 6px 12px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
}

.wce-nav-btn:hover:not(:disabled) {
  color: var(--fg);
  border-color: var(--accent);
}

.wce-nav-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

/* --- Mobile --- */

@media (max-width: 600px) {
  .wce-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .wce-bar {
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
  }

  .wce-controls {
    justify-content: space-between;
  }

  .wce-search-input {
    width: 100%;
  }

  .wce-search {
    flex: 1 1 auto;
    min-width: 0;
  }

  .wce-card-name {
    font-size: 12px;
  }

  .wce-overlay {
    padding: 0;
    align-items: stretch;
  }

  .wce-dialog {
    width: 100%;
    max-height: none;
    min-height: 100%;
    border: 0;
    border-radius: 0;
    padding: 12px;
  }
}

/* --- Mouvement reduit --- */

@media (prefers-reduced-motion: reduce) {
  .wce-live-dot {
    animation: none;
  }
}
