/* Miloudi Optique: the site's design system. Tokens first, then base, then components.
   Every page links this one file. Directions use logical properties (inline-start/end): Arabic pages mirror by dir="rtl". */

/* ---------- Tokens ---------- */
:root {
  /* Colour: the app's own navy and amber, a pale glass blue, the coating's teal only on the lens */
  --nuit: #0F2440;          /* dark bands, the hero */
  --nuit-2: #16304F;        /* raised surfaces on nuit */
  --encre: #1F3A5F;         /* the app's navy: headings on light, links */
  --texte: #13243B;         /* body text on light */
  --discret: #4A5A70;       /* secondary text on light */
  --papier: #F5F7FA;        /* page */
  --blanc: #FFFFFF;
  --verre: #DCE8F5;         /* pale glass: quiet fills, selected rows */
  --trait: #D5DCE6;         /* borders, rules */
  --ambre: #F5A524;         /* actions; text on it is --texte */
  --ambre-vif: #FFB938;     /* action hover */
  --reflet: #5FD4C0;        /* anti-reflective coating: the lens, nothing else */
  --reflet-violet: #8E7CF0; /* the other side of the coating's sheen */
  --sur-nuit: #E8EEF6;      /* text on nuit */
  --sur-nuit-discret: #A9B8CC;
  --alerte: #E5484D;        /* a lens under its minimum */

  /* Type: one family for both scripts */
  --police: "IBM Plex Sans", system-ui, sans-serif;
  --police-ar: "IBM Plex Sans Arabic", "IBM Plex Sans", system-ui, sans-serif;
  --t-petit: 0.875rem;  /* 14 */
  --t-base: 1.0625rem;  /* 17 */
  --t-moyen: 1.25rem;   /* 20 */
  --t-titre-3: 1.5rem;  /* 24 */
  --t-titre-2: clamp(1.75rem, 1.2rem + 2vw, 2.5rem);
  --t-titre-1: clamp(2.25rem, 1.3rem + 4vw, 4rem);
  --interligne: 1.6;
  --interligne-ar: 1.85;

  /* Space: 4 px steps */
  --e-1: 4px; --e-2: 8px; --e-3: 12px; --e-4: 16px; --e-5: 24px; --e-6: 32px; --e-7: 48px; --e-8: 64px; --e-9: 96px; --e-10: 128px;
  --largeur: 1160px;
  --mesure: 62ch;           /* a paragraph's longest line */
  --gouttiere: clamp(16px, 4vw, 40px);

  /* Shape: small for controls, larger for screens, round for pills; never the same radius everywhere */
  --r-controle: 6px;
  --r-ecran: 12px;
  --r-pilule: 999px;
  --ombre-ecran: 0 1px 2px rgb(15 36 64 / 0.08), 0 24px 48px -16px rgb(15 36 64 / 0.35);
  --focus: 0 0 0 3px var(--papier), 0 0 0 5px var(--ambre);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--papier);
  color: var(--texte);
  font: 400 var(--t-base) / var(--interligne) var(--police);
  font-feature-settings: "tnum" 0;
  -webkit-font-smoothing: antialiased;
}
:lang(ar) { font-family: var(--police-ar); line-height: var(--interligne-ar); }
:lang(ar) body, body:lang(ar) { font-size: 1.125rem; }
h1, h2, h3 { margin: 0; color: var(--encre); font-weight: 600; line-height: 1.15; letter-spacing: -0.015em; text-wrap: balance; }
:lang(ar) :is(h1, h2, h3) { letter-spacing: 0; line-height: 1.4; }
h1 { font-size: var(--t-titre-1); letter-spacing: -0.03em; }
h2 { font-size: var(--t-titre-2); }
h3 { font-size: var(--t-titre-3); }
p { margin: 0; max-width: var(--mesure); text-wrap: pretty; }
a { color: var(--encre); text-underline-offset: 0.2em; }
img { display: block; max-width: 100%; height: auto; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--r-controle); }
.chiffres { font-variant-numeric: tabular-nums; }
.discret { color: var(--discret); }
.visuellement-cache { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---------- Layout ---------- */
.conteneur { width: min(100% - 2 * var(--gouttiere), var(--largeur)); margin-inline: auto; }
.bande { padding-block: var(--e-9); }
.bande--nuit { background: var(--nuit); color: var(--sur-nuit); }
.bande--nuit :is(h1, h2, h3) { color: var(--blanc); }
.bande--nuit a:not(.bouton) { color: var(--sur-nuit); }
.bande--blanc { background: var(--blanc); }
.bande--verre { background: var(--verre); }
.intro { font-size: var(--t-moyen); color: var(--discret); }
.bande--nuit .intro { color: var(--sur-nuit-discret); }

/* ---------- Header ---------- */
.entete { background: var(--nuit); color: var(--sur-nuit); border-block-end: 1px solid rgb(255 255 255 / 0.08); }
.entete__ligne { display: flex; align-items: center; gap: var(--e-5); min-height: 72px; }
.marque { display: inline-flex; align-items: center; gap: var(--e-3); color: var(--blanc); text-decoration: none; font-weight: 600; font-size: 1.125rem; letter-spacing: -0.01em; }
.marque svg { width: 30px; height: 30px; flex: none; }
.nav { display: flex; gap: var(--e-5); margin-inline-start: auto; }
.nav a { color: var(--sur-nuit-discret); text-decoration: none; font-size: var(--t-petit); font-weight: 500; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--blanc); }
.langues { display: flex; border: 1px solid rgb(255 255 255 / 0.18); border-radius: var(--r-pilule); padding: 2px; }
.langues a { padding: 4px 12px; border-radius: var(--r-pilule); color: var(--sur-nuit-discret); text-decoration: none; font-size: var(--t-petit); line-height: 1.5; }
.langues a[aria-current="true"] { background: var(--nuit-2); color: var(--blanc); }
.langues a:lang(ar) { font-family: var(--police-ar); }
@media (max-width: 760px) {
  .nav { display: none; }
  .langues { margin-inline-start: auto; }
  .entete .bouton { display: none; }
}

/* ---------- Buttons ---------- */
.bouton {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--e-2);
  min-height: 48px; padding: 0 var(--e-5);
  border: 1px solid transparent; border-radius: var(--r-controle);
  font: 600 1rem/1 inherit; font-family: inherit; text-decoration: none; cursor: pointer;
  transition: background-color 120ms, border-color 120ms, transform 120ms;
}
.bouton:active { transform: translateY(1px); }
.bouton svg { width: 20px; height: 20px; flex: none; }
.bouton--principal { background: var(--ambre); color: var(--texte); }
.bouton--principal:hover { background: var(--ambre-vif); }
.bouton--secondaire { background: transparent; color: var(--encre); border-color: var(--trait); }
.bouton--secondaire:hover { border-color: var(--encre); }
.bande--nuit .bouton--secondaire, .entete .bouton--secondaire { color: var(--blanc); border-color: rgb(255 255 255 / 0.28); }
.bande--nuit .bouton--secondaire:hover { border-color: var(--blanc); }
.bouton--petit { min-height: 38px; padding: 0 var(--e-4); font-size: var(--t-petit); }
.actions { display: flex; flex-wrap: wrap; gap: var(--e-3); }

/* ---------- Hero: the lens over the stock ---------- */
.heros { padding-block: var(--e-9) var(--e-10); overflow: hidden; position: relative; }
/* The stock's grid lines behind everything, unmagnified */
.heros::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(rgb(255 255 255 / 0.045) 1px, transparent 1px), linear-gradient(90deg, rgb(255 255 255 / 0.045) 1px, transparent 1px);
  background-size: 44px 34px;
  mask-image: linear-gradient(90deg, transparent 35%, #000 75%);
}
[dir="rtl"] .heros::before, .heros[dir="rtl"]::before { mask-image: linear-gradient(270deg, transparent 35%, #000 75%); }
.heros__grille { position: relative; display: grid; grid-template-columns: 1.05fr 1fr; align-items: center; gap: var(--e-8); }
.heros__texte > * + * { margin-block-start: var(--e-5); }
.heros__texte .actions { margin-block-start: var(--e-6); }
.heros__note { display: flex; align-items: center; gap: var(--e-2); font-size: var(--t-petit); color: var(--sur-nuit-discret); }
.heros__note svg { width: 18px; height: 18px; color: var(--reflet); flex: none; }
@media (max-width: 900px) {
  .heros__grille { grid-template-columns: 1fr; gap: var(--e-7); }
  .heros { padding-block: var(--e-8) var(--e-9); }
}

/* The lens: a coated rim (the teal-violet sheen of an anti-reflective coating), the grid magnified inside */
.lentille {
  --taille: min(100%, 500px);
  width: var(--taille); aspect-ratio: 1; margin-inline: auto; position: relative;
  border-radius: 50%; padding: 10px;
  background: conic-gradient(from 210deg, var(--reflet), var(--reflet-violet) 22%, rgb(255 255 255 / 0.15) 40%, var(--reflet) 62%, var(--reflet-violet) 80%, var(--reflet));
  box-shadow: 0 40px 80px -30px rgb(0 0 0 / 0.6), 0 0 120px -20px rgb(95 212 192 / 0.25);
  animation: lentille-arrive 900ms cubic-bezier(.2, .7, .2, 1) both;
}
.lentille__verre {
  position: absolute; inset: 10px; border-radius: 50%; overflow: hidden;
  background: radial-gradient(circle at 35% 30%, #20406A, var(--nuit-2) 60%, #0B1C33);
  display: grid; place-items: center;
}
/* The glass itself: a highlight at the top, darker at the edge */
.lentille__verre::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%; pointer-events: none;
  background: radial-gradient(ellipse 60% 35% at 38% 18%, rgb(255 255 255 / 0.16), transparent 70%), radial-gradient(circle, transparent 58%, rgb(5 14 28 / 0.65) 100%);
}
.lentille { container-type: inline-size; }
/* Sized from the lens itself: the grid always fits inside it, on a phone as on a wide screen */
.lentille .grille-verres { font-size: 2.9cqi; }
.lentille .grille-verres th { font-size: 2.5cqi; padding: 1cqi 1.4cqi; }
.lentille .grille-verres td { width: 8.6cqi; height: 6.4cqi; }
@keyframes lentille-arrive { from { opacity: 0; translate: -40px 0; } to { opacity: 1; translate: 0 0; } }
[dir="rtl"] .lentille { animation-name: lentille-arrive-rtl; }
@keyframes lentille-arrive-rtl { from { opacity: 0; translate: 40px 0; } to { opacity: 1; translate: 0 0; } }
@media (prefers-reduced-motion: reduce) { .lentille { animation: none; } }

/* ---------- The lens stock grid (sphere in rows, cylinder in columns): always left to right, as in the app ---------- */
.grille-verres { border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: 0.8125rem; color: var(--sur-nuit); direction: ltr; }
.grille-verres th { font-weight: 500; color: var(--sur-nuit-discret); padding: 5px 8px; text-align: center; font-size: 0.75rem; }
.grille-verres th[scope="row"] { text-align: end; padding-inline-end: 10px; }
.grille-verres td { width: 40px; height: 30px; text-align: center; border: 1px solid rgb(255 255 255 / 0.09); }
.grille-verres td:empty::after { content: ""; }
.grille-verres .peu { color: var(--ambre); font-weight: 600; }
.grille-verres .rupture { color: var(--alerte); font-weight: 600; }
.grille-verres .choisi { background: rgb(95 212 192 / 0.18); outline: 2px solid var(--reflet); outline-offset: -2px; color: var(--blanc); font-weight: 600; }
.grille-verres__coin { font-size: 0.6875rem; line-height: 1.2; text-align: end; }
/* On light backgrounds */
.grille-verres--clair { color: var(--texte); }
.grille-verres--clair th { color: var(--discret); }
.grille-verres--clair td { border-color: var(--trait); background: var(--blanc); }
.grille-verres--clair .choisi { background: var(--verre); outline-color: var(--encre); color: var(--encre); }
.grille-verres--clair .peu { color: #B26A00; }
.grille-verres--clair .rupture { color: #C62828; }

/* ---------- Feature: words beside the real screen ---------- */
.fonction { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: var(--e-8); align-items: center; }
.fonction + .fonction { margin-block-start: var(--e-9); }
.fonction--inverse { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }
.fonction--inverse .fonction__texte { order: 2; }
.fonction__texte > * + * { margin-block-start: var(--e-4); }
@media (max-width: 900px) {
  .fonction, .fonction--inverse { grid-template-columns: 1fr; gap: var(--e-6); }
  .fonction--inverse .fonction__texte { order: 0; }
}
/* What it does, said concretely: a tick per point, no cards */
.points { list-style: none; margin: var(--e-5) 0 0; padding: 0; display: grid; gap: var(--e-3); }
.points li { display: grid; grid-template-columns: 22px 1fr; gap: var(--e-3); align-items: start; }
.points li::before {
  content: ""; width: 22px; height: 22px; margin-block-start: 0.15em; border-radius: 50%;
  background: var(--verre) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231F3A5F' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 12.5l4 4 8-9'/%3E%3C/svg%3E") center / 14px no-repeat;
}
.bande--nuit .points li::before { background-color: rgb(95 212 192 / 0.16); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235FD4C0' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 12.5l4 4 8-9'/%3E%3C/svg%3E"); }

/* A screen of the app, framed as a window */
.ecran { margin: 0; border-radius: var(--r-ecran); background: var(--blanc); box-shadow: var(--ombre-ecran); overflow: hidden; border: 1px solid var(--trait); }
.ecran__barre { display: flex; gap: 6px; padding: 10px 14px; background: var(--papier); border-block-end: 1px solid var(--trait); direction: ltr; }
.ecran__barre span { width: 10px; height: 10px; border-radius: 50%; background: var(--trait); }
.ecran img { width: 100%; }
.ecran figcaption { padding: var(--e-3) var(--e-4); font-size: var(--t-petit); color: var(--discret); border-block-start: 1px solid var(--trait); background: var(--blanc); }

/* ---------- Availability: the honest scarcity (real numbers only) ---------- */
.dispo { display: flex; flex-wrap: wrap; align-items: center; gap: var(--e-4) var(--e-6); padding: var(--e-5) var(--e-6); border-radius: var(--r-ecran); background: var(--nuit); color: var(--sur-nuit); }
.dispo__places { display: flex; align-items: baseline; gap: var(--e-3); }
.dispo__chiffre { font-size: 2.5rem; font-weight: 600; line-height: 1; color: var(--ambre); font-variant-numeric: tabular-nums; }
.dispo__texte { flex: 1 1 320px; color: var(--sur-nuit-discret); }
.dispo__texte strong { color: var(--blanc); font-weight: 600; }
.jauge { display: flex; gap: 4px; }
.jauge span { width: 18px; height: 6px; border-radius: 3px; background: var(--ambre); }
.jauge span.pris { background: rgb(255 255 255 / 0.16); }

/* ---------- Steps of a guide: a real sequence, so numbered ---------- */
.etapes { list-style: none; counter-reset: etape; margin: 0; padding: 0; display: grid; gap: var(--e-6); }
.etapes > li { counter-increment: etape; display: grid; grid-template-columns: 40px 1fr; gap: var(--e-4); }
.etapes > li::before {
  content: counter(etape); width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 600; font-variant-numeric: tabular-nums;
  background: var(--encre); color: var(--blanc);
}
.etapes > li > * + * { margin-block-start: var(--e-3); }
/* Words of the app as on its screen: a button, a page */
.mot-ecran { padding: 1px 7px; border-radius: 4px; border: 1px solid var(--trait); background: var(--blanc); font-size: 0.9375em; font-weight: 500; color: var(--encre); white-space: nowrap; }

/* ---------- Video: a poster, played on click (files on R2) ---------- */
.video { position: relative; margin: 0; border-radius: var(--r-ecran); overflow: hidden; background: var(--nuit); aspect-ratio: 16 / 9; box-shadow: var(--ombre-ecran); }
.video img, .video video { width: 100%; height: 100%; object-fit: cover; }
.video__lancer {
  position: absolute; inset: 0; display: grid; place-items: center; border: 0; cursor: pointer;
  background: linear-gradient(180deg, rgb(15 36 64 / 0.15) 30%, rgb(15 36 64 / 0.92));
  color: var(--blanc); font: inherit;
}
.video__rond { display: grid; place-items: center; width: 76px; height: 76px; border-radius: 50%; background: var(--ambre); color: var(--texte); transition: transform 150ms; }
.video__lancer:hover .video__rond { transform: scale(1.06); }
.video__lancer svg { width: 30px; height: 30px; margin-inline-start: 4px; }
[dir="rtl"] .video__lancer svg { margin-inline-start: 0; margin-inline-end: 4px; transform: scaleX(-1); }
.video__legende { position: absolute; inset-inline: var(--e-5); inset-block-end: var(--e-4); color: var(--blanc); font-weight: 500; text-align: start; }
.video__legende small { display: block; color: var(--sur-nuit-discret); font-weight: 400; }
.video--bientot .video__lancer { cursor: default; }
.video--bientot .video__rond { background: rgb(255 255 255 / 0.14); color: var(--sur-nuit); }

/* ---------- Contact ---------- */
.contact { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: var(--e-4); }
.contact__moyen {
  display: grid; grid-template-columns: 48px 1fr; gap: var(--e-2) var(--e-4); align-items: center;
  padding: var(--e-5); border-radius: var(--r-ecran); border: 1px solid var(--trait); background: var(--blanc);
  text-decoration: none; color: var(--texte); transition: border-color 120ms;
}
.contact__moyen:hover { border-color: var(--encre); }
.contact__icone { grid-row: span 2; width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; background: var(--verre); color: var(--encre); }
.contact__icone svg { width: 24px; height: 24px; }
.contact__moyen--whatsapp .contact__icone { background: #25D366; color: var(--blanc); }
.contact__titre { font-weight: 600; color: var(--encre); }
.contact__valeur { color: var(--discret); direction: ltr; unicode-bidi: isolate; text-align: start; }

/* ---------- Form fields (the contact form, later) ---------- */
.champ { display: grid; gap: var(--e-2); }
.champ label { font-weight: 500; font-size: var(--t-petit); color: var(--encre); }
.champ input, .champ textarea, .champ select {
  font: inherit; color: var(--texte); background: var(--blanc);
  min-height: 48px; padding: var(--e-3) var(--e-4);
  border: 1px solid var(--trait); border-radius: var(--r-controle);
}
.champ textarea { min-height: 120px; resize: vertical; }
.champ input:focus-visible, .champ textarea:focus-visible { border-color: var(--encre); }
.champ__aide { font-size: var(--t-petit); color: var(--discret); }
.champ--erreur input { border-color: var(--alerte); }
.champ--erreur .champ__aide { color: var(--alerte); }

/* ---------- Footer ---------- */
.pied { background: var(--nuit); color: var(--sur-nuit-discret); padding-block: var(--e-7); font-size: var(--t-petit); }
.pied__ligne { display: flex; flex-wrap: wrap; gap: var(--e-4) var(--e-6); align-items: center; }
.pied a { color: var(--sur-nuit); text-decoration: none; }
.pied a:hover { text-decoration: underline; }
.pied .marque { margin-inline-end: auto; }

/* ---------- Questions: each opens on click (details/summary, no script) ---------- */
.questions { max-width: 820px; border-block-start: 1px solid var(--trait); }
.question { border-block-end: 1px solid var(--trait); }
.question summary {
  list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: var(--e-4);
  padding: var(--e-5) 0; font-weight: 600; font-size: var(--t-moyen); color: var(--encre);
}
.question summary::-webkit-details-marker { display: none; }
.question summary::after {
  content: ""; flex: none; width: 12px; height: 12px; margin-inline-end: 4px;
  border-inline-end: 2px solid currentColor; border-block-end: 2px solid currentColor; transform: translateY(-3px) rotate(45deg); transition: transform 150ms;
}
.question[open] summary::after { transform: translateY(3px) rotate(-135deg); }
.question p { padding-block-end: var(--e-5); color: var(--discret); }
@media (prefers-reduced-motion: reduce) { .question summary::after { transition: none; } }

/* ---------- A list in columns (the « Et aussi » of the home page) ---------- */
.colonnes { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: var(--e-6) var(--e-7); }
.colonnes h3 { font-size: 1.0625rem; margin-block-end: var(--e-2); }
.colonnes p { color: var(--discret); font-size: 1rem; }
.bande--nuit .colonnes p { color: var(--sur-nuit-discret); }

/* Steps on a dark band: the number in amber */
.bande--nuit .etapes > li::before { background: var(--ambre); color: var(--texte); }
.bande--nuit .etapes p { color: var(--sur-nuit-discret); }

/* A heading and its introduction above a section */
.tete { max-width: 720px; margin-block-end: var(--e-8); }
.tete > * + * { margin-block-start: var(--e-4); }

/* ---------- Aperçu: a picture full screen, zoomed and moved (js/apercu.js) ---------- */
img[data-apercu] { cursor: zoom-in; }
html:has(.apercu[open]) { overflow: hidden; }
.apercu {
  width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0;
  background: #0A1628; overflow: hidden; touch-action: none; user-select: none;
}
.apercu::backdrop { background: transparent; }
.apercu img { position: absolute; top: 0; left: 0; max-width: none; transform-origin: 0 0; cursor: grab; border-radius: 4px; box-shadow: 0 30px 80px rgb(0 0 0 / 0.5); }
.apercu img.prise { cursor: grabbing; }
.apercu__fermer {
  position: fixed; inset-block-start: var(--e-4); inset-inline-end: var(--e-4); z-index: 1;
  width: 48px; height: 48px; border-radius: 50%; border: 0; display: grid; place-items: center; cursor: pointer;
  background: rgb(15 36 64 / 0.9); color: var(--blanc); box-shadow: 0 0 0 1px rgb(255 255 255 / 0.2);
}
.apercu__fermer:hover { background: var(--encre); }
.apercu__fermer svg { width: 22px; height: 22px; }
.apercu__aide {
  position: fixed; inset-block-end: var(--e-4); inset-inline: 0; margin-inline: auto; width: max-content; max-width: calc(100% - 32px);
  padding: 6px 14px; border-radius: var(--r-pilule); background: rgb(0 0 0 / 0.45); color: var(--sur-nuit); font-size: var(--t-petit); pointer-events: none;
}

/* ---------- Stacks: last, so they win over a component's own margin ---------- */
.pile > * + * { margin-block-start: var(--e-4); }
.pile--large > * + * { margin-block-start: var(--e-5); }
