@import url('https://fonts.googleapis.com/css2?family=Lato:wght@400;500;600;700&family=PT+Serif:wght@400;600;700&display=swap');

* { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Focus visible global (accessibilité clavier) ── */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}

/* ── Skip link (accessibilité) ── */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 9999;
  padding: 8px 16px;
  background: var(--accent);
  color: #fff;
  font-family: "SF Mono", monospace;
  font-size: 12px;
  text-decoration: none;
  border-radius: 0 0 6px 0;
}
.skip-link:focus {
  left: 0;
}
body {
  background: var(--paper); color: var(--ink);
  font-family: 'Lato', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  min-height: 100vh; -webkit-font-smoothing: antialiased;
}
.mono { font-family: "SF Mono", "Cascadia Code", "JetBrains Mono", Menlo, Consolas, monospace; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 24px 80px; }
/* Legacy : conservé pour compatibilité avec marche-temps-reel avant refonte header */
.site-header {
  background: var(--card); border: 1px solid var(--line); border-radius: 8px;
  padding: 14px 20px; margin-bottom: 24px;
}
.theme-bar { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; padding-bottom: 12px; border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.theme-bar .nav-btn {
  background: var(--card); border: 1px solid var(--line); border-radius: 6px;
  padding: 6px 14px; cursor: pointer; font-size: 13px; color: var(--ink);
  font-family: "SF Mono", monospace;
  text-decoration: none;
}
.theme-bar .nav-btn:hover { background: var(--card-alt); }
.masthead {
  display: flex; justify-content: space-between; align-items: baseline;
  flex-wrap: wrap; gap: 12px;
}
.masthead-title { font-family: 'PT Serif', Georgia, serif; font-size: 24px; font-weight: 700; }
.masthead-meta { font-family: "SF Mono", monospace; font-size: 11px; color: var(--ink-soft); }

/* ── Header — Design validé ── */
.header-new { background: var(--card); border: 1px solid var(--line); border-radius: 8px; overflow: visible; margin-bottom: 24px; position: relative; }
/* Brand */
.header-brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); flex-shrink: 0; }
.header-brand-logo { width: 28px; height: 28px; border-radius: 6px; }
.header-brand-name { font-family: 'PT Serif', Georgia, serif; font-size: 16px; font-weight: 700; }

/* Barre horizontale unique */
.header-bar { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; gap: 12px; }
.header-bar-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; min-width: 0; }

/* Navigation horizontale */
.header-nav { display: flex; align-items: center; gap: 4px; }
.header-nav-link {
  background: transparent; border: 1px solid transparent; border-radius: 6px;
  padding: 6px 10px; font-size: 13px; color: var(--ink-soft);
  font-family: "SF Mono", monospace; text-decoration: none; cursor: pointer;
  white-space: nowrap; transition: 0.12s; display: flex; align-items: center; gap: 4px;
}
.header-nav-link:hover { background: var(--card-alt); color: var(--ink); }

/* Dropdowns */
.header-dropdown { position: relative; }
.header-dropdown-toggle {
  background: transparent; border: 1px solid transparent; border-radius: 6px;
  padding: 6px 10px; font-size: 13px; color: var(--ink-soft);
  font-family: "SF Mono", monospace; cursor: pointer; white-space: nowrap;
  transition: 0.12s; display: flex; align-items: center; gap: 4px;
}
.header-dropdown-toggle:hover { background: var(--card-alt); color: var(--ink); }

.header-dropdown-menu {
  display: none; position: absolute; top: calc(100% + 2px); left: 0;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 6px; padding: 4px; min-width: 180px; z-index: 150;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}
.header-dropdown-menu.open { display: block; }
.header-dropdown-menu.right { left: auto; right: 0; }

/* Dropdown items */
.dropdown-item {
  display: flex; align-items: center; gap: 6px;
  width: 100%; padding: 10px 14px; font-size: 12px; color: var(--ink);
  text-decoration: none; font-family: "SF Mono", monospace;
  border-radius: 4px; background: none; border: none; cursor: pointer; text-align: left;
  transition: background 0.1s;
}
.dropdown-item:hover { background: var(--card-alt); }
.dropdown-divider { height: 1px; background: var(--line); margin: 4px 0; }

/* Don button */
.don-btn {
  background: var(--terracotta); color: #fff; border: none; border-radius: 6px;
  padding: 6px 14px; font-size: 12px; font-family: "SF Mono", monospace;
  text-decoration: none; cursor: pointer; white-space: nowrap; font-weight: 500;
  transition: opacity 0.15s;
}
.don-btn:hover { opacity: 0.85; }

/* Hamburger */
.hamburger { display: none; flex-direction: column; gap: 4px; cursor: pointer; background: none; border: none; padding: 4px; flex-shrink: 0; }
.hamburger span { display: block; width: 20px; height: 2px; background: var(--ink); border-radius: 1px; transition: 0.2s; }
.hamburger.open span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

/* Mobile menu */
.header-mobile { display: none; flex-direction: column; padding: 8px 16px 16px; border-top: 1px solid var(--line); }
.header-mobile.open { display: flex; }
.header-mobile .mobile-section { padding: 2px 0; }
.header-mobile .mobile-section-title { font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-soft); padding: 8px 4px 4px; font-family: "SF Mono", monospace; }
.header-mobile .mobile-link {
  display: block; padding: 9px 14px; font-size: 13px; color: var(--ink); text-decoration: none;
  font-family: "SF Mono", monospace; border-radius: 6px; transition: background 0.1s;
}
.header-mobile .mobile-link:hover { background: var(--card-alt); }
.header-mobile .mobile-sep { height: 1px; background: var(--line); margin: 6px 4px; }
.header-mobile .mobile-don {
  display: block; margin: 6px 4px; padding: 10px 14px; background: var(--terracotta);
  color: #fff; text-align: center; border-radius: 6px; text-decoration: none;
  font-family: "SF Mono", monospace; font-size: 13px; font-weight: 500;
  transition: opacity 0.15s;
}
.header-mobile .mobile-don:hover { opacity: 0.85; }

/* Account user email truncation */
.header-user-email { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; vertical-align: middle; }

/* ── Mobile ── */
@media (max-width: 640px) {
  .header-nav { display: none; }
  .header-bar-right > .don-btn { display: none; }
  .header-bar-right > #auth-nav { display: none; }
  .hamburger { display: flex; }
}

/* Footer */
.footer-new { margin-top: 48px; padding: 24px 20px; background: var(--card); border: 1px solid var(--line); border-radius: 8px; }
.footer-new-inner { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; }
.footer-new-brand { display: flex; align-items: center; gap: 8px; }
.footer-new-brand img { width: 24px; height: 24px; border-radius: 4px; }
.footer-new-brand span { font-family: 'PT Serif', Georgia, serif; font-size: 14px; font-weight: 600; color: var(--ink); }
.footer-new-links { font-size: 12px; }
.footer-new-links a { color: var(--ink-soft); text-decoration: none; }
.footer-new-links a:hover { color: var(--terracotta); text-decoration: underline; }
.footer-new-links .sep { color: var(--line); margin: 0 6px; }
.footer-new-links .footer-new-don { color: var(--terracotta); font-weight: 500; }
.footer-new-copy { font-size: 11px; color: var(--ink-soft); width: 100%; text-align: center; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }

/* Disclaimer */
.disclaimer { background: var(--amber-soft); border: 1px solid var(--amber); border-radius: 6px; padding: 10px 14px; font-size: 11.5px; line-height: 1.5; color: var(--amber); font-style: italic; }

/* Eyebrow + section title */
.eyebrow { display: flex; align-items: center; gap: 6px; font-family: "SF Mono", monospace; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-soft); }
.eyebrow-rule { flex: 1; height: 1px; background: var(--line); }
.section-title { font-family: 'PT Serif', Georgia, serif; font-size: 16px; font-weight: 600; color: var(--ink); margin: 2px 0 10px; }
.section-desc { margin-bottom: 14px; }
.section-desc summary { font-family: "SF Mono", monospace; font-size: 11px; color: var(--terracotta); cursor: pointer; user-select: none; }
.note-grid { background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 14px; margin-top: 8px; line-height: 1.7; font-size: 12px; }

/* Ticker bar */
.ticker-wrapper { overflow: hidden; background: var(--card); border: 1px solid var(--line); border-radius: 6px; margin-bottom: 16px; height: 32px; position: relative; }
.ticker-track { display: flex; gap: 0; white-space: nowrap; animation: ticker-scroll 90s linear infinite; width: max-content; }
.ticker-track:hover { animation-play-state: paused; }
.ticker-item { display: inline-flex; align-items: center; gap: 6px; padding: 0 12px; font-size: 11px; font-family: "SF Mono", monospace; height: 32px; }
.ticker-sep { display: inline-block; width: 1px; height: 14px; background: var(--line); margin-left: 6px; }
.t-sym { font-weight: 600; }
.t-price { color: var(--ink-soft); }
.t-var { font-weight: 600; }
.t-var.green { color: var(--terracotta); }
.t-var.red { color: var(--rust); }
.t-var.grey { color: var(--ink-soft); }
.t-rec { font-size: 10px; padding: 1px 5px; border-radius: 3px; font-weight: 500; }
.t-rec.achat { background: var(--terracotta-soft); color: var(--terracotta); }
.t-rec.surveiller { background: var(--amber-soft); color: var(--amber); }
.t-rec.conserver { background: var(--slate-soft); color: var(--slate); }
.t-rec.aleger { background: var(--rust-soft); color: var(--rust); }
.t-rec.eviter { background: var(--card-alt); color: var(--ink-soft); }
@keyframes ticker-scroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* Respect du prefers-reduced-motion : désactive les animations non essentielles */
@media (prefers-reduced-motion: reduce) {
  .ticker-track { animation: none; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Market badge */
.market-badge { font-size: 12px; font-weight: 400; vertical-align: middle; }
.market-badge.open { color: var(--green); }
.market-badge.closed { color: var(--ink-soft); }

/* Watchlist star button */
.wl-btn {
  cursor: pointer;
  display: inline-block;
  font-size: 13px;
  line-height: 1;
  margin-left: 15px;
  padding: 0 2px;
  color: var(--ink-soft);
  transition: color 0.15s, transform 0.1s;
  user-select: none;
  vertical-align: middle;
}
.wl-btn:hover {
  color: var(--amber);
  transform: scale(1.15);
}
.wl-btn:active {
  transform: scale(0.95);
}
.wl-btn.active {
  color: var(--amber);
}

/* ════════════════════════════════════════════
   THEMES
   ════════════════════════════════════════════ */

/* Blue Chip (defaut) */
:root, [data-theme="blue"] {
  --paper: #F0F4F8;       --paper-dim: #E2E8F0;
  --ink: #1E293B;         --ink-soft: #64748B;
  --accent: #2563EB;      --accent-soft: #DBEAFE;
  --success: #059669;     --success-soft: #D1FAE5;
  --danger: #DC2626;      --danger-soft: #FEE2E2;
  --warning: #D97706;     --warning-soft: #FEF3C7;
  --line: #E2E8F0;        --card: #FFFFFF;    --card-alt: #F8FAFC;
  /* Compatibilite anciens noms */
  --terracotta: var(--accent);
  --terracotta-soft: var(--accent-soft);
  --green: var(--success);
  --green-soft: var(--success-soft);
  --rust: var(--danger);
  --rust-soft: var(--danger-soft);
  --amber: var(--warning);
  --amber-soft: var(--warning-soft);
  --slate: #475569;
  --slate-soft: #E2E8F0;
  --heat-up: #1E3A5F;
  --heat-down: #BFDBFE;
  --heat-text-up: #FFFFFF;
  --heat-text-down: #1E293B;
}

/* Emerald */
[data-theme="emerald"], .theme-emerald {
  --paper: #ECFDF5;       --paper-dim: #D1FAE5;
  --ink: #064E3B;         --ink-soft: #6B7280;
  --accent: #059669;      --accent-soft: #D1FAE5;
  --success: #047857;     --success-soft: #A7F3D0;
  --danger: #B91C1C;      --danger-soft: #FEE2E2;
  --warning: #B45309;     --warning-soft: #FEF3C7;
  --line: #D1FAE5;        --card: #FFFFFF;    --card-alt: #F0FDF4;
  --slate: #374151;
  --slate-soft: #D1FAE5;
  --heat-up: #064E3B;
  --heat-down: #A7F3D0;
  --heat-text-up: #FFFFFF;
  --heat-text-down: #064E3B;
}

/* Dark mode */
[data-theme="dark"], .theme-dark {
  --paper: #0F172A;       --paper-dim: #0B1120;
  --ink: #E2E8F0;         --ink-soft: #94A3B8;
  --accent: #60A5FA;      --accent-soft: #1E3A5F;
  --success: #34D399;     --success-soft: #064E3B;
  --danger: #F87171;      --danger-soft: #450A0A;
  --warning: #FBBF24;     --warning-soft: #451A03;
  --line: #334155;        --card: #1E293B;    --card-alt: #334155;
  --slate: #94A3B8;
  --slate-soft: #334155;
  --heat-up: #34D399;
  --heat-down: #F87171;
  --heat-text-up: #0F172A;
  --heat-text-down: #0F172A;
}

/* Dark mode automatique : si l'utilisateur n'a pas choisi de thème manuellement,
   on respecte la préférence système. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]):not([data-theme="blue"]):not(.theme-blue):not(.theme-emerald) {
    --paper: #0F172A;       --paper-dim: #0B1120;
    --ink: #E2E8F0;         --ink-soft: #94A3B8;
    --accent: #60A5FA;      --accent-soft: #1E3A5F;
    --success: #34D399;     --success-soft: #064E3B;
    --danger: #F87171;      --danger-soft: #450A0A;
    --warning: #FBBF24;     --warning-soft: #451A03;
    --line: #334155;        --card: #1E293B;    --card-alt: #334155;
    --slate: #94A3B8;
    --slate-soft: #334155;
  }
}

/* Theme button */
.theme-btn {
  background: transparent; border: 1px solid transparent; border-radius: 6px;
  cursor: pointer; padding: 4px 8px; color: var(--ink-soft);
  display: flex; align-items: center; transition: 0.12s;
}
.theme-btn:hover { background: var(--card-alt); color: var(--ink); }

/* ── Fin ── */