/*
 * .faq-library — FAQ page library: head, search, category pills, accordion groups;
 * search states "results" and "nothing found" (template-parts/flexible/faq-library.php).
 * Figma iQAOfxwhBBZYowlHVCUV8x: main D 18:43696 / M 18:50961, results D 18:43480 / M 18:50816,
 * nothing found D 18:43311 / M 18:50714. Measurements: docs/phase2/analysis/faq-values.md.
 *
 * The groups and the found questions are the shared FAQ accordion (faq.css, .faq--plain);
 * the library only tunes its spacing to the FAQ page frames.
 */

.faq-library {
  /* head → search: 40 → 75 px; search → pills: 40 → 50 px (pills → groups is 50 px everywhere) */
  --fl-gap-s: clamp(2.5rem, 2.28rem + 0.94vw, 3.125rem);
  --fl-gap-l: clamp(2.5rem, 1.78rem + 3.06vw, 4.6875rem);
  /* group lines: navy 10 % on desktop, blue 10 % on phones */
  --fl-line: rgba(26, 121, 191, 0.1);

  position: relative;
  isolation: isolate;
  padding-top: var(--nv-section-y);
  padding-bottom: var(--nv-section-y);
  scroll-margin-top: 7.5rem;

  /* @media (width >= 48em) .faq-library */
  @media (width >= 48em) {
    --fl-line: rgba(19, 33, 50, 0.1);
  }
}

/* .faq-library:has(+ .form-card), .faq-library--empty — no bottom padding: the form card's own top padding
   (desktop 100 px, phones 0) or the next section's padding is the whole gap in the frames (18:43696 / 18:50961,
   18:43311 / 18:50714) */
.faq-library:has(+ .form-card),
.faq-library--empty {
  padding-bottom: 0;
}

/* .faq-library__texture — strip along the left edge behind the groups (27 % of the page), desktop only */
.faq-library__texture {
  display: none;

  /* @media (width >= 48em) .faq-library__texture */
  @media (width >= 48em) {
    display: block;
    position: absolute;
    z-index: -1;
    top: 0;
    left: 0;
    width: 26.97%;
    pointer-events: none;
  }
}

/* .faq-library__texture-image */
.faq-library__texture-image {
  display: block;
  width: 100%;
  height: auto;
}

/* .faq-library__container */
.faq-library__container {
  display: flex;
  flex-direction: column;
}

/* .faq-library__head — eyebrow, heading (and the results subtitle), centred */
.faq-library__head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(2.5rem, 2.32rem + 0.75vw, 3rem);
  text-align: center;
}

/* .faq-library__eyebrow — green label with a rhomb, 10 px around the cap height */
.faq-library__eyebrow {
  display: inline-flex;
  max-width: 100%;
  align-items: flex-start;
  gap: 0.3125rem;
  padding: calc(0.625rem - 0.14em) 0.625rem;
  color: var(--nv-green);
  font-weight: 500;
  font-size: clamp(1rem, 0.91rem + 0.38vw, 1.25rem);
  line-height: 1;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  overflow-wrap: anywhere;

  /* @media (width >= 64.0625em) .faq-library__eyebrow */
  @media (width >= 64.0625em) {
    letter-spacing: 0.1em;
  }

  /* .faq-library__eyebrow::before — rhomb */
  &::before {
    content: "";
    flex-shrink: 0;
    width: 0.53rem;
    height: 0.53rem;
    margin-top: calc(0.5lh - 0.265rem);
    background: url("../../img/icons/rhomb.svg") center / contain no-repeat;
  }
}

/* .faq-library__title — 40 → 90 px, two lines on desktop; line box trimmed to cap / baseline */
.faq-library__title {
  max-width: 15.2em;
  margin-top: -0.14em;
  margin-bottom: -0.14em;
  color: var(--nv-navy);
  font-weight: 400;
  font-size: var(--nv-fs-h2);
  line-height: 1;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;

  /* any tag from the editor keeps the heading look */
  & > * {
    margin: 0;
    font: inherit;
    letter-spacing: inherit;
  }

  & strong {
    color: var(--nv-green);
    font-weight: inherit;
  }
}

/* .faq-library__subtitle — "Showing results for “…”": 23 → 32 px at 120 %, 20 → 48 px under the heading
   (head gap 40 → 48 minus 21 → 0) */
.faq-library__subtitle {
  margin-top: calc(clamp(-1.3125rem, -1.744rem + 1.834vw, 0rem) - 0.19em);
  margin-bottom: -0.1em;
  color: var(--nv-navy);
  font-size: clamp(1.4375rem, 1.24rem + 0.85vw, 2rem);
  line-height: 1.2;
  letter-spacing: -0.04em;
  overflow-wrap: anywhere;

  & > * {
    margin: 0;
  }
}

/* .faq-library__query — the visitor's words, blue and medium (with the quotes);
   phones: one block, so the frame's break after "for" happens and the quoted words stay together */
.faq-library__query {
  display: inline-block;
  max-width: 100%;
  color: var(--nv-blue-light);
  font-weight: 500;

  /* @media (width >= 48em) .faq-library__query — runs on with the sentence */
  @media (width >= 48em) {
    display: inline;
  }
}

/* .faq-library__search — phones: field, then the button under it (20 px);
   desktop: one 924 × 78 box with the button inside */
.faq-library__search {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  width: 100%;
  max-width: 57.75rem;
  margin-top: var(--fl-gap-l);
  margin-inline: auto;

  /* @media (width >= 48em) .faq-library__search */
  @media (width >= 48em) {
    flex-direction: row;
    gap: 0;
    height: 4.875rem;
    border: 0.125rem solid rgba(26, 121, 191, 0.1);
    border-radius: 0.75rem;
    background-color: var(--nv-white);

    /* .faq-library__search:has(.faq-library__field:focus-within) — desktop: the box frame turns blue while
       typing, like the other site fields; no second ring around it (Pavlo, 2026-11-18) */
    &:has(.faq-library__field:focus-within) {
      border-color: var(--nv-blue-light);
    }
  }
}

/* .faq-library__field — the text box: 64 px with a light frame on phones, no frame of its own on desktop */
.faq-library__field {
  position: relative;
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  gap: 0.625rem;
  min-width: 0;
  height: 4rem;
  padding-inline: 1.25rem;
  border: 0.125rem solid #f6f7f9;
  border-radius: var(--nv-radius-s);
  background-color: var(--nv-white);
  color: var(--nv-blue);

  /* .faq-library__field:focus-within — phones: the field's own frame turns blue while typing */
  &:focus-within {
    border-color: var(--nv-blue-light);
  }

  /* @media (width >= 48em) .faq-library__field — the clear button sits 25 px before SEARCH */
  @media (width >= 48em) {
    height: auto;
    padding-left: 1.875rem;
    padding-right: 1.5625rem;
    border: 0;
    background-color: transparent;
  }
}

/* .faq-library__label — visible to screen readers only */
.faq-library__label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* .faq-library__search-icon — magnifier on the left, only with words in the field */
.faq-library__search-icon {
  display: none;
  flex-shrink: 0;
}

/* .faq-library__search--filled .faq-library__search-icon */
.faq-library__search--filled .faq-library__search-icon {
  display: block;
}

/* .faq-library__input — 20 px blue text and placeholder */
.faq-library__input {
  flex: 1 1 auto;
  min-width: 0;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--nv-blue);
  font: inherit;
  font-size: 1.25rem;
  line-height: 1;
  letter-spacing: -0.02em;
  text-overflow: ellipsis;

  /* .faq-library__input::placeholder */
  &::placeholder {
    color: var(--nv-blue);
    opacity: 1;
  }

  /* .faq-library__input:focus — the whole search box shows the focus */
  &:focus {
    outline: none;
  }

  /* .faq-library__input::-webkit-search-cancel-button — the clear link replaces the native cross */
  &::-webkit-search-cancel-button {
    appearance: none;
  }
}

/* .faq-library__clear — 32 px cross in a circle, back to the whole library */
.faq-library__clear {
  display: flex;
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  color: var(--nv-blue);

  /* .faq-library__clear:focus-visible */
  &:focus-visible {
    outline: 0.125rem solid var(--nv-blue-light);
    outline-offset: 0.125rem;
  }
}

/* .faq-library__clear-icon */
.faq-library__clear-icon {
  width: 100%;
  height: 100%;
}

/* .faq-library__submit — phones: full-width 64 px (grows with a long label), 20 px label left (30 px padding)
   and magnifier right; desktop: 74 px inside the box frame */
.faq-library__submit {
  justify-content: space-between;
  width: 100%;
  min-height: 4rem;
  padding-inline: 1.875rem;
  border: 0;
  font-size: 1.25rem;
  overflow-wrap: anywhere;
  cursor: pointer;

  /* @media (width >= 48em) .faq-library__submit */
  @media (width >= 48em) {
    flex-shrink: 0;
    justify-content: center;
    width: auto;
    height: 100%;
  }

  /* .faq-library__submit:focus-visible */
  &:focus-visible {
    outline: 0.125rem solid var(--nv-navy);
    outline-offset: -0.25rem;
  }
}

/* .faq-library__submit-icon */
.faq-library__submit-icon {
  flex-shrink: 0;
}

/* .faq-library__pills — phones: one row that scrolls sideways to the screen edges; desktop: wraps (10 px) */
.faq-library__pills {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  margin-top: var(--fl-gap-s);
  margin-inline: -1.25rem;
  padding-inline: 1.25rem;
  overflow-x: auto;
  scrollbar-width: none;

  /* @media (width >= 48em) .faq-library__pills */
  @media (width >= 48em) {
    flex-wrap: wrap;
    margin-inline: 0;
    padding-inline: 0;
    overflow: visible;
  }
}

/* .faq-library__pill — the filter tab of the resource lists (filter-bar.css .filter-bar__tab) */
.faq-library__pill {
  flex-shrink: 0;
  border-radius: 6.25rem;
  padding: calc(1.25rem - 0.14em) 1.25rem;
  background-color: rgba(204, 219, 232, 0.15);
  color: var(--nv-blue);
  font-weight: 500;
  font-size: clamp(1rem, 0.9111rem + 0.3792vw, 1.25rem);
  line-height: 1;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  white-space: nowrap;
  transition: background-color 0.3s ease, color 0.3s ease;

  /* .faq-library__pill:focus-visible */
  &:focus-visible {
    outline: 0.125rem solid var(--nv-green);
    outline-offset: -0.125rem;
  }

  /* @media (width >= 48em) .faq-library__pill — 20 → 15 px sides */
  @media (width >= 48em) {
    padding-inline: 0.9375rem;
  }
}

/* .faq-library__pill--active — large navy pill */
.faq-library__pill--active {
  padding: calc(1.875rem - 0.14em) 1.875rem;
  background: linear-gradient(90deg, var(--nv-navy) 0%, var(--nv-blue) 100%);
  color: var(--nv-white);
  font-size: clamp(1rem, 0.8223rem + 0.7583vw, 1.5rem);

  /* @media (width >= 48em) .faq-library__pill--active — 30 → 20 px sides */
  @media (width >= 48em) {
    padding-inline: 1.25rem;
  }
}

/* @media (hover: hover) .faq-library__pill:hover */
@media (hover: hover) and (pointer: fine) {
  .faq-library__pill:not(.faq-library__pill--active):hover {
    background-color: rgba(204, 219, 232, 0.4);
  }
}

/* .faq-library__count — the number stays with its label */
.faq-library__count {
  white-space: nowrap;
}

/* .faq-library__groups — a line above every shown group, 50 px under the pills */
.faq-library__groups {
  margin-top: 3.125rem;
}

/* .faq-library__group[hidden] — groups of the other categories (pills) */
.faq-library__group[hidden] {
  display: none;
}

/* .faq-library__group — one category: line, 50 px, eyebrow | heading + accordion */
.faq-library__group {
  border-top: 1px solid var(--fl-line);
}

/* .faq-library__group .faq — the shared accordion section inside the library: line → eyebrow 51 px on phones, 50 px from 48em */
.faq-library__group > .faq {
  padding-top: 3.1875rem;
  padding-bottom: clamp(1.875rem, 1.49rem + 1.66vw, 3.0625rem);

  /* @media (width >= 48em) .faq-library__group .faq */
  @media (width >= 48em) {
    padding-top: 3.125rem;
  }
}

/* .faq-library .faq__container — no second set of page gutters inside the library;
   desktop: heading and list 20 px after the 335 px column */
.faq-library .faq__container {
  padding-inline: 0;

  /* @media (width >= 64.0625em) .faq-library .faq__container */
  @media (width >= 64.0625em) {
    column-gap: 1.25rem;
  }
}

/* .faq-library .faq__title — group heading: 120 % / -3 % on desktop */
.faq-library .faq__title {
  /* @media (width >= 48em) .faq-library .faq__title */
  @media (width >= 48em) {
    line-height: 1.2;
    letter-spacing: -0.03em;
  }

  /* @media (width >= 64.0625em) .faq-library .faq__title — heading ink 48 px under the line and 32 px above the list
     (the 120 % line box would give 67 and 50) */
  @media (width >= 64.0625em) {
    margin-top: -0.25em;
    margin-bottom: -0.24em;
  }
}

/* .faq-library .faq__list, .faq__item — lines in the page colour */
.faq-library .faq__list,
.faq-library .faq__item {
  border-color: var(--fl-line);
}

/* .faq-library .faq__list — no line under the last question: the next group's line follows */
.faq-library .faq__list {
  border-bottom: 0;
}

/* .faq-library .faq__eyebrow — phones: 2 px of slack so a long label wraps where the frame wraps it
   (the box is 335 px and the text needs 335.9 with the right padding) */
.faq-library .faq__eyebrow {
  padding-right: 0.5rem;

  /* @media (width >= 48em) .faq-library .faq__eyebrow */
  @media (width >= 48em) {
    padding-right: 0.625rem;
  }
}

/* .faq-library .faq__item — desktop: 15 px closed (14.5 + the 1 px line = the 105 px step of the frame), 25 px open */
.faq-library .faq__item {
  /* @media (width >= 64.0625em) .faq-library .faq__item */
  @media (width >= 64.0625em) {
    padding-block: calc(0.9375rem - 0.5px);
  }
}

/* .faq-library .faq__item[open] */
.faq-library .faq__item[open]:not(.faq__item--closing) {
  /* @media (width >= 64.0625em) .faq-library .faq__item[open] */
  @media (width >= 64.0625em) {
    padding-block: 1.5625rem;
  }
}

/* .faq-library .faq__chevron — closed: 30 %, light blue on phones */
.faq-library .faq__chevron {
  color: var(--nv-blue-light);
  opacity: 0.3;

  /* @media (width >= 48em) .faq-library .faq__chevron */
  @media (width >= 48em) {
    color: var(--nv-blue);
  }
}

/* .faq-library .faq__answer — 22 → 24 px under the question; phones: text at 80 %, 22 px lines (Figma 120 % rounds up), -2 % tracking (-3 % on desktop) */
.faq-library .faq__answer {
  margin-top: clamp(1.375rem, 1.334rem + 0.175vw, 1.5rem);
  color: rgba(19, 33, 50, 0.8);
  line-height: 1.2222;
  letter-spacing: -0.02em;

  /* @media (width >= 48em) .faq-library .faq__answer */
  @media (width >= 48em) {
    color: var(--nv-navy);
    line-height: 1.4;
    letter-spacing: -0.03em;
  }

  /* .faq-library .faq__answer > .nv-bold-line — phones: 15 px of ink between the paragraph and the bold line
     (Figma M 18:50961; the shared rule gives 11) */
  & > .nv-bold-line {
    margin-top: calc(1.25rem - 0.16em);

    /* @media (width >= 48em) .faq-library .faq__answer > .nv-bold-line — back to the shared flow gap (13.2 px, collapses to 6.4) */
    @media (width >= 48em) {
      margin-top: calc(1.25rem - 0.34em);
    }
  }

  /* bold lines stay at full strength */
  & strong,
  & b {
    color: var(--nv-navy);
  }
}

/* .faq-library--results .faq-library__search — results: 37 → 70 px under the subtitle (the plain library has 40 → 75 under the heading) */
.faq-library--results .faq-library__search {
  margin-top: clamp(2.3125rem, 1.64rem + 2.88vw, 4.375rem);
}

/* .faq-library__results — count, found questions and "Back to FAQ" in the 926 px column */
.faq-library__results {
  width: 100%;
  max-width: 57.875rem;
  margin-top: 3.25rem;
  margin-inline: auto;
}

/* .faq-library__total — "4 results found": 16 → 18 px, blue 90 %; 52 px of ink to the first question on phones,
   22 px of margin on desktop (the 75 px row centres the question 22 px lower) */
.faq-library__total {
  margin-bottom: clamp(1.375rem, 3.864rem - 2.62vw, 3.25rem);
  color: rgba(33, 91, 135, 0.9);
  font-size: clamp(1rem, 0.91rem + 0.38vw, 1.125rem);
  line-height: 1;
  letter-spacing: -0.02em;
}

/* .faq-library__results .faq — the found questions: no section padding, first item without a line above */
.faq-library__results .faq {
  padding-block: 0;
}

/* .faq-library__results .faq__main — the list fills the column */
.faq-library__results .faq__main {
  grid-column: 1 / -1;
}

/* .faq-library__results .faq__list */
.faq-library__results .faq__list {
  border-bottom: 0;

  & > .faq__item:first-child {
    border-top: 0;
    padding-top: 0;
  }
}

/* .faq-library__back — "‹ Back to FAQ" / "‹ Browse all FAQs": 60 px of ink under the last question on phones, 67 on desktop
   (the item padding and the 75 px row already add space, so the margin is 30 → 19 px) */
.faq-library__back {
  margin-top: clamp(1.1875rem, 2.1rem - 0.961vw, 1.875rem);
}

/* .faq-library__back-link */
.faq-library__back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.625rem 0;
  color: var(--nv-blue);
  font-weight: 500;
  font-size: clamp(1.125rem, 1.08rem + 0.19vw, 1.25rem);
  line-height: 1;
  letter-spacing: -0.02em;

  /* .faq-library__back-link:focus-visible */
  &:focus-visible {
    outline: 0.125rem solid var(--nv-blue-light);
    outline-offset: 0.125rem;
  }
}

/* @media (hover: hover) .faq-library__back-link:hover */
@media (hover: hover) and (pointer: fine) {
  .faq-library__back-link:hover {
    color: var(--nv-blue-light);
  }
}

/* .faq-library__back-icon — 20 px box, the frame's 10 × 20 chevron with a 2 px line */
.faq-library__back-icon {
  flex-shrink: 0;
}

/* .faq-library__empty — light card with the wave: 40 / 20 px on phones, 75 / 30 px on desktop */
.faq-library__empty {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border-radius: var(--nv-radius-s);
  background-color: var(--nv-ice);
}

/* .faq-library__empty-texture — phones 467 px wide from (-66, -113), desktop 1132 px from (134, 173) */
.faq-library__empty-texture {
  position: absolute;
  z-index: -1;
  top: -7.0625rem;
  left: -4.125rem;
  width: 29.1875rem;
  pointer-events: none;

  /* @media (width >= 48em) .faq-library__empty-texture */
  @media (width >= 48em) {
    top: 10.8125rem;
    left: 9.57%;
    width: 70.75rem;
  }
}

/* .faq-library__empty-texture-image */
.faq-library__empty-texture-image {
  display: block;
  width: 100%;
  height: auto;
}

/* .faq-library__empty-body */
.faq-library__empty-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(2.5rem, 1.72rem + 3.29vw, 4.375rem);
  padding: 2.5rem 1.25rem;
  text-align: center;

  /* @media (width >= 48em) .faq-library__empty-body */
  @media (width >= 48em) {
    padding: 4.6875rem 1.875rem;
  }

  /* .faq-library__empty-body > .faq-library__search — desktop: 3 px closer to the text */
  & > .faq-library__search {
    margin-top: 0;

    /* @media (width >= 48em) .faq-library__empty-body > .faq-library__search */
    @media (width >= 48em) {
      margin-top: -0.1875rem;
    }
  }

  /* .faq-library__empty-body > .faq-library__back — pulled up: 0 → 19 px at the 1520 frame */
  & > .faq-library__back {
    margin-top: calc(-1 * clamp(0rem, -0.38rem + 1.6vw, 1.1875rem));
  }
}

/* .faq-library__empty-text — 16 px regular on phones, 20 px medium at 140 % on desktop */
.faq-library__empty-text {
  max-width: 59.5rem;
  margin-top: calc(-0.2em);
  margin-bottom: calc(-0.2em);
  color: var(--nv-navy);
  font-size: 1rem;
  line-height: 1.2;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;

  /* @media (width >= 48em) .faq-library__empty-text */
  @media (width >= 48em) {
    margin-top: calc(-0.2em - 1.5rem);
    font-weight: 500;
    font-size: 1.25rem;
    line-height: 1.4;
  }

  & > * {
    margin: 0;
  }

  & .faq-library__query {
    font-weight: inherit;
  }
}

/* @media (prefers-reduced-motion: reduce) .faq-library__pill */
@media (prefers-reduced-motion: reduce) {
  .faq-library__pill {
    transition: none;
  }
}
