/* ===================================================================
   IONA — Responsive Overrides
   Breakpoints: 1600 · 1440 · 1280 · 1024 · 768 · 430 · 414 · 390 · 375 · 320
   Never use !important unless fighting a third-party override.
=================================================================== */

/* ── Global overflow guard ─────────────────────────────────────── */

html,
body.et-theme {
  overflow-x: clip; /* clip prevents layout shift unlike hidden */
  max-width: 100vw;
}

img,
video,
iframe,
svg {
  max-width: 100%;
  height: auto;
}

/* ── Accessibility: focus states ───────────────────────────────── */

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--emerald);
  outline-offset: 3px;
  border-radius: 3px;
}

/* ── 1600px ─────────────────────────────────────────────────────── */

@media (min-width: 1601px) {
  :root {
    --container: 1340px;
  }
  .nav-inner {
    padding-left: 48px;
    padding-right: 48px;
  }
}

/* ── 1440px ─────────────────────────────────────────────────────── */

@media (max-width: 1440px) {
  :root {
    --container: 1200px;
  }
}

/* ── 1280px ─────────────────────────────────────────────────────── */

@media (max-width: 1280px) {
  :root {
    --container: 1080px;
  }
  .nav-inner {
    gap: 24px;
  }
  .footer-grid {
    grid-template-columns: 1.3fr 1fr 1fr 1fr;
  }
  .iona-header {
    padding-left: 24px !important;
    padding-right: 24px !important;
  }
}

/* ── 1024px ─────────────────────────────────────────────────────── */

@media (max-width: 1024px) {
  :root {
    --container: 100%;
  }

  /* Stacked hero layouts */
  .hero,
  .page-hero,
  .hero-2,
  .product-head,
  .mission-hero,
  .contact-hero,
  .feature-band,
  .iona-about-hero > .elementor-element,
  .iona-product-main > .elementor-element {
    flex-direction: column !important;
    gap: 32px !important;
  }

  .product-info {
    position: static;
  }

  /* Grids → 2 col */
  .gallery-grid,
  .grid-4,
  .post-grid,
  .teaser-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .values-row,
  .trust-row,
  .pillar-row {
    grid-template-columns: repeat(2, 1fr);
  }

  .footer-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 32px;
  }

  /* Trust band → 2×2 */
  .iona-trust-band .iona-stat {
    width: 50% !important;
    border-right: 0 !important;
    border-bottom: 1px solid rgba(255,255,255,0.12) !important;
    padding: 24px 0 !important;
  }

  /* Nav */
  #et-primary-nav .nav-links {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 72px;
    left: 0;
    right: 0;
    background: var(--surface);
    border-top: 1px solid var(--line);
    padding: 16px;
    box-shadow: var(--shadow-lg);
    z-index: 999;
  }
  #et-primary-nav .nav-links.is-open {
    display: flex;
  }
  .nav-toggle {
    display: flex;
  }
}

/* ── 768px ──────────────────────────────────────────────────────── */

@media (max-width: 768px) {
  .container,
  .container-tight {
    padding: 0 20px;
  }

  .nav-inner {
    padding: 14px 20px;
    flex-wrap: wrap;
  }

  /* Single column grids */
  .footer-grid,
  .gallery-grid,
  .grid-4,
  .grid-3,
  .grid-2,
  .post-grid,
  .teaser-grid {
    grid-template-columns: 1fr;
  }

  .values-row,
  .trust-row,
  .pillar-row,
  .mission-cards,
  .contact-cards,
  .form-grid {
    grid-template-columns: 1fr;
  }

  /* Newsletter strip */
  .newsletter-strip,
  .newsletter-strip-wrap .newsletter-strip {
    flex-direction: column;
    text-align: center;
    align-items: center;
    gap: 16px;
  }
  .newsletter-strip form {
    flex-direction: column;
    width: 100%;
    max-width: 440px;
  }
  .newsletter-strip input {
    min-width: 0;
    width: 100%;
  }

  /* Filter bar */
  .filter-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .filter-bar .right {
    margin-left: 0;
    justify-content: space-between;
  }

  /* CTA band */
  .cta-band { padding: 40px 24px; }
  .cta-band .row { flex-direction: column; align-items: center; }

  /* Feature band */
  .feature-band { padding: 40px 24px; }

  /* Hero meta row */
  .hero-meta { flex-wrap: wrap; gap: 20px; }

  /* Footer columns → single col */
  .iona-footer-cols > .elementor-element {
    width: 100% !important;
    flex: 0 0 100% !important;
  }

  /* Trust band → single col */
  .iona-trust-band .iona-stat {
    width: 100% !important;
    padding: 20px 0 !important;
  }

  /* Elementor heading size clamp for mobile */
  .iona-hero--home .elementor-heading-title {
    font-size: clamp(2rem, 9vw, 3rem) !important;
  }

  /* Product single → stack */
  .iona-product-main {
    flex-direction: column !important;
  }
  .iona-product-gallery,
  .iona-product-details {
    width: 100% !important;
    flex: none !important;
  }
}

/* ── 430px ──────────────────────────────────────────────────────── */

@media (max-width: 430px) {
  .specs {
    grid-template-columns: repeat(2, 1fr);
  }

  .case-bar {
    grid-template-columns: 1fr;
  }

  .hero-meta {
    flex-direction: column;
    gap: 16px;
  }

  .pager button {
    min-width: 32px;
    height: 32px;
  }

  /* Artwork card meta → 2×2 grid */
  .ev-meta {
    grid-template-columns: repeat(2, 1fr) !important;
    row-gap: 14px;
  }
  .ev-cell:nth-child(2) { border-right: 0; }
  .ev-cell:nth-child(3) { padding-left: 0; }

  /* Iona card buttons → stack */
  .iona-card-btns {
    flex-direction: column;
  }
}

/* ── 414px ──────────────────────────────────────────────────────── */

@media (max-width: 414px) {
  /* Contact cards → 1 col */
  .iona-contact-cards > .elementor-element {
    width: 100% !important;
  }

  /* Popup → single col */
  .iona-popup-newsletter {
    flex-direction: column !important;
  }
  .iona-popup-img-col {
    display: none !important; /* Hide image on very small screens */
  }
}

/* ── 390px ──────────────────────────────────────────────────────── */

@media (max-width: 390px) {
  /* Artist card loop → 1 col on smallest iPhones */
  .iona-artists-grid-section .e-loop-item {
    flex: 0 0 100%;
    max-width: 100%;
  }

  /* Trust band stats → 1 col */
  .iona-trust-band .iona-stat {
    border-bottom: 1px solid rgba(255,255,255,0.12) !important;
  }

  /* Artwork product meta grid → 2 col */
  .iona-product-meta {
    flex-wrap: wrap;
  }
  .iona-product-meta > .elementor-element {
    width: 50% !important;
    flex: 0 0 50% !important;
  }
}

/* ── 375px ──────────────────────────────────────────────────────── */

@media (max-width: 375px) {
  h1 {
    font-size: clamp(1.9rem, 8vw, 2.4rem);
  }

  .btn-lg {
    width: 100%;
    text-align: center;
  }

  .hero-cta {
    flex-direction: column;
  }

  /* Single product add-to-cart */
  .single-product .cart .button,
  .single-product .single_add_to_cart_button {
    width: 100% !important;
  }

  /* 404 page number */
  .iona-404 .elementor-heading-title {
    font-size: 120px !important;
  }
}

/* ── 320px ──────────────────────────────────────────────────────── */

@media (max-width: 320px) {
  h1 {
    font-size: clamp(1.65rem, 7.5vw, 2rem);
  }
  h2 {
    font-size: clamp(1.3rem, 6vw, 1.7rem);
  }

  .nav-inner {
    padding: 12px 14px;
  }

  .container,
  .container-tight {
    padding: 0 14px;
  }

  .btn,
  .elementor-button {
    padding: 10px 16px;
    font-size: 13px;
  }

  /* Never show side-by-side on 320px */
  .iona-card-btns {
    flex-direction: column !important;
  }

  .ev-meta {
    grid-template-columns: 1fr !important;
  }

  .ev-cell {
    border-right: 0 !important;
    padding: 0 0 12px 0 !important;
    border-bottom: 1px solid var(--line);
  }
  .ev-cell:last-child {
    border-bottom: 0;
    padding-bottom: 0 !important;
  }
}
