/* ==========================================================================
   SENTIA — Site final (base Piste A + piste hybride : fond blanc, accent unique, arrondis modérés)
   Variables nommées selon la fiche e3-1 (--color-*, --space-*, --radius-card, --font-sans).
   Sommaire : 1 Variables · 2 Base · 3 Cadre · 4 Masthead · 5 Fil & cartes
              6 Recherche · 7 Fiche détail · 8 Feuilles · 9 Onboarding
              10 Notifications · 11 Réglages · 12 Navigation · 13 Board
   ========================================================================== */

/* 1. VARIABLES ------------------------------------------------------------
   Design tokens demandés par la fiche e3-1 (noms conservés) + extras Sentia.
   Palette 60-30-10 : 60 % fond blanc · 30 % gris neutres · 10 % accent bleu nuit
   (le rouge est réservé aux baisses et alertes).
   Contrastes : texte / fond 16,6:1 · muted / fond 7,6:1 · primary / blanc 12,4:1
   ------------------------------------------------------------------------ */
:root {
  /* Couleurs (tokens de la fiche) */
  --color-bg: #ffffff;
  --color-surface: #ffffff;
  --color-text: #1b1f27;             /* anthracite */
  --color-text-muted: #4b5563;
  --color-primary: #023564;          /* unique couleur d'accent */
  --color-primary-hover: #012648;

  /* Couleurs (extras Sentia) */
  --color-on-primary: #ffffff;       /* texte posé sur l'accent */
  --color-surface-alt: #fafafa;      /* gris très clair */
  --color-pearl: #e5e7eb;            /* gris perle (états inactifs) */
  --color-border: #d1d5db;           /* contours de contrôles */
  --color-hairline: #eceef0;         /* filets entre les blocs : à peine visibles */
  --color-up: var(--color-primary);  /* hausse : accent + flèche + signe + */
  --color-down: #b3261e;             /* baisse : rouge + flèche + signe − */
  --color-backdrop: rgba(27, 31, 39, .4);

  /* Typographie */
  --font-sans: "Montserrat", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-signature: "Newsreader", "Iowan Old Style", Georgia, serif;   /* typo signature Sentia : titres, chiffres clés, marque */
  --font-serif: var(--font-signature);

  --text-xs: .6875rem;   /* 11 */
  --text-sm: .8125rem;   /* 13 */
  --text-md: .9375rem;   /* 15 */
  --text-lg: 1.125rem;   /* 18 */
  --text-xl: 1.5rem;     /* 24 */
  --text-2xl: 2rem;      /* 32 */

  /* Espacements (échelle de la fiche : 4 · 8 · 16 · 24, prolongée) */
  --space-1: 4px;
  --space-2: 8px;
  --space-2h: 12px;      /* intermédiaire utilisé par les cartes */
  --space-3: 16px;
  --space-4: 24px;
  --space-5: 32px;
  --space-6: 48px;
  --gutter: 20px;

  /* Formes : arrondis modérés (piste hybride) */
  --radius-card: 12px;
  --radius-control: 8px;
  --radius-sm: 2px;
  --shadow-sheet: 0 -6px 24px rgba(27, 31, 39, .10);
  --shadow-phone: 0 30px 60px rgba(27, 31, 39, .25);

  /* Transitions */
  --t-fast: 140ms ease;
  --t-med: 260ms cubic-bezier(.2, .7, .2, 1);
}

/* Version « Avant » (bouton de comparaison) : valeurs d'origine de la Piste A.
   On ne change QUE les valeurs des variables ; aucune règle n'est dupliquée. */
[data-version="avant"] {
  --color-bg: #fbf8f2;
  --color-surface: #fbf8f2;
  --color-text: #14213d;
  --color-text-muted: #4f596b;
  --color-primary: #14213d;
  --color-primary-hover: #0c1630;
  --color-on-primary: #fbf8f2;
  --color-surface-alt: #f3efe6;
  --color-pearl: #e4e6e9;
  --color-hairline: #d5d3cc;
  --color-border: #d5d3cc;
  --color-up: #2d5e46;
  --color-down: #8a2f38;
  --color-backdrop: rgba(20, 33, 61, .38);
  --radius-card: 10px;
  --radius-control: 4px;
}
/* Thème sombre (réglage « Apparence ») : mêmes noms, autres valeurs */
[data-theme="dark"] {
  --color-bg: #0f1520;
  --color-surface: #151c2a;
  --color-text: #f3f4f6;
  --color-text-muted: #b6bdc9;
  --color-primary: #9cc2f0;
  --color-primary-hover: #b8d4f5;
  --color-on-primary: #0f1520;
  --color-surface-alt: #1c2535;
  --color-pearl: #2a3446;
  --color-hairline: #2a3446;
  --color-border: #374155;
  --color-down: #f2a29a;
  --color-backdrop: rgba(0, 0, 0, .6);
}
/* 2. BASE ----------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { font-size: 16px; }
body {
  margin: 0; min-height: 100vh;
  display: grid; place-items: center;
  background: #cfd2d8;
  font-family: var(--font-sans);
  color: var(--color-text);
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
h1, h2, h3, p { margin: 0; }
ul { list-style: none; margin: 0; padding: 0; }
:focus-visible { outline: 2px solid var(--color-text); outline-offset: 2px; }
[hidden] { display: none !important; }
svg.i { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.serif { font-family: var(--font-serif); }
.kicker {
  font-size: var(--text-xs); letter-spacing: .12em; text-transform: uppercase;
  color: var(--color-text-muted); font-weight: 600;
}

/* 3. CADRE SMARTPHONE ----------------------------------------------------- */
.phone {
  width: 414px; height: 868px; padding: 12px;
  background: #0e1626; border-radius: 54px;
  box-shadow: var(--shadow-phone);
}
.app {
  position: relative; overflow: hidden;
  width: 390px; height: 844px;
  border-radius: 42px;
  background: var(--color-bg);
  display: flex; flex-direction: column;
}

/* 4. MASTHEAD (en-tête de journal) --------------------------------------- */
.masthead { padding: 22px var(--gutter) 0; flex: none; }
.masthead__row { display: flex; align-items: center; justify-content: space-between; min-height: 44px; }
.brand { display: flex; align-items: baseline; gap: var(--space-2); }
.brand__name { font-family: var(--font-serif); font-size: 1.75rem; font-weight: 600; letter-spacing: -.01em; line-height: 1; }
.brand__mark { width: 22px; height: 22px; align-self: center; }
.masthead__actions { display: flex; gap: var(--space-1); }
.icon-btn { width: 44px; height: 44px; display: grid; place-items: center; border-radius: var(--radius-control); transition: background var(--t-fast); }
.icon-btn:hover { background: var(--color-surface-alt); }
.icon-btn[aria-pressed="true"] svg { fill: currentColor; }
.masthead__dateline {
  display: flex; justify-content: space-between; margin-top: var(--space-2);
  padding: var(--space-2) 0; border-top: 2px solid var(--color-text); border-bottom: 1px solid var(--color-text);
  font-size: var(--text-xs); letter-spacing: .08em; text-transform: uppercase; color: var(--color-text-muted);
}

.view { flex: 1; overflow-y: auto; padding: var(--space-3) var(--gutter) 108px; scrollbar-width: none; outline: 0; }
.view::-webkit-scrollbar { display: none; }
.section-title { font-family: var(--font-serif); font-size: var(--text-xl); font-weight: 500; line-height: 1.15; margin: var(--space-2) 0 var(--space-2h); }

/* Onglets de filtre : style « rubriques de journal » */
.filters { display: flex; gap: var(--space-3); overflow-x: auto; border-bottom: 1px solid var(--color-border); scrollbar-width: none; margin-bottom: var(--space-1); }
.filters::-webkit-scrollbar { display: none; }
.filter {
  flex: none; padding: var(--space-2h) 0 calc(var(--space-2h) - 2px); min-height: 44px;
  font-size: var(--text-sm); letter-spacing: .06em; text-transform: uppercase; font-weight: 600;
  color: var(--color-text-muted); border-bottom: 2px solid transparent; transition: color var(--t-fast);
}
.filter[aria-pressed="true"] { color: var(--color-primary); border-bottom-color: var(--color-primary); }

/* 5. FIL & CARTES --------------------------------------------------------- */
.feed > li { border-bottom: 1px solid var(--color-border); }
.card {
  display: grid; grid-template-columns: 52px 1fr auto; column-gap: var(--space-2h);
  width: 100%; text-align: left; padding: var(--space-3) 0; align-items: start;
  transition: background var(--t-fast);
}
.card:hover { background: var(--color-surface-alt); }
.monogram {
  width: 48px; height: 48px; border-radius: 50%; border: 1px solid var(--color-text);
  display: grid; place-items: center;
  font-family: var(--font-serif); font-size: 1.05rem; font-weight: 600; letter-spacing: -.02em;
}
.card__ticker { margin-top: var(--space-2); font-size: var(--text-xs); letter-spacing: .1em; font-weight: 600; text-align: center; width: 48px; color: var(--color-text-muted); }
.card__title { font-family: var(--font-serif); font-size: var(--text-lg); line-height: 1.22; font-weight: 600; margin: 2px 0 var(--space-2); }
.card__teaser { font-size: var(--text-sm); line-height: 1.45; color: var(--color-text-muted); }
.card__meta { margin-top: var(--space-2); font-size: var(--text-xs); color: var(--color-text-muted); letter-spacing: .02em; }
.card__meta b { font-weight: 600; }

/* Variation : signe + flèche + couleur (jamais la couleur seule) */
.delta { display: inline-flex; align-items: center; gap: 4px; font-variant-numeric: tabular-nums; font-weight: 600; font-size: var(--text-md); white-space: nowrap; }
.delta svg { width: 12px; height: 12px; fill: currentColor; stroke: none; }
.delta--up { color: var(--color-up); }
.delta--down { color: var(--color-down); }
.delta--flat { color: var(--color-text-muted); }

/* 6. RECHERCHE ------------------------------------------------------------ */
.searchbar { display: flex; align-items: center; gap: var(--space-2); border-bottom: 1.5px solid var(--color-text); padding-bottom: var(--space-2); margin-bottom: var(--space-2h); }
.searchbar input { flex: 1; min-width: 0; border: 0; background: transparent; font-family: var(--font-serif); font-size: var(--text-lg); padding: var(--space-2) 0; outline: 0; }
.searchbar input::placeholder { color: var(--color-text-muted); font-style: italic; }
.result-count { font-size: var(--text-xs); letter-spacing: .1em; text-transform: uppercase; color: var(--color-text-muted); font-weight: 600; margin: var(--space-2h) 0 0; }
.empty { text-align: center; padding: var(--space-6) var(--space-3); }
.empty__title { font-family: var(--font-serif); font-size: var(--text-xl); margin-bottom: var(--space-2); }
.empty p { color: var(--color-text-muted); line-height: 1.5; font-size: var(--text-md); }
.empty .rule { width: 40px; height: 2px; background: var(--color-text); margin: 0 auto var(--space-3); }

/* 7. FICHE DÉTAIL --------------------------------------------------------- */
.layer { position: absolute; inset: 0; z-index: 10; background: var(--color-backdrop); backdrop-filter: blur(3px); animation: fade var(--t-med); }
.layer--detail-open { z-index: 20; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(24px); opacity: 0; } }
.sheet-full {
  position: absolute; left: 12px; right: 12px; top: 64px; bottom: 100px;
  background: var(--color-bg); border-radius: var(--radius-card); border: 1px solid var(--color-border);
  display: flex; flex-direction: column; overflow: hidden; animation: rise var(--t-med);
}
.sheet-full__bar { display: flex; align-items: center; justify-content: space-between; padding: var(--space-2) var(--space-2) var(--space-2) var(--space-3); border-bottom: 1px solid var(--color-border); flex: none; }
.trust { display: inline-flex; align-items: center; gap: var(--space-2); font-size: var(--text-xs); letter-spacing: .04em; color: var(--color-text-muted); }
.trust b { color: var(--color-text); font-size: var(--text-sm); }
/* Le score est cliquable : il ouvre son explication (cible tactile de 44 px) */
button.trust { min-height: 44px; padding: 0 var(--space-1); margin-left: calc(-1 * var(--space-1)); border-radius: var(--radius-control); }
button.trust:hover { background: var(--color-surface-alt); }
.trust svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.sheet__liste { display: grid; gap: var(--space-2h); margin: 0 0 var(--space-3); padding: 0; list-style: none; font-size: var(--text-sm); line-height: 1.5; color: var(--color-text-muted); }
.sheet__liste strong { color: var(--color-text); }
.sheet-full__body { flex: 1; overflow-y: auto; padding: var(--space-3) var(--space-3) var(--space-4); scrollbar-width: none; }
.sheet-full__body::-webkit-scrollbar { display: none; }
.detail__head { display: grid; grid-template-columns: 1fr auto; gap: var(--space-2h); align-items: start; }
.detail__title { font-family: var(--font-serif); font-size: 1.625rem; line-height: 1.12; font-weight: 600; margin: var(--space-2) 0 var(--space-2); letter-spacing: -.01em; }
.detail__stand { font-family: var(--font-serif); font-style: italic; font-size: var(--text-md); line-height: 1.45; color: var(--color-text-muted); }
.detail__quote { text-align: right; border-left: 1px solid var(--color-border); padding-left: var(--space-2h); }
.detail__quote .delta { font-size: var(--text-lg); }
.detail__ticker { display: block; margin-top: var(--space-1); font-size: var(--text-xs); letter-spacing: .1em; color: var(--color-text-muted); font-weight: 600; }
.brief { margin: var(--space-4) 0 var(--space-3); border-top: 2px solid var(--color-text); }
.brief__row { display: grid; grid-template-columns: 78px 1fr; gap: var(--space-2h); padding: var(--space-2h) 0; border-bottom: 1px solid var(--color-border); }
.brief__row p { font-size: var(--text-md); line-height: 1.5; }
.analysis h3 { font-family: var(--font-serif); font-size: var(--text-lg); margin-bottom: var(--space-2); }
.analysis p { font-family: var(--font-serif); font-size: 1.0125rem; line-height: 1.6; margin-bottom: var(--space-2h); }
.source { display: block; margin-top: var(--space-3); padding-top: var(--space-2h); border-top: 1px solid var(--color-border); font-size: var(--text-xs); line-height: 1.5; color: var(--color-text-muted); }
.source a { color: var(--color-text); text-decoration: underline; text-underline-offset: 3px; }
.sheet-full__foot { padding: var(--space-2h) var(--space-3) var(--space-3); border-top: 1px solid var(--color-border); flex: none; background: var(--color-bg); }

/* Boutons */
.btn {
  display: flex; align-items: center; justify-content: center; gap: var(--space-2);
  width: 100%; min-height: 48px; padding: 0 var(--space-3);
  background: var(--color-primary); color: var(--color-on-primary); border: 1px solid var(--color-primary);
  border-radius: var(--radius-control); font-size: var(--text-sm); font-weight: 600; letter-spacing: .1em; text-transform: uppercase;
  transition: opacity var(--t-fast);
}
.btn:hover { background: var(--color-primary-hover); border-color: var(--color-primary-hover); }
.btn[disabled] { background: var(--color-pearl); border-color: var(--color-pearl); color: var(--color-text-muted); cursor: not-allowed; }
.btn--ghost { background: transparent; color: var(--color-text); }
.btn--auto { width: auto; }

/* 8. FEUILLES (courtiers, à propos) -------------------------------------- */
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; background: var(--color-bg);
  border-radius: var(--radius-card) var(--radius-card) 0 0; padding: var(--space-2) var(--gutter) var(--space-4);
  box-shadow: var(--shadow-sheet); animation: rise var(--t-med);
}
.sheet__grip { width: 36px; height: 3px; border-radius: 2px; background: var(--color-border); margin: var(--space-2) auto var(--space-3); }
.sheet__title { font-family: var(--font-serif); font-size: var(--text-xl); line-height: 1.15; font-weight: 500; margin-bottom: var(--space-2); }
.sheet__lead { font-size: var(--text-sm); line-height: 1.5; color: var(--color-text-muted); margin-bottom: var(--space-3); }
.broker {
  display: flex; align-items: center; justify-content: space-between; width: 100%;
  padding: var(--space-3) var(--space-2h); margin-bottom: var(--space-2); text-align: left;
  border: 1px solid var(--color-text); border-radius: var(--radius-control); transition: background var(--t-fast);
}
.broker:hover { background: var(--color-surface-alt); }
.broker__name { font-family: var(--font-serif); font-size: var(--text-lg); font-weight: 600; display: block; }
.broker__cta { font-size: var(--text-sm); color: var(--color-text-muted); }
.sheet__cancel { display: block; margin: var(--space-2h) auto 0; min-height: 44px; padding: 0 var(--space-4); font-size: var(--text-sm); letter-spacing: .1em; text-transform: uppercase; font-weight: 600; color: var(--color-text-muted); }

/* 9. ONBOARDING ----------------------------------------------------------- */
.onb {
  position: absolute; left: 20px; right: 20px; top: 84px; bottom: 96px;
  background: var(--color-bg); border: 1px solid var(--color-border); border-radius: var(--radius-card);
  padding: var(--space-4) var(--space-4) var(--space-3); display: flex; flex-direction: column; animation: rise var(--t-med);
}
.onb__title { font-family: var(--font-serif); font-size: var(--text-2xl); line-height: 1.08; font-weight: 500; letter-spacing: -.015em; margin: var(--space-3) 0 var(--space-2h); }
.onb__rule { width: 48px; height: 2px; background: var(--color-primary); margin-bottom: var(--space-3); }
.onb__lead { font-family: var(--font-serif); font-size: var(--text-lg); line-height: 1.5; color: var(--color-text-muted); }
.onb__body { flex: 1; overflow-y: auto; scrollbar-width: none; }
.onb__foot { flex: none; display: flex; flex-direction: column; align-items: center; gap: var(--space-3); padding-top: var(--space-2h); }
.dots { display: flex; gap: 6px; }
.dots span { width: 22px; height: 3px; background: var(--color-pearl); }
.dots span[aria-current="true"] { background: var(--color-primary); }
.steps { margin-top: var(--space-2h); border-top: 2px solid var(--color-text); }
.steps li { display: grid; grid-template-columns: 34px 1fr; gap: var(--space-2h); padding: var(--space-2h) 0; border-bottom: 1px solid var(--color-border); }
.steps__n { font-family: var(--font-serif); font-size: var(--text-xl); line-height: 1; color: var(--color-text-muted); }
.steps strong { display: block; font-size: var(--text-xs); letter-spacing: .12em; text-transform: uppercase; margin-bottom: 2px; }
.steps span { font-family: var(--font-serif); font-size: var(--text-md); line-height: 1.4; color: var(--color-text-muted); }
.checks { margin-top: var(--space-2); }
.check { display: flex; align-items: center; gap: var(--space-2h); width: 100%; min-height: 48px; border-bottom: 1px solid var(--color-border); text-align: left; font-family: var(--font-serif); font-size: var(--text-lg); }
.check__box { width: 20px; height: 20px; border: 1.5px solid var(--color-text); border-radius: var(--radius-sm); display: grid; place-items: center; flex: none; }
.check__box svg { width: 14px; height: 14px; stroke: var(--color-on-primary); stroke-width: 2.4; fill: none; opacity: 0; }
.check[aria-checked="true"] .check__box { background: var(--color-primary); }
.check[aria-checked="true"] .check__box svg { opacity: 1; }
.link-btn { min-height: 44px; font-size: var(--text-sm); text-decoration: underline; text-underline-offset: 3px; color: var(--color-text); }

/* 10. NOTIFICATIONS ------------------------------------------------------- */
.chips { display: flex; gap: var(--space-2); flex-wrap: wrap; align-items: center; margin-bottom: var(--space-2); }
.chip { display: inline-flex; align-items: center; gap: var(--space-2); min-height: 32px; padding: 0 var(--space-2h); border: 1px solid var(--color-text); border-radius: 100px; font-size: var(--text-sm); }
.chip svg { width: 12px; height: 12px; }
.notif { position: relative; }
.notif .card { padding-left: var(--space-2h); }
.notif--unread .card { background: var(--color-surface-alt); }
.notif__flag { display: inline-flex; align-items: center; gap: 4px; font-size: var(--text-xs); font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--color-down); margin-bottom: 4px; }
.notif__flag svg { width: 14px; height: 14px; }
.notif__dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--color-text); margin-right: 6px; vertical-align: 1px; }
.side { display: flex; flex-direction: column; align-items: flex-end; gap: var(--space-2); }

/* 11. RÉGLAGES ------------------------------------------------------------ */
.group { margin-top: var(--space-4); }
.group:first-of-type { margin-top: var(--space-2); }
.group__label { padding-bottom: var(--space-2); border-bottom: 2px solid var(--color-text); }
.row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2h); width: 100%; min-height: 56px; padding: var(--space-2h) 0; border-bottom: 1px solid var(--color-border); text-align: left; }
.row__main { font-family: var(--font-serif); font-size: var(--text-lg); line-height: 1.25; }
.row__sub { display: block; margin-top: 2px; font-family: var(--font-sans); font-size: var(--text-sm); color: var(--color-text-muted); }
.row svg { color: var(--color-text-muted); }
.switch { width: 48px; height: 28px; border: 1.5px solid var(--color-text); border-radius: 100px; position: relative; flex: none; transition: background var(--t-fast); }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 19px; height: 19px; border-radius: 50%; background: var(--color-text); transition: transform var(--t-fast), background var(--t-fast); }
.switch[aria-checked="true"] { background: var(--color-primary); }
.switch[aria-checked="true"]::after { transform: translateX(20px); background: var(--color-bg); }
.fineprint { margin-top: var(--space-4); font-size: var(--text-xs); line-height: 1.5; color: var(--color-text-muted); }

/* 12. NAVIGATION BASSE ---------------------------------------------------- */
.tabbar {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(3, 1fr);
  padding: var(--space-2) var(--space-3) var(--space-3); background: var(--color-bg); border-top: 1px solid var(--color-text);
}
.tab { display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 52px; padding-top: var(--space-2); color: var(--color-text-muted); font-size: var(--text-xs); letter-spacing: .1em; text-transform: uppercase; font-weight: 600; position: relative; }
.tab[aria-current="page"] { color: var(--color-text); }
.tab[aria-current="page"]::before { content: ""; position: absolute; top: -9px; left: 30%; right: 30%; height: 3px; background: var(--color-primary); }
.tab__badge { position: absolute; top: 4px; left: calc(50% + 8px); min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--color-text); color: var(--color-on-primary); font-size: 10px; display: grid; place-items: center; letter-spacing: 0; }

/* Splash */
.splash { position: absolute; inset: 0; z-index: 50; background: var(--color-bg); display: flex; flex-direction: column; align-items: center; justify-content: center; }
.splash__brand { font-family: var(--font-serif); font-size: 3.25rem; font-weight: 500; letter-spacing: -.02em; margin-top: var(--space-2h); }
.splash__tag { font-family: var(--font-serif); font-style: italic; color: var(--color-text-muted); margin-top: var(--space-2); }
.splash__status { position: absolute; bottom: 132px; left: 40px; right: 40px; text-align: center; }
.splash__status p { font-size: var(--text-xs); letter-spacing: .12em; text-transform: uppercase; color: var(--color-text-muted); margin-bottom: var(--space-2h); }
.progress { height: 2px; background: var(--color-pearl); }
.progress i { display: block; height: 100%; width: 0; background: var(--color-primary); animation: load 1.6s ease-out forwards; }
@keyframes load { to { width: 100%; } }

/* Mode « embed » (captures) : pas de marge */
.embed body { display: block; background: transparent; min-height: 0; }
.embed .phone { width: 390px; height: 844px; padding: 0; background: none; box-shadow: none; border-radius: 0; }

/* 13. BOARD DE PRÉSENTATION ---------------------------------------------- */
.board { width: 1360px; padding: 56px 48px 40px; background: #e9e6df; margin: 0 auto; }
.board__head { display: flex; justify-content: space-between; align-items: baseline; border-top: 3px solid #14213d; border-bottom: 1px solid #14213d; padding: 14px 0; margin-bottom: 48px; }
.board__head h1 { font-family: var(--font-serif); font-size: 2.4rem; font-weight: 500; letter-spacing: -.02em; }
.board__head p { font-size: .8rem; letter-spacing: .12em; text-transform: uppercase; color: #4a5468; }
.board__grid { display: grid; grid-template-columns: repeat(3, 414px); gap: 44px 32px; justify-content: center; }
.board figure { margin: 0; }
.board figcaption { margin-top: 16px; text-align: center; font-family: var(--font-serif); font-size: 1rem; color: #14213d; }
.board figcaption span { display: block; font-family: var(--font-sans); font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; color: #5f6878; margin-bottom: 2px; }
.board iframe { width: 390px; height: 844px; border: 0; display: block; border-radius: 42px; }
.board .phone { box-shadow: 0 18px 40px rgba(20, 33, 61, .18); }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* Écrans plus larges que le mobile : le cadre reste centré ; sous 430 px, plein écran */
@media (max-width: 430px) {
  body { display: block; background: var(--color-bg); }
  .phone { width: 100%; height: 100dvh; padding: 0; border-radius: 0; box-shadow: none; background: none; }
  .app { width: 100%; height: 100%; border-radius: 0; }
}

/* Calques modaux au-dessus de la navigation (onboarding, feuilles) */
#layer-onboarding { z-index: 45; }
#layer-sheet { z-index: 46; }

/* ==========================================================================
   MONTSERRAT (fichiers locaux, aucune dépendance externe)
   Regular 400 · Medium 500-600 · Bold 700+ — usage sobre : Medium par défaut
   ========================================================================== */
@font-face { font-family: "Montserrat"; src: url("fonts/Montserrat-Regular.ttf") format("truetype"); font-weight: 300 400; font-display: swap; }
@font-face { font-family: "Montserrat"; src: url("fonts/Montserrat-Medium.ttf") format("truetype"); font-weight: 500 600; font-display: swap; }
@font-face { font-family: "Montserrat"; src: url("fonts/Montserrat-Bold.ttf") format("truetype"); font-weight: 700 900; font-display: swap; }

.masthead { padding-bottom: var(--space-2); border-bottom: 2px solid var(--color-text); }
.brand__mark { width: 48px; height: auto; color: var(--color-text); }
.dateline { margin: 0 0 var(--space-2h); font-size: var(--text-xs); font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--color-text-muted); }
.section-title:has(+ .dateline) { margin-bottom: 2px; }
.card { grid-template-columns: 68px 1fr; }
.card__side { display: flex; flex-direction: column; align-items: center; gap: var(--space-2); }
.card__side .delta { font-size: var(--text-xs); }
.card__side .card__ticker { margin-top: -2px; }
.kicker, .filter, .tab, .btn { font-weight: 500; }

/* ==========================================================================
   NEWSREADER (fichiers locaux) — réservé aux éléments importants :
   titres, chapeaux, titres de feuilles et d'onboarding
   ========================================================================== */
@font-face { font-family: "Newsreader"; src: url("fonts/Newsreader-Variable.ttf") format("truetype"); font-weight: 200 800; font-style: normal; font-display: swap; }
@font-face { font-family: "Newsreader"; src: url("fonts/Newsreader-Italic-Variable.ttf") format("truetype"); font-weight: 200 800; font-style: italic; font-display: swap; }
.section-title, .card__title, .detail__title, .detail__stand, .sheet__title, .onb__title, .onb__lead, .empty__title, .analysis h3, .brief__row p, .row__main { font-family: var(--font-serif); }
.card__title { font-size: 1.25rem; font-weight: 600; }
.detail__title { font-size: 1.9rem; font-weight: 600; }
.section-title, .onb__title, .sheet__title { font-weight: 500; }
.analysis p { font-family: var(--font-serif); font-size: 1.1rem; }

/* ==========================================================================
   COMPARATEUR AVANT / APRÈS — visible seulement sur grand écran
   (à gauche du téléphone) ; masqué sur mobile et dans les captures (?embed)
   ========================================================================== */
.comparateur { display: none; }

@media (min-width: 900px) {
  .comparateur {
    display: block;
    position: fixed;
    left: 32px;
    top: 50%;
    transform: translateY(-50%);
    width: 200px;
    padding: var(--space-3);
    background: #ffffff;
    border: 1px solid #c9ced6;
    border-radius: var(--radius-card);
    color: #1b1f27;
    font-family: var(--font-sans);
  }
  .embed .comparateur { display: none; }
}

.comparateur__titre { margin: 0 0 var(--space-2); font-size: var(--text-xs); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: #4b5563; }
.comparateur__choix { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-1); padding: var(--space-1); background: #f3f4f6; border-radius: var(--radius-control); }
.comparateur__btn { min-height: 44px; border-radius: var(--radius-sm); font-size: var(--text-sm); font-weight: 600; color: #4b5563; }
.comparateur__btn[aria-pressed="true"] { background: #023564; color: #ffffff; }
.comparateur__btn:hover:not([aria-pressed="true"]) { background: #e5e7eb; }
.comparateur__aide { margin: var(--space-2) 0 0; font-size: var(--text-xs); line-height: 1.5; color: #4b5563; }

/* ==========================================================================
   MICRO-ANIMATIONS — douces, courtes (150–450 ms), jamais décoratives.
   Désactivées automatiquement si l'utilisateur demande moins de mouvement
   (règle prefers-reduced-motion plus haut dans ce fichier).
   Sommaire : 1 Courbes · 2 Navigation · 3 Entrées d'écran · 4 Pression
              5 Calques · 6 Détails · 7 Onboarding · 8 Splash · 9 Thème
   ========================================================================== */

/* 1. COURBES ------------------------------------------------------------- */
:root {
  --ease-out: cubic-bezier(.2, .7, .2, 1);       /* démarrage vif, arrivée douce */
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1); /* léger rebond */
  --ease-glide: cubic-bezier(.65, 0, .25, 1);     /* glissement symétrique */
}

/* 2. NAVIGATION BASSE : l'indicateur glisse d'un onglet à l'autre --------- */
.tabbar { display: block; }
.tabbar__tabs { display: grid; grid-template-columns: repeat(3, 1fr); }
.tab[aria-current="page"]::before { display: none; }   /* remplacé par l'indicateur mobile */

.tab-indicator {
  position: absolute;
  top: 0;
  left: var(--space-3);
  width: calc((100% - 2 * var(--space-3)) / 3);        /* = largeur d'un onglet */
  height: 3px;
  pointer-events: none;
  transition: transform 420ms var(--ease-glide), opacity 200ms ease;
}
.tab-indicator::after {
  content: "";
  display: block;
  width: 40%;
  height: 100%;
  margin-inline: auto;
  background: var(--color-primary);
  border-radius: 0 0 3px 3px;
}

.tab { transition: color 200ms ease, transform 160ms var(--ease-out); }
.tab svg { transition: transform 320ms var(--ease-spring); }
.tab[aria-current="page"] svg { transform: translateY(-2px) scale(1.08); }

/* 3. ENTRÉES D'ÉCRAN : cascade de haut en bas ----------------------------- */
@keyframes enter-up { from { opacity: 0; transform: translateY(10px); } }

.view--enter > :not(.results):not(.feed) {
  animation: enter-up 420ms var(--ease-out) both;
  animation-delay: calc(var(--i, 0) * 45ms);
}
.view--enter > :nth-child(2) { --i: 1; }
.view--enter > :nth-child(3) { --i: 2; }
.view--enter > :nth-child(4) { --i: 3; }
.view--enter > :nth-child(5) { --i: 4; }
.view--enter > :nth-child(6) { --i: 5; }

/* Cartes : apparition échelonnée (écran) et fondu (changement de filtre) */
.feed > li:nth-child(1) { --j: 0; }
.feed > li:nth-child(2) { --j: 1; }
.feed > li:nth-child(3) { --j: 2; }
.feed > li:nth-child(4) { --j: 3; }
.feed > li:nth-child(5) { --j: 4; }
.feed > li:nth-child(6) { --j: 5; }
.feed > li:nth-child(n+7) { --j: 6; }

.view--enter .feed > li {
  animation: enter-up 460ms var(--ease-out) both;
  animation-delay: calc(140ms + var(--j, 0) * 55ms);
}
.results--swap .feed > li,
.results--swap .empty {
  animation: enter-up 340ms var(--ease-out) both;
  animation-delay: calc(var(--j, 0) * 40ms);
}

/* 4. PRESSION : tout ce qui se touche répond ------------------------------ */
.btn, .card, .broker, .row, .filter, .icon-btn, .check {
  transition: transform 160ms var(--ease-out), background-color 160ms ease,
              border-color 160ms ease, color 160ms ease, box-shadow 160ms ease;
}
.btn:active { transform: scale(.98); }
.card:active, .broker:active, .row:active, .check:active { transform: scale(.99); }
.icon-btn:active { transform: scale(.9); }
.tab:active { transform: scale(.94); }

/* Au survol : le titre se souligne en fondu, la flèche de variation bouge d'un pixel */
.card__title {
  text-decoration: underline;
  text-decoration-color: transparent;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
  transition: text-decoration-color 220ms ease;
}
.card:hover .card__title { text-decoration-color: currentColor; }
.delta svg { transition: transform 220ms var(--ease-out); }
.card:hover .delta--up svg { transform: translateY(-1px); }
.card:hover .delta--down svg { transform: translateY(1px); }

/* 5. CALQUES : sortie symétrique de l'entrée ------------------------------ */
@keyframes fade-out { to { opacity: 0; } }
@keyframes sink { to { transform: translateY(24px); opacity: 0; } }

.sheet-full, .sheet { animation-timing-function: var(--ease-out); animation-duration: 320ms; }
.layer.is-closing { animation: fade-out 200ms ease forwards; }
.layer.is-closing .sheet-full,
.layer.is-closing .sheet { animation: sink 200ms ease forwards; }

/* 6. DÉTAILS ---------------------------------------------------------------- */
/* Signet : petit rebond à l'enregistrement */
@keyframes pop { 0% { transform: scale(1); } 40% { transform: scale(1.3); } 100% { transform: scale(1); } }
.icon-btn.is-pop svg { animation: pop 420ms var(--ease-spring); }

/* Case à cocher et interrupteur : la coche apparaît en fondu */
.check__box { transition: background-color 160ms ease; }
.check__box svg { transition: opacity 160ms ease; }

/* En-tête : une ombre fine apparaît quand le fil défile */
.masthead { position: relative; z-index: 2; transition: box-shadow 220ms ease; }
.masthead--scrolled { box-shadow: 0 8px 14px -10px rgba(27, 31, 39, .45); }

/* Alerte non lue : le point pulse deux fois puis se calme */
@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 0 0 rgba(2, 53, 100, .35); }
  50% { box-shadow: 0 0 0 5px rgba(2, 53, 100, 0); }
}
.notif__dot { animation: pulse-dot 1.8s ease-out 2; }

/* 7. ONBOARDING : à l'étape suivante, seul le contenu glisse ---------------- */
@keyframes step-in { from { opacity: 0; transform: translateX(14px); } }
.onb-static .onb { animation: none; }
.onb-static .onb__body { animation: step-in 320ms var(--ease-out) both; }

/* 8. SPLASH : fondu de sortie ----------------------------------------------- */
.splash { transition: opacity 450ms ease; }
.splash--out { opacity: 0; pointer-events: none; }

/* 9. THÈME : fondu des couleurs au passage clair ↔ sombre -------------------- */
.theme-fade, .theme-fade * {
  transition: background-color 300ms ease, color 300ms ease, border-color 300ms ease,
              fill 300ms ease, stroke 300ms ease !important;
}

/* ==========================================================================
   COURBES « FAÇON APPLE » ET TRANSITION PARTAGÉE
   Règle : ce qui ARRIVE ralentit (ease-out) ; ce qui PART accélère (ease-in) ;
   ce qui se DÉPLACE entre deux positions démarre et finit en douceur
   (ease-in-out). Les feuilles utilisent la courbe de ressort d'iOS.
   ========================================================================== */
:root {
  --ease-out: cubic-bezier(.22, 1, .36, 1);       /* arrivée : décélération longue */
  --ease-in: cubic-bezier(.4, 0, 1, 1);           /* départ : accélération */
  --ease-in-out: cubic-bezier(.65, 0, .35, 1);    /* déplacement entre deux positions */
  --ease-sheet: cubic-bezier(.32, .72, 0, 1);     /* feuilles (courbe type iOS) */
  --ease-glide: var(--ease-in-out);
}

/* Entrées : decélération. Sorties : accélération. */
.sheet-full, .sheet { animation-timing-function: var(--ease-sheet); animation-duration: 440ms; }
.layer.is-closing { animation: fade-out 220ms var(--ease-in) forwards; }
.layer.is-closing .sheet-full,
.layer.is-closing .sheet { animation: sink 220ms var(--ease-in) forwards; }
.splash { transition: opacity 450ms var(--ease-in-out); }
.tab-indicator { transition: transform 460ms var(--ease-in-out), opacity 200ms ease; }

/* Transition partagée : la carte s'agrandit en fiche (et inversement) */
.vt-active .layer,
.vt-active .layer .sheet-full,
.vt-active .layer .sheet { animation: none !important; }

::view-transition-group(carte-fiche) {
  animation-duration: 480ms;
  animation-timing-function: var(--ease-sheet);
  border-radius: var(--radius-card);
  overflow: clip;
}
::view-transition-old(carte-fiche),
::view-transition-new(carte-fiche) { height: 100%; object-fit: cover; object-position: top; }
::view-transition-old(root),
::view-transition-new(root) { animation-duration: 260ms; animation-timing-function: var(--ease-in-out); }

/* Geste : la zone de départ ne doit pas faire défiler la page sur écran tactile */
.sheet-full__bar, .sheet { touch-action: none; }
.sheet-full__bar, .sheet__grip { cursor: grab; }

/* ==========================================================================
   RESPIRATION (option C) — plus d'espace négatif, aucun contenu retiré.
   Tout passe par des variables : la version « Avant » remet les anciennes
   valeurs plus bas, pour que le bouton Avant / Après montre la vraie différence.
   Rythme : groupes de texte serrés entre eux, grands vides entre les groupes.
   ========================================================================== */
:root {
  --gutter: 28px;               /* marges latérales de l'écran */
  --bottom-room: 150px;         /* place sous la dernière carte (barre fixe) */

  /* En-tête et titre de page */
  --masthead-rule: 1px solid var(--color-hairline);
  --top-gap: 36px;              /* trait → titre de page */
  --date-gap: 10px;             /* titre → date */
  --filters-gap: 28px;          /* date → filtres */
  --list-gap: 28px;             /* filtres → première carte */

  /* Cartes */
  --card-pad-y: 32px;           /* marge au-dessus et en dessous du contenu d'une carte */
  --card-col: 76px;             /* colonne de gauche : variation, cercle, ticker */
  --card-gap: 20px;             /* colonne de gauche ↔ texte */
  --side-gap: 14px;             /* variation → cercle */
  --ticker-gap: 2px;            /* cercle → ticker */
  --kicker-gap: 8px;            /* rubrique → titre */
  --title-gap: 14px;            /* titre → résumé */
  --meta-gap: 18px;             /* résumé → fiabilité et heure */
  --teaser-size: var(--text-md);
  --teaser-lh: 1.65;
  --meta-size: .75rem;          /* 12 px */

  --tabbar-rule: 1px solid var(--color-hairline);
}

/* Version « Avant » : valeurs d'origine de la Piste A */
[data-version="avant"] {
  --gutter: 20px;
  --bottom-room: 108px;
  --masthead-rule: 2px solid var(--color-text);
  --top-gap: 8px;
  --date-gap: 2px;
  --filters-gap: 12px;
  --list-gap: 4px;
  --card-pad-y: 16px;
  --card-col: 68px;
  --card-gap: 12px;
  --side-gap: 8px;
  --ticker-gap: -2px;
  --kicker-gap: 2px;
  --title-gap: 8px;
  --meta-gap: 8px;
  --teaser-size: var(--text-sm);
  --teaser-lh: 1.45;
  --meta-size: var(--text-xs);
  --tabbar-rule: 1px solid var(--color-text);
}

/* Page blanche en version « Après » (autour du téléphone aussi) */
html[data-version="apres"] body { background: #ffffff; }

/* En-tête */
.masthead { padding-inline: var(--gutter); padding-bottom: var(--space-3); border-bottom: var(--masthead-rule); }
.view { padding: var(--space-4) var(--gutter) var(--bottom-room); }
.section-title { margin-top: var(--top-gap); }
.section-title:has(+ .dateline) { margin-bottom: var(--date-gap); }
.dateline { margin-bottom: var(--filters-gap); }
.filters { margin-bottom: var(--list-gap); border-bottom-color: var(--color-hairline); }

/* Cartes */
.feed > li { border-bottom-color: var(--color-hairline); }
.card {
  grid-template-columns: var(--card-col) 1fr;
  column-gap: var(--card-gap);
  padding-block: var(--card-pad-y);
}
.card__side { gap: var(--side-gap); }
.card__side .card__ticker { margin-top: var(--ticker-gap); }
.card__title { margin: var(--kicker-gap) 0 var(--title-gap); line-height: 1.25; }
.card__teaser { font-size: var(--teaser-size); line-height: var(--teaser-lh); }
.card__meta { margin-top: var(--meta-gap); font-size: var(--meta-size); }

/* Navigation basse : un peu plus haute, filet léger */
.tabbar { padding-block: var(--space-2h) var(--space-3); border-top: var(--tabbar-rule); }
.tab { min-height: 56px; }

/* ==========================================================================
   MODE TÉLÉPHONE SEUL (body.solo)
   Plus de cadre de téléphone : l'appli occupe toute la hauteur de l'écran.
   Sur ordinateur elle reste une colonne centrée de 480 px maximum (pas de
   mise en page bureau). Le comparateur Avant / Après devient une petite
   pastille en haut à gauche, visible dès 700 px de large (en dessous :
   ?version=avant dans l'adresse).
   ========================================================================== */
html body.solo { display: block; min-height: 100dvh; background: var(--color-bg); }
body.solo .phone {
  width: 100%;
  max-width: 480px;
  height: 100dvh;
  margin-inline: auto;
  padding: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
}
body.solo .app { width: 100%; height: 100%; border-radius: 0; }

@media (min-width: 481px) {
  body.solo .phone { border-inline: 1px solid var(--color-hairline); }
}

body.solo .comparateur { display: none; }
@media (min-width: 700px) {
  body.solo .comparateur {
    display: block;
    left: 24px;
    top: 24px;
    transform: none;
    width: auto;
    padding: var(--space-1);
  }
  body.solo .comparateur__titre,
  body.solo .comparateur__aide { display: none; }
  body.solo .comparateur__btn { min-width: 72px; }
}

/* ==========================================================================
   AUDIT PREMIUM — confirmations, états vides, texte pour lecteurs d'écran
   ========================================================================== */
.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Toast : bandeau discret en haut de l'écran, avec « Annuler » si utile */
.toast {
  position: absolute; z-index: 60; top: 14px; left: 16px; right: 16px;
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
  padding: var(--space-2h) var(--space-3);
  background: var(--color-text); color: var(--color-bg);
  border-radius: var(--radius-card); font-size: var(--text-sm); line-height: 1.4;
  box-shadow: 0 10px 28px -12px rgba(27, 31, 39, .5);
}
.toast__action {
  flex: none; min-height: 36px; padding: 0 var(--space-2h);
  border-radius: var(--radius-control);
  font-size: var(--text-sm); font-weight: 600; color: var(--color-bg);
  text-decoration: underline; text-underline-offset: 3px;
}
.toast__action:hover { background: rgba(255, 255, 255, .14); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-14px); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-10px); } }
.toast--in { animation: toast-in 380ms var(--ease-out) both; }
.toast--out { animation: toast-out 220ms var(--ease-in) forwards; }

/* États vides : un bouton pour repartir */
.empty .btn { width: auto; margin: var(--space-4) auto 0; padding-inline: var(--space-4); }   /* centré sous le texte */

/* ==========================================================================
   ÉCRAN SUR LA PAGE : sur ordinateur, la page autour de l'appli est grise
   et l'appli (blanche) ressort comme un écran, avec une ombre douce.
   ========================================================================== */
:root { --page-bg: #e9ebee; --screen-shadow: 0 0 0 1px rgba(27, 31, 39, .08), 0 24px 70px -20px rgba(27, 31, 39, .35); }
[data-version="avant"] { --page-bg: #dedbd3; }
[data-theme="dark"] { --page-bg: #05070b; --screen-shadow: 0 0 0 1px rgba(255, 255, 255, .08), 0 24px 70px -20px rgba(0, 0, 0, .8); }

@media (min-width: 481px) {
  html body.solo { background: var(--page-bg); }
  body.solo .phone {
    border-inline: 0;
    box-shadow: var(--screen-shadow);
    background: var(--color-bg);
  }
  /* Le comparateur reste lisible sur le fond gris */
  body.solo .comparateur { background: var(--color-surface); border-color: transparent; box-shadow: 0 6px 20px -10px rgba(27, 31, 39, .35); }
}

/* Écran de téléphone : sur ordinateur, l'appli est un « écran » aux coins arrondis,
   posé au centre de la page grise (pas de boîtier). Sur vrai téléphone : plein écran. */
@media (min-width: 481px) {
  body.solo .phone {
    width: 100%;
    max-width: 420px;
    height: min(calc(100dvh - 48px), 900px);
    margin: 24px auto;
    border-radius: 44px;
    overflow: hidden;
  }
  body.solo .app { border-radius: 44px; }
}

/* ==========================================================================
   CARTES COMME LE WIREFRAME (après) : compactes, contour fin, coins arrondis.
   Gauche : pastille + ticker · Centre : titre, résumé, rubrique · Droite : variation.
   La version « Avant » garde l'ancienne mise en page (liste à filets).
   ========================================================================== */
:root {
  --card-radius: 28px;
  --card-border: 1px solid var(--color-border);
  --card-pad-x: 18px;
  --card-pad-y: 16px;
  --card-col: 56px;
  --card-gap: 14px;
  --side-gap: 6px;
  --ticker-gap: 0px;
  --title-gap: 6px;
  --meta-gap: 10px;
  --teaser-size: var(--text-sm);
  --teaser-lh: 1.5;
  --meta-size: .6875rem;
  --feed-gap: 12px;
  --feed-rule: 0 solid transparent;
}

[data-version="avant"] {
  --card-radius: 0px;
  --card-border: 0 solid transparent;
  --card-pad-x: 0px;
  --card-pad-y: 16px;
  --card-col: 68px;
  --card-gap: 12px;
  --side-gap: 8px;
  --ticker-gap: -2px;
  --title-gap: 8px;
  --meta-gap: 8px;
  --teaser-size: var(--text-sm);
  --teaser-lh: 1.45;
  --meta-size: var(--text-xs);
  --feed-gap: 0px;
  --feed-rule: 1px solid var(--color-hairline);
}

.feed { display: grid; gap: var(--feed-gap); }
.feed > li { border-bottom: var(--feed-rule); }

.card {
  grid-template-columns: var(--card-col) minmax(0, 1fr) auto;
  column-gap: var(--card-gap);
  padding: var(--card-pad-y) var(--card-pad-x);
  border: var(--card-border);
  border-radius: var(--card-radius);
  align-items: center;
}
.notif .card { padding-left: var(--card-pad-x); }
html[data-version="apres"] .notif--unread .card { border-color: var(--color-primary); }

/* Gauche : pastille et ticker */
.card__side { align-self: center; gap: var(--side-gap); }

/* Droite : variation en haut à droite */
.card__delta { align-self: start; justify-self: end; }
.card__delta .delta { font-size: var(--text-xs); }

/* Centre : titre, résumé, puis « rubrique · fiabilité · heure » sur une seule ligne */
.card__body { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 6px; min-width: 0; }
.card__body > .card__title { order: 1; flex: 0 0 100%; margin: 0 0 var(--title-gap); line-height: 1.25; }
.card__body > .card__teaser { order: 2; flex: 0 0 100%; }
.card__body > .kicker { order: 3; margin-top: var(--meta-gap); }
.card__body > .kicker::after { content: " ·"; }
.card__body > .card__meta { order: 4; margin-top: var(--meta-gap); }
.card__body > .notif__flag { order: 0; flex: 0 0 100%; margin-bottom: 6px; }

/* Version « Avant » : variation au-dessus de la pastille, texte en bloc */
[data-version="avant"] .card { grid-template-columns: var(--card-col) minmax(0, 1fr); align-items: start; }
[data-version="avant"] .card__delta { grid-column: 1; grid-row: 1; justify-self: center; }
[data-version="avant"] .card__side { grid-column: 1; grid-row: 2; align-self: start; }
[data-version="avant"] .card__body { grid-column: 2; grid-row: 1 / span 2; display: block; }
[data-version="avant"] .card__body > .card__title { margin: var(--kicker-gap) 0 var(--title-gap); }
[data-version="avant"] .card__body > .kicker::after { content: none; }
[data-version="avant"] .card__body > .card__meta { display: block; }
[data-version="avant"] .card__body > .card__teaser { display: block; }

/* Cartes plus compactes : la variation se pose en haut à droite, au-dessus du texte,
   donc le résumé et la ligne du bas profitent de toute la largeur de la carte. */
:root { --gutter: 22px; --delta-room: 72px; }
[data-version="avant"] { --gutter: 20px; }

.card { grid-template-columns: var(--card-col) minmax(0, 1fr); }
.card { position: relative; }                      /* ancre de la variation en haut à droite */
.card__delta { position: absolute; top: var(--card-pad-y); right: var(--card-pad-x); }
.card__body > .card__title { padding-right: var(--delta-room); }
.card__body > .notif__flag { padding-right: var(--delta-room); }

[data-version="avant"] .card__delta { position: static; }
[data-version="avant"] .card__body > .card__title,
[data-version="avant"] .card__body > .notif__flag { padding-right: 0; }

/* Cartes : variation au-dessus du ticker (colonne de gauche), titre sur UNE ligne.
   Le texte du centre occupe toute la largeur restante. */
:root {
  --delta-room: 0px;
  --card-col: 52px;
  --card-title-size: 1rem;          /* 16 px : 38 caractères tiennent sur une ligne */
  --card-title-wrap: nowrap;
}
[data-version="avant"] {
  --card-col: 68px;
  --card-title-size: 1.25rem;
  --card-title-wrap: normal;
}

.card {
  grid-template-columns: var(--card-col) minmax(0, 1fr);
  row-gap: var(--side-gap);
  align-content: center;
  align-items: center;
}
.card__delta { position: static; grid-column: 1; grid-row: 1; justify-self: center; align-self: end; }
.card__side  { grid-column: 1; grid-row: 2; align-self: start; }
.card__body  { grid-column: 2; grid-row: 1 / span 2; align-self: center; }

.card__body > .card__title {
  padding-right: 0;
  padding-bottom: 2px;                       /* laisse la place au soulignement du survol */
  font-size: var(--card-title-size);
  white-space: var(--card-title-wrap);
  overflow: hidden;
  text-overflow: ellipsis;                    /* sécurité sur écran très étroit */
}
.card__body > .notif__flag { padding-right: 0; }

/* Le titre s'adapte à la largeur disponible pour que 38 caractères tiennent toujours
   sur une ligne (container query : l'unité cqi = 1 % de la largeur du bloc de texte). */
:root { --card-title-size: clamp(.8rem, 5.8cqi, 1.0625rem); }
[data-version="avant"] { --card-title-size: 1.25rem; }
.card__body { container-type: inline-size; }

/* Réglage final : 38 caractères sur une ligne, titre un peu plus petit */
:root { --card-title-size: clamp(.78rem, 5.2cqi, 1rem); --card-col: 50px; --card-gap: 12px; --card-pad-x: 16px; }
[data-version="avant"] { --card-title-size: 1.25rem; --card-col: 68px; --card-gap: 12px; --card-pad-x: 0px; }

/* Logo = bouton « retour à l'accueil » */
.brand { min-width: 44px; min-height: 44px; align-items: center; border-radius: var(--radius-control); cursor: pointer; transition: transform 160ms var(--ease-out), opacity 160ms ease; }
.brand:hover { opacity: .75; }
.brand:active { transform: scale(.94); }

/* ==========================================================================
   HIÉRARCHIE D'ESPACEMENT ET DE TAILLE (cartes + page)
   Règle : dans un même groupe (titre + résumé) c'est serré ; entre deux groupes
   (résumé → ligne d'infos) c'est ouvert ; entre deux sections c'est très ouvert.
     Titre      16 px serif, sombre            → résumé : 4 px
     Résumé     13 px, gris moyen              → ligne d'infos : 14 px
     Infos      10 px, gris clair (SMI · fiabilité · heure)
   ========================================================================== */
:root {
  --color-text-subtle: #6b7280;      /* 4,8:1 sur blanc : plus discret, toujours lisible */
  --meta-size: .625rem;              /* 10 px */
  --ticker-size: .625rem;
  --title-gap: 4px;                  /* titre → résumé (même groupe) */
  --meta-gap: 14px;                  /* résumé → infos (autre groupe) */
  --side-gap: 8px;                   /* variation → pastille */
  --ticker-gap: 4px;                 /* pastille → ticker */

  --top-gap: 28px;                   /* en-tête → titre de page */
  --date-gap: 6px;                   /* titre → date (même groupe) */
  --filters-gap: 24px;               /* date → filtres (autre groupe) */
  --list-gap: 20px;                  /* filtres → cartes */
  --feed-gap: 14px;                  /* carte → carte */
}
/* Version Avant : le texte discret passe à 4,5:1 minimum, même sur fond crème foncé */
[data-version="avant"] { --color-text-subtle: var(--color-text-muted); }
[data-theme="dark"] { --color-text-subtle: #9aa3b2; }

[data-version="avant"] {
  --color-text-subtle: var(--color-text-muted);
  --meta-size: var(--text-xs);
  --ticker-size: var(--text-xs);
  --title-gap: 8px;
  --meta-gap: 8px;
  --side-gap: 8px;
  --ticker-gap: -2px;
  --top-gap: 8px;
  --date-gap: 2px;
  --filters-gap: 12px;
  --list-gap: 4px;
  --feed-gap: 0px;
}

.card__body > .kicker,
.card__body > .card__meta { font-size: var(--meta-size); color: var(--color-text-subtle); }
.card__body > .card__meta b { color: var(--color-text-muted); }
.card__ticker { font-size: var(--ticker-size); }
.dateline { color: var(--color-text-subtle); }

/* ==========================================================================
   INFOS DE LA CARTE EN HAUT À DROITE (choix retenu)
   Ligne « TECH · 90 % fiabilité · 5 h » alignée à droite, détachée du titre
   par un vrai espace (--info-gap) et remontée vers le bord haut de la carte.
   La version « Avant » garde les infos en bas.
   ========================================================================== */
:root { --info-gap: 16px; }

html[data-version="apres"] .card__body { justify-content: flex-end; }
html[data-version="apres"] .card__body > .kicker { order: -2; margin: 0 0 var(--info-gap); }
html[data-version="apres"] .card__body > .card__meta { order: -1; margin: 0 0 var(--info-gap); }
html[data-version="apres"] .card { padding-top: calc(var(--card-pad-y) - 4px); }

/* ==========================================================================
   LOGOS DES ACTIONS dans la pastille ronde
   ========================================================================== */
.monogram { position: relative; overflow: hidden; }
.monogram__logo { display: none; position: absolute; inset: 22%; width: 56%; height: 56%; object-fit: contain; }
.monogram.has-logo .monogram__logo { display: block; }
.monogram.has-logo .monogram__lettres { visibility: hidden; }

/* Pastille foncée (version « Après ») : le logo passe en blanc sur fond accent, pour le contraste.
   Thème sombre : fond clair et logo foncé. Les lettres de secours suivent la même couleur. */
html[data-version="apres"] .monogram {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: var(--color-on-primary);
}
html[data-version="apres"] .monogram__logo { inset: 14%; width: 72%; height: 72%; filter: brightness(0) invert(1); }
html[data-version="apres"][data-theme="dark"] .monogram__logo { filter: brightness(0); }

/* ==========================================================================
   CHARGEMENT DE data.json : cartes « squelettes » avec un balayage lumineux
   ========================================================================== */
.card--squelette { pointer-events: none; }
.card--squelette:hover { background: none; }
.squelette {
  display: block; position: relative; overflow: hidden;
  background: var(--color-hairline); border-radius: var(--space-1);
}
.squelette--rond { width: 48px; height: 48px; border-radius: 50%; }
.squelette--ligne { height: 12px; margin-bottom: var(--space-2h); }
.squelette--courte { width: 60%; }
.squelette::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, var(--color-bg), transparent);
  transform: translateX(-100%);
  animation: squelette-balayage 1.4s var(--ease-in-out) infinite;
}
@keyframes squelette-balayage { to { transform: translateX(100%); } }

/* ==========================================================================
   FIL ÉDITORIAL (version Après)
   1. À la une (carrousel)  2. Mini-courbes  3. Fil découpé : Aujourd'hui, Hier, Cette semaine
   ========================================================================== */
/* Rayons selon la taille du composant (inspiré de Uber Base) :
   16 px grand conteneur · 12 px carte · 8 px élément imbriqué · 4 px étiquette */
:root { --radius-container: 16px; --radius-nested: 8px; --radius-tag: 4px; }

/* 1. À la une : les actualités les plus importantes, en grand, sur l'accent */
.une {
  display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-2h); width: 100%; text-align: left;
  margin-bottom: var(--space-4); padding: var(--space-4);
  background: var(--color-primary); color: var(--color-on-primary);
  border-radius: var(--radius-container);
  transition: background var(--t-fast);
}
.une:hover { background: var(--color-primary-hover); }
/* Entrée : glissement + fondu (décélération 500 ms, opacité linéaire 200 ms) */
@keyframes une-entree { from { transform: translateY(16px); } }
@keyframes une-fondu { from { opacity: 0; } }
.view--enter .une { animation: une-entree 500ms var(--ease-out) both, une-fondu 200ms linear both; }
.une__haut { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-2); }
.une .kicker, .une .card__meta { color: inherit; opacity: .8; margin: 0; }
.une__titre { font-family: var(--font-serif); font-size: 1.6rem; line-height: 1.12; font-weight: 600; margin: 0; }
.une__fait { font-size: var(--text-sm); line-height: 1.5; opacity: .9; }
.une__chiffres {
  display: flex; justify-content: space-between; align-items: center; gap: var(--space-2);
  padding-top: var(--space-2h); border-top: 1px solid rgba(255, 255, 255, .22);
}
.une__societe { display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-xs); min-width: 0; }
.une__societe b { display: block; letter-spacing: .1em; }
.une__societe > span:last-child { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.une__societe .monogram { flex: none; width: 40px; height: 40px; background: rgba(255, 255, 255, .12); border-color: rgba(255, 255, 255, .4); }
.une__cours { display: flex; align-items: center; gap: var(--space-2); }
.une .delta { color: inherit; font-size: var(--text-lg); font-weight: 600; }
.une .delta svg { fill: currentColor; }

/* Carrousel « À la une » : défilement au doigt, arrêt sur chaque diapositive, pas de défilement automatique */
.une-carrousel { margin-bottom: var(--space-4); }
.une-piste {
  display: flex; gap: var(--space-2h); overflow-x: auto;
  scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior-x: contain;
}
.une-piste::-webkit-scrollbar { display: none; }
.une-diapo { flex: 0 0 86%; min-width: 0; scroll-snap-align: start; display: flex; }
.une-diapo .une { margin-bottom: 0; min-width: 0; }
.une-points { display: flex; justify-content: center; gap: var(--space-1); margin-top: var(--space-2); }
.une-point { width: 24px; height: 24px; display: grid; place-items: center; }
.une-point::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--color-text-subtle);
  transition: width 200ms var(--ease-out), background 200ms linear;
}
.une-point[aria-current="true"]::before { width: 18px; border-radius: 3px; background: var(--color-primary); }

/* 2. Mini-courbes : même couleur que la flèche de variation */
.courbe { display: block; margin: var(--space-1) auto 0; overflow: visible; }
.courbe__ligne { fill: none; stroke: currentColor; stroke-width: 1.25; stroke-linecap: round; stroke-linejoin: round; }
.courbe__aire { fill: currentColor; opacity: .14; stroke: none; }
.courbe__fin { fill: currentColor; }
.courbe--up { color: var(--color-up); }
.courbe--down { color: var(--color-down); }
.courbe--flat { color: var(--color-text-muted); }
.courbe--grande { margin: 0; }
.courbe--grande .courbe__ligne { stroke-width: 1.75; }
.une .courbe { color: inherit; }
.une .courbe--grande { width: 96px; height: auto; flex: none; }
.une-diapo .une .courbe--grande { width: 72px; }
.detail__quote .courbe--grande { width: 88px; height: auto; margin: 0 0 var(--space-1) auto; }

/* 3. Fil découpé dans le temps — intertitres en casse de phrase (« Aujourd'hui ») */
.periode + .periode { margin-top: var(--space-4); }
.periode__titre {
  display: flex; align-items: center; gap: var(--space-2);
  margin: 0 0 var(--space-2h);
  font-family: var(--font-serif); font-size: var(--text-lg); font-weight: 600;
  color: var(--color-text);
}
.periode__titre::after { content: ""; flex: 1; height: 1px; background: var(--color-hairline); }
.periode__titre span { font-family: var(--font-sans); font-size: var(--text-xs); font-weight: 500; color: var(--color-text-muted); }

/* Brèves : une ligne par actualité plus ancienne */
.breves { border-top: 1px solid var(--color-hairline); }
.breve {
  display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; align-items: center; gap: var(--space-2);
  width: 100%; min-height: 48px; padding: var(--space-2) var(--space-1);
  text-align: left; border-bottom: 1px solid var(--color-hairline);
  transition: background var(--t-fast);
}
.breve:hover { background: var(--color-surface-alt); }
.breve__ticker { font-size: var(--text-xs); font-weight: 600; letter-spacing: .1em; color: var(--color-text-muted); }
.breve__titre { font-family: var(--font-serif); font-size: var(--text-md); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ==========================================================================
   TYPOGRAPHIE ÉDITORIALE (version Après)
   Deux rôles nets : Newsreader = ce qu'on lit (titres, faits, analyses),
   Montserrat = ce qu'on manipule ou compare (boutons, onglets, chiffres).
   Une seule voix en capitales : les surtitres (SMI, BANQUE…). Le reste en casse de phrase.
   ========================================================================== */
:root { --text-display: 2rem; --text-une: 1.75rem; --tracking-titre: -.015em; }

/* Titres : césures équilibrées (pas de mot seul sur la dernière ligne) */
html[data-version="apres"] :is(.section-title, .une__titre, .detail__title, .card__title, .periode__titre, .empty__title, .sheet__title) {
  text-wrap: balance; letter-spacing: var(--tracking-titre);
}
html[data-version="apres"] :is(.analysis p, .brief__row p, .une__fait, .card__teaser) { text-wrap: pretty; }

/* Hiérarchie : titre de page > à la une > intertitres > titres de cartes */
html[data-version="apres"] .section-title { font-size: var(--text-display); font-weight: 500; line-height: 1.05; }
html[data-version="apres"] .une__titre { font-size: var(--text-une); line-height: 1.1; }
html[data-version="apres"] .une__fait { font-family: var(--font-serif); font-size: var(--text-md); line-height: 1.45; }

/* Date, filtres, onglets et boutons : casse de phrase, sans espacement forcé */
html[data-version="apres"] .dateline { text-transform: none; letter-spacing: 0; font-size: var(--text-sm); }
html[data-version="apres"] .filter { text-transform: none; letter-spacing: 0; font-size: var(--text-md); font-weight: 500; }
html[data-version="apres"] .filter[aria-pressed="true"] { font-weight: 700; }
html[data-version="apres"] .tab { text-transform: none; letter-spacing: 0; font-size: var(--text-xs); }
html[data-version="apres"] :is(.btn, .sheet__cancel) { text-transform: none; letter-spacing: 0; font-size: var(--text-md); }

/* Chiffres : largeur fixe pour qu'ils s'alignent d'une ligne à l'autre */
html[data-version="apres"] :is(.card__meta, .breve, .une__cours, .trust, .card__ticker, .detail__ticker) { font-variant-numeric: tabular-nums; }
html[data-version="apres"] .une .delta { font-size: var(--text-xl); font-weight: 600; }
html[data-version="apres"] .une-diapo .une .delta { font-size: var(--text-lg); }

@media (prefers-reduced-motion: reduce) {
  .theme-fade, .theme-fade * { transition: none !important; }
  .tab-indicator { transition: none; }
}
