/* ===================================================================
   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,
body.et-theme {
  overflow-x: clip; /* clip prevents layout shift unlike hidden */
  max-width: 100%;
}

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

img, video { height: auto; }

/* Prevent absolutely-positioned Elementor sections from causing overflow */
.elementor-section.elementor-section-boxed > .elementor-container {
  max-width: 100% !important;
}

/* Defensive: interactive elements always meet WCAG 2.5.5 touch target */
a, button, [role="button"], input, select, textarea, label[for] {
  touch-action: manipulation;
}

button,
a.btn,
.btn,
.elementor-button,
.woocommerce .button,
.woocommerce button {
  min-height: 44px;
}

/* ── 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;
  }
}

/* ── 428px — iPhone 14 Pro Max ──────────────────────────────────── */

@media (max-width: 428px) {
  /* Hero stacking */
  .iona-hero-home,
  .hero-2,
  .page-hero {
    grid-template-columns: 1fr !important;
    padding: 40px 0 32px;
  }

  .hero-cta {
    flex-direction: column;
    gap: 10px;
  }

  .hero-cta .btn { width: 100%; }

  /* Checkout at this width → single column */
  .woocommerce-checkout #customer_details {
    grid-template-columns: 1fr !important;
  }

  /* Product card actions → full width */
  .work-card .actions .btn { width: 100%; }

  /* Gallery grid single col */
  .gallery-grid,
  .work-grid { grid-template-columns: 1fr; }

  /* Pillar grid → 2 col */
  .pillar-grid { grid-template-columns: 1fr 1fr; }

  /* ev-card image height trim */
  .ev-card img { height: 200px; }

  /* No fixed widths on Elementor columns */
  .elementor-col-50,
  .elementor-col-33,
  .elementor-col-25 {
    width: 100% !important;
  }

  /* Sections no inner horizontal padding bleed */
  .elementor-section > .elementor-container {
    padding-left: 16px;
    padding-right: 16px;
  }
}

/* ── 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 — iPhone 15, 14, 13 ──────────────────────────────────── */

@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;
  }

  /* Cart table: hide thumbnail column, show stacked */
  .woocommerce table.cart .product-thumbnail { display: none; }

  .woocommerce table.cart td,
  .woocommerce table.cart th { padding: 12px 10px; }

  /* Cart totals — full width */
  .woocommerce .cart-collaterals,
  .woocommerce .cart-collaterals .cart_totals {
    width: 100% !important;
    float: none !important;
  }

  /* Coupon input + button stacking */
  .woocommerce table.cart td.actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }
  .woocommerce table.cart td.actions .coupon {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }
  .woocommerce table.cart td.actions .coupon .input-text {
    width: 100%;
  }
  .woocommerce table.cart td.actions .button,
  .woocommerce table.cart td.actions .coupon .button {
    width: 100%;
    text-align: center;
  }
}

/* ── 375px — iPhone SE 3rd gen, iPhone 12 mini ──────────────────── */

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

  h2 {
    font-size: clamp(1.5rem, 6.5vw, 2rem);
  }

  .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;
  }

  /* Narrow filter bar */
  .filter-bar select,
  .filter-bar .select {
    width: 100%;
    min-width: 0;
  }

  /* ev-card image shorter */
  .ev-card img { height: 180px; }

  /* Case bar 1-col */
  .case-bar { grid-template-columns: 1fr; }

  /* WC checkout columns */
  .woocommerce form .form-row-first,
  .woocommerce form .form-row-last {
    width: 100% !important;
    float: none !important;
  }
}

/* ── 320px — Galaxy A series, older small Androids ──────────────── */

@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;
  }

  /* Spec rows vertical at 320 */
  .specs { grid-template-columns: 1fr 1fr !important; }

  /* Footer help card padding */
  .footer-help { padding: 16px; }

  /* Trust cells stack fully */
  .trust-cell,
  .vc { flex-direction: column; align-items: flex-start; }

  /* No decorative shadows on 320 — performance */
  .work-card,
  .post-card,
  .ev-card { box-shadow: none; }
}
