/* Olevor documents, 404 and search (VISUAL_REVAMP_PLAN R6.4). Tokens in style.css.
   Loaded only on the six document pages (Envíos, Devoluciones, Privacidad, Términos,
   Contacto, politicas hub), the 404 route and the search route (functions.php), so the
   §5.4 pill geometry from home-v3.css is repeated here scoped to `.olv-route`.
   No `!important`: Blocksy is overridden by specificity (R6.6). */

/* ------------------------------------------ Blocksy page shell (document pages) */
body.page .ct-container,
body.page .ct-container-full,
body.page .ct-container-narrow,
body.page [data-content="normal"] {
    margin: 0;
    max-width: none;
    padding: var(--olv-section-pad) 0;
    width: 100%;
}

body.page .ct-container > article,
body.page .ct-container-full > article,
body.page .ct-container-narrow > article,
body.page [data-content="normal"] > article {
    background: transparent;
    margin: 0 auto;
    max-width: var(--olv-wrap);
    padding-inline: var(--olv-edge);
    width: 100%;
}

body.page .entry-content {
    margin: 0;
    max-width: none;
}

/* Blocksy's own page title would duplicate the document hero h1 (the W4 capture of
   /politicas/ showed two "Políticas"). `:has()` finds the hero whatever the seeded
   page id; `body.olv-document` is the hook for a body class from functions.php. */
body.page:has(.olv-document-hero) .entry-header,
body.page:has(.olv-document-hero) .hero-section,
body.olv-document .entry-header,
body.olv-document .hero-section {
    display: none;
}

/* ------------------------------------------------------------ shared type (§5.2) */
.olv-document-hero > p,
.olv-route-eyebrow,
.olv-search-result-type {
    color: var(--olv-muted);
    font-family: var(--olv-mono);
    font-size: var(--olv-type-eyebrow);
    font-weight: 400;
    letter-spacing: 0.1em;
    line-height: 1.4;
    margin: 0;
    text-transform: uppercase;
}

.olv-document-hero h1,
.olv-route-state h1 {
    color: var(--olv-ink);
    font-family: var(--olv-ui);
    font-size: var(--olv-type-pdp-title);
    font-weight: 500;
    letter-spacing: -0.04em;
    line-height: 1.2;
    margin: 0;
    max-width: 800px;
    overflow-wrap: anywhere;
    text-wrap: balance;
}

.olv-document-hero > span,
.olv-route-state > p:not(.olv-route-eyebrow) {
    color: var(--olv-muted);
    display: block;
    font-size: var(--olv-type-lead);
    font-weight: 500;
    line-height: 1.6;
    margin: 0;
    max-width: 560px;
}

/* ----------------------------------------------------------- document hero (R6.4) */
body.page .olv-document-hero {
    border-bottom: 1px solid var(--olv-line);
    display: grid;
    gap: 16px;
    margin: 0;
    padding: 0 0 40px;
}

/* ------------------------------------------------- document layout + nav (R6.4) */
body.page .olv-document-layout {
    display: grid;
    gap: 40px;
    grid-template-columns: minmax(0, 1fr);
    margin: 0;
    padding-top: 40px;
}

.olv-document-layout > nav {
    align-content: start;
    align-self: start;
    border-left: 1px solid var(--olv-line);
    display: grid;
}

.olv-document-layout > nav a {
    align-items: center;
    border-left: 2px solid transparent;
    color: var(--olv-muted);
    display: flex;
    font-size: var(--olv-type-small);
    line-height: 1.5;
    margin-left: -1px;
    min-height: 44px; /* R7.3 target floor */
    padding: 10px 0 10px 16px;
    text-decoration: none;
    transition: color var(--olv-motion-fast) var(--olv-ease-standard);
}

.olv-document-layout > nav a:hover {
    color: var(--olv-ink);
}

.olv-document-layout > nav a[aria-current="page"] {
    border-left-color: var(--olv-ink);
    color: var(--olv-ink);
    font-weight: 500;
}

/* ----------------------------------------------------------- document body (R6.4) */
.olv-document-body {
    color: var(--olv-ink);
    font-size: var(--olv-type-body);
    line-height: 1.6;
    max-width: 680px;
}

.olv-document-body > :first-child {
    margin-top: 0;
}

.olv-document-body > :last-child {
    margin-bottom: 0;
}

.olv-document-body p,
.olv-document-body ul,
.olv-document-body ol,
.olv-document-body table,
.olv-document-body blockquote,
.olv-document-body figure {
    margin: 0 0 20px;
}

.olv-document-body h2,
.olv-document-body h3,
.olv-document-body h4,
.olv-document-body h5,
.olv-document-body h6 {
    color: var(--olv-ink);
    font-family: var(--olv-ui);
    text-wrap: balance;
}

.olv-document-body h2 {
    font-size: var(--olv-type-card-title);
    font-weight: 500;
    letter-spacing: -0.03em;
    line-height: 1.2;
    margin: 40px 0 12px;
}

.olv-document-body h3 {
    font-size: 17px;
    font-weight: 500;
    letter-spacing: -0.02em;
    line-height: 1.3;
    margin: 32px 0 8px;
}

.olv-document-body h4,
.olv-document-body h5,
.olv-document-body h6 {
    font-size: var(--olv-type-body);
    font-weight: 600;
    line-height: 1.4;
    margin: 24px 0 8px;
}

.olv-document-body a {
    color: var(--olv-ink);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
    transition: color var(--olv-motion-fast) var(--olv-ease-standard);
}

.olv-document-body a:hover {
    color: var(--olv-muted);
}

.olv-document-body ul,
.olv-document-body ol {
    padding-left: 20px;
}

.olv-document-body li {
    margin: 0 0 8px;
}

.olv-document-body li::marker {
    color: var(--olv-muted);
}

.olv-document-body strong {
    font-weight: 600;
}

.olv-document-body small {
    font-size: var(--olv-type-micro);
}

.olv-document-body blockquote {
    border-left: 2px solid var(--olv-ink);
    padding: 0 0 0 16px;
}

.olv-document-body hr {
    border: 0;
    border-top: 1px solid var(--olv-line);
    margin: 32px 0;
}

.olv-document-body img {
    border-radius: var(--olv-radius-card);
}

.olv-document-body table {
    border-collapse: collapse;
    font-size: var(--olv-type-small);
    width: 100%;
}

.olv-document-body th,
.olv-document-body td {
    border-top: 1px solid var(--olv-line);
    padding: 12px 16px 12px 0;
    text-align: left;
    vertical-align: top;
}

.olv-document-body th {
    color: var(--olv-muted);
    font-family: var(--olv-mono);
    font-size: var(--olv-type-eyebrow);
    font-weight: 400;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.olv-document-body tr:last-child td {
    border-bottom: 1px solid var(--olv-line);
}

/* Seeded draft notice (seed.php): quiet, still clearly "not final". `--olv-accent`
   is offer-only (D14), so the label is mono ink on the soft band tone. */
.olv-document-body .policy-draft-notice {
    background: var(--olv-soft);
    border-radius: var(--olv-radius-card);
    color: var(--olv-ink);
    font-size: var(--olv-type-body);
    line-height: 1.6;
    margin: 0 0 32px;
    padding: 20px 24px;
}

.olv-document-body .policy-draft-notice strong {
    color: var(--olv-ink);
    display: block;
    font-family: var(--olv-mono);
    font-size: var(--olv-type-eyebrow);
    font-weight: 400;
    letter-spacing: 0.1em;
    line-height: 1.4;
    margin-bottom: 10px;
    text-transform: uppercase;
}

/* ------------------------------------------------- 404 and search shell (R6.4) */
.olv-route {
    background: var(--olv-bg);
    color: var(--olv-ink);
}

.olv-route-state {
    display: grid;
    gap: 16px;
    justify-items: start;
    padding-block: var(--olv-section-pad);
}

.olv-route--404 .olv-route-state {
    align-content: center;
    min-height: min(62vh, 620px);
}

.olv-route-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 8px;
}

/* --------------------------------------------------- pills (§5.4, D24, R5.3) */
.olv-route .olv4-pill {
    align-items: center;
    background: var(--olv-ink);
    border: 0;
    border-radius: var(--olv-radius-control);
    color: var(--olv-white);
    cursor: pointer;
    display: inline-flex;
    font-size: 15px;
    font-weight: 500;
    gap: 8px;
    justify-content: center;
    line-height: 1.2;
    min-height: 47px;
    padding: 12px 24px;
    text-decoration: none;
    transition:
        background var(--olv-motion-fast) var(--olv-ease-standard),
        color var(--olv-motion-fast) var(--olv-ease-standard),
        transform 200ms var(--olv-ease-standard);
}

.olv-route .olv4-pill:hover {
    color: var(--olv-white);
    transform: scale(1.02);
}

/* §5.4 primary-pill focus ring: 2 px ink, offset 2 px (acid stays offer-only, D14). */
.olv-route .olv4-pill:focus-visible {
    outline: 2px solid var(--olv-ink);
    outline-offset: 2px;
}

.olv-route .olv4-pill--secondary {
    background: rgba(0, 0, 0, 0.06);
    color: var(--olv-ink);
    font-size: 13px;
    min-height: 44px; /* R7.3 target floor */
    padding: 12px 18px;
}

.olv-route .olv4-pill--secondary:hover {
    background: rgba(0, 0, 0, 0.09);
    color: var(--olv-ink);
    transform: none;
}

.olv-route .olv4-pill--secondary span {
    display: inline-block;
    transition: transform var(--olv-motion-fast) var(--olv-ease-standard);
}

.olv-route .olv4-pill--secondary:hover span,
.olv-route .olv4-pill--secondary:focus-visible span {
    transform: translateX(4px);
}

/* ------------------------------------------------------- search results (R6.4) */
.olv-search-body {
    padding-bottom: var(--olv-section-pad);
}

.olv-search-results {
    border-top: 1px solid var(--olv-line);
    display: grid;
}

.olv-search-result {
    align-items: center;
    border-bottom: 1px solid var(--olv-line);
    display: grid;
    gap: 16px 24px;
    grid-template-columns: 96px minmax(0, 1fr);
    padding: 24px 0;
}

.olv-search-result-media {
    aspect-ratio: 1 / 1;
    background: var(--olv-field-50);
    border-radius: var(--olv-radius-card);
    display: block;
    overflow: hidden;
    padding: 10px;
    width: 96px;
}

.olv-search-result-media img {
    height: 100%;
    object-fit: contain;
    width: 100%;
}

.olv-search-result-type {
    margin-bottom: 8px;
}

.olv-search-result h2 {
    font-family: var(--olv-ui);
    font-size: var(--olv-type-card-title);
    font-weight: 500;
    letter-spacing: -0.03em;
    line-height: 1.1;
    margin: 0;
}

.olv-search-result h2 a {
    color: var(--olv-ink);
    text-decoration: none;
    transition: color var(--olv-motion-fast) var(--olv-ease-standard);
}

.olv-search-result h2 a:hover {
    color: var(--olv-muted);
}

.olv-search-result-excerpt {
    color: var(--olv-muted);
    font-size: var(--olv-type-body);
    line-height: 1.6;
    margin: 8px 0 0;
}

.olv-search-result > .olv4-pill {
    grid-column: 2;
    justify-self: start;
}

/* WordPress pagination on multi-page results (the_posts_pagination). */
.olv-route .navigation.pagination {
    margin-top: 24px;
}

.olv-route .navigation.pagination .nav-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.olv-route .navigation.pagination .page-numbers {
    align-items: center;
    border: 1px solid var(--olv-line);
    border-radius: var(--olv-radius-control);
    color: var(--olv-ink);
    display: inline-flex;
    font-size: var(--olv-type-small);
    font-weight: 500;
    justify-content: center;
    min-height: 44px; /* R7.3 target floor */
    min-width: 44px;
    padding: 8px 14px;
    text-decoration: none;
}

.olv-route .navigation.pagination .page-numbers.current {
    background: var(--olv-ink);
    border-color: var(--olv-ink);
    color: var(--olv-white);
}

/* ------------------- WooCommerce notices and WP .screen-reader-text (kept working) */
.woocommerce-error,
.woocommerce-message,
.woocommerce-info {
    background: var(--olv-white);
    border: 1px solid var(--olv-line);
    border-radius: var(--olv-radius-input);
    color: var(--olv-ink);
    font-size: var(--olv-type-body);
    line-height: 1.6;
    list-style: none;
    margin: 0 0 24px;
    padding: 14px 18px;
}

.woocommerce-error {
    border-color: var(--olv-danger);
}

.woocommerce-error li,
.woocommerce-message li,
.woocommerce-info li {
    list-style: none;
    margin: 0;
    padding: 0;
}

.woocommerce-error li + li,
.woocommerce-message li + li,
.woocommerce-info li + li {
    margin-top: 8px;
}

.woocommerce-error a,
.woocommerce-message a,
.woocommerce-info a {
    color: var(--olv-ink);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.woocommerce-notices-wrapper:empty {
    display: none;
}

.screen-reader-text {
    border: 0;
    clip: rect(1px, 1px, 1px, 1px);
    clip-path: inset(50%);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    width: 1px;
    word-wrap: normal;
}

.screen-reader-text:focus {
    background: var(--olv-white);
    clip: auto;
    clip-path: none;
    color: var(--olv-ink);
    display: block;
    font-size: var(--olv-type-body);
    height: auto;
    left: 5px;
    line-height: normal;
    padding: 12px 16px;
    text-decoration: none;
    top: 5px;
    width: auto;
    z-index: 100000;
}

/* --------------------------------------------------------------- mobile ≤ 760 */
@media (max-width: 760px) {
    body.page .olv-document-hero {
        gap: 12px;
        padding-bottom: 32px;
    }

    body.page .olv-document-layout {
        gap: 32px;
        padding-top: 32px;
    }

    .olv-route--404 .olv-route-state {
        min-height: min(56vh, 480px);
    }

    .olv-search-result {
        gap: 12px 16px;
        grid-template-columns: 72px minmax(0, 1fr);
        padding: 20px 0;
    }

    .olv-search-result-media {
        padding: 6px;
        width: 72px;
    }
}

.olv-learning .olv-document-layout > nav summary {
    cursor: pointer;
    min-height: 44px;
    padding: 10px 16px;
}

.olv-learning .olv-document-body > details > summary {
    cursor: pointer;
    min-height: 44px;
    padding: 10px 0;
}

@media (max-width: 999px) {
    /* Contact remains in the header and footer; floating controls obscure reading. */
    .olv-learning .olv-concierge {
        display: none;
    }
}

/* -------------------------------------------------------------- desktop ≥ 1000 */
@media (min-width: 1000px) {
    body.page .olv-document-layout {
        gap: 64px;
        grid-template-columns: 240px minmax(0, 1fr);
        padding-top: 56px;
    }

    .olv-document-layout > nav {
        position: sticky;
        top: calc(var(--olv-header) + 24px);
    }

    .olv-search-result {
        grid-template-columns: 96px minmax(0, 1fr) auto;
    }

    .olv-search-result > .olv4-pill {
        grid-column: auto;
    }
}

/* ------------------------------------------------------ reduced motion (§1 rule 8) */
body.olv-reduced-motion-preview .olv-route .olv4-pill,
body.olv-reduced-motion-preview .olv-route .olv4-pill--secondary span,
body.olv-reduced-motion-preview .olv-document-layout > nav a,
body.olv-reduced-motion-preview .olv-document-body a,
body.olv-reduced-motion-preview .olv-search-result h2 a {
    transition: none;
}

@media (prefers-reduced-motion: reduce) {
    .olv-route .olv4-pill,
    .olv-route .olv4-pill--secondary span,
    .olv-document-layout > nav a,
    .olv-document-body a,
    .olv-search-result h2 a {
        transition: none;
    }
}

/* Topic library: native navigation, existing brand tokens, no decorative cover images. */
.olv-learning-body [id],
.olv-learning-group,
.olv-reading-toc {
    scroll-margin-top: calc(var(--olv-header) + 24px);
}
body.admin-bar .olv-learning-body [id],
body.admin-bar .olv-learning-group,
body.admin-bar .olv-reading-toc {
    scroll-margin-top: calc(var(--olv-header) + 70px);
}
.olv-learning-jumps {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-block: 16px 0;
}
.olv-learning-jumps a,
.olv-learning-download .olv-learning-download-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 10px 16px;
    border: 1px solid var(--olv-line);
    border-radius: var(--olv-radius-control);
    background: var(--olv-soft);
    color: var(--olv-ink);
    font-size: var(--olv-type-small);
    line-height: 1.5;
    text-decoration: none;
}
.olv-learning-jumps a:hover,
.olv-learning-download .olv-learning-download-link:hover { background: var(--olv-white); }
.olv-learning-jumps a:focus-visible,
.olv-learning-body a:focus-visible,
.olv-learning-body summary:focus-visible {
    outline: 2px solid var(--olv-ink);
    outline-offset: 3px;
}
body.page .olv-learning-layout--hub { grid-template-columns: minmax(0, 1fr); }
.olv-learning-layout--hub .olv-learning-body { max-width: 800px; }
.olv-learning-group { margin-block: 32px; }
.olv-learning-body .olv-learning-group > h2 { margin-block: 0 16px; }
.olv-learning-body .olv-learning-readings { list-style: none; padding: 0; margin: 0; }
.olv-learning-readings > li { border-top: 1px solid var(--olv-line); padding-block: 16px; }
.olv-learning-body .olv-learning-readings h3 { margin: 0; font-size: var(--olv-type-lead); }
.olv-learning-readings h3 a { display: block; min-height: 44px; padding-block: 8px; }
.olv-learning-body .olv-learning-readings p { margin: 4px 0 0; color: var(--olv-muted); }
.olv-learning-body .olv-learning-readings .olv-learning-updated { font-size: var(--olv-type-small); color: var(--olv-muted); }
.olv-learning-featured { padding-inline: 16px; background: var(--olv-soft); }
.olv-learning-body .olv-learning-featured > p { color: var(--olv-muted-strong); }
.olv-learning-label { font-family: var(--olv-mono); font-size: var(--olv-type-small); }
.olv-reading-toc,
.olv-glossary-index { border: 1px solid var(--olv-line); border-radius: var(--olv-radius-input); margin-block: 0 24px; }
.olv-reading-toc summary,
.olv-glossary-index summary { cursor: pointer; min-height: 44px; padding: 10px 16px; font-weight: 500; }
.olv-reading-toc ol,
.olv-glossary-index ul { padding: 0 16px 12px 32px; margin: 0; }
.olv-reading-toc a,
.olv-glossary-index a { display: inline-flex; align-items: center; min-height: 44px; padding-block: 8px; line-height: 1.5; }
.olv-learning-body .olv-reading-byline { font-size: var(--olv-type-small); color: var(--olv-muted); margin-bottom: 16px; }
.olv-reading-next { display: grid; gap: 8px; margin-top: 32px; padding-top: 16px; border-top: 1px solid var(--olv-line); }
.olv-reading-next a { display: flex; align-items: center; min-height: 44px; padding-block: 8px; }
.olv-learning-download { margin-block: 24px; }
.olv-document-body .olv-learning-download-meta { display: block; margin: 8px 0 0; font-size: var(--olv-type-small); color: var(--olv-muted); }
@media (max-width: 767px) {
    body.page:has(.olv-learning-hero) main { padding-block: 24px; }
    body.page .olv-learning-hero { gap: 8px; padding-bottom: 16px; }
    body.page .olv-learning-layout { gap: 24px; padding-top: 24px; }
    .olv-learning-hero > span { font-size: var(--olv-type-body); }
    .olv-learning-jumps a { padding-inline: 12px; }
}

/* Primary content comes first in source order; desktop keeps the sidebar at left. */
.olv-learning-layout > .olv-learning-body { min-width: 0; }
@media (min-width: 1000px) {
    .olv-learning-layout--article,
    .olv-document-layout--contact { grid-template-areas: "secondary primary"; }
    .olv-learning-layout--article > .olv-learning-body,
    .olv-document-layout--contact > .olv-document-body { grid-area: primary; }
    .olv-learning-layout--article > .olv-learning-siblings,
    .olv-document-layout--contact > nav { grid-area: secondary; }
}
