/**
 * InFront Technologies - iPad / tablet redesign for the Elementor home (landing #2).
 *
 * Scope is deliberately limited to iPad-class viewports so the existing desktop
 * and mobile designs are left completely untouched:
 *   - iPad portrait / landscape: 768px - 1024px wide AND min-height 768px
 *   - Larger iPad landscape (11"/12.9"): 1025px - 1366px, touch, min-height 768px
 *     (min-height excludes phones in landscape; pointer: coarse excludes laptops)
 *
 * Everything is also gated behind body:not(.elementor-editor-active) so the
 * Elementor back-office editor keeps its native rendering.
 */

/* ------------------------------------------------------------------ */
/* 1. Section visibility on tablet (Elementor tablet breakpoint <=1023) */
/* ------------------------------------------------------------------ */
@media (min-width: 768px) and (max-width: 1023px) and (min-height: 768px) {
  body:not(.elementor-editor-active) .elementor-hidden-tablet {
    display: block !important;
  }

  body:not(.elementor-editor-active) .elementor-hidden-desktop.elementor-hidden-tablet {
    display: none !important;
  }
}

/* ------------------------------------------------------------------ */
/* 2. iPad redesign                                                     */
/* ------------------------------------------------------------------ */
@media (min-width: 768px) and (max-width: 1024px) and (min-height: 768px),
       (min-width: 1025px) and (max-width: 1366px) and (pointer: coarse) and (min-height: 768px) {

  body:not(.elementor-editor-active) {
    --ift-accent: #8cd400;
    --ift-accent-d: #74b000;
    --ift-ink: #14181f;
    --ift-ink-soft: #555f70;
    --ift-line: #e7eaf0;
    --ift-surface: #ffffff;
    --ift-surface-2: #f4f6f9;
    --ift-radius: 16px;
    --ift-radius-sm: 10px;
    --ift-shadow: 0 6px 24px rgba(20, 24, 31, 0.08);
    --ift-shadow-hover: 0 12px 34px rgba(20, 24, 31, 0.14);
  }

  /* ---- 2.1 Global rhythm + overflow guards ---- */
  body:not(.elementor-editor-active) .elementor {
    overflow-x: hidden;
  }

  body:not(.elementor-editor-active) .elementor-section-stretched {
    max-width: 100vw;
    overflow-x: hidden;
  }

  body:not(.elementor-editor-active) .elementor-section-stretched > .elementor-container {
    max-width: 100%;
  }

  body:not(.elementor-editor-active) .elementor-top-section {
    padding-left: 18px;
    padding-right: 18px;
  }

  body:not(.elementor-editor-active) .elementor-top-section > .elementor-container {
    max-width: 980px;
    margin-left: auto;
    margin-right: auto;
  }

  body:not(.elementor-editor-active) .elementor-row {
    flex-wrap: wrap;
  }

  body:not(.elementor-editor-active) .elementor-widget-wrap img,
  body:not(.elementor-editor-active) .elementor-image img,
  body:not(.elementor-editor-active) .elementor-widget-image img {
    max-width: 100%;
    height: auto;
  }

  /* ---- 2.2 Typography scale ---- */
  body:not(.elementor-editor-active) .elementor-widget-heading .elementor-heading-title {
    line-height: 1.22 !important;
    max-width: 100%;
    word-wrap: break-word;
    overflow-wrap: break-word;
    color: var(--ift-ink);
    letter-spacing: -0.01em;
  }

  body:not(.elementor-editor-active) .elementor-widget-heading .elementor-heading-title.elementor-size-xxl {
    font-size: clamp(26px, 4vw, 36px) !important;
  }
  body:not(.elementor-editor-active) .elementor-widget-heading .elementor-heading-title.elementor-size-xl {
    font-size: clamp(23px, 3.4vw, 30px) !important;
  }
  body:not(.elementor-editor-active) .elementor-widget-heading .elementor-heading-title.elementor-size-large {
    font-size: clamp(20px, 2.8vw, 26px) !important;
  }
  body:not(.elementor-editor-active) .elementor-widget-heading .elementor-heading-title.elementor-size-medium {
    font-size: clamp(17px, 2.2vw, 21px) !important;
  }
  body:not(.elementor-editor-active) .elementor-widget-heading .elementor-heading-title.elementor-size-small {
    font-size: 15px !important;
  }

  body:not(.elementor-editor-active) .elementor-text-editor,
  body:not(.elementor-editor-active) .elementor [class*="elementor-element-"] .elementor-text-editor {
    font-size: 15px !important;
    line-height: 1.6 !important;
    color: var(--ift-ink-soft);
    word-wrap: break-word;
    overflow-wrap: break-word;
  }

  /* ---- 2.3 Hero carousel + full-bleed promo tiles ---- */
  body:not(.elementor-editor-active) .elementor-widget-image-carousel .swiper-container,
  body:not(.elementor-editor-active) .elementor-widget-image-carousel .elementor-image-carousel {
    border-radius: var(--ift-radius);
    overflow: hidden;
  }

  /* Promo image tiles (3-up, no-gap rows of images) -> 2 polished cards */
  body:not(.elementor-editor-active) .elementor-column-gap-no .elementor-row {
    gap: 14px;
    padding: 4px;
  }

  body:not(.elementor-editor-active) .elementor-column-gap-no .elementor-column.elementor-col-33 {
    width: calc(50% - 7px) !important;
    flex: 0 0 calc(50% - 7px) !important;
    max-width: calc(50% - 7px) !important;
  }

  body:not(.elementor-editor-active) .elementor-column-gap-no .elementor-widget-image img {
    border-radius: var(--ift-radius);
    box-shadow: var(--ift-shadow);
    width: 100%;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
  }

  body:not(.elementor-editor-active) .elementor-column-gap-no .elementor-widget-image a:hover img {
    transform: translateY(-3px);
    box-shadow: var(--ift-shadow-hover);
  }

  /* ---- 2.4 Brand header band (logo / heading+text / VIEW MORE button) ----
     Identified as a section that carries a logo image, a heading, body copy
     and a button together. Restyled into a clean centered intro band. */
  body:not(.elementor-editor-active)
    .elementor-top-section:has(.elementor-widget-image):has(.elementor-widget-heading):has(.elementor-widget-text-editor):has(.elementor-widget-button) {
    background: var(--ift-surface-2);
    border: 1px solid var(--ift-line);
    border-radius: var(--ift-radius);
    margin: 26px auto 8px;
    padding: 24px 22px 20px;
    max-width: 940px;
  }

  body:not(.elementor-editor-active)
    .elementor-top-section:has(.elementor-widget-image):has(.elementor-widget-heading):has(.elementor-widget-text-editor):has(.elementor-widget-button)
    .elementor-row {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  body:not(.elementor-editor-active)
    .elementor-top-section:has(.elementor-widget-image):has(.elementor-widget-heading):has(.elementor-widget-text-editor):has(.elementor-widget-button)
    .elementor-column.elementor-col-33 {
    width: 100% !important;
    flex: 0 0 100% !important;
    max-width: 720px !important;
  }

  /* collapse the empty spacers that pad the band on desktop */
  body:not(.elementor-editor-active)
    .elementor-top-section:has(.elementor-widget-image):has(.elementor-widget-heading):has(.elementor-widget-text-editor):has(.elementor-widget-button)
    .elementor-widget-spacer {
    display: none !important;
  }

  /* logo */
  body:not(.elementor-editor-active)
    .elementor-top-section:has(.elementor-widget-image):has(.elementor-widget-heading):has(.elementor-widget-text-editor):has(.elementor-widget-button)
    .elementor-widget-image img {
    max-height: 60px;
    width: auto !important;
    margin: 0 auto 6px;
  }

  /* heading with accent underline */
  body:not(.elementor-editor-active)
    .elementor-top-section:has(.elementor-widget-image):has(.elementor-widget-heading):has(.elementor-widget-text-editor):has(.elementor-widget-button)
    .elementor-heading-title {
    font-size: clamp(20px, 2.9vw, 26px) !important;
    margin-bottom: 12px;
    position: relative;
    padding-bottom: 12px;
  }

  body:not(.elementor-editor-active)
    .elementor-top-section:has(.elementor-widget-image):has(.elementor-widget-heading):has(.elementor-widget-text-editor):has(.elementor-widget-button)
    .elementor-heading-title::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%);
    width: 52px;
    height: 4px;
    border-radius: 4px;
    background: var(--ift-accent);
  }

  body:not(.elementor-editor-active)
    .elementor-top-section:has(.elementor-widget-image):has(.elementor-widget-heading):has(.elementor-widget-text-editor):has(.elementor-widget-button)
    .elementor-text-editor {
    font-size: 15px !important;
    line-height: 1.62 !important;
    margin: 0 auto 4px;
    max-width: 640px;
  }

  /* ---- 2.5 Buttons (global Elementor buttons) ---- */
  body:not(.elementor-editor-active) .elementor-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 15px !important;
    font-weight: 700 !important;
    line-height: 1.2 !important;
    white-space: normal !important;
    text-align: center;
    height: auto !important;
    min-height: 46px;
    padding: 12px 24px !important;
    border-radius: var(--ift-radius-sm) !important;
    background: var(--ift-ink) !important;
    color: #fff !important;
    border: 0 !important;
    box-shadow: 0 4px 14px rgba(20, 24, 31, 0.18);
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
  }

  body:not(.elementor-editor-active) .elementor-button:hover {
    background: var(--ift-accent) !important;
    color: var(--ift-ink) !important;
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(140, 212, 0, 0.4);
  }

  body:not(.elementor-editor-active) .elementor-button:active {
    transform: translateY(0);
  }

  body:not(.elementor-editor-active) .elementor-button .elementor-button-text {
    white-space: normal !important;
  }

  /* brand-header VIEW MORE button gets the accent treatment by default */
  body:not(.elementor-editor-active)
    .elementor-top-section:has(.elementor-widget-image):has(.elementor-widget-heading):has(.elementor-widget-text-editor):has(.elementor-widget-button)
    .elementor-button {
    margin-top: 6px;
    background: var(--ift-accent) !important;
    color: var(--ift-ink) !important;
    box-shadow: 0 6px 18px rgba(140, 212, 0, 0.35);
  }

  body:not(.elementor-editor-active)
    .elementor-top-section:has(.elementor-widget-image):has(.elementor-widget-heading):has(.elementor-widget-text-editor):has(.elementor-widget-button)
    .elementor-button:hover {
    background: var(--ift-ink) !important;
    color: #fff !important;
    box-shadow: var(--ift-shadow-hover);
  }

  /* ---- 2.6 Category quick-link rows (4x col-25 of buttons) -> pill grid ---- */
  body:not(.elementor-editor-active)
    .elementor-top-section:has(.elementor-widget-button):not(:has(.elementor-widget-heading)):not(:has(.elementor-widget-image))
    .elementor-row {
    gap: 12px;
    justify-content: center;
  }

  body:not(.elementor-editor-active)
    .elementor-top-section:has(.elementor-widget-button):not(:has(.elementor-widget-heading)):not(:has(.elementor-widget-image))
    .elementor-column.elementor-col-25 {
    width: calc(50% - 6px) !important;
    flex: 0 0 calc(50% - 6px) !important;
    max-width: calc(50% - 6px) !important;
  }

  body:not(.elementor-editor-active)
    .elementor-top-section:has(.elementor-widget-button):not(:has(.elementor-widget-heading)):not(:has(.elementor-widget-image))
    .elementor-button {
    display: flex;
    width: 100%;
    min-height: 50px;
    font-size: 14px !important;
    font-weight: 700 !important;
    background: var(--ift-surface) !important;
    color: var(--ift-ink) !important;
    border: 1.5px solid var(--ift-line) !important;
    border-radius: 999px !important;
    box-shadow: 0 2px 8px rgba(20, 24, 31, 0.05);
  }

  body:not(.elementor-editor-active)
    .elementor-top-section:has(.elementor-widget-button):not(:has(.elementor-widget-heading)):not(:has(.elementor-widget-image))
    .elementor-button:hover {
    background: var(--ift-accent) !important;
    color: var(--ift-ink) !important;
    border-color: var(--ift-accent) !important;
    box-shadow: 0 8px 20px rgba(140, 212, 0, 0.35);
  }

  /* ---- 2.7 Product carousels / grids ---- */
  body:not(.elementor-editor-active) .elementor-products .products.row.products-grid > [class*="col-"],
  body:not(.elementor-editor-active) .elementor-products .products.row.products-grid > .js-product-miniature,
  body:not(.elementor-editor-active) .elementor-products .products.row.products-grid > .product-miniature {
    flex: 0 0 50% !important;
    max-width: 50% !important;
  }

  body:not(.elementor-editor-active) .elementor-products .product-miniature {
    background: var(--ift-surface);
    border: 1px solid var(--ift-line);
    border-radius: 14px;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  }

  body:not(.elementor-editor-active) .elementor-products .product-miniature:hover {
    transform: translateY(-4px);
    box-shadow: var(--ift-shadow-hover);
    border-color: transparent;
  }

  body:not(.elementor-editor-active) .elementor-products .product-miniature .product-title,
  body:not(.elementor-editor-active) .elementor-products .product-miniature .product-title a {
    font-size: 14.5px !important;
    line-height: 1.4 !important;
    font-weight: 600;
    color: var(--ift-ink);
  }

  body:not(.elementor-editor-active) .elementor-products .product-miniature .product-price,
  body:not(.elementor-editor-active) .elementor-products .product-miniature .price {
    font-size: 17px !important;
    font-weight: 800 !important;
  }

  body:not(.elementor-editor-active) .elementor-products .product-miniature-small .product-title,
  body:not(.elementor-editor-active) .elementor-products .product-miniature-small .product-title a {
    font-size: 13.5px !important;
    line-height: 1.35 !important;
  }

  /* product add-to-cart buttons */
  body:not(.elementor-editor-active) .elementor-products .product-miniature .add-to-cart,
  body:not(.elementor-editor-active) .elementor-products .product-miniature .button {
    border-radius: var(--ift-radius-sm) !important;
    font-weight: 700 !important;
  }

  body:not(.elementor-editor-active) .elementor-products .products-list .product-title a {
    font-size: 15px !important;
    line-height: 1.4 !important;
  }

  /* carousel nav arrows: keep them inside, circular, subtle */
  body:not(.elementor-editor-active) .elementor-products .swiper-button-prev,
  body:not(.elementor-editor-active) .elementor-products .swiper-button-next,
  body:not(.elementor-editor-active) .elementor-products [class*="owl-prev"],
  body:not(.elementor-editor-active) .elementor-products [class*="owl-next"] {
    background: rgba(255, 255, 255, 0.92) !important;
    border-radius: 50% !important;
    box-shadow: var(--ift-shadow);
  }

  /* ---- 2.8 "Trusted Security Experts" feature row (4x col-25 heading+text) ---- */
  body:not(.elementor-editor-active)
    .elementor-top-section:has(.elementor-widget-heading):has(.elementor-widget-text-editor):not(:has(.elementor-widget-image)):not(:has(.elementor-widget-button)):not(:has(.elementor-widget-spacer))
    .elementor-column.elementor-col-25 {
    width: calc(50% - 8px) !important;
    flex: 0 0 calc(50% - 8px) !important;
    max-width: calc(50% - 8px) !important;
  }

  body:not(.elementor-editor-active)
    .elementor-top-section:has(.elementor-widget-heading):has(.elementor-widget-text-editor):not(:has(.elementor-widget-image)):not(:has(.elementor-widget-button)):not(:has(.elementor-widget-spacer))
    .elementor-row {
    gap: 16px;
    justify-content: center;
  }

  body:not(.elementor-editor-active)
    .elementor-top-section:has(.elementor-widget-heading):has(.elementor-widget-text-editor):not(:has(.elementor-widget-image)):not(:has(.elementor-widget-button)):not(:has(.elementor-widget-spacer))
    .elementor-column.elementor-col-25 .elementor-widget-wrap {
    background: var(--ift-surface);
    border: 1px solid var(--ift-line);
    border-radius: 14px;
    padding: 18px 16px;
    height: 100%;
    box-shadow: var(--ift-shadow);
    text-align: center;
  }

  /* ---- 2.9 Generic 3-up / 4-up fallback (any remaining unstyled rows) ---- */
  body:not(.elementor-editor-active) .elementor-column.elementor-col-33:not([style*="100%"]),
  body:not(.elementor-editor-active) .elementor-column[data-col="33"],
  body:not(.elementor-editor-active) .elementor-column.elementor-col-25,
  body:not(.elementor-editor-active) .elementor-column[data-col="25"],
  body:not(.elementor-editor-active) .elementor-column.elementor-col-20,
  body:not(.elementor-editor-active) .elementor-column[data-col="20"] {
    width: 50%;
    flex: 0 0 50%;
    max-width: 50%;
  }

  /* tighten populated column padding so tiles breathe */
  body:not(.elementor-editor-active) .elementor-column-gap-default .elementor-element-populated {
    padding: 10px !important;
  }
}
