/* =====================================================================
   LAYOUT ALIGNMENT + HERO FIRST FOLD
   ---------------------------------------------------------------------
   Loaded after assets/css/style.css (see functions.php). Nothing in
   style.css was removed; these rules only override it.

   Mobile (<= 768px) is NOT touched by this file, except
   `.hero-right > picture` (a no-op wrapper for the signature WebP).

   HOW IT WORKS
   1. --site-gutter is the empty space left/right of the floating header
      on tablet and desktop.
   2. The header bar AND every section container use the same width:
         min(--container-width, 100% - 2 * --site-gutter)
      so content starts exactly under the header's left edge and ends
      under its right edge, at every screen size.
   3. Carousels / scrolling strips are not constrained (they may run
      past the container edges), see "FULL-BLEED EXCEPTIONS".

   To add a new section: give its wrapper one of the container classes
   below (e.g. .container) or add the class to the list.
   ===================================================================== */

:root {
  --site-gutter: clamp(24px, 4vw, 64px);
  --site-width: min(var(--container-width), 100% - (2 * var(--site-gutter)));
}

/* Signature WebP is wrapped in <picture> (page-home.php); keep the img
   laid out exactly as before by removing the wrapper's own box. */
.hero-right > picture { display: contents; }


/* =====================================================================
   TABLET + DESKTOP (769px and up)
   ===================================================================== */
@media (min-width: 769px) {

  /* ---------- HEADER: floating glass bar with side gutters ---------- */
  .header-wrap {
    padding-inline: var(--site-gutter);
  }
  .header-inner {
    width: 100%;
    max-width: var(--container-width);
    margin-inline: auto;
  }

  /* ---------- SECTION CONTAINERS: same edges as the header ---------- */
  .container,
  .expect-section .container,
  .hero-inner,
  .obesity-inner,
  .bariatric-container,
  .procedures-container,
  .post-surgery-container,
  .faq-container,
  .bd-call-wrap,
  .inner-hero-container,
  .obesity-info-container,
  .eligibility-container,
  .journey-container,
  .benefits-container,
  .risks-container,
  .recovery-container,
  .transformations-container,
  .surgeon-container,
  .dr-hero-container,
  .philosophy-container,
  .container-1400,
  .experience-container,
  .hospital-container,
  .heal-eazy-container,
  .doctor-message-container,
  .consultation-container,
  .why-consult-container,
  .wellness-container,
  .consult-steps-container,
  .diet-guidelines-container,
  .support-reminder-container,
  .wps-container,
  .resource-container,
  .faq-main-container,
  .rp-container {
    box-sizing: border-box;
    width: var(--site-width);
    max-width: none;
    margin-left: auto;
    margin-right: auto;
    padding-left: 0;
    padding-right: 0;
  }

  /* A container inside another container just fills its parent
     (e.g. the education carousel wraps a second .container). */
  .container .container,
  .container .rp-container {
    width: 100%;
  }

  /* Sections that added their own side padding around a container:
     the container now handles the gutter, so drop the extra padding. */
  .bd-call-section,
  .philosophy-section,
  .hospital-affiliations,
  .heal-eazy-section,
  .doctor-message-section,
  .wellness-info-section,
  .support-reminder-section,
  .consultation-section,
  .wps-patient-section,
  .resource-section,
  .faq-main-section,
  .bmi-section,
  .diet-guidelines-section {
    padding-left: 0;
    padding-right: 0;
  }

  /* Inner wrappers that pushed content in from the container edge */
  .faq-content-wrapper {
    padding-left: 0;
    padding-right: 0;
  }
  .faq-items-column {
    margin-left: 0;
  }

  /* ---------- FULL-BLEED EXCEPTIONS (allowed past the edges) ---------- */
  /* The education carousel's side slides may overflow the container;
     clip at the viewport so it never causes a horizontal scrollbar. */
  .education-section,
  .transformations-section,
  .philosophy-section {   /* image glow (::before, inset -40px) */
    overflow-x: clip;
  }
}


/* =====================================================================
   CONTENT THAT USED TO RUN PAST THE CONTAINER EDGE (desktop)
   ===================================================================== */
@media (min-width: 1024px) {
  /* Home "What to expect": 5 steps in a row could not shrink below their
     text width, so the last step ran past the right edge at ~1024-1100px */
  .expect-timeline { gap: clamp(16px, 2.6vw, 40px); }
  .timeline-step   { min-width: 0; }
}

@media (min-width: 1025px) {
  /* Diet page wellness row (reverse): the fixed 733px image column squeezed
     the text to ~230px and pushed it past the edge below ~1300px screens.
     52.4% of the 1400px container = 733px, so large screens look the same. */
  .wellness-row.reverse { grid-template-columns: minmax(0, min(733px, 52.4%)) minmax(0, 1fr); }
}

@media (min-width: 1201px) {
  /* Contact page: the 687px glass form forced its grid column wider than
     half the container (20-40px overflow at 1201-1440px). minmax(0, 1fr)
     keeps both columns inside; the form keeps max-width 687px. */
  .consultation-container { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .consultation-form-glass { height: auto; min-height: 733px; }
}


/* =====================================================================
   DESKTOP HEADER: menu items always on ONE line, always inside the bar
   ---------------------------------------------------------------------
   From 1024px to 1680px the font sizes and spacing scale smoothly with
   the screen width (1024px = smallest values, 1680px = original design
   values), so the menu fits inside the bar at every desktop width and
   browser zoom level. Below 1024px the hamburger menu takes over.
   ===================================================================== */
@media (min-width: 1024px) {
  .main-nav a,
  .nav-parent,
  .header-cta {
    white-space: nowrap;
  }
  .logo,
  .header-cta,
  .nav-divider {
    flex-shrink: 0;
  }
}

@media (min-width: 1024px) and (max-width: 1680px) {
  .header-inner {
    gap: clamp(14px, 3.354vw - 20.3px, 36px);
    padding: 0 clamp(16px, 3.05vw - 15.2px, 36px);
  }
  .main-nav {
    gap: clamp(18px, 4.116vw - 24.15px, 45px);
    margin-left: clamp(16px, 12.8vw - 115.1px, 100px);
  }
  .main-nav a {
    font-size: clamp(13px, 0.457vw + 8.32px, 16px);
  }
  .header-cta {
    font-size: clamp(14px, 0.61vw + 7.76px, 18px);
  }
}

/* Short screens / zoomed-in browsers: slimmer header leaves room for the hero */
@media (min-width: 769px) and (max-height: 640px) {
  .site-header { padding: 12px 0; }
  .header-inner,
  .site-header.scrolled .header-inner { height: 64px; }
}


/* =====================================================================
   HOME HERO — FITS THE FIRST FOLD ON EVERY DESKTOP SCREEN (1024px+)
   and on landscape tablets / phones (769px+ wide, landscape).
   (769px+ with max-height <= 760px can only be landscape, so the
   short-screen queries below also cover landscape phones.)
   ---------------------------------------------------------------------
   The hero is exactly one screen tall. The doctor photo scales with the
   screen height and sits on the bottom edge (overlapping the blue strip,
   as in the original design); stats + button are centred in the space
   above the strip.
   ===================================================================== */
@media (min-width: 1024px), (min-width: 769px) and (orientation: landscape) {
  .hero {
    --hero-top: clamp(104px, 15vh, 170px);  /* space under the fixed header */
    --hero-strip-h: 106px;                   /* height of the blue strip      */

    display: flex;
    flex-direction: column;
    /* exactly one screen; no min-height so the blue strip stays in view
       even on short / zoomed-in browser windows */
    height: 100vh;
    height: 100svh;
    min-height: 0;
    padding-top: var(--hero-top);
    padding-bottom: 0;
  }

  .hero-inner {
    flex: 1 1 auto;
    min-height: 0;
    align-items: stretch;
    gap: clamp(24px, 3vw, 64px);
  }

  /* Doctor photo: height follows the screen, never upscaled past its file size */
  .hero-left {
    flex: 0 0 auto;
    display: flex;
    align-items: flex-end;
    min-height: 0;
    max-width: 46%;   /* narrow-but-tall screens: leave room for the stats */
  }
  .hero-left img {
    width: auto;
    height: 100%;
    max-width: 100%;
    max-height: 796px;
    margin-bottom: 0;
    object-fit: contain;
    object-position: bottom;
  }

  /* Right column: signature + stats + button, centred above the strip */
  .hero-right {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
    flex-direction: column;
    align-items: flex-start;
    justify-content: safe center;
    padding-bottom: var(--hero-strip-h);
  }
  .hero-bg-gif {
    position: relative;
    top: auto;
    right: auto;
    width: auto;
    height: clamp(150px, 30vh, 360px);
    max-width: 100%;
    object-fit: contain;
    /* the animation canvas has empty space round the signature: overlap it */
    margin: calc(clamp(150px, 30vh, 360px) * -0.12) 0 calc(clamp(150px, 30vh, 360px) * -0.22) calc(clamp(150px, 30vh, 360px) * -0.4);
  }
  .hero-content {
    padding: 0;
  }
  .hero-stats {
    margin-bottom: clamp(20px, 4vh, 40px);
    gap: clamp(16px, 2.6vw, 40px);
  }
  /* stats shrink with the screen width so the 3rd stat never runs off the edge */
  .stat span { font-size: clamp(24px, 2.4vw, 36px); }
  .stat p    { font-size: clamp(15px, 1.3vw, 20px); width: auto; max-width: 160px; }

  /* Blue strip pinned to the bottom of the first screen */
  .hero-strip-wrapper {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    margin-top: 0;
  }
}

/* Short laptop screens (e.g. 1366x650 browser area): tighten type a little */
@media (min-width: 769px) and (max-height: 760px) {
  .stat span { font-size: clamp(22px, min(2.4vw, 4.6vh), 36px); }
  .stat p    { font-size: clamp(14px, min(1.3vw, 2.5vh), 20px); margin-top: 4px; }
  .divider   { height: 52px; }
  .hero-btn  { min-height: 48px; padding: 12px 36px; }
}

/* Very short / zoomed-in windows: smaller strip and header gap so the
   doctor, stats, button AND the blue strip all stay on the first screen */
@media (min-width: 769px) and (max-height: 640px) {
  .hero {
    --hero-top: 88px;          /* slim header: 12px + 64px + gap */
    --hero-strip-h: 76px;
  }
  .hero-strip { padding: 16px 0; }
  .hero-strip span { font-size: 26px; }
  .hero-stats { gap: 24px; }
  .stat span { line-height: 1.1; }
  .divider   { height: 40px; }
  .hero-btn  { min-height: 42px; padding: 10px 30px; font-size: 15px; }
}

@media (min-width: 769px) and (max-height: 520px) {
  .hero-bg-gif { display: none; }  /* not enough height for the signature */
}

/* =====================================================================
   HOME HERO — PORTRAIT TABLETS (769px–1023px, portrait)
   Previously the desktop row layout squeezed the photo to a thumbnail
   and pushed the stats off screen. Same stacked order as mobile:
   photo, signature, stats, button, blue strip — scaled up for tablets.
   ===================================================================== */
@media (min-width: 769px) and (max-width: 1023px) and (orientation: portrait) {
  .hero {
    min-height: auto;
    padding-top: 108px;
    padding-bottom: 0;
  }
  .hero-inner {
    flex-direction: column;
    align-items: center;
    gap: 0;
  }
  .hero-left {
    order: 1;
    width: 100%;
    display: flex;
    justify-content: center;
  }
  .hero-left img {
    width: min(50%, 29svh);   /* photo size follows screen height */
    max-width: 420px;
    margin: 0;
  }
  .hero-right {
    order: 2;
    width: 100%;
    min-height: auto;
    flex-direction: column;
    align-items: center;
  }
  .hero-bg-gif {
    position: relative;
    top: auto;
    right: auto;
    width: 100%;
    max-width: min(460px, 40svh);
    margin: -24px auto -40px;
  }
  .hero-content {
    align-items: center;
    width: 100%;
    padding: 0 0 36px;
  }
  .hero-stats {
    justify-content: center;
    gap: 28px;
    margin-bottom: 32px;
  }
  .stat span { font-size: 30px; }
  .stat p    { font-size: 17px; width: auto; max-width: 160px; }
  .hero-btn  { align-self: center; }
  .hero-strip-wrapper { margin-top: 0; }
}

/* The signature animation's light background blends into the page
   (removes the faint rectangle round the WebP). */
.hero-bg-gif { mix-blend-mode: darken; }
