/* ============================================================
   mobile.css — responsive layer for the Margot Latasa site.
   Everything lives inside @media (max-width:820px), so the
   desktop design is 100% untouched above the breakpoint.
   The JS-built mobile bar/menu is hidden by default and only
   revealed on small screens.
   ============================================================ */

/* ============================================================
   Smooth page-to-page navigation (View Transitions API).
   Same-origin navigations crossfade instead of hard-cutting,
   so moving between pages feels like an in-place swap rather
   than a reload/flash. No-ops gracefully where unsupported.
   ============================================================ */
@view-transition { navigation: auto; }

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: .42s;
  animation-timing-function: cubic-bezier(.4, 0, .2, 1);
  /* Anchor snapshots to their own intrinsic height (top-aligned) so a
     tall->short page change cross-fades instead of the snapshot being
     stretched/scaled to the animating group box (which looked like a
     zoom in/out on arrival). */
  height: auto;
  width: 100%;
}
::view-transition-group(root) {
  animation-duration: .42s;
  animation-timing-function: cubic-bezier(.4, 0, .2, 1);
}

/* Calm base background, painted before any page's own styles or JS
   load — so navigation never flashes browser-default white in the
   gap before a page renders. Each page's own background paints over
   it once loaded. */
html { background: #f8fcfe; overflow-y: scroll; }

/* Hidden on desktop — shown only inside the mobile media query. */
.m-bar,
.m-scrim,
.m-menu { display: none; }

@media (max-width: 820px) {

  /* ---- 1. Neutralise the desktop "stage" scaling ------------
     The inline fit() script sets transform/width/height as inline
     styles; !important here overrides them on phones only.        */
  html, body { overflow-x: hidden !important; }
  .stage {
    transform: none !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow: visible !important;
    padding-top: 62px !important;   /* clear the fixed mobile bar */
  }
  .stage-wrap {
    width: 100% !important;
    height: auto !important;
    margin: 0 !important;
    overflow: visible !important;
  }

  /* ---- 2. Hide the desktop headers (replaced by .m-bar) ----- */
  .hero, .topbar { display: none !important; }

  /* ---- 3. Fluid safety net --------------------------------- */
  .stage * { max-width: 100% !important; }
  .stage img { height: auto !important; }

  /* Sensible side padding for the common section wrappers. */
  .stage > section,
  .intro, .approche, .avancer, .cadre, .section, .wrap,
  .bio, .pricing, .circle-quote, .cols-wrap {
    padding-left: 22px !important;
    padding-right: 22px !important;
    box-sizing: border-box !important;
  }

  /* Fixed-width text blocks become fluid. */
  .narrative, .explainer, .quote, .big-quote, .body, .engage,
  .footnote, .desc, .page-title, .subhead, .subtitle, .lead,
  .intro h1, .cols, .clouds, .bubble-diagram, .bio-text,
  [style*="width: 750px"], [style*="width:750px"],
  [style*="width: 832px"], [style*="width: 560px"] {
    width: auto !important;
    max-width: 100% !important;
  }

  /* Accueil bubble diagram: 40% bigger than the default mobile-fit
     size, bleeding slightly past the screen edges (cropped by the
     viewport, no scrollbar) rather than being clamped to 100%. */
  .bubble-diagram{
    width: 200% !important;
    max-width: 200% !important;
    margin-left: -50% !important;
    margin-right: -50% !important;
  }

  /* Stack rows that were side-by-side on desktop. */
  .cols, .bio, .brand {
    flex-direction: column !important;
    align-items: center !important;
    gap: 28px !important;
  }
  .bio { margin-top: 45px !important; }
  .bio-photo { margin-top: -70.9px !important; padding-top: 0 !important; }
  .seaweed { width: 114px !important; }
  .photo-shape { width: 313.6px !important; height: 314.4px !important; }
  .bio-photo img { width: 313.6px !important; }
  .cadre .cols { align-items: flex-start !important; }
  .cadre .col { text-align: left !important; font-size: 14px !important; }
  .cadre .col br { display: none !important; } /* desktop-only line breaks; let text reflow to fill the full width on mobile */
  /* Clouds keep their desktop side-by-side row on mobile too. */
  .clouds { flex-wrap: nowrap !important; gap: 0px !important; overflow-x: visible !important; justify-content: center !important; margin-top: 56px !important; }
  .cloud { width: 127.6px !important; height: 119.1px !important; max-width: 127.6px !important; flex-shrink: 0 !important; margin: 0 -10px !important; }
  .cloud[href="epreuves-de-vie.html"] { width: 134.4px !important; height: 126.6px !important; max-width: 134.4px !important; }
  .cloud:first-child { margin-left: 0 !important; }
  .cloud:last-child { margin-right: 0 !important; }
  .cloud span { font-size: 12.8px !important; max-width: 108.9px !important; line-height: 1.25 !important; transform: translate(-13px, 5px) !important; }
  .col { text-align: center !important; }
  html[lang="en"] .clouds a.cloud:nth-child(1) span { left: -13px !important; }
  html[lang="en"] .clouds a.cloud:nth-child(2) span { left: -16px !important; }
  .desc { white-space: normal !important; }

  /* ---- 4. Gently reduce the largest display type ----------- */
  .intro { padding-bottom: 56px !important; }
  .intro h1 { font-size: 24px !important; line-height: 1.35 !important; }
  .intro .lead { font-size: 18px !important; }
  .page-title { font-size: 30px !important; margin-top: 40px !important; padding-top: 0 !important; padding-bottom: 0 !important; }
  .approche .eyebrow { font-size: 18px !important; }
  .approche { padding-top: 56px !important; padding-bottom: 56px !important; }
  .approche .subhead { font-size: 16px !important; }
  .avancer h2 { font-size: 18px !important; }
  .avancer { padding-top: 56px !important; }
  .avancer .desc { font-size: 16px !important; }
  .big-quote { font-size: 18px !important; line-height: 1.7 !important; }
  .circle-quote { margin-top: 88px !important; }
  .quote { font-size: 16px !important; line-height: 1.7 !important; }
  .m-br { display: inline !important; }
  .engage { font-size: 14px !important; padding-left: 22px !important; padding-right: 22px !important; box-sizing: border-box !important; margin-top: 66px !important; width: auto !important; max-width: none !important; text-align: left !important; }
  .explainer { font-size: 13px !important; }
  .narrative { font-size: 14px !important; }
  .intro p.body { font-size: 14px !important; }
  .footnote { letter-spacing: .05em !important; font-size: 15px !important; }
  .cadre { padding-top: 0 !important; }
  .avancer { padding-bottom: 0 !important; }
  .wave-div { margin-top: 28px !important; }
  .cadre .eyebrow { margin-top: 28px !important; font-size: 18px !important; }
  .cadre .subtitle { font-size: 16px !important; }
  .whale { width: 240px !important; margin-top: 47px !important; }
  .closing-logo { width: 180px !important; left: 0 !important; }

  /* Pills full-ish width and tappable. */
  .pill { min-height: 46px !important; display: inline-flex !important;
          align-items: center !important; justify-content: center !important; }
  .intro .cta-center .pill { font-size: 14px !important; padding: 12px 28px !important; }
  .closing-cta .pill { font-size: 14px !important; padding: 12px 28px !important; }
  .avancer .cta-center .pill { width: auto !important; margin: 0 auto !important;
          padding-left: 34px !important; padding-right: 34px !important; }

  /* ---- 5. Footer stacks --------------------------------------*/
  .footer { padding: 34px 20px 26px !important; }
  .footer { margin-top: 28px !important; padding: 24px 20px 20px !important; background-image: url('assets/footer-full-mobile.png') !important; }
  .copyright { font-size: 11px !important; margin-top: 14px !important; }
  .legal-btn { font-size: 12px !important; margin-top: 16px !important; padding: 6px 16px !important; }
  .footer nav {
    flex-direction: column !important;
    gap: 12px !important;
    align-items: center !important;
  }
  .footer .nav a {
    font-size: 15px !important;
    letter-spacing: .02em !important;
    white-space: normal !important;
    text-align: center !important;
  }
  .footer .navdrop-panel { display: none !important; } /* no hover on touch */
  .footer .navdrop > a::after { display: none !important; }
  .footer .nav, .footer .topnav { display: none !important; }

  /* ---- Type scale for every non-index mobile page (index.html keeps its
     own sizes — it uses .hero, not .topbar, so it's unaffected here) --- */
  body:has(.topbar) .page-title,
  body:has(.topbar) h1 { font-size: 24px !important; }
  .page-title { font-size: 24px !important; } /* unscoped fallback: absent from index.html, safe everywhere else */

  body:has(.topbar) .subtitle,
  body:has(.topbar) .subhead,
  body:has(.topbar) .lead { font-size: 18px !important; }

  body:has(.topbar) .quote,
  body:has(.topbar) .narrative,
  body:has(.topbar) .explainer,
  body:has(.topbar) .footnote { font-size: 16px !important; }

  body:has(.topbar) .col,
  body:has(.topbar) .bio-text p,
  body:has(.topbar) p { font-size: 14px !important; }

  /* Qui je suis: bio heading on one line, circle-quote sized up 20% from the halved base (218px -> 262px) */
  .who { font-size: 18px !important; white-space: nowrap !important; }
  .circle-quote { width: 262px !important; height: 262px !important; }
  .circle-quote p { font-size: 12px !important; line-height: 1.3 !important; }

  /* ---- 6. Liste des formations page -------------------------- */
  .content { padding: 45px 22px 0 !important; }
  .upper { display: flex !important; flex-direction: column !important; }
  .coral {
    display: block !important; position: static !important; order: 3 !important;
    height: auto !important; width: 45% !important; max-width: 165px !important;
    margin: 32px auto 8px !important;
  }
  .sec-head { font-size: 18px !important; margin-bottom: 24px !important; }
  .sec + .sec { margin-top: 48px !important; }
  ul.flist li { font-size: 14px !important; }
  .lower { margin-top: 48px !important; }
  .lower .intro-note { font-size: 14px !important; }
  .cta { margin: 56px 0 64px !important; }

  /* ---- 7. Trauma "manifestations" diagram ---------------------
     Desktop radiates 6 text columns around a jellyfish via
     absolute px offsets sized for a 1200px canvas. Scale the whole
     cluster down as one unit so the drawing + radiating text keep
     their exact relative composition, just smaller. */
  .manifest { width: auto !important; height: auto !important; padding: 32px 0 64px !important; margin: 0 !important; overflow: hidden !important; }
  .stage > section.manifest { padding-left: 2.2px !important; padding-right: 2.2px !important; }
  .manifest-shape-img { width: 200% !important; max-width: 200% !important; }
  .diagram-scale { position: relative; width: 100%; height: 320px; overflow: hidden; }
  .diagram {
    width: 1200px !important; max-width: none !important; min-height: 980px !important;
    margin: 38px 0 0 !important; position: absolute !important; left: 50% !important; top: 0 !important;
    transform: translateX(-50%) scale(0.315) !important;
    transform-origin: top center !important;
  }
  .manifest-note { font-size: 15px !important; line-height: 1.6 !important; margin: 24px auto 0 !important; }
  .manifest-link { font-size: 14px !important; }

  /* =========================================================
     MOBILE BAR + SLIDE-IN MENU  (built by mobile.js)
     ========================================================= */
  .m-bar {
    display: flex !important;
    position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
    align-items: center; gap: 12px;
    height: 62px; padding: 0 16px;
    background: url('assets/header.png') center top / cover no-repeat, rgba(248, 252, 254, .92);
    box-shadow: 0 2px 14px rgba(46, 110, 112, .12);
  }
  .m-bar__logo { height: 38px; width: auto; display: block; }
  .m-bar__name {
    display: flex; flex-direction: column; justify-content: center;
    gap: 1px; line-height: 1.05; margin-right: auto; min-width: 0;
  }
  .m-bar__brand {
    font-family: 'Playfair Display', Georgia, serif; font-weight: 600;
    font-size: 15px; color: #4c4c4c; letter-spacing: .01em; white-space: nowrap;
  }
  .m-bar__role {
    font-family: 'Playfair Display SC', 'Playfair Display', Georgia, serif;
    text-transform: uppercase; font-size: 9.5px; letter-spacing: .05em;
    color: #4c4c4c; white-space: nowrap; margin-top: 3px;
  }
  .m-bar__tagline {
    font-family: 'Playfair Display', Georgia, serif; font-style: italic;
    font-size: 9px; color: #6b7a7a; white-space: nowrap; margin-top: 2px;
  }
  .m-lang { display: flex; align-items: baseline; gap: 7px;
    font-family: 'Playfair Display', Georgia, serif; font-size: 15px;
    letter-spacing: .04em; }
  .m-lang button {
    border: none; background: transparent; cursor: pointer; padding: 2px 0;
    font: inherit; letter-spacing: inherit; text-transform: uppercase;
    color: rgba(76, 76, 76, .42); border-bottom: 1.5px solid transparent;
  }
  .m-lang button.active { color: #4c4c4c; border-bottom-color: currentColor; }
  .m-lang .m-sep { color: rgba(76, 76, 76, .35); }

  .m-burger {
    width: 42px; height: 42px; flex: 0 0 42px; border: none; background: transparent;
    cursor: pointer; position: relative; -webkit-tap-highlight-color: transparent;
  }
  .m-burger span {
    position: absolute; left: 9px; right: 9px; height: 2px; border-radius: 2px;
    background: #3f7380; transition: transform .3s ease, opacity .2s ease;
  }
  .m-burger span:nth-child(1) { top: 14px; }
  .m-burger span:nth-child(2) { top: 20px; }
  .m-burger span:nth-child(3) { top: 26px; }
  body.m-open .m-burger span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
  body.m-open .m-burger span:nth-child(2) { opacity: 0; }
  body.m-open .m-burger span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

  .m-scrim {
    display: block !important;
    position: fixed; inset: 0; z-index: 998;
    background: rgba(30, 55, 58, .38);
    opacity: 0; visibility: hidden; transition: opacity .3s ease, visibility .3s ease;
  }
  body.m-open .m-scrim { opacity: 1; visibility: visible; }

  .m-menu {
    display: flex !important; flex-direction: column;
    position: fixed; top: 0; right: 0; z-index: 999;
    width: min(86vw, 360px); height: 100%;
    background: #f8fcfe; box-shadow: -8px 0 34px rgba(46, 110, 112, .22);
    padding: 78px 0 32px; overflow-y: auto;
    transform: translateX(100%); transition: transform .34s cubic-bezier(.2,.7,.3,1);
  }
  body.m-open .m-menu { transform: translateX(0); }

  .m-menu a, .m-group__label {
    font-family: 'Playfair Display SC', 'Playfair Display', Georgia, serif;
    text-transform: uppercase; letter-spacing: .03em;
    color: #3d5556; text-decoration: none;
  }
  .m-menu > a, .m-group__label {
    display: flex; align-items: center; justify-content: space-between;
    font-size: 15px; padding: 15px 26px; line-height: 1.3;
  }
  .m-menu > a { border-bottom: 1px solid rgba(63, 115, 128, .12); }
  .m-group { border-bottom: 1px solid rgba(63, 115, 128, .12); }
  .m-group__label { cursor: pointer; width: 100%; background: none; border: none; text-align: left; }
  .m-group__label::after {
    content: ''; width: 7px; height: 7px; margin-left: 10px; flex: 0 0 auto;
    border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
    transform: rotate(45deg); transition: transform .28s ease; opacity: .5;
  }
  .m-group.open .m-group__label::after { transform: rotate(-135deg); }
  .m-group__panel {
    max-height: 0; overflow: hidden; transition: max-height .34s ease;
    background: #eef7f7;
  }
  .m-group.open .m-group__panel { max-height: 420px; }
  .m-group__panel a {
    display: block; font-size: 13px; padding: 13px 26px 13px 34px;
    color: #446; letter-spacing: .02em; line-height: 1.4;
    border-top: 1px solid rgba(63, 115, 128, .08);
  }
  .m-menu .m-cta {
    margin: 22px 26px 0; padding: 15px 20px; border-radius: 9999px;
    background: #4c4c4c; color: #fff; text-align: center; justify-content: center;
    font-family: 'Playfair Display', Georgia, serif; text-transform: none; letter-spacing: normal;
  }

  /* ---- Trauma "non resolu" circle + text block: stack on mobile,
     desktop uses a fixed-width flex row with no wrap ---------- */
  .resolu-grid { flex-direction: column !important; gap: 32px !important; margin-top: 24px !important; }
  .resolu-circle { flex: 0 0 auto !important; width: 260px !important; height: 260px !important; margin: 0 auto !important; }
  .resolu-circle p { font-size: 15px !important; max-width: 200px !important; }
  .resolu-text { flex: 1 1 auto !important; width: 100% !important; padding-top: 0 !important; }

  /* ---- Epreuves de vie "why" grid: stack on mobile; desktop is a
     fixed 2-column grid with a fixed-height card, no wrap -------- */
  .why-grid { grid-template-columns: 1fr !important; gap: 32px !important; }
  .why-card { height: auto !important; width: 100% !important; transform: none !important; padding: 26px 30px !important; }

  /* ---- Expatriation "3 dimensions" blobs: fixed px fonts inside a
     26%-wide blob don't shrink with it -------------------------- */
  .blob { width: 30% !important; }
  .blob .bt { font-size: 10px !important; line-height: 1.15 !important; }
  .blob .bd { font-size: 8.5px !important; line-height: 1.25 !important; margin-top: 6px !important; }
  html:not([lang="en"]) .blob.b1 .bt,
  html:not([lang="en"]) .blob.b1 .bd { transform: translateX(6px) !important; }

  /* Expatriation "choc culturel": fixed 2-column flex row, no wrap */
  .choc-grid { flex-direction: column !important; gap: 32px !important; }
  .choc-grid .txt { width: 100% !important; max-width: 100% !important; }
  .quote-box { width: 100% !important; max-width: 100% !important; margin-top: 0 !important; }

  .dims-sub { white-space: normal !important; max-width: 90% !important; margin-left: auto !important; margin-right: auto !important; }
}
