/* ===========================================================================
   Wald Maâlam — couche d'INTERFACE (au-dessus du moteur 3D)
   ---------------------------------------------------------------------------
   Ce fichier ne touche à rien de ce que pose style.css (moteur) : il ne fait
   qu'habiller les ancrages laissés vides — #filters, #work-modal,
   #reservation-form, #fallback-grid — et ajoute deux conteneurs propres à
   l'interface (#room-cartel, #end-panel). #hero reste dans le document mais
   HIDDEN EN PERMANENCE : l'ancien panneau du hall qui l'occupait a été retiré
   à la demande du peintre (voir ui.js §5). L'indice de navigation flottant
   (#nav-hint) est créé par le MOTEUR (main.js), pas par cette feuille.

   Palette : catalog.md §7 (variables déjà déclarées dans style.css).
   Typographies : catalog.md §8.

   RTL : toute la mise en page d'interface est écrite en propriétés LOGIQUES
   (inset-inline-*, margin-inline-*, padding-inline-*, text-align: start …)
   pour que le passage `dir="rtl"` (arabe) mirroir l'ensemble sans règle
   dédiée. Seule la scène 3D reste, volontairement, non inversée.
   ========================================================================= */

:root {
  --chrome-bg: rgba(28, 25, 21, 0.82);
  --chrome-bg-solid: #1c1915;
  --chrome-line: rgba(216, 199, 154, 0.22);
  --chrome-line-soft: rgba(216, 199, 154, 0.12);
  --overlay-veil: rgba(12, 10, 8, 0.72);
  --ui-radius: 2px;
}

/* `[hidden]` n'est qu'une règle de feuille utilisateur-agent : n'importe quelle
   règle d'auteur portant `display` la neutralise (c'était le cas de `.wm-group`
   et de `#scene { display: block }`). On lui rend son autorité une fois pour
   toutes — tout le code d'interface pilote la visibilité par `el.hidden`. */
[hidden] {
  display: none !important;
}

/* Verrou de défilement : pendant l'écran d'accueil, et pendant qu'un panneau
   modal est ouvert. On ne verrouille jamais pendant que `goToRoom()` peut
   être appelé — `window.scrollTo()` serait sans effet. */
html.wm-lock,
html.wm-lock body {
  overflow: hidden !important;
}

/* Le moteur pose `#ui-layer { z-index: 10 }`, ce qui crée un contexte
   d'empilement : sans cette reprise, la barre de navigation, la modale et le
   panier (tous enfants de #ui-layer) passeraient SOUS #fallback-grid, qui est
   un frère à z-index 30. On remonte donc la couche entière au-dessus de la
   grille, mais sous l'écran de chargement (z-index 100). */
#ui-layer {
  z-index: 50;
}

.wm-defs {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

/* --- Boutons et contrôles génériques ------------------------------------ */

.wm-btn {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--paper);
  background: transparent;
  border: 1px solid var(--chrome-line);
  border-radius: var(--ui-radius);
  padding: 0.5rem 0.85rem;
  cursor: pointer;
  transition: background 0.2s var(--ease-out), border-color 0.2s var(--ease-out),
    color 0.2s var(--ease-out);
  white-space: nowrap;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  line-height: 1.2;
}

.wm-btn:hover {
  border-color: var(--sand);
  background: rgba(216, 199, 154, 0.1);
}

.wm-btn[aria-pressed='true'],
.wm-btn.is-active {
  background: var(--sand);
  border-color: var(--sand);
  color: var(--ink);
}

.wm-btn:disabled,
.wm-btn[aria-disabled='true'] {
  opacity: 0.42;
  cursor: not-allowed;
}

.wm-btn--primary {
  background: var(--rust);
  border-color: var(--rust);
  color: #f6efe2;
}

.wm-btn--primary:hover {
  background: #ae4b39;
  border-color: #ae4b39;
}

.wm-btn--wa {
  background: var(--whatsapp);
  border-color: var(--whatsapp);
  color: var(--whatsapp-fg);
}

.wm-btn--wa:hover {
  background: var(--whatsapp-hover);
  border-color: var(--whatsapp-hover);
  color: var(--whatsapp-fg);
}

:where(button, a, select, input, textarea):focus-visible {
  outline: 2px solid var(--rust);
  outline-offset: 2px;
}

/* --- 1. Écran de chargement : libellé i18n ------------------------------ */

#loading-label {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--stone);
  margin: 0;
  text-align: center;
}

/* --- 2. Barre de filtres / navigation ----------------------------------- */

/* z-index 62 : la barre passe AU-DESSUS du panneau du hall (60), qui reste
   affiché pendant toute la traversée du hall — sans quoi la navigation
   disparaîtrait derrière son voile. Elle reste sous le panneau éditorial (65),
   le panier (70) et la modale (80), qui sont des surcouches modales. */
#filters {
  position: fixed;
  inset-block-start: 0;
  inset-inline: 0;
  z-index: 62;
  display: flex;
  align-items: center;
  gap: 0.6rem 0.75rem;
  flex-wrap: wrap;
  padding: 0.6rem clamp(0.7rem, 2.4vw, 1.6rem);
  background: var(--chrome-bg);
  border-block-end: 1px solid var(--chrome-line-soft);
  backdrop-filter: blur(14px) saturate(1.1);
  -webkit-backdrop-filter: blur(14px) saturate(1.1);
  transition: opacity 0.5s var(--ease-out), transform 0.5s var(--ease-out);
}

#filters[hidden] {
  display: none;
}

/* Tant que le visiteur n'est pas entré, la barre s'efface derrière le hero. */
#app-root.wm-intro #filters {
  opacity: 0;
  transform: translateY(-100%);
  pointer-events: none;
}

.wm-brand {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
  margin-inline-end: auto;
  min-width: 0;
}

.wm-brand strong {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 0.98rem;
  color: var(--paper);
  white-space: nowrap;
}

.wm-brand span {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--sand);
  opacity: 0.72;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wm-group {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.wm-select {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  color: var(--paper);
  background: rgba(18, 16, 13, 0.9);
  border: 1px solid var(--chrome-line);
  border-radius: var(--ui-radius);
  padding: 0.5rem 0.7rem;
  max-width: 15rem;
}

.wm-select option {
  background: var(--chrome-bg-solid);
  color: var(--paper);
}

.wm-seg {
  display: inline-flex;
  border: 1px solid var(--chrome-line);
  border-radius: var(--ui-radius);
  overflow: hidden;
}

.wm-seg .wm-btn {
  border: 0;
  border-inline-end: 1px solid var(--chrome-line-soft);
  padding: 0.5rem 0.6rem;
  font-size: 0.64rem;
  letter-spacing: 0.1em;
}

.wm-seg .wm-btn:last-child {
  border-inline-end: 0;
}

.wm-label {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--stone);
}

#wm-cart-toggle .wm-badge-count {
  font-variant-numeric: tabular-nums;
}

/* --- 3. Panneau du hall d'accueil — SUPPRIMÉ ----------------------------
   Il occupait l'ancrage #hero : plein écran opaque à lire, puis état
   translucide superposé au hall (voir ui.js §5 pour l'historique complet).
   Retiré à la demande du peintre — aucun texte ne doit plus apparaître
   devant la scène 3D. #hero reste dans le document mais hidden en
   permanence ; toutes les règles qui l'habillaient (.hero-*, .hall-*) ont
   été retirées avec lui. Le contenu éditorial ne vit plus que dans
   #end-panel, dont les règles suivent plus bas (§10). */

/* --- 4. Indicateur de parcours : passage en propriétés logiques ---------- */

#progress-indicator {
  right: auto;
  inset-inline-end: clamp(0.85rem, 2.4vw, 1.9rem);
}

/* Une fois la visite commencée, l'indicateur passe lui aussi au-dessus du
   panneau du hall : le nom de l'espace courant doit rester lisible pendant la
   traversée du hall. Pendant l'écran d'introduction, il reste dessous. */
#app-root:not(.wm-intro) #progress-indicator {
  z-index: 61;
}

/* Le moteur écrit le titre FRANÇAIS de l'espace courant dans `.pi-series` et
   garde une référence sur ce nœud : on ne le remplace pas (cela casserait son
   contrat), on le masque — ainsi que son « / 6 » — et on affiche à la place la
   même information traduite, plus la position « N / 6 » que l'interface
   escamote pendant la phase hall. */
#progress-indicator .pi-series,
#progress-indicator .pi-count {
  display: none;
}

/* Les salles claires (Rabat, Orsay) noient un texte sable sur simple ombre
   portée : on pose l'étiquette sur une plaque sombre translucide, lisible dans
   les six ambiances. */
#progress-indicator .pi-label {
  padding: 0.4rem 0.6rem;
  background: rgba(20, 17, 14, 0.55);
  border: 1px solid var(--chrome-line-soft);
  border-radius: var(--ui-radius);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.pi-room-i18n {
  color: var(--sand);
  max-inline-size: 8.5rem;
  text-align: center;
  line-height: 1.35;
  text-wrap: balance;
}

.pi-position {
  color: var(--stone);
  opacity: 0.75;
  font-variant-numeric: tabular-nums;
}

/* --- 4 bis. Cartel de salle --------------------------------------------- */

/* Museal, discret, non bloquant : il s'annonce à chaque franchissement de
   porte puis s'efface tout seul. Il ne capte jamais le pointeur — la visite
   continue pendant qu'on le lit. */
#room-cartel {
  position: fixed;
  inset-block-end: clamp(1rem, 4vh, 2.4rem);
  inset-inline-start: clamp(0.9rem, 3vw, 2.2rem);
  z-index: 45;
  inline-size: min(27rem, calc(100% - 2rem));
  padding: 0.95rem 1.15rem 1.05rem;
  background: var(--chrome-bg);
  border: 1px solid var(--chrome-line-soft);
  border-inline-start: 2px solid var(--sand);
  border-radius: var(--ui-radius);
  backdrop-filter: blur(12px) saturate(1.05);
  -webkit-backdrop-filter: blur(12px) saturate(1.05);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-out);
  pointer-events: none;
  text-align: start;
}

#room-cartel.is-visible {
  opacity: 1;
  transform: none;
}

#app-root.is-fallback #room-cartel {
  display: none;
}

.rc-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.56rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--sand);
  opacity: 0.8;
  margin: 0 0 0.35rem;
  font-variant-numeric: tabular-nums;
}

.rc-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(1.05rem, 2.4vw, 1.35rem);
  line-height: 1.15;
  color: var(--paper);
  margin: 0 0 0.5rem;
}

.rc-text {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.6;
  color: rgba(232, 225, 210, 0.82);
}

/* --- 5. Modale de détail d'œuvre ---------------------------------------- */

#work-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(0.6rem, 3vw, 2rem);
  background: var(--overlay-veil);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

#work-modal[hidden] {
  display: none;
}

.wm-modal-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: clamp(1rem, 3vw, 2.2rem);
  inline-size: min(1040px, 100%);
  max-block-size: min(92vh, 780px);
  overflow: hidden;
  background: linear-gradient(180deg, #201c17 0%, #191510 100%);
  border: 1px solid var(--chrome-line);
  border-radius: 3px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.65);
  padding: clamp(1rem, 2.6vw, 1.9rem);
}

.wm-modal-figure {
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #14110d;
  border: 1px solid var(--chrome-line-soft);
  overflow: hidden;
  min-block-size: 0;
}

.wm-modal-figure img {
  inline-size: 100%;
  block-size: 100%;
  object-fit: contain;
  max-block-size: 100%;
}

.wm-modal-body {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  overflow-y: auto;
  min-block-size: 0;
  text-align: start;
  padding-inline-end: 0.3rem;
}

.wm-modal-code {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.22em;
  color: var(--stone);
}

.wm-modal-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(1.3rem, 3vw, 1.9rem);
  line-height: 1.15;
  color: var(--paper);
  /* Le titre d'œuvre reste en français quelle que soit la langue. On l'ISOLE
     (sans forcer `direction`) : le texte latin se lit de gauche à droite, mais
     le bloc reste aligné sur le bord de la langue active — donc à droite en
     arabe, comme le reste de la fiche. */
  unicode-bidi: isolate;
}

.wm-fields {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 0.4rem 0.9rem;
  margin: 0;
  font-size: 0.86rem;
}

.wm-fields dt {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--stone);
  padding-block-start: 0.22rem;
}

.wm-fields dd {
  margin: 0;
  color: rgba(232, 225, 210, 0.92);
}

.wm-fields dd.wm-ltr {
  unicode-bidi: isolate;
}

.wm-price {
  font-family: var(--font-mono);
  font-size: 1rem;
  color: var(--rust);
  font-weight: 500;
  filter: brightness(1.45);
  font-variant-numeric: tabular-nums;
}

.wm-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  padding: 0.2rem 0.55rem;
  border-radius: 2px;
}

.wm-badge--available {
  background: transparent;
  color: var(--sand);
  border: 1px solid var(--chrome-line);
}

.wm-badge--reserved {
  background: var(--reserved-bg);
  color: var(--reserved-fg);
}

.wm-badge--sold {
  background: var(--sold-bg);
  color: var(--sold-fg);
}

.wm-keywords {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.wm-keywords li {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.08em;
  color: var(--sand);
  border: 1px solid var(--chrome-line-soft);
  padding: 0.15rem 0.45rem;
  unicode-bidi: isolate;
}

.wm-modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-block-start: auto;
  padding-block-start: 0.6rem;
}

.wm-close {
  position: absolute;
  inset-block-start: 0.5rem;
  inset-inline-end: 0.5rem;
  z-index: 2;
  inline-size: 2.1rem;
  block-size: 2.1rem;
  padding: 0;
  justify-content: center;
  font-size: 1rem;
  line-height: 1;
  background: rgba(20, 17, 13, 0.85);
}

/* --- 6. Panier + formulaire de réservation ------------------------------ */

#reservation-form {
  position: fixed;
  inset-block: 0;
  inset-inline-end: 0;
  z-index: 70;
  inline-size: min(420px, 100%);
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #221d18 0%, #17130f 100%);
  border-inline-start: 1px solid var(--chrome-line);
  box-shadow: -18px 0 60px rgba(0, 0, 0, 0.55);
  overflow-y: auto;
  padding: clamp(1rem, 3vw, 1.6rem);
  gap: 1rem;
  text-align: start;
}

#reservation-form[hidden] {
  display: none;
}

.wm-drawer-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--paper);
  margin: 0;
  padding-inline-end: 2.4rem;
}

.wm-cart-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.wm-cart-item {
  display: grid;
  grid-template-columns: 3.2rem minmax(0, 1fr) auto;
  gap: 0.6rem;
  align-items: center;
  border: 1px solid var(--chrome-line-soft);
  padding: 0.45rem;
}

.wm-cart-item img {
  inline-size: 3.2rem;
  block-size: 2.4rem;
  object-fit: cover;
}

.wm-cart-meta {
  min-inline-size: 0;
}

.wm-cart-meta b {
  display: block;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 0.85rem;
  color: var(--paper);
  unicode-bidi: isolate;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wm-cart-meta small {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.12em;
  color: var(--stone);
}

.wm-cart-empty {
  font-size: 0.85rem;
  color: var(--stone);
  margin: 0;
  padding: 1rem 0;
  border-block: 1px solid var(--chrome-line-soft);
}

.wm-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-block-end: 0.6rem;
}

.wm-field label {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--stone);
}

.wm-field input,
.wm-field textarea {
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--paper);
  background: rgba(12, 10, 8, 0.7);
  border: 1px solid var(--chrome-line-soft);
  border-radius: var(--ui-radius);
  padding: 0.55rem 0.65rem;
  inline-size: 100%;
  text-align: start;
}

.wm-field textarea {
  min-block-size: 4.5rem;
  resize: vertical;
}

.wm-field input:focus,
.wm-field textarea:focus {
  border-color: var(--sand);
  outline: none;
}

.wm-form-error {
  color: #f0a196;
  font-size: 0.78rem;
  margin: 0 0 0.5rem;
}

.wm-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.wm-confirm {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.7rem;
  padding: 1.4rem 0.6rem;
}

.wm-confirm-icon {
  font-size: 2rem;
  color: var(--sand);
  line-height: 1;
}

.wm-confirm h3 {
  font-family: var(--font-display);
  font-size: 1.3rem;
  color: var(--paper);
  margin: 0;
}

.wm-confirm p {
  color: rgba(232, 225, 210, 0.85);
  font-size: 0.9rem;
  margin: 0;
  max-width: 34ch;
}

/* --- 7. Panneau éditorial à la demande ----------------------------------- */

/* Mêmes sections que le hall (L'artiste, Avant-propos, pied de page), ouvertes
   depuis la barre de navigation à n'importe quel moment de la visite. Il ne se
   déclenche plus tout seul en fin de parcours : le contenu d'accueil vit
   maintenant dans le hall. */

#end-panel {
  position: fixed;
  inset: 0;
  z-index: 65;
  overflow-y: auto;
  background: var(--paper);
  color: var(--ink);
  padding: calc(var(--wm-bar-h, 4.6rem) + clamp(1rem, 3vw, 2rem)) clamp(1rem, 5vw, 3rem)
    clamp(2rem, 6vw, 4rem);
  text-align: start;
}

#end-panel[hidden] {
  display: none;
}

.wm-sheet {
  max-inline-size: 62rem;
  margin-inline: auto;
  display: flex;
  flex-direction: column;
  gap: clamp(2rem, 5vw, 3.4rem);
}

.wm-section-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(1.5rem, 4vw, 2.3rem);
  color: var(--ink);
  margin: 0 0 0.6rem;
}

.wm-artist {
  display: grid;
  grid-template-columns: minmax(0, 18rem) minmax(0, 1fr);
  gap: clamp(1.2rem, 4vw, 2.6rem);
  align-items: start;
}

.wm-portrait {
  margin: 0;
  border: 1px solid rgba(33, 31, 26, 0.18);
  background: #ddd5c4;
}

.wm-portrait img {
  inline-size: 100%;
  /* Effet noir et blanc du site d'origine (catalog.md §3), reproduit tel quel. */
  filter: grayscale(1) contrast(1.03);
}

.wm-tagline {
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(1rem, 2.2vw, 1.2rem);
  color: var(--walnut);
  margin: 0 0 0.9rem;
}

.wm-studio {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  color: rgba(33, 31, 26, 0.7);
  margin: 0 0 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.wm-studio a {
  color: var(--rust);
}

.wm-prose p {
  margin: 0 0 0.9rem;
  line-height: 1.72;
  font-size: 0.97rem;
  color: rgba(33, 31, 26, 0.9);
}

.wm-books {
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.wm-books li {
  font-family: var(--font-display);
  font-style: italic;
  color: var(--walnut);
  unicode-bidi: isolate;
}

.wm-books li::before {
  content: '— ';
  font-style: normal;
  color: var(--stone);
}

.wm-signature {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.15rem;
  color: var(--walnut);
  margin: 1.2rem 0 0.2rem;
}

.wm-book-note {
  font-size: 0.9rem;
  color: rgba(33, 31, 26, 0.75);
  margin: 1rem 0 0.8rem;
}

.wm-book-cta {
  border-color: var(--rust);
  color: var(--rust);
  font-size: 0.68rem;
}

.wm-book-cta:hover {
  background: var(--rust);
  color: var(--paper);
  border-color: var(--rust);
}

.wm-footer {
  border-block-start: 1px solid rgba(33, 31, 26, 0.16);
  padding-block-start: 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  font-size: 0.8rem;
  line-height: 1.6;
  color: rgba(33, 31, 26, 0.72);
}

.wm-footer .wm-footer-contact {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  color: var(--walnut);
}

.wm-footer .wm-footer-legal {
  font-size: 0.72rem;
  color: rgba(33, 31, 26, 0.58);
}

/* Bouton de fermeture du panneau final, sur fond clair. */
#end-panel .wm-close {
  position: fixed;
  inset-block-start: calc(var(--wm-bar-h, 4.6rem) + 0.6rem);
  inset-inline-end: clamp(0.8rem, 3vw, 2rem);
  background: rgba(33, 31, 26, 0.9);
  border-color: rgba(33, 31, 26, 0.4);
  color: var(--paper);
}

/* --- 8. Vue de secours 2D : grille des 208 œuvres ----------------------- */

#fallback-grid {
  padding-block-start: calc(var(--wm-bar-h, 4.6rem) + clamp(0.9rem, 2.4vw, 1.8rem));
  /* Motif zellige léger : entrelacs à 45° évoquant l'étoile à huit branches. */
  background-color: var(--paper);
  background-image: repeating-linear-gradient(
      45deg,
      transparent 0 21px,
      rgba(155, 64, 48, 0.055) 21px 23px
    ),
    repeating-linear-gradient(-45deg, transparent 0 21px, rgba(107, 107, 69, 0.055) 21px 23px),
    repeating-linear-gradient(0deg, transparent 0 21px, rgba(107, 66, 38, 0.035) 21px 22px),
    repeating-linear-gradient(90deg, transparent 0 21px, rgba(107, 66, 38, 0.035) 21px 22px);
  background-attachment: fixed;
}

.fg-inner {
  max-inline-size: 78rem;
  margin-inline: auto;
}

.fg-notice {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  color: var(--walnut);
  background: rgba(216, 199, 154, 0.32);
  border: 1px solid rgba(107, 66, 38, 0.25);
  padding: 0.55rem 0.8rem;
  margin: 0 0 1.2rem;
}

.fg-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.8rem;
  margin-block-end: 1.4rem;
}

.fg-toolbar .wm-label {
  color: rgba(33, 31, 26, 0.6);
}

.fg-toolbar .wm-btn {
  color: var(--ink);
  border-color: rgba(33, 31, 26, 0.28);
}

.fg-toolbar .wm-btn:hover {
  background: rgba(33, 31, 26, 0.08);
  border-color: var(--walnut);
}

.fg-toolbar .wm-btn[aria-pressed='true'] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

.fg-toolbar .wm-seg {
  border-color: rgba(33, 31, 26, 0.28);
}

.fg-toolbar .wm-seg .wm-btn {
  border-inline-end-color: rgba(33, 31, 26, 0.18);
}

.fg-count {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.14em;
  color: rgba(33, 31, 26, 0.6);
  margin-inline-start: auto;
  font-variant-numeric: tabular-nums;
}

.fg-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: clamp(0.9rem, 2.4vw, 1.6rem);
}

.fg-card {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  inline-size: 100%;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  text-align: start;
  color: inherit;
  font: inherit;
}

.fg-card[hidden] {
  display: none;
}

.fg-frame {
  position: relative;
  aspect-ratio: 4 / 3;
  background: #ded6c5;
  border: 1px solid rgba(33, 31, 26, 0.2);
  /* Angle d'arc marocain suggéré (clip-path SVG en unités relatives). */
  clip-path: url(#wm-arch);
  overflow: hidden;
  transition: transform 0.35s var(--ease-out), box-shadow 0.35s var(--ease-out);
}

.fg-card:hover .fg-frame,
.fg-card:focus-visible .fg-frame {
  transform: translateY(-3px);
  box-shadow: 0 12px 26px rgba(33, 31, 26, 0.22);
}

.fg-frame img {
  inline-size: 100%;
  block-size: 100%;
  object-fit: cover;
}

.fg-frame .wm-badge {
  position: absolute;
  inset-block-end: 0.4rem;
  inset-inline-start: 0.4rem;
}

.fg-frame .wm-badge--available {
  display: none;
}

.fg-meta {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-inline-size: 0;
}

.fg-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 0.92rem;
  color: var(--ink);
  line-height: 1.25;
  unicode-bidi: isolate;
}

.fg-sub {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  color: rgba(33, 31, 26, 0.6);
}

.fg-card.is-in-cart .fg-frame {
  box-shadow: 0 0 0 2px var(--rust);
}

.fg-price {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--rust);
  font-variant-numeric: tabular-nums;
}

.fg-sections {
  margin-block-start: clamp(2.4rem, 7vw, 4rem);
}

/* Dans la vue classique, les sections « L'artiste » / « Avant-propos » et le
   pied de page sont rendus en flux, pas en surcouche. */
.fg-sections .wm-sheet {
  gap: clamp(1.6rem, 4vw, 2.6rem);
}

/* --- 9. Responsive ------------------------------------------------------ */

@media (max-width: 900px) {
  .wm-modal-card {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) auto;
    max-block-size: 94vh;
  }

  .wm-modal-figure {
    max-block-size: 38vh;
  }

  .wm-artist {
    grid-template-columns: minmax(0, 1fr);
  }

  .wm-portrait {
    max-inline-size: 16rem;
  }
}

@media (max-width: 720px) {
  #filters {
    gap: 0.4rem 0.5rem;
    padding: 0.5rem 0.7rem;
  }

  .wm-brand strong {
    font-size: 0.85rem;
  }

  .wm-brand span {
    display: none;
  }

  .wm-select {
    max-width: 9.5rem;
    font-size: 0.64rem;
    padding: 0.45rem 0.5rem;
  }

  .wm-btn {
    padding: 0.45rem 0.6rem;
    font-size: 0.62rem;
    letter-spacing: 0.1em;
  }

  #filters .wm-label {
    display: none;
  }

  .fg-list {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }

  #reservation-form {
    inline-size: 100%;
  }

  .wm-fields {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.1rem 0;
  }

  .wm-fields dt {
    padding-block-start: 0.5rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero-arrow {
    animation: none;
  }

  #hero,
  #filters,
  .fg-frame {
    transition-duration: 0.01ms;
  }
}
