/*
 * Go-live 0.17.0: India's own WordPress/WooCommerce pages (body.hf-native-portal) share the market routes'
 * graphite palette (global-2027.css re-points the theme's dark-scheme variables), the owned header navigation
 * and footer, and one content-to-footer spacing owner. Presentation only: no WooCommerce template, form,
 * price, quantity or checkout markup is changed or hidden here.
 */

/* Content-to-footer transition. Measured cause: the theme's .cs-site-content margin-bottom (11rem = 176 px
 * at >= 992 px, 6rem / 4rem below) stacked on each template's own trailing spacing. The wrapper now owns one
 * bottom padding; the footer keeps its 48 px (32 px on phones) internal top padding. */
body.hf-native-portal .cs-site-content {
    margin-bottom: 0;
    padding-bottom: 64px;
}

body.hf-native-portal :is(.cs-site-primary, .cs-content-area, .entry-content, .elementor, .pagelayer-content) > :last-child {
    margin-bottom: 0;
}

/* Elementor/PageLayer sections that end a page keep their own inner padding; only the trailing gap below
 * the final top-level section is removed. */
body.hf-native-portal .elementor > .e-con:last-child,
body.hf-native-portal .elementor > .elementor-section:last-child {
    margin-bottom: 0;
}

@media (max-width: 767.98px) {
    body.hf-native-portal .cs-site-content { padding-bottom: 40px; }
}

/* Restrained gold accent for links and the active navigation item, as on the market routes. */
body.hf-native-portal .cs-header .menu-item.current-menu-item > a,
body.hf-native-portal .cs-header .menu-item > a:is(:hover, :focus-visible) {
    color: var(--hf27-accent);
}

body.hf-native-portal :is(a, button, input, select, textarea, [tabindex]):focus-visible {
    outline-color: var(--hf27-accent);
}

/* Theme negative tracking collapses word spaces in short headings and table labels. */
body.hf-native-portal :is(.woocommerce-loop-product__title, .product_title, .cs-entry__title, table th) {
    word-spacing: normal;
}

/* Trailing spacing of the final block on each native template (measured on staging, 1440 px):
 * product pages end with the editorial extension (80 px padding + 48 px margin), Elementor pages with a
 * widget margin (60 px) plus column padding (20 px), the empty cart with 120 px block padding and the
 * not-found page with 68 px. Only the last block's trailing space is removed; inner spacing is unchanged. */
/* A product schema script can follow the editorial block, so match the last article rather than the last child. */
body.hf-native-portal .cs-single-product > .helfinch-editorial:last-child,
body.hf-native-portal .cs-single-product > article.helfinch-editorial:last-of-type {
    margin-bottom: 0;
    padding-bottom: 0;
}

body.hf-native-portal :is(.woocommerce-area, .cs-entry__wrap, .cs-content-area) > :last-child,
body.hf-native-portal .entry-content > :last-child,
body.hf-native-portal .elementor-widget-container > :last-child,
body.hf-native-portal .elementor > :is(.elementor-section, .e-con):last-child .elementor-widget:last-child > :last-child {
    margin-bottom: 0;
}

body.hf-native-portal .elementor > :is(.elementor-section, .e-con):last-child :is(.elementor-widget-wrap, .e-con-inner) {
    padding-bottom: 0;
}

body.hf-native-portal .elementor > :is(.elementor-section, .e-con):last-child .elementor-widget:last-child > .elementor-widget-container {
    margin-bottom: 0;
}

body.hf-native-portal .wp-block-woocommerce-empty-cart-block,
body.hf-native-portal .wc-block-checkout-empty,
body.hf-native-portal .cs-entry__comments:last-child .cs-entry__comments-inner,
body.hf-native-portal .cs-content-not-found {
    padding-bottom: 0;
}

/* Lighting guides use square product photographs as their featured image: show them at product scale
 * (centred, contained) instead of the theme's full-width uncropped hero. Landscape heroes are unchanged. */
body.hf-native-portal.hf-square-hero .cs-entry__media-inner {
    max-width: 520px;
    margin-inline: auto;
}

body.hf-native-portal.hf-square-hero .cs-entry__media-inner img {
    width: 100%;
    max-height: 520px;
    object-fit: contain;
}

@media (max-width: 767.98px) {
    body.hf-native-portal.hf-square-hero .cs-entry__media-inner { max-width: 320px; }
}

/* WordPress quote blocks inherit the theme's large display tracking, which collapses word spaces in long
 * quoted paragraphs (CSR, partner pages). Quoted prose keeps normal letter and word spacing. */
body.hf-native-portal :is(blockquote, .wp-block-quote, .wp-block-pullquote) :is(p, cite) {
    letter-spacing: 0;
    word-spacing: normal;
}

/* Post category/tag archives (Helfinch Editorial Design System) end with 112 px wrapper padding. */
body.hf-native-portal .cs-content-area > .helfinch-editorial-archive:last-child {
    padding-bottom: 0;
}

/* Landing pages end with a closing section followed by a non-section element (script/style), so :last-child
 * misses it: drop only its trailing margin. Its own padding (a visible band) is unchanged. */
body.hf-native-portal .entry-content > section:last-of-type {
    margin-bottom: 0;
}

/* Archive and page titles use the theme's display size; a long single word ("Manufacturing", "Uncategorized")
 * is wider than a 390 px screen. Titles may wrap inside the word instead of pushing the page sideways. */
body.hf-native-portal :is(.cs-page__title, .page-title, .woocommerce-products-header__title, .cs-entry__title, .product_title) {
    overflow-wrap: anywhere;
    hyphens: auto;
}

/* Single-page archives print an empty pagination nav whose top margin collapses below the grid (64 px). */
body.hf-native-portal .hf-archive-pagination:not(:has(a)) {
    display: none;
}

/* ---------- Phase II (4 Dec 2026): product A+ description family (.helfinch-aplus-50w) ----------
 * Root cause of the unreadable "Product Codes & Pack Details" table: products with the editorial
 * "authority evidence" extension load helfinch-editorial.css, whose unscoped .hf-table-wrap rule
 * (off-white #f8f7f2 panel, full-bleed width, translateX(-50%)) collides with the A+ description's own
 * .hf-table-wrap/.hf-table classes; the A+ stylesheet then paints white and gold text on that panel,
 * a 1,040 px table squeezes the introduction to 225 px, and phones get a forced 700 px table.
 * The A+ family is restyled as one component (scoped; !important only where the A+ inline sheet uses it). */
body.hf-native-portal .helfinch-aplus-50w {
    --hf-ap-surface: #16181c;
    --hf-ap-line: rgba(255, 255, 255, .09);
    --hf-ap-gold: #d8b46a;
    --hf-ap-text: #f2f3f5;
    --hf-ap-muted: #b5bbc3;
}

body.hf-native-portal .helfinch-aplus-50w .hf-table-wrap {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    transform: none !important;
    background: var(--hf-ap-surface) !important;
    border: 1px solid var(--hf-ap-line) !important;
    border-radius: 12px;
    overflow-x: auto !important;
    box-shadow: none !important;
}

body.hf-native-portal .helfinch-aplus-50w .hf-table-wrap::after { display: none !important; }

body.hf-native-portal .helfinch-aplus-50w .hf-table {
    width: 100% !important;
    min-width: 0 !important;
    height: auto !important;
    margin: 0 !important;
    border: 0 !important;
    border-collapse: collapse !important;
    background: transparent !important;
    font-size: 16px;
    line-height: 1.5;
}

body.hf-native-portal .helfinch-aplus-50w .hf-table tr,
body.hf-native-portal .helfinch-aplus-50w .hf-table tbody tr:nth-child(2n) td {
    background: transparent !important;
}

body.hf-native-portal .helfinch-aplus-50w .hf-table :is(td, th) {
    padding: 14px 18px !important;
    border: 0 !important;
    border-bottom: 1px solid var(--hf-ap-line) !important;
    color: var(--hf-ap-text) !important;
    background: transparent !important;
    vertical-align: top;
    height: auto !important;
    letter-spacing: 0;
    word-spacing: normal;
}

body.hf-native-portal .helfinch-aplus-50w .hf-table tr:last-child :is(td, th) { border-bottom: 0 !important; }

/* Label cells: first column, and the third column of four-column specification tables. */
body.hf-native-portal .helfinch-aplus-50w .hf-table td:first-child,
body.hf-native-portal .helfinch-aplus-50w .hf-table tr > td:nth-child(3):nth-last-child(2) {
    color: var(--hf-ap-gold) !important;
    font-weight: 600 !important;
    width: 32%;
}

body.hf-native-portal .helfinch-aplus-50w .hf-table th {
    color: #101216 !important;
    background: var(--hf-ap-gold) !important;
    font-weight: 700 !important;
}

/* Introduction beside its table: readable measure, table sized to its content. */
body.hf-native-portal .helfinch-aplus-50w .hf-spec-grid {
    grid-template-columns: minmax(280px, 2fr) minmax(0, 3fr) !important;
    align-items: start;
    gap: 48px !important;
}

/* Cards and section rules: fine solid lines instead of heavy dotted borders. */
body.hf-native-portal .helfinch-aplus-50w section {
    border-bottom: 1px solid var(--hf-ap-line) !important;
}

body.hf-native-portal .helfinch-aplus-50w .hf-card {
    border: 1px solid rgba(216, 180, 106, .28) !important;
    background: rgba(255, 255, 255, .03) !important;
    border-radius: 14px !important;
}

body.hf-native-portal .helfinch-aplus-50w h3 { color: var(--hf-ap-gold) !important; }

@media (max-width: 767.98px) {
    body.hf-native-portal .helfinch-aplus-50w .hf-spec-grid { grid-template-columns: 1fr !important; gap: 24px !important; }
    body.hf-native-portal .helfinch-aplus-50w .hf-table { font-size: 15px; }
    body.hf-native-portal .helfinch-aplus-50w .hf-table :is(td, th) { padding: 12px 14px !important; }
    /* Four-column specification rows (label, value, label, value) become two label/value pairs. */
    body.hf-native-portal .helfinch-aplus-50w .hf-table tr:has(> td:nth-child(4)) { display: grid; grid-template-columns: minmax(110px, 42%) 1fr; border-bottom: 1px solid var(--hf-ap-line); }
    body.hf-native-portal .helfinch-aplus-50w .hf-table tr:has(> td:nth-child(4)):last-child { border-bottom: 0; }
    body.hf-native-portal .helfinch-aplus-50w .hf-table tr:has(> td:nth-child(4)) > td { border-bottom: 0 !important; width: auto; }
    /* Comparison tables with a header row keep their columns and scroll inside their own frame. */
    body.hf-native-portal .helfinch-aplus-50w .hf-table:has(th) { min-width: 560px !important; }
}

/* Phase II: WooCommerce price states, sale badge, tier savings, review stars and variation reset on the graphite
 * surface (WCAG AA measured: struck-through red 4.0:1, pure #f00 savings 4.3:1, Sale badge 4.3:1, empty stars 2.1:1).
 * Colours only; prices, amounts and controls are unchanged. */
body.hf-native-portal :is(.price, .woocommerce-Price-amount) del,
body.hf-native-portal del :is(.woocommerce-Price-amount, .woocommerce-Price-currencySymbol),
body.hf-native-portal del.woocommerce-Price-amount {
    color: #f08a96 !important;
}

body.hf-native-portal :is(.tiered-pricing-you-save, .tiered-pricing-you-save *) {
    color: #ff8f8f !important;
}

body.hf-native-portal span.onsale {
    background-color: #b4233a !important;
    color: #ffffff !important;
}

body.hf-native-portal .hrs-star.empty {
    color: rgba(255, 255, 255, .5) !important;
}

body.hf-native-portal a.reset_variations {
    color: #b5bbc3 !important;
    opacity: 1 !important;
    text-decoration: underline;
}

/* Phase II batch B2. India landing pages (led-lights-india, buy-led-bulbs-online-in-india, high-watt-led-bulbs,
 * led-lights-for-home, led-panel-lights-india, direct-to-retailer, 150-lumens-per-watt-led-lights, bee-5-star-ratings)
 * paint light inline panels (#fff, #fff8d8, #fffdf2, #f8f6f1, #f6f6f6, #f4de86, gold) but leave many paragraphs and
 * links without an inline colour, so they inherited the dark theme's light text (1.04-1.9:1). Text without its own
 * inline colour inside a light inline surface (and not inside a nested dark inline surface) takes dark text. */
body.hf-native-portal .entry-content :is([style*="background: #fff"], [style*="background:#fff"], [style*="background: #FFF"], [style*="background: #f8f6f1"], [style*="background: #f6f6f6"], [style*="background: #f4de86"], [style*="background: #f6ca12"], [style*="background: #F6CA12"], [style*="background: #f4c404"])
    :is(p, li, span, td, th, strong, b, em, small, h1, h2, h3, h4, h5, h6, dt, dd, blockquote, label, figcaption):not([style*="color"]):not(:is([style*="background: #1"], [style*="background:#1"], [style*="background: #2"], [style*="background: #3"], [style*="background: #4"]) *) {
    color: #2b2b2b !important;
}

body.hf-native-portal .entry-content :is([style*="background: #fff"], [style*="background:#fff"], [style*="background: #FFF"], [style*="background: #f8f6f1"], [style*="background: #f6f6f6"], [style*="background: #f4de86"], [style*="background: #f6ca12"], [style*="background: #F6CA12"], [style*="background: #f4c404"])
    a:not([style*="color"]):not(:is([style*="background: #1"], [style*="background:#1"], [style*="background: #2"], [style*="background: #3"], [style*="background: #4"]) *) {
    color: #5c4400 !important;
}

/* Tables that declare white text (e.g. the BLDC fan article) get a dark cell surface instead of the editorial
 * light panel (white on #eceae2 / #f8f7f2 was invisible). */
.helfinch-editorial table[style*="color:#fff"] td,
.helfinch-editorial table[style*="color: #fff"] td,
.helfinch-editorial table[style*="color:#fff"] tbody tr:nth-child(2n) td {
    background: #16181c !important;
    border-color: rgba(255, 255, 255, .09) !important;
}

/* Post category pills on archive cards: gold text on white (1.65:1) -> dark text on gold, as on single posts. */
body.hf-native-portal .cs-entry__category .post-categories a {
    background: #d8b46a !important;
    color: #101216 !important;
}

/* Required-field marker on comment and contact forms (3.9:1 on graphite). */
body.hf-native-portal :is(.required, abbr.required) {
    color: #ff8a7a !important;
}

/* Long unbroken strings in body copy (bare URLs, e.g. the partner sign-up address on /online-resellers/) pushed the
 * page 22 px sideways at 390 px. break-word keeps table cell sizing unchanged. */
body.hf-native-portal :is(.entry-content, .cs-entry__content, .elementor-widget-text-editor) :is(p, li, dd, dt, blockquote, figcaption, h1, h2, h3, h4, h5, h6) {
    overflow-wrap: break-word;
}

/* R-9 content-to-footer spacing: the layout already owns 64 px (.cs-site-content padding-bottom); these trailing
 * margins/paddings doubled it. Short pages still keep the footer at the window bottom (viewport fill, intended). */
body.hf-native-portal .woocommerce-no-products-found .woocommerce-info {
    margin-bottom: 0 !important;
}
body.hf-native-portal .hqc-wrap.hqc-catalog {
    padding-bottom: 0 !important;
}
body.hf-native-portal .hqc-wrap.hqc-catalog > :last-child {
    margin-bottom: 0 !important;
}
@media (max-width: 767.98px) {
    body.hf-native-portal main.hqc-wrap.hqc-single {
        padding-bottom: 24px !important;
    }
}

/* Account forms (login, lost password, register): white inputs showed the graphite theme's light placeholder
 * (#b5bbc3 on #fff, 1.9:1). Labels exist; the placeholder still has to be readable. */
body.hf-native-portal .woocommerce-Input::placeholder,
body.hf-native-portal .woocommerce-form :is(input, textarea)::placeholder {
    color: #5f6670 !important;
    opacity: 1 !important;
}

/* Quick-commerce product cards on phones: the two-line title clamp cut the product's rating qualifier
 * ("10W LED Bulb TwinPack (5 Star..."). Three lines fit every current title. */
@media (max-width: 767.98px) {
    body.hf-native-portal .hqc-card a.hqc-card-title {
        -webkit-line-clamp: 3 !important;
        line-clamp: 3;
    }
}

/* ---- Phase II B5 (independent visual QA) ---- */

/* IQ-V-002 / IQ-V-007: 60 px page titles in ~220-280 px boxes broke inside words at 320 px ("Contac/t",
 * "Consume/r"). Phones below 420 px get a fluid title size. */
@media (max-width: 419.98px) {
    body.hf-native-portal :is(.entry-content h1, h1.page-title, h1.woocommerce-products-header__title, h1.elementor-heading-title) {
        font-size: clamp(32px, 12vw, 46px) !important;
        line-height: 1.08 !important;
    }
}

/* IQ-V-013: product breadcrumb wrapped on phones and its second line was covered by the gallery band. One line,
 * the current item ends in an ellipsis (the full name is the H1 below). */
@media (max-width: 767.98px) {
    body.hf-native-portal .woocommerce-breadcrumb {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

/* IQ-V-017: quick-commerce catalogue intro: 23 px body copy with -1.2 px tracking ran words together; the
 * heading was the same size as the text. */
body.hf-native-portal .hqc-catalog-bottom-copy :is(p, h2) {
    letter-spacing: normal !important;
}
body.hf-native-portal .hqc-catalog-bottom-copy > h2:first-child {
    font-size: clamp(24px, 2.4vw, 30px) !important;
    margin-bottom: 10px !important;
}
/* The listing plugin marks the intro sentence up as a second h2; it is body copy. */
body.hf-native-portal .hqc-catalog-bottom-copy > :is(p, h2:not(:first-child)) {
    font-size: 17px !important;
    font-weight: 400 !important;
    line-height: 1.65 !important;
}

/* IQ-V-010: A+ comparison tables keep their columns on phones and scroll inside the frame, but nothing showed
 * that more columns exist. Scroll shadows: a gold edge appears on the side that has more content. */
@media (max-width: 767.98px) {
    body.hf-native-portal .helfinch-aplus-50w .hf-table-wrap:has(.hf-table th) {
        background:
            linear-gradient(90deg, #16181c 30%, rgba(22, 24, 28, 0)) left center / 36px 100% no-repeat local,
            linear-gradient(270deg, #16181c 30%, rgba(22, 24, 28, 0)) right center / 36px 100% no-repeat local,
            radial-gradient(farthest-side at 0 50%, rgba(216, 180, 106, .8), rgba(216, 180, 106, 0)) left center / 22px 100% no-repeat scroll,
            radial-gradient(farthest-side at 100% 50%, rgba(216, 180, 106, .8), rgba(216, 180, 106, 0)) right center / 22px 100% no-repeat scroll,
            #16181c !important;
    }
}
