/* Station « grande dimension » de index_V1.html : maths en MathML et figure Monte Carlo. */

/* Formules : police mathématique du système (Cambria Math, STIX Two Math, Latin Modern Math) */
math { font-family: "Latin Modern Math", "STIX Two Math", "Cambria Math", math; font-size: 1.08em; font-weight: 400; }
math[display="block"] { margin: 12px 0; font-size: 1.12em; overflow-x: auto; overflow-y: hidden; padding-block: 2px; }
.station-copy math { color: var(--ink); }

/* Résumé, puis détails dépliables */
.ht-more { margin-top: 18px; display: inline-flex; align-items: center; gap: 8px; padding: 0; font-size: .875rem; color: var(--ink-2); text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 4px; }
.ht-more:hover { color: var(--ink); text-decoration-color: currentColor; }
.ht-more::after { content: ""; width: 7px; height: 7px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: translateY(-2px) rotate(45deg); transition: transform var(--fast) var(--ease); }
.ht-more[aria-expanded="true"]::after { transform: translateY(2px) rotate(-135deg); }
.ht-details { margin-top: 14px; padding: 4px 0 4px 16px; border-inline-start: 2px solid var(--line-2); }
.station-copy .ht-details p { margin-top: 12px; font-size: .9375rem; }
.station-copy .more + .more { margin-top: 10px; }
.station-copy .more-small { font-size: .875rem; font-weight: 400; }

/* Commandes au-dessus du graphique */
/* tout ce qui n'est pas le graphique est un peu plus petit, au profit du graphique */
.fig-hotelling { padding: clamp(16px, 2.4vw, 26px); }
.fig-hotelling .controls { display: grid; gap: 10px; margin: 0 0 12px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.ht-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 18px; }
.ht-row3 { grid-template-columns: auto auto auto; justify-content: space-between; }
.ht-ctl { display: grid; grid-template-columns: 1fr auto; gap: 0 10px; align-items: center; font-size: .78rem; color: var(--ink-2); }
.ht-ctl input[type="range"] { grid-column: 1 / -1; width: 100%; margin-block: 2px; }
.ht-ctl .ht-range { grid-column: 1 / -1; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 6px; }
.ht-ctl .ht-range input[type="range"] { min-width: 0; }
.ht-range .pt-lim { font: 400 .66rem var(--mono); color: var(--ink-3); font-variant-numeric: tabular-nums; }
.ht-ctl { position: relative; }
/* valeur entourée de ses flèches ‹ › */
.ht-val { display: inline-flex; align-items: center; gap: 1px; }
.ht-step { width: 20px; height: 22px; border-radius: 5px; font: 400 .95rem/1 var(--sans); color: var(--ink-3); display: inline-grid; place-items: center; user-select: none; touch-action: manipulation; }
.ht-step:hover { color: var(--ink); background: var(--raised); }
.ht-step:active { transform: scale(.92); }
.ht-step:disabled { opacity: .4; pointer-events: none; }
.ht-val .ht-num { width: 3.9rem; text-align: center; }
/* barre au-dessus du graphique : zoom à gauche, paramètres à droite */
.ht-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; margin-bottom: 2px; }
.ht-head .ht-chips { margin: 0; }
.ht-zoom { display: inline-flex; gap: 2px; padding: 2px; border: 1px solid var(--line-2); border-radius: 8px; }
.ht-zoom button { min-width: 26px; height: 24px; padding-inline: 6px; border-radius: 5px; font: 400 .8rem/1 var(--sans); color: var(--ink-2); }
.ht-zoom button:hover { background: var(--raised); color: var(--ink); }
.ht-zoom b { font: 400 .72rem var(--mono); color: var(--ink-3); }
/* valeur du curseur, modifiable à la main */
.ht-num { width: 4.6rem; padding: 2px 6px; border: 1px solid transparent; border-radius: 5px; background: transparent; font: 400 .74rem var(--mono); color: var(--ink); text-align: end; font-variant-numeric: tabular-nums; }
.ht-num:hover { border-color: var(--line-2); }
.ht-num:focus { border-color: var(--accent); background: var(--surface); outline: none; }
.ht-ctl.is-auto { opacity: .6; }
.ht-ctl.is-auto .ht-num { color: var(--accent-ink); }
/* bulle : rappel des bornes du curseur, 2 s */
.ht-bubble { position: absolute; right: 0; bottom: calc(100% + 4px); z-index: 2; padding: 5px 9px; border-radius: 7px; background: var(--ink); color: var(--bg); font-size: .75rem; white-space: nowrap; pointer-events: none; opacity: 0; transform: translateY(4px); transition: opacity .18s, transform .18s; }
.ht-bubble.on { opacity: 1; transform: none; }
.ht-seg { display: grid; gap: 4px; font-size: .78rem; color: var(--ink-2); }
.ht-seg .seg-set { justify-self: start; }
.ht-seg .seg-set button { width: auto; min-width: 34px; height: 26px; padding-inline: 8px; font-size: .74rem; }
.ht-law { grid-template-columns: auto 1fr; align-items: center; gap: 12px; }
/* invitation, en tête du panneau */
/* une seule ligne : le texte rapetisse un peu avec le panneau (jusqu'à 11 px), puis passe à la ligne sur téléphone */
.ht-try { margin: 0; display: flex; align-items: center; gap: 8px; font-size: clamp(.6875rem, calc((100cqi - 60px) / 36), .8125rem); color: var(--ink-3); }
.ht-try b { font-weight: 500; color: var(--accent-ink); }
.ht-try .icon { width: 14px; height: 14px; color: var(--accent-ink); flex: none; }
/* première ligne : la loi, et à droite l'indice de queue de Pareto */
.ht-lawrow { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; }
.ht-alpha { flex: 1 1 190px; max-width: 250px; }
.ht-alpha .ht-num { width: 3.2rem; }
/* progression du Monte Carlo, façon tqdm */
/* sur sa propre ligne, juste au-dessus du graphique : rien ne la recouvre, et sa place reste réservée (pas de saut) */
.ht-prog { display: flex; align-items: center; gap: 8px; height: 18px; margin: 4px 0 6px; font: 400 .72rem/1 var(--mono); color: var(--ink-2); font-variant-numeric: tabular-nums; transition: opacity .4s; }
.ht-prog-bar { width: 96px; height: 5px; border-radius: 3px; background: var(--line-2); overflow: hidden; }
.ht-prog-bar i { display: block; height: 100%; background: var(--accent); transform-origin: 0 50%; transform: scaleX(0); }
.ht-prog.done { opacity: 0; }
.ht-prog[hidden] { display: flex !important; visibility: hidden; }
.ht-alpha[hidden] { display: none !important; }
.ht-law .seg-set button { font-family: var(--sans); }
.ht-note { margin: 0; font-size: .78rem; line-height: 1.5; color: var(--ink-3); }
.ht-warn { margin-top: 4px; color: var(--ink-2); }
/* légende du graphique : hypothèses, puis situation */
.ht-caption { margin-top: 8px; display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 8px 16px; }
.ht-cap-text { flex: 1 1 260px; min-width: 0; }
.ht-lw { flex: 0 1 auto; font-size: .8rem; }
.ht-lw .ht-hint { display: block; }
.ht-caption p { margin: 0; font-size: .8rem; line-height: 1.5; color: var(--ink-2); }
.ht-caption p.ht-note { color: var(--ink-3); font-size: .78rem; }
.fig-hotelling .legend { margin-top: 8px; gap: 4px 16px; font-size: .78rem; }
.ht-bars rect.rej { fill: var(--reject); opacity: 1; }
.sw-rej { width: 10px; height: 10px; border-radius: 2px; background: var(--reject); }
.fig-hotelling { --reject: #e5484d; }
/* lien vers le notebook, en bas du panneau */
.ht-code { display: inline-flex; align-items: center; gap: 8px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); width: 100%; font-size: .8125rem; color: var(--accent-ink); text-decoration: none; }
.ht-code:hover span { text-decoration: underline; text-underline-offset: 3px; }
.ht-code .icon { width: 15px; height: 15px; }
/* section Code : menu déroulant des notebooks de la page */
.code-page-btn { display: inline-flex; align-items: center; gap: 10px; padding: 0; text-align: start; color: var(--ink); }
.code-page-btn h3 { margin: 0; }
.code-page-btn::after { content: ""; width: 8px; height: 8px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: translateY(-3px) rotate(45deg); transition: transform var(--fast) var(--ease); }
.code-page-btn[aria-expanded="true"]::after { transform: translateY(2px) rotate(-135deg); }
#code-page-list { margin-top: 12px; }
#code-page-list[hidden] { display: none !important; }

/* Graphique */
.ht-chart { position: relative; }
.ht-chips { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px 14px; margin: 0 0 2px; font: 400 .75rem/1.4 var(--mono); color: var(--ink-3); }
.ht-chips b { color: var(--ink); font-weight: 400; }
.fig-hotelling .ht-plot { width: 100%; height: auto; overflow: hidden; display: block; }
.ht-bars rect { fill: var(--accent); opacity: .8; }
.fig-hotelling.is-running .ht-bars rect { opacity: .55; }
.ht-baseline { stroke: var(--line-2); stroke-width: 1; vector-effect: non-scaling-stroke; }
.ht-axis line { stroke: var(--line-2); stroke-width: 1; vector-effect: non-scaling-stroke; }
.ht-axis text { font: 400 10px var(--mono); fill: var(--ink-3); }
.ht-bound { stroke: var(--ink); stroke-width: 2; vector-effect: non-scaling-stroke; }
.ht-box line { stroke: var(--ink); stroke-width: 1.4; vector-effect: non-scaling-stroke; }
.ht-box rect { fill: var(--surface); fill-opacity: 1; stroke: var(--ink); stroke-width: 1.4; vector-effect: non-scaling-stroke; }
.ht-z { stroke: var(--ink-2); stroke-width: 1.2; stroke-dasharray: 4 4; vector-effect: non-scaling-stroke; }
.ht-gauss { fill: none; stroke: var(--ink); stroke-width: 1.4; vector-effect: non-scaling-stroke; }
.sw-box { width: 16px; height: 9px; border: 1.4px solid var(--ink); border-radius: 2px; }
.sw-curve { width: 18px; border-top: 1.4px solid var(--ink); border-radius: 50% 50% 0 0; }

/* Sous le graphique */
.ht-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; margin-top: 14px; }
.ht-actions .btn-quiet { margin-inline-start: auto; }
.ht-check { display: inline-flex; align-items: center; gap: 10px; font-size: .875rem; color: var(--ink); cursor: pointer; }
.ht-check input { width: 18px; height: 18px; accent-color: var(--accent); margin: 0; flex: none; }
.ht-hint { color: var(--ink-3); font-size: .8125rem; }
.ht-info { width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--line-2); font: 500 .75rem/1 var(--sans); color: var(--ink-2); display: inline-grid; place-items: center; }
.ht-info:hover, .ht-info[aria-expanded="true"] { color: var(--ink); background: var(--raised); }
.ht-def { margin: 10px 0 0; font-size: .8125rem; line-height: 1.6; color: var(--ink-2); }

.ht-params[hidden], [data-note][hidden], [data-only][hidden], .ht-details[hidden], .ht-def[hidden], [data-warn][hidden] { display: none !important; }

@container (max-width: 480px) {
  .ht-row { grid-template-columns: 1fr; }
  .ht-row3 { grid-template-columns: 1fr 1fr; justify-content: stretch; }
  .ht-law { grid-template-columns: 1fr; }
  .ht-hint { display: block; }
}

/* index_V4 ------------------------------------------------------------------ */
/* min et max sous les deux bouts du curseur, plus d'écart entre deux curseurs voisins : on ne confond pas
   le max de l'un avec le min de l'autre */
.ht-row { column-gap: 40px; }
.ht-ctl .ht-range { grid-template-columns: 1fr 1fr; row-gap: 0; }
.ht-ctl .ht-range input[type="range"] { grid-column: 1 / -1; grid-row: 1; }
.ht-ctl .ht-range .pt-lim { grid-row: 2; line-height: 1.2; }
.ht-ctl .ht-range .pt-lim:first-child { grid-column: 1; justify-self: start; }
.ht-ctl .ht-range .pt-lim:last-child { grid-column: 2; justify-self: end; }
.seg-set button:disabled { opacity: .35; cursor: not-allowed; }
.ht-kwarn { margin: 2px 0 0; font-size: .75rem; color: var(--ink-3); }
.ht-kwarn[hidden] { display: none; }

/* figure 1 : légende à gauche, cases à droite (renormaliser, Ledoit–Wolf), pénalité calibrée sous la légende */
.fig-hotelling .ht-caption { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "text norm" "cal lw" "msg msg"; gap: 12px 28px; align-items: start; }
.fig-hotelling .ht-cap-text { grid-area: text; }
.fig-hotelling .ht-opt-norm { grid-area: norm; display: flex; align-items: flex-start; gap: 8px; }
.fig-hotelling .ht-opt-cal { grid-area: cal; }
.fig-hotelling .ht-opt-lw { grid-area: lw; }
.fig-hotelling .ht-rauto { grid-area: msg; }
.ht-check.ht-lw { align-items: flex-start; }
.ht-check.ht-lw input { margin-top: 2px; }

/* pied de chaque figure : le code à gauche, « Nouveau tirage » à droite, sur la même ligne */
.fig-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.fig-foot .ht-code { width: auto; margin: 0; padding: 0; border: 0; }
.fig-foot .btn-quiet { margin-inline-start: auto; }

@container (max-width: 480px) {
  .fig-hotelling .ht-caption { grid-template-columns: minmax(0, 1fr); grid-template-areas: "text" "norm" "cal" "lw" "msg"; }
  .ht-row { column-gap: 18px; }
}
/* n, δ, MC : chaque choix sur une ligne ; la rangée passe à la ligne s'il le faut */
.ht-row3 { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 18px; }
.ht-row3 .seg-set button { white-space: nowrap; }
