/* tradeinplus responsive styles */

    /* ───────────────────────────────────────────────
       UNIVERSAL: Apply to all viewport sizes
       ─────────────────────────────────────────────── */
    html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
    body { overflow-x: hidden; max-width: 100vw; }

    /* Fix any element that overflows the viewport */
    img, video, iframe, svg { max-width: 100%; height: auto; }
    table { max-width: 100%; }

    /* Prevent any element from forcing horizontal scroll */
    section, main, header, footer, article, aside { max-width: 100vw; }

    /* Fluid typography baseline */
    :root {
      --tip-fluid-h1: clamp(1.75rem, 5vw, 3.5rem);
      --tip-fluid-h2: clamp(1.5rem, 4vw, 2.8rem);
      --tip-fluid-h3: clamp(1.2rem, 3vw, 2rem);
      --tip-fluid-body: clamp(0.95rem, 1.5vw, 1.05rem);
      --tip-fluid-gap: clamp(1rem, 3vw, 2rem);
      --tip-fluid-pad: clamp(1rem, 4vw, 2.5rem);
    }

    /* ───────────────────────────────────────────────
       LARGE DESKTOP (>= 1440px)
       Wide screens — extra breathing room
       ─────────────────────────────────────────────── */
    @media (min-width: 1441px) {
      .phero, .section-inner, .features-inner,
      .specs-table, .related-grid, .footer-grid {
        max-width: 1400px !important;
      }
    }

    /* ───────────────────────────────────────────────
       DESKTOP (1024px - 1440px)
       Standard desktop
       ─────────────────────────────────────────────── */
    @media (min-width: 1025px) and (max-width: 1440px) {
      .site-nav { padding: 0 1.5rem !important; }
    }

    /* ───────────────────────────────────────────────
       TABLET LANDSCAPE (901px - 1024px)
       ─────────────────────────────────────────────── */
    @media (min-width: 901px) and (max-width: 1024px) {
      .nav-links { gap: 1.2rem !important; }
      .nav-links a { font-size: 13px !important; }
      .phero-title, .uhero-info h1 {
        font-size: clamp(2rem, 5vw, 2.8rem) !important;
      }
    }

    /* ───────────────────────────────────────────────
       TABLET PORTRAIT (768px - 900px)
       iPad portrait, large phones landscape
       ─────────────────────────────────────────────── */
    @media (max-width: 900px) {
      .nav-links { display: none !important; }
      .hamburger { display: inline-flex !important; align-items: center; justify-content: center; }

      /* Stack 2-col grids */
      .phero, .uhero {
        grid-template-columns: 1fr !important;
        gap: 1.5rem !important;
        padding: 2rem 1.25rem !important;
      }
      .phero-info { order: 2 !important; }
      .phero-image { order: 1 !important; min-height: 360px !important; }

      /* Features grid: 2 columns */
      .features-grid,
      .related-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1rem !important;
      }

      /* Footer compact */
      .footer-top {
        grid-template-columns: 1fr 1fr !important;
        gap: 2rem !important;
      }

      /* Quick facts: 2-col on tablet */
      .quick-facts {
        grid-template-columns: 1fr 1fr !important;
      }

      /* Buttons: prevent overflow */
      .actions { flex-wrap: wrap; gap: 0.5rem !important; }
      .actions .btn { min-width: 140px; flex: 1; }

      /* Spec rows */
      .spec-row { padding: 1rem 1.25rem !important; }

      /* Section padding */
      section, .section { padding: 3rem 1.5rem !important; }
    }

    /* ───────────────────────────────────────────────
       MOBILE LARGE (481px - 768px)
       Phones landscape, small tablets
       ─────────────────────────────────────────────── */
    @media (max-width: 768px) {
      /* Hide things that don't fit */
      .announcement-ticker .ticker-track span { font-size: 11px !important; }

      /* Container padding */
      section, .section, .phero, .uhero {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
      }

      /* Headings */
      .phero-title, .uhero-info h1 {
        font-size: clamp(1.75rem, 7vw, 2.4rem) !important;
        letter-spacing: -0.5px !important;
      }
      .phero-eyebrow { letter-spacing: 2px !important; font-size: 10px !important; }
      .phero-tagline { font-size: 1rem !important; }
      .phero-price { font-size: 2.2rem !important; }

      /* Better tap targets — minimum 44px */
      button, a.btn, .nav-icon, .color-swatch, .storage-opt {
        min-height: 44px;
      }

      /* Color swatches */
      .color-swatch { width: 38px !important; height: 38px !important; }
      .storage-opt { padding: 10px 14px !important; font-size: 13.5px !important; }

      /* Features: keep 2 cols on mobile-large */
      .features-grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 0.8rem !important;
      }
      .feature-card { padding: 1.2rem 1rem !important; }
      .feature-name { font-size: 14px !important; }
      .feature-desc { font-size: 12px !important; }
    }

    /* ───────────────────────────────────────────────
       PREMIUM CARD POLISH — only on light-themed pages
       Skip dark-themed pages (tech, gaming) where cards have custom styling
       ─────────────────────────────────────────────── */
    body:not(.theme-dark) .cat-card,
    body:not(.theme-dark) .prod-card,
    body:not(.theme-dark) .rel-card,
    body:not(.theme-dark) .feature-card,
    body:not(.theme-dark) .store-card,
    body:not(.theme-dark) .why-card,
    body:not(.theme-dark) .review-card,
    body:not(.theme-dark) .used-card {
      background: #fff !important;
      border: 1px solid rgba(0,0,0,0.06) !important;
      box-shadow: 0 1px 3px rgba(0,0,0,0.03) !important;
      transition: transform 0.3s cubic-bezier(0.22,1,0.36,1),
                  box-shadow 0.3s cubic-bezier(0.22,1,0.36,1),
                  border-color 0.3s !important;
    }
    body:not(.theme-dark) .cat-card:hover,
    body:not(.theme-dark) .prod-card:hover,
    body:not(.theme-dark) .rel-card:hover,
    body:not(.theme-dark) .feature-card:hover,
    body:not(.theme-dark) .store-card:hover,
    body:not(.theme-dark) .used-card:hover {
      transform: translateY(-4px) !important;
      box-shadow: 0 18px 40px rgba(0,0,0,0.08), 0 4px 12px rgba(0,0,0,0.04) !important;
      border-color: rgba(0,0,0,0.1) !important;
    }

    /* Image area inside cat-card (light pages only) */
    body:not(.theme-dark) .cat-card .cat-img {
      background: #fff !important;
      border-bottom: none !important;
    }
    body:not(.theme-dark) .cat-card .cat-img img {
      filter: drop-shadow(0 10px 24px rgba(0,0,0,0.12)) !important;
    }
    body:not(.theme-dark) .cat-card .cat-info {
      background: #fff !important;
    }

    /* Dark theme support */
    html[data-theme="dark"] .cat-card,
    html[data-theme="dark"] .rel-card,
    html[data-theme="dark"] .feature-card,
    html[data-theme="dark"] .store-card,
    html[data-theme="dark"] .used-card {
      background: #181818 !important;
      border-color: rgba(255,255,255,0.08) !important;
    }
    /* .prod-card stays light in dark mode (see index.html inline dark-theme rules) —
       product photos have a white backing, so the card body matches it instead of
       leaving a white image box floating on a dark card. */
    html[data-theme="dark"] .prod-card {
      border-color: rgba(0,0,0,0.06) !important;
    }
    html[data-theme="dark"] .cat-card .cat-img {
      background: #181818 !important;
      border-bottom: none !important;
    }
    html[data-theme="dark"] .cat-card .cat-info {
      background: #181818 !important;
    }
    html[data-theme="dark"] .cat-card:hover,
    html[data-theme="dark"] .prod-card:hover {
      box-shadow: 0 18px 40px rgba(0,0,0,0.4) !important;
      border-color: rgba(255,255,255,0.15) !important;
    }

    /* ───────────────────────────────────────────────
       DARK THEME PAGES (tech, gaming) — enhanced mobile experience
       Keep glassmorphism but ensure mobile usability
       ─────────────────────────────────────────────── */
    body.theme-dark .prod-card {
      min-height: auto !important;
      padding: 1.25rem !important;
    }

    @media (max-width: 900px) {
      body.theme-dark .prod-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 14px !important;
      }
      body.theme-dark .prod-card {
        padding: 1rem !important;
        border-radius: 22px !important;
      }
      body.theme-dark .prod-mockup-wrap {
        height: 150px !important;
        border-radius: 16px !important;
        margin-bottom: 0.8rem !important;
      }
      body.theme-dark .prod-name {
        font-size: 14px !important;
        line-height: 1.3 !important;
      }
      body.theme-dark .prod-specs {
        font-size: 11px !important;
        gap: 3px !important;
      }
      body.theme-dark .prod-price {
        font-size: 16px !important;
      }
      body.theme-dark .prod-cta {
        padding: 6px 12px !important;
        font-size: 12px !important;
      }
      body.theme-dark .sec-title,
      body.theme-dark .spatial-title {
        font-size: clamp(1.6rem, 6vw, 2.4rem) !important;
      }
      body.theme-dark .hero {
        padding: 4rem 1rem 2rem !important;
      }
      body.theme-dark .hero-blueprint {
        margin: 2rem 0 !important;
      }
      body.theme-dark .pills {
        gap: 6px !important;
      }
      body.theme-dark .pill {
        padding: 7px 14px !important;
        font-size: 12px !important;
      }
    }

    @media (max-width: 480px) {
      body.theme-dark .prod-card {
        padding: 0.85rem !important;
      }
      body.theme-dark .prod-mockup-wrap {
        height: 125px !important;
      }
      body.theme-dark .prod-name {
        font-size: 13px !important;
      }
      body.theme-dark .prod-specs span {
        padding: 2px 5px !important;
        font-size: 10px !important;
      }
      body.theme-dark .prod-price {
        font-size: 14px !important;
      }
      body.theme-dark .prod-price small {
        font-size: 9.5px !important;
      }
      body.theme-dark .prod-row {
        gap: 6px !important;
      }
      /* Better hero device positioning */
      body.theme-dark .devices-stage {
        height: 220px !important;
        overflow: hidden;
      }
      body.theme-dark .device {
        max-width: 40px !important;
      }
      body.theme-dark .hero-center { max-width: 50px !important; }
      body.theme-dark .marquee-item {
        font-size: 14px !important;
      }
    }

    /* ───────────────────────────────────────────────
       UNIVERSAL CARD GRIDS — 2 columns on mobile with breathing room
       Cards feel premium and comfortable, not cramped
       ─────────────────────────────────────────────── */
    @media (max-width: 900px) {
      .cat-grid,
      .prod-grid,
      .features-grid,
      .related-grid,
      .stores-grid,
      .why-grid,
      .reviews-grid,
      .used-grid,
      .check-grid,
      .device-grid,
      .grade-grid,
      .photo-grid,
      .lab-grid,
      .bp-grid,
      .faq-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 20px !important;
      }

      /* Cards: comfortable padding */
      .cat-card, .prod-card, .feature-card, .rel-card, .store-card,
      .why-card, .review-card, .used-card {
        padding: 1.5rem 1.25rem !important;
        border-radius: 18px !important;
      }

      /* Images: tall and present */
      .cat-img, .prod-img-wrap, .rel-img {
        height: 200px !important;
      }

      /* Sections: more vertical space */
      .section, section.section {
        padding-top: 4.5rem !important;
        padding-bottom: 4.5rem !important;
      }

      /* Section heading area */
      .sec-head { margin-bottom: 3rem !important; }
    }

    @media (max-width: 640px) {
      .cat-grid,
      .prod-grid,
      .features-grid,
      .related-grid,
      .stores-grid,
      .why-grid,
      .reviews-grid,
      .used-grid,
      .check-grid,
      .device-grid,
      .grade-grid,
      .photo-grid,
      .lab-grid,
      .bp-grid,
      .faq-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 16px !important;
      }

      /* Cards still spacious */
      .cat-card, .prod-card, .feature-card, .rel-card, .store-card,
      .why-card, .review-card, .used-card {
        padding: 1.25rem 1rem !important;
        border-radius: 18px !important;
      }

      .cat-img, .prod-img-wrap, .rel-img {
        height: 170px !important;
      }

      .cat-name, .prod-name, .feature-name, .rel-name {
        font-size: 15px !important;
        margin-bottom: 6px !important;
      }
      .prod-price, .rel-price { font-size: 15px !important; }

      /* Sections breathe */
      .section, section.section {
        padding-top: 3.5rem !important;
        padding-bottom: 3.5rem !important;
      }
      .sec-head { margin-bottom: 2.5rem !important; }
    }

    @media (max-width: 380px) {
      .cat-grid,
      .prod-grid,
      .features-grid,
      .related-grid,
      .stores-grid,
      .why-grid,
      .reviews-grid,
      .used-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
      }

      .cat-card, .prod-card, .feature-card, .rel-card {
        padding: 1rem 0.85rem !important;
      }

      .cat-img, .prod-img-wrap, .rel-img { height: 140px !important; }
      .cat-name, .prod-name, .feature-name { font-size: 14px !important; }
    }

    /* Section headings: consistent fluid sizing with breathing room */
    @media (max-width: 900px) {
      .sec-title, .features-title, .related-title, .specs-title,
      .uhero-info h1, .why-title, .reviews-title, .stores-title,
      h2.sec-title {
        font-size: clamp(1.6rem, 5.5vw, 2.4rem) !important;
        letter-spacing: -0.5px !important;
        line-height: 1.25 !important;
        margin-bottom: 0.7rem !important;
      }
      .sec-eyebrow, .features-eyebrow, .related-eyebrow {
        font-size: 11px !important;
        letter-spacing: 3px !important;
        margin-bottom: 1rem !important;
      }
    }

    @media (max-width: 480px) {
      .sec-title, .features-title, .related-title, .specs-title,
      .uhero-info h1, .why-title, .reviews-title, .stores-title {
        font-size: clamp(1.4rem, 6vw, 1.9rem) !important;
      }
    }

    /* ───────────────────────────────────────────────
       MOBILE (320px - 480px)
       Standard phone sizes
       ─────────────────────────────────────────────── */
    @media (max-width: 480px) {
      /* Roomy spacing — section sides only, NOT vertical (handled above) */
      section, .section, .phero, .uhero {
        padding-left: 1.25rem !important;
        padding-right: 1.25rem !important;
      }

      /* Inspiration/inclusive/release grids — these can stay 1 col */
      .insp-grid,
      .incl-grid,
      .rel-grid {
        grid-template-columns: 1fr !important;
      }

      /* Footer single column */
      .footer-top {
        grid-template-columns: 1fr !important;
        gap: 1.5rem !important;
      }
      .footer-bottom {
        flex-direction: column !important;
        gap: 0.8rem !important;
        text-align: center !important;
      }

      /* Quick facts single col on small phones */
      .quick-facts {
        grid-template-columns: 1fr !important;
        gap: 0.5rem !important;
      }
      .quick-facts li {
        padding: 0.6rem 0.8rem;
        background: rgba(0,0,0,0.025);
        border-radius: 8px;
        font-size: 12.5px !important;
      }

      /* Hero adjustments */
      .phero-image {
        min-height: 280px !important;
      }
      .phero-image .product-photo {
        max-width: 92% !important;
      }
      .phone-mockup {
        max-width: 200px !important;
      }

      /* Compact price block */
      .phero-price-block {
        padding: 1.1rem 1.2rem !important;
        border-radius: 14px !important;
      }
      .phero-price { font-size: 1.9rem !important; }
      .phero-monthly { font-size: 12.5px !important; flex-wrap: wrap; }

      /* Action buttons stack on tiny screens */
      .actions {
        flex-direction: column !important;
        gap: 0.6rem !important;
      }
      .actions .btn {
        width: 100% !important;
        min-width: auto !important;
        font-size: 14px !important;
        padding: 12px 20px !important;
      }

      /* Spec rows: stack key/value */
      .spec-row {
        grid-template-columns: 1fr !important;
        gap: 0.3rem !important;
        padding: 1rem 1.2rem !important;
      }
      .spec-label { font-size: 12px !important; }
      .spec-value { font-size: 13.5px !important; }

      /* Hero section reduces height */
      .hero { min-height: 70vh !important; padding: 4rem 1rem 3rem !important; }
      .hero-brand { font-size: clamp(2.5rem, 12vw, 4.5rem) !important; }

      /* Buttons */
      .btn { padding: 0.7rem 1.4rem !important; font-size: 13.5px !important; }

      /* Trust badges compact */
      .feature-card { padding: 1rem 0.85rem !important; }
      .feature-icon { width: 36px !important; height: 36px !important; }
      .feature-icon svg { width: 18px !important; height: 18px !important; }

      /* Mobile menu padding */
      .mobile-menu { padding: 0.8rem !important; }
      .mobile-menu a { padding: 0.7rem 1rem !important; font-size: 14px !important; }

      /* Nav icons */
      .nav-actions { gap: 0.5rem !important; }
      .nav-icon { padding: 6px !important; }
      .nav-icon svg { width: 19px !important; height: 19px !important; }
      .theme-toggle { width: 34px !important; height: 34px !important; }

      /* Sections in shop */
      .shop-grid { grid-template-columns: 1fr 1fr !important; gap: 0.8rem !important; }
      .product-card { padding: 0.8rem !important; }

      /* Logo size */
      .logo { font-size: 17px !important; }
      .logo img { height: 22px !important; }
      .logo-mark { width: 28px !important; height: 28px !important; }
    }

    /* ───────────────────────────────────────────────
       TINY MOBILE (< 360px)
       iPhone SE 1st gen, very small phones
       ─────────────────────────────────────────────── */
    @media (max-width: 360px) {
      section, .section, .phero, .uhero {
        padding-left: 0.6rem !important;
        padding-right: 0.6rem !important;
      }

      .phero-title, .uhero-info h1 {
        font-size: 1.5rem !important;
      }

      .phero-price { font-size: 1.6rem !important; }

      .nav-icon { padding: 4px !important; }
      .nav-icon svg { width: 17px !important; height: 17px !important; }
      .nav-actions { gap: 0.3rem !important; }

      .logo span { font-size: 14px !important; }
      .logo img { height: 18px !important; }
      .logo-mark { width: 24px !important; height: 24px !important; }

      /* Hide non-essential nav items on tiny screens */
      .announcement-ticker { display: none !important; }

      /* Shop grid single col */
      .shop-grid { grid-template-columns: 1fr !important; }
    }

    /* ───────────────────────────────────────────────
       LANDSCAPE PHONE (height < 500px)
       Optimizations for landscape orientation
       ─────────────────────────────────────────────── */
    @media (max-height: 500px) and (orientation: landscape) {
      .hero, .uhero, .phero {
        min-height: auto !important;
        padding-top: 1.5rem !important;
        padding-bottom: 1.5rem !important;
      }
      .phero-image { min-height: 200px !important; }
    }

    /* ───────────────────────────────────────────────
       HIGH-DPI / RETINA ENHANCEMENTS
       ─────────────────────────────────────────────── */
    @media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
      img { image-rendering: -webkit-optimize-contrast; }
    }

    /* ───────────────────────────────────────────────
       SAFE AREAS — Notched phones (iPhone X+)
       ─────────────────────────────────────────────── */
    @supports (padding: env(safe-area-inset-bottom)) {
      footer, .footer-bottom {
        padding-bottom: max(1rem, env(safe-area-inset-bottom)) !important;
      }
      .mobile-menu, #tip-cart-fab, #tip-search-fab {
        bottom: max(1rem, env(safe-area-inset-bottom)) !important;
      }
    }

    /* ───────────────────────────────────────────────
       PRINT (hide UI chrome when printing)
       ─────────────────────────────────────────────── */
    @media print {
      .site-header, .site-nav, .mobile-menu, .announcement-ticker,
      footer, #tip-cart-fab, #tip-search-fab, .actions, .nav-actions {
        display: none !important;
      }
      body { color: #000 !important; background: #fff !important; }
    }
  /* ───────────────────────────────────────────────────────────
   tradeinplus — site-wide performance & smoothness layer
   Loaded on every page. Safe, layout-neutral optimisations.
   ─────────────────────────────────────────────────────────── */

/* 1) Smooth anchor scrolling (auto-disabled for reduced motion). */
@media (prefers-reduced-motion:no-preference){
  html{ scroll-behavior:smooth; }
}

/* 2) When JS detects the tab is hidden or a heavy section has scrolled
      off-screen, it adds these classes so the GPU stops repainting
      animations nobody can see. Pure play-state — no layout impact. */
.tip-anim-paused,
.tip-anim-paused *,
.tip-anim-paused *::before,
.tip-anim-paused *::after{
  animation-play-state:paused !important;
}

/* 3) Honour reduced-motion / battery-saver: drop the expensive
      always-on ambient effects and heavy compositing entirely. */
@media (prefers-reduced-motion:reduce){
  *,*::before,*::after{
    animation-duration:.001ms !important;
    animation-iteration-count:1 !important;
    transition-duration:.001ms !important;
    scroll-behavior:auto !important;
  }
  .stars,.ambient,.showcase-spotlight,.cursor-glow{ display:none !important; }
}
