/* ============================================================================================================
   PHONE LAYER  (<= 575.98px)  — loaded after every other public stylesheet.

   Why this file exists: responsive.css grew one phone model at a time (min-device-width + pixel-ratio queries),
   so layouts depended on the exact phone and broke on the sizes in between: the menu button fell off the right
   edge on every phone from 240 to 402px wide, text logos could not shrink, and the hero/headings had no room at
   240-340px. These rules are WIDTH-based (fluid units, clamp(), wrapping), never device-based, and only apply
   below 576px, so tablets and desktops are untouched.

   Covered widths (CSS px): 240 · 320 · 344 · 360 · 375 · 384 · 390 · 393 · 402 · 411-414 · 420 · 427-430 ·
   440 · 448 · 480 · 540.
   Page-specific blocks are scoped with body.page-home (set by the page through @section('body_class')).
   ============================================================================================================ */

@media (max-width: 575.98px) {

    /* ── Header ───────────────────────────────────────────────────────────────────────────────────────────
       The logo used to be flex-shrink:0 and 199px wide, so logo + cart + Sign in + menu needed ~405px.
       Now the brand takes whatever is left (text wraps to two lines, an image logo keeps its size) and the
       buttons keep a 44px touch size. */
    body .kalon-navbar-inner {
        padding: 0 12px !important;
        gap: 8px !important;
    }

    body .kalon-logo {
        flex: 1 1 0 !important;
        min-width: 0 !important;
    }

    body .kalon-logo .site-logo-text {
        display: -webkit-box !important;
        -webkit-box-orient: vertical !important;
        -webkit-line-clamp: 2 !important;
        overflow: hidden !important;
        white-space: normal !important;
        overflow-wrap: anywhere !important;
        line-height: 1.12 !important;
        font-size: clamp(15px, 4.6vw, 20px) !important;
    }

    body .kalon-logo img {
        flex: none !important;
    }

    body .kalon-mob-right {
        flex: none !important;
        gap: 4px !important;
    }

    body .kalon-mob-right .kalon-cart-btn {
        width: 44px !important;
        height: 44px !important;
        min-width: 44px !important;
    }

    body .kalon-signin-btn {
        min-height: 40px !important;
        padding: 0 12px !important;
        font-size: 13px !important;
        letter-spacing: 0 !important;
    }

    body .kalon-ham-btn,
    body .kalon-x-btn {
        width: 44px !important;
        height: 44px !important;
        flex: none !important;
    }

    body .kalon-ham-btn span {
        width: 20px !important;
    }
}

/* Under ~340px the Sign in pill would squeeze the brand to nothing; the same link is the first entry of the menu. */
@media (max-width: 339.98px) {
    body .kalon-mob-right .kalon-signin-btn {
        display: none !important;
    }
}

/* ── Mobile menu: the closed panel is parked above the screen by a percentage of its OWN height (-110%), which
      is not enough on a short screen (a 320px-tall phone, or any phone turned sideways) — the last links of the
      closed menu showed through the transparent header. Park it a full header-height further, and keep it out
      of the tab order while it is closed. ─────────────────────────────────────────────────────────────────── */
@media (max-width: 991.98px) {
    body .kalon-mob-menu {
        transform: translateY(calc(-100% - 80px)) !important;
        visibility: hidden !important;
        transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1), visibility 0s linear 0.28s !important;
    }

    body .kalon-mob-menu.kalon-menu-open {
        transform: translateY(0) !important;
        visibility: visible !important;
        transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1), visibility 0s !important;
    }
}

@media (max-width: 575.98px) {

    /* ── Touch targets (44px is Apple's and WCAG 2.5.5's size; 40px for the Sign in pill) ───────────────── */
    body .kalon-logo {
        min-height: 44px !important;
    }

    body .btn-primary-custom,
    body .book-btn,
    body .events-btn,
    body .mobile-hero-btn {
        min-height: 44px !important;
    }

    body .sfc-head,
    body .sfc-sub {
        display: block !important;
        padding: 10px 0 !important;
    }

    /* ── Never let a heading, button or paragraph be wider than its box ─────────────────────────────────── */
    body .container,
    body .container-fluid {
        padding-left: 16px !important;
        padding-right: 16px !important;
    }

    body h1,
    body h2,
    body h3,
    body h4,
    body h5,
    body .btn-primary-custom {
        overflow-wrap: anywhere !important;
    }
}

/* ============================================================================================================
   HOME PAGE
   ============================================================================================================ */
@media (max-width: 575.98px) {

    /* Hero: the old box was a fixed height with the text pushed down by a fixed margin, so at 240-340px wide the
       title (six or seven lines) ran out of the box and up behind the header. Now the box grows with the text,
       the text sits at the bottom, and a scrim keeps white text readable on any hero photo. */
    body.page-home .hero-section {
        height: auto !important;
        min-height: clamp(380px, 56vh, 520px) !important;
        display: flex !important;
        align-items: flex-end !important;
    }

    body.page-home .hero-section > .container {
        padding: 96px 16px 24px !important;
        max-width: 100% !important;
    }

    body.page-home .hero-section .mt-350px {
        margin-top: 0 !important;
        padding: 0 12px !important;   /* row gutter -12 + container 16 + 12 = the same 16px edge as the sections below */
    }

    body.page-home .hero-section .hero-overlay {
        background: linear-gradient(180deg, rgba(0, 0, 0, 0) 25%, rgba(0, 0, 0, 0.62) 100%) !important;
    }

    body.page-home .hero-subtitle {
        font-size: clamp(12px, 3.6vw, 16px) !important;
        letter-spacing: 0.04em !important;
        text-shadow: 0 1px 10px rgba(0, 0, 0, 0.35) !important;
    }

    body.page-home .hero-title {
        font-size: clamp(21px, 7.6vw, 34px) !important;
        line-height: 1.12 !important;
        overflow-wrap: anywhere !important;
        text-shadow: 0 1px 14px rgba(0, 0, 0, 0.4) !important;
    }

    body.page-home .mobile-hero-btns {
        padding: 12px 16px !important;
    }

    body.page-home .mobile-hero-btn {
        font-size: 14px !important;
        width: 100% !important;
    }

    /* Brand heading: it was one line with an ellipsis ("Medspa Kalon …"); let the name wrap. */
    body.page-home .brand-intro .text-start h2 {
        white-space: normal !important;
        overflow: visible !important;
        text-overflow: clip !important;
        overflow-wrap: anywhere !important;
        font-size: clamp(20px, 6.6vw, 28px) !important;
        line-height: 1.15 !important;
    }

    /* Featured: its header row (title + button) must stack when there is no room for both. */
    body.page-home .featured-section .container > .row:first-child {
        display: flex !important;
        flex-wrap: wrap !important;
        align-items: center !important;
        gap: 10px !important;
        margin-left: 0 !important;      /* the row's own -12px gutter pulled the heading to 4px from the screen edge */
        margin-right: 0 !important;
    }

    /* The cards are a swipe row (scroll-snap): keep the same 16px left edge as the rest of the page when it rests at the start. */
    body.page-home .featured-section .row.g-4 {
        padding-left: 10px !important;
        padding-right: 10px !important;
        scroll-padding-left: 10px !important;
        scroll-padding-right: 10px !important;
    }

    body.page-home .featured-section .btn-primary-custom {
        font-size: 14px !important;
    }

    body.page-home .featured-section .container > .row:first-child > [class*="col-"] {
        flex: 1 1 auto !important;
        width: auto !important;
        max-width: 100% !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
        text-align: left !important;
    }

    /* Text that was 10-11px */
    body.page-home .featured-card .row.g-0 {
        height: auto !important;
        min-height: 130px !important;
    }

    body.page-home .featured-section .container > .row:first-child .col-lg-5.text-end .btn-primary-custom {
        font-size: 14px !important;
    }

    body.page-home .featured-card p.text-muted.small {
        font-size: 12px !important;
        line-height: 1.4 !important;
    }

    body.page-home .featured-card h5 {
        font-size: 14px !important;
    }

    /* Not home-only: About Us uses the same before/after component. */
    body .before-after-card p {
        font-size: 12.5px !important;
        line-height: 1.4 !important;
    }

    body .before-after-card h4 {
        font-size: 14px !important;
    }
}

/* ============================================================================================================
   FOOTER (every public page)
   ============================================================================================================ */
@media (max-width: 575.98px) {

    /* The brand name in the footer is a 26px text logo: wrap it instead of running out of the card. */
    body .sfc-logo-col .site-logo-text--footer {
        font-size: clamp(20px, 6.4vw, 26px) !important;
        overflow-wrap: anywhere !important;
    }

    /* Two link columns, side by side, each allowed to shrink; one column when two would not fit a word. */
    body .sfc-nav {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 8px 16px !important;
    }

    body .sfc-nav-col {
        min-width: 0 !important;
    }

    body .sfc-head,
    body .sfc-sub {
        overflow-wrap: normal !important;
        word-break: normal !important;
        hyphens: manual !important;
    }

    /* The contact lines were indented 24px (room for icons that are not drawn). */
    body .sfc-contact,
    body .sfc-contact a {
        margin-left: 0 !important;
        padding-left: 0 !important;
        overflow-wrap: anywhere !important;
    }
}

@media (max-width: 359.98px) {
    body .sfc-nav {
        grid-template-columns: minmax(0, 1fr) !important;
    }
}

/* ============================================================================================================
   FIXED LAYERS (home): the "Book" bar sits at the bottom edge of the screen. The cookie notice (first visit only)
   takes its place until Accept, and the back-to-top button is lifted above the bar.
   ============================================================================================================ */
@media (max-width: 767.98px) {
    body.page-home {
        --mf-bar-h: calc(64px + env(safe-area-inset-bottom, 0px));
    }

    body.page-home .mobile-book-fixed {
        padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px)) !important;
    }

    /* First visit: the notice takes the Book bar's place (the bar is covered until Accept) instead of stacking on top of it,
       so the two never eat a third of a small screen together. */
    body.page-home .cookie-banner {
        bottom: 0 !important;
        z-index: 10000 !important;
    }

    body.page-home .back-to-top {
        bottom: calc(var(--mf-bar-h) + 16px) !important;
        right: 16px !important;
        width: 44px !important;
        height: 44px !important;
    }
}

@media (max-width: 575.98px) {

    /* Cookie notice: one slim row (text left, Accept right) so it stays out of the way; it stacks on very narrow screens. */
    body .cookie-banner {
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: 12px !important;
        padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px)) !important;
        max-height: 40vh !important;
        overflow-y: auto !important;
    }

    body .cookie-banner p {
        flex: 1 1 auto !important;
        min-width: 0 !important;
        font-size: 12px !important;
        line-height: 1.4 !important;
        margin: 0 !important;
        color: #3d4148 !important;
    }

    body .cookie-banner .accept-cookies {
        flex: 0 0 auto !important;
        width: auto !important;
        min-width: 76px !important;
        min-height: 44px !important;
        padding: 0 14px !important;
        font-size: 14px !important;
        white-space: nowrap !important;
    }

    /* The always-visible bar already carries the Book button; the extra inline copy under the hero is a duplicate. */
    body.page-home .mobile-hero-btns {
        display: none !important;
    }
}

/* ============================================================================================================
   TAP TARGETS (footer + cart drawer): at least 40-44px of touchable area, same look
   ============================================================================================================ */
@media (max-width: 575.98px) {
    body .sfc-contact {
        gap: 0 !important;
        max-width: none !important;
        margin-right: 0 !important;
    }

    body .sfc-contact a,
    body .sfc-policy a {
        display: inline-flex !important;
        align-items: center !important;
        min-height: 40px !important;
    }

    body .sfc-policy {
        gap: 0 20px !important;
    }

    body .sfc-soc-btn {
        width: 44px !important;
        height: 44px !important;
    }

    body .sfc-socials {
        gap: 6px !important;
    }

    body .sfc-badge {
        height: 44px !important;
    }

    body .shop-drawer-close {
        width: 44px !important;
        height: 44px !important;
    }
}

@media (max-width: 299.98px) {
    body .cookie-banner {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 8px !important;
    }

    body .cookie-banner .accept-cookies {
        width: 100% !important;
    }
}

/* ============================================================================================================
   PHASE 1 — MAIN PAGES (About, Treatments, Packages, Membership, Gift Cards, Rewards, Gallery, Reviews, Blog,
   Locations, Contact Us, Help Center, Mobile App). No page in this phase has horizontal overflow, stuck-out
   elements or clipped text at any tested width (240-540px) — the harness only flagged tap-target sizing and a
   few small-caps "eyebrow" labels a point or two under 12px. Decorative/aria-hidden illustrations (the Rewards
   example card, the Mobile App phone mock-up) are left at their design size on purpose.
   ============================================================================================================ */
@media (max-width: 575.98px) {

    /* Breadcrumb "Home" link: the same pattern on the gift-cards / rewards / gallery / reviews / blog / app pages. */
    .gc-breadcrumbs a, .rw-breadcrumbs a, .gl-breadcrumbs a, .rv-breadcrumbs a, .bg-breadcrumbs a, .ap-breadcrumbs a {
        display: inline-flex !important;
        align-items: center !important;
        min-height: 40px !important;
        padding: 0 4px 0 0 !important;
        min-width: 40px !important;
    }

    /* Small-caps "eyebrow" / badge labels: a deliberate design pattern, just a point or two under 12px. */
    .pkg-category, .pkg-includes-label, .pkg-banner-eyebrow, .pkg-tier, .pkg-price-note,
    .gc-tile-label, .gc-tile-note, .gc-badge-gift, .gc-eyebrow,
    .loc-hero-eyebrow, .loc-hero-stat-label, .loc-item-open, .events-eyebrow,
    .hero-eyebrow, .hero-stat-label, .section-eyebrow,
    .card-img-badge, .card-plan-label, .card-ribbon, .perks-label,
    .hstat-l, .hero-vert-lbl, .hero-scroll-ind,
    .t-card-meta-item, .gc-saving-pill .lbl {
        font-size: 12px !important;
    }

    /* Treatments: the sticky mobile category-filter pills. */
    body .mob-pill {
        min-height: 40px !important;
    }

    /* Contact Us: topic pills, social icons, and the phone/email/location links in the info cards. */
    body .tpill {
        min-height: 40px !important;
    }
    body .h-slink {
        width: 40px !important;
        height: 40px !important;
    }
    body .icard-v a, body .icard-s a, body .hours-card .hday a {
        display: inline-flex !important;
        align-items: center !important;
        min-height: 40px !important;
    }

    /* Membership: the phone number in the closing CTA band. */
    body .cta-phone a {
        display: inline-flex !important;
        align-items: center !important;
        min-height: 40px !important;
    }

    /* Locations: the phone/email pills (and the link inside, which is the part that actually has to be tapped)
       and the Book button on each list item. */
    body .loc-item-meta-pill {
        min-height: 40px !important;
        padding: 0 10px !important;
        font-size: 12px !important;
    }
    body .loc-item-meta-pill a {
        display: inline-flex !important;
        align-items: center !important;
        min-height: 40px !important;
    }
    body .btn-loc-book {
        min-height: 40px !important;
    }

    /* Help Center: the on-page jump-nav pills, the social icons and the footer-style legal line. */
    body .hc-jump a {
        min-height: 40px !important;
    }
    body .hc-socials a {
        width: 40px !important;
        height: 40px !important;
    }
    body .hc-legal a {
        display: inline-flex !important;
        align-items: center !important;
        min-height: 40px !important;
    }

    /* Treatments: the closing CTA carries an inline 135px left padding (meant for the desktop two-column layout);
       on a stacked mobile column it leaves almost no room for the heading and button. */
    body .cta-content {
        padding-left: 0 !important;
    }
}

/* ============================================================================================================
   PHASE 2 — BOOKING (the wizard at /book and /book-appointments, and the older /book-appointment fork — both
   share booking.css's .bk-* classes, so one set of rules below covers both pages).
   ============================================================================================================ */
@media (max-width: 575.98px) {

    /* The page title + two-column grid (1fr 280px) + card both carried their desktop padding straight down to
       240px, leaving very little room for the date/time grids inside. */
    body .bk-page-heading {
        padding: 12px 12px 18px !important;
        margin-top: 76px !important;
    }

    body .bk-page-heading h1 {
        font-size: 24px !important;
    }

    body .bk-layout {
        padding: 0 12px !important;
        gap: 14px !important;
    }

    body .bk-card {
        padding: 16px !important;
    }

    /* The 4-step stepper has no narrow-width rule at all: 4 labelled steps plus 3 70px connectors do not fit in
       240-540px. Letting it scroll horizontally keeps every step reachable instead of the later ones being cut
       off by the page's own overflow-x:hidden. */
    body .bk-stepper {
        justify-content: flex-start !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        padding: 0 12px 6px !important;
        margin-bottom: 18px !important;
    }

    body .bk-step-connector {
        width: 34px !important;
        margin: 0 2px 22px !important;
    }

    body .bk-step-label {
        font-size: 12px !important;
    }

    /* Branch card icon + text: stop the circle eating a third of the row on the narrowest phones. */
    body .bk-branch-card {
        padding: 14px !important;
        gap: 12px !important;
    }

    body .bk-sec-title {
        font-size: 16px !important;
    }
}

/* ============================================================================================================
   PHASE 3 — SHOP. shop/_header.blade.php (More menu, Sign in, cart) and shop/_card.blade.php (the wishlist
   heart) are shared across every shop page, so these rules reach all of them, not just Products.
   ============================================================================================================ */
@media (max-width: 575.98px) {

    /* Shop header: the "More" menu trigger and the Sign in / cart buttons were a few px under 40. */
    body .shop-header .nav-more-btn {
        min-height: 40px !important;
    }

    body .shop-header .btn-signin {
        min-height: 40px !important;
    }

    /* Wishlist heart on every product card. */
    body .p-heart {
        width: 40px !important;
        height: 40px !important;
    }

    body .p-heart-inline {
        width: 40px !important;
        height: 40px !important;
    }

    /* Product-card badges ("Best Seller" / "New" / "Sale"): small-caps labels under 12px. */
    body .p-badge {
        font-size: 12px !important;
    }

    /* Product detail: the breadcrumb trail and the Description/FAQ/Reviews/Q&A tab row. */
    body .shop-crumbs a {
        display: inline-flex !important;
        align-items: center !important;
        min-height: 40px !important;
    }

    body .tab-btn-cyan {
        min-width: 40px !important;
        min-height: 40px !important;
    }
}

/* ============================================================================================================
   PHASE 3 — SHOP, part 2: checkout, quiz/report forms, kits, For You, cart lookup/subscription pages.
   ============================================================================================================ */
@media (max-width: 575.98px) {

    /* The shop header's own "Medical Aesthetics" tagline (shown while the clinic has not uploaded a logo). */
    body .nav-logo-text span {
        font-size: 12px !important;
    }

    /* Checkout: "Back to Cart". */
    body .checkout-back-link {
        display: inline-flex !important;
        align-items: center !important;
        min-height: 40px !important;
    }

    /* The shared date-picker button (report-reaction and elsewhere on the public site). Checkboxes on the
       quiz and report-reaction forms are not listed here: every one is wrapped in a <label> that is itself
       the full tap target, text included, so the native 17px box is not the real usability surface. */
    body .sh-dp-btn {
        min-height: 40px !important;
    }

    /* Product card category label ("SERUM"), the name link and the overlay "Add to Cart" button. */
    body .p-card-category {
        font-size: 12px !important;
    }
    body .p-card-name {
        min-height: 40px !important;
    }
    body .p-overlay-btn-cart {
        min-height: 40px !important;
    }

    /* Kit page: each included product's name link. */
    body .kit-item-link {
        display: inline-flex !important;
        align-items: center !important;
        min-height: 40px !important;
    }
}

/* ============================================================================================================
   PHASE 3 — SHOP, part 3: product detail quantity stepper + report-reaction link; cart sidebar suggestions.
   ============================================================================================================ */
@media (max-width: 575.98px) {

    body .qty-btn {
        width: 40px !important;
        height: 40px !important;
    }
    body .qty-input {
        min-height: 40px !important;
    }
    body .report-reaction {
        display: inline-flex !important;
        align-items: center !important;
        min-height: 40px !important;
    }

    /* Cart: the cross-sell sidebar ("you might also like") and the back-to-shopping link. */
    body .cart-back-link {
        display: inline-flex !important;
        align-items: center !important;
        min-height: 40px !important;
    }
    body .sidebar-product-content p {
        font-size: 12px !important;
    }
    body .sidebar-order-btn {
        min-height: 40px !important;
        font-size: 12px !important;
    }
}

/* ============================================================================================================
   PHASE 3 — SHOP, part 4: order confirmation (success.blade.php) and order tracking (order.blade.php) —
   both built from the same success.css component classes.
   ============================================================================================================ */
@media (max-width: 575.98px) {

    body .order-success-back {
        min-height: 40px !important;
    }
    body .order-number-box span {
        font-size: 12px !important;
    }
    body .order-success-email {
        font-size: 12px !important;
    }
    body .order-success-btn {
        min-height: 44px !important;
        height: auto !important;
    }
    body .order-success-product-info p,
    body .order-success-product-info strong {
        font-size: 12px !important;
    }
}

/* ============================================================================================================
   PHASE 1 FOLLOW-UP — Blog post detail (the single-post template, not swept with the listing page since it
   needs a real slug): category tag and the "All articles" back link.
   ============================================================================================================ */
@media (max-width: 575.98px) {
    body .bg-cat {
        display: inline-flex !important;
        align-items: center !important;
        min-height: 40px !important;
    }
    body .bg-back {
        display: inline-flex !important;
        align-items: center !important;
        min-height: 40px !important;
    }
}

/* ============================================================================================================
   PHASE 1 FOLLOW-UP — Blog listing cards: the title link and the "Read article" CTA (only exercised once a
   real post exists to render a card — the empty state has neither).
   ============================================================================================================ */
@media (max-width: 575.98px) {
    body .bg-card h3 a {
        display: inline-flex !important;
        align-items: center !important;
        min-height: 40px !important;
    }
    body .bg-more {
        display: inline-flex !important;
        align-items: center !important;
        min-height: 40px !important;
    }
}

/* ============================================================================================================
   PHASE 1 FOLLOW-UP — Gallery and Reviews: re-tested with real rows (the Phase 1 sweep ran against an empty
   gallery/review set, so this card and before/after-slider markup was never actually exercised).
   ============================================================================================================ */
@media (max-width: 575.98px) {
    body .gl-stat span {
        font-size: 12px !important;
    }
    body .gl-cat {
        font-size: 12px !important;
    }
    body .gl-pill {
        font-size: 12px !important;
    }
    body .gl-expand {
        width: 40px !important;
        height: 40px !important;
    }
}

@media (max-width: 575.98px) {
    body .rv-src {
        font-size: 12px !important;
    }
}
