/*
 * R2H — Documentation de style
 * Fichier : mobile/css/mobile-public.css
 * Périmètre : Expérience mobile native du site public et des pages d'authentification (barre inférieure .pub-mob-tabbar, CTA mobile « Se connecter » / « Mon espace », cartes mobiles et palette bleu dashboard).
 * Cascade / précautions : Chargé sur les 30 pages .r2h-public (jamais sur app.html) après public-theme.css et home.css.
 * Référence : mobile/README.md ; docs/REFERENCE_FICHIERS.md
 * Signature du projet : @admin-zaloria
 */
/* ============================================================
   R2H — Interface Mobile Applicative du Site Public
   ============================================================ */

/* Barre inférieure mobile masquée par défaut sur ordinateur */
.pub-mob-tabbar {
  display: none;
}

/* ---------- 1. AUTHENTIFICATION MOBILE PLEIN ÉCRAN (<= 900px) ---------- */
@media (max-width: 900px) {
  body.r2h-auth-app {
    background: #ffffff;
    min-height: 100dvh;
  }
  .r2h-auth-app .ln-wrap {
    display: block;
    max-width: none;
    min-height: 100dvh;
    padding: 0;
  }
  .r2h-auth-app .ln-left {
    display: none;
  }
  .r2h-auth-app .ln-right {
    min-height: 100dvh;
    padding: 0;
    background: #ffffff;
  }
  .r2h-auth-app .ln-app-shell {
    min-height: 100dvh;
    max-width: 520px;
    margin-inline: auto;
    border-radius: 0;
    box-shadow: none;
  }
  .r2h-auth-app .ln-hero-head {
    height: calc(214px + env(safe-area-inset-top, 0px));
    padding: env(safe-area-inset-top, 0px) 20px 28px;
  }
  .r2h-auth-app .ln-back-home {
    position: absolute;
    top: calc(14px + env(safe-area-inset-top, 0px));
    left: 16px;
  }
  .r2h-auth-app .ln-lang {
    position: absolute;
    top: calc(14px + env(safe-area-inset-top, 0px));
    right: 16px;
  }
  .r2h-auth-app .ln-sheet {
    margin-top: -32px;
    border-radius: 32px 32px 0 0;
    padding: 28px 24px calc(26px + env(safe-area-inset-bottom, 0px));
  }
  .r2h-auth-app .ln-card {
    padding: 0;
    border: 0;
    box-shadow: none;
  }
  .r2h-auth-app .ln-input {
    height: 50px;
  }
  .r2h-auth-app .ln-input input,
  .r2h-auth-app .ln-input select {
    font-size: 16px;
  }
  .r2h-auth-app .ln-btn {
    height: 50px;
  }
}

/* ---------- 2. TABLETTES PORTRAIT & MOBILES LARGES (<= 820px) ---------- */
@media (max-width: 820px) {
  .r2h-public .page-hero .public-hero-grid,
  .r2h-public .abx-hero .hero-grid {
    grid-template-columns: 1fr;
    gap: 22px;
  }
  .r2h-public .public-hero-art {
    display: none;
  }
  .r2h-public .public-hero-copy {
    max-width: 680px;
  }
  .r2h-public .page-hero h1 {
    font-size: 31px;
  }
  .r2h-public:not(.home-page) .section {
    padding-block: 48px;
  }

  /* Accueil <= 820px */
  .home-hero { height: 520px; }
  .home-hero-copy { width: 56%; }
  .home-hero-copy h1 { font-size: 30px; }
  .home-reassurance { display: none; }
  .home-search-form { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
  .home-search-submit { grid-column: 1 / -1; min-height: 42px; }
  .home-search-panel { padding: 18px 20px; }
  .home-field-label { font-size: 9.5px; white-space: normal; }
  .home-shortcuts { grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 18px 0; row-gap: 22px; }
  .home-shortcut { padding-inline: 24px; }
  .home-shortcut:nth-child(4) { border-left: 0; }
  .home-shortcut strong { font-size: 12px; }
  .home-shortcut > span:last-child { font-size: 11px; }
  .home-services { padding-top: 52px; }
  .home-services-layout { grid-template-columns: 1fr; gap: 24px; }
  .home-section-intro p { max-width: 470px; margin-bottom: 15px; }
  .home-service-card { min-height: 140px; }
  .home-service-card h3 { font-size: 13px; }
  .home-service-card p { font-size: 11px; }
  .home-audience-card { grid-template-columns: 1fr; grid-template-rows: 165px auto; height: auto; }
  .home-audience-card > img { height: 165px; object-position: 50% 24%; }
  .home-audience-copy { min-height: 200px; padding: 18px; }
  .home-audience-copy h3 { font-size: 13px; }
  .home-audience-copy p { font-size: 12px; }
  .home-audience-copy .home-text-link { font-size: 11px; }
  .home-card-banner { grid-template-columns: 44% 56%; }
  .home-card-left { padding-inline: 20px; }
  .home-health-card { padding-inline: 17px; }
  .home-card-copy { padding-right: 18px; }
  .home-card-copy h2 { font-size: 24px; }
  .home-telemedicine-grid { grid-template-columns: 1fr 1fr; gap: 25px; }
  .home-telemedicine-benefits { grid-column: 1 / -1; grid-template-columns: 1fr 1fr; padding-top: 6px; gap: 14px; }
  .home-telemedicine-benefits strong { font-size: 12px; }
  .home-telemedicine-benefits div > span { font-size: 11px; }
  .home-network-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr); }
  .home-family { display: none; }
  .home-network-copy h2 { font-size: 22px; }
  .home-network-countries li { font-size: 11px; }
  .home-results-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- 3. BARRE INFÉRIEURE MOBILE & CTA DYNAMIQUE (<= 768px) ---------- */
@media (max-width: 768px) {
  .r2h-public .header-cta a.account-link {
    display: none !important;
  }
  .r2h-public .site-header .header-cta a.provider-button {
    width: auto;
    min-height: 41px;
    padding: 8px 15px;
    font-size: 12.5px;
    font-weight: 700;
    gap: 6px;
    white-space: nowrap;
  }

  /* Barre d'onglets fixe en bas d'écran style application native */
  body.r2h-public:not(.no-chrome) .pub-mob-tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 125;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    align-items: stretch;
    height: calc(62px + env(safe-area-inset-bottom, 0px));
    padding: 4px 6px env(safe-area-inset-bottom, 0px);
    background: rgba(255, 255, 255, .96);
    backdrop-filter: blur(18px) saturate(1.4);
    -webkit-backdrop-filter: blur(18px) saturate(1.4);
    border-top: 1px solid #d7e1f5;
    box-shadow: 0 -8px 26px rgba(15, 29, 64, .08);
  }
  .pub-mtab {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-width: 0;
    border-radius: 12px;
    color: #516182;
    font-size: 10px;
    font-weight: 650;
    line-height: 1.1;
    text-decoration: none;
    transition: color .18s ease, background-color .18s ease;
  }
  .pub-mtab-ic {
    position: relative;
    display: grid;
    place-items: center;
    width: 28px;
    height: 24px;
    border-radius: 999px;
    transition: background-color .18s ease, transform .18s ease;
  }
  .pub-mtab-ic .i {
    width: 19px;
    height: 19px;
  }
  .pub-mtab-lbl {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding-inline: 2px;
  }
  .pub-mtab.on {
    color: #2b50c7;
    font-weight: 750;
  }
  .pub-mtab.on .pub-mtab-ic {
    background: #eef2fd;
  }
  .pub-mtab.on::before {
    content: "";
    position: absolute;
    top: -4px;
    width: 24px;
    height: 3px;
    border-radius: 0 0 4px 4px;
    background: #2b50c7;
  }
  .pub-mtab.is-connected .pub-mtab-ic {
    color: #2b50c7;
  }
  .pub-mtab-dot {
    position: absolute;
    top: 1px;
    right: 2px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #16a34a;
    border: 1.5px solid #ffffff;
  }

  /* Pied de page mobile épuré et centré : uniquement le bloc marque R2H + réseaux sociaux */
  body.r2h-public:not(.no-chrome) .site-footer {
    padding: 40px 0 calc(132px + env(safe-area-inset-bottom, 0px));
  }
  body.r2h-public:not(.no-chrome) .site-footer .footer-grid {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    padding-bottom: 0;
  }
  body.r2h-public:not(.no-chrome) .site-footer .footer-grid > div:not(.footer-brand),
  body.r2h-public:not(.no-chrome) .site-footer .footer-bottom {
    display: none !important;
  }
  body.r2h-public:not(.no-chrome) .site-footer .footer-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    width: 100%;
    max-width: 340px;
    margin-inline: auto;
  }
  body.r2h-public:not(.no-chrome) .site-footer .footer-brand .fb-logo {
    margin-inline: auto;
  }
  body.r2h-public:not(.no-chrome) .site-footer .footer-brand p {
    margin: 14px auto 0;
    max-width: 320px;
    text-align: center;
  }
  body.r2h-public:not(.no-chrome) .site-footer .footer-social {
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
  }
  body.r2h-public:not(.no-chrome) .site-footer .footer-social a.fs {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: rgba(65, 105, 226, .16);
    border: 1px solid rgba(142, 170, 243, .22);
    color: #49c5c1;
  }
  body.r2h-public:not(.no-chrome) .site-footer .footer-social a.fs:hover {
    color: #ffffff;
  }
  body.r2h-public:not(.no-chrome) #chat-fab {
    right: 14px;
    bottom: calc(74px + env(safe-area-inset-bottom, 0px));
    width: 46px;
    height: 46px;
    border-radius: 15px;
  }
  body.r2h-public:not(.no-chrome) #to-top {
    left: 14px;
    right: auto;
    bottom: calc(74px + env(safe-area-inset-bottom, 0px));
    width: 44px;
    height: 44px;
    border-radius: 14px;
  }
  body.r2h-public:not(.no-chrome) #chat-panel {
    right: 12px;
    bottom: calc(74px + env(safe-area-inset-bottom, 0px));
    width: calc(100vw - 24px);
    height: min(520px, calc(100dvh - 150px));
  }
}

/* ---------- 4. SMARTPHONES (<= 600px) ---------- */
@media (max-width: 600px) {
  .r2h-public .container,
  .home-container,
  .home-page .site-header > .container {
    width: calc(100% - 32px);
  }
  .home-wide {
    width: calc(100% - 24px);
  }
  .r2h-public .site-header > .container,
  .home-page .site-header > .container {
    height: 62px;
    gap: 8px;
  }
  .r2h-public .brand .brand-logo-img,
  .home-page .brand .brand-logo-img {
    height: 34px;
  }
  .r2h-public .header-cta,
  .home-page .header-cta {
    gap: 6px;
  }
  .r2h-public .header-cta .hdr-lang,
  .home-page .header-cta .hdr-lang {
    display: inline-flex;
    padding-inline: 8px;
    min-height: 36px;
  }
  .r2h-public .header-cta .hdr-lang .i,
  .home-page .header-cta .hdr-lang .i {
    display: none;
  }
  .r2h-public .burger,
  .home-page .burger {
    border-radius: 12px;
    width: 38px;
    height: 38px;
    border: 1px solid #dfe6f4;
    background: #f6f8fd;
    color: #0f1d40;
    position: relative;
    z-index: 220;
  }
  .r2h-public .main-nav.mobile-open,
  .home-page .main-nav.mobile-open {
    top: 0;
    left: 0;
    right: 0;
    bottom: auto;
    height: 100dvh;
    padding: 78px 20px calc(86px + env(safe-area-inset-bottom, 0px));
  }

  /* Pages intérieures sur smartphone */
  .r2h-public:not(.home-page) .page-hero,
  .r2h-public .abx-hero {
    padding: 26px 0 28px;
  }
  .r2h-public .page-hero h1,
  .r2h-public .abx-hero h1 {
    font-size: clamp(24px, 7.2vw, 33px);
  }
  .r2h-public .page-hero .lede,
  .r2h-public .abx-lede {
    font-size: 13.5px;
    line-height: 1.65;
  }
  .r2h-public .public-hero-art.public-hero-person {
    display: none;
  }
  .r2h-public:not(.home-page) .section {
    padding-block: 40px;
  }
  .r2h-public:not(.home-page) .section-tight {
    padding-block: 28px;
  }
  .r2h-public .sec-head {
    margin-bottom: 24px;
  }
  .r2h-public .sec-head h2 {
    font-size: 24px;
  }
  .r2h-public .sec-head p {
    font-size: 13px;
  }
  .r2h-public .card {
    border-radius: 16px;
  }
  .r2h-public .btn {
    white-space: normal;
    text-align: center;
    min-height: 44px;
  }
  .r2h-public .header-cta .btn {
    white-space: nowrap;
  }
  .r2h-public .ph-actions {
    gap: 10px;
  }
  .r2h-public .an-article header {
    padding: 20px;
  }
  .r2h-public .an-article h1 {
    font-size: 26px;
  }
  .r2h-public .public-error-panel {
    padding: 25px 18px;
  }
  .r2h-public .cta-final {
    padding-block: 20px 42px;
  }
  .r2h-public .legal {
    line-height: 1.75;
  }
  .r2h-public .card-head,
  .r2h-public .dir-item .flex-between,
  .r2h-public #join-form .flex-between,
  .r2h-public #join-panel .flex-between {
    flex-wrap: wrap;
    gap: 8px;
  }
  .r2h-public .country-card {
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr);
    gap: 7px 12px;
  }
  .r2h-public .country-card .c-flag {
    grid-row: 1 / 3;
  }
  .r2h-public .country-card .c-badge {
    grid-column: 2;
    margin: 0;
  }
  .r2h-public .country-card .c-badge .badge {
    white-space: normal;
  }
  .r2h-public .ent-head {
    flex-wrap: wrap;
  }
  .r2h-public .ent-kpis {
    gap: 9px;
  }
  .r2h-public .ent-kpi {
    min-width: 0;
    padding: 12px;
    gap: 8px;
    flex-wrap: wrap;
  }
  .r2h-public .ent-float {
    position: static;
    margin-top: 12px;
    white-space: normal;
    width: fit-content;
  }
  .r2h-public .stepper .step {
    flex: 1 1 0;
    flex-direction: column;
    gap: 5px;
  }
  .r2h-public .stepper .step .step-l {
    white-space: normal;
    text-align: center;
    font-size: 10px;
  }
  .r2h-public .stepper .step .step-line {
    display: none;
  }
  .r2h-public .pays-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 15px;
  }
  .r2h-public .pays-stats span {
    font-size: 10px;
  }
  .r2h-public :is(.otp-row,.ln-otp) {
    gap: 6px;
  }

  /* Accueil <= 600px façon application mobile */
  .home-hero { height: auto; padding-bottom: 22px; }
  .home-hero-inner { padding-top: 24px; height: auto; }
  .home-hero-copy { max-width: none; width: 100%; margin-bottom: 280px; }
  .home-hero-copy h1 { font-size: clamp(25px, 7.4vw, 34px); line-height: 1.16; margin-bottom: 12px; }
  .home-hero-copy p { font-size: 13.5px; line-height: 1.6; max-width: 400px; }
  .home-hero-illustration {
    right: 0; width: 100%; height: 270px; object-fit: contain;
    top: var(--home-visual-top, 244px); object-position: right bottom;
    mask-image: linear-gradient(to bottom, transparent, #000 12%, #000 83%, transparent);
    -webkit-mask-image: linear-gradient(to bottom, transparent, #000 12%, #000 83%, transparent);
  }
  .home-hero-map { display: block; left: 14px; top: calc(var(--home-visual-top, 244px) + 41px); width: 100px; height: 100px; opacity: .85; }
  .home-hero-note { display: block; left: 21px; top: calc(var(--home-visual-top, 244px) + 143px); font-size: 21px; }
  .home-search-panel { position: relative; left: auto; bottom: auto; padding: 18px; border-radius: 18px; }
  .home-search-panel h2 { font-size: 14.5px; line-height: 1.4; margin-bottom: 15px; }
  .home-search-form { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 12px; }
  .home-search-query { grid-column: 1 / -1; }
  .home-search-field { min-height: 52px; gap: 9px; padding-right: 0; }
  .home-search-field::after { display: none; }
  .home-search-icon { width: 30px; height: 34px; }
  .home-field-label { font-size: 10px; }
  .home-search-control input, .home-search-control select { font-size: 12px; padding-block: 8px; }
  .home-select-caret { right: 0; bottom: 10px; }
  .home-search-submit { grid-column: auto; font-size: 11.5px; min-height: 44px; padding-inline: 10px; gap: 7px; }
  .home-shortcuts { margin-top: 22px; grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 20px; padding: 20px 0; border-radius: 18px; }
  .home-shortcut { padding-inline: 18px; }
  .home-shortcut:nth-child(odd) { border-left: 0; }
  .home-shortcut:nth-child(4) { border-left: 1px solid #e6ecf8; }
  .home-round-icon { width: 32px; height: 32px; margin-bottom: 10px; }
  .home-shortcut strong { font-size: 12px; }
  .home-shortcut > span:last-child { font-size: 9.5px; line-height: 1.5; }
  .home-services { padding: 44px 0 48px; }
  .home-section-intro h2 { font-size: 26px; }
  .home-section-intro p { font-size: 13px; }
  .home-services-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .home-service-card { padding: 17px 16px; min-height: 142px; border-radius: 16px; }
  .home-service-card h3 { font-size: 13px; }
  .home-service-card p { font-size: 11px; }
  .home-audiences { padding: 38px 0 42px; }
  .home-audiences h2 { font-size: 24px; margin-bottom: 18px; }
  .home-audiences-grid { grid-template-columns: 1fr; gap: 13px; }
  .home-audience-card { grid-template-columns: 43% 57%; grid-template-rows: minmax(0, 1fr); height: 228px; min-height: 191px; }
  .home-audience-card > img { height: 100%; min-height: 191px; }
  .home-audience-copy { padding: 20px 18px; min-height: 191px; }
  .home-audience-copy h3 { font-size: 13px; }
  .home-audience-copy p { font-size: 12px; }
  .home-card-section { padding: 40px 0 28px; }
  .home-card-banner {
    grid-template-columns: 1fr;
    background: linear-gradient(156deg, #0a1430 0%, #19338c 34%, #dce5fb 50%, #eef2fd 72%, #e5ecfc 100%);
  }
  .home-card-left { padding: 24px 20px 18px; }
  .home-health-card { width: 303px; max-width: 100%; height: 212px; padding: 18px 20px; }
  .home-health-card-top > img { width: 62px; height: 37px; }
  .home-card-copy { padding: 14px 22px 24px; }
  .home-card-copy h2 { font-size: 25px; }
  .home-card-copy p { font-size: 13px; line-height: 1.6; }
  .home-check-list li { font-size: 12px; }
  .home-check-list { gap: 9px; margin-bottom: 20px; }
  .home-button { font-size: 11.5px; min-height: 40px; }
  .home-telemedicine { padding: 16px 0 44px; }
  .home-telemedicine-grid { grid-template-columns: 1fr; gap: 22px; }
  .home-consult-visual { height: 228px; }
  .home-consult-illustration { object-position: center; }
  .home-consult-patient { width: 43px; height: 54px; }
  .home-telemedicine-copy h2 { font-size: 25px; }
  .home-telemedicine-copy p { font-size: 13px; max-width: none; }
  .home-telemedicine-benefits { grid-column: auto; grid-template-columns: 1fr; gap: 10px; padding-top: 2px; }
  .home-telemedicine-benefits li { gap: 10px; align-items: flex-start; }
  .home-telemedicine-benefits strong { font-size: 12px; }
  .home-telemedicine-benefits div > span { font-size: 10.5px; }
  .home-benefit-icon { width: 32px; height: 32px; }
  .home-network { padding: 22px 0 0; }
  .home-network-grid { grid-template-columns: 1fr; gap: 17px; }
  .home-network-copy { grid-column: 1 / -1; padding: 22px 0 0; }
  .home-network-copy h2 { font-size: 25px; }
  .home-network-copy p { font-size: 13px; }
  .home-network-map img { width: 100%; height: auto; }
  .home-network-countries { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 12px; }
  .home-network-countries li { font-size: 11px; }
  .home-network-status { font-size: 10px; margin-bottom: 8px; }
  .home-family { display: block; grid-column: 1 / -1; height: 235px; margin: 0 -16px; }
  .home-family > img {
    object-position: 50% 45%;
    mask-image: linear-gradient(to right, transparent, #000 8%);
    -webkit-mask-image: linear-gradient(to right, transparent, #000 8%);
  }
  .home-family-note { right: 12px; top: 38px; font-size: 26px; }
  .home-results { padding: 17px; margin-top: 18px; }
  .home-results-heading h2 { font-size: 21px; }
  .home-results-grid { grid-template-columns: 1fr; }
  .home-results-footer { flex-direction: column; align-items: flex-start; gap: 12px; }
}

/* ---------- 5. TRÈS PETITS ÉCRANS (<= 380px / 320px) ---------- */
@media (max-width: 380px) {
  .r2h-public .site-header > .container,
  .home-page .site-header > .container {
    gap: 5px;
    width: calc(100% - 24px);
  }
  .r2h-public .brand .brand-logo-img,
  .home-page .brand .brand-logo-img {
    height: 30px;
  }
  .r2h-public .header-cta .hdr-lang,
  .home-page .header-cta .hdr-lang {
    padding-inline: 6px;
    font-size: 11px;
  }
  /* Bouton « Se connecter » / « Mon espace » net, tactile et compact à 320px */
  .r2h-public .site-header .header-cta a.provider-button {
    width: auto;
    min-height: 40px;
    padding: 8px 11px;
    font-size: 11.5px;
    line-height: 1.2;
    gap: 5px;
    white-space: nowrap;
  }
  .r2h-public .site-header .header-cta a.provider-button .i {
    display: inline-block;
    width: 13px;
    height: 13px;
  }
  .r2h-auth-app .ln-sheet { padding: 24px 18px calc(22px + env(safe-area-inset-bottom, 0px)); }
  .r2h-auth-app .ln-qa-grid { gap: 12px; }
  .r2h-auth-app .ln-qa-tile { width: 42px; height: 42px; min-height: 42px; padding: 0; }
  .r2h-public .device-row { flex-wrap: wrap; }
  .home-audience-copy { padding: 16px 14px; }
  .home-health-card { width: 100%; padding: 16px; }
}
