/* ==========================================
   NARESH ENGINEERING CORPORATION
   SITE-WIDE RESPONSIVE OVERRIDES
   Loaded LAST on every page (after the page's own CSS).
========================================== */


/* ==========================================
   PRODUCT HERO <picture>
   Machine pages serve a separate portrait banner on mobile
   (<source media="(max-width: 767px)">). The wrapper must not
   affect layout, so the <img> behaves exactly as before.
========================================== */

.nec-products-hero-picture {
    display: contents;
}


/* ==========================================
   HERO SECTIONS - MOBILE & TABLET
   On desktop the heroes are tall, full-bleed banners.
   On smaller screens a fixed height made the image/video
   crop by 45-75%. Here the hero takes the media's own
   aspect ratio, so the whole image/video is visible and
   the hero becomes shorter.
========================================== */

@media (max-width: 1024px) {

    .home-hero,
    .about-hero,
    .nec-products-hero,
    .high-speed-hero,
    .auxiliary-hero,
    .nec-contact-hero,
    .industries-hero,
    .quality-hero {
        height: auto !important;
        min-height: 0 !important;
    }

    .home-hero-video,
    .about-hero-image,
    .nec-products-hero-img,
    .high-speed-hero-image,
    .auxiliary-hero-image,
    .nec-contact-hero-image,
    .industries-hero-image,
    .quality-hero-image {
        position: relative !important;
        inset: auto !important;

        display: block;

        width: 100% !important;
        height: auto !important;
        max-height: none !important;

        object-fit: cover;
    }

    /* Reserve each hero's space BEFORE the image/video loads, so the hero
       never has 0 height (the header measures it to draw the logo curves).
       "auto" = use the real image ratio once it has loaded. */
    .home-hero-video        { aspect-ratio: 848 / 480; }
    .about-hero-image,
    .high-speed-hero-image,
    .auxiliary-hero-image   { aspect-ratio: auto 1717 / 916; }
    .nec-products-hero-img  { aspect-ratio: auto 1584 / 750; }
    .nec-contact-hero-image { aspect-ratio: auto 742 / 360; }
    .industries-hero-image  { aspect-ratio: auto 1600 / 800; }
    .quality-hero-image     { aspect-ratio: auto 1910 / 1023; }

}

/* Phones get the portrait product banner (see <picture> in the pages) */
@media (max-width: 767px) {

    .nec-products-hero-img  { aspect-ratio: auto 572 / 720; }

}


/* ==========================================
   SPEC TABLES (auxiliary product pages etc.)
   Classes are added by js/site-widgets.js:
   .nec-tscroll  = the horizontal scroll box
   .nec-ttable   = the table (--nec-cols = column count)
   .nec-tsticky  = first column stays visible while scrolling
========================================== */

/* High-speed granulator: 100px side padding left only 175px for the table */
@media (max-width: 1024px) {

    .granulator-table-section {
        box-sizing: border-box;
        padding-left: 24px !important;
        padding-right: 24px !important;
    }

    .granulator-table-wrapper {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

}

.nec-table-hint {
    display: none;
    margin: 8px 0 0;
    text-align: center;
    color: #6b7686;
    font-size: 12px;
    letter-spacing: 0.3px;
}

@media (max-width: 768px) {

    .granulator-table-section {
        padding-left: 12px !important;
        padding-right: 12px !important;
    }

    .nec-tscroll {
        box-sizing: border-box;
        width: 100% !important;
        max-width: 100% !important;
        margin-left: auto !important;
        margin-right: auto !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-x: contain;
        border-radius: 6px;
    }

    /* ~95px per column instead of the old fixed 900-1765px */
    .nec-ttable {
        width: 100% !important;
        min-width: max(100%, calc(var(--nec-cols, 6) * 95px)) !important;
    }

    .nec-tscroll .nec-ttable th,
    .nec-tscroll .nec-ttable td,
    .nec-tscroll .nec-ttable th *,
    .nec-tscroll .nec-ttable td * {
        font-size: 12px !important;
        line-height: 1.4 !important;
    }

    .nec-tscroll .nec-ttable th,
    .nec-tscroll .nec-ttable td {
        min-width: 80px !important; /* overrides per-column desktop widths */
        white-space: normal !important;
        overflow-wrap: break-word;
        padding: 8px 10px !important;
        font-size: 12px !important;
        line-height: 1.4 !important;
    }

    /* Collapsed borders are painted by the table (under the sticky cell),
       so scrolled text peeked through. Separate borders fix that. */
    .nec-tscroll .nec-tsticky {
        border-collapse: separate !important;
        border-spacing: 0 !important;
    }

    /* Sticky label column */
    .nec-tsticky tr > :first-child {
        position: sticky;
        left: 0;
        z-index: 2;
        width: 120px;
        min-width: 120px !important;
        max-width: 150px;
        background-color: var(--nec-sticky-bg, #ffffff) !important;
        background-image: var(--nec-sticky-img, none) !important;
        background-attachment: scroll !important;
        /* left: covers the 1-2px gap at the box edge; right: separation shadow */
        box-shadow:
            -4px 0 0 0 var(--nec-sticky-bg, #ffffff),
            3px 0 6px -2px rgba(15, 30, 60, 0.18);
    }

    .nec-tscroll.is-scrollable + .nec-table-hint {
        display: block;
    }

}
