/* ============================================================================
   SARASWAT ELECTRICALS — RESPONSIVE LAYER
   ----------------------------------------------------------------------------
   Loaded last on every page, after style.css and pages.css.

   Those two files already carry the main breakpoints (1200 / 1024 / 900 / 640
   / 380) and this file deliberately does not repeat them — every range below
   is bounded so it can only add behaviour, never silently override a narrower
   rule that an earlier file already got right.

     01. Overflow safety net   — nothing may push the page sideways
     02. Large desktops & 4K   — 1700px and up
     03. Tablet landscape      — 1025 - 1200px
     04. Tablet portrait       —  641 - 1024px
     05. Large phone / small tablet — 641 - 768px
     06. Phones                — up to 640px
     07. Very small phones     — up to 380px
     08. Foldables / split screen — up to 320px
     09. Landscape phones      — short viewports
     10. Touch vs. pointer     — finger-sized targets, no hover traps
     11. Notches, and print

   Everything is sized with clamp(), % and minmax(), so the widths between two
   breakpoints are covered too — not just the breakpoints themselves.
   ========================================================================== */


/* ==========================================================================
   01. OVERFLOW SAFETY NET
   What stops a long model number or a wide spec table producing a horizontal
   scrollbar on a phone.
   ========================================================================== */

html { overflow-x: hidden; }

/* Grid and flex children default to min-width:auto and refuse to shrink below
   their content. Zero lets the track do its job at every width. */
[class*="-grid"] > *,
[class*="__grid"] > *,
.container > * {
  min-width: 0;
}

/* Long model numbers, e-mail addresses and URLs wrap instead of overflowing. */
p, li, td, th, dd, dt, address, figcaption, label, summary,
.info-card__value, .footer__about, .pcard__name, .pdp__short {
  overflow-wrap: break-word;
}

/* The spec table scrolls inside its own frame rather than widening the page. */
.spec-wrap {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}

/* The embedded map scales with the viewport instead of holding a fixed 420px. */
.contact__map iframe {
  width: 100%;
  height: clamp(280px, 38vw, 420px);
}


/* ==========================================================================
   02. LARGE DESKTOPS & 4K
   Past ~1700px a 1240px column is stranded in the middle of the screen, so
   the container and the section rhythm grow with it.
   ========================================================================== */

@media (min-width: 1700px) {
  :root {
    --container: 1400px;
    --gutter: 32px;
    --section-y: 132px;
  }
  body { font-size: 17.5px; }
}

@media (min-width: 2200px) {
  :root {
    --container: 1560px;
    --section-y: 144px;
  }
  body { font-size: 18px; }
}


/* ==========================================================================
   03. TABLET LANDSCAPE  (1025 - 1200px)
   The inline navigation is still visible here; product cards drop one column
   so headlines stop breaking mid-word.
   ========================================================================== */

@media (min-width: 1025px) and (max-width: 1200px) {
  .gcard-grid,
  .ccard-grid,
  .pcard-grid,
  .eseries-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; }

  .about__points { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}


/* ==========================================================================
   04. TABLET PORTRAIT  (641 - 1024px)
   iPad, Galaxy Tab, Surface. The drawer navigation has already taken over at
   1024px, so the content grids go to two columns instead of squeezing three
   cards across a 780px screen.
   ========================================================================== */

@media (min-width: 641px) and (max-width: 1024px) {
  .cat-grid,
  .prod-grid,
  .why-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }

  .about__points { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .about__media  { margin-inline: auto; }

  .phero__stats > div { flex: 1 1 calc(50% - 12px); }

  .pdp__stage { max-width: 560px; }
  .contact__showroom img { aspect-ratio: 16 / 9; }
}

/* The drawer starts at the top and scrolls, so a long menu stays reachable on
   a short screen instead of being centred half off-view. */
@media (max-width: 1024px) {
  .nav {
    justify-content: flex-start;
    padding-top: calc(var(--header-h) + 16px);
    overscroll-behavior: contain;
  }
}


/* ==========================================================================
   05. LARGE PHONE / SMALL TABLET  (641 - 768px)
   ========================================================================== */

@media (min-width: 641px) and (max-width: 768px) {
  :root { --section-y: 76px; }

  .toolbar { flex-wrap: wrap; gap: 12px; }
  .toolbar .sel { flex: 1 1 calc(50% - 6px); }

  .footer__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Wattage chips become a swipeable strip at every touch-sized width — a series
   with eight wattages must not wrap into four tall rows. */
@media (max-width: 768px) {
  .pdp__wattages-list,
  .pcard__watts-list {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 8px;
    padding-bottom: 6px;
    scrollbar-width: none;
  }
  .pdp__wattages-list::-webkit-scrollbar,
  .pcard__watts-list::-webkit-scrollbar { display: none; }
  .pdp__wchip,
  .pcard__wchip { flex: 0 0 auto; }
}


/* ==========================================================================
   06. PHONES  (up to 640px)
   ========================================================================== */

@media (max-width: 640px) {
  /* 16px is the threshold below which iOS Safari zooms the page on focus. */
  .field__input,
  .field__input--select,
  .field__input--area,
  .sel select,
  input, select, textarea { font-size: 16px; }

  /* Large buttons fill the row: easier to hit, and no two-word label wrapping
     onto three lines. */
  .btn--lg { width: 100%; justify-content: center; }
  .ecard__actions .btn { flex: 1 1 100%; }

  .section__head { margin-bottom: 36px; }
  .crumbs__list  { font-size: .74rem; }
}


/* ==========================================================================
   07. VERY SMALL PHONES  (up to 380px)
   iPhone SE, Galaxy A-series, and any phone at 200% text zoom.
   ========================================================================== */

@media (max-width: 380px) {
  :root { --gutter: 14px; }

  body { font-size: 14.5px; }

  .btn     { padding-inline: 16px; font-size: .92rem; }
  .btn--sm { padding-inline: 12px; }

  .phero__title   { font-size: clamp(1.65rem, 8vw, 2.1rem); }
  .section__title { font-size: clamp(1.5rem, 7vw, 1.9rem); }

  .spec th, .spec td { padding: 10px; font-size: .78rem; }

  .fab__btn   { width: 46px; height: 46px; font-size: 1.05rem; }
  .info-card  { padding: 15px; }
  .form       { padding: 22px 16px 24px; }
}


/* ==========================================================================
   08. FOLDABLES / SPLIT SCREEN  (up to 320px)
   ========================================================================== */

@media (max-width: 320px) {
  :root { --gutter: 12px; }

  .logo__lockup { height: 58px; }
  .header.is-scrolled .logo__lockup { height: 52px; }
  .phero__stats { display: none; }
}


/* ==========================================================================
   09. LANDSCAPE PHONES
   A 360px-tall viewport must not hide the hero copy behind a full-height
   layout, and the drawer must scroll rather than centre its items off-screen.
   ========================================================================== */

@media (max-height: 560px) and (orientation: landscape) and (max-width: 1024px) {

  .phero { padding-block: 48px 44px; }

  .nav { padding-top: 84px; padding-bottom: 28px; }

  .modal__panel { max-height: 94vh; }
  .contact__map iframe { height: 240px; }
}


/* ==========================================================================
   10. TOUCH VS. POINTER
   Hover is not available on a phone, so anything hover-only has to be
   reachable and every tap target has to be finger-sized (44px is the figure
   both Apple and Google publish).
   ========================================================================== */

@media (hover: none) {
  .nav__link,
  .nav__menu a,
  .footer__contact a {
    min-height: 44px;
    display: flex;
    align-items: center;
  }
  .footer__links a { display: inline-block; padding-block: 5px; }

  .filter,
  .chip,
  .pdp__wchip,
  .pcard__wchip,
  .slider__dot { min-height: 38px; }

  .fab__btn { min-width: 48px; min-height: 48px; }

  /* Cards lift on hover on a desktop; on touch that transform sticks after a
     tap, so it is switched off. */
  .cat-card:hover,
  .why-card:hover,
  .gcard:hover,
  .ccard:hover,
  .pcard:hover { transform: none; }
}

/* With a mouse, the horizontal strips get a slim visible scrollbar so it is
   obvious there is more to the right. */
@media (pointer: fine) {
  .pdp__wattages-list::-webkit-scrollbar,
  .pcard__watts-list::-webkit-scrollbar { height: 6px; }
  .pdp__wattages-list::-webkit-scrollbar-thumb,
  .pcard__watts-list::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border: 0;
    border-radius: 999px;
  }
}


/* ==========================================================================
   11. NOTCHES, AND PRINT
   ========================================================================== */

/* Rounded corners / notches — keep content clear of the safe area. */
@supports (padding: max(0px)) {
  .container {
    padding-left:  max(var(--gutter), env(safe-area-inset-left));
    padding-right: max(var(--gutter), env(safe-area-inset-right));
  }
  .fab {
    right:  max(14px, env(safe-area-inset-right));
    bottom: max(16px, env(safe-area-inset-bottom));
  }
}

@media print {
  .crumbs, .phero__bg, .toolbar, .pdp__wattages { display: none !important; }
  .spec-wrap { overflow: visible; box-shadow: none; }
  .pdp__grid, .pdp__detail { grid-template-columns: 1fr !important; }
}
