/* ============================================
 * service-page-faq.css — categorised FAQ accordion
 *
 * Template module across all 6 service pages.
 * Built from Figma node 226:1346 (Website service page).
 *
 * Layout:
 *   Mobile  — title → horizontal scrollable category pills → questions.
 *   Desktop — 2-column: sidebar (title + sticky category list) | questions.
 *
 * Category control deliberately differs by breakpoint: mobile is a
 * horizontal scroll strip of pills; desktop is a plain vertical text
 * list in the sidebar with hairline row dividers. A pill strip and a
 * sidebar list are different layouts for the same filter control.
 *
 * Categories filter the visible question list via inline JS in
 * preview-website.html (data-faq-category / data-faq-category-list).
 *
 * FAQ items use native <details>/<summary> so they work without JS.
 * Chevron rotates -180° (counter-clockwise) on open to match the
 * mobile drawer accordion's direction.
 * ============================================ */

.tlm-service-page-faq {
  background-color: var(--color-white);
  padding-block: var(--space-section-y-mobile);        /* 40/40 mobile — tighter stacked rhythm; desktop bumps to 120 */
}

/* Background variants — opt-in per page. */
.tlm-service-page-faq--cream {
  background-color: var(--color-cream);
}

/* On a cream section the default cream accordion chip would vanish —
   flip to navy chip + white icon so it pops off the cream surround
   (matches the Engagements / reach-list chip treatment elsewhere). */
.tlm-service-page-faq--cream .tlm-service-page-faq__icon {
  background-color: var(--color-navy);
  color: var(--color-white);
}

/* Open state on cream: hold the same navy fill so the chevron flip
   reads as a state change, not a colour change. */
.tlm-service-page-faq--cream .tlm-service-page-faq__details[open] .tlm-service-page-faq__icon {
  background-color: var(--color-navy);
}

.tlm-service-page-faq__inner {
  display: flex;
  flex-direction: column;
  gap: var(--space-xl);                   /* 48 between sidebar and list (mobile) */
}

/* ============================================
 * Sidebar — title + categories
 * ============================================ */

.tlm-service-page-faq__sidebar {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);                   /* 24 between title and categories (mobile) */
}

.tlm-service-page-faq__title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: var(--text-h2-mobile);       /* 32 mobile */
  font-weight: var(--weight-regular);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-display);
  color: var(--color-text-on-light);
  text-wrap: balance;
}

/* ============================================
 * Categories — MOBILE: horizontal scrollable pills
 * ============================================ */

.tlm-service-page-faq__categories {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: row;
  gap: var(--space-xs);                   /* 8 between pills */
  overflow-x: auto;
  /* Bleed the scrollable list to the section edges so chips can flush
     to the viewport sides on mobile. Hidden scrollbar for a clean look. */
  margin-inline: calc(var(--space-section-x-mobile) * -1);
  padding-inline: var(--space-section-x-mobile);
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.tlm-service-page-faq__categories::-webkit-scrollbar {
  display: none;
}

.tlm-service-page-faq__category {
  flex-shrink: 0;
  display: inline-block;
  padding: var(--space-xs) var(--space-md);  /* 8 vertical, 24 horizontal */
  background-color: transparent;
  border: 1px solid var(--color-border-card);
  border-radius: var(--radius-pill);
  font-family: var(--font-sans);
  font-size: var(--text-base);            /* 16 — smaller than desktop's 20 */
  font-weight: var(--weight-regular);
  line-height: var(--leading-normal);
  letter-spacing: var(--tracking-tight);
  color: var(--color-text-on-light);
  white-space: nowrap;
  text-align: center;
  cursor: pointer;
  transition: background-color 200ms ease, color 200ms ease, border-color 200ms ease;
}

/* Hover = text-colour shift only (no background), matching the
   canonical link hover. Guarded so a touch tap can't leave it stuck.
   :not(.is-active) so it never fires on the selected pill — that one
   has white text on navy and must not pick up the muted navy. */
@media (hover: hover) {
  .tlm-service-page-faq__category:not(.is-active):hover {
    color: var(--color-navy-muted);
  }
}

.tlm-service-page-faq__category.is-active {
  background-color: var(--color-navy);
  border-color: var(--color-navy);
  color: var(--color-text-on-dark);
  font-weight: var(--weight-semibold);
}

.tlm-service-page-faq__category:focus-visible {
  outline: 2px solid var(--color-navy);
  outline-offset: 2px;
}

/* ============================================
 * FAQ list — native <details>/<summary>
 * ============================================ */

.tlm-service-page-faq__list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
}

.tlm-service-page-faq__list[hidden] {
  display: none;
}

.tlm-service-page-faq__item {
  border-top: 1px solid var(--color-border-card);
}

.tlm-service-page-faq__item:last-child {
  border-bottom: 1px solid var(--color-border-card);
}

.tlm-service-page-faq__details > summary::-webkit-details-marker {
  display: none;
}

.tlm-service-page-faq__details > summary::marker {
  content: none;
}

.tlm-service-page-faq__summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  padding-block: var(--space-lg);         /* 32 vertical breathing room */
  cursor: pointer;
  list-style: none;
}

.tlm-service-page-faq__summary:focus-visible {
  outline: 2px solid var(--color-navy);
  outline-offset: 2px;
}

.tlm-service-page-faq__question {
  flex: 1;
  font-family: var(--font-serif);
  font-size: var(--text-2xl);             /* 24 — H5 per Figma */
  font-weight: var(--weight-regular);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-display);
  color: var(--color-text-on-light);
}

.tlm-service-page-faq__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  background-color: var(--color-cream);
  border-radius: var(--radius-pill);
  color: var(--color-text-on-light);
  transition: transform 250ms ease, background-color 200ms ease;
}

.tlm-service-page-faq__icon svg {
  width: 24px;
  height: 24px;
}

/* Open state — chevron rotates COUNTER-CLOCKWISE (-180°) to match
   the mobile drawer accordion's direction (navbar.css:351). */
.tlm-service-page-faq__details[open] .tlm-service-page-faq__icon {
  transform: rotate(-180deg);
  background-color: var(--color-grey-100);
}

.tlm-service-page-faq__answer {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);                   /* 16 between paragraphs */
  padding-bottom: var(--space-lg);        /* 32 below answer */
}

.tlm-service-page-faq__answer p {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--text-lg);              /* 18 */
  line-height: var(--leading-relaxed);    /* 1.6 */
  letter-spacing: var(--tracking-tight);
  color: var(--color-text-on-light);
  opacity: 0.8;
}

/* ============================================
 * DESKTOP (>= 1024px) — 2-column, sticky sidebar, vertical category list
 * ============================================ */

@media (min-width: 1024px) {
  .tlm-service-page-faq {
    padding-block: var(--space-5xl);  /* 120 top + bottom — symmetric body rhythm */
  }

  .tlm-service-page-faq__inner {
    display: grid;
    grid-template-columns: 409px 1fr;
    column-gap: var(--space-4xl);         /* 80 */
    align-items: start;
  }

  .tlm-service-page-faq__title {
    font-size: var(--text-h2);            /* 56 desktop */
  }

  /* Sticky sidebar so the categories stay in view while scrolling
     the (potentially long) FAQ list. */
  .tlm-service-page-faq__sidebar {
    position: sticky;
    top: 152px;                           /* clears navbar (128) + 24 breathing */
    gap: var(--space-xl);                 /* 48 between title and categories */
  }

  /* Desktop categories: vertical stack, plain text + bottom-border
     hairline between rows, no pill chrome. Mobile keeps the scroll-
     strip pills; the desktop sidebar reads better as a plain list. */
  .tlm-service-page-faq__categories {
    flex-direction: column;
    gap: 0;
    overflow: visible;
    margin-inline: 0;
    padding-inline: 0;
  }

  .tlm-service-page-faq__category {
    width: 100%;
    flex-shrink: 1;
    display: block;
    padding: var(--space-md) 0;           /* 24 vertical, no horizontal */
    background-color: transparent;
    border: 0;
    border-bottom: 1px solid var(--color-border-card);
    border-radius: 0;
    font-size: var(--text-xl);            /* 20 */
    line-height: var(--leading-tight);
    color: var(--color-text-on-light);
    text-align: left;
    white-space: normal;
  }

  .tlm-service-page-faq__category.is-active {
    background-color: transparent;
    border-color: var(--color-border-card);
    color: var(--color-text-on-light);
    font-weight: var(--weight-bold);
  }

  .tlm-service-page-faq__categories li:last-child .tlm-service-page-faq__category {
    border-bottom: 0;
  }
}
