/* base.css — fondations du thème Atelier : page, typographie, boutons, champs, badges, prix, modales.
   Tout est piloté par les variables --at-* (tokens.css) et la palette de la zone (schemes.css).
   Point de rupture unique : 750 px. Les sélecteurs sont volontairement en listes (pas de :is) pour garder
   la spécificité de chacun : un titre reçoit toujours le style de sa classe .hN plutôt que celui de sa balise. */

/* ==================== Page ==================== */

/* Largeur de la barre de défilement toujours réservée : ouvrir le panier, les filtres ou une modale
   (body en overflow:hidden) ne fait pas sauter la mise en page. */
html { scrollbar-gutter: stable; }

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  overflow-x: hidden;
  font-family: var(--at-font-body);
  color: var(--at-text);
  background: var(--at-bg);
}

/* Conteneur centré : largeur du Customizer, gouttières bureau / mobile */
.at-container {
  width: 100%;
  max-width: var(--at-page-width);
  margin: 0 auto;
  padding: 0 var(--at-gutter-m);
}
.at-section { overflow-x: hidden; }
@media (width > 750px) {
  .at-container { padding: 0 var(--at-gutter); }
  .at-container--narrow { max-width: 900px; }
}

/* ==================== Visibilité ==================== */

dialog:not([open]) { display: none; }
.at-noscroll { overflow: hidden !important; }
.at-hidden { display: none !important; }
@media (width < 750px) { .at-hide-m { display: none !important; } }
@media (width > 750px) { .at-hide-d { display: none !important; } }

/* Carte entièrement cliquable : un lien transparent couvre le bloc, les vrais liens et boutons restent au-dessus */
.at-cover { position: relative; cursor: pointer; }
.at-cover__hit { position: absolute; inset: 0; z-index: 0; }
.at-cover a:not(.at-cover__hit),
.at-cover button,
.at-cover input,
.at-cover select,
.at-cover summary { position: relative; z-index: 1; }

/* ==================== Typographie ==================== */

/* Contenu éditorial WordPress (pages, articles) */
.at-prose > * { margin-block: var(--at-space-5); }

.at-link { color: var(--at-text); text-decoration: underline; cursor: pointer; }

/* Texte courant */
p,
ul li,
ol li,
.at-p,
.at-text.at-p > * {
  font-family: var(--at-font-body);
  font-style: normal;
  font-weight: var(--at-fw-body);
  font-size: var(--at-size-body);
  line-height: var(--at-lh-body);
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Variantes de taille du texte courant (réglage paragraph_font_size des blocs) */
.at-text-sm { font-size: var(--at-size-small); }
.at-text-lg { font-size: var(--at-size-large); }

strong { font-weight: 600; }
button { font-family: var(--at-font-body); }

/* Titres : réglages communs, puis police par famille (h1-h3 titres, h4-h6 sous-titres), puis taille par niveau.
   Une balise, sa classe .hN ou un bloc de texte .at-text.hN reçoivent le même style. */
h1, .at-h1, .at-text.at-h1 > *,
h2, .at-h2, .at-text.at-h2 > *,
h3, .at-h3, .at-text.at-h3 > *,
h4, .at-h4, .at-text.at-h4 > *,
h5, .at-h5, .at-text.at-h5 > *,
h6, .at-h6, .at-text.at-h6 > * {
  font-style: normal;
  line-height: var(--at-lh-heading);
  letter-spacing: 0;
  text-transform: none;
  color: var(--at-text);
  -webkit-font-smoothing: auto;
  -moz-osx-font-smoothing: auto;
}
h1, .at-h1, .at-text.at-h1 > *,
h2, .at-h2, .at-text.at-h2 > *,
h3, .at-h3, .at-text.at-h3 > * { font-family: var(--at-font-heading); font-weight: var(--at-fw-heading); }
h4, .at-h4, .at-text.at-h4 > *,
h5, .at-h5, .at-text.at-h5 > *,
h6, .at-h6, .at-text.at-h6 > * { font-family: var(--at-font-sub); font-weight: var(--at-fw-sub); }
h1, .at-h1, .at-text.at-h1 > * { font-size: var(--at-size-h1); }
h2, .at-h2, .at-text.at-h2 > * { font-size: var(--at-size-h2); }
h3, .at-h3, .at-text.at-h3 > * { font-size: var(--at-size-h3); }
h4, .at-h4, .at-text.at-h4 > * { font-size: var(--at-size-h4); }
h5, .at-h5, .at-text.at-h5 > * { font-size: var(--at-size-h5); }
h6, .at-h6, .at-text.at-h6 > * { font-size: var(--at-size-h6); }

/* Blocs de texte : espacement entre paragraphes, aucun en tête ni en fin de bloc */
.at-text > * { margin-block: var(--at-space-5) 0; }
.at-text > *:first-child { margin-top: 0; }
.at-text > *:last-child { margin-bottom: 0; }

/* ==================== Barres de défilement ==================== */

* { scrollbar-width: thin; scrollbar-color: rgba(1, 1, 1, 0.25) transparent; }
/* Navigateurs WebKit sans scrollbar-color */
::-webkit-scrollbar { width: 12px; }
::-webkit-scrollbar-track,
::-webkit-scrollbar-corner { background-color: transparent; }
::-webkit-scrollbar-thumb { border: 3px solid #fff; border-radius: 20px; background-color: rgba(1, 1, 1, 0.25); transition: background-color 0.2s; }
::-webkit-scrollbar-thumb:hover { background-color: rgba(1, 1, 1, 0.3); }

/* ==================== Cartes ==================== */

.at-surface { padding: var(--at-card-pad); border-radius: var(--at-radius-card); }
/* carte dans une carte : marge intérieure et rayon réduits pour rester concentriques */
.at-surface > .at-surface { padding: calc(var(--at-card-pad) * 0.75); }
.at-surface .at-img,
.at-surface > .at-surface { border-radius: calc(var(--at-radius-card) - (var(--at-card-pad) * 0.5)); }
.at-surface > .at-surface .at-img { border-radius: calc(var(--at-radius-card) - (var(--at-card-pad) * 0.67)); }

/* ==================== Icônes ==================== */

/* Icône = masque SVG (--icon-url, icons.css) rempli de la couleur du texte ; taille en px via --at-icon-size */
.icon {
  display: inline-block;
  flex-shrink: 0;
  width: 1em;
  height: 1em;
  font-size: calc(var(--at-icon-size) * 1px);
  background-color: currentColor;
  -webkit-mask: var(--icon-url) center / contain no-repeat;
  mask: var(--icon-url) center / contain no-repeat;
}

/* ==================== Boutons ==================== */

/* Principal (plein) par défaut */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: var(--at-field-w);
  max-width: max-content;
  min-height: var(--at-field-h);
  padding: var(--at-btn-py) var(--at-btn-px);
  appearance: none;
  outline: 1px solid transparent;
  border: var(--at-btn-border) solid var(--at-btn-line);
  border-radius: var(--at-radius-btn);
  font-size: var(--at-btn-size);
  font-weight: 400;
  letter-spacing: var(--at-btn-tracking);
  text-decoration: none;
  text-transform: none;
  color: var(--at-btn-text);
  background-color: var(--at-btn-bg);
  cursor: pointer;
  transition: all var(--at-speed) var(--at-ease);
}
.button:hover { opacity: 0.75; }
.button:has(.at-price) { padding: var(--at-btn-py); }
.button span { pointer-events: none; }
.button:disabled,
.button[disabled],
.button[aria-disabled='true'] { opacity: 0.5; cursor: not-allowed; }
.button .icon { font-size: 18px !important; }

/* Secondaire (contour) */
.button--secondary {
  border: var(--at-btn2-border) solid var(--at-btn2-line);
  font-weight: 400;
  text-transform: none;
  color: var(--at-btn2-text);
  background-color: var(--at-btn2-bg);
}

/* Tertiaire (texte seul) : hérite de la couleur du texte */
.button--tertiary { border: none; color: inherit; background-color: transparent; }
.button--tertiary.button--icon-only .icon { font-size: calc(var(--at-icon-size) * 1px) !important; }

/* Carré, icône seule */
.button--icon-only { padding: 0; min-width: var(--at-field-h); }

.button--full-width { width: 100%; max-width: 100%; }

/* Petite taille : tout est multiplié par --at-small */
.button--small {
  min-width: calc(var(--at-small) * var(--at-field-w));
  min-height: calc(var(--at-small) * var(--at-field-h));
  padding: calc(var(--at-btn-py) / 2) calc(var(--at-btn-px) * var(--at-small));
  border-radius: calc(var(--at-small) * var(--at-radius-btn));
}
.button--small.button--icon-only {
  padding: 0;
  min-width: calc(var(--at-small) * var(--at-field-h));
  max-width: calc(var(--at-small) * var(--at-field-h));
  min-height: calc(var(--at-small) * var(--at-field-h));
  max-height: calc(var(--at-small) * var(--at-field-h));
}

.at-btn-label { display: flex; flex-wrap: wrap; align-items: center; gap: var(--at-space-3); }

/* ==================== Listes déroulantes ==================== */

.at-select-wrap { position: relative; display: inline-block; }
.at-select-wrap--full { width: 100%; }
.at-select {
  width: 100%;
  min-width: var(--at-field-w);
  height: var(--at-field-h);
  padding: var(--at-field-pad);
  padding-right: calc(var(--at-field-pad) * 2.5);
  -webkit-appearance: none;
  appearance: none;
  border: var(--at-field-border) solid var(--at-field-line);
  border-radius: var(--at-radius-field);
  font-size: var(--at-field-size);
  color: var(--at-field-text);
  background-color: var(--at-field-bg);
  cursor: pointer;
}
.at-select:focus,
.at-select:focus-visible,
.at-select:not(:disabled):hover { margin: 0; outline: none; box-shadow: none; }
.at-select:disabled { opacity: 0.5; cursor: not-allowed; }

/* ==================== Badges ==================== */

.at-badges { display: flex; flex-wrap: wrap; gap: var(--at-space-3); }
.at-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--at-space-2);
  padding: var(--at-space-2) var(--at-space-4);
  border: 0px solid var(--at-badge-line);
  border-radius: 0px;
  font-size: var(--at-size-small);
  font-weight: 400;
  line-height: normal;
  text-transform: none;
  color: var(--at-badge-text);
  background-color: var(--at-badge-bg);
}

/* ==================== Prix ==================== */

.at-price {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--at-space-3);
  -webkit-font-smoothing: initial;
  -moz-osx-font-smoothing: initial;
}
.at-price .at-price__list { display: flex; flex-wrap: wrap; align-items: center; gap: var(--at-space-2); }
.at-price .price,
.at-price .at-price__was { text-wrap-mode: nowrap; }
/* prix barré (promotion) */
.at-price .at-price__was { opacity: 0.7; text-decoration: line-through; text-decoration-thickness: 1.5px; }
.at-price .at-price__was:empty { display: none; }
.at-price .at-price__ref { text-wrap-mode: nowrap; font-size: .85em; opacity: .75; }
.at-price .at-price__ref .at-price__was { opacity: 1; }
/* prix au kg / au litre */
.at-per-unit { opacity: 0.7; font-size: var(--at-size-small); }

/* ==================== Fenêtres modales ==================== */

@keyframes at-modal-in { from { transform: translateY(200%); } to { transform: translateY(0); } }
@keyframes at-backdrop-dim { from { backdrop-filter: brightness(1); } to { backdrop-filter: brightness(0.75); } }

.at-modal {
  min-width: 50%;
  max-width: var(--at-modal-w);
  max-height: var(--at-modal-max-h);
  margin: auto var(--at-space-5);
  padding: var(--at-space-7);
  box-shadow: var(--at-modal-shadow);
}
.at-modal:focus,
.at-modal:focus-visible { outline: none; }
.at-modal[open] { animation: at-modal-in var(--at-speed) var(--at-ease) forwards; }
.at-modal::backdrop {
  -webkit-backdrop-filter: brightness(1);
  backdrop-filter: brightness(1);
  background: rgba(var(--at-shadow));
  transition: backdrop-filter var(--at-speed) var(--at-ease);
}
.at-modal[open]::backdrop {
  animation: at-backdrop-dim var(--at-speed) var(--at-ease) forwards;
  transition: opacity var(--at-speed) var(--at-ease);
}
.at-modal::-webkit-scrollbar-track { margin: var(--at-space-5) 0; }
.at-modal__body > * { margin-block: var(--at-space-5); }
.at-modal__body > *:first-child { margin-block-start: 0; }
.at-modal__close { position: absolute; top: var(--at-space-5); right: var(--at-space-5); }

@media (width < 750px) {
  .at-modal { padding: var(--at-space-7) var(--at-space-5) var(--at-space-5); }
  /* variante « bas d'écran » : pleine largeur, collée en bas */
  .at-modal--sheet { width: 100%; max-width: 100%; margin: auto 0 0; }
  .at-modal--sheet.at-surface { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
  .at-modal__close { top: var(--at-space-4); right: var(--at-space-4); }
}
@media (width > 750px) {
  .at-modal { margin: 10% auto; }
}

/* ==================== Formulaires ==================== */

/* Champs côte à côte (prénom + nom), empilés en mobile */
.at-fields-row { display: flex; flex-direction: row; align-items: center; gap: var(--at-space-3); }
@media (width < 750px) {
  .at-fields-row { flex-direction: column; gap: var(--at-space-5); }
}
