/* Phone alignment fixes (audit of 2026-11-12 at 390 px). One block per page; loaded last in the « mobile » library. */
@media (max-width: 767px) {
  /* ---- every page ---- */
  /* footer logo: « Gov » was dark on the navy footer */
  html body footer .ec-footer__logo .logo__name { color: #fff !important; }
  /* no white band under the footer: the room for the bottom tab bar is inside the footer */
  html.m-shell body { padding-bottom: 0 !important; }
  html.m-shell body footer.footer { padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px) + 1.1rem) !important; }
  /* page title in the top bar: two short lines instead of a cut one */
  html.m-shell .msh-title { display: -webkit-box !important; overflow: hidden; white-space: normal !important; -webkit-line-clamp: 2; -webkit-box-orient: vertical; font-size: .9rem !important; line-height: 1.12 !important; }
  /* a checkbox and its label side by side, the label's lines aligned */
  html body .gc-member-form .form-type-checkbox, html body .sr-form .form-type-checkbox { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .1rem .6rem; align-items: start; }
  html body .gc-member-form .form-type-checkbox > input, html body .sr-form .form-type-checkbox > input { margin-top: .3rem; }
  html body .gc-member-form .form-type-checkbox > .description, html body .sr-form .form-type-checkbox > .description { grid-column: 2; }
  /* boxed groups of a form: the title sits inside the box, on as many lines as it needs */
  html body .gc-member-form fieldset, html body .sr-form fieldset { min-width: 0; margin-inline: 0 !important; padding: .95rem .9rem .6rem !important; }
  html body .gc-member-form fieldset > legend, html body .sr-form fieldset > legend { float: left; width: 100%; margin: 0 0 .55rem; padding: 0; white-space: normal; line-height: 1.25; }
  html body .gc-member-form fieldset > legend + *, html body .sr-form fieldset > legend + * { clear: both; }
  html body .gc-member-form .gc-member-form__intro { margin-inline: 0 !important; padding-inline: 0 !important; }

  /* ---- home ---- */
  /* the top section stays inside the screen (the four topic tiles forced it to 422 px on a 390 px phone) */
  html body .hub-hero__in { grid-template-columns: minmax(0, 1fr) !important; }
  html body .hub-hero__main, html body .hub-near { min-width: 0; max-width: 100%; }
  html body .hub-topics { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; gap: .45rem !important; }
  html body .hub-topics > li > a { min-width: 0; padding-inline: .2rem !important; font-size: .8rem !important; line-height: 1.15; overflow-wrap: anywhere; }
  html body .hub-topics > li > a > span { white-space: normal; }
  html body .hub-eyebrow { max-width: 100%; white-space: normal; }
  html body .hub-topics { align-items: stretch; }
  html body .hub-topics > li { display: flex; }
  html body .hub-topics > li > a { flex: 1; }
  html body .hub-near__figs li > span { overflow: visible !important; white-space: normal !important; text-overflow: clip; line-height: 1.15; }
  html body .hub-near__pick { flex-wrap: wrap; }
  html body .hub-near__pick > select { flex: 1 1 100%; min-width: 0; }
  html body .hub-near__pick > :not(select):not(label) { flex: 1 1 100%; justify-content: center; }
  /* the alert text ends on a whole line with « … » (it was cut in the middle of a line); the full text is on the report's page */
  html body .hub .hub-near__feed .hub-slide strong { flex: 0 1 auto !important; display: -webkit-box !important; overflow: hidden !important; max-height: calc(1.4em * 5) !important; line-height: 1.4 !important; -webkit-box-orient: vertical; -webkit-line-clamp: 5 !important; }
  /* the scrolling row of shortcuts fades at the right edge instead of cutting a word */
  html body .hub-top__in { -webkit-mask-image: linear-gradient(90deg, #000 86%, transparent); mask-image: linear-gradient(90deg, #000 86%, transparent); padding-right: 1.6rem; }

  /* ---- Suivi citoyen (reports list) ---- */
  html body .gc-srh__row { max-width: 100%; }
  html body .gc-srh__row > * { max-width: 100%; min-width: 0; }
  html body .gc-srh__row > .sr-tabs { flex: 1 1 100%; width: 100%; padding-inline: .25rem; overflow-x: auto; scrollbar-width: none; }
  html body .gc-srh__row > .sr-tabs::-webkit-scrollbar { display: none; }
  html body .grl-steps li > span { overflow: visible !important; white-space: normal !important; text-overflow: clip; font-size: .78rem !important; line-height: 1.15; }
  /* the « Carte » button sits at the right, above the tab bar, off the cards' titles */
  html.m-shell .msh-mapfab { left: auto !important; right: .75rem !important; transform: none !important; }

  /* tabs « Nouvelle demande / Suivre ma demande / Signalements des habitants »: two even lines at most */
  html body .sr-tabs { gap: .15rem; }
  html body .sr-tabs .sr-tabs__tab { min-width: 0; padding: .35rem .45rem; font-size: .78rem; line-height: 1.15; text-align: center; text-wrap: balance; }
  html body .sr-tabs .sr-tabs__tab .fa-icon { flex: none; width: .9em; height: .9em; }

  /* ---- Projets ---- */
  html body .gtab > a { flex: 1 1 0; min-width: 0; justify-content: center; padding-inline: .6rem; font-size: .86rem; line-height: 1.15; text-align: center; text-wrap: balance; }
  html body .gpl-card__progress { margin: .1rem .95rem 0; }
  html body .gpl-card__progress small { flex: none; }
  html body .gpl-card__money small { margin-left: .35em; }
  /* no empty ruled strip under the cost when a project has no date */
  html body .gpl-card__foot:not(:has(*)) { display: none !important; }

  /* ---- Demander un service ---- */
  html body .sr-action { align-items: flex-start; flex-wrap: wrap; }
  html body .sr-action__text { flex: 1 1 0; }
  html body .sr-action__cta { flex: 1 1 100%; justify-content: center; margin-top: .15rem; }

  /* ---- entity page ---- */
  html body .mc2-hero.eh:not(#_) .eh__facts > .eh__fact--mail { grid-column: 1 / -1; flex: 1 1 100%; }
  html body .eh__facts .eh__fact--mail a { overflow-wrap: anywhere; word-break: normal; }
  html body.path-ma-ville .mv-brief__head { flex-wrap: wrap; gap: .35rem .8rem; }
  html body.path-ma-ville .mv-brief__head h2 { white-space: nowrap; }
  html body.path-ma-ville .mv-brief__tag { white-space: nowrap; }
  html body .pl-ents__name { overflow: visible; white-space: normal; text-overflow: clip; line-height: 1.2; }
  html body .pl-ents a { grid-template-columns: minmax(0, 2fr) minmax(0, .8fr) 4.2rem .5rem; }
  html body .pl-svc__row { grid-template-columns: minmax(0, 2.3fr) minmax(0, .7fr) 3rem; }

  /* ---- Tableau de bord ---- */
  html body .gdb-lead b { white-space: nowrap; }

  /* ---- Climat ---- */
  html body .cwt td small { display: block; white-space: nowrap; }
  /* hour labels under the 48 h chart: every second one, so they no longer run into each other */
  html body .cwh__ticks span:nth-child(odd) { display: none; }
  html body .cwh__ticks span { white-space: nowrap; font-size: .72rem; }
  html body .cw-bul__share { display: grid !important; grid-template-columns: 1fr; gap: .45rem; }
  html body .cw-bul__share .btn { justify-content: center; white-space: nowrap; }
  html body .cwr__top { display: flex; align-items: flex-start; justify-content: space-between; gap: .6rem; }
  html body .cwr__top .cwl__tag { flex: none; white-space: nowrap; }

  /* ---- Alertes pluie ---- */
  html body .ec-phero__figures:has(> :nth-child(2):last-child) { grid-template-columns: 1fr 1fr !important; }
  html body .ra-adv__actions { flex-direction: column; align-items: stretch; }
  html body .ra-adv__actions .btn { justify-content: center; text-align: center; }

  /* ---- one report ---- */
  html body .sr-pub__title { display: block !important; overflow: visible !important; -webkit-line-clamp: unset !important; font-size: 1.55rem !important; line-height: 1.15 !important; overflow-wrap: anywhere; }
  html body .srh__track ol { display: grid !important; grid-template-columns: 1fr 1fr 1fr; }
  html body .srh__track ol > li:nth-child(2) { justify-self: center; }
  html body .srh__track ol > li:last-child { justify-self: end; }
}
