/* Standard content pages - ordinary WP pages rendered by Storefront page.php.
   Loaded only when body has .dealer-content-page. */

body.dealer-content-page {
    --content-page-max-width: 960px;
    --content-page-padding-top: 28px;
    --content-page-padding-bottom: 64px;
    --content-page-title-gap: 28px;
    --content-page-section-gap: 36px;
    --content-page-text-gap: 18px;
}

body.dealer-content-page .site-main {
    margin-bottom: 0;
    padding-top: var(--content-page-padding-top);
    padding-bottom: var(--content-page-padding-bottom);
}

body.dealer-content-page article.page {
    width: 100%;
    max-width: var(--content-page-max-width);
    margin: 0;
    padding: 0;
}

body.dealer-content-page .entry-header {
    margin: 0 0 var(--content-page-title-gap);
    padding: 0;
    border: 0;
}

body.dealer-content-page .entry-title {
    margin: 0;
    color: var(--color-black);
    font-size: var(--font-size-h1);
    font-weight: var(--font-weight-semibold);
    line-height: 1.25;
    letter-spacing: 0;
}

body.dealer-content-page .entry-content {
    max-width: var(--content-page-max-width);
    color: var(--color-black);
    font-size: var(--font-size-body);
    font-weight: var(--font-weight-light);
    line-height: 1.65;
}

body.dealer-content-page .entry-content > * {
    margin-top: 0;
    margin-bottom: var(--content-page-text-gap);
}

body.dealer-content-page .entry-content > :last-child {
    margin-bottom: 0;
}

body.dealer-content-page .entry-content h2,
body.dealer-content-page .entry-content h3,
body.dealer-content-page .entry-content h4 {
    clear: none;
    color: var(--color-black);
    letter-spacing: 0;
}

body.dealer-content-page .entry-content h2 {
    margin-top: var(--content-page-section-gap);
    margin-bottom: 14px;
    font-size: var(--font-size-h2);
    font-weight: var(--font-weight-medium);
    line-height: 1.3;
}

body.dealer-content-page .entry-content h3 {
    margin-top: 28px;
    margin-bottom: 10px;
    padding-top: 0;
    border-top: 0;
    font-size: var(--font-size-body);
    font-weight: var(--font-weight-medium);
    line-height: 1.45;
}

body.dealer-content-page .entry-content h4 {
    margin-top: 24px;
    margin-bottom: 8px;
    font-size: var(--font-size-small);
    font-weight: var(--font-weight-medium);
    line-height: 1.45;
}

body.dealer-content-page .entry-content p {
    max-width: var(--content-page-max-width);
}

body.dealer-content-page .entry-content ul,
body.dealer-content-page .entry-content ol {
    padding-left: 22px;
    margin-left: 0;
}

body.dealer-content-page .entry-content li {
    margin-bottom: 8px;
}

body.dealer-content-page .entry-content li:last-child {
    margin-bottom: 0;
}

body.dealer-content-page .entry-content a {
    color: var(--color-black);
    text-decoration: underline;
    text-decoration-thickness: var(--link-text-decoration-thickness);
    text-underline-offset: var(--link-text-underline-offset);
}

body.dealer-content-page .entry-content a:hover,
body.dealer-focus-modality-ready.dealer-using-keyboard.dealer-content-page .entry-content a:focus {
    color: var(--color-primary);
}

body.dealer-content-page .entry-content hr,
body.dealer-content-page .entry-content .wp-block-separator {
    width: 100%;
    max-width: 100%;
    height: 1px;
    margin: var(--content-page-section-gap) 0;
    border: 0;
    background-color: rgba(0, 0, 0, 0.1);
}

body.dealer-content-page .edit-link {
    display: none;
}

@media (min-width: 768px) {
    body.dealer-content-page {
        --content-page-padding-top: 40px;
        --content-page-padding-bottom: 88px;
        --content-page-title-gap: 32px;
        --content-page-section-gap: 44px;
    }
}

@media (min-width: 1024px) {
    body.dealer-content-page {
        --content-page-padding-top: 48px;
        --content-page-padding-bottom: 104px;
        --content-page-title-gap: 36px;
    }
}

/* =========================================================================
   Opt-in content sidebar (the "Інформація" menu) — DESKTOP ONLY.

   Renders through Storefront's storefront_sidebar hook as
   `.dealer-content-sidebar`, a sibling of `#primary` inside `.col-full`
   (see CONTENT-PAGE-SYSTEM.md "Sidebar"). The body gets .has-content-sidebar.
   Owned by inc/content-sidebar.php.

   Mobile + tablet (< 1024px): the sidebar is fully hidden — the footer carries
   the same menu, so there is no reason to repeat it on small screens. The page
   then renders as a normal single content column (no layout change).

   Desktop (>= 1024px): a deterministic 2-column CSS grid on `.col-full`
   (menu left, content right). Grid + explicit placement is used instead of the
   parent theme's float layout so Storefront's `.content-area { float; width }`
   can't push the columns around.
   ========================================================================= */

.dealer-content-sidebar {
    display: none;
}

@media (min-width: 1024px) {
    body.dealer-content-page.has-content-sidebar #content > .col-full {
        display: grid;
        grid-template-columns: 232px minmax(0, 1fr);
        column-gap: 64px;
        align-items: start;
        /* Overall page breathing room lives on the grid container so BOTH
           columns (menu + content) share the same top/bottom space and align
           at the top. The per-column .site-main padding is zeroed below. */
        padding-top: 56px;
        padding-bottom: 96px;
    }

    /* Padding is now owned by the grid container — avoid doubling it. */
    body.dealer-content-page.has-content-sidebar .site-main {
        padding-top: 0;
        padding-bottom: 0;
    }

    /* Neutralise Storefront's floated/percentage content-area inside the grid. */
    body.dealer-content-page.has-content-sidebar #primary {
        grid-column: 2;
        grid-row: 1;
        width: 100%;
        max-width: none;
        min-width: 0;
        margin: 0;
        float: none;
    }

    body.dealer-content-page.has-content-sidebar .dealer-content-sidebar {
        display: block;
        grid-column: 1;
        grid-row: 1;
        position: sticky;
        top: 96px;
    }

    .dealer-content-sidebar__menu {
        margin: 0;
        padding: 0;
        list-style: none;
        display: flex;
        flex-direction: column;
        gap: 2px;
    }

    .dealer-content-sidebar__menu a {
        display: block;
        padding: 10px 14px;
        border-radius: 8px;
        color: var(--color-black);
        font-size: var(--font-size-body);
        font-weight: var(--font-weight-light);
        line-height: 1.4;
        text-decoration: none;
        transition: background-color var(--motion-duration-fast) var(--motion-ease-standard),
                    color var(--motion-duration-fast) var(--motion-ease-standard);
    }

    .dealer-content-sidebar__menu a:hover {
        background-color: rgba(0, 0, 0, 0.05);
        color: var(--color-primary);
    }

    body.dealer-focus-modality-ready.dealer-using-keyboard .dealer-content-sidebar__menu a:focus {
        outline: var(--focus-outline-width) solid var(--color-primary);
        outline-offset: var(--focus-outline-offset);
    }

    /* Active page. */
    .dealer-content-sidebar__menu .current-menu-item > a,
    .dealer-content-sidebar__menu .current_page_item > a {
        background-color: var(--color-primary);
        color: var(--color-white);
        font-weight: var(--font-weight-medium);
    }

    .dealer-content-sidebar__empty {
        margin: 0;
        color: var(--color-black);
        font-size: var(--font-size-small);
    }
}
