/* ==========================================================================
   AF Agenda — Mobile et tactile (chargé en dernier)
   1. Marges latérales des gabarits (formulaire, pages, annuaire)
   2. Cibles tactiles ≥ 44 px (pointeur grossier uniquement : le desktop garde la maquette)
   3. Lisibilité (texte ≥ 14 px, titres qui ne débordent pas)
   4. Filtres rapides : défilement horizontal signalé par un fondu
   5. Fiche événement : barre basse (safe area, réserve seulement si présente), prochaines dates
   6. Tiroir et modale : défilement du fond verrouillé
   ========================================================================== */

/* 1. Marges latérales ------------------------------------------------------ */
@media (max-width: 768px) {
  .fl-row:has(.af_page_main_col, .af_form_card) > .fl-row-content-wrap {
    padding-left: var(--af-gutter-mobile, 16px);
    padding-right: var(--af-gutter-mobile, 16px);
  }
  body.page:not(.home) .af_page_content:has(.af_annuaire) { width: 100%; }
  .fl-row:has(.af_related) > .fl-row-content-wrap { padding-top: 0; padding-bottom: var(--spacing-5); }
  .af_hero--org { min-height: 480px; padding-bottom: var(--spacing-5); }
  .af_footer_cta .af_button { width: 100%; height: auto; min-height: 48px; white-space: normal; text-align: center; }
}

/* 2. Cibles tactiles ------------------------------------------------------- */
@media (pointer: coarse) {
  .af_theme_filters .af_tag,
  .af_view_btn { min-height: 44px; }
  .af_searchbar .af_field select,
  .af_searchbar .af_field input[type="search"] { height: 44px; font-size: 16px; line-height: 42px; }
  .af_404_search input[type="search"],
  .af_annuaire_search input[type="search"] { font-size: 16px; }
  .af_form_aside--dark a { display: inline-flex; align-items: center; min-height: 44px; }
  .af_view_btn { padding-inline: 14px; }

  .af_breadcrumb a,
  .af_footer_cookies { position: relative; }
  .af_theme_filters a.af_tag::after { content: none; }
  .af_breadcrumb a::after,
  .af_footer_cookies::after { content: ""; position: absolute; inset: -13px -4px; }
  .af_empty_actions .af_button { min-height: 44px; }

  .af_stickybar_share,
  .af_footer_social a { width: 44px; height: 44px; flex-basis: 44px; }
  .af_messes__close { width: 44px !important; height: 44px !important; }
  .gform_wrapper.gform-theme.gform-theme--framework .gfield--input-type-datepicker .ginput_container_date button.gform-datepicker-toggle { min-inline-size: 44px; min-block-size: 44px; }

  .af_footer_links { gap: 0; }
  .af_footer_links a { min-height: 44px; min-width: 44px; }

  .af_form_card .gform-theme.gform-theme--framework .gform_drop_area .gform_button_select_files { padding-block: 15px !important; margin-block: -15px !important; }
}

/* 3. Lisibilité ------------------------------------------------------------ */
@media (max-width: 768px) {
  :is(h1, h2, h3, .af_page_title, .af_event_title, .af_hero_title) { overflow-wrap: break-word; }
  .af_breadcrumb,
  .af_breadcrumb :is(li, a),
  .af_org_card_foot span,
  .af_page_content :is(cite, figcaption),
  .af_view_btn,
  .af_footer_bar,
  .af_footer_ext,
  .af_messes__footer { font-size: 14px; }
  .af_row_meta { font-size: 14px; }
  .af_infos_text small,
  .af_infos_text small a { font-size: 14px; }
  .af_404_search input[type="search"] { font-size: 16px; }
  .af_form_card .gform-theme.gform-theme--framework { --gf-ctrl-desc-font-size: 14px; }
  .af_form_card .gform-theme.gform-theme--framework .gfield .gfield_description:not(.validation_message):not(.gfield_validation_message):not(.gfield_consent_description) { font-size: 14px; }
  .af_form_card .gform-theme.gform-theme--framework .gf_step_active { flex: 1 1 0; min-width: 0; }
  .af_form_card .gform-theme.gform-theme--framework .gf_step_active .gf_step_label { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .af_form_card .af_form_req_note { font-size: 14px; }
}

/* 4. Filtres rapides : fondu à droite tant qu'il reste des filtres à faire défiler */
@media (max-width: 768px) {
  .af_theme_filters ul {
    -webkit-mask-image: linear-gradient(to right, var(--color-neutral-900) calc(100% - 64px), transparent);
    mask-image: linear-gradient(to right, var(--color-neutral-900) calc(100% - 64px), transparent);
    scroll-snap-type: x proximity;
    overscroll-behavior-x: contain;
  }
  .af_theme_filters.is-end ul { -webkit-mask-image: none; mask-image: none; }
  .af_theme_filters li { scroll-snap-align: start; flex: 0 0 auto; }
}

/* 5. Fiche événement -------------------------------------------------------- */
@media (max-width: 992px) {
  body.single-mec-events { padding-bottom: 0; }
  body.single-mec-events:has(.af_event_sticky:not(:empty)) { padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px)); }
  .af_event_sticky { padding-bottom: calc(var(--spacing-2) + env(safe-area-inset-bottom, 0px)); }
  .af_stickybar { padding-top: env(safe-area-inset-top, 0px); }
  .af_event_sticky { transition: transform 0.25s ease, visibility 0.25s; }
  .af_event_sticky.is-hidden { transform: translateY(110%); visibility: hidden; }
}
.af_infos_dates li::before { content: none !important; }
.af_infos_dates li { padding-left: 0 !important; }

/* 6. Tiroir et modale ------------------------------------------------------- */
html.af_messes-open,
html.af_messes-open body { overflow: hidden; }
.af_messes__modal { overscroll-behavior: contain; }
.af_messes__modal:focus { outline: none; }
