/*
  Medelfa : la couche du design system Medelfa (https://claude.ai/artifact/X3tPqVMM1w4eCFYnCRdjTJ)
  appliquée au système du site. Chargée après system.css, layout.css et icon.css.

  Jetons Medelfa → variables du site :
    paper #f7f3ec  fond par défaut          sand #f0e6d8  cartes, bandes claires
    ink #121110    texte, fonds sombres      graphite #262321  surface sur ink
    race-orange #ff6a00  remplissage seulement (boutons, barre coupée), texte dessus : ink
    ember #b23f0b  orange pour écrire sur paper et sand (liens, étiquettes)
    clay #d97757   chaud secondaire        muted #625c56  texte secondaire
  Règles : angles droits, pas d'ombre, pas de dégradé, une seule diagonale à 12°.
*/

:root {
  --p-bg: #f7f3ec; --p-surface: #f0e6d8; --p-ink: #121110; --p-muted: #625c56;
  --p-accent: #ff6a00; --p-accent-ink: #121110; --p-action: #ff6a00; --p-action-ink: #121110;
  --p-inv-bg: #121110; --p-inv-surface: #262321; --p-inv-ink: #f7f3ec; --p-inv-muted: #c9c0b5;
  --p-inv-accent: #ff6a00; --p-inv-accent-ink: #121110; --p-inv-action: #ff6a00; --p-inv-action-ink: #121110;

  --md-paper: #f7f3ec; --md-sand: #f0e6d8; --md-ink: #121110; --md-graphite: #262321;
  --md-race: #ff6a00; --md-clay: #d97757; --md-ember: #b23f0b; --md-muted: #625c56; --md-line: #e2d8ca;
  --md-cut: 12deg;

  --font-display: "Barlow Condensed", "Arial Narrow", sans-serif;
  --font-text: Inter, system-ui, sans-serif;
  --font-serif: "Source Serif 4", Georgia, serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
  --display-weight: 700;
  --display-tracking: -0.005em;
  --display-tracking-xl: -0.01em;

  /* l'orange d'écriture : ember sur fond clair, race-orange sur ink */
  --md-write: var(--md-ember);
}
.ground-inverse, .hero.ground-inverse { --md-write: var(--md-race); }

/* angles droits partout, 4px pour les champs et petits contrôles (radius-none, radius-sm) */
html[data-radius] { --r-sm: 4px; --r-md: 0px; --r-lg: 0px; --r-btn: 0px; }
/* pas d'ombre : le relief vient des changements de fond */
.card, .ui, .ly-float, .formulaire, .app.ui { box-shadow: none !important; }
.ui { --u-shadow: none; --u-r: 4px; }
@media (max-width: 1023px) { .md-stripes { display: none; } }

/* ---------- typographie ---------- */
h1, h2, h3, .t-card { font-family: var(--font-display); }
h1, h2 { font-weight: 700; letter-spacing: var(--display-tracking); }
h3 { font-weight: 500; }
.hero h1 { text-transform: uppercase; line-height: .95; letter-spacing: var(--display-tracking-xl); }
.hero__lead, .section-head > p:not(.muted), .t-lead, .credential strong { font-family: var(--font-serif); }
.section-head h2 { font-size: calc(var(--t-h2) * 1.12); line-height: 1.02; }
.faq .faq__item > h3 { font-family: var(--font-display); font-size: calc(var(--t-lead) * 1.15); font-weight: 500; letter-spacing: 0; }

/* étiquettes (kickers) : mono, capitales, espacées, orange d'écriture */
.t-label, .hero__kicker, .kicker {
  font-family: var(--font-mono); text-transform: uppercase; letter-spacing: .22em;
  font-size: 13px; font-weight: 500; color: var(--md-write);
}
.hero__kicker .dot { display: none; }
.mentions, .footer__legal { font-family: var(--font-text); }
.footer__lede { font-family: var(--font-serif); font-weight: 400; }

/* liens écrits en orange : ember sur clair, race-orange sur ink */
.link { color: var(--md-write); }
.link-plain { text-decoration-color: var(--md-write); }

/* ---------- la coupe Medelfa ---------- */
/* barre coupée : parallélogramme race-orange au-dessus du titre (couvertures, séparateurs) */
.cut-bar { display: block; width: 96px; height: 12px; background: var(--md-race); transform: skewX(calc(-1 * var(--md-cut))); margin: 0 0 var(--s-5) 4px; }
@media (max-width: 639px) { .cut-bar { width: 72px; height: 10px; margin-bottom: var(--s-4); } }

/* bandes : 6 traits race-orange à 12°, au pas de 16px, découpés dans un bloc sombre (une fois par écran au plus) */
.md-stripes { position: absolute; z-index: 0; pointer-events: none; width: 168px; height: 200px; }
.md-stripes i { position: absolute; top: 0; bottom: 0; width: 8px; background: var(--md-race); transform: skewX(calc(-1 * var(--md-cut))); }
.md-stripes i:nth-child(1) { left: 40px; } .md-stripes i:nth-child(2) { left: 56px; } .md-stripes i:nth-child(3) { left: 72px; }
.md-stripes i:nth-child(4) { left: 88px; } .md-stripes i:nth-child(5) { left: 104px; } .md-stripes i:nth-child(6) { left: 120px; }

/* ---------- logo ---------- */
.nav__logo .md-logo { display: block; height: 32px; width: auto; }
.nav__logo .md-logo--mark { display: none; }
@media (max-width: 639px) {
  .nav__logo .md-logo--full { display: none; }
  .nav__logo .md-logo--mark { display: block; height: 28px; }
}
.footer .md-logo { display: block; height: 40px; width: auto; }

/* ---------- boutons ---------- */
.btn { font-family: var(--font-text); font-weight: 600; letter-spacing: .01em; }
.btn--secondary { background: transparent; border-color: var(--ink); color: var(--ink); }

/* ---------- cartes ---------- */
/* carte sur sand ou paper, liseré race-orange de 6px en haut */
.card { border-radius: 0; }
.md-card { background: var(--md-paper); border: 0; border-top: 6px solid var(--md-race); }
.ground-surface .md-card { background: var(--md-paper); }

/* champs : 4px, bordure lisible (contrôles 3:1) */
.field :is(input, select, textarea) { border-radius: 4px; }
.form-etat[data-etat="erreur"], .field .erreur { color: #b3261e; }
.field [aria-invalid="true"] { border-color: #b3261e; }
.ground-inverse :is(.form-etat[data-etat="erreur"], .field .erreur) { color: #ff9c8a; }

/* ---------- petits écrans : hauteur naturelle des sections ----------
   Sur ordinateur, chaque section occupe un ou deux écrans (le rythme du skill). Sous 1024px cette règle
   laisse de grands vides : les sections y prennent leur hauteur, le hero garde l'écran entier. */
@media (max-width: 1023px) {
  main > section.section:not(.hero), footer.closing {
    height: auto !important; min-height: 0 !important;
    padding-top: var(--s-9); padding-bottom: calc(var(--s-9) + var(--bar));
  }
  footer.closing.g2m > .wrap { display: block; }
  footer.closing .closing__links { margin-top: var(--s-9); }
}
@media (max-width: 639px) {
  main > section.section:not(.hero), footer.closing { padding-top: var(--s-8); padding-bottom: calc(var(--s-8) + var(--bar)); }
  footer.closing .closing__links { margin-top: var(--s-8); }
}

/* texte courant en ink (7:1) ; le gris muted reste aux petites mentions, sources et pieds */
:is(.section-head, .stack-4) > p.muted { color: var(--ink); }
.form > p.t-small.muted, .offres__note { color: var(--ink); opacity: .8; }

/* ---------- aucune section ne déborde, quelle que soit la hauteur de l'écran ----------
   Le skill fixe chaque section à un ou deux écrans (100svh). Sur un écran plus bas que prévu
   (portable de 760 à 830px de haut), le contenu débordait sur la section suivante. La hauteur
   d'écran devient un minimum : la section grandit si son contenu l'exige. */
@media (min-width: 1024px) {
  main > section.section:not(.hero), footer.closing {
    height: auto !important;
    min-height: calc(var(--h, 1) * 100svh);
  }
  footer.closing > .wrap { display: flex; flex-direction: column; gap: var(--s-9); }
}

/* ---------- la note de synthèse ne déborde pas sur téléphone ----------
   La marque « Les stocks augmentent plus vite que les ventes » restait sur une ligne
   (white-space: nowrap) : la page du document prenait 339px et dépassait l'écran sous 375px.
   Sur iPhone, Safari laissait alors glisser toute la page vers la droite. */
@media (max-width: 440px) {
  /* les CSS des fragments UI se chargent après ce fichier : sélecteurs doublés pour l'emporter */
  .ui.ui-doc, .ui-doc > .ui-doc__page { min-width: 0; max-width: 100%; }
  .ui-doc .ui-doc__text .ui-doc__mark { white-space: normal; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
}

/* ---------- barre du haut sur les petits téléphones (moins de 360px) ----------
   À 320px, logo + « S’inscrire à la session » + bouton menu prenaient 288px pour 272px disponibles :
   le bouton menu touchait le bord. On resserre les marges du bouton, le logo et les écarts ;
   le texte du bouton et les zones tactiles de 44px ne changent pas. */
@media (max-width: 359px) {
  .nav .nav__bar { gap: 6px; }
  .nav .nav__logo .md-logo--mark { height: 22px; }
  .nav:not(.is-open) .nav__actions .btn { padding-inline: 8px; }
}
