/* ==========================================================================
   Components — Pages & Cards
   Extracted from inline blade styles. Loaded after responsive.css.
   Selectors scoped specifically to avoid leaking into other contexts.
   ========================================================================== */

/* --------------------------------------------------------------------------
   ABOUT / KNOW — readable single column with prose width cap
   -------------------------------------------------------------------------- */
.about-content,
.content-page.know-page {
    max-width: var(--read-w);
    margin-inline: auto;
    padding-inline: var(--container-pad);
    min-height: 50%;
}
.about-content section,
.content-page.know-page section { margin-block: var(--space-lg); }

/* --------------------------------------------------------------------------
   CONTACT — 2-col layout (form left, info right) at 768+
   -------------------------------------------------------------------------- */
.contact-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-lg);
}
@media (min-width: 768px) {
    .contact-layout { grid-template-columns: 1.2fr 1fr; }
}
.contact-form { min-width: 0; }
.contact-form input,
.contact-form textarea,
.contact-form select { width: 100%; font-size: max(16px, var(--fs-base)); }

/* SUPPLIERS — grid layout in responsive.css §31b. Page-specific bits only: */
.suppliers-page-grid .supplier { margin: 0; }
.supplier-card { margin-bottom: var(--space-xl); } /* legacy class */
.swiper-section .supplier-img {
    aspect-ratio: 392 / 287;
    width: 100%;
    max-width: 100%;
    height: auto;
}

/* --------------------------------------------------------------------------
   MAINTENANCE — fluid sizing via foundation tokens
   -------------------------------------------------------------------------- */
.maintenance-wrapper {
    min-height: 100vh;
    min-height: 100dvh;
    padding-inline: var(--container-pad);
}
.maintenance-logo { max-width: clamp(120px, 20vw, 200px); height: auto; }
.maintenance-title { font-size: var(--fs-h1); color: #333; margin-bottom: var(--space-md); }
.maintenance-message { font-size: var(--fs-md); color: #555; max-width: 60ch; margin-inline: auto; }
.maintenance-note { font-size: var(--fs-base); color: #595959; } /* AA on white ≈5.93:1 */
.maintenance-socials { gap: var(--space-md); }

/* --------------------------------------------------------------------------
   SEARCH — centered, full-width input
   -------------------------------------------------------------------------- */
.search-page {
    max-width: 800px;
    margin-inline: auto;
    padding-inline: var(--container-pad);
}
.search-page form input[type="text"],
.search-page form input[type="search"],
.search-page form input.form-control {
    width: 100% !important;
    max-width: 100%;
    font-size: max(16px, var(--fs-base));
    padding: var(--space-sm) var(--space-md);
}
/* Grid columns from responsive.css §31b; only adds top spacing here */
.search-results-list { margin-top: var(--space-lg); }

/* --------------------------------------------------------------------------
   ERROR PAGES — fluid centered layout (404, 500, etc.)
   -------------------------------------------------------------------------- */
.error-page {
    max-width: 600px;
    margin-inline: auto;
    padding-inline: var(--container-pad);
}
.error-page .h1-404 { font-size: var(--fs-h1); }
.error-page-form input[type="text"] { font-size: max(16px, var(--fs-base)); }

/* Honeypot — visually hidden but submitted with the form. Real users never
   see this; bots that auto-fill all inputs will flunk validation. */
.honeypot-field {
    position: absolute !important;
    left: -10000px !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
}

/* --------------------------------------------------------------------------
   RELATED PRODUCTS slider — thumbnail sizing
   -------------------------------------------------------------------------- */
.related-product-thumb {
    max-width: 200px;
    max-height: 200px;
    height: auto;
    width: auto;
}

/* --------------------------------------------------------------------------
   PRODUCT DETAIL — gallery + info grid
   -------------------------------------------------------------------------- */
.product-detail-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-lg);
}
/* Grid items default to min-width:auto which lets content (Swiper translate3d
   slides at 33M+ px) inflate the track. Force min-width:0 + overflow clamp
   so the gallery + info column never push the page wider than viewport. */
.product-detail-grid > * { min-width: 0; }
.product-detail-grid .product-images,
.product-detail-grid .product-information { min-width: 0; max-width: 100%; }
.product-detail-grid .swiper-entry,
.product-detail-grid .container-swiper {
    max-width: 100%;
    overflow: hidden; /* contain swiper transform overflow visually + DOM-wise for capture */
}
@media (min-width: 768px) {
    .product-detail-grid {
        grid-template-columns: minmax(280px, 1fr) minmax(280px, 1fr);
    }
}
@media (min-width: 1200px) {
    .product-detail-grid {
        grid-template-columns: 1.2fr 1fr;
    }
}
.product-detail-grid img.main-image,
.product-detail-grid .product-image-wrapper img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: contain;
    background: #fafafa;
}
.product-detail-grid .product-title { font-size: var(--fs-h2); }
.product-detail-grid .price { font-size: var(--fs-h3); font-weight: 700; }
/* --------------------------------------------------------------------------
   EDITOR / RICH-TEXT CONTENT (Word/Elementor pasted markup) — make responsive
   without altering authored HTML. Targets product description + blog body.
   Strips fixed pixel widths from <table>/<img>/<iframe>/<video> and forces
   wide tables into a horizontal scroll wrapper.
   -------------------------------------------------------------------------- */
.tab-content-inner .elementor-widget-container,
.elementor-widget-container.pe-3,
article .post-content,
.blog-show .editor-content,
section.elementor-section .elementor-widget-container {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
/* Strip authored fixed widths on media + media-like elements */
.tab-content-inner .elementor-widget-container :is(img, video, iframe, embed, object),
.elementor-widget-container.pe-3 :is(img, video, iframe, embed, object),
article .post-content :is(img, video, iframe, embed, object),
section.elementor-section .elementor-widget-container :is(img, video, iframe, embed, object) {
    max-width: 100% !important;
    height: auto !important;
    width: auto;
    display: inline-block;
}
/* Tables: keep their styling but allow horizontal scroll on overflow.
   `display:block` + `overflow-x:auto` lets the table scroll inside its
   container instead of pushing the whole page wider. */
.tab-content-inner .elementor-widget-container table,
.elementor-widget-container.pe-3 table,
article .post-content table,
.blog-show table,
section.elementor-section .elementor-widget-container table {
    max-width: 100% !important;
    display: block;
    overflow-x: auto;
    width: max-content;
    min-width: 0;
}
/* Tablet+ — let tables hit container width naturally if they fit */
@media (min-width: 768px) {
    .tab-content-inner .elementor-widget-container table,
    .elementor-widget-container.pe-3 table,
    article .post-content table,
    .blog-show table,
    section.elementor-section .elementor-widget-container table {
        width: 100% !important;
        display: table;
        overflow-x: visible;
    }
}
/* Strip authored explicit `width:Xpx` style on tables but keep cell padding */
.tab-content-inner .elementor-widget-container table[style*="width"],
.elementor-widget-container.pe-3 table[style*="width"] {
    /* override inline width via specificity */
    width: max-content !important;
    max-width: 100% !important;
}
@media (min-width: 768px) {
    .tab-content-inner .elementor-widget-container table[style*="width"],
    .elementor-widget-container.pe-3 table[style*="width"] {
        width: 100% !important;
    }
}
/* Cells: avoid super-tight columns crashing on mobile */
.tab-content-inner .elementor-widget-container :is(td, th),
.elementor-widget-container.pe-3 :is(td, th) {
    word-break: break-word;
    overflow-wrap: anywhere;
    padding: var(--space-2xs) var(--space-xs);
}
/* Word-pasted markup often uses .MsoNormalTable with 0 padding — restore */
.MsoTable15List1Light :is(td, th),
.MsoNormalTable :is(td, th) {
    padding: var(--space-2xs) var(--space-xs) !important;
}
/* Long URLs / unbroken strings inside paragraphs */
.tab-content-inner .elementor-widget-container :is(p, li, span, h1, h2, h3, h4),
.elementor-widget-container.pe-3 :is(p, li, span, h1, h2, h3, h4) {
    overflow-wrap: anywhere;
}
/* --------------------------------------------------------------------------
   FONT-SIZE NEUTRALIZER — frontend-only (does NOT touch authored content
   or editor config). TinyMCE still exposes the fontsize buttons so authors
   can use them, but any inline `font-size`, `mso-bidi-font-size`, or
   legacy `<font size="N">` baked into stored HTML is mapped onto the
   site's typography token (--fs-base / --fs-h*) on render. Tag-aware so
   headings keep their scale even when authored with hard pixel sizes.
   Scope is intentionally narrow — only user-content rendering surfaces
   (product description, blog body, supplier info, about page) — so
   layout/design widgets on Home/About are untouched.
   -------------------------------------------------------------------------- */
/* `[style*="font-size" i]` is case-insensitive (CSS Selectors L4). All
   browsers we support honor it; legacy fallback below uses lowercase only. */
.tab-content-inner .elementor-widget-container :is(p, li, td, th, span, div, a, strong, em, b, i, u, label)[style*="font-size" i],
.elementor-widget-container.pe-3 :is(p, li, td, th, span, div, a, strong, em, b, i, u, label)[style*="font-size" i],
article .post-content :is(p, li, td, th, span, div, a, strong, em, b, i, u, label)[style*="font-size" i],
.blog-show :is(p, li, td, th, span, div, a, strong, em, b, i, u, label)[style*="font-size" i],
.about-content :is(p, li, td, th, span, div, a, strong, em, b, i, u, label)[style*="font-size" i],
.editor-content :is(p, li, td, th, span, div, a, strong, em, b, i, u, label)[style*="font-size" i] {
    font-size: var(--fs-base) !important;
    line-height: 1.6 !important;
}
/* Headings: keep type scale even when authored with inline font-size */
.tab-content-inner .elementor-widget-container :is(h1)[style*="font-size" i],
.elementor-widget-container.pe-3 :is(h1)[style*="font-size" i],
article .post-content :is(h1)[style*="font-size" i],
.blog-show :is(h1)[style*="font-size" i],
.about-content :is(h1)[style*="font-size" i],
.editor-content :is(h1)[style*="font-size" i] { font-size: var(--fs-h1) !important; line-height: 1.2 !important; }

.tab-content-inner .elementor-widget-container :is(h2)[style*="font-size" i],
.elementor-widget-container.pe-3 :is(h2)[style*="font-size" i],
article .post-content :is(h2)[style*="font-size" i],
.blog-show :is(h2)[style*="font-size" i],
.about-content :is(h2)[style*="font-size" i],
.editor-content :is(h2)[style*="font-size" i] { font-size: var(--fs-h2) !important; line-height: 1.25 !important; }

.tab-content-inner .elementor-widget-container :is(h3)[style*="font-size" i],
.elementor-widget-container.pe-3 :is(h3)[style*="font-size" i],
article .post-content :is(h3)[style*="font-size" i],
.blog-show :is(h3)[style*="font-size" i],
.about-content :is(h3)[style*="font-size" i],
.editor-content :is(h3)[style*="font-size" i] { font-size: var(--fs-h3) !important; line-height: 1.3 !important; }

.tab-content-inner .elementor-widget-container :is(h4)[style*="font-size" i],
.elementor-widget-container.pe-3 :is(h4)[style*="font-size" i],
article .post-content :is(h4)[style*="font-size" i],
.blog-show :is(h4)[style*="font-size" i],
.about-content :is(h4)[style*="font-size" i],
.editor-content :is(h4)[style*="font-size" i] { font-size: var(--fs-h4) !important; line-height: 1.35 !important; }

.tab-content-inner .elementor-widget-container :is(h5, h6)[style*="font-size" i],
.elementor-widget-container.pe-3 :is(h5, h6)[style*="font-size" i],
article .post-content :is(h5, h6)[style*="font-size" i],
.blog-show :is(h5, h6)[style*="font-size" i],
.about-content :is(h5, h6)[style*="font-size" i],
.editor-content :is(h5, h6)[style*="font-size" i] { font-size: var(--fs-h5) !important; line-height: 1.4 !important; }

/* Legacy <font size="N">…</font> wrappers — keep text, drop size. */
.tab-content-inner .elementor-widget-container font[size],
.elementor-widget-container.pe-3 font[size],
article .post-content font[size],
.blog-show font[size],
.about-content font[size],
.editor-content font[size] {
    font-size: inherit !important;
}
/* iframes (videos) — responsive 16:9 wrapper alternative when no wrapper present */
.tab-content-inner .elementor-widget-container iframe,
.elementor-widget-container.pe-3 iframe {
    width: 100% !important;
    aspect-ratio: 16 / 9;
}
/* Word-pasted markup often carries rogue `dir="rtl"` on tables/paragraphs
   authored on an Arabic-locale Word install with English text. The table
   DOM order is [value-cell, label-cell] expecting RTL visual flip. We
   keep the table-level dir=rtl so labels read first, but force LTR on
   inline text inside cells/paragraphs so English reads left-to-right. */
html[dir="ltr"] .tab-content-inner .elementor-widget-container :is(p, span, td, th, li, h1, h2, h3, h4, h5, h6)[dir],
html[dir="ltr"] .elementor-widget-container.pe-3 :is(p, span, td, th, li, h1, h2, h3, h4, h5, h6)[dir],
html[dir="ltr"] article .post-content :is(p, span, td, th, li, h1, h2, h3, h4, h5, h6)[dir],
html[dir="ltr"] .blog-show :is(p, span, td, th, li, h1, h2, h3, h4, h5, h6)[dir] {
    direction: ltr !important;
    text-align: start;
}
/* Mobile: convert RTL-authored tables into stacked rows so labels +
   values both fit without horizontal scroll. Each cell becomes a line
   with the label visually first (DOM had label-cell second under dir=rtl). */
@media (max-width: 767.98px) {
    html[dir="ltr"] .elementor-widget-container.pe-3 table[dir="rtl"],
    html[dir="ltr"] .tab-content-inner .elementor-widget-container table[dir="rtl"] {
        display: block !important;
        width: 100% !important;
        direction: ltr !important;
    }
    html[dir="ltr"] .elementor-widget-container.pe-3 table[dir="rtl"] :is(thead, tbody, tfoot),
    html[dir="ltr"] .tab-content-inner .elementor-widget-container table[dir="rtl"] :is(thead, tbody, tfoot) {
        display: block !important;
        width: 100% !important;
    }
    html[dir="ltr"] .elementor-widget-container.pe-3 table[dir="rtl"] tr,
    html[dir="ltr"] .tab-content-inner .elementor-widget-container table[dir="rtl"] tr {
        display: flex !important;
        flex-direction: column-reverse; /* DOM order: [value, label] → render: label on top */
        width: 100% !important;
        height: auto !important;
        gap: 0;
        padding-block: var(--space-xs);
        border-bottom: 1px solid #e5e7eb;
    }
    html[dir="ltr"] .elementor-widget-container.pe-3 table[dir="rtl"] :is(td, th),
    html[dir="ltr"] .tab-content-inner .elementor-widget-container table[dir="rtl"] :is(td, th) {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        text-align: start !important;
        padding: var(--space-2xs) var(--space-xs) !important;
        white-space: normal !important;
    }
    /* Label cell — Word marks them with strong+RTL paragraph */
    html[dir="ltr"] .elementor-widget-container.pe-3 table[dir="rtl"] td:has(strong),
    html[dir="ltr"] .tab-content-inner .elementor-widget-container table[dir="rtl"] td:has(strong) {
        font-weight: 600;
        background: transparent !important;
    }
}

.product-detail-grid .cart {
    flex-wrap: wrap;
    gap: var(--space-sm);
}
.product-detail-grid .cart .quantity { flex: 0 0 auto; }
.product-detail-grid .cart .btn-primary { flex: 1 1 auto; min-width: 200px; }
.related-products-title { font-size: var(--fs-h3); margin-block: var(--space-lg) var(--space-md); }

/* --------------------------------------------------------------------------
   BLOG list + show
   -------------------------------------------------------------------------- */
/* Grid columns + img aspect-ratio from responsive.css §31b */
.blog-list-grid .post-card { display: flex; flex-direction: column; }
.blog-list-grid .post-card :is(h2, h3) { font-size: var(--fs-h4); }

.blog-show {
    max-width: var(--read-w);
    margin-inline: auto;
    padding-inline: var(--container-pad);
}
.blog-show img { width: 100%; max-width: 100%; height: auto; }
.blog-show h1, .blog-show h2 { text-wrap: balance; }
.blog-show p { text-wrap: pretty; }
.blog-show .editor-content { font-size: var(--fs-md); line-height: 1.7; }
@media (min-width: 1200px) {
    .blog-show { max-width: 75ch; }
}
