/* ==========================================================================
   Swan Diagnostics Ltd — Responsive Stylesheet
   Breakpoints: 1280 / 1100 / 960 (nav collapses) / 760 / 520
   ========================================================================== */

@media (max-width: 1280px) {
  .nav__link { padding: .6rem .6rem; font-size: .9rem; }
  .footer-grid { grid-template-columns: 1.4fr 1fr 1.1fr 1.3fr; }
  .footer-grid .footer-col--services { display: none; }
}

@media (max-width: 1100px) {
  .header-actions .btn-quote-text { display: none; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .hero__inner { grid-template-columns: 1fr; }
  .hero__cards { display: none; }
  .product-grid { grid-template-columns: repeat(2, 1fr); }
  .catalogue-layout { grid-template-columns: 240px 1fr; gap: 1.75rem; }
  .catalogue-grid { grid-template-columns: 1fr 1fr; }
  .supply-table .spec { display: none; }
  .cta-banner__inner { grid-template-columns: 1fr; }
  .cta-banner .btn-group { justify-content: flex-start; }
  .steps { grid-template-columns: repeat(2, 1fr); row-gap: 2.5rem; }
  .steps::before { display: none; }
  .media-frame__sub { right: -1rem; }
}

/* Navigation collapses ---------------------------------------------------- */
@media (max-width: 960px) {
  :root { --header-h: 72px; }
  .topbar { display: none; }
  .site-header { inset: 0 0 auto 0; }
  .hero, .page-hero { padding-top: calc(var(--header-h) + 3rem); }
  .brand img { height: 44px; }
  .site-header.is-scrolled .brand img { height: 42px; }
  .nav-toggle { display: grid; }
  .mobile-only { display: block; }

  .nav {
    position: fixed; inset: 0 0 0 auto; width: min(400px, 100%); height: 100dvh; z-index: 1200;
    background: #fff; flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 0;
    padding: 5.5rem 1.5rem 2rem; overflow-y: auto; transform: translateX(100%); visibility: hidden;
    transition: transform .55s var(--ease), visibility .55s; box-shadow: -30px 0 60px rgba(10, 25, 42, .2);
  }
  .nav.is-open { transform: none; visibility: visible; }
  /* The header is its own stacking context: lift it above the backdrop while the menu is open */
  .nav-open .site-header { z-index: 1300; backdrop-filter: none; }
  .nav-backdrop { position: fixed; inset: 0; background: rgba(10, 25, 42, .55); backdrop-filter: blur(3px); z-index: 1150; opacity: 0; visibility: hidden; transition: all .45s var(--ease); }
  .nav-backdrop.is-open { opacity: 1; visibility: visible; }
  .nav__close { position: absolute; top: 1.2rem; right: 1.2rem; width: 46px; height: 46px; border-radius: 12px; border: 1.5px solid var(--c-line); background: #fff; display: grid; place-items: center; color: var(--c-deep); }
  .nav__brand { position: absolute; top: 1.2rem; left: 1.5rem; }
  .nav__brand img { height: 42px; width: auto; }
  .nav__list { flex-direction: column; align-items: stretch; gap: 0; }
  .nav__item { border-bottom: 1px solid var(--c-line); opacity: 0; transform: translateX(24px); transition: opacity .4s var(--ease), transform .5s var(--ease); }
  .nav.is-open .nav__item { opacity: 1; transform: none; transition-delay: calc(var(--i, 0) * 55ms + 150ms); }
  .nav__link, .site-header .nav__link, .site-header.is-scrolled .nav__link { color: var(--c-ink); width: 100%; justify-content: space-between; padding: 1rem .25rem; font-size: 1.05rem; border-radius: 0; background: none !important; }
  .nav__link[aria-current="page"] { color: var(--c-blue) !important; }
  .dropdown {
    position: static; transform: none !important; opacity: 1; visibility: visible; box-shadow: none; border: 0; padding: 0 0 .5rem; min-width: 0;
    display: grid; grid-template-rows: 0fr; transition: grid-template-rows .45s var(--ease);
  }
  .dropdown > .dd-inner { overflow: hidden; }
  .nav__item.is-open > .dropdown { grid-template-rows: 1fr; }
  .nav__item:hover > .nav__link .icon { transform: none; }
  .nav__item.is-open > .nav__link .icon { transform: rotate(180deg); }
  .dropdown a { padding: .6rem .5rem; }
  .dropdown a small { display: none; }
  .nav__cta { margin-top: 1.75rem; display: grid; gap: .75rem; }
  .nav__contact { margin-top: 1.5rem; display: grid; gap: .6rem; font-size: .92rem; }
  .nav__contact a { display: inline-flex; align-items: center; gap: .6rem; color: var(--c-text); }
  .nav__contact .icon { color: var(--c-teal); }
  .header-actions .btn-quote { display: none; }

  .grid-3, .solution-grid { grid-template-columns: repeat(2, 1fr); }
  .split, .split--wide-left, .alt-row, .pd { grid-template-columns: 1fr; }
  .alt-row--reverse .alt-row__media { order: 0; }
  .media-frame { max-width: 560px; margin: 0 auto 2.5rem; width: 100%; }
  .media-frame__badge { left: -.5rem; }
  .cat-grid { grid-template-columns: repeat(2, 1fr); }
  .cat-card, .cat-card--wide { grid-column: span 1; }
  .cat-card--wide .cat-card__media { aspect-ratio: 16 / 10; }
  .cat-card:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .stats { grid-template-columns: repeat(2, 1fr); row-gap: 2rem; }
  .stat:nth-child(3)::before { display: none; }
  .catalogue-layout { grid-template-columns: 1fr; }
  .catalogue-sidebar { position: static; }
  .catalogue-sidebar .side-panel--cta { display: none; }
  .side-filter { display: flex; flex-wrap: wrap; gap: .4rem; }
  .side-filter button { width: auto; border: 1.5px solid var(--c-line); border-radius: 999px; padding: .45rem .85rem; font-size: .85rem; }
  .pd__gallery { position: static; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-brand { grid-column: 1 / -1; }
  .map-frame { aspect-ratio: 16 / 9; }
  .sub-nav { top: 72px; }
}

@media (max-width: 760px) {
  .grid-2, .grid-3, .grid-4, .solution-grid, .product-grid, .catalogue-grid, .mv-grid { grid-template-columns: 1fr; }
  .value-strip { margin-top: -3rem; }
  .value-strip .grid-4 { grid-template-columns: 1fr 1fr; gap: 1rem; }
  .value-card { padding: 1.5rem 1.25rem; }
  .cat-grid { grid-template-columns: 1fr; }
  .cat-card:last-child:nth-child(odd) { grid-column: auto; }
  .hero { min-height: auto; padding-bottom: 6.5rem; }
  .hero__trust { gap: 1rem 1.5rem; }
  .scroll-cue { display: none; }
  .shape--ring { width: 260px; height: 260px; }
  .shape--dots { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .check-list--2 { grid-template-columns: 1fr; }
  .steps { grid-template-columns: 1fr; }
  .media-frame__sub { width: 42%; right: -.25rem; bottom: -1.5rem; border-width: 4px; }
  .media-frame__badge { max-width: 220px; padding: .8rem 1rem; top: 1rem; }
  .solution-tile { min-height: 300px; }
  .solution-tile p { max-height: none; opacity: 1; margin-top: .4rem; }
  .supply-table th:nth-child(4), .supply-table td:nth-child(4) { display: none; }
  .supply-table td, .supply-table th { padding: .8rem .75rem; }
  .article__media { aspect-ratio: 16 / 9; }
  .newsletter-form { min-width: 0; width: 100%; max-width: none; }
  .footer-bottom .container { flex-direction: column; }
}

@media (max-width: 520px) {
  .btn-group .btn { width: 100%; }
  .value-strip .grid-4 { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr 1fr; gap: 1rem; }
  .stat { padding: 1rem .25rem; }
  .stat__label { font-size: .84rem; }
  .product-card__actions { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
  .footer-col--products { display: none; }
  .newsletter-form { flex-direction: column; }
  .newsletter-form .btn { width: 100%; }
  .newsletter-form .field-error { position: static; }
  .supply-table .code { font-size: .75rem; }
  .catalogue-toolbar { flex-direction: column; align-items: stretch; }
  .view-tabs { justify-content: center; }
  .fab-stack { right: .9rem; bottom: .9rem; }
  .pd__actions .btn { width: 100%; }
  .cta-banner { border-radius: var(--r-lg); }
}

/* ==========================================================================
   Mobile refinements
   ========================================================================== */
.mobile-bar { display: none; }
main { overflow-x: clip; }

@media (max-width: 760px) {
  :root { --section-y: 3.5rem; --gutter: 1.1rem; }
  body { padding-bottom: calc(68px + env(safe-area-inset-bottom)); }
  .section-head { margin-bottom: 1.75rem; }
  .section-head--split { gap: 1.1rem; }
  .lead { font-size: 1rem; }

  /* Side-sliding reveals cause sideways overflow on narrow screens: slide up instead */
  .js-anim [data-reveal="left"], .js-anim [data-reveal="right"] { transform: translateY(28px); }

  /* Hero: tighter, content-first */
  .hero { padding: calc(var(--header-h) + 2rem) 0 5rem; }
  .hero h1 { font-size: clamp(2.05rem, 1.5rem + 3.6vw, 2.6rem); margin-bottom: 1rem; }
  .hero__text { font-size: 1rem; margin-bottom: 1.6rem; }
  .hero__tagline { margin-bottom: 1.1rem; }
  .hero__trust { margin-top: 1.8rem; padding-top: 1.3rem; gap: .7rem; }
  .hero__trust li { font-size: .88rem; }
  .page-hero { padding: calc(var(--header-h) + 2.5rem) 0 2.75rem; }
  .page-hero p { font-size: 1rem; }

  /* Swipeable card rows: long grids become horizontal, snap-scrolling strips */
  [data-m-scroll] {
    display: flex !important; gap: .9rem; overflow-x: auto; overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory; scroll-padding-inline: var(--gutter);
    margin-inline: calc(var(--gutter) * -1); padding: .25rem var(--gutter) 1.25rem;
    scrollbar-width: none; -webkit-overflow-scrolling: touch;
  }
  [data-m-scroll]::-webkit-scrollbar { display: none; }
  [data-m-scroll] > * { flex: 0 0 84%; max-width: 360px; scroll-snap-align: start; }
  [data-m-scroll] > .empty-state { flex-basis: 100%; max-width: none; }
  .solution-grid[data-m-scroll] > * { min-height: 360px; }
  .m-scroll-hint { display: flex; align-items: center; justify-content: flex-end; gap: .35rem; font-size: .8rem; color: var(--c-muted); margin: -.5rem 0 .5rem; }

  /* Filter chips: one swipeable row instead of several wrapped rows */
  .filter-bar, .side-filter, .form-tabs {
    flex-wrap: nowrap !important; overflow-x: auto; scrollbar-width: none;
    margin-inline: calc(var(--gutter) * -1); padding: .2rem var(--gutter) .5rem;
  }
  .filter-bar::-webkit-scrollbar, .side-filter::-webkit-scrollbar, .form-tabs::-webkit-scrollbar { display: none; }
  .filter-bar { justify-content: flex-start !important; margin-bottom: 1.25rem; }
  .filter-btn, .side-filter button, .form-tabs button { flex-shrink: 0; white-space: nowrap; min-height: 42px; }
  .side-panel { padding: 1rem 0 .25rem; border: 0; background: none; }
  .side-panel h4 { margin-bottom: .5rem; }

  /* Value cards: compact two-up grid */
  .value-strip .grid-4 { grid-template-columns: 1fr 1fr !important; gap: .75rem; }
  .value-card { padding: 1.2rem 1rem; border-radius: var(--r-md); }
  .value-card h3 { font-size: .98rem; margin: .9rem 0 .35rem; }
  .value-card p { font-size: .84rem; line-height: 1.55; }
  .value-card .icon-box { width: 44px; height: 44px; border-radius: 12px; }
  .value-card__num { font-size: 1.8rem; right: .9rem; top: .8rem; }

  /* Media & content blocks */
  .alt-row + .alt-row { margin-top: 3.5rem; }
  .alt-row__media { aspect-ratio: 16 / 11; border-radius: var(--r-lg); }
  .alt-row h3[style] { font-size: 1.55rem !important; }
  .media-frame { margin-bottom: 2rem; }
  .media-frame__main { aspect-ratio: 4 / 3.6; }
  .cta-banner { padding: 2.25rem 1.25rem; }
  .cta-banner h2 { font-size: 1.6rem; }
  .testimonial { padding: 1.75rem 1.25rem; }
  .testimonial blockquote { font-size: 1.02rem; }
  .partner-mark { padding: 1.6rem 1rem; }
  .partner-logo--img { width: 180px; height: 90px; padding: .9rem 1.2rem; }

  /* Touch targets ≥ 44px */
  .link-arrow { min-height: 44px; }
  .footer-links a, .footer-contact a { display: inline-flex; align-items: center; min-height: 40px; }
  .footer-links { gap: 0; grid-template-columns: 1fr 1fr; column-gap: 1rem; }
  .footer-bottom a { display: inline-flex; min-height: 40px; align-items: center; }
  .slider-dot { position: relative; }
  .slider-dot::after { content: ""; position: absolute; inset: -14px -6px; }
  .slider-btn { width: 44px; height: 44px; }
  .breadcrumb a { display: inline-flex; min-height: 32px; align-items: center; }
  .add-btn { min-height: 40px; }
  .pagination button { min-width: 44px; height: 44px; }

  /* Forms: 16px text stops iOS from zooming into fields */
  .form-control, .search-box input, .newsletter-form input, .ql-qty input { font-size: 16px; }
  .form-card { padding: 1.4rem 1.1rem; border-radius: var(--r-lg); }
  .form-foot { flex-direction: column-reverse; align-items: stretch; }
  .form-foot .btn { width: 100%; }

  /* Footer: shorter on phones */
  .newsletter { padding-block: 2.25rem; }
  .footer-main { padding-block: 2.5rem 1.5rem; }
  .footer-grid { gap: 1.75rem; }
  .footer-brand p { font-size: .9rem; }

  /* Bottom quick-action bar replaces the floating WhatsApp button */
  .mobile-bar {
    display: grid; grid-template-columns: repeat(3, 1fr) 1.35fr; position: fixed; inset: auto 0 0 0; z-index: 950;
    background: rgba(255, 255, 255, .97); backdrop-filter: blur(12px); border-top: 1px solid var(--c-line);
    box-shadow: 0 -8px 24px rgba(16, 36, 58, .08); padding: .4rem .5rem calc(.4rem + env(safe-area-inset-bottom)); gap: .3rem;
  }
  .mobile-bar a, .mobile-bar button {
    position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .15rem;
    min-height: 54px; border: 0; background: none; border-radius: 12px; color: var(--c-deep);
    font-family: var(--f-head); font-weight: 700; font-size: .7rem; letter-spacing: .01em;
  }
  .mobile-bar .icon { width: 21px; height: 21px; }
  .mobile-bar a:active, .mobile-bar button:active { background: var(--c-light); }
  .mobile-bar a[href^="https://wa.me"] { color: #1a8f48; }
  .mobile-bar__cta { background: var(--grad-brand) !important; color: #fff !important; box-shadow: var(--sh-brand); }
  .mobile-bar .count {
    position: absolute; top: 4px; right: 50%; margin-right: -22px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 999px;
    background: var(--c-green); color: #fff; font-size: .65rem; display: grid; place-items: center; transform: scale(0); transition: transform .3s var(--ease);
  }
  .mobile-bar .count.has-items { transform: scale(1); }
  .fab--whatsapp { display: none; }
  .fab-stack { bottom: calc(80px + env(safe-area-inset-bottom)); }
  .toast-stack { bottom: calc(84px + env(safe-area-inset-bottom)); }
  .header-actions .quote-list-btn { display: none; }
  .nav-open .mobile-bar { display: none; }
}

@media (max-width: 359px) {
  .mobile-bar span:not(.count) { font-size: .64rem; }
  .value-strip .grid-4 { grid-template-columns: 1fr !important; }
}

/* Compact horizontal product cards in the catalogue on phones */
@media (max-width: 760px) {
  .catalogue-grid { gap: .85rem; }
  .catalogue-grid .product-card { display: grid; grid-template-columns: 112px 1fr; border-radius: var(--r-md); }
  .catalogue-grid .product-card:hover { transform: none; }
  .catalogue-grid .product-card__media { aspect-ratio: auto; height: 100%; min-height: 150px; }
  .catalogue-grid .product-card__media .badge { display: none; }
  .catalogue-grid .product-card__quick { opacity: 1; transform: none; width: 40px; height: 40px; top: .5rem; right: auto; left: .5rem; }
  .catalogue-grid .product-card__body { padding: .85rem .9rem .9rem; }
  .catalogue-grid .product-card__cat { font-size: .68rem; margin-bottom: .25rem; }
  .catalogue-grid .product-card__body h3 { font-size: .98rem; margin-bottom: .3rem; }
  .catalogue-grid .product-card__body p {
    font-size: .84rem; line-height: 1.5; margin-bottom: .7rem;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  }
  .catalogue-grid .product-card__specs { display: none; }
  .catalogue-grid .product-card__actions { grid-template-columns: 1fr; gap: .4rem; }
  .catalogue-grid .product-card__actions .btn { min-height: 40px; padding: .4rem .5rem; font-size: .76rem; }
}

/* Grid children must be allowed to shrink, or a wide scrolling row (filter chips) stretches the whole column */
.catalogue-layout > *, .catalogue-sidebar > *, .split > *, .alt-row > *, .hero__inner > *, .cta-banner__inner > *, .partner-feature > * { min-width: 0; }
