/* Pulse — thème « Swiss editorial »
   Grille nette, typographie de presse (Newsreader + Roboto), rouge « breaking » pour la hiérarchie,
   bleu pour les liens et le focus. Toutes les couleurs passent par des jetons sémantiques. */

:root {
  --bg: #FAFAF9;
  --surface: #FFFFFF;
  --surface-2: #F5F5F4;
  --surface-3: #E7E5E4;
  --text: #1C1917;
  --muted: #57534E;
  --line: #E7E5E4;
  --line-strong: #D6D3D1;
  --primary: #DC2626;
  --on-primary: #FFFFFF;
  --primary-soft: #FEF2F2;
  --primary-ink: #B91C1C;
  --accent: #1E40AF;
  --focus: #1E40AF;
  --chart-line: #DC2626;
  --scrim: rgb(12 10 9 / .5);
  --shadow-pop: 0 12px 32px rgb(28 25 23 / .14), 0 2px 6px rgb(28 25 23 / .06);

  --serif: 'Newsreader', 'IBM Plex Sans Arabic', Georgia, 'Times New Roman', serif;
  --sans: 'Roboto', 'IBM Plex Sans Arabic', system-ui, -apple-system, 'Segoe UI', sans-serif;

  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 12px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --t-fast: 150ms;
  --t-med: 220ms;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0C0A09; --surface: #1C1917; --surface-2: #292524; --surface-3: #3A3533;
    --text: #FAFAF9; --muted: #A8A29E; --line: #2E2A27; --line-strong: #44403C;
    --primary: #F87171; --on-primary: #1C1917; --primary-soft: #3A1717; --primary-ink: #FCA5A5;
    --accent: #93C5FD; --focus: #93C5FD; --chart-line: #EF4444;
    --scrim: rgb(0 0 0 / .65); --shadow-pop: 0 16px 40px rgb(0 0 0 / .5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0C0A09; --surface: #1C1917; --surface-2: #292524; --surface-3: #3A3533;
  --text: #FAFAF9; --muted: #A8A29E; --line: #2E2A27; --line-strong: #44403C;
  --primary: #F87171; --on-primary: #1C1917; --primary-soft: #3A1717; --primary-ink: #FCA5A5;
  --accent: #93C5FD; --focus: #93C5FD; --chart-line: #EF4444;
  --scrim: rgb(0 0 0 / .65); --shadow-pop: 0 16px 40px rgb(0 0 0 / .5);
  color-scheme: dark;
}

/* L'arabe n'existe pas en Newsreader : la police arabe prend la tête des deux familles. */
:root:lang(ar) {
  --serif: 'IBM Plex Sans Arabic', 'Newsreader', Georgia, serif;
  --sans: 'IBM Plex Sans Arabic', 'Roboto', system-ui, sans-serif;
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; }
button, select, input { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }
h1, h2, h3 { text-wrap: balance; }
p, li { overflow-wrap: anywhere; }
.icon { flex: none; }
[dir="rtl"] .flip-rtl { transform: scaleX(-1); }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
#view:focus { outline: none; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; inset-inline-start: 16px; top: -48px; z-index: 300;
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: var(--r-md);
  font-weight: 500; text-decoration: none; transition: top var(--t-fast) var(--ease);
}
.skip-link:focus { top: 12px; }

.wrap { max-width: 960px; margin: 0 auto; padding-inline: 16px; }
.muted { color: var(--muted); }
.center { text-align: center; }

/* ---------- Barre du haut ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner { display: flex; align-items: center; gap: 12px; min-height: 64px; }
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.logo-text { font: 700 24px/1 var(--serif); letter-spacing: -0.02em; }
:root:lang(ar) .logo-text { font-family: 'Newsreader', Georgia, serif; }
.logo-mark {
  width: 22px; height: 22px; border-radius: 50%; background: var(--primary);
  display: grid; place-items: center; position: relative;
}
.logo-mark i { width: 7px; height: 7px; border-radius: 50%; background: var(--bg); }
.logo-mark::after {
  content: ''; position: absolute; inset: -4px; border-radius: 50%;
  border: 2px solid var(--primary); opacity: 0; animation: pulse 2.8s var(--ease) infinite;
}
@keyframes pulse { 0% { transform: scale(.7); opacity: .6; } 100% { transform: scale(1.5); opacity: 0; } }

.tabs { display: flex; gap: 2px; margin-inline-start: 12px; flex: 1; }
.tabs a {
  position: relative; text-decoration: none; font-size: 15px; font-weight: 500; color: var(--muted);
  padding: 10px 12px; border-radius: var(--r-sm); white-space: nowrap;
  transition: color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.tabs a:hover { color: var(--text); background: var(--surface-2); }
.tabs a.active { color: var(--text); }
.tabs a.active::after {
  content: ''; position: absolute; inset-inline: 12px; bottom: -11px; height: 2px; background: var(--primary);
}

.topbar-actions { display: flex; align-items: center; gap: 8px; }
.pill {
  font-size: 12px; font-weight: 500; padding: 4px 10px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--muted); white-space: nowrap;
}
.pill.on { border-color: transparent; background: var(--primary-soft); color: var(--primary-ink); }
.pill.on::before { content: '●'; margin-inline-end: 6px; font-size: 9px; vertical-align: 1px; }

.lang-picker { position: relative; display: flex; align-items: center; }
.lang-icon { position: absolute; inset-inline-start: 10px; display: flex; pointer-events: none; color: var(--muted); }
.lang-picker select {
  appearance: none; height: 40px; padding-inline: 32px 12px; border-radius: var(--r-md);
  border: 1px solid var(--line); background: var(--surface); font-size: 14px; font-weight: 500; cursor: pointer;
}
.lang-picker select:hover { border-color: var(--line-strong); }

.icon-btn {
  position: relative; width: 40px; height: 40px; border-radius: var(--r-md);
  border: 1px solid var(--line); background: var(--surface);
  display: grid; place-items: center; color: var(--text);
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}
.icon-btn:hover { background: var(--surface-2); border-color: var(--line-strong); }
.icon-btn .dot {
  position: absolute; top: -4px; inset-inline-end: -4px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px; background: var(--primary); color: var(--on-primary); font-size: 11px; font-weight: 700;
  display: grid; place-items: center; border: 2px solid var(--bg);
}
.account-btn {
  height: 40px; padding: 0 16px; border-radius: var(--r-md); border: 1px solid var(--text);
  background: var(--text); color: var(--bg); font-size: 14px; font-weight: 500;
  transition: opacity var(--t-fast) var(--ease);
}
.account-btn:hover { opacity: .88; }
.account-btn.avatar { width: 40px; padding: 0; border-radius: 50%; background: var(--primary); border-color: var(--primary); color: var(--on-primary); font-weight: 700; }

.menu-wrap { position: relative; }
.menu {
  position: absolute; inset-inline-end: 0; top: calc(100% + 8px); z-index: 40; min-width: 220px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-pop); padding: 6px; display: grid;
}
.menu > button {
  border: 0; background: none; text-align: start; padding: 10px 12px; border-radius: var(--r-sm);
  font-size: 14px; min-height: 40px;
}
.menu > button:hover { background: var(--surface-2); }
.menu > button.danger { color: var(--primary-ink); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 6px 4px; }
.panel { width: min(360px, calc(100vw - 32px)); max-height: 70vh; overflow-y: auto; padding: 8px; gap: 2px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; padding: 6px 8px 8px; }
.panel p { padding: 8px; margin: 0; font-size: 14px; }
.notif { display: grid; gap: 2px; padding: 10px; border-radius: var(--r-sm); text-decoration: none; font-size: 14px; }
.notif:hover { background: var(--surface-2); }
.notif.unread { background: var(--primary-soft); }
.notif .muted { font-size: 12px; }

/* ---------- Contrôles ---------- */
.controls { display: flex; flex-direction: column; gap: 16px; padding: 32px 0 8px; }
.country-picker { display: flex; align-items: center; gap: 12px; }
.country-picker .label { font-size: 12px; font-weight: 500; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
:root:lang(ar) .country-picker .label { letter-spacing: 0; text-transform: none; }
select {
  font-size: 16px; font-weight: 500; color: var(--text);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
  min-height: 44px; padding-block: 8px; padding-inline: 12px 36px; appearance: none; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 55%, calc(100% - 13px) 55%;
  background-size: 5px 5px; background-repeat: no-repeat;
  transition: border-color var(--t-fast) var(--ease);
}
[dir="rtl"] select:not(#lang-select) { background-position: 18px 55%, 13px 55%; }
select:hover { border-color: var(--line-strong); }
.lang-picker select { background-image: none; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: thin; scroll-snap-type: x proximity; }
.chip {
  flex: none; scroll-snap-align: start; display: inline-flex; gap: 8px; align-items: center;
  min-height: 40px; padding: 0 14px; border-radius: var(--r-sm);
  border: 1px solid var(--line); background: var(--surface); font-size: 14px; font-weight: 500; color: var(--muted);
  transition: color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.chip:hover { color: var(--text); border-color: var(--line-strong); }
.chip[aria-selected="true"] { background: var(--text); border-color: var(--text); color: var(--bg); }

/* ---------- Brief ---------- */
.brief {
  margin: 20px 0 32px; padding: 28px; border-radius: var(--r-lg);
  background: var(--surface); border: 1px solid var(--line);
  border-top: 3px solid var(--primary);
}
.brief-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.eyebrow { margin: 0 0 6px; font-size: 13px; color: var(--primary-ink); font-weight: 500; letter-spacing: .02em; }
.eyebrow::first-letter { text-transform: uppercase; }
.brief h1, .intro h1 { margin: 0; font: 700 clamp(28px, 5vw, 40px)/1.12 var(--serif); letter-spacing: -0.02em; }
.brief-text { font: 400 19px/1.6 var(--serif); margin: 18px 0 0; max-width: 68ch; }
.brief-text:empty { display: none; }
.brief-top { margin: 20px 0 0; padding: 0; list-style: none; display: grid; gap: 0; counter-reset: top; }
.brief-top li {
  display: flex; gap: 14px; align-items: baseline; padding: 10px 0; border-top: 1px solid var(--line);
}
.brief-top li:first-child { border-top: 0; padding-top: 0; }
.brief-top b { font: 700 18px var(--serif); color: var(--primary); min-width: 18px; font-variant-numeric: tabular-nums; }
.brief-top a { text-decoration: none; font-weight: 500; font-size: 16px; }
.brief-top a:hover { text-decoration: underline; text-underline-offset: 3px; }

.view-switch { display: flex; background: var(--surface-2); border-radius: var(--r-md); padding: 3px; gap: 2px; }
.view-switch button {
  border: 0; background: none; padding: 6px 12px; min-height: 34px; border-radius: var(--r-sm);
  font-size: 13px; font-weight: 500; color: var(--muted); transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.view-switch button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgb(0 0 0 / .08); }

.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }
.action {
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px;
  border: 1px solid var(--line); background: var(--surface); border-radius: var(--r-sm);
  font-size: 14px; font-weight: 500;
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.action:hover { border-color: var(--line-strong); background: var(--surface-2); }
.action:active { transform: scale(.98); }
.action.on, .action.playing { background: var(--primary-soft); color: var(--primary-ink); border-color: transparent; }
.action.on .icon { fill: currentColor; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: var(--r-md);
  border: 1px solid var(--line-strong); background: var(--surface); font-weight: 500; font-size: 15px;
  transition: background var(--t-fast) var(--ease), opacity var(--t-fast) var(--ease);
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn.primary:hover { opacity: .9; }
.btn:disabled { opacity: .5; cursor: progress; }
.link-btn {
  display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; padding: 4px 0;
  color: var(--accent); font-size: 14px; font-weight: 500; text-decoration: none; min-height: 32px;
}
.link-btn:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Liste ---------- */
.list-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.list-head h2 { font: 700 24px var(--serif); margin: 0; letter-spacing: -0.01em; }
.explain {
  margin: 14px 0 0; padding: 18px; border-radius: var(--r-md); background: var(--surface-2);
  font-size: 14px; color: var(--muted);
}
.explain p { margin: 0; }
.explain p + ul, .explain ul + p { margin-top: 8px; }
.explain strong { color: var(--text); font-weight: 500; }
.explain ul { padding-inline-start: 18px; margin-bottom: 0; }

.stories { list-style: none; padding: 0; margin: 16px 0 0; display: grid; gap: 12px; }
.story {
  display: grid; grid-template-columns: 48px 1fr auto; gap: 16px; align-items: start;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 20px; animation: rise .32s var(--ease) both;
  transition: border-color var(--t-fast) var(--ease);
}
.story:hover { border-color: var(--line-strong); }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
.story.top { border-inline-start: 3px solid var(--primary); }
.rank { font: 700 34px/1 var(--serif); color: var(--muted); text-align: center; font-variant-numeric: tabular-nums; }
.story.top .rank { color: var(--primary); }
.meta { display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: 13px; color: var(--muted); align-items: center; }
.meta .src { font-weight: 500; color: var(--text); }
.badge, .trend {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; font-weight: 500; padding: 2px 8px; border-radius: var(--r-sm); line-height: 1.5;
}
.badge { background: var(--primary-soft); color: var(--primary-ink); }
.trend { background: var(--surface-2); color: var(--muted); }
.trend.new { background: var(--text); color: var(--bg); }
.trend.up { background: var(--primary-soft); color: var(--primary-ink); }
[dir="rtl"] .trend .icon { transform: scaleX(-1); }
.plural { display: inline-flex; align-items: center; gap: 4px; }
.plural.warn { color: var(--primary-ink); font-weight: 500; }
.story h3 { margin: 8px 0 0; font: 600 20px/1.32 var(--serif); letter-spacing: -0.01em; }
.story h3 a { text-decoration: none; }
.story h3 a:hover { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.summary, .why { margin: 8px 0 0; font-size: 15px; max-width: 70ch; }
.why { color: var(--muted); }
.why strong { color: var(--text); font-weight: 500; }
.personal {
  margin: 12px 0 0; font-size: 14px; padding: 8px 12px; border-radius: var(--r-md);
  background: var(--primary-soft); color: var(--text);
}
.personal strong { color: var(--primary-ink); font-weight: 500; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.tag { font-size: 12px; padding: 2px 8px; border-radius: var(--r-sm); background: var(--surface-2); color: var(--muted); }

.detail { margin-top: 14px; font-size: 14px; }
.detail summary {
  cursor: pointer; color: var(--accent); font-weight: 500; list-style: none;
  display: inline-flex; align-items: center; gap: 6px; min-height: 32px;
}
.detail summary::-webkit-details-marker { display: none; }
.detail summary::before { content: ''; width: 6px; height: 6px; border-inline-end: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); transition: transform var(--t-fast) var(--ease); }
[dir="rtl"] .detail summary::before { transform: rotate(45deg); }
.detail[open] summary::before { transform: rotate(45deg); }
[dir="rtl"] .detail[open] summary::before { transform: rotate(-45deg); }
.signals { display: grid; gap: 10px; margin-top: 12px; }
.signal { display: grid; grid-template-columns: 110px 1fr 56px; gap: 12px; align-items: center; font-size: 13px; }
.signal .bar { height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.signal .bar i { display: block; height: 100%; background: var(--primary); border-radius: 999px; }
.signal .val { text-align: end; color: var(--muted); font-variant-numeric: tabular-nums; }
.related { margin-top: 14px; display: grid; gap: 6px; padding-top: 12px; border-top: 1px solid var(--line); }
.related a { font-size: 13px; color: var(--muted); text-decoration: none; }
.related a:hover { color: var(--text); }
.related a b { color: var(--text); font-weight: 500; }

.side { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.score {
  --v: 0; width: 54px; height: 54px; border-radius: 50%;
  background: conic-gradient(var(--primary) calc(var(--v) * 1%), var(--surface-2) 0);
  display: grid; place-items: center;
}
.score span {
  width: 44px; height: 44px; border-radius: 50%; background: var(--surface);
  display: grid; place-items: center; font: 700 16px var(--sans); font-variant-numeric: tabular-nums;
}
.spark-btn { border: 0; background: none; padding: 6px; border-radius: var(--r-sm); line-height: 0; min-width: 44px; min-height: 36px; }
.spark-btn:hover { background: var(--surface-2); }
.spark { overflow: visible; direction: ltr; }
.spark-line { fill: none; stroke: var(--chart-line); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.spark-dot { fill: var(--chart-line); stroke: var(--surface); stroke-width: 2; }

.story.compact { padding: 16px; }
.story.compact h3 { font-size: 17px; }
.story.compact .why { font-size: 14px; }
.story.common { box-shadow: inset 3px 0 0 var(--accent); }
[dir="rtl"] .story.common { box-shadow: inset -3px 0 0 var(--accent); }

body.quick .story:nth-child(n+6) { display: none; }
body.quick .detail, body.quick .tags, body.quick .summary { display: none; }

/* ---------- Courbe détaillée ---------- */
.curve { margin-top: 12px; }
.curve-title { font: 600 19px/1.35 var(--serif); margin: 0 0 4px; }
.curve-svg { width: 100%; height: auto; display: block; touch-action: none; direction: ltr; }
.curve-svg .grid { stroke: var(--line); stroke-width: 1; }
.curve-svg .axis { fill: var(--muted); font: 11px var(--sans); }
.curve-line { fill: none; stroke: var(--chart-line); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.curve-dot { fill: var(--chart-line); stroke: var(--surface); stroke-width: 2; }
.crosshair { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
.chart-tip {
  position: fixed; z-index: 100; pointer-events: none; background: var(--surface); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--r-md); padding: 6px 10px; font-size: 13px;
  box-shadow: var(--shadow-pop);
}
.data-table { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 13px; font-variant-numeric: tabular-nums; }
.data-table th, .data-table td { text-align: start; padding: 6px 8px; border-bottom: 1px solid var(--line); }

/* ---------- Regard croisé ---------- */
.intro { padding: 36px 0 0; }
.intro p { margin: 10px 0 0; max-width: 64ch; }
.versus { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.stat { display: grid; gap: 4px; padding-inline-start: 14px; border-inline-start: 2px solid var(--line); }
.stat:first-child { border-color: var(--primary); }
.stat strong { font: 700 32px/1 var(--serif); font-variant-numeric: tabular-nums; }
.stat span { font-size: 13px; color: var(--muted); }
.pairs { margin-top: 22px; display: grid; gap: 10px; }
.pairs h3 { margin: 0; font: 700 18px var(--serif); }
.pair {
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px 20px; padding: 14px;
  border-radius: var(--r-md); background: var(--surface-2); font-size: 14px;
}
.pair > div { display: grid; gap: 2px; }
.pair a { text-decoration: none; font-weight: 500; }
.pair a:hover { text-decoration: underline; }
.pair .muted { font-size: 12px; }
.angle { grid-column: 1 / -1; margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.angle strong { color: var(--text); font-weight: 500; }
.compare-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.compare-col h2 { font: 700 22px var(--serif); margin: 0 0 6px; }
.brief-mini { font: 400 15px/1.6 var(--serif); margin: 0 0 8px; color: var(--muted); }

/* ---------- Mon brief ---------- */
.mine-section { margin-top: 32px; }
.mine-section h2 { font-size: 20px; }
.cta h2 { font: 700 24px var(--serif); margin: 0 0 8px; }
.cta p { max-width: 62ch; }

/* ---------- Modale & formulaires ---------- */
.modal {
  width: min(560px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); padding: 28px;
  border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); color: var(--text);
  box-shadow: var(--shadow-pop);
}
.modal[open] { animation: pop var(--t-med) var(--ease); }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.modal::backdrop { background: var(--scrim); backdrop-filter: blur(2px); }
.modal-close { position: absolute; top: 14px; inset-inline-end: 14px; margin: 0; }
.modal-close button {
  border: 0; background: none; font-size: 16px; color: var(--muted);
  width: 40px; height: 40px; border-radius: 50%;
}
.modal-close button:hover { background: var(--surface-2); color: var(--text); }
.modal-title { margin: 0 0 14px; font: 700 24px var(--serif); padding-inline-end: 40px; }
.modal h3 { margin: 20px 0 4px; font: 700 17px var(--serif); }
.form { display: grid; gap: 14px; }
.form > p { margin: 0; }
.field { display: grid; gap: 6px; font-size: 14px; font-weight: 500; color: var(--text); }
.field .hint { font-weight: 400; color: var(--muted); font-size: 13px; }
.field input, .field select, .tag-input {
  font-size: 16px; font-weight: 400; color: var(--text); background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: var(--r-md); min-height: 44px; padding: 10px 12px; width: 100%;
}
.field input:focus, .field select:focus, .tag-input:focus-within { outline: 2px solid var(--focus); outline-offset: -1px; border-color: transparent; }
.field input[type=range] { padding: 0; accent-color: var(--primary); border: 0; min-height: 32px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: end; }
.row > * { flex: 1 1 160px; }
.row > .btn { flex: 0 0 auto; }
.tag-input { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px; }
.tag-input input { border: 0; background: none; padding: 4px; flex: 1 1 160px; min-width: 0; outline: none; min-height: 32px; }
.tag.removable { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; color: var(--text); }
.tag.removable button { border: 0; background: none; padding: 0 4px; color: var(--muted); min-width: 24px; min-height: 24px; }
.check { display: flex; align-items: center; gap: 10px; font-size: 15px; min-height: 44px; }
.check input { accent-color: var(--primary); width: 18px; height: 18px; }
.form-error { color: var(--primary-ink); font-size: 14px; font-weight: 500; }
.form-error:empty { display: none; }
.fav-list { list-style: none; padding: 0; margin: 4px 0 8px; display: grid; gap: 4px; }
.fav-list li {
  display: flex; justify-content: space-between; gap: 12px; align-items: center;
  padding: 8px 12px; border-radius: var(--r-md); background: var(--surface-2); font-size: 14px; min-height: 44px;
}

/* ---------- États ---------- */
.skeleton {
  height: 128px; border-radius: var(--r-lg); border: 1px solid var(--line);
  background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 50%, var(--surface) 75%);
  background-size: 200% 100%; animation: shimmer 1.3s linear infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }
.empty { text-align: center; color: var(--muted); padding: 48px 0; }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 200;
  background: var(--text); color: var(--bg); padding: 12px 20px; border-radius: var(--r-md);
  font-size: 14px; font-weight: 500; box-shadow: var(--shadow-pop); max-width: calc(100vw - 32px);
  animation: pop var(--t-med) var(--ease);
}
.footer {
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; align-items: baseline;
  color: var(--muted); font-size: 13px; padding-block: 48px; margin-top: 32px; border-top: 1px solid var(--line);
}
.footer p { margin: 0; max-width: 60ch; }

/* ---------- Responsive ---------- */
@media (max-width: 760px) {
  .topbar-inner { flex-wrap: wrap; padding-block: 10px 0; row-gap: 4px; min-height: 0; }
  .tabs { order: 3; flex-basis: 100%; margin: 0 -4px; overflow-x: auto; }
  .tabs a { padding: 12px; }
  .tabs a.active::after { bottom: 0; }
  .topbar-actions { margin-inline-start: auto; }
  #ai-status { display: none; }
  .lang-picker select { padding-inline: 30px 8px; width: 74px; }
  .compare-grid, .pair { grid-template-columns: 1fr; }
  .stat-row { grid-template-columns: repeat(2, 1fr); }
  .brief { padding: 20px; }
  .story { grid-template-columns: 32px 1fr; gap: 10px 12px; padding: 16px; }
  .rank { font-size: 26px; }
  .side { grid-column: 2; grid-row: 1; flex-direction: row-reverse; justify-self: end; align-items: center; }
  .score { width: 46px; height: 46px; }
  .score span { width: 38px; height: 38px; font-size: 14px; }
  .story-body { grid-column: 1 / -1; }
  .signal { grid-template-columns: 90px 1fr 48px; }
}
@media (pointer: coarse) {
  .chip, .action, .view-switch button { min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media (forced-colors: active) {
  .score { border: 2px solid CanvasText; }
  .story.top { border-inline-start-color: Highlight; }
}

/* ---------- Bandeau photo (monument du pays) ---------- */
#hero:empty { display: none; }
.hero {
  position: relative; margin: 0; height: clamp(240px, 34vw, 380px); overflow: hidden;
  background: #1C1917; color: #FFFFFF; isolation: isolate;
}
.hero-img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 40%;
  opacity: 0; transform: scale(1.03); transition: opacity 500ms var(--ease), transform 1200ms var(--ease); z-index: -2;
}
.hero.loaded .hero-img { opacity: 1; transform: none; }
.hero.no-photo .hero-img { display: none; }
/* Voile mesuré pour un texte blanc ≥ 4,5:1 quelle que soit la photo : très sombre en bas, plus léger en haut. */
.hero-scrim {
  position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(to top, rgb(12 10 9 / .88) 0%, rgb(12 10 9 / .7) 50%, rgb(12 10 9 / .42) 100%);
}
.hero.no-photo .hero-scrim { background: linear-gradient(135deg, #292524, #0C0A09); }
.hero-inner { position: relative; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; padding-block: 24px 44px; }
.hero-eyebrow { margin: 0 0 6px; font-size: 14px; font-weight: 500; color: #FECACA; text-shadow: 0 1px 2px rgb(0 0 0 / .4); }
.hero-eyebrow::first-letter { text-transform: uppercase; }
.hero-title {
  margin: 0; font: 700 clamp(30px, 5.6vw, 52px)/1.08 var(--serif); letter-spacing: -0.02em;
  text-shadow: 0 2px 12px rgb(0 0 0 / .35); max-width: 22ch;
}
.hero-controls { margin-top: 18px; }
.hero .country-picker .label { color: rgb(255 255 255 / .85); }
.hero select { background-color: rgb(255 255 255 / .96); color: #1C1917; border-color: transparent; }
.hero-credit {
  position: absolute; inset-inline-end: 12px; bottom: 10px; max-width: calc(100% - 24px);
  display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 2px 10px;
  font-size: 12px; color: rgb(255 255 255 / .85); text-shadow: 0 1px 2px rgb(0 0 0 / .6);
}
.hero-credit a { color: inherit; text-decoration: underline; text-underline-offset: 2px; text-decoration-color: rgb(255 255 255 / .5); }
.hero-place { font-weight: 500; color: #FFFFFF; }
.hero-credit:empty { display: none; }
body[data-view="ranking"] .controls { padding-top: 20px; }

/* ---------- Avis ---------- */
.review-layout { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 20px; align-items: start; margin-top: 8px; }
.review-layout > .brief { margin: 20px 0 12px; }
.section-title { font: 700 22px var(--serif); margin: 0 0 14px; }
.review-summary { display: grid; gap: 20px; }
.review-average { display: grid; gap: 6px; justify-items: start; }
.review-average strong { font: 700 56px/1 var(--serif); font-variant-numeric: tabular-nums; }
.stars { display: inline-flex; gap: 2px; color: var(--line-strong); vertical-align: middle; }
.stars .star.full, .rating-input label.on { color: var(--primary); }
.stars .star.full { fill: currentColor; }
.stars .star.half { color: var(--primary); fill: currentColor; fill-opacity: .45; }
.review-dist { display: grid; gap: 8px; }
.dist-row { display: grid; grid-template-columns: 36px 1fr 32px; gap: 10px; align-items: center; font-size: 13px; }
.dist-label { display: inline-flex; align-items: center; gap: 4px; font-variant-numeric: tabular-nums; }
.dist-label .star { color: var(--primary); fill: currentColor; }
.dist-row .bar { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.dist-row .bar i { display: block; height: 100%; background: var(--primary); border-radius: 999px; }
.dist-val { text-align: end; color: var(--muted); font-variant-numeric: tabular-nums; }

.rating-field { border: 0; padding: 0; margin: 0; display: grid; gap: 6px; }
.rating-field legend { font-size: 14px; font-weight: 500; padding: 0; margin-bottom: 6px; }
.rating-input { display: flex; gap: 4px; }
.rating-input label {
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: var(--r-md);
  color: var(--line-strong); cursor: pointer; transition: color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
.rating-input label:hover { transform: scale(1.08); }
.rating-input label.on .icon { fill: currentColor; }
.rating-input input:focus-visible + label { outline: 2px solid var(--focus); outline-offset: 1px; }
.rating-hint { font-size: 14px; color: var(--muted); min-height: 1.4em; }
.field textarea {
  font: 400 16px/1.55 var(--sans); color: var(--text); background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: var(--r-md); padding: 10px 12px; width: 100%; resize: vertical; min-height: 110px;
}
.field textarea:focus { outline: 2px solid var(--focus); outline-offset: -1px; border-color: transparent; }
.danger-btn { color: var(--primary-ink); border-color: var(--line-strong); }
.danger-btn:hover { background: var(--primary-soft); }

.reviews { list-style: none; padding: 0; margin: 16px 0; display: grid; gap: 12px; }
.review { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px 20px; }
.review.mine { border-color: color-mix(in srgb, var(--primary) 40%, var(--line)); }
.review-head { display: flex; gap: 12px; align-items: flex-start; }
.review-head > div { flex: 1; min-width: 0; }
.review-head strong { display: inline-flex; gap: 8px; align-items: center; font-weight: 500; }
.avatar {
  width: 40px; height: 40px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: var(--surface-2); color: var(--text); font-weight: 700;
}
.review-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; font-size: 13px; color: var(--muted); margin-top: 2px; }
.review-text { margin: 12px 0 0; white-space: pre-line; max-width: 70ch; }

.footer-rating {
  display: inline-flex; align-items: center; gap: 8px; text-decoration: none; color: var(--text); font-size: 14px;
  min-height: 44px;
}
.footer-rating .footer-cta { color: var(--accent); font-weight: 500; }
.footer-rating:hover .footer-cta { text-decoration: underline; text-underline-offset: 3px; }

@media (max-width: 760px) {
  .review-layout { grid-template-columns: 1fr; gap: 0; }
  .hero { height: 280px; }
  .hero-inner { padding-block: 20px 40px; }
  .hero-credit { inset-inline: 12px; justify-content: flex-start; }
}
@media (prefers-reduced-motion: reduce) {
  .hero-img { opacity: 1; transform: none; }
}

/* ---------- Depuis votre dernière visite ---------- */
.since {
  margin: 20px 0 0; padding: 18px 20px; border-radius: var(--r-lg);
  background: var(--surface); border: 1px solid var(--line); border-inline-start: 3px solid var(--accent);
}
.since-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.since-head h2 { margin: 0; font: 700 20px var(--serif); }
.since-head p { margin: 2px 0 0; font-size: 13px; }
.since-counts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.since-count {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: var(--r-sm);
  font-size: 14px; font-weight: 500; background: var(--surface-2); color: var(--text);
}
.since-count.fresh { background: color-mix(in srgb, var(--accent) 14%, var(--surface)); color: var(--accent); }
.since-count.up { background: var(--primary-soft); color: var(--primary-ink); }
.since-count.down { color: var(--muted); }
[dir="rtl"] .since-count .icon { transform: scaleX(-1); }
.since-quiet { margin: 0; display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; }
.since-dropped { margin-top: 12px; font-size: 14px; }
.since-dropped summary { cursor: pointer; color: var(--accent); font-weight: 500; min-height: 32px; display: inline-flex; align-items: center; }
.since-dropped ul { margin: 6px 0 0; padding-inline-start: 18px; display: grid; gap: 4px; }
.since-dropped a { text-decoration: none; }
.since-dropped a:hover { text-decoration: underline; }
.since-badge {
  display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 500; line-height: 1.5;
  padding: 2px 8px; border-radius: var(--r-sm);
  background: color-mix(in srgb, var(--accent) 14%, var(--surface)); color: var(--accent);
}
.since-badge.up { background: var(--primary-soft); color: var(--primary-ink); }
[dir="rtl"] .since-badge .icon { transform: scaleX(-1); }
.story.changed:not(.top) { border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }

/* ---------- Brief WhatsApp ---------- */
.channel-switch { align-self: start; margin: 4px 0 16px; width: fit-content; }
.channel-switch button { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px; }
.phone-row { display: flex; gap: 8px; }
.phone-row .dial { flex: 0 0 96px; min-height: 44px; }
.phone-row input { flex: 1; min-width: 0; font-size: 16px; color: var(--text); background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-md); min-height: 44px; padding: 10px 12px; }
.phone-row input:focus { outline: 2px solid var(--focus); outline-offset: -1px; border-color: transparent; }
[dir="rtl"] .phone-row { direction: ltr; }
.consent { align-items: flex-start; font-size: 14px; line-height: 1.5; }
.consent input { margin-top: 3px; flex: none; }
.form > .hint { margin: -6px 0 0; font-size: 13px; color: var(--muted); }
.wa-step2 { display: grid; gap: 12px; }
.wa-step2 h3 { margin: 0; }
.wa-step2 p { margin: 0; }
.wa-step2 code { font: 600 16px ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--surface-2); padding: 2px 8px; border-radius: var(--r-sm); }
.wa-open { justify-self: start; text-decoration: none; }
.fav-list .icon { vertical-align: -2px; color: var(--muted); }
