/**
 * MG Red Shift - content pages (Etap 11, nr 5, 34, 35): layout and type of the text pages only.
 *
 * Loaded by mgredline_content_assets() (inc/content-pages.php) on content pages (body.mgredline-content-page: every
 * page except home, shop, cart, checkout, account and Technology) and on the 404, after controls.css. Buttons and the
 * search field get their look from controls.css; this sheet only places them.
 *
 * Two kinds of markup share the 720 px reading column (box-sizing: content-box, so the text itself is up to 720 px wide
 * and the 20 px side padding is the phone margin):
 *   - the theme templates (FAQ, Contact, 404): <main id="main" class="mgredline-content">;
 *   - Astra's page template (Terms, Privacy, Shipping info, ...): .site-main > article > .entry-header + .entry-content.
 *     style.css "PAGE HEADER STYLING" skips body.mgredline-content-page, so the title rules here need no !important.
 * body.mgredline-content-page--wide (Distributors) keeps a 1200 px column for its grid.
 * Weights: body.mgredline-content-page prefixes every text rule so it beats Astra's heading rules, up to
 * (0,1,1) (".entry-content h2") and (0,2,1) ("header.entry-header .entry-title"). The generic content headings weigh
 * (0,2,2) (body.mgredline-content-page :is(.mgredline-content, .entry-content) h2) at every width, including the phone
 * block at the end; component headings (FAQ group and "next" section, contact card, 404 sections) add .mgredline-content
 * (0,3,x) so their margins hold on phones too.
 *
 * Line length (Etap 13, decision 6): the column stays 720 px, and paragraphs and list items in it get max-width 32em,
 * about 70 characters per line (544 px at 17 px, 512 px at 16 px; on a 390 px phone the column is narrower anyway).
 * Headings, FAQ questions, cards, tables and the wide Distributors column keep their width.
 */

/* ===================================================================== */
/* Column                                                                 */
/* ===================================================================== */

.mgredline-content,
body.mgredline-content-page .site-main {
    box-sizing: content-box;
    max-width: 720px;
    margin: 0 auto;
    padding: 0 20px;
}

body.mgredline-content-page--wide .site-main {
    max-width: 1200px;
}

/* #page is a flex column and the auto side margins stop the theme templates' <main> from stretching: give it the
   full width (minus its padding) up to the 720 px column. */
.mgredline-content {
    width: calc(100% - 40px);
}

/* Astra's page template: no extra 60 px above and below (".ast-plain-container.ast-no-sidebar #primary", (1,2,0)), so
   the title sits as far under the header as on the theme templates. */
body.mgredline-content-page #primary.content-area {
    margin-top: 0;
    margin-bottom: 0;
}

/* The last block keeps its distance from the footer. */
.mgredline-content,
body.mgredline-content-page .site-main {
    padding-bottom: 64px;
}

/* Astra's block layout gives every top-level block its own max-width and auto margins; inside the column they fill it. */
body.mgredline-content-page .entry-content[data-ast-blocks-layout] > :not(.alignfull):not(.alignwide) {
    max-width: none;
}

/* The 404 has a white page like the others (Astra paints it #f0f5fa). */
body.error404 {
    background-color: var(--white);
}

/* ===================================================================== */
/* Title and text                                                          */
/* ===================================================================== */

body.mgredline-content-page .entry-header {
    margin: 0;
    padding: 0;
    text-align: left;
}

body.mgredline-content-page .mgredline-content__title,
body.mgredline-content-page .entry-header .entry-title {
    margin: 40px 0 24px;
    color: var(--dark-color);
    font-family: var(--font-heading);
    font-size: 40px;
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: 0;
    text-align: left;
    text-transform: none;
    overflow-wrap: break-word;
}

body.mgredline-content-page :is(.mgredline-content, .entry-content) :is(h1, h2, h3, h4, h5, h6) {
    color: var(--dark-color);
    font-family: var(--font-heading);
    text-transform: none;
    overflow-wrap: break-word;
}

body.mgredline-content-page :is(.mgredline-content, .entry-content) h2 {
    margin: 40px 0 12px;
    font-size: 24px;
    font-weight: 600;
    line-height: 1.25;
}

body.mgredline-content-page :is(.mgredline-content, .entry-content) h3 {
    margin: 28px 0 8px;
    font-size: 20px;
    font-weight: 600;
    line-height: 1.3;
}

body.mgredline-content-page :is(.mgredline-content, .entry-content) :is(p, li) {
    color: var(--text-color);
    font-family: var(--font-primary);
    font-size: 17px;
    line-height: 1.6;
}

body.mgredline-content-page :is(.mgredline-content, .entry-content) p {
    margin: 0 0 16px;
}

/* Reading measure: about 70 characters per line (see the header). The second selector is for paragraphs placed
   straight in Astra's block layout: it outweighs the max-width: none rule under "Column". */
body.mgredline-content-page:not(.mgredline-content-page--wide) :is(.mgredline-content, .entry-content) :is(p, li):not(summary *, table *, .mgredline-content__chips li, .mgredline-contact__card *, .mgredline-contact__help li),
body.mgredline-content-page:not(.mgredline-content-page--wide) .entry-content[data-ast-blocks-layout] > p:not(.alignfull):not(.alignwide) {
    max-width: 32em;
}

/* Links in the text: underlined, so they do not rely on colour alone. */
body.mgredline-content-page :is(.mgredline-content__body, .entry-content, .mgredline-faq__answer, .mgredline-faq__mail) a:not(.mgredline-btn) {
    color: var(--dark-color);
    text-decoration: underline;
    text-underline-offset: 2px;
    overflow-wrap: anywhere;
}

body.mgredline-content-page :is(.mgredline-content__body, .entry-content, .mgredline-faq__answer, .mgredline-faq__mail) a:not(.mgredline-btn):hover {
    color: var(--primary-color-dark);
}

/* ===================================================================== */
/* Shared parts: action row, category chips                               */
/* ===================================================================== */

.mgredline-content__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: 0 0 24px;
}

body.mgredline-content-page .mgredline-content__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 24px;
    padding: 0;
    list-style: none;
}

body.mgredline-content-page .mgredline-content__chips li {
    margin: 0;
    max-width: 100%;
}

body.mgredline-content-page .mgredline-content__chips a {
    display: inline-flex;
    align-items: center;
    box-sizing: border-box;
    max-width: 100%;
    min-height: 44px;
    padding: 0 16px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-pill);
    background: var(--white);
    color: var(--text-color);
    font-family: var(--font-primary);
    font-size: 15px;
    line-height: 1.2;
    text-decoration: none;
}

body.mgredline-content-page .mgredline-content__chips a:hover {
    border-color: var(--dark-color);
    color: var(--dark-color);
}

/* ===================================================================== */
/* FAQ                                                                    */
/* ===================================================================== */

/* keep: FAQ group headings on production */
body.mgredline-content-page .mgredline-content .mgredline-faq__group {
    margin: 40px 0 8px;
}

.mgredline-faq__list {
    margin: 0 0 16px;
    border-top: 1px solid var(--border);
}

.mgredline-faq__item {
    border-bottom: 1px solid var(--border);
}

.mgredline-faq__question {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    box-sizing: border-box;
    min-height: 48px;
    padding: 12px 0;
    cursor: pointer;
    list-style: none;
}

.mgredline-faq__question::-webkit-details-marker {
    display: none;
}

/* Chevron drawn in CSS: down when closed, up when open; no transition. */
.mgredline-faq__question::after {
    content: "";
    flex: none;
    width: 9px;
    height: 9px;
    margin: 0 4px 4px 0;
    border-right: 2px solid var(--dark-color);
    border-bottom: 2px solid var(--dark-color);
    transform: rotate(45deg);
}

.mgredline-faq__item[open] > .mgredline-faq__question::after {
    margin-bottom: -4px;
    transform: rotate(-135deg);
}

body.mgredline-content-page .mgredline-faq__question .mgredline-faq__heading {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    line-height: 1.3;
}

.mgredline-faq__answer {
    padding: 0 0 16px;
}

.mgredline-faq__answer > :last-child {
    margin-bottom: 0;
}

.mgredline-faq__next {
    margin-top: 40px;
}

body.mgredline-content-page .mgredline-content .mgredline-faq__next h2 {
    margin-top: 0;
}

body.mgredline-content-page .mgredline-faq__mail {
    margin: 0;
}

/* ===================================================================== */
/* Contact                                                                */
/* ===================================================================== */

.mgredline-contact__card {
    margin: 32px 0 0;
    padding: 24px;
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    background: var(--white);
}

body.mgredline-content-page .mgredline-content .mgredline-contact__card h2 {
    margin-top: 0;
}

body.mgredline-content-page .mgredline-contact__card .mgredline-contact__email {
    margin: 0 0 8px;
    font-family: var(--font-heading);
    font-size: 28px;
    font-weight: 700;
    line-height: 1.2;
}

body.mgredline-content-page .mgredline-contact__card .mgredline-contact__email a {
    display: inline-flex;
    align-items: center;
    max-width: 100%;
    min-height: 48px;
    color: var(--dark-color);
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 4px;
    overflow-wrap: anywhere;
}

.mgredline-contact__card .mgredline-content__actions {
    margin: 16px 0 0;
}

.mgredline-contact__help {
    margin-top: 40px;
}

body.mgredline-content-page .mgredline-contact__help ul {
    margin: 0;
    padding: 0;
    list-style: none;
    border-top: 1px solid var(--border);
}

body.mgredline-content-page .mgredline-contact__help li {
    margin: 0;
    border-bottom: 1px solid var(--border);
}

body.mgredline-content-page .mgredline-contact__help a {
    display: flex;
    align-items: center;
    min-height: 48px;
    padding: 8px 0;
    color: var(--dark-color);
    text-decoration: underline;
    text-underline-offset: 2px;
}

body.mgredline-content-page .mgredline-contact__help a:hover {
    color: var(--primary-color-dark);
}

/* ===================================================================== */
/* 404                                                                    */
/* ===================================================================== */

.mgredline-404__section {
    margin-top: 16px;
}

body.mgredline-content-page .mgredline-content .mgredline-404__section h2 {
    margin-top: 16px;
}

.mgredline-404 .woocommerce-product-search {
    display: flex;
    gap: 8px;
    max-width: 480px;
}

.mgredline-404 .woocommerce-product-search input[type="search"] {
    flex: 1 1 auto;
    min-width: 0;
}

.mgredline-404 .woocommerce-product-search button {
    flex: none;
}

/* ===================================================================== */
/* Complianz legal documents (Privacy statement, Cookie policy)            */
/* ===================================================================== */

/* The plugin's document.min.css sets 14px text and 22px headings at ID weight (#cmplz-document p, li, td / h2, h3);
   in the reading column they follow the page's text sizes. */
body.mgredline-content-page #cmplz-document :is(p, li, td) {
    font-size: 17px;
    line-height: 1.6;
}

body.mgredline-content-page #cmplz-document h2 {
    font-size: 24px;
}

/* Section headings only; the service names in the cookie dropdowns (summary h3, 18 px) keep the plugin's size. */
body.mgredline-content-page #cmplz-document > h3 {
    font-size: 20px;
}

/* ===================================================================== */
/* Phones                                                                 */
/* ===================================================================== */

@media (max-width: 768px) {
    body.mgredline-content-page--wide .site-main {
        padding: 0 20px 48px;
    }

    .mgredline-content,
    body.mgredline-content-page .site-main {
        padding-bottom: 48px;
    }

    body.mgredline-content-page .mgredline-content__title,
    body.mgredline-content-page .entry-header .entry-title {
        margin: 28px 0 20px;
        font-size: 32px;
    }

    body.mgredline-content-page :is(.mgredline-content, .entry-content) h2 {
        margin-top: 32px;
        font-size: 20px;
    }

    body.mgredline-content-page :is(.mgredline-content, .entry-content) h3,
    body.mgredline-content-page .mgredline-faq__question .mgredline-faq__heading {
        font-size: 18px;
    }

    body.mgredline-content-page :is(.mgredline-content, .entry-content) :is(p, li) {
        font-size: 16px;
    }

    .mgredline-contact__card {
        padding: 20px 16px;
    }

    body.mgredline-content-page #cmplz-document :is(p, li, td) {
        font-size: 16px;
    }

    body.mgredline-content-page #cmplz-document h2 {
        font-size: 20px;
    }

    body.mgredline-content-page #cmplz-document > h3 {
        font-size: 18px;
    }

    body.mgredline-content-page .mgredline-contact__card .mgredline-contact__email {
        font-size: 24px;
    }
}
