/* ------------------------------------------------------------------
   Central Asia Wire — feuille de style
   Type : titres en grotesque serré, métadonnées en monospace.
   L'inverse de la convention presse (serif/sans), assumé :
   ici la donnée (source, pays, heure) est aussi importante que le titre.
------------------------------------------------------------------- */

:root {
  --thumb: 128px;
  --paper:  #FAFAF8;
  --ink:    #12161C;
  --dust:   #6B7280;
  --rule:   #E4E3DE;
  --tile:   #1B6E8C;   /* céramique timouride — couleur d'ancrage */
  --focus:  #1B6E8C;

  /* Surface surelevee de l'en-tete. En mode clair elle se confond avec le
     fond, comme avant ; la nuit elle s'en detache. */
  --surface: var(--paper);
  /* Pastille « media d'Etat ». Etait codee en dur, donc impossible a
     adapter au fond sombre, ou elle tombait a 3,99:1. */
  --etat:   #9A6B1F;

  /* Accents pays : encodent une information, pas une décoration */
  --c-kz: #1B6E8C;
  --c-uz: #2F8F6B;
  --c-kg: #B4543A;
  --c-tj: #7A5EA6;
  --c-tm: #B08428;
  --c-af: #3E5FA3;

  --font-display: "Inter Tight", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, monospace;

  --wrap: 46rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    /* #101317 avait une luminance de 0.006 : a deux pour cent du noir.
       #1C2128 vaut 0.015, deux fois et demie plus clair, et garde 13,3:1
       avec le texte -- le 7:1 recommande pour un corps de texte est
       largement depasse. */
    --paper:   #1C2128;
    --surface: #242A33;   /* en-tete : une fois et demie plus clair */
    --ink:     #E7E9EC;   /* 13,3:1 */
    --dust:    #9BA3AF;   /*  6,4:1 — au-dela du 4,5:1 des petits textes */
    --rule:    #39414C;   /*  1,6:1 — visible sans decouper la page */

    /* Ancrage eclairci : #1B6E8C tombait a 2,4:1 sur ce fond, illisible
       pour un lien et pour la pastille de langue active. */
    --tile:    #4BB3CE;
    --focus:   #4BB3CE;
    --etat:    #D9A84B;   /*  7,4:1 contre 3,99:1 */

    /* Les accents pays n'existaient que pour le fond clair. Ils encodent
       une information, donc ils doivent rester distinguables entre eux
       autant que lisibles : chacun depasse 5:1. */
    --c-kz: #45B8D4;
    --c-uz: #5CC48C;
    --c-kg: #E8825E;
    --c-tj: #BC8ADE;
    --c-tm: #D9B45C;
    --c-af: #6689DE;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 16px;
  line-height: 1.5;
  font-synthesis-weight: none;
}

a { color: inherit; }

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 1px;
}

.wrap {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* ---------- En-tête ---------- */

.masthead {
  border-bottom: 1px solid var(--rule);
  padding: 1.75rem 0 0;
}

.masthead__title {
  margin: 0;
  font-size: 1.375rem;
  font-weight: 650;
  letter-spacing: -0.025em;
}

.masthead__title a { text-decoration: none; }

.masthead__note {
  margin: 0.35rem 0 0;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--dust);
  letter-spacing: 0.02em;
}

/* ---------- Filtres pays ---------- */

.filters {
  display: flex;
  gap: 0.1rem;
  overflow-x: auto;
  margin-top: 1.1rem;
  padding-bottom: 0.6rem;
  scrollbar-width: none;
}
.filters::-webkit-scrollbar { display: none; }

.filters__link {
  flex: none;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--dust);
  text-decoration: none;
  padding: 0.3rem 0.4rem;
  border: 1px solid transparent;
  border-radius: 2px;
}

.filters__link:hover { color: var(--ink); }

.filters__link[aria-current="page"] {
  color: var(--ink);
  border-color: var(--rule);
  background: color-mix(in srgb, var(--tile) 7%, transparent);
}

/* ---------- Le fil ---------- */

.feed {
  list-style: none;
  margin: 0;
  padding: 0;
}

.item {
  display: grid;
  grid-template-columns: 3px 1fr auto;
  column-gap: 1rem;
  padding: 1.4rem 0;
  border-bottom: 1px solid var(--rule);
}

/* Le rail : signature du site. Sa couleur encode le pays. */
.item__rail {
  border-radius: 2px;
  background: var(--dust);
}
.item[data-country="kz"] .item__rail { background: var(--c-kz); }
.item[data-country="uz"] .item__rail { background: var(--c-uz); }
.item[data-country="kg"] .item__rail { background: var(--c-kg); }
.item[data-country="tj"] .item__rail { background: var(--c-tj); }
.item[data-country="tm"] .item__rail { background: var(--c-tm); }
.item[data-country="af"] .item__rail { background: var(--c-af); }

.item__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.4rem 0.55rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.02em;
  color: var(--dust);
  margin-bottom: 0.4rem;
}

.item__source {
  color: var(--ink);
  font-weight: 500;
  text-decoration: none;
  border-bottom: 1px solid var(--rule);
}
.item__source:hover { border-bottom-color: currentColor; }

/* Transparence éditoriale : dit au lecteur à qui il a affaire. */
.item__standing {
  text-transform: uppercase;
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  padding: 0.1rem 0.32rem;
  border: 1px solid var(--rule);
  border-radius: 2px;
  white-space: nowrap;
}
.item__standing[data-standing="state"] {
  color: var(--etat);
  border-color: color-mix(in srgb, var(--etat) 35%, transparent);
}

.item__lang { text-transform: uppercase; }

.item__title {
  margin: 0 0 0.35rem;
  font-size: 1.0625rem;
  font-weight: 620;
  line-height: 1.32;
  letter-spacing: -0.017em;
  text-wrap: balance;
}

.item__title a {
  text-decoration: none;
  background-image: linear-gradient(var(--tile), var(--tile));
  background-size: 0 1px;
  background-position: 0 100%;
  background-repeat: no-repeat;
  transition: background-size 0.18s ease;
}
.item__title a:hover { background-size: 100% 1px; }

.item__summary {
  margin: 0;
  font-size: 0.9375rem;
  line-height: 1.55;
  color: color-mix(in srgb, var(--ink) 78%, var(--paper));
}

.item__thumb {
  width: var(--thumb);
  /* 3:2 plutot que carre : une photo de presse est en paysage, un
     cadrage carre lui retire un tiers. */
  aspect-ratio: 3 / 2;
  height: auto;
  object-fit: cover;
  border-radius: 2px;
  background: var(--rule);
  grid-column: 3;
  grid-row: 1;
}

/* ---------- Pied ---------- */

.foot {
  padding: 2rem 0 3rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  line-height: 1.7;
  color: var(--dust);
}
.foot p { margin: 0 0 0.5rem; }
.foot a { color: var(--ink); }

/* ---------- Mobile ---------- */

@media (max-width: 34rem) {
  .item {
    grid-template-columns: 3px 1fr;
    column-gap: 0.75rem;
  }
  .item__thumb {
    grid-column: 2;
    grid-row: auto;
    width: 100%;
    aspect-ratio: 16 / 9;
    height: auto;
    margin-top: 0.7rem;
  }
  .item__title { font-size: 1rem; }
}

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

/* ---------- Multilingue ---------- */

.masthead__top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.langs {
  display: flex;
  gap: 0.15rem;
  flex: none;
}

.langs__link {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.02em;
  color: var(--dust);
  text-decoration: none;
  padding: 0.2rem 0.45rem;
  border-radius: 2px;
}
.langs__link:hover { color: var(--ink); }
.langs__link[aria-current="page"] {
  color: var(--paper);
  background: var(--tile);
}

/* Marqueur de traduction automatique : discret mais toujours présent */
.item__mt {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--dust);
  padding: 0.1rem 0.32rem;
  border: 1px dashed var(--rule);
  border-radius: 2px;
  white-space: nowrap;
  cursor: help;
}

/* ---------- En-tête statique ---------- */

.site-head {
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
}

.site-head__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 0.85rem;
  padding-bottom: 0.85rem;
}

.brand { display: inline-flex; align-items: center; text-decoration: none; }

.brand__mark {
  height: 30px;
  width: auto;
  display: block;
}

.site-head__home {
  flex: none;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: var(--dust);
  text-decoration: none;
}
.site-head__home:hover { color: var(--ink); }

/* ---------- Barre de navigation ---------- */

.bar {
  border-bottom: 1px solid var(--rule);
  z-index: 10;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: saturate(180%) blur(8px);
}

/* Deux lignes distinctes : pays au-dessus, langues en dessous. */
.bar__inner {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  padding-top: 0.4rem;
  padding-bottom: 0.4rem;
}

.bar .filters { margin-top: 0; padding-bottom: 0.3rem; }
.bar .langs {
  flex: none;
  justify-content: flex-start;
  padding-top: 0.3rem;
  border-top: 1px solid color-mix(in srgb, var(--rule) 55%, transparent);
  overflow-x: auto;
  scrollbar-width: none;
}
.bar .langs::-webkit-scrollbar { display: none; }
.bar .langs__link { flex: none; }

/* ---------- Pied de page ---------- */

.foot__legal {
  max-width: 42rem;
  margin: 0 0 0.5rem;
}

.foot__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1rem;
  margin: 0.9rem 0 0;
  padding-top: 0.9rem;
  border-top: 1px solid var(--rule);
}
.foot__meta + .foot__meta { border-top: 0; padding-top: 0; margin-top: 0.35rem; }
.foot__meta a { text-decoration: none; border-bottom: 1px solid var(--rule); }
.foot__meta a:hover { border-bottom-color: currentColor; }

/* Le chinois n'a pas d'espaces entre les mots : le crenage negatif et
   text-wrap: balance, cales sur le latin, y produisent un rendu serre
   et des coupures arbitraires. */
:lang(zh) .item__title,
[lang^="zh"] .item__title {
  letter-spacing: 0;
  line-height: 1.45;
  text-wrap: auto;
  font-weight: 600;
}

:lang(zh) .item__summary,
[lang^="zh"] .item__summary {
  line-height: 1.75;
}

:lang(zh) .masthead__title,
[lang^="zh"] .masthead__title { letter-spacing: 0; }

/* Coupure des URL et chaines latines au sein d'un texte chinois */
[lang^="zh"] .item__title,
[lang^="zh"] .item__summary {
  overflow-wrap: break-word;
  line-break: strict;
}

/* ---------- Index des archives ---------- */
.archive-list {
  list-style: none;
  margin: 1.5rem 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.archive-list a {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  padding: 0.4rem 0.7rem;
  border: 1px solid var(--rule);
  border-radius: 2px;
  text-decoration: none;
  color: var(--ink);
}
.archive-list a:hover { border-color: var(--tile); color: var(--tile); }

/* ---------- Page autonome (partage) ---------- */
.single { max-width: 42rem; padding: 1.75rem 0 0; }

.single__meta {
  display: flex; flex-wrap: wrap; align-items: baseline;
  gap: 0.4rem 0.55rem; margin-bottom: 0.7rem;
  font-family: var(--font-mono); font-size: 0.7rem;
  letter-spacing: 0.02em; color: var(--dust);
}

.single__title {
  margin: 0 0 1rem;
  font-size: 1.6rem; font-weight: 640; line-height: 1.25;
  letter-spacing: -0.02em; text-wrap: balance;
}
[lang^="zh"] .single__title { letter-spacing: 0; line-height: 1.4; text-wrap: auto; }

.single__image {
  width: 100%; height: auto; border-radius: 3px;
  background: var(--rule); margin-bottom: 1.1rem;
}

.single__summary {
  margin: 0 0 1.6rem;
  font-size: 1.0625rem; line-height: 1.65;
  color: color-mix(in srgb, var(--ink) 85%, var(--paper));
}
[lang^="zh"] .single__summary { line-height: 1.8; }

/* L'appel a lire la source est l'action principale de la page :
   elle ne remplace pas l'article, elle y renvoie. */
.single__cta a {
  display: inline-block;
  font-size: 0.95rem; font-weight: 560;
  padding: 0.65rem 1.15rem;
  color: var(--paper); background: var(--tile);
  border-radius: 3px; text-decoration: none;
}
.single__cta a:hover { filter: brightness(1.08); }

.single__note {
  margin: 1.4rem 0 0;
  font-family: var(--font-mono); font-size: 0.68rem;
  line-height: 1.6; color: var(--dust);
}

.single__langs {
  display: flex; flex-wrap: wrap; gap: 0.3rem;
  margin: 1.6rem 0 2rem; padding-top: 1rem;
  border-top: 1px solid var(--rule);
}
.single__langs a {
  font-family: var(--font-mono); font-size: 0.72rem;
  color: var(--dust); text-decoration: none;
  padding: 0.25rem 0.5rem; border: 1px solid var(--rule); border-radius: 2px;
}
.single__langs a:hover { color: var(--ink); border-color: var(--tile); }

/* ---------- Page sources ---------- */
.sources-page { max-width: 44rem; padding: 1.75rem 0 2rem; }

.sources-page__intro {
  margin: 0 0 1rem;
  font-size: 0.9375rem; line-height: 1.65;
  color: color-mix(in srgb, var(--ink) 82%, var(--paper));
}
[lang^="zh"] .sources-page__intro { line-height: 1.85; }

.sources-block { margin-top: 2rem; }

.sources-block__title {
  margin: 0 0 0.6rem;
  font-size: 0.78rem; font-weight: 500;
  font-family: var(--font-mono);
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--dust);
}

.sources-table {
  width: 100%; border-collapse: collapse; font-size: 0.875rem;
}
.sources-table th {
  text-align: left; font-weight: 500; font-size: 0.7rem;
  font-family: var(--font-mono); letter-spacing: 0.04em;
  color: var(--dust); padding: 0 0.6rem 0.4rem 0;
  border-bottom: 1px solid var(--rule);
}
.sources-table td {
  padding: 0.55rem 0.6rem 0.55rem 0;
  border-bottom: 1px solid color-mix(in srgb, var(--rule) 55%, transparent);
  vertical-align: middle;
}
.sources-table a { color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--rule); }
.sources-table a:hover { border-bottom-color: var(--tile); }
.sources-table .mono { font-family: var(--font-mono); font-size: 0.75rem; color: var(--dust); }
.sources-table .num { text-align: right; }

@media (max-width: 34rem) {
  .sources-table { font-size: 0.8rem; }
  .sources-table td, .sources-table th { padding-right: 0.35rem; }
}

/* Meteo et monnaies : memes police, couleur et rythme que les rangees de
   navigation, mais detaches par une respiration — ce sont des informations
   passives, pas des commandes. Masques tant que les donnees ne sont pas
   arrivees, pour ne pas decaler la mise en page. */
.meteo,
.change {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: flex-start;
  gap: 0.15rem;
  overflow-x: auto;
  scrollbar-width: none;
}
.meteo::-webkit-scrollbar,
.change::-webkit-scrollbar { display: none; }
.meteo[hidden],
.change[hidden] { display: none; }

/* Le premier bandeau visible porte le filet et la respiration. */
.meteo {
  margin-top: 0.75rem;
  padding-top: 0.55rem;
  border-top: 1px solid var(--rule);
}

/* Le second se rattache au premier. */
.change { padding-top: 0.1rem; }

/* Si la meteo est indisponible, les monnaies prennent sa place en tete du
   groupe et recuperent filet et respiration. */
.meteo[hidden] + .change {
  margin-top: 0.75rem;
  padding-top: 0.55rem;
  border-top: 1px solid var(--rule);
}

/* Typographie commune, reprise ligne pour ligne de .langs__link */
.meteo__ville,
.change__paire,
.change__base {
  flex: none;
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  line-height: 1.5;
  letter-spacing: 0.02em;
  color: var(--dust);
  padding: 0.2rem 0.45rem;
}

.meteo__ciel { opacity: 0.8; }
.change__note { text-decoration: none; cursor: help; opacity: 0.6; }
.change__bases { display: flex; flex: none; gap: 0.1rem; margin-right: 0.3rem; }

/* Un <button> n'herite pas comme un <a> : sans neutralisation de son rendu
   natif, sa police et sa hauteur de ligne decalent toute la rangee. */
.change__base {
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  border-radius: 2px;
  background: transparent;
  cursor: pointer;
}
.change__base:hover { color: var(--ink); }
.change__base[aria-current="true"] {
  color: var(--paper);
  background: var(--tile);
}

/* Sur fond sombre, les filets a 55 % disparaissent : on les remonte. */
@media (prefers-color-scheme: dark) {
  .bar .langs,
  .meteo,
  .meteo[hidden] + .change {
    border-top-color: color-mix(in srgb, var(--rule) 85%, transparent);
  }
  .sources-table td {
    border-bottom-color: color-mix(in srgb, var(--rule) 85%, transparent);
  }
}

/* Separateur entre un libelle et sa valeur, dans les bandeaux. */
.sep {
  padding: 0 0.28em;
  opacity: 0.55;
}
.site-head {
  top: 0;
  z-index: 20;
  background: var(--paper);
}

.bar {
  z-index: 10;
}

/* Sans fond opaque, le contenu defilant transparait sous l'en-tete. */
@supports not (backdrop-filter: blur(1px)) {
  .bar { background: var(--paper); }
}



/* Recouvrement d'un pixel : evite qu'un arrondi sous-pixel ne laisse
   filtrer une ligne de contenu entre la barre du logo et le menu. */
.bar { margin-border-top: 1px solid var(--rule); }


/* ---------- En-tête : un seul bloc collant ---------- */
/* Les deux barres etaient collantes separement, celle des pays calee sur
   la hauteur de celle du logo via --head-h. Cette hauteur depend de la
   police, donc de la langue, et de la largeur de l'ecran : aucune valeur,
   figee ou mesuree, ne la couvre a tout instant. D'ou la couture par
   laquelle les articles defilaient.

   Ici un seul element colle. Les deux barres sont dans son flux normal :
   elles sont solidaires par construction, et il n'y a plus de decalage a
   calculer. */

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--surface);
}

/* Dans le conteneur, les barres reprennent le flux normal. */
.topbar > .site-head,
.topbar > .bar {
  background: transparent;
  position: static;
  top: auto;
  z-index: auto;
}

/* Le flou de la barre des pays n'a plus de sens : le conteneur est opaque,
   et un backdrop-filter sur un enfant d'element colle cree en outre un
   contexte d'empilement qui brouille le rendu sur WebKit. */
.topbar > .bar {
  background: transparent;
  backdrop-filter: none;
}
