/* Hub "Буровые реагенты и химические добавки для РВО" and its product pages.
   Loaded on top of produkt_style.css (functions.php) for the hub template and for the drilling_product post type.
   Both pages reuse the markup and the styles of the chemical products page (title bar, #ximik section with its
   orange-bar h4, .xim-back card, #produksiya cards). Only what that page does not have is added here.
   The text of the sections comes from ACF WYSIWYG fields, so the rules below address plain HTML (p, ul, table). */


/* ---------- Hub and product: shared ---------- */

/* The title bar paints the h1 with a white-to-blue gradient over its whole box. That suits the one-line
   "Химическая продукция", but the first line of a two-line title would be almost white. Cloning the
   box per line gives every line the same gradient. */
.bv_product_ximik.hub-title h1 {
    display: inline;
    -webkit-box-decoration-break: clone;
    box-decoration-break: clone;
}
/* the two lines of a long title get about the same length instead of one word on the second line */
.bv_product_ximik.hub-title {
    text-wrap: balance;
}

/* Keeps «ASDAPAC-HV 85 %» together in a two-line title */
.product-nowrap {
    white-space: nowrap;
}

/* The chemical page has a second <h1> in the right column of the card. Here it is an <h2> (one <h1> per page)
   with exactly the look of ".xim-title h1" from produkt_style.css. */
.xim-title h2 {
    margin-left: 16px;
    color: black;
    box-sizing: border-box;
    font-weight: 700;
    font-size: 32px;
    line-height: 39px;
    margin-bottom: 30px;
}


/* ".card-img" is a fixed 250px box. Landscape photos fit it, a portrait one (big-bag products) would overflow and show
   only its top, so every photo fills the box and is cropped around the bag instead of being stretched or cut at the top. */
.drilling-cards .card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 58%;
}


/* The theme sets its own font on <p>; the text of #srd-2 (hub intro) and of the product sections is Google Sans,
   as on the chemical page, where it is bare text inside #srd-2. */
.hub-intro #srd-2 p,
.product-info .product-text p,
.product-info .product-text li {
    font-family: inherit;
    font-weight: inherit;
    letter-spacing: inherit;
}


/* ---------- Hub ---------- */

/* Intro text: the h4 (orange bars) and the paragraphs come from one field */
.hub-intro #srd-2 h4 {
    margin-bottom: 3rem;
}
.hub-intro #srd-2 p {
    margin-bottom: .8em;
}
.hub-intro #srd-2 p:last-child {
    margin-bottom: 0;
}

/* 19 products make the right column much taller than the 11 on the chemical page, and
   ".xim-img img" is height: 100% without object-fit, which would stretch the photo. */
#big-info.hub-offer .xim-img img {
    object-fit: cover;
    object-position: 92% center; /* the big bags with the products are on the right of the photo */
}

/* The list of products: the look of ".xim-back .component .comp-text" of the chemical page, made from a <ul> */
.hub-offer .xim-title ul {
    margin: 0;
    padding: 0 !important;
    list-style: none;
}
.hub-offer .xim-title ul li {
    margin: 0 0 12px 28px;
    font-style: normal;
    font-weight: 700;
    font-size: 20px;
    line-height: 24px;
}
.hub-offer .xim-title ul li:first-child {
    margin-top: 0; /* header.php gives every first <li> a 35px top margin */
}
.hub-offer .xim-title ul li::before {
    content: url("../images/categ12.png");
    right: 11px;
    position: relative;
    top: 6px;
}
@media (min-width: 991px) and (max-width: 1600px) {
    .hub-offer .xim-title ul li {
        margin-bottom: 1px;
        font-size: 16px;
        line-height: 20px;
    }
}
@media (min-width: 320px) and (max-width: 990px) {
    .hub-offer .xim-title ul li {
        margin-bottom: 12px;
        font-size: 13px;
        font-weight: 600;
    }
}

/* Closing SEO text: same look as the footer text of /barvent-produktsiya (#foot_text) */
.hub-seo-text {
    margin-top: 40px;
    color: black;
    border-top: 1px solid #ddd;
    padding-top: 20px;
}
.hub-seo-text p {
    margin-bottom: 16px;
}


/* ---------- Product ---------- */

/* Photo + key facts card: the same .xim-back block as the hub's "Мы предлагаем" block */
.product-main .xim-img {
    display: flex;
    align-items: center;
}
/* ".xim-img img" is height: 100% in produkt_style.css; the photo is shown whole at its own aspect ratio */
.product-main .xim-img img {
    height: auto;
}
.product-main .xim-title {
    padding: 30px 40px 36px 40px;
}

/* Key facts: a lead paragraph, then a list "label (strong) + value". The template wraps the value in a <span>,
   so every row is a two-cell grid and a row grows with whichever of the two is longer. */
.product-facts > p:first-child {
    margin: 0 0 14px 16px;
    font-size: 18px;
    line-height: 28px;
    font-weight: 500;
    color: #565656;
}
.product-facts ul {
    margin: 0 0 28px 16px;
    padding: 0 !important;
    list-style: none;
}
.product-facts ul li {
    display: grid;
    grid-template-columns: 170px 1fr;
    gap: 16px;
    margin: 0;
    padding: 12px 0;
    border-bottom: 1px solid #e3e6ee;
    font-size: 17px;
    line-height: 24px;
    font-weight: 600;
    color: #000;
}
.product-facts ul li:first-child {
    margin-top: 0; /* header.php gives every first <li> a 35px top margin */
}
.product-facts ul li strong {
    font-size: 15px;
    font-weight: 500;
    color: #565656;
}

/* Same orange as the submit button of the inquiry modal */
.product-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 52px;
    margin-left: 16px;
    padding: 0 28px;
    background: #f39500;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.3;
    text-align: center;
    cursor: pointer;
    transition: background .2s;
}
.product-cta:hover {
    background: #d98200;
}

/* #ximik is made for one short paragraph (#srd-2: 25px, centred). The product page has several blocks,
   some of them with lists, so the text gets the same look with a narrower measure and a slightly smaller size. */
.product-info .product-text {
    max-width: 960px;
    margin-left: auto;
    margin-right: auto;
    font-family: 'Google sans';
    font-weight: 400;
    font-size: 22px;
    line-height: 32px;
    text-align: center;
    color: #000000;
}
.product-info .product-text p:last-child {
    margin-bottom: 0;
}
/* a list is one centred block with left-aligned items */
.product-info .product-text ul {
    display: table;
    margin: 16px auto;
    padding: 0 !important;
    list-style: none;
    text-align: left;
}
.product-info .product-text ul li {
    position: relative;
    margin: 0 0 8px 0;
    padding-left: 28px;
}
.product-info .product-text ul li:first-child {
    margin-top: 0; /* header.php gives every first <li> a 35px top margin */
}
.product-info .product-text ul li::before {
    content: "";
    position: absolute;
    top: 11px;
    left: 0;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #f39500;
}

/* Technical table (<p> note + <table> from the field; the template wraps the table in .product-table-wrap) */
.product-tech > p {
    max-width: 960px;
    margin: 0 auto 24px auto;
    font-size: 16px;
    line-height: 24px;
    text-align: center;
    color: #565656;
}
.product-table-wrap {
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0px 4px 15px rgba(0, 0, 0, 0.25);
    background: #fff;
}
.product-table-wrap table {
    width: 100%;
    margin: 0;
    border-collapse: collapse;
    color: #000;
}
.product-table-wrap caption {
    caption-side: top;
    padding: 18px 20px;
    background: #fff;
    font-size: 15px;
    line-height: 22px;
    color: #565656;
    text-align: left;
}
.product-table-wrap caption strong {
    display: block;
    font-size: 20px;
    line-height: 28px;
    color: #000;
}
.product-table-wrap th {
    padding: 14px 20px;
    background: #003CDE;
    color: #fff;
    font-size: 15px;
    line-height: 20px;
    font-weight: 600;
    text-align: left;
}
.product-table-wrap td {
    padding: 14px 20px;
    border-top: 1px solid #e3e6ee;
    font-size: 16px;
    line-height: 24px;
    text-align: left;
    vertical-align: top;
}
.product-table-wrap tbody tr:nth-child(even) {
    background: #f3f6ff;
}
.product-table-wrap th:first-child,
.product-table-wrap td:first-child {
    width: 56px;
    text-align: center;
}
.product-table-wrap td:last-child {
    font-weight: 600;
}

/* "Смотрите также" footer link */
.product-back {
    display: inline-block;
    padding: 12px 26px;
    border: 2px solid #f39500;
    border-radius: 6px;
    color: #000;
    font-weight: 600;
    text-decoration: none;
    transition: background .2s, color .2s;
}
.product-back:hover {
    background: #f39500;
    color: #fff;
    text-decoration: none;
}

@media (max-width: 1199px) {
    .product-facts ul li {
        grid-template-columns: 1fr;
        gap: 2px;
    }
}

@media (max-width: 991px) {
    .product-main .xim-title {
        padding: 24px 20px 30px 20px;
    }
}

@media (max-width: 767px) {
    .product-facts > p:first-child,
    .product-facts ul {
        margin-left: 0;
    }
    .product-cta {
        width: 100%;
        margin-left: 0;
    }
    .product-info .product-text {
        font-size: 18px;
        line-height: 28px;
    }
    .product-info .product-text ul li::before {
        top: 9px;
    }
    /* the section headings: shorter orange bars, otherwise the words wrap under each other */
    #ximik.product-info h4::before,
    #ximik.product-info h4::after {
        flex: 0 0 36px;
        width: 36px;
    }
    #ximik.product-info h4 {
        text-align: center;
    }
    /* the table turns into one card per row: the indicator, then norm and result with their labels */
    .product-table-wrap thead {
        display: none;
    }
    .product-table-wrap tr,
    .product-table-wrap td {
        display: block;
    }
    .product-table-wrap tbody tr {
        padding: 12px 0;
        border-top: 1px solid #e3e6ee;
    }
    .product-table-wrap td,
    .product-table-wrap td:first-child {
        width: auto;
        padding: 3px 16px;
        border-top: none;
    }
    .product-table-wrap td:first-child {
        display: none;
    }
    .product-table-wrap td:nth-child(2) {
        padding-bottom: 6px;
        font-weight: 600;
    }
    .product-table-wrap td:nth-child(3),
    .product-table-wrap td:nth-child(4) {
        display: flex;
        justify-content: space-between;
        gap: 16px;
        font-size: 15px;
        text-align: right;
    }
    .product-table-wrap td:nth-child(3)::before,
    .product-table-wrap td:nth-child(4)::before {
        flex: 0 0 45%;
        font-weight: 400;
        text-align: left;
        color: #565656;
    }
    .product-table-wrap td:nth-child(3)::before {
        content: "Норма";
    }
    .product-table-wrap td:nth-child(4)::before {
        content: "Результат анализа";
    }
}
