/* =========================================================================
   TOPICS 1C LIST + NAV + 2C TIT TEXT BOX
   Section: el_id and class ht--topics-1c-list-nav-2c-tit-text-box
   Single component:
     1. heading: label (Text, DIV tag, class ht--label) + H2
     2. numbered index: Text block with class ht--topics-index containing an
        ordered list <ol>; each item = title linked to #anchor, line break
        (Shift+Enter) and description. Numbers and arrows are automatic
     3. bar: inner Row with class ht--topics-nav containing a Text block with
        the #anchor links; it stays below the header from the first topic to
        the end of the page
     4. N topics: inner Rows 1/3 + 2/3 with class ht--topics-item and Row ID =
        anchor (risk, workflows...). Column 1: label + H2. Column 2: label +
        text + Text block with class ht--topics-box (H3 + text)
   Behaviour (bar numbering, active item, anchor scrolling, fixed bar after the
   component) lives in 47_ht--topics-1c-list-nav-2c-tit-text-box.js, enqueued
   by functions.php. The section anchor (#overview) is set on the column.
   Root selector .l-section.<class> to win over .section--overflow, which is
   imported later. The few !important declarations only beat the global rule
   .page p:not(#page-footer *, ...) {margin-bottom:24px} in typography.css,
   which has ID-level specificity.
   ========================================================================= */

.l-section.ht--topics-1c-list-nav-2c-tit-text-box {
  /* Module tokens. Values not in the UIKit palette come from the page design. */
  --ht-topics-line: var(--color-silver, #ccd4de);
  --ht-topics-nav-line: var(--color-silver, #ccd4de);
  --ht-topics-muted: #566374;         /* design --muted (UIKit: #768190) */
  --ht-topics-pale: var(--color-f2f5f7, #f2f5f7);
  --ht-topics-pale-blue: #e6edf7;     /* design --pale-blue */
  --ht-topics-box-bg: #f5f8fc;        /* design, callout */
  --ht-topics-box-line: #d9e3ef;      /* design, callout */
  /* updated by the script with the real bottom edge of the header; without JS it
     falls back to Impreza's value (108, a bit taller than the real sticky header, 87) */
  --ht-topics-nav-top: var(--header-sticky-height, 0px);
  padding: 48px 0;                    /* UIKit main>section, at every width */
}

/* ---------- 1. heading ---------- */

/* H2 = UIKit .H700: 40 / 36 / 32 / 24 across the CMS breakpoints */
.l-section.ht--topics-1c-list-nav-2c-tit-text-box h2 {
  font-size: 40px;
  line-height: 1.3;
  font-weight: 600;
  margin: 10px 0 36px;
}

/* ---------- 2. numbered index ---------- */

.l-section.ht--topics-1c-list-nav-2c-tit-text-box .ht--topics-index {
  margin-bottom: 48px;
}

.l-section.ht--topics-1c-list-nav-2c-tit-text-box .ht--topics-index ol {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: ht-topics-index;
  border-top: 1px solid var(--ht-topics-line);
}

.l-section.ht--topics-1c-list-nav-2c-tit-text-box .ht--topics-index li {
  counter-increment: ht-topics-index;
  position: relative;
  padding-block: 20px;
  padding-inline: 80px 64px;
  border-bottom: 1px solid var(--ht-topics-line);
  /* explicit values: posts set li to 18px/1.7 !important with bullets (000_single-post.css) */
  margin: 0 !important;
  list-style: none !important;
  font-size: 16px !important;
  line-height: 24px !important;
  color: var(--color-content-text, #000);
  transition: background-color .15s ease;
}

.l-section.ht--topics-1c-list-nav-2c-tit-text-box .ht--topics-index li:focus-within {
  background: var(--ht-topics-pale);
}

/* hover only on devices with a real pointer: on phones a tapped item would stay
   highlighted ("sticky hover") */
@media (hover: hover) {
  .l-section.ht--topics-1c-list-nav-2c-tit-text-box .ht--topics-index li:hover {
    background: var(--ht-topics-pale);
  }
}

/* automatic number 01, 02... */
.l-section.ht--topics-1c-list-nav-2c-tit-text-box .ht--topics-index li::before {
  content: counter(ht-topics-index, decimal-leading-zero);
  position: absolute;
  top: 20px;
  inset-inline-start: 16px;
  color: var(--color-maincolor, #0055b8);
  font-size: 16px;
  line-height: 24px;
  font-weight: 500;
}

/* arrow */
.l-section.ht--topics-1c-list-nav-2c-tit-text-box .ht--topics-index li::after {
  content: "\2193";
  position: absolute;
  top: 20px;
  inset-inline-end: 16px;
  color: var(--color-maincolor, #0055b8);
  font-size: 16px;
  line-height: 24px;
  font-weight: 500;
}

/* title = link: the whole row is clickable */
.l-section.ht--topics-1c-list-nav-2c-tit-text-box .ht--topics-index li a {
  display: block;
  margin-bottom: 5px;
  color: var(--color-content-text, #000);
  font-size: 20px;
  line-height: 1.2;
  font-weight: 500;
  text-decoration: none;
}

.l-section.ht--topics-1c-list-nav-2c-tit-text-box .ht--topics-index li a::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
}

.l-section.ht--topics-1c-list-nav-2c-tit-text-box .ht--topics-index li a:focus-visible {
  outline: none;
}

.l-section.ht--topics-1c-list-nav-2c-tit-text-box .ht--topics-index li a:focus-visible::after {
  outline: 2px solid var(--color-maincolor, #0055b8);
  outline-offset: -2px;
}

.l-section.ht--topics-1c-list-nav-2c-tit-text-box .ht--topics-index li > br,
.l-section.ht--topics-1c-list-nav-2c-tit-text-box .ht--topics-index li > p:empty {
  display: none;
}

.l-section.ht--topics-1c-list-nav-2c-tit-text-box .ht--topics-index li p {
  margin: 0;
  margin-bottom: 0 !important;
  font-size: 16px;
  line-height: 24px;
}

/* ---------- 3. bar ---------- */

.l-section.ht--topics-1c-list-nav-2c-tit-text-box .ht--topics-nav {
  position: sticky;
  top: var(--ht-topics-nav-top);
  z-index: 9;
  margin: 0;
  background: var(--color-content-bg, #fff);
  /* full-width background and line without widening the page */
  box-shadow: 0 0 0 100vmax var(--color-content-bg, #fff);
  clip-path: inset(0 -100vmax);
}

/* after the last topic the script fixes it (and leaves a placeholder in its place) */
.l-section.ht--topics-1c-list-nav-2c-tit-text-box .ht--topics-nav.is-fixed {
  position: fixed;
}

.l-section.ht--topics-1c-list-nav-2c-tit-text-box .ht--topics-nav::after {
  content: "";
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  height: 1px;
  background: var(--ht-topics-nav-line);
  box-shadow: 0 0 0 100vmax var(--ht-topics-nav-line);
  clip-path: inset(0 -100vmax);
  pointer-events: none;
}

.l-section.ht--topics-1c-list-nav-2c-tit-text-box .ht--topics-nav .vc_column-inner,
.l-section.ht--topics-1c-list-nav-2c-tit-text-box .ht--topics-nav .wpb_text_column,
.l-section.ht--topics-1c-list-nav-2c-tit-text-box .ht--topics-nav .wpb_wrapper {
  margin: 0;
  padding: 0;
}

.l-section.ht--topics-1c-list-nav-2c-tit-text-box .ht--topics-nav p {
  display: flex;
  gap: 8px;
  margin: 0;
  margin-bottom: 0 !important;
  overflow-x: auto;
  scrollbar-width: thin;
  font-size: 16px;
  line-height: 24px;
}

.l-section.ht--topics-1c-list-nav-2c-tit-text-box .ht--topics-nav p {
  /* when the bar scrolls (mobile): items settle whole, the active one centred */
  scroll-snap-type: x proximity;
}

.l-section.ht--topics-1c-list-nav-2c-tit-text-box .ht--topics-nav a {
  scroll-snap-align: center;
}

/* fades on the sides that hide more items (classes set by the script) */
.l-section.ht--topics-1c-list-nav-2c-tit-text-box .ht--topics-nav.ht--fade-left p {
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 40px);
  mask-image: linear-gradient(to right, transparent 0, #000 40px);
}

.l-section.ht--topics-1c-list-nav-2c-tit-text-box .ht--topics-nav.ht--fade-right p {
  -webkit-mask-image: linear-gradient(to left, transparent 0, #000 40px);
  mask-image: linear-gradient(to left, transparent 0, #000 40px);
}

.l-section.ht--topics-1c-list-nav-2c-tit-text-box .ht--topics-nav.ht--fade-left.ht--fade-right p {
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 40px, #000 calc(100% - 40px), transparent 100%);
  mask-image: linear-gradient(to right, transparent 0, #000 40px, #000 calc(100% - 40px), transparent 100%);
}

.l-section.ht--topics-1c-list-nav-2c-tit-text-box .ht--topics-nav p::-webkit-scrollbar {
  height: 4px;
}

.l-section.ht--topics-1c-list-nav-2c-tit-text-box .ht--topics-nav p::-webkit-scrollbar-thumb {
  background: var(--ht-topics-nav-line);
  border-radius: 2px;
}

/* touch devices scroll the bar with a swipe: no scrollbar (it would appear as a
   line under the items for a second after each horizontal scroll) */
@media (hover: none) {
  .l-section.ht--topics-1c-list-nav-2c-tit-text-box .ht--topics-nav p {
    scrollbar-width: none;
  }
  .l-section.ht--topics-1c-list-nav-2c-tit-text-box .ht--topics-nav p::-webkit-scrollbar {
    display: none;
  }
}

.l-section.ht--topics-1c-list-nav-2c-tit-text-box .ht--topics-nav a {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 6px 20px 4px;
  border-bottom: 2px solid transparent;
  color: var(--ht-topics-muted);
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  /* the active item switches at once: Impreza's global a{transition:.2s} made the
     old underline and background fade out slowly while the new one appeared */
  transition: none;
}

.l-section.ht--topics-1c-list-nav-2c-tit-text-box .ht--topics-nav a::before {
  content: attr(data-n);
  font-size: 14px;
}

.l-section.ht--topics-1c-list-nav-2c-tit-text-box .ht--topics-nav a:not([data-n])::before {
  content: none;
}

@media (hover: hover) {
  .l-section.ht--topics-1c-list-nav-2c-tit-text-box .ht--topics-nav a:hover {
    color: var(--color-maincolor, #0055b8);
  }
}

.l-section.ht--topics-1c-list-nav-2c-tit-text-box .ht--topics-nav a[aria-current] {
  color: var(--color-maincolor, #0055b8);
  background: var(--ht-topics-pale-blue);
  border-bottom-color: var(--color-maincolor, #0055b8);
  font-weight: 600;
}

.l-section.ht--topics-1c-list-nav-2c-tit-text-box .ht--topics-nav a:focus-visible {
  outline: 2px solid var(--color-maincolor, #0055b8);
  outline-offset: -4px;
}

/* links that do not point to a topic of the component (e.g. "Full report"): pushed to the end */
.l-section.ht--topics-1c-list-nav-2c-tit-text-box .ht--topics-nav a.ht--topics-nav-extra {
  margin-inline-start: auto;
  color: var(--color-maincolor, #0055b8);
}

/* ---------- 4. topics ---------- */

.l-section.ht--topics-1c-list-nav-2c-tit-text-box .ht--topics-item {
  /* without JS the native anchor jump still lands below the header and the bar */
  scroll-margin-top: calc(var(--ht-topics-nav-top) + 44px);
  margin: 0;
  /* 48 above and below each divider = UIKit section rhythm (main>section 48) */
  padding: 48px 0;
  border-bottom: 1px solid var(--ht-topics-line);
}

/* no divider and no bottom padding after the last topic: the section padding
   (48) follows, as between any two sections of the page */
.l-section.ht--topics-1c-list-nav-2c-tit-text-box .ht--topics-item:not(:has(~ .ht--topics-item)) {
  border-bottom: 0;
  padding-bottom: 0;
}

/* UIKit grid col-4 + col-8 (30 px gutter) only on the intended layout (1/3 + 2/3)
   and only above 840: if an editor changes the columns, Impreza's grid applies */
@media (min-width: 841px) {
  .l-section.ht--topics-1c-list-nav-2c-tit-text-box .ht--topics-item.g-cols.cols_1-2 {
    grid-template-columns: calc((100% + 30px) / 3 - 30px) 1fr;
    column-gap: 30px;
    align-items: start;
  }
}

/* links in the text and index items: keyboard focus does not end up under the header and the bar */
.l-section.ht--topics-1c-list-nav-2c-tit-text-box .ht--topics-item a,
.l-section.ht--topics-1c-list-nav-2c-tit-text-box .ht--topics-index a {
  scroll-margin-top: calc(var(--ht-topics-nav-top) + 52px);
}

/* topic H2 = UIKit .H600: 32 / 30 / 28 / 23 */
.l-section.ht--topics-1c-list-nav-2c-tit-text-box .ht--topics-item h2 {
  margin: 10px 0 0;
  font-size: 32px;
  line-height: 1.25;
  font-weight: 600;
}

.l-section.ht--topics-1c-list-nav-2c-tit-text-box .ht--topics-item p {
  margin: 10px 0 0;
  /* explicit: pages add 24px below paragraphs, posts remove it */
  margin-bottom: 24px !important;
  font-size: 18px;
  line-height: 1.6;
}

/* the last paragraph of the column (with or without box) adds no bottom space */
.l-section.ht--topics-1c-list-nav-2c-tit-text-box .ht--topics-item .wpb_text_column:last-child p:last-child {
  margin-bottom: 0 !important;
}

.l-section.ht--topics-1c-list-nav-2c-tit-text-box .ht--topics-box {
  margin-top: 0;
  padding: 20px 24px;
  border: 1px solid var(--ht-topics-box-line);
  border-radius: 4px;
  background: var(--ht-topics-box-bg);
}

/* box H3 = UIKit .H400 (20/1.2/500, 18 below 840). The !important declarations beat
   h3{font-weight:600 !important; line-height:1.3 !important} in typography.css */
.l-section.ht--topics-1c-list-nav-2c-tit-text-box .ht--topics-box h3 {
  margin: 0;
  font-size: 20px !important;
  line-height: 1.2 !important;
  font-weight: 500 !important;
}

.l-section.ht--topics-1c-list-nav-2c-tit-text-box .ht--topics-box p {
  font-size: 16px;
  line-height: 24px;
}

.l-section.ht--topics-1c-list-nav-2c-tit-text-box .ht--topics-box p:first-child {
  margin-top: 0;
}

/* ---------- responsive: Impreza breakpoints mapped to the UIKit scale ----------
   >1920 = UIKit desktop; 1025-1920 = UIKit <=1399; 841-1024 = <=991; <=840 = <=575 */

@media (min-width: 1025px) and (max-width: 1920px) {
  .l-section.ht--topics-1c-list-nav-2c-tit-text-box h2 {
    font-size: 36px;
  }
  .l-section.ht--topics-1c-list-nav-2c-tit-text-box .ht--topics-item h2 {
    font-size: 30px;
  }
}

@media (min-width: 841px) and (max-width: 1024px) {
  .l-section.ht--topics-1c-list-nav-2c-tit-text-box h2 {
    font-size: 32px;
  }
  .l-section.ht--topics-1c-list-nav-2c-tit-text-box .ht--topics-item h2 {
    font-size: 28px;
  }
  .l-section.ht--topics-1c-list-nav-2c-tit-text-box .ht--topics-item {
    padding-block: 40px;
  }
  .l-section.ht--topics-1c-list-nav-2c-tit-text-box .ht--topics-item:not(:has(~ .ht--topics-item)) {
    padding-bottom: 0;
  }
}

@media (max-width: 840px) {
  .l-section.ht--topics-1c-list-nav-2c-tit-text-box h2 {
    font-size: 24px;
  }
  .l-section.ht--topics-1c-list-nav-2c-tit-text-box .ht--topics-index {
    margin-bottom: 32px;
  }
  .l-section.ht--topics-1c-list-nav-2c-tit-text-box .ht--topics-index li {
    padding-block: 16px;
    padding-inline: 41px 30px;
  }
  .l-section.ht--topics-1c-list-nav-2c-tit-text-box .ht--topics-index li::before,
  .l-section.ht--topics-1c-list-nav-2c-tit-text-box .ht--topics-index li::after {
    top: 16px;
  }
  .l-section.ht--topics-1c-list-nav-2c-tit-text-box .ht--topics-index li::before {
    inset-inline-start: 4px;
  }
  .l-section.ht--topics-1c-list-nav-2c-tit-text-box .ht--topics-index li::after {
    inset-inline-end: 4px;
  }
  .l-section.ht--topics-1c-list-nav-2c-tit-text-box .ht--topics-index li a {
    font-size: 18px;
  }
  .l-section.ht--topics-1c-list-nav-2c-tit-text-box .ht--topics-nav a {
    padding-inline: 14px;
  }
  .l-section.ht--topics-1c-list-nav-2c-tit-text-box .ht--topics-nav p {
    gap: 0;
  }
  /* stacked columns, UIKit 30 px gutter */
  .l-section.ht--topics-1c-list-nav-2c-tit-text-box .ht--topics-item.g-cols {
    grid-template-columns: 1fr;
    gap: 30px;
    padding: 32px 0;
  }
  .l-section.ht--topics-1c-list-nav-2c-tit-text-box .ht--topics-item.g-cols:not(:has(~ .ht--topics-item)) {
    padding-bottom: 0;
  }
  .l-section.ht--topics-1c-list-nav-2c-tit-text-box .ht--topics-item h2 {
    font-size: 23px !important;      /* posts force 24px !important on mobile */
  }
  .l-section.ht--topics-1c-list-nav-2c-tit-text-box .ht--topics-item p {
    font-size: 16px;
  }
  .l-section.ht--topics-1c-list-nav-2c-tit-text-box .ht--topics-box h3 {
    font-size: 18px !important;      /* posts force 40px !important on mobile */
  }
  .l-section.ht--topics-1c-list-nav-2c-tit-text-box .ht--topics-box {
    padding: 16px;
  }
}

/* Below 840px Impreza sets .l-canvas{overflow:hidden}, which prevents sticky
   positioning. Only on pages containing this module overflow:clip is used instead:
   it clips the same way but does not create a scroll container. */
@media (max-width: 839px) {
  .l-canvas:has(.ht--topics-1c-list-nav-2c-tit-text-box) {
    overflow: clip;
  }
}

/* very short viewports (high zoom): the bar does not stick, so that together
   with the header it does not cover half of the screen */
/* ---------- page gutter on tablet ---------- */

/* 841-1024: Impreza keeps the content 16 px from the edges while the header
   logo stays at 40 px. On the page that hosts this module the content lines up
   with the logo (as in the mockup, where content and logo share the gutter).
   Scoped with :has(), and this file is only enqueued where the module is used:
   no other page is affected. */
@media (min-width: 841px) and (max-width: 1024px) {
  .l-canvas:has(.l-section.ht--topics-1c-list-nav-2c-tit-text-box) .l-main > .l-section > .l-section-h {
    padding-left: 40px;
    padding-right: 40px;
  }
}

/* ---------- report title in a post ---------- */

/* #ht--quote (existing module) on the page that hosts this module: in posts
   000_single-post.css sets h3 to 40px !important at <=840, so the title's line
   pitch doubled. Same values as in a page. Scoped with :has(). */
@media (max-width: 840px) {
  .single-post .l-canvas:has(.l-section.ht--topics-1c-list-nav-2c-tit-text-box) #ht--quote h3.p32 {
    font-size: 32px !important;
  }
}
@media (max-width: 575px) {
  .single-post .l-canvas:has(.l-section.ht--topics-1c-list-nav-2c-tit-text-box) #ht--quote h3.p32 {
    font-size: 20px !important;
  }
}

@media (max-height: 500px) {
  .l-section.ht--topics-1c-list-nav-2c-tit-text-box .ht--topics-nav {
    position: static;
  }
}

@media (prefers-reduced-motion: reduce) {
  .l-section.ht--topics-1c-list-nav-2c-tit-text-box .ht--topics-index li {
    transition: none;
  }
}
