/* =============================================================================
   Lot « Marchés & outils » : /marches/, fiches d'indice, calendrier économique, outils.
   Préfixe .mw-mk-. Tokens sémantiques uniquement (aucune couleur en dur). Mobile d'abord (360 px),
   ruptures 48rem / 64rem / 80rem.
   ========================================================================== */

/* ------------------------------------------------------------------ 1. En-tête de graphique + séance */
.mw-mk-chart-head { display: flex; flex-direction: column; gap: var(--mw-s-4); }
@media (min-width: 64rem) {
  .mw-mk-chart-head { flex-direction: row; align-items: center; justify-content: space-between; gap: var(--mw-s-6); }
  .mw-mk-chart-head .mw-mk-session { max-width: 560px; }
}

.mw-mk-session {
  display: flex; align-items: flex-start; gap: var(--mw-s-4);
  padding: var(--mw-s-4) var(--mw-s-5);
  border: 1px solid var(--mw-line);
  border-radius: var(--mw-r-lg);
  background: var(--mw-surface);
  box-shadow: var(--mw-highlight);
  min-width: 0;
}
.mw-mk-session__dot {
  flex: none; width: 10px; height: 10px; margin-top: .55em;
  border-radius: 50%; background: var(--mw-text-3);
}
.mw-mk-session.is-open { border-color: color-mix(in srgb, var(--mw-up) 40%, var(--mw-line)); }
.mw-mk-session.is-open .mw-mk-session__dot { background: var(--mw-up); box-shadow: 0 0 0 4px var(--mw-up-soft); }
.mw-mk-session.is-closed .mw-mk-session__dot { background: var(--mw-warn); box-shadow: 0 0 0 4px var(--mw-warn-soft); }
@media (prefers-reduced-motion: no-preference) {
  .mw-mk-session.is-open .mw-mk-session__dot { animation: mw-mk-pulse 2.4s ease-in-out infinite; }
}
@keyframes mw-mk-pulse { 50% { box-shadow: 0 0 0 7px transparent; } }
.mw-mk-session__body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.mw-mk-session__label { font-weight: 650; color: var(--mw-text); line-height: 1.35; }
.mw-mk-session__detail { font-size: var(--mw-fs-sm); color: var(--mw-text-2); }
.mw-mk-session__detail:empty { display: none; }
.mw-mk-session__note { font-size: var(--mw-fs-xs); color: var(--mw-text-3); line-height: 1.5; }
.mw-theme-light .mw-mk-session__note { color: var(--mw-text-2); }

.mw-mk-sessionband { display: grid; gap: var(--mw-s-6); align-items: start; }
@media (min-width: 64rem) { .mw-mk-sessionband { grid-template-columns: minmax(0, 6fr) minmax(0, 5fr); gap: var(--mw-s-8); } }
.mw-mk-sessionband__hours { display: flex; flex-direction: column; gap: var(--mw-s-3); }

/* ------------------------------------------------------------------ 2. Horaires convertis */
.mw-mk-hours {
  display: grid; gap: 0;
  border: 1px solid var(--mw-line); border-radius: var(--mw-r-md);
  background: var(--mw-surface); overflow: hidden;
}
.mw-mk-hours > div {
  display: flex; align-items: baseline; justify-content: space-between; gap: var(--mw-s-4);
  padding: var(--mw-s-3) var(--mw-s-4); min-height: 44px;
}
.mw-mk-hours > div + div { border-top: 1px solid var(--mw-line); }
.mw-mk-hours > div[hidden] { display: none; }
.mw-mk-hours dt { font-size: var(--mw-fs-sm); color: var(--mw-text-2); }
.mw-mk-hours dd { font-weight: 650; color: var(--mw-text); text-align: right; font-size: var(--mw-fs-base); }
.mw-mk-hours--lg dd { font-family: var(--mw-font-display); font-size: var(--mw-fs-lg); letter-spacing: -.01em; }
.mw-mk-hours--sm > div { padding: var(--mw-s-2) var(--mw-s-3); min-height: 36px; }
.mw-mk-hours--sm dd { font-size: var(--mw-fs-sm); }
.mw-mk-hours--sm { background: var(--mw-bg-2); }
.mw-theme-light .mw-mk-hours { background: var(--mw-surface); }

.mw-mk-time { display: inline-flex; flex-wrap: wrap; align-items: baseline; gap: 0 var(--mw-s-1); color: var(--mw-text); font-weight: 600; }
.mw-mk-time__local { font-weight: 400; color: var(--mw-text-2); }
.mw-mk-time__local[hidden] { display: none; }

.mw-mk-dst {
  padding: var(--mw-s-3) var(--mw-s-4);
  border-radius: var(--mw-r-md);
  background: var(--mw-warn-soft);
  border: 1px solid color-mix(in srgb, var(--mw-warn) 35%, transparent);
  color: var(--mw-text); font-size: var(--mw-fs-sm);
}
.mw-mk-dst[hidden] { display: none; }

.mw-mk-note { margin-top: var(--mw-s-4); max-width: 68ch; }
.mw-mk-risk { margin-top: var(--mw-s-7); }

/* ------------------------------------------------------------------ 3. Façades et widgets TradingView */
.mw-mk-embed { --mw-embed-h: 32rem !important; }
@media (min-width: 48rem) { .mw-mk-embed--advanced-chart { --mw-embed-h: 36rem !important; } }
@media (min-width: 64rem) { .mw-mk-embed--advanced-chart { --mw-embed-h: 40rem !important; } }
.mw-mk-embed--events { --mw-embed-h: 34rem !important; }
@media (min-width: 64rem) { .mw-mk-embed--events { --mw-embed-h: 38rem !important; } }
.mw-mk-embed--mini { --mw-embed-h: 17rem !important; }

.mw-mk-embed .mw-embed__facade { gap: var(--mw-s-2); padding: var(--mw-s-4); overflow-y: auto; }
.mw-mk-embed .mw-embed__text { max-width: 40ch; }
.mw-mk-embed__extra { display: flex; flex-direction: column; align-items: center; gap: var(--mw-s-1); position: relative; max-width: 100%; }
.mw-mk-always { min-height: 44px; text-align: left; font-size: var(--mw-fs-sm); max-width: 34ch; padding-block: 6px; }
.mw-mk-always small { font-size: var(--mw-fs-xs); }
.mw-mk-direct {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding-inline: var(--mw-s-2);
  font-size: var(--mw-fs-sm); color: var(--mw-text-2);
  text-decoration: underline; text-underline-offset: .2em; text-decoration-color: var(--mw-line-strong);
}
.mw-mk-direct:hover { color: var(--mw-text); text-decoration-color: currentColor; }
.mw-mk-direct .mw-icon { width: 14px; height: 14px; }
.mw-mk-embed--mini .mw-embed__icon { display: none; }
.mw-mk-embed--mini .mw-embed__title { font-size: var(--mw-fs-base); }
.mw-mk-embed--mini .mw-embed__text { font-size: var(--mw-fs-xs); }
.mw-mk-embed--mini .mw-embed__provider { display: none; }
.mw-mk-embed--mini .mw-mk-direct { min-height: 36px; font-size: var(--mw-fs-xs); }

.mw-mk-embed.is-loaded .mw-embed__frame { min-height: 0; height: var(--mw-embed-h); }
.mw-mk-tv { display: flex; flex-direction: column; height: 100%; width: 100%; }
.mw-mk-tv .tradingview-widget-container__widget { flex: 1 1 auto; min-height: 0; width: 100%; }
.mw-mk-tv__copy { flex: none; padding: var(--mw-s-1) var(--mw-s-3); font-size: var(--mw-fs-xs); color: var(--mw-text-3); text-align: right; }
.mw-mk-tv__copy a { color: var(--mw-text-2); text-decoration: underline; text-underline-offset: .2em; }

/* Barre « Toujours afficher » (visible seulement quand le visiteur l'a choisi) */
.mw-mk-pref {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--mw-s-2) var(--mw-s-4);
  padding: var(--mw-s-2) var(--mw-s-4);
  border: 1px solid var(--mw-line); border-radius: var(--mw-r-md); background: var(--mw-surface);
  font-size: var(--mw-fs-sm); color: var(--mw-text-2);
}
.mw-mk-pref[hidden] { display: none; }
.mw-mk-pref p { display: flex; align-items: center; gap: var(--mw-s-2); }
.mw-mk-pref .mw-icon { width: 18px; height: 18px; color: var(--mw-accent-2); flex: none; }
.mw-mk-pref__undo {
  min-height: 44px; padding: 0 var(--mw-s-2); background: none; border: 0; cursor: pointer;
  color: var(--mw-accent); font: inherit; font-weight: 600;
  text-decoration: underline; text-underline-offset: .2em;
}
.mw-mk-pref__undo:hover { color: var(--mw-text); }

.mw-mk-legend { display: grid; gap: var(--mw-s-2); font-size: var(--mw-fs-sm); color: var(--mw-text-2); }
.mw-mk-legend li { display: flex; align-items: flex-start; gap: var(--mw-s-3); }
.mw-mk-legend .mw-icon { width: 18px; height: 18px; margin-top: 2px; flex: none; color: var(--mw-accent-2); }

/* ------------------------------------------------------------------ 4. Cartes d'indice (/marches/) */
.mw-mk-cards > * { min-width: 0; }
.mw-mk-card { display: flex; flex-direction: column; gap: var(--mw-s-4); }
.mw-mk-card .mw-card__text { margin: 0; }
.mw-mk-card__link { color: inherit; text-decoration: none; }
.mw-mk-card__link:hover { text-decoration: underline; text-underline-offset: .2em; }
.mw-mk-card__hours { display: flex; flex-direction: column; gap: var(--mw-s-2); }
.mw-mk-card__label { display: flex; align-items: center; gap: 6px; font-size: var(--mw-fs-xs); text-transform: uppercase; letter-spacing: .1em; color: var(--mw-text-2); }
.mw-mk-card__label .mw-icon { width: 14px; height: 14px; }
.mw-mk-card .mw-card__footer { margin-top: auto; }

.mw-mk-compare th[scope="row"] { color: var(--mw-text); font-weight: 650; }
.mw-mk-compare td { color: var(--mw-text-2); }
@media (max-width: 47.99rem) {
  .mw-mk-compare tbody tr { padding-block: var(--mw-s-4); }
  .mw-mk-compare th[scope="row"] { font-family: var(--mw-font-display); font-size: var(--mw-fs-md); padding-bottom: var(--mw-s-2); }
  .mw-mk-compare td { text-align: right; }
}

/* ------------------------------------------------------------------ 5. Fiche d'indice */
.mw-mk-facts .mw-stat__value { font-size: clamp(1.25rem, 1rem + 1vw, 1.75rem); overflow-wrap: anywhere; }

.mw-mk-article { display: grid; gap: var(--mw-s-6); align-items: start; }
@media (min-width: 64rem) { .mw-mk-article { grid-template-columns: 15rem minmax(0, 1fr); gap: var(--mw-s-8); } }

.mw-mk-toc { min-width: 0; }
.mw-mk-toc__title { font-size: var(--mw-fs-xs); text-transform: uppercase; letter-spacing: .14em; font-weight: 600; color: var(--mw-text-2); margin-bottom: var(--mw-s-2); }
.mw-mk-toc__list {
  display: flex; gap: var(--mw-s-2); overflow-x: auto; scroll-snap-type: x proximity;
  padding-bottom: var(--mw-s-2); margin-inline: calc(var(--mw-gutter) * -1); padding-inline: var(--mw-gutter);
  scrollbar-width: thin;
}
.mw-mk-toc__list li { flex: none; scroll-snap-align: start; }
.mw-mk-toc__list a {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 var(--mw-s-4);
  border: 1px solid var(--mw-line-strong); border-radius: var(--mw-r-pill);
  color: var(--mw-text); font-size: var(--mw-fs-sm); text-decoration: none; background: var(--mw-surface); white-space: nowrap;
}
.mw-mk-toc__list a:hover { border-color: var(--mw-accent); color: var(--mw-accent); }
@media (min-width: 64rem) {
  .mw-mk-toc { position: sticky; top: calc(var(--mw-header-h) + var(--mw-s-6)); }
  .mw-mk-toc__list { flex-direction: column; overflow: visible; margin-inline: 0; padding: 0; gap: 0; border-left: 1px solid var(--mw-line-strong); }
  .mw-mk-toc__list a {
    border: 0; border-radius: 0; background: none; padding: 0 var(--mw-s-4); margin-left: -1px;
    border-left: 2px solid transparent; white-space: normal;
  }
  .mw-mk-toc__list a:hover { border-left-color: var(--mw-accent); }
}

.mw-mk-prose { max-width: 70ch; min-width: 0; }
.mw-mk-prose h3 { scroll-margin-top: calc(var(--mw-header-h) + var(--mw-s-5)); }
.mw-mk-prose > h3:first-child { margin-top: 0; }
.mw-mk-aside { padding: var(--mw-s-3) var(--mw-s-4); border-left: 2px solid var(--mw-accent); background: var(--mw-bg-2); border-radius: 0 var(--mw-r-md) var(--mw-r-md) 0; font-size: var(--mw-fs-base); color: var(--mw-text-2); }
.mw-mk-movers { display: grid; gap: var(--mw-s-3); list-style: none; padding-left: 0 !important; }
.mw-mk-movers li { padding: var(--mw-s-3) var(--mw-s-4); border: 1px solid var(--mw-line); border-radius: var(--mw-r-md); background: var(--mw-surface); }
.mw-mk-movers li + li { margin-top: 0; }
.mw-mk-prose .mw-mk-hours { margin-block: var(--mw-s-4); }
#mk-negocier, #mk-vocab, #mk-erreurs { scroll-margin-top: calc(var(--mw-header-h) + var(--mw-s-5)); }

/* Façons de négocier */
.mw-mk-way { display: flex; flex-direction: column; gap: var(--mw-s-3); }
.mw-mk-way .mw-card__text { margin: 0; }
.mw-mk-specs { display: grid; gap: var(--mw-s-2); }
.mw-mk-specs li { display: flex; gap: var(--mw-s-3); align-items: flex-start; padding: var(--mw-s-3); border: 1px solid var(--mw-line); border-radius: var(--mw-r-md); background: var(--mw-bg-2); font-size: var(--mw-fs-sm); color: var(--mw-text-2); }
.mw-mk-specs strong { color: var(--mw-text); font-weight: 650; }
.mw-mk-specs__code { flex: none; min-width: 3.2em; padding: 2px 8px; border: 1px solid var(--mw-line-strong); border-radius: 6px; color: var(--mw-accent-2); text-align: center; font-size: var(--mw-fs-xs); }

.mw-mk-cta {
  display: flex; flex-direction: column; gap: var(--mw-s-4);
  margin-top: var(--mw-s-6); padding: var(--mw-s-5);
  border: 1px solid var(--mw-line-strong); border-radius: var(--mw-r-xl);
  background: var(--mw-surface); box-shadow: var(--mw-highlight);
}
.mw-mk-cta p { margin-top: var(--mw-s-1); max-width: 56ch; }
@media (min-width: 64rem) { .mw-mk-cta { flex-direction: row; align-items: center; justify-content: space-between; padding: var(--mw-s-6); gap: var(--mw-s-7); } }

/* Vocabulaire */
.mw-mk-vocab { display: grid; gap: var(--mw-s-3); }
@media (min-width: 48rem) { .mw-mk-vocab { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--mw-s-4); } }
@media (min-width: 64rem) { .mw-mk-vocab { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.mw-mk-vocab > div { padding: var(--mw-s-4) var(--mw-s-5); border: 1px solid var(--mw-line); border-radius: var(--mw-r-lg); background: var(--mw-surface); box-shadow: var(--mw-highlight); }
.mw-theme-light .mw-mk-vocab > div { box-shadow: var(--mw-highlight), var(--mw-shadow-1); }
.mw-mk-vocab dt { font-family: var(--mw-font-display); font-weight: 700; font-size: var(--mw-fs-lg); letter-spacing: -.015em; color: var(--mw-text); margin-bottom: var(--mw-s-1); }
.mw-mk-vocab dd { color: var(--mw-text-2); font-size: var(--mw-fs-base); }

/* Erreurs fréquentes */
.mw-mk-mistakes-wrap { margin-top: var(--mw-s-9); scroll-margin-top: calc(var(--mw-header-h) + var(--mw-s-5)); }
.mw-mk-mistakes { counter-reset: mk-err; display: grid; gap: var(--mw-s-3); }
@media (min-width: 48rem) { .mw-mk-mistakes { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--mw-s-4); } }
.mw-mk-mistakes li { counter-increment: mk-err; position: relative; padding: var(--mw-s-4) var(--mw-s-5) var(--mw-s-4) calc(var(--mw-s-5) + 2.6rem); border: 1px solid var(--mw-line); border-radius: var(--mw-r-lg); background: var(--mw-surface); }
.mw-mk-mistakes li::before {
  content: counter(mk-err, decimal-leading-zero);
  position: absolute; left: var(--mw-s-4); top: var(--mw-s-4);
  font-family: var(--mw-font-display); font-weight: 800; font-size: var(--mw-fs-lg); color: var(--mw-accent);
  font-variant-numeric: tabular-nums;
}
.mw-mk-mistakes h3 { font-size: var(--mw-fs-md); margin-bottom: var(--mw-s-1); }
.mw-mk-mistakes p { color: var(--mw-text-2); font-size: var(--mw-fs-base); }

/* ------------------------------------------------------------------ 6. Calendrier économique */
.mw-mk-tztable { margin-top: var(--mw-s-6); }
.mw-mk-events > * { min-width: 0; }
.mw-mk-event { display: flex; flex-direction: column; gap: var(--mw-s-3); }
.mw-mk-event__list { display: grid; gap: var(--mw-s-3); }
.mw-mk-event__list dt { font-size: var(--mw-fs-xs); text-transform: uppercase; letter-spacing: .12em; font-weight: 600; color: var(--mw-accent); margin-bottom: 2px; }
.mw-mk-event__list dd { color: var(--mw-text-2); font-size: var(--mw-fs-base); }
.mw-mk-rules { align-self: start; }
.mw-mk-rules .mw-checklist { margin-top: var(--mw-s-3); }

/* ------------------------------------------------------------------ 7. Répertoire d'outils */
.mw-mk-bento > * { min-width: 0; }
.mw-mk-when { font-size: var(--mw-fs-sm); color: var(--mw-text-2); }
.mw-mk-when strong { color: var(--mw-text); font-weight: 650; }
@media (min-width: 48rem) and (max-width: 63.99rem) { .mw-mk-bento > :last-child { grid-column: span 6; } }

/* ------------------------------------------------------------------ 8. Pages des calculateurs */
.mw-mk-tool { min-width: 0; }
.mw-mk-tool .mwc { max-width: 100%; }
.mw-mk-howto > * { min-width: 0; }
.mw-mk-example { display: flex; flex-direction: column; gap: var(--mw-s-4); }
.mw-mk-example__head { display: flex; flex-direction: column; align-items: flex-start; gap: var(--mw-s-2); }
.mw-mk-example__data { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; border: 1px solid var(--mw-line); border-radius: var(--mw-r-md); overflow: hidden; background: var(--mw-line); }
.mw-mk-example__data > div { background: var(--mw-surface-2); padding: var(--mw-s-3); min-width: 0; }
.mw-mk-example__data dt { font-size: var(--mw-fs-xs); color: var(--mw-text-2); }
.mw-mk-example__data dd { font-family: var(--mw-font-display); font-weight: 700; font-size: var(--mw-fs-md); color: var(--mw-text); overflow-wrap: anywhere; }
.mw-mk-calc { counter-reset: mk-calc; display: grid; gap: var(--mw-s-2); }
.mw-mk-calc li { counter-increment: mk-calc; position: relative; padding-left: 2.2rem; color: var(--mw-text-2); font-size: var(--mw-fs-base); font-variant-numeric: tabular-nums; }
.mw-mk-calc li::before {
  content: counter(mk-calc); position: absolute; left: 0; top: .1em;
  display: grid; place-items: center; width: 1.5rem; height: 1.5rem; border-radius: 50%;
  background: var(--mw-accent-soft); color: var(--mw-accent); font-size: var(--mw-fs-xs); font-weight: 700;
}

/* ------------------------------------------------------------------ 9. Sans JavaScript / mouvement réduit */
@media (prefers-reduced-motion: reduce) {
  .mw-mk-session__dot { animation: none !important; }
  .mw-mk-toc__list { scroll-behavior: auto; }
}

/* Éléments qui exigent JavaScript : masqués par l'attribut hidden tant que marches.js ne les affiche pas. */
.mw-mk-embed [data-mw-mk-needs-js][hidden] { display: none; }
