/* ============================================================
   Éditions Rihlaa — feuille de style du site
   Ordre : polices → tokens → base (design system) → composants →
   pages (UI kit) → spécifique site (ci-dessous).
   Règle : ne jamais écrire de couleur/taille en dur, toujours un token.
   ============================================================ */

@import url("tokens/fonts-4OOtRzv.css");
@import url("tokens/colors-qT8Xjrx.css");
@import url("tokens/typography-J2fcq8T.css");
@import url("tokens/spacing-JUCi0tN.css");
@import url("tokens/base-_QTHIvQ.css");
@import url("components-dvGSCnv.css");
@import url("pages-VZNHQmM.css");

/* ---- Accessibilité --------------------------------------- */
.skip-link {
  position: absolute; left: -999px; top: 0; z-index: var(--z-toast);
  background: var(--rih-ink); color: var(--paper); padding: .6rem 1rem; border-radius: 0 0 var(--radius-md) 0;
}
.skip-link:focus { left: 0; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- Layout ---------------------------------------------- */
.site-main { min-height: 60vh; }
.section { padding-block: var(--section-y); }
.section--tight { padding-block: var(--space-16); }
.section--cream { background: var(--cream); border-block: 1px solid var(--border-hairline); }

/* ---- Header : navigation mobile -------------------------- */
.rih-header__burger { display: none; }
.rih-header__burger .icon--close,
.rih-header__burger[aria-expanded="true"] .icon--menu { display: none; }
.rih-header__burger[aria-expanded="true"] .icon--close { display: inline; }
/* Compte : icône en desktop, lien du menu en mobile (trois icônes ne tiennent pas à côté du logo). */
.rih-header__link--compte { display: none; }
@media (max-width: 860px) {
  .rih-header__burger { display: inline-flex; }
  .rih-header__icon--desktop { display: none; }
  .rih-header__nav .rih-header__link--compte { display: block; }
  .rih-header__nav { display: none; position: absolute; left: 0; right: 0; top: 100%;
    flex-direction: column; background: var(--paper); border-bottom: 1px solid var(--border);
    padding: var(--space-4) var(--gutter); gap: var(--space-2); box-shadow: var(--shadow-md); }
  .rih-header__nav.is-open { display: flex; }
  /* Sans z-index, le héro (position:relative, plus loin dans le DOM) recouvre le menu ouvert. */
  .rih-header { position: relative; z-index: var(--z-sticky); }
}

/* Marque recadrée (plus large que l'ancienne, perdue dans une page A4) : en-tête resserré
   sur petit écran pour que marque, nom et icônes tiennent sur 375 px. */
@media (max-width: 480px) {
  .rih-header__bar { gap: .75rem; }
  .rih-header__brand img { height: 30px; }
  .rih-header__wordmark b { font-size: .9rem; letter-spacing: .12em; }
  .rih-header__wordmark span { letter-spacing: .26em; }
}

/* ---- Héro : image de fond gérée par le back-office -------- */
.bq-hero__media { background-color: var(--clay-800); }
.bq-hero__title { white-space: pre-line; } /* le retour à la ligne saisi = saut de ligne */

/* ---- Ouvrage à l'honneur : image manquante ---------------- */
.cover-placeholder {
  aspect-ratio: 2 / 3; width: 100%; border-radius: var(--radius-lg); box-shadow: var(--shadow-xl);
  background: linear-gradient(160deg, var(--clay-500), var(--clay-800));
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  color: var(--cream); font-family: var(--font-title); font-weight: 600; padding: var(--space-6);
}
.cover-placeholder small { display: block; font-weight: 400; color: var(--sand-300); font-size: var(--fs-sm); margin-top: .5rem; }
/* Dans une carte du catalogue, le cadre impose déjà son ratio : le placeholder le
   remplit au lieu d'imposer le sien. Une carte sans couverture doit rester correcte. */
.rih-product__media .cover-placeholder { aspect-ratio: auto; height: 100%; border-radius: 0;
  box-shadow: none; flex-direction: column; font-size: var(--fs-sm); padding: var(--space-4); }
.rih-product__media .cover-placeholder small { font-size: var(--fs-xs); }
.bq-featured__cover img, .bq-pdp__media img { aspect-ratio: 2 / 3; object-fit: cover; }

/* ---- Bloc Institut (accueil) ------------------------------ */
.institut { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-16); align-items: center; }
.institut h2 { font-size: var(--fs-2xl); margin: .3rem 0 1rem; }
/* :not(.rih-eyebrow) : un eyebrow est un <p>, ces règles l'écrasaient (gris, grand). */
.institut p:not(.rih-eyebrow) { font-size: var(--fs-md); line-height: 1.75; color: var(--stone-700); }
.institut__media img { width: 100%; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); aspect-ratio: 4 / 3; object-fit: cover; }
@media (max-width: 860px) { .institut { grid-template-columns: 1fr; } }

/* ---- Fiche produit : quantité + commander ----------------- */
.buy-form { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; margin-bottom: 1.4rem; }
.buy-form .rih-qty { flex: none; }
.stock-note { font-family: var(--font-title); font-size: var(--fs-sm); color: var(--success-600); display: inline-flex; align-items: center; gap: .4rem; }
.stock-note--out { color: var(--error-600); }

/* ---- Prose (pages éditoriales : À propos, CGV…) ----------- */
.prose { max-width: 68ch; margin-inline: auto; }
.prose__head { text-align: center; margin-bottom: var(--space-12); }
.prose__head h1 { font-size: var(--fs-3xl); margin: .4rem 0 .8rem; }
.prose__intro { font-size: var(--fs-md); line-height: 1.75; color: var(--stone-600); }
.prose__body h2 { font-size: var(--fs-xl); margin: 2.2rem 0 .7rem; }
.prose__body h3 { font-size: var(--fs-lg); margin: 1.6rem 0 .5rem; }
.prose__body p:not(.rih-eyebrow), .prose__body li { font-size: var(--fs-md); line-height: 1.8; color: var(--stone-800); }
.prose__body ul, .prose__body ol { padding-left: 1.4rem; margin: 0 0 1.2rem; }
.prose__body blockquote { margin: 1.5rem 0; padding-left: 1.2rem; border-left: 3px solid var(--gold-400); color: var(--stone-600); font-style: italic; }
.prose__body a { text-decoration: underline; text-underline-offset: .2em; }
.prose__body img, .prose__body iframe, .prose__body script, .prose__body style { display: none !important; } /* ceinture + bretelles : le sanitizer les retire déjà */

/* ---- Formulaire de contact -------------------------------- */
.form-grid { display: grid; gap: var(--space-5); max-width: 620px; margin-inline: auto; }
/* Les cases à cocher gardent la mise en page de .form-check (case puis libellé, sur une ligne). */
.form-grid label:not(.form-check label) { display: block; font-family: var(--font-title); font-weight: 600; font-size: var(--fs-sm); margin-bottom: .35rem; color: var(--stone-800); }
.form-grid input:not([type=checkbox], [type=radio]), .form-grid textarea {
  width: 100%; font: inherit; font-size: var(--fs-base); padding: .7rem .9rem; border: 1.5px solid var(--stone-300);
  border-radius: var(--radius-md); background: var(--white); color: var(--text-primary); transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
.form-grid input:not([type=checkbox], [type=radio]):focus, .form-grid textarea:focus { outline: none; border-color: var(--clay-500); box-shadow: var(--shadow-focus); }
.form-grid textarea { min-height: 180px; resize: vertical; }
.form-grid .form-error { color: var(--error-600); font-size: var(--fs-sm); margin-top: .3rem; font-family: var(--font-title); }
/* Thème templates/form/theme.html.twig : aide, champ en erreur, erreurs du formulaire. */
.form-grid .form-error p { margin: 0; }
.form-grid .form-help { margin: .35rem 0 0; font-size: var(--fs-xs); line-height: 1.5; color: var(--stone-600); }
.form-grid input[aria-invalid="true"], .form-grid textarea[aria-invalid="true"] { border-color: var(--error-500); }
.form-alert { padding: .9rem 1.1rem; border: 1px solid var(--error-500); border-radius: var(--radius-md);
  background: var(--error-100); color: var(--error-600); font-family: var(--font-title); font-size: var(--fs-sm); }
.form-alert p { margin: 0; }
.form-grid .hp { position: absolute; left: -9999px; } /* pot de miel */
.form-rgpd { font-size: var(--fs-xs); color: var(--stone-500); }

/* ---- Messages flash --------------------------------------- */
/* Alignés sur le contenu (rih-container) et non plus centrés sur 840 px (UI-060). */
.flash-zone { display: grid; gap: var(--space-3); padding-top: var(--space-6); }
.flash { display: flex; align-items: flex-start; gap: var(--space-3); padding: .9rem 1.1rem; border-radius: var(--radius-md); font-family: var(--font-title); font-size: var(--fs-sm); border: 1px solid; }
.flash p { margin: 0; flex: 1; align-self: center; }
.flash__close { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 2rem; height: 2rem; margin: -.35rem -.5rem -.35rem 0;
  border: 0; border-radius: 50%; background: transparent; color: inherit; cursor: pointer; }
.flash__close[hidden] { display: none; }
/* Sous un message, la section ne rajoute pas toute sa marge haute. */
.flash-zone + .section { padding-top: var(--space-10); }
.flash__close:hover { background: color-mix(in srgb, currentColor 10%, transparent); }
.flash--success { background: var(--success-100); color: var(--success-600); border-color: var(--success-500); }
.flash--error { background: var(--error-100); color: var(--error-600); border-color: var(--error-500); }
.flash--info { background: var(--info-100); color: var(--clay-800); border-color: var(--clay-300); }

/* ---- Page merci ------------------------------------------- */
.thanks { max-width: 640px; margin-inline: auto; text-align: center; }
.thanks__mark { width: 84px; height: 84px; border-radius: 50%; background: var(--cream); color: var(--clay-500); display: flex; align-items: center; justify-content: center; margin: 0 auto 1.4rem; }
.thanks__mark svg { width: 2.2rem; height: 2.2rem; }
.thanks h1 { font-size: var(--fs-2xl); margin: 0 0 .6rem; }
.thanks__ref { font-family: var(--font-title); font-weight: 700; color: var(--clay-700); letter-spacing: .04em; }
.thanks__recap { text-align: left; background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--space-6); margin-top: var(--space-8); box-shadow: var(--shadow-sm); }
.thanks__recap div { display: flex; justify-content: space-between; padding: .45rem 0; border-bottom: 1px solid var(--border-hairline); }
.thanks__recap div:last-child { border-bottom: 0; font-family: var(--font-title); font-weight: 700; }
.thanks__actions { display: flex; flex-wrap: wrap; gap: var(--space-3); justify-content: center; margin-top: var(--space-8); }

/* ---- Pages d'erreur (templates/bundles/TwigBundle/Exception) */
.error-page { max-width: var(--container-sm); margin-inline: auto; text-align: center; }
.error-page__mark { width: 84px; height: 84px; border-radius: 50%; background: var(--cream); color: var(--clay-500); display: flex; align-items: center; justify-content: center; margin: 0 auto var(--space-6); }
.error-page__mark svg { width: 2.2rem; height: 2.2rem; }
.error-page h1 { font-size: var(--fs-2xl); margin: .4rem 0 .8rem; }
.error-page p:not(.rih-eyebrow) { color: var(--stone-700); line-height: 1.7; }
.error-page p a { text-decoration: underline; text-underline-offset: .2em; }
.error-page__actions { display: flex; flex-wrap: wrap; gap: var(--space-3); justify-content: center; margin-top: var(--space-8); }

/* ---- Bandeau « site non indexé » (local/staging) ---------- */
.env-banner { background: var(--gold-100); color: var(--clay-900); text-align: center; font-family: var(--font-title); font-size: var(--fs-xs); padding: .35rem; letter-spacing: .06em; text-transform: uppercase; }

/* ---- Accessibilité : contrastes AA (audit UI-058) ---------
   Les composants extraits du DS mettent du petit texte en gold-600 ou stone-500
   (environ 3,6:1 sur papier) et en stone-400 (2,4:1). WCAG AA demande 4,5:1 : on monte
   d'un cran ici, sans toucher aux fichiers extraits. À reporter dans le design system. */
.rih-eyebrow, .rih-header__wordmark span, .rih-product__eyebrow, .rih-line__cat,
.bq-why__meta dt, .bq-pdp__aside h3, .account-table th { color: var(--gold-700); }
.bq-value__name em, .bq-breadcrumb, .bq-pdp__author, .bq-pdp__tax, .bq-pdp__meta dt,
.bq-summary__note, .rih-line__author, .rih-line__remove, .rih-line__unit,
.rih-product__author, .rih-product__price del, .bq-pdp__price del, .bq-cart__head h1 span,
.rih-field__hint, .form-rgpd { color: var(--stone-600); }
.rih-footer__copy { color: var(--stone-400); }
.rih-badge--gold { color: var(--clay-800); }

/* Un lien dans un paragraphe se voit sans dépendre de la couleur (audit UI-054) :
   l'argile du lien et le gris du texte ne se distinguent pas assez (WCAG 1.4.1). */
main p a:not([class]) { text-decoration: underline; text-underline-offset: .2em; }

/* ---- Espace client (UI-045, UI-049, UI-050) -------------- */
.account-head { margin-bottom: var(--space-6); }
.account-head h1 { font-size: var(--fs-3xl); margin: .4rem 0 .6rem; }
.account-head__intro { max-width: 62ch; margin: 0; color: var(--stone-600); font-size: var(--fs-md); line-height: 1.7; }
.account-head__meta { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .8rem; margin: 0; color: var(--stone-600); }
.account-body { margin-top: var(--space-8); }
.account-section + .account-section { margin-top: var(--space-12); }
.account-section h2 { font-size: var(--fs-xl); margin: 0 0 var(--space-4); }
.account-narrow { max-width: 38rem; }
.account-more { margin-top: var(--space-4); }
.account-more a { display: inline-flex; align-items: center; gap: .4rem; }
.account-address { font-style: normal; line-height: 1.6; color: var(--stone-700); margin: 0 0 var(--space-4); }
.account-info { display: grid; grid-template-columns: max-content 1fr; gap: .6rem 1.6rem; margin: 0; }
.account-info dt { color: var(--stone-600); }
.account-info dd { margin: 0; font-family: var(--font-title); font-weight: var(--fw-semibold); overflow-wrap: anywhere; }
.account-card__actions { display: flex; flex-wrap: wrap; align-items: flex-start; gap: var(--space-2); }
.account-nav a { display: inline-block; padding-block: .6rem; }
.order-recap { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--space-4) var(--space-6); box-shadow: var(--shadow-sm); }
.order-recap div { display: flex; justify-content: space-between; gap: 1rem; padding: .5rem 0; border-bottom: 1px solid var(--border-hairline); }
.order-recap div:last-child { border-bottom: 0; font-family: var(--font-title); font-weight: var(--fw-bold); }
.form-grid--start { margin-inline: 0; }
.form-actions { display: flex; flex-wrap: wrap; gap: var(--space-3); }

/* Actions destructives : rouge du design system, jamais un bouton fantôme argile. */
.rih-btn--danger { --_bg: var(--error-600); --_fg: var(--white); --_bd: transparent; --_bgh: var(--error-500); --_bga: var(--error-600); }
.rih-btn--danger-ghost { --_bg: transparent; --_fg: var(--error-600); --_bd: var(--error-500); --_bgh: var(--error-100); --_bga: var(--error-100); }
.confirm-delete > summary { list-style: none; cursor: pointer; }
.confirm-delete > summary::-webkit-details-marker { display: none; }
.confirm-delete__panel { margin-top: var(--space-3); padding: var(--space-4); border: 1px solid var(--error-500); border-radius: var(--radius-md); background: var(--error-100); }
.confirm-delete__question { margin: 0 0 .4rem; font-family: var(--font-title); font-weight: var(--fw-semibold); color: var(--error-600); }
.confirm-delete__note { margin: 0 0 .8rem; font-size: var(--fs-sm); color: var(--stone-700); }
.account-section--danger h2 { color: var(--error-600); }

/* ---- Connexion, inscription, mot de passe : colonne étroite centrée ---- */
.auth { max-width: 28rem; }
.auth--wide { max-width: 32rem; }
.auth__links { margin: var(--space-6) 0 0; text-align: center; color: var(--stone-600); }
.auth__links--tight { margin-top: var(--space-2); }
.contact-direct { margin: var(--space-10) 0 0; text-align: center; color: var(--stone-600); }

/* Cibles d'au moins 24 px (WCAG 2.5.8), sans changer le dessin : fil d'Ariane,
   « Tout voir », titres des cartes, cases à cocher. */
.bq-breadcrumb a, .bq-seeall { display: inline-flex; align-items: center; min-height: 2.75rem; }
/* Liens de 44 px dans une ligne de 22 : on compense de 11 px en haut et en bas. */
.bq-breadcrumb { margin-top: -.6875rem; margin-bottom: calc(var(--space-10) - .6875rem); }
.rih-product__title a, .rih-line__title a { display: inline-block; padding-block: .2rem; }
.form-check input { width: 1.5rem; height: 1.5rem; }

/* ---- Recherche du catalogue (UI-009) --------------------- */
.catalogue-search { display: flex; gap: var(--space-3); flex-wrap: wrap; align-items: center; margin: 0 0 var(--space-6); max-width: 36rem; }
.catalogue-search__field { flex: 1 1 16rem; display: flex; align-items: center; gap: .5rem; padding: 0 .9rem;
  border: 1.5px solid var(--stone-300); border-radius: var(--radius-pill); background: var(--white); color: var(--stone-600); }
.catalogue-search__field:focus-within { border-color: var(--clay-500); box-shadow: var(--shadow-focus); }
.catalogue-search__field input { flex: 1; min-width: 0; border: 0; background: transparent; font: inherit; font-size: var(--fs-base);
  padding: .7rem 0; color: var(--text-primary); outline: none; }
.catalogue-search__count { margin: 0 0 var(--space-6); color: var(--stone-600); font-size: var(--fs-sm); }
/* L'état vide du catalogue reprend celui du panier, dont le titre est un h1 ici h2. */
.bq-cart__empty h2 { font-size: var(--fs-2xl); margin: 0 0 .6rem; }

/* Champ du sélecteur de quantité de la fiche (le style était en ligne) : sans flèches natives. */
input.rih-qty__val { width: 3ch; border: 0; background: transparent; text-align: center; font: inherit; -moz-appearance: textfield; appearance: textfield; }
input.rih-qty__val::-webkit-inner-spin-button, input.rih-qty__val::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

/* Pied de page : titres de colonnes en h2 (des h4 sans parent, UI-062), même rendu. */
.rih-footer__col h2{ font-family:var(--font-title); font-weight:var(--fw-semibold); font-size:var(--fs-2xs);
  letter-spacing:.14em; text-transform:uppercase; color:var(--gold-400); margin:0 0 1.1rem; }

/* ---- Finitions (audit, lot 4) ---------------------------- */
/* UI-028 : le titre de la présentation retrouve sa taille, écrasée par .prose__body h2. */
.bq-pdp__desc .prose__body h2 { font-size: var(--fs-2xl); margin: .3rem 0 1.2rem; }
/* UI-020 : « Tout voir » ne se coupe plus en deux à côté du titre. */
.bq-seeall { white-space: nowrap; flex: none; }
/* UI-053 : un mot long (« remboursements ») ne fait plus déborder la page en mobile. */
.prose__head h1 { overflow-wrap: break-word; hyphens: auto; }
@media (max-width: 480px) { .prose__head h1 { font-size: var(--fs-2xl); } }
/* UI-075 : le texte et le lien « Écrivez-nous » reprennent des espaces normaux. */
.stock-note--out { display: block; }
/* UI-056 : la devise s'aligne sur la colonne ; une seule colonne sur petit écran. */
.rih-footer__arabic { text-align: left; }
@media (max-width: 480px) { .rih-footer__inner { grid-template-columns: 1fr; } }

/* UI-059 : focus visible. Contour plein, décalé, plutôt qu'une ombre or à 35 %
   qui disparaissait sur les boutons terre. Clair sur les fonds sombres. */
a:focus-visible, button:focus-visible, .rih-btn:focus-visible, .rih-header__icon:focus-visible,
.rih-qty__btn:focus-visible, summary:focus-visible { outline: 3px solid var(--clay-800); outline-offset: 3px; box-shadow: none; }
.bq-hero :focus-visible, .bq-final :focus-visible, .bq-quote :focus-visible,
.rih-footer :focus-visible { outline-color: var(--gold-300); }

/* UI-061 : cibles tactiles d'au moins 44 px. Les petits boutons gardent leur
   apparence : seule leur zone cliquable s'étend, par un pseudo-élément invisible. */
.rih-header__icon { width: 2.75rem; height: 2.75rem; }
.rih-qty { height: 2.75rem; }
.rih-qty__btn { width: 2.75rem; }
.rih-btn--sm { position: relative; }
.rih-btn--sm::before { content: ""; position: absolute; inset: -6px -4px; }
.rih-line__remove { min-height: 2.75rem; }
@media (max-width: 860px) {
  .rih-footer__col li a { display: inline-block; padding-block: .6rem; }
}

/* ---- Icônes inline (SVG Lucide) --------------------------- */
.icon { width: 1.15em; height: 1.15em; flex: none; vertical-align: -.15em; }

/* Accueil, livre épuisé : la mention passe sous le prix et le bouton, sur sa propre ligne,
   au lieu de s'intercaler entre eux. */
.bq-featured__stock { flex-basis: 100%; order: 3; }
