/* ==============================================================
   Observatoire matières — ticker défilant style Bloomberg/CNBC
   Bandeau noir fin en top, défilement infini, modal détaillé au clic
   ============================================================== */

/* ---------- Ticker top (barre noire défilante) ---------- */
.obs-ticker {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 400;
  background: #0a0f0c;
  height: 34px;
  display: flex;
  align-items: center;
  overflow: hidden;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  font-family: 'Outfit', system-ui, sans-serif;
  font-size: 12px;
  color: rgba(255,255,255,0.85);
}

.obs-ticker-label {
  flex-shrink: 0;
  padding: 0 16px;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(90deg, #0a0f0c 60%, rgba(10,15,12,0.75) 100%);
  z-index: 3;
  position: relative;
  font-weight: 600;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #4dc07a;
  border-right: 1px solid rgba(255,255,255,0.06);
}
.obs-ticker-label .obs-live-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: #ff3333;
  box-shadow: 0 0 8px #ff3333;
  animation: obs-pulse 1.4s ease-in-out infinite;
  margin-right: 4px;
}
@keyframes obs-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

.obs-ticker-track {
  flex: 1;
  overflow: hidden;
  position: relative;
  height: 100%;
}
.obs-ticker-marquee {
  display: inline-flex;
  align-items: center;
  height: 100%;
  gap: 0;
  animation: obs-scroll 60s linear infinite;
  white-space: nowrap;
  padding-left: 100%; /* démarre hors écran à droite */
}
.obs-ticker:hover .obs-ticker-marquee { animation-play-state: paused; }

@keyframes obs-scroll {
  from { transform: translate3d(0, 0, 0); }
  to   { transform: translate3d(-100%, 0, 0); }
}

.obs-ticker-item {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  padding: 0 22px;
  border-right: 1px solid rgba(255,255,255,0.05);
  cursor: pointer;
  transition: color 0.15s;
  background: none;
  border-top: none;
  border-bottom: none;
  border-left: none;
  color: inherit;
  font: inherit;
}
.obs-ticker-item:hover { color: white; }
.obs-ticker-item-name {
  font-weight: 500;
  color: rgba(255,255,255,0.75);
  font-size: 12px;
  letter-spacing: 0.01em;
}
.obs-ticker-item-price {
  font-weight: 600;
  color: white;
  font-variant-numeric: tabular-nums;
  font-size: 12px;
}
.obs-ticker-item-var {
  font-weight: 600;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.obs-ticker-item-var.up { color: #ff5555; }
.obs-ticker-item-var.down { color: #4dc07a; }
.obs-ticker-item-var.flat { color: rgba(255,255,255,0.5); }

/* Bouton "voir tous" et close à droite */
.obs-ticker-right {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  height: 100%;
  padding-right: 8px;
  background: linear-gradient(-90deg, #0a0f0c 60%, rgba(10,15,12,0.75) 100%);
  z-index: 3;
  position: relative;
  border-left: 1px solid rgba(255,255,255,0.06);
}
.obs-ticker-more {
  background: none;
  border: none;
  color: #4dc07a;
  cursor: pointer;
  padding: 0 14px;
  height: 100%;
  font-family: inherit;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  transition: color 0.15s;
}
.obs-ticker-more:hover { color: white; }
.obs-ticker-close {
  background: none;
  border: none;
  color: rgba(255,255,255,0.4);
  cursor: pointer;
  width: 28px; height: 100%;
  padding: 0;
  font-size: 18px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s;
}
.obs-ticker-close:hover { color: white; }

@media (max-width: 720px) {
  .obs-ticker { height: 30px; font-size: 11px; }
  .obs-ticker-label { padding: 0 10px; font-size: 9px; letter-spacing: 0.12em; }
  .obs-ticker-item { padding: 0 14px; gap: 6px; }
  .obs-ticker-more { padding: 0 8px; font-size: 9px; letter-spacing: 0.1em; }
}

/* ---------- Décalage du header pour laisser place au ticker ---------- */
body.has-obs-ticker .site-header,
body.has-obs-ticker header.site-header { top: 34px !important; }
/* Page splash (index.html) : décale tout le layout .bienvenue */
body.has-obs-ticker .bienvenue { padding-top: 34px; }

@media (max-width: 720px) {
  body.has-obs-ticker .site-header,
  body.has-obs-ticker header.site-header { top: 30px !important; }
  body.has-obs-ticker .bienvenue { padding-top: 30px; }
}

/* ---------- Modal détaillée ---------- */
.obs-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 15, 12, 0);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: background 0.25s ease, opacity 0.25s ease, visibility 0.25s;
}
.obs-modal-backdrop.is-open {
  background: rgba(10, 15, 12, 0.7);
  opacity: 1;
  visibility: visible;
}

.obs-modal {
  background: white;
  border-radius: 14px;
  width: 100%;
  max-width: 980px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0,0,0,0.45);
  transform: translateY(20px) scale(0.98);
  transition: transform 0.25s ease;
  font-family: 'DM Sans', system-ui, sans-serif;
}
.obs-modal-backdrop.is-open .obs-modal { transform: translateY(0) scale(1); }

.obs-modal-head {
  padding: 22px 26px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  border-bottom: 1px solid #eee;
}
.obs-modal-head h2 {
  margin: 0 0 4px;
  font-family: 'Outfit', system-ui, sans-serif;
  font-size: 22px;
  font-weight: 600;
  color: #2a2f26;
  letter-spacing: -0.01em;
}
.obs-modal-sub { margin: 0; font-size: 12.5px; color: #8a8e82; }
.obs-modal-close {
  width: 34px; height: 34px;
  border: none;
  background: #f4f2ea;
  border-radius: 50%;
  cursor: pointer;
  color: #4a5140;
  font-size: 22px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex-shrink: 0;
}
.obs-modal-close:hover { background: #e5e2d5; color: #2a2f26; }

.obs-modal-tabs {
  padding: 0 26px;
  display: flex;
  gap: 4px;
  border-bottom: 1px solid #eee;
  overflow-x: auto;
  scrollbar-width: none;
}
.obs-modal-tabs::-webkit-scrollbar { display: none; }
.obs-tab {
  padding: 12px 16px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 14px;
  color: #7d8574;
  font-family: inherit;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
  transition: color 0.15s;
}
.obs-tab:hover { color: #2a2f26; }
.obs-tab.is-active { color: #0e6e3a; border-color: #0e6e3a; font-weight: 600; }

.obs-modal-body {
  padding: 8px 26px 20px;
  overflow-y: auto;
  flex: 1;
}

/* Liste matières */
.obs-list { display: flex; flex-direction: column; }
.obs-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 160px 110px 130px;
  gap: 20px;
  padding: 18px 0;
  border-bottom: 1px solid #f0eee5;
  align-items: center;
}
.obs-row:last-child { border-bottom: none; }
.obs-row-head { display: flex; gap: 12px; align-items: flex-start; min-width: 0; }
.obs-row-icon { font-size: 22px; line-height: 1; flex-shrink: 0; margin-top: 2px; }
.obs-row-info { min-width: 0; }
.obs-row-info h4 {
  margin: 0 0 4px;
  font-family: 'Outfit', system-ui, sans-serif;
  font-size: 15px;
  font-weight: 600;
  color: #2a2f26;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.obs-row-info p { margin: 0; font-size: 12.5px; color: #7d8574; line-height: 1.45; }
.obs-live-badge {
  background: #e8f4ec; color: #0e6e3a;
  font-size: 9.5px; padding: 2px 6px; border-radius: 3px;
  font-weight: 700; letter-spacing: 0.08em;
}
.obs-static-badge {
  background: #f4f2ea; color: #7d8574;
  font-size: 9.5px; padding: 2px 6px; border-radius: 3px;
  font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase;
}
.obs-row-spark { display: flex; align-items: center; justify-content: center; }
.obs-sparkline { width: 100%; height: 40px; display: block; }
.obs-spark-empty { color: #c9cec1; font-size: 20px; }
.obs-row-price { text-align: right; }
.obs-row-price-val {
  font-family: 'Outfit', system-ui, sans-serif;
  font-size: 18px; font-weight: 600; color: #2a2f26; line-height: 1.1;
}
.obs-row-price-unit { font-size: 11px; color: #8a8e82; margin-top: 2px; }
.obs-row-vars { display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }
.obs-row-var { display: flex; align-items: baseline; gap: 6px; font-size: 12.5px; }
.obs-row-var .lbl { color: #a0a598; font-size: 11px; }
.obs-row-var .val { font-weight: 600; }
.obs-row-var.up .val { color: #c94040; }
.obs-row-var.down .val { color: #4a9558; }
.obs-row-var.flat .val { color: #7d8574; }

@media (max-width: 720px) {
  .obs-modal { max-height: 95vh; border-radius: 12px 12px 0 0; align-self: flex-end; }
  .obs-modal-head { padding: 16px 18px; }
  .obs-modal-head h2 { font-size: 18px; }
  .obs-modal-tabs { padding: 0 18px; }
  .obs-modal-body { padding: 8px 18px 16px; }
  .obs-row { grid-template-columns: 1fr; gap: 10px; padding: 14px 0; }
  .obs-row-spark { justify-content: flex-start; height: 32px; }
  .obs-sparkline { max-width: 140px; height: 32px; }
  .obs-row-price, .obs-row-vars { text-align: left; align-items: flex-start; }
  .obs-row-vars { flex-direction: row; gap: 16px; }
}
.obs-empty { padding: 40px 20px; text-align: center; color: #7d8574; font-size: 14px; }
.obs-modal-foot { padding: 16px 26px; background: #f4f2ea; border-top: 1px solid #eee; }
.obs-modal-foot p { margin: 0; font-size: 12px; color: #7d8574; line-height: 1.5; }
