/* =====================================================================
   02 · BASE — typographie, liens, formulaires, accessibilité
   ---------------------------------------------------------------------
   Styles des balises HTML « nues ». Aucune couleur en dur : tout vient
   de 01-tokens.css.
   ===================================================================== */

/* ---------------------------------------------------------------------
   Page
   --------------------------------------------------------------------- */
body {
  font-family: var(--brand-font-body);
  font-size: 1rem;
  line-height: 1.55;
  color: var(--ui-text);
  background-color: var(--brand-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

::selection {
  color: var(--brand-on-accent);
  background: var(--brand-accent);
}

img {
  max-width: 100%;
  height: auto;
}

/* ---------------------------------------------------------------------
   Titres
   h1-h2 : police « display » de la marque — h3-h6 : police de texte
   --------------------------------------------------------------------- */
h1, h2, h3, h4, h5, h6 {
  margin: 0 0 .6em;
  color: var(--ui-heading);
}

h1, h2 {
  font-family: var(--brand-font-display);
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: 0;
}

h3, h4, h5, h6 {
  font-family: var(--brand-font-body);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -.005em;
}

h1 { font-size: clamp(2rem, 1.55rem + 1.6vw, 2.75rem); color: var(--ui-title); }
h2 { font-size: clamp(1.55rem, 1.35rem + .8vw, 2rem); }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.125rem; }
h5, h6 { font-size: 1rem; }

h1 a, h2 a, h3 a, h4 a {
  color: inherit;
  text-decoration: none;
}

/* ---------------------------------------------------------------------
   Texte courant
   --------------------------------------------------------------------- */
p { margin: 0 0 1em; }

a {
  color: var(--ui-link);
  text-underline-offset: .18em;
  transition: color var(--ui-speed) var(--ui-ease);
}

a:hover { color: var(--ui-link-hover); }

strong, b { font-weight: 700; }

small { font-size: .8125rem; }

hr {
  height: 1px;
  margin: 2rem 0;
  border: 0;
  background: var(--brand-border);
}

blockquote {
  margin: 1.5rem 0;
  padding: .25rem 0 .25rem 1.25rem;
  border-left: 4px solid var(--brand-accent);
  font-size: 1.125rem;
  font-style: italic;
}

/* ---------------------------------------------------------------------
   Formulaires
   16px minimum sur les champs : évite le zoom automatique sur iPhone.
   --------------------------------------------------------------------- */
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="number"],
input[type="password"],
input[type="search"],
input[type="url"],
input[type="date"],
input[type="time"],
select,
textarea,
.form-control {
  min-height: 46px;
  padding: .6rem .9rem;
  font-family: var(--brand-font-body);
  font-size: 1rem;
  line-height: 1.4;
  color: var(--ui-text);
  background-color: var(--brand-surface);
  border: 1.5px solid var(--ui-border-strong);
  border-radius: var(--brand-radius-sm);
  box-shadow: none;
  transition: border-color var(--ui-speed), box-shadow var(--ui-speed);
}

textarea { min-height: 110px; }

/* Listes déroulantes : main.css du thème parent leur impose height: 34px.
   Sur iPhone (WebKit), une liste native dont la hauteur est fixée ignore
   min-height : elle restait à 34 px et le texte était coupé à mi-hauteur.
   En hauteur automatique, la liste a toujours la place pour son texte. */
select,
select.form-control { height: auto; }

input:focus,
select:focus,
textarea:focus,
.form-control:focus {
  border-color: var(--brand-primary);
  box-shadow: var(--ui-focus-ring);
  outline: none;
}

::placeholder {
  color: var(--ui-text-soft);
  opacity: .85;
}

label {
  font-weight: 500;
  color: var(--ui-text);
}

input[type="checkbox"],
input[type="radio"] {
  accent-color: var(--brand-primary);
}

/* Liste déroulante « nice-select » (thème parent) */
.nice-select {
  height: 46px;
  line-height: 43px;
  border: 1.5px solid var(--ui-border-strong);
  border-radius: var(--brand-radius-sm);
}

.nice-select:hover,
.nice-select.open,
.nice-select:focus { border-color: var(--brand-primary); }

.nice-select .option.selected { font-weight: 600; }
.nice-select .option:hover,
.nice-select .option.focus,
.nice-select .option.selected.focus { background-color: var(--ui-primary-soft); }

/* Liste déroulante Select2 / SelectWoo (pays, etc.) */
.select2-container .select2-selection--single {
  height: 46px;
  border: 1.5px solid var(--ui-border-strong);
  border-radius: var(--brand-radius-sm);
}

.select2-container .select2-selection--single .select2-selection__rendered { line-height: 43px; }
.select2-container .select2-selection--single .select2-selection__arrow { height: 44px; }
.select2-container--default .select2-results__option--highlighted[aria-selected] {
  color: var(--brand-on-primary);
  background-color: var(--brand-primary);
}

/* ---------------------------------------------------------------------
   Accessibilité
   --------------------------------------------------------------------- */
:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--brand-primary) 60%, transparent);
  outline-offset: 2px;
}

.screen-reader-text {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

@layer overrides {
  .screen-reader-text { position: absolute !important; }
}

/* Visiteurs qui ont demandé moins d'animations dans leur système */
@media (prefers-reduced-motion: reduce) {
  @layer overrides {
    *,
    *::before,
    *::after {
      animation-duration: .01ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: .01ms !important;
      scroll-behavior: auto !important;
    }
  }
}
