/* Paper tones shared by full-width editorial sections. */
:root {
  --li-banda-papel: var(--prueba-papel, #f1eade);
  --li-banda-clara: #f8f2e7;
}

@media screen and (forced-colors: none) {
  body.li-editorial-site #li-main [data-li-banda-lectura] {
    --li-fondo-lectura: var(--li-banda-papel, #f1eade);
    display: flow-root;
    min-width: 0;
    margin-block: 0;
    padding-block: clamp(28px, 3.3vw, 48px);
    background-color: var(--li-fondo-lectura);
    border-block: 0;
    border-image: linear-gradient(var(--li-fondo-lectura) 0 0) fill 0 // 0 100vmax;
  }
  body.li-editorial-site #li-main [data-li-banda-lectura]:nth-child(even of [data-li-banda-lectura]) {
    --li-fondo-lectura: var(--li-banda-clara, #f8f2e7);
  }
  body.li-editorial-site #li-main [data-li-banda-lectura] > :is(.li-divider, .gl-rule, hr.li-rule),
  body.single-que-es #li-main [data-li-banda-lectura] > header.gl-section-head > .li-divider {
    min-block-size: 0;
    block-size: 0;
    margin-block: 0;
    padding-block: 0;
    border: 0;
    background: transparent;
  }
  body.li-editorial-site #li-main [data-li-banda-lectura]:not(:has(> .bc-phase)) > :is(h2, .li-glossary-section-heading),
  body.li-editorial-site #li-main [data-li-banda-lectura] > .bc-phase,
  body.single-que-es #li-main [data-li-banda-lectura] > header.gl-section-head {
    margin-block-start: 0;
    padding-block-start: 0;
    border-block-start: 0;
  }
  body.li-editorial-site #li-main [data-li-banda-lectura] > :first-child {
    margin-block-start: 0;
  }
  body.li-editorial-site #li-main [data-li-banda-lectura] > :last-child {
    margin-block-end: 0;
  }
  body.li-editorial-site #li-main [data-li-banda-lectura]:not(:has(> .bc-phase)) > :is(h2, .li-glossary-section-heading)::before,
  body.li-editorial-site #li-main [data-li-banda-lectura] > :is(.li-divider, .gl-rule, hr.li-rule, .bc-phase)::before,
  body.single-que-es #li-main [data-li-banda-lectura] > header.gl-section-head > .li-divider::before,
  body.li-editorial-site #li-main section[data-li-banda-lectura]::before,
  body.single-que-es #li-main [data-li-banda-lectura] > header.gl-section-head :is(.li-glossary-section-heading, h2)::before {
    content: none;
  }
}

/* On reading pages the section owns the band. Tables, accordions, cards and figures keep their own edges. */
@media screen and (forced-colors: none) {
  body.li-library-reading #li-main .li-library-document > :is(.li-section, .li-library-guides, .li-related-concepts):not([aria-labelledby="subhubs"], [aria-labelledby="modelo-minimo"], :has(> .lh-routes)) {
    --li-tono-lectura: var(--li-banda-papel);
    margin-block: 0;
    background-color: var(--li-tono-lectura);
    border-image: linear-gradient(var(--li-tono-lectura) 0 0) fill 0 // 0 100vmax;
  }

  body.li-library-reading #li-main .li-library-document > :nth-child(even of :is(.li-section, .li-library-guides, .li-related-concepts):not([aria-labelledby="subhubs"], [aria-labelledby="modelo-minimo"], :has(> .lh-routes))) {
    --li-tono-lectura: var(--li-banda-clara);
  }

  /* The next cream section starts at the lower edge of the purple closing navigation. */
  body.li-library-reading #li-main .li-library-document > .li-related-concepts {
    padding-block: var(--li-section-gap, 40px);
  }

  body.li-library-reading #li-main .li-library-document > :is(.li-section, .li-library-guides, .li-related-concepts)::before,
  body.li-library-reading #li-main .li-library-document > .li-library-guides::after,
  body.li-library-reading #li-main .li-library-document > hr,
  body.li-library-reading #li-main .li-library-document + details.li-ai-info::before {
    display: none;
  }
}

/* Alternate content areas, leaving cards and their own internal dividers intact. */
@media screen and (forced-colors: none) {
  body.li-editorial-site #li-main {
    & :is(.li-atlas-index, .li-audit-page) > section:nth-child(even of section:not([hidden])),
    & .li-atlas-sheet > :nth-child(even of :is(section, details.atlas-editor, p.atlas-back):not([hidden])),
    & .li-about-page > :nth-child(even of .about-section, .about-close),
    & .li-privacy-consolidated > :nth-child(even of .li-privacy-section, .li-privacy-close),
    & #library-results > :nth-child(odd of .lb-area-section:not([hidden])),
    & .li-glossary-index > :nth-child(odd of [data-li-glossary-group]:not([hidden])),
    & .li-courses-continue,
    & .li-blog-index-wrap:has(> .li-blog-featured) > .li-blog-grid {
      background-color: var(--li-banda-clara, #f8f2e7);
      border-image: linear-gradient(var(--li-banda-clara, #f8f2e7) 0 0) fill 0 // 0 100vmax;
    }

    & .li-reading.li-reading-with-index:has(.li-atlas-sheet) {
      padding-block-end: 0;
    }

    & :is(.li-atlas-index, .li-atlas-sheet) > section,
    & .li-atlas-sheet > :is(details.atlas-editor, p.atlas-back) {
      margin-block: 0;
      padding-block: var(--atlas-sheet-space, var(--li-section-gap, 40px));
    }
    & .li-glossary-index > [data-li-glossary-group]:not([hidden]) {
      margin-block: 0;
      padding-block: clamp(24px, 3vw, 40px);
    }
    & .li-glossary-index > [data-li-glossary-group] > :first-child { margin-block-start: 0; }
    & .li-blog-index-wrap:has(> .li-blog-featured) > .li-blog-grid {
      padding-block: clamp(24px, 3vw, 40px);
    }
    & .li-blog-index-wrap:has(> .li-blog-featured) > .li-blog-pagination { margin-block-start: 0; }

    & :is(.about-hero, .about-section, .li-courses-header, .li-courses-survey-section, .li-courses-continue),
    & .li-library-index :is(.lb-explorer, .lb-hero, .lb-area-section) {
      border-block-end-width: 0;
    }
    & :is(.li-atlas-sheet, .li-atlas-index) > section::before,
    & .li-atlas-sheet :is(.atlas-sheet-facts, .atlas-back)::before,
    & .li-atlas-sheet :is(.atlas-sheet-facts, .atlas-back)::after,
    & .li-atlas-sheet > .atlas-editor > summary::before,
    & .li-atlas-sheet > .atlas-editor > summary::after,
    & :is(.li-audit-page, .li-audit-intake-page) > .li-entry-section::before,
    & .li-privacy-consolidated > :is(.li-privacy-section, .li-privacy-close)::before,
    & .li-blog-index-wrap > .li-blog-index-hero::after,
    & .li-blog-index-wrap:has(> .li-blog-featured) > .li-blog-pagination::before,
    & #li-masterclasses-index:has(> [data-li-banda-lectura]) .li-masterclass-upcoming::after,
    & #b2c-guide > [data-li-banda-lectura] > .bc-phase::before {
      content: none;
    }
    & #b2c-guide > [data-li-banda-lectura] > .bc-phase { margin-block-start: 0; }
  }
}

/* Some related concept blocks place the links in a native list below the caption. */
@media screen {
  body.li-library-reading #li-main .li-related-concepts:has(> ul) {
    display: block;
  }

  body.li-library-reading #li-main .li-related-concepts:has(> ul) > .li-section-kicker {
    margin-block: 0 .625rem;
  }

  body.li-library-reading #li-main .li-related-concepts > ul {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    gap: .5rem;
    margin: 0;
    padding: 0;
  }

  body.li-library-reading #li-main .li-related-concepts > ul > li {
    max-inline-size: 100%;
    margin: 0;
    padding: 0;
  }

  body.li-library-reading #li-main .li-related-concepts > ul > li::marker {
    font-size: 0;
  }
}

/* Related terms and closing actions on glossary definitions. */
@media screen {
  body.single-que-es #li-main .li-glossary-end-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .75rem 1rem;
    margin: 0;
    padding: clamp(1.25rem, 3vw, 2.5rem) 0;
  }
  body.single-que-es #li-main .li-glossary-end-actions > :is(.gl-back, .gl-end-nav) {
    display: flex;
    flex: 0 1 auto;
    min-width: 0;
    max-width: 100%;
    width: auto;
    margin: 0;
    padding: 0;
    border: 0;
  }
  body.single-que-es #li-main .li-glossary-end-actions > :is(.gl-back, .gl-end-nav)::before,
  body.single-que-es #li-main .gl-terms::before,
  body.single-que-es #li-main :is(hr, .li-divider):has(+ .gl-terms),
  body.single-que-es #li-main .gl-terms br,
  body.single-que-es #li-main .li-glossary-end-actions a > br { display: none; }

  body.single-que-es #li-main .gl-terms {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: .5rem;
    max-width: 100%;
    margin: 0;
    padding-block: clamp(1.25rem, 3vw, 2.5rem) 0;
    border: 0;
  }
  body.single-que-es #li-main .gl-terms :is(p, ul, li):has(a) {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    gap: .5rem;
    list-style: none;
    margin: 0;
    padding: 0;
  }
  body.single-que-es #li-main .gl-terms .gl-terms-label { flex-basis: 100%; margin: 0; }
  body.single-que-es #li-main .li-glossary-end-actions > :is(.gl-back, .gl-end-nav) > a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    min-height: 44px;
    padding: .65rem 1.1rem;
    border: 1px solid transparent;
    border-radius: var(--li-button-radius, 8px);
    background: #f0d060;
    color: #18131d;
    text-decoration: none;
  }
  body.single-que-es #li-main .li-glossary-end-actions > :is(.gl-back, .gl-end-nav) > a:hover {
    background: #e6c34f;
    text-decoration: underline;
  }
  body.single-que-es #li-main .li-glossary-end-actions .gl-nav-copy { display: inline-flex; flex-wrap: wrap; gap: .35em; }
  body.single-que-es #li-main .li-glossary-end-actions :is(a, button):focus-visible {
    outline: 3px solid #54366f;
    outline-offset: 3px;
  }
  body.single-que-es #li-main .li-glossary-end-actions a,
  body.single-que-es #li-main .li-glossary-end-actions button { max-width: 100%; margin: 0; }
}

/* Shared, collapsible AI summary at the end of editorial content. */
@media screen and (forced-colors: none) {
  body.li-editorial-site #li-main .li-reading:has(> .li-article > .li-ai-info + .li-action-status:last-child) {
    --li-reading-bottom: 0px;
    padding-block-end: 0;
  }

  body.li-editorial-site #li-main details.li-ai-info,
  body.li-editorial-site #li-main details.li-ai-info + .li-action-status:not(:empty) {
    --li-ink: var(--prueba-papel);
    --li-muted: var(--prueba-papel);
    --li-link: var(--prueba-amarillo);
    background-color: var(--prueba-violeta-oscuro);
    color: var(--li-ink);
    margin-block: 0;
    border: 0;
    border-radius: 0;
    border-image: linear-gradient(var(--prueba-violeta-oscuro) 0 0) fill 0 // 0 100vmax;
  }

  body.li-editorial-site #li-main details.li-ai-info {
    padding: clamp(28px, 3.5vw, 44px) 0;
  }

  body.li-editorial-site #li-main details.li-ai-info::before {
    content: none;
  }

  body.li-editorial-site #li-main:has(.li-article > .li-ai-info + .li-action-status:last-child) + footer.li-footer {
    border-block-start: 0;
  }

  body.li-editorial-site #li-main details.li-ai-info + .li-action-status:not(:empty) {
    padding-block-end: 1.25rem;
  }

  body.li-editorial-site #li-main details.li-ai-info :is(summary, p, strong) {
    color: var(--li-ink);
  }

  body.li-editorial-site #li-main details.li-ai-info summary::marker,
  body.li-editorial-site #li-main details.li-ai-info a {
    color: var(--li-link);
  }

  body.li-editorial-site #li-main details.li-ai-info a {
    text-decoration: underline;
    text-decoration-color: currentColor;
  }

  body.li-editorial-site #li-main details.li-ai-info .li-entry-actions > button {
    background-color: var(--prueba-papel);
    color: var(--prueba-tinta);
    border-color: var(--prueba-papel);
  }

  body.li-editorial-site #li-main details.li-ai-info .li-entry-actions > button:hover {
    background-color: var(--prueba-amarillo);
    border-color: var(--prueba-amarillo);
  }

  body.li-editorial-site #li-main details.li-ai-info :is(summary, a, button):focus-visible {
    outline: 3px solid var(--prueba-amarillo);
    outline-offset: 3px;
  }
}

/* Closing navigation in the Library, across areas, guides and articles. */
@media screen and (forced-colors: none) {
  body:is(.li-library-reading, .li-library) #li-main nav.li-library-continuation {
    --li-ink: var(--prueba-papel);
    --li-muted: var(--prueba-papel);
    --li-link: var(--prueba-amarillo);
    padding-block: clamp(36px, 5vw, 64px);
    border-block: 0;
    background-color: var(--prueba-violeta-oscuro);
    border-image: linear-gradient(var(--prueba-violeta-oscuro) 0 0) fill 0 // 0 100vmax;
    color: var(--li-ink);
  }

  body:is(.li-library-reading, .li-library) #li-main nav.li-library-continuation::before,
  body:is(.li-library-reading, .li-library) #li-main nav.li-library-continuation + :is(.li-section, .li-related-concepts)::before {
    content: none;
  }

  body:is(.li-library-reading, .li-library) #li-main nav.li-library-continuation > .li-label {
    color: var(--prueba-amarillo);
  }

  body:is(.li-library-reading, .li-library) #li-main .li-library-continuation .li-library-path {
    --li-ink: var(--prueba-tinta);
    --li-muted: #4b404e;
    --li-link: var(--prueba-violeta-icono);
    background: var(--prueba-papel);
    color: var(--li-link);
    text-decoration: none;
  }

  body:is(.li-library-reading, .li-library) #li-main .li-library-continuation .li-library-path:is(:hover, :focus-visible) {
    background: var(--li-v2-raised, #fffaf0);
  }

  body:is(.li-library-reading, .li-library) #li-main .li-library-continuation .li-library-path:is(:hover, :focus-visible) strong {
    text-decoration: underline;
    text-underline-offset: .19em;
  }

  body:is(.li-library-reading, .li-library) #li-main .li-library-continuation .li-library-return {
    margin-block-start: clamp(20px, 3vw, 32px);
    padding-block: 0;
  }

  body:is(.li-library-reading, .li-library) #li-main .li-library-continuation button[data-li-ai-brand-return] {
    border: 1px solid var(--prueba-lavanda) !important;
  }

  body:is(.li-library-reading, .li-library) #li-main .li-library-continuation button[data-li-ai-brand-return]:hover {
    background: var(--prueba-violeta-icono) !important;
  }

  body:is(.li-library-reading, .li-library) #li-main .li-library-continuation .li-library-all {
    color: var(--prueba-papel);
    text-decoration: underline;
    text-decoration-color: currentColor;
  }

  body:is(.li-library-reading, .li-library) #li-main .li-library-continuation .li-library-all:hover {
    color: var(--prueba-amarillo);
  }

  body:is(.li-library-reading, .li-library) #li-main .li-library-continuation :is(a, button):focus-visible {
    outline: 3px solid var(--prueba-amarillo);
    outline-offset: 4px;
  }
}
