/**
 * chronologie-viewer.css — William Guindon (williamguindon.me)
 * Styles d'intégration pour le visualiseur SVG interactif svg-pan-zoom,
 * barre d'outils épurée, tactile mobile (touch-action: pan-y) et mode intégration (Embed / iFrame).
 */

.wg-chronologie-container {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--card-bg, #ffffff);
  border: 1px solid var(--card-border, #e2e8f0);
  border-radius: 14px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.06);
  overflow: hidden;
  margin: 28px 0;
  font-family: inherit;
  color: var(--text-main, #0f172a);
}

[data-theme="dark"] .wg-chronologie-container {
  background: #0d1713;
  border-color: rgba(16, 185, 129, 0.22);
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.45);
  color: #f1f5f3;
}

.wg-chronologie-container:fullscreen,
.wg-chronologie-container:-webkit-full-screen,
.wg-chronologie-container.is-fullscreen {
  width: 100vw !important;
  height: 100vh !important;
  max-width: none !important;
  margin: 0 !important;
  border-radius: 0 !important;
  border: none !important;
  z-index: 999999 !important;
  background: var(--card-bg, #ffffff) !important;
}

[data-theme="dark"] .wg-chronologie-container:fullscreen,
[data-theme="dark"] .wg-chronologie-container:-webkit-full-screen,
[data-theme="dark"] .wg-chronologie-container.is-fullscreen {
  background: #09120e !important;
}

/* En-tête épuré et minimaliste */
.wg-chronologie-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  background: var(--surface, #ffffff);
  border-bottom: 1px solid var(--line, #edf2f7);
}

[data-theme="dark"] .wg-chronologie-header {
  background: #111d17;
  border-bottom-color: rgba(16, 185, 129, 0.15);
}

.wg-chronologie-titles {
  flex: 1 1 240px;
}

.wg-chronologie-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #047857;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.25);
  padding: 2px 7px;
  border-radius: 4px;
  margin-bottom: 4px;
}

[data-theme="dark"] .wg-chronologie-badge {
  color: #34d399;
  background: rgba(52, 211, 153, 0.12);
  border-color: rgba(52, 211, 153, 0.25);
}

.wg-chronologie-title {
  font-size: 1.12rem;
  font-weight: 800;
  color: var(--text-main, #0f172a);
  margin: 0;
  line-height: 1.3;
  letter-spacing: -0.2px;
}

[data-theme="dark"] .wg-chronologie-title {
  color: #f8fafc;
}

.wg-chronologie-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted, #64748b);
  margin: 3px 0 0 0;
  line-height: 1.4;
}

[data-theme="dark"] .wg-chronologie-subtitle {
  color: #94a3b8;
}

/* Barre d'actions minimaliste et discrète dans le coin */
.wg-chronologie-toolbar {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.wg-chronologie-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--surface, #ffffff);
  color: var(--text-main, #1e293b);
  border: 1px solid var(--border-color, #cbd5e1);
  padding: 6px 11px;
  border-radius: 7px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
  user-select: none;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

[data-theme="dark"] .wg-chronologie-btn {
  background: #16241e;
  color: #f1f5f3;
  border-color: rgba(255, 255, 255, 0.14);
}

.wg-chronologie-btn:hover,
.wg-chronologie-btn:focus-visible {
  background: rgba(16, 185, 129, 0.1);
  border-color: #10b981;
  color: #047857;
  outline: none;
  transform: translateY(-1px);
}

[data-theme="dark"] .wg-chronologie-btn:hover,
[data-theme="dark"] .wg-chronologie-btn:focus-visible {
  background: rgba(16, 185, 129, 0.22);
  color: #34d399;
}

.wg-chronologie-btn:active {
  transform: translateY(0);
}

/* Stage SVG : fond doux, blanc cassé/très pâle, touch-action pan-y pour mobile */
.wg-chronologie-stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 520px;
  height: 620px;
  background: #f8fafc;
  cursor: grab;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  outline: none;
  touch-action: pan-y !important;
}

[data-theme="dark"] .wg-chronologie-stage {
  background: #09120e;
}

.wg-chronologie-stage:active {
  cursor: grabbing;
}

/* Liens cliquables à l'intérieur du SVG */
.wg-chronologie-stage svg a,
.wg-chronologie-stage svg a * {
  cursor: pointer !important;
  pointer-events: auto !important;
  transition: opacity 0.15s ease, filter 0.15s ease;
}

.wg-chronologie-stage svg a:hover,
.wg-chronologie-stage svg a:focus {
  opacity: 0.95;
  outline: none;
}

.wg-chronologie-stage svg a:hover text,
.wg-chronologie-stage svg a:focus text {
  text-decoration: underline;
  filter: drop-shadow(0 0 3px rgba(16, 185, 129, 0.8));
}

.wg-chronologie-stage svg a:hover rect,
.wg-chronologie-stage svg a:focus rect {
  filter: drop-shadow(0 0 5px rgba(16, 185, 129, 0.75));
  stroke: #10b981 !important;
  stroke-width: 2px !important;
}

.wg-chronologie-stage svg a:hover circle,
.wg-chronologie-stage svg a:focus circle {
  filter: drop-shadow(0 0 6px rgba(52, 211, 153, 0.9));
}

.wg-chronologie-container:fullscreen .wg-chronologie-stage,
.wg-chronologie-container:-webkit-full-screen .wg-chronologie-stage,
.wg-chronologie-container.is-fullscreen .wg-chronologie-stage {
  height: calc(100vh - 65px) !important;
  min-height: 400px;
}

/* Mention subtile et discrète en dessous (remplace la grosse barre grise) */
.wg-chronologie-subtle-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 16px;
  background: var(--surface, #ffffff);
  border-top: 1px solid var(--line, #edf2f7);
  font-size: 0.75rem;
  color: var(--text-muted, #64748b);
  letter-spacing: 0.01em;
}

[data-theme="dark"] .wg-chronologie-subtle-hint {
  background: #111d17;
  border-top-color: rgba(16, 185, 129, 0.12);
  color: #94a3b8;
}

.wg-chronologie-subtle-hint svg {
  color: #10b981;
  flex-shrink: 0;
}

.wg-chronologie-loading,
.wg-chronologie-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
  color: #64748b;
  gap: 12px;
}

[data-theme="dark"] .wg-chronologie-loading,
[data-theme="dark"] .wg-chronologie-error {
  color: #94a3b8;
}

.wg-chronologie-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(16, 185, 129, 0.2);
  border-top-color: #10b981;
  border-radius: 50%;
  animation: wgChronologieSpin 0.8s linear infinite;
}

@keyframes wgChronologieSpin {
  to { transform: rotate(360deg); }
}

/* =========================================================================
   MODE INTÉGRATION (EMBED / IFRAME) SUR D'AUTRES SITES
   Affiche le visualiseur épuré avec sa petite bannière verte officielle
   ========================================================================= */

html.is-embedded-widget,
body.is-embed-mode {
  margin: 0 !important;
  padding: 0 !important;
  background: #f8fafc !important;
  width: 100vw !important;
  height: 100vh !important;
  overflow: hidden !important;
}

[data-theme="dark"] html.is-embedded-widget,
[data-theme="dark"] body.is-embed-mode {
  background: #09120e !important;
}

.is-embed-mode .site-header,
.is-embed-mode .sub-hero,
.is-embed-mode .prose,
.is-embed-mode footer,
.is-embed-mode .skip-link,
.is-embed-mode .satellite-page > *:not(.wrap),
.is-embed-mode .nav-desktop,
.is-embed-mode #embed-original-banner {
  display: none !important;
}

.is-embed-mode .satellite-page,
.is-embed-mode main,
.is-embed-mode .wrap {
  max-width: 100vw !important;
  width: 100vw !important;
  margin: 0 !important;
  padding: 0 !important;
}

.is-embed-mode .wg-chronologie-container {
  margin: 0 !important;
  border-radius: 0 !important;
  border: none !important;
  width: 100vw !important;
  height: calc(100vh - 36px) !important;
  box-shadow: none !important;
}

.is-embed-mode .wg-chronologie-stage {
  height: calc(100vh - 90px) !important;
  min-height: 240px !important;
}

/* Petite bannière verte officielle en mode embed */
.wg-embed-brand-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
  gap: 10px;
  padding: 6px 14px;
  background: #064e3b;
  border-top: 1.5px solid #10b981;
  color: #ecfdf5;
  font-size: 11.5px;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  box-sizing: border-box;
  height: 36px;
  position: relative;
  z-index: 99999;
}

.wg-embed-brand-left {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wg-embed-brand-dot {
  width: 8px;
  height: 8px;
  min-width: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.9);
}

.wg-embed-brand-text {
  font-weight: 700;
  letter-spacing: -0.2px;
  color: #f0fdf4;
}

.wg-embed-brand-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #ffffff;
  color: #064e3b;
  font-weight: 800;
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 999px;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
  transition: all 0.15s ease;
}

.wg-embed-brand-btn:hover {
  background: #10b981;
  color: #ffffff;
}

@media (max-width: 640px) {
  .wg-chronologie-header {
    padding: 10px 12px;
  }
  .wg-chronologie-title {
    font-size: 1rem;
  }
  .wg-chronologie-stage {
    min-height: 360px;
    height: 440px;
  }
  .wg-embed-brand-text {
    font-size: 10px;
  }
  .wg-embed-brand-btn {
    font-size: 9.5px;
    padding: 2px 7px;
  }
}
