/* ==========================================================================
   GoalSpeakAr — système de design (Master)
   Presse sport éditoriale. Palette restreinte, zéro dégradé/néon/glow.
   Une seule couleur de marque (rouge éditorial) + neutres chauds.
   Re-tuner la marque = changer les variables ci-dessous, rien d'autre.
   ========================================================================== */

:root {
  /* — Couleurs : papier + encre + 1 accent — */
  --paper:        #FBFAF7;
  --surface:      #FFFFFF;
  --surface-2:    #F3F1EA;
  --ink:          #15171C;
  --ink-soft:     #3C3F47;
  --muted:        #6E727A;
  --line:         #E6E3DB;
  --line-2:       #D7D3C8;
  --rule:         #15171C;          /* filets éditoriaux forts */
  --brand:        #C8102E;          /* rouge presse (Marca-like) */
  --brand-ink:    #8C0C20;          /* rouge foncé pour texte sur rouge clair */
  --brand-wash:   #FBEBED;

  /* data-viz prédictions (équipe A / nul / équipe B) */
  --win-a: var(--ink);
  --draw:  #C6C2B6;
  --win-b: var(--brand);

  /* — Typo — */
  --sans: "IBM Plex Sans Arabic", system-ui, sans-serif;
  --display: "Archivo", "IBM Plex Sans Arabic", sans-serif;

  /* — Rythme / formes — */
  --r: 4px;
  --r-lg: 6px;
  --gut: clamp(16px, 3vw, 28px);
  --maxw: 1200px;
  --t: 180ms cubic-bezier(.2,.6,.2,1);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  font-feature-settings: "kern" 1;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { font-family: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding-inline: var(--gut); }

/* ----------------------------- en-tête / masthead ----------------------------- */
.topbar {
  border-bottom: 1px solid var(--line);
  font-size: 12.5px; color: var(--muted);
}
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; height: 38px; }
.topbar .live { display: inline-flex; align-items: center; gap: 7px; color: var(--ink); font-weight: 600; }
.topbar .live i { width: 7px; height: 7px; border-radius: 50%; background: var(--brand); display: inline-block; }

.masthead { border-bottom: 2px solid var(--rule); }
.masthead .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-block: 18px; }
.logo { display: flex; align-items: center; gap: 10px; }
.logo b {
  font-family: var(--display); font-weight: 800; font-size: clamp(30px, 4.6vw, 46px);
  letter-spacing: -.02em; color: var(--ink); line-height: 1;
}
.logo b .dot { color: var(--brand); }   /* « Ar » en rouge, même taille que le reste */
.logo span { font-size: 13px; color: var(--muted); font-weight: 500; }
.logo-img { display: block; width: auto; }
.masthead .logo-img { height: 44px; }
.foot .logo-img { height: 30px; }
.masthead .edition { text-align: left; font-size: 12px; color: var(--muted); line-height: 1.5; }
.masthead .edition strong { color: var(--ink); display: block; font-weight: 600; }

/* nav */
.nav { border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; z-index: 40; }
.nav .wrap { display: flex; align-items: stretch; gap: 4px; height: 48px; }
.nav a {
  display: inline-flex; align-items: center; padding-inline: 14px;
  font-size: 14.5px; font-weight: 500; color: var(--ink-soft);
  border-bottom: 2px solid transparent; transition: color var(--t), border-color var(--t);
}
.nav a:hover { color: var(--ink); }
.nav a.active { color: var(--ink); border-bottom-color: var(--brand); font-weight: 600; }
.nav .spacer { margin-inline-start: auto; }
.nav .nav-tz { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }

/* fil oblique : une seule ligne, pas de marquee scintillant */
.breaking { border-bottom: 1px solid var(--line); background: var(--surface); }
.breaking .wrap { display: flex; align-items: center; gap: 12px; height: 40px; overflow: hidden; }
.breaking .tag {
  background: var(--brand); color: #fff; font-size: 11px; font-weight: 600;
  letter-spacing: .04em; padding: 3px 9px; border-radius: var(--r); flex: none;
}
.breaking p { margin: 0; font-size: 14px; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ----------------------------- éléments éditoriaux ----------------------------- */
.kicker {
  font-family: var(--display); font-weight: 700; font-size: 12px; letter-spacing: .08em;
  text-transform: uppercase; color: var(--brand);
}
.section-head { display: flex; align-items: center; gap: 14px; margin: 0 0 16px; }
.section-head h2 { font-size: 19px; font-weight: 700; margin: 0; }
.section-head .line { height: 1px; background: var(--line-2); flex: 1; }

/* grille principale */
.layout { display: grid; grid-template-columns: 1fr 340px; gap: 40px; padding-block: 32px 48px; align-items: start; }

/* article une (lead) */
.lead { border-bottom: 1px solid var(--line); padding-bottom: 28px; margin-bottom: 28px; }
.lead .media { position: relative; aspect-ratio: 16/9; overflow: hidden; border-radius: var(--r-lg); background: var(--surface-2); }
.lead .media img { width: 100%; height: 100%; object-fit: cover; }
.lead .cap { font-size: 11.5px; color: var(--muted); padding-top: 6px; }
.lead h1 {
  font-size: clamp(26px, 3.4vw, 38px); line-height: 1.15; font-weight: 700;
  letter-spacing: -.01em; margin: 14px 0 10px;
}
.lead .dek { font-size: 17px; color: var(--ink-soft); margin: 0 0 14px; line-height: 1.6; }
.byline { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--muted); }
.byline .sep { width: 3px; height: 3px; border-radius: 50%; background: var(--line-2); }

/* carte de prédiction en une (visuel éditorial basé sur le modèle) */
.lead-pred { border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; margin: 18px 0 16px; }
.lead-pred .h { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--surface-2); font-size: 12px; color: var(--muted); }
.lead-pred .h b { font-family: var(--display); font-weight: 700; color: var(--ink); letter-spacing: .04em; font-size: 12px; }
.lead-pred .teams { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 12px; font-size: 19px; font-weight: 600; }
.lead-pred .teams .vs { font-family: var(--display); font-size: 12px; color: var(--muted); }
.lead-pred .barwrap { padding: 0 18px 18px; }
.lead-pred .barwrap .bar { height: 12px; }
.lead-pred .vals { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); margin-top: 9px; }
.lead-pred .vals b { color: var(--ink); font-family: var(--display); font-weight: 700; }

/* cartes secondaires */
.story-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.story { display: flex; flex-direction: column; gap: 8px; }
.story + .story {}
.story h3 { font-size: 18px; line-height: 1.25; font-weight: 600; margin: 4px 0 0; transition: color var(--t); }
.story:hover h3 { color: var(--brand-ink); }
.story p { font-size: 14px; color: var(--muted); margin: 0; }
.story .meta { font-size: 12px; color: var(--muted); margin-top: auto; padding-top: 6px; }

/* ----------------------------- colonne latérale ----------------------------- */
.aside { display: flex; flex-direction: column; gap: 28px; position: sticky; top: 64px; }
.module { border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); }
.module > h3 {
  font-size: 13px; font-weight: 700; letter-spacing: .02em; margin: 0;
  padding: 13px 16px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 8px;
}
.module .body { padding: 16px; }
.module .ico { color: var(--brand); display: inline-flex; }

/* prédicteur */
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; }
select, .btn {
  width: 100%; height: 40px; border: 1px solid var(--line-2); border-radius: var(--r);
  background: var(--surface); color: var(--ink); font-size: 14px; padding: 0 12px;
  transition: border-color var(--t), background var(--t);
}
select:hover { border-color: var(--ink-soft); }
.vs-row { text-align: center; font-family: var(--display); font-weight: 700; font-size: 12px; color: var(--muted); margin: 8px 0; }
.btn-primary {
  background: var(--ink); color: #fff; border-color: var(--ink); font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; margin-top: 4px;
}
.btn-primary:hover { background: var(--brand); border-color: var(--brand); }
.btn-primary:active { transform: translateY(1px); }

/* barre de probabilités */
.prob { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.prob.hidden { display: none; }
.prob .names { display: flex; justify-content: space-between; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.bar { display: flex; height: 10px; border-radius: var(--r); overflow: hidden; background: var(--surface-2); }
.bar > i { display: block; transition: width var(--t); }
.bar .a { background: var(--win-a); }
.bar .d { background: var(--draw); }
.bar .b { background: var(--win-b); }
.prob .vals { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 6px; }
.prob .score { margin-top: 12px; padding: 10px 12px; background: var(--surface-2); border-radius: var(--r); font-size: 13px; display: flex; justify-content: space-between; }
.prob .score b { font-family: var(--display); font-weight: 700; }

/* classement / favoris */
.rank { list-style: none; margin: 0; padding: 0; }
.rank li { display: flex; align-items: center; gap: 12px; padding: 11px 16px; border-top: 1px solid var(--line); transition: background var(--t); }
.rank li:first-child { border-top: 0; }
.rank li:hover { background: var(--surface-2); }
.rank .n { font-family: var(--display); font-weight: 700; font-size: 13px; color: var(--muted); width: 18px; }
.rank .nm { font-weight: 600; font-size: 14.5px; flex: 1; }
.rank .pct { font-family: var(--display); font-weight: 700; font-size: 14px; }
.rank .mini { width: 54px; height: 4px; background: var(--surface-2); border-radius: 2px; overflow: hidden; }
.rank .mini > i { display: block; height: 100%; background: var(--brand); }

.note { font-size: 11.5px; color: var(--muted); padding: 12px 16px; border-top: 1px solid var(--line); }

/* tableau de classement des groupes (résultats réels + proba modèle) */
.standings { width: 100%; border-collapse: collapse; font-size: 13px; }
.standings thead th { text-align: start; font-weight: 600; color: var(--muted); font-size: 11px; padding: 9px 6px 6px; border-bottom: 1px solid var(--line); }
.standings th.c, .standings td.c { text-align: center; width: 30px; padding-inline: 3px; }
.standings th.r, .standings td.r { width: 22px; text-align: center; padding-inline: 3px; }
.standings tbody td { padding: 8px 6px; border-bottom: 1px solid var(--line); }
.standings tbody tr:last-child td { border-bottom: 0; }
.standings td.r { font-family: var(--display); font-weight: 700; color: var(--muted); }
.standings tr.qa td.r { color: var(--brand); }
.standings td.nm { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 118px; }
.standings td.gd { font-family: var(--display); color: var(--ink-soft); }
.standings td.pts { font-family: var(--display); font-weight: 700; }
.standings td.q { color: var(--muted); font-size: 11px; font-family: var(--display); }

/* page Articles */
.news-list { max-width: 760px; }
.news-item { padding: 22px 0; border-bottom: 1px solid var(--line); }
.news-item:first-child { padding-top: 4px; }
.news-item h2 { font-size: clamp(20px, 2.4vw, 26px); line-height: 1.25; margin: 6px 0 8px; }
.news-item h2 a { transition: color var(--t); }
.news-item h2 a:hover { color: var(--brand-ink); }
.news-item p { color: var(--ink-soft); margin: 0 0 10px; }
.article { max-width: 740px; scroll-margin-top: 70px; padding: 8px 0 30px; border-bottom: 2px solid var(--rule); margin-bottom: 30px; }
.article:last-child { border-bottom: 0; }
.article h2 { font-size: clamp(23px, 3vw, 33px); line-height: 1.18; margin: 8px 0 10px; }
.article .byline { margin: 0 0 18px; }
.article p { font-size: 16.5px; line-height: 1.85; margin: 0 0 16px; }
.article h3 { font-size: 18px; margin: 24px 0 8px; }
.article .lead-pred { max-width: 540px; margin: 18px 0; }

/* ----------------------------- pied ----------------------------- */
.foot { border-top: 2px solid var(--rule); margin-top: 24px; }
.foot .wrap { padding-block: 28px; display: grid; gap: 14px; }
.foot .logo b { font-size: 22px; }
.foot small { color: var(--muted); font-size: 12px; line-height: 1.7; }
.foot .credits { font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 14px; }
.foot .credits b { color: var(--ink); font-weight: 600; }
.foot .credits a { color: var(--brand); font-weight: 600; }

/* ----------------------------- pages internes (matchs / stades) ----------------------------- */
.page-head { border-bottom: 1px solid var(--line); background: var(--surface); }
.page-head .wrap { padding-block: 22px; display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.page-head h1 { font-size: clamp(22px, 3vw, 30px); margin: 0 0 4px; }
.page-head p { margin: 0; color: var(--muted); font-size: 14px; }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.toolbar .ctrl { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line-2); border-radius: var(--r); padding: 6px 10px; background: var(--surface); }
.toolbar .ctrl label { font-size: 11px; color: var(--muted); }
.toolbar select.sm { height: 32px; width: auto; border: 0; padding: 0 4px; background: transparent; font-weight: 600; }
.toolbar .off { font-family: var(--display); font-weight: 700; font-size: 13px; color: var(--brand); }
.toolbar .chip { height: 34px; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--surface); font-size: 12.5px; font-weight: 600; padding: 0 12px; color: var(--ink-soft); transition: all var(--t); }
.toolbar .chip:hover { border-color: var(--ink-soft); }

.day { margin-top: 26px; }
.day:first-child { margin-top: 4px; }
.day .dh { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; }
.day .dh h2 { font-size: 15px; margin: 0; }
.day .dh .line { flex: 1; height: 1px; background: var(--line); }
.day .dh .ct { font-size: 12px; color: var(--muted); }

.fx { display: grid; grid-template-columns: 58px minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 12px 16px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); transition: border-color var(--t); }
.fx + .fx { margin-top: 8px; }
.fx:hover { border-color: var(--line-2); }
.fx .t { font-family: var(--display); font-weight: 700; font-size: 16px; line-height: 1.1; }
.fx .t small { display: block; font-family: var(--sans); font-weight: 500; font-size: 10.5px; color: var(--muted); margin-top: 2px; white-space: nowrap; }
.fx .m { display: flex; align-items: center; gap: 12px; }
.fx .tm { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 15.5px; flex: 1; min-width: 0; }
.fx .tm span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fx .tm.a { justify-content: flex-end; }
.fx .tm img { width: 26px; height: 18px; object-fit: cover; border-radius: 2px; border: 1px solid var(--line); flex: none; }
.fx .vs { font-family: var(--display); font-size: 11px; color: var(--muted); flex: none; }
.fx .venue { font-size: 11.5px; color: var(--muted); margin-top: 6px; }
.fx-pred { height: 32px; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--surface); font-size: 12.5px; font-weight: 600; padding: 0 14px; color: var(--ink-soft); transition: all var(--t); }
.fx-pred:hover { background: var(--ink); color: #fff; border-color: var(--ink); }
.fx-out { grid-column: 1 / -1; padding-top: 10px; margin-top: 2px; border-top: 1px solid var(--line); }
.fx-out.hidden { display: none; }
.fx-out .names { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 6px; }
.fx-out .names b { color: var(--ink); font-family: var(--display); }
.fx-out .score { text-align: center; font-size: 12.5px; margin-top: 6px; }
.fx-out .score b { font-family: var(--display); }

/* carte des stades (page الملاعب) */
#map { height: 460px; border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.leaflet-container { background: var(--surface-2); font-family: var(--sans); }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--surface); color: var(--ink); border: 1px solid var(--line); box-shadow: none; }
.leaflet-popup-content { direction: rtl; font-family: var(--sans); margin: 10px 13px; }
.leaflet-bar a { background: var(--surface); color: var(--ink); border-color: var(--line); }
.venue-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--brand); border: 2px solid #fff; box-shadow: 0 0 0 2px var(--brand); }
.venue-dot.active { background: var(--ink); box-shadow: 0 0 0 3px var(--ink); }
.venue-label { background: transparent; border: 0; box-shadow: none; padding: 0; color: var(--ink); font-family: var(--sans); font-weight: 600; font-size: 11px; text-shadow: 0 0 3px #fff, 0 0 3px #fff, 0 0 3px #fff; white-space: nowrap; }
.venue-label.leaflet-tooltip-right::before, .venue-label.leaflet-tooltip-left::before { display: none; }
.std-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; margin-top: 24px; }
.std { border: 1px solid var(--line); border-radius: var(--r-lg); padding: 15px; background: var(--surface); transition: border-color var(--t); scroll-margin-top: 80px; }
.std:hover, .std.active { border-color: var(--ink); }
.std .city { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.std .city img { width: 20px; height: 14px; border-radius: 2px; border: 1px solid var(--line); }
.std h3 { font-size: 16.5px; margin: 8px 0 4px; }
.std .ct { font-size: 12px; color: var(--brand); font-family: var(--display); font-weight: 700; }

.plain { padding-block: 28px 48px; }

/* mini-carte révélée au clic d'un match : « où ça se joue » */
.findmap { position: sticky; top: 58px; z-index: 30; margin-bottom: 18px; border: 1px solid var(--line-2); border-radius: var(--r-lg); overflow: hidden; background: var(--surface); box-shadow: 0 8px 24px rgba(0,0,0,.08); }
.findmap.hidden { display: none; }
.findmap .fm-head { display: flex; align-items: center; justify-content: space-between; padding: 9px 14px; border-bottom: 1px solid var(--line); }
.findmap .fm-head .ttl { font-size: 13.5px; font-weight: 600; }
.findmap .fm-head .ttl b { color: var(--brand); }
.findmap .fm-close { border: 0; background: transparent; font-size: 20px; color: var(--muted); cursor: pointer; line-height: 1; padding: 0 4px; }
.findmap .fm-close:hover { color: var(--ink); }
#mini-map { height: 230px; }
.venue-dot.flash { animation: dotflash 1s ease-out 3; }
@keyframes dotflash {
  0%, 100% { box-shadow: 0 0 0 2px var(--brand); }
  40% { box-shadow: 0 0 0 11px rgba(200,16,46,.0); background: var(--brand); }
  50% { box-shadow: 0 0 0 4px var(--brand); transform: scale(1.25); }
}

.fx .venue { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.fx-where { background: transparent; border: 0; color: var(--brand); font-weight: 600; font-size: 11.5px; padding: 0; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
.fx-where:hover { text-decoration: underline; }
.fx-where svg { width: 13px; height: 13px; }

/* réseaux sociaux */
.social { display: flex; gap: 8px; }
.social a { width: 34px; height: 34px; border: 1px solid var(--line-2); border-radius: var(--r); display: inline-flex; align-items: center; justify-content: center; color: var(--ink-soft); transition: all var(--t); }
.social a:hover { background: var(--ink); color: #fff; border-color: var(--ink); }
.social a svg { width: 16px; height: 16px; }

/* ----------------------------- responsive ----------------------------- */
@media (max-width: 1024px) {
  .layout { grid-template-columns: 1fr; }
  .aside { position: static; flex-direction: row; flex-wrap: wrap; }
  .aside .module { flex: 1 1 280px; }
}
@media (max-width: 680px) {
  .story-grid { grid-template-columns: 1fr; }
  .nav .wrap { overflow-x: auto; }
  .masthead .edition { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
