/*
 * Mobile enhancements shared by every page.
 * Everything that changes layout or sizing lives inside the small-screen
 * media queries below, so the desktop layout is left untouched.
 * This file is loaded after each page's inline styles so it can override them.
 */

/* Embeds and media never exceed their container (safe at every size). */
iframe,
video,
embed,
object {
    max-width: 100%;
}

/* The menu toggle only exists on small screens. */
.nav-toggle {
    display: none;
}

@media (max-width: 768px) {

    /* ---------- Overflow / sideways scrolling ---------- */

    /* "clip" (not "hidden") so the sticky header keeps working. */
    html,
    body {
        max-width: 100%;
        overflow-x: clip;
    }

    body {
        -webkit-text-size-adjust: 100%;
        text-size-adjust: 100%;
    }

    img,
    svg,
    picture,
    canvas {
        max-width: 100%;
    }

    img:not([class]) {
        height: auto;
    }

    iframe,
    video,
    embed,
    object {
        width: 100%;
    }

    iframe {
        aspect-ratio: 16 / 9;
        height: auto;
    }

    pre,
    code {
        white-space: pre-wrap;
        word-break: break-word;
    }

    h1, h2, h3, h4, p, li, a, span, td, th, label {
        overflow-wrap: break-word;
    }

    /* Wide tables scroll inside their own box instead of the page. */
    table {
        max-width: 100%;
    }

    /* ---------- Readable body text (min 16px) ---------- */

    /* ":not(#_)" raises specificity so these beat page rules such as
       ".footer-about p" without needing !important. No paragraph/list text
       on the site is larger than 16px on phones, so nothing is shrunk. */
    body,
    p:not(#_),
    li:not(#_),
    td:not(#_),
    th:not(#_),
    label:not(#_),
    input:not(#_),
    select:not(#_),
    textarea:not(#_),
    .intro,
    .view-details,
    .product-hindi,
    .quantity-control span,
    .control-label,
    .weight-select,
    .form-note,
    .document-note,
    .okra-note,
    .info-text a,
    .footer-column ul a,
    .footer-contact p a {
        font-size: 16px;
    }

    p,
    li {
        line-height: 1.6;
    }

    /* Inputs at 16px also stop iOS from zooming in on focus. */
    input:not([type="checkbox"]):not([type="radio"]),
    select,
    textarea {
        min-height: 44px;
    }

    /* ---------- Tap targets (min 44 x 44px) ---------- */

    button,
    .btn,
    .submit-btn,
    .add-cart-btn,
    .remove-cart-btn,
    .cart-enquiry-btn,
    .products-cta a,
    .document-preview-link {
        min-height: 44px;
        font-size: 16px;
    }

    .btn,
    .view-details,
    .document-preview-link {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-height: 44px;
    }

    .quantity-control button {
        width: 44px;
        height: 44px;
        font-size: 20px;
    }

    .footer-column ul a,
    .footer-contact p a {
        display: inline-flex;
        align-items: center;
        min-height: 44px;
    }

    .footer-column ul li {
        margin-bottom: 0;
    }

    .footer-socials a {
        width: 44px;
        height: 44px;
    }

    .brand {
        min-height: 44px;
    }

    /* ---------- Collapsible navigation ---------- */

    .site-header {
        min-height: 0;
    }

    .nav,
    .site-header .nav {
        position: relative;
        width: calc(100% - 30px);
        min-height: 68px;
        padding: 8px 0;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        justify-content: space-between;
        gap: 0;
    }

    .brand {
        justify-content: flex-start;
        min-width: 0;
        flex: 1 1 auto;
    }

    .brand img,
    .logo-img {
        width: 48px;
        height: 48px;
        object-fit: contain;
    }

    .brand-name {
        font-size: 17px;
        white-space: normal;
    }

    .brand-tagline {
        font-size: 12px;
    }

    .js-nav .nav-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex: 0 0 auto;
        width: 48px;
        height: 48px;
        margin-left: 10px;
        padding: 0;
        border: 1px solid #ddd3c0;
        border-radius: 10px;
        background: #fffefa;
        color: #385526;
        font-size: 22px;
        cursor: pointer;
    }

    .nav-toggle:focus-visible {
        outline: 3px solid #c99036;
        outline-offset: 2px;
    }

    .nav-toggle .icon-close {
        display: none;
    }

    .nav.is-open .nav-toggle .icon-open {
        display: none;
    }

    .nav.is-open .nav-toggle .icon-close {
        display: inline;
    }

    .nav-links,
    .site-header .nav-links {
        width: 100%;
        flex-basis: 100%;
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
        flex-wrap: nowrap;
        gap: 4px;
        padding: 10px 0 6px;
    }

    .js-nav .nav-links {
        display: none;
    }

    .js-nav .nav.is-open .nav-links {
        display: flex;
    }

    .nav-links a,
    .site-header .nav-links a {
        display: flex;
        align-items: center;
        min-height: 48px;
        padding: 10px 14px;
        border-radius: 8px;
        font-size: 16px;
    }

    .nav-links .nav-cta,
    .nav-links .cart-nav {
        justify-content: center;
        margin-top: 6px;
        padding: 12px 16px;
    }

    /* ---------- Floating WhatsApp button ---------- */

    .floating_btn {
        width: auto;
    }

    .contact_icon {
        width: 58px;
        height: 58px;
        font-size: 28px;
    }

    .text_icon {
        display: none;
    }

    /* ---------- Tables ---------- */

    .comparison-table-wrapper {
        max-width: 100%;
        -webkit-overflow-scrolling: touch;
    }
}

@media (max-width: 480px) {

    /* Single-column cards so 16px text has room to breathe. */
    .products-grid {
        grid-template-columns: 1fr;
    }

    .shop-card-image {
        height: 220px;
    }

    .product-image-wrap {
        height: 220px;
    }

    .product-image-wrap .shop-card-image {
        height: 100%;
    }

    .shop-card h3 {
        font-size: 18px;
    }

    .product-tags span,
    .product-badge {
        font-size: 12px;
    }

    .benefits {
        font-size: 14px;
    }

    .eyebrow,
    .section-tag {
        font-size: 13px;
    }
}

@media (max-width: 768px) {
    .lightbox-close {
        width: 44px;
        height: 44px;
    }
}
