/* ==========================================================================
   FAQ Page CSS — faq-page.css
   Uses design-system.css variables: --ffo-primary, --ffo-dark, etc.
   ========================================================================== */

/* Header offset — header is ~102px on desktop (40px pad + ~22px logo + 40px pad) */
:root {
  --faq-header-h: 110px;
}

/* ---------- Layout ---------- */
.ffo-faq-layout {
  display: flex;
  gap: 3rem;
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

.ffo-faq-sidebar {
  flex: 0 0 280px;
  position: sticky;
  top: calc(var(--faq-header-h) + 1rem);
  align-self: flex-start;
  max-height: calc(100vh - var(--faq-header-h) - 2rem);
  overflow-y: auto;
}

.ffo-faq-content {
  flex: 1;
  min-width: 0;
}

/* ---------- Hero (Index page) ---------- */
.ffo-faq-hero {
  background: var(--ffo-dark, #181f33);
  color: #fff;
  padding: calc(var(--faq-header-h) + 3rem) 1.5rem 3rem;
  text-align: center;
}

.ffo-faq-hero h1 {
  font-family: "Figtree", sans-serif;
  font-size: 2.25rem;
  font-weight: 700;
  margin: 0 0 1.5rem;
  color: #fff;
}

/* ---------- Search ---------- */
.ffo-faq-search {
  max-width: 600px;
  margin: 0 auto;
  position: relative;
}

.ffo-faq-search__input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.ffo-faq-search__icon {
  position: absolute;
  left: 1rem;
  width: 20px;
  height: 20px;
  color: #999;
  pointer-events: none;
}

.ffo-faq-search__input {
  width: 100%;
  padding: 0.875rem 1rem 0.875rem 2.75rem;
  font-family: "Figtree", sans-serif;
  font-size: 1rem;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  outline: none;
  transition: border-color 0.2s, background 0.2s;
}

.ffo-faq-search__input::placeholder {
  color: rgba(255, 255, 255, 0.6);
}

.ffo-faq-search__input:focus {
  border-color: var(--ffo-primary, #6CAA80);
  background: rgba(255, 255, 255, 0.15);
}

/* Search inside category/article pages (light variant) */
.ffo-faq-search--light .ffo-faq-search__input {
  background: #f5f7fa;
  border: 2px solid #e2e8f0;
  color: var(--ffo-dark, #181f33);
}

.ffo-faq-search--light .ffo-faq-search__input::placeholder {
  color: #94a3b8;
}

.ffo-faq-search--light .ffo-faq-search__input:focus {
  border-color: var(--ffo-primary, #6CAA80);
  background: #fff;
}

/* Search Results Dropdown */
.ffo-faq-search__results {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  max-height: 400px;
  overflow-y: auto;
  z-index: 100;
  display: none;
}

.ffo-faq-search__results.is-active {
  display: block;
}

.ffo-faq-search__results-item {
  display: block;
  padding: 0.75rem 1rem;
  text-decoration: none;
  color: var(--ffo-dark, #181f33);
  border-bottom: 1px solid #f0f0f0;
  transition: background 0.15s;
}

.ffo-faq-search__results-item:hover,
.ffo-faq-search__results-item:focus {
  background: #f5f7fa;
}

.ffo-faq-search__results-item:last-child {
  border-bottom: none;
}

.ffo-faq-search__results-title {
  font-weight: 600;
  font-size: 0.9375rem;
  margin: 0 0 0.25rem;
}

.ffo-faq-search__results-category {
  font-size: 0.8125rem;
  color: #64748b;
}

.ffo-faq-search__no-results {
  padding: 1rem;
  text-align: center;
  color: #64748b;
  font-size: 0.875rem;
}

/* ---------- Category Cards Grid (Index page) ---------- */
.ffo-faq-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
  padding: 3rem 1.5rem 4rem;
}

.ffo-faq-card {
  display: block;
  background: #fff;
  border-radius: 12px;
  padding: 1.75rem;
  text-decoration: none;
  color: var(--ffo-dark, #181f33);
  border: 1px solid #e2e8f0;
  border-top: 4px solid var(--ffo-primary, #6CAA80);
  transition: box-shadow 0.2s, transform 0.2s;
}

.ffo-faq-card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  transform: translateY(-2px);
}

.ffo-faq-card h3 {
  font-family: "Figtree", sans-serif;
  font-size: 1.125rem;
  font-weight: 700;
  margin: 0 0 0.5rem;
  color: var(--ffo-dark, #181f33);
}

.ffo-faq-card p {
  font-size: 0.875rem;
  color: #64748b;
  margin: 0 0 1rem;
  line-height: 1.5;
}

.ffo-faq-card__link {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--ffo-primary, #6CAA80);
}

/* ---------- Breadcrumbs ---------- */
.ffo-faq-breadcrumbs {
  max-width: 1200px;
  margin: 0 auto;
  padding: calc(var(--faq-header-h) + 1.5rem) 1.5rem 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.ffo-faq-breadcrumbs ol {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 0.25rem;
  font-size: 0.875rem;
}

.ffo-faq-breadcrumbs li {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.ffo-faq-breadcrumbs li + li::before {
  content: "›";
  color: #94a3b8;
  margin-right: 0.25rem;
}

.ffo-faq-breadcrumbs a {
  color: var(--ffo-primary, #6CAA80);
  text-decoration: none;
}

.ffo-faq-breadcrumbs a:hover {
  text-decoration: underline;
}

.ffo-faq-breadcrumbs span {
  color: #64748b;
}

/* ---------- Sidebar Navigation ---------- */
.ffo-faq-sidebar__nav {
  list-style: none;
  margin: 0;
  padding: 0;
}

.ffo-faq-sidebar__cat {
  margin-bottom: 0.25rem;
}

.ffo-faq-sidebar__cat-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.625rem 0.75rem;
  font-family: "Figtree", sans-serif;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ffo-dark, #181f33);
  text-decoration: none;
  border-radius: 6px;
  border-left: 3px solid transparent;
  transition: background 0.15s, border-color 0.15s;
}

.ffo-faq-sidebar__cat-link:hover {
  background: #f5f7fa;
}

.ffo-faq-sidebar__cat.is-active > .ffo-faq-sidebar__cat-link {
  border-left-color: var(--ffo-primary, #6CAA80);
  background: #f0fdf4;
  color: var(--ffo-primary, #6CAA80);
}

.ffo-faq-sidebar__cat-link svg {
  width: 12px;
  height: 7px;
  flex-shrink: 0;
  transition: transform 0.2s;
}

.ffo-faq-sidebar__cat.is-open > .ffo-faq-sidebar__cat-link svg {
  transform: rotate(180deg);
}

.ffo-faq-sidebar__subcats {
  list-style: none;
  margin: 0;
  padding: 0 0 0 1rem;
  display: none;
}

.ffo-faq-sidebar__cat.is-open > .ffo-faq-sidebar__subcats {
  display: block;
}

.ffo-faq-sidebar__subcat-link {
  display: block;
  padding: 0.375rem 0.75rem;
  font-size: 0.8125rem;
  color: #64748b;
  text-decoration: none;
  border-radius: 4px;
  transition: background 0.15s, color 0.15s;
}

.ffo-faq-sidebar__subcat-link:hover {
  background: #f5f7fa;
  color: var(--ffo-dark, #181f33);
}

/* ---------- Inline Search (category + article pages) ---------- */
.ffo-faq-search-bar {
  flex: 0 0 300px;
  max-width: 300px;
}

/* ---------- Anchor Scroll Offset ---------- */
.ffo-faq-articles__group[id] {
  scroll-margin-top: calc(var(--faq-header-h) + 2rem);
}

/* ---------- Category Page: Article Listings ---------- */
.ffo-faq-articles__header {
  margin-bottom: 2rem;
}

.ffo-faq-articles__header h1 {
  font-family: "Figtree", sans-serif;
  font-size: 1.75rem;
  font-weight: 700;
  margin: 0 0 0.5rem;
  color: var(--ffo-dark, #181f33);
}

.ffo-faq-articles__header p {
  font-size: 1rem;
  color: #64748b;
  margin: 0;
  line-height: 1.6;
}

.ffo-faq-articles__group {
  margin-bottom: 2rem;
}

.ffo-faq-articles__group-title {
  font-family: "Figtree", sans-serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--ffo-dark, #181f33);
  margin: 0 0 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #f0f0f0;
}

.ffo-faq-articles__list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.ffo-faq-articles__list li {
  border-bottom: 1px solid #f0f0f0;
}

.ffo-faq-articles__list a {
  display: block;
  padding: 0.75rem 0;
  font-size: 0.9375rem;
  color: var(--ffo-dark, #181f33);
  text-decoration: none;
  transition: color 0.15s;
}

.ffo-faq-articles__list a:hover {
  color: var(--ffo-primary, #6CAA80);
}

/* Ungrouped articles (no subcategory) */
.ffo-faq-articles__ungrouped {
  margin-bottom: 2rem;
}

/* ---------- Article Page ---------- */
.ffo-faq-article h1 {
  font-family: "Figtree", sans-serif;
  font-size: 1.75rem;
  font-weight: 700;
  margin: 0 0 1.5rem;
  color: var(--ffo-dark, #181f33);
  line-height: 1.3;
}

.ffo-faq-article h2 {
  font-family: "Figtree", sans-serif;
  font-size: 1.25rem;
  font-weight: 600;
  margin: 1.5rem 0 0.75rem;
  color: var(--ffo-dark, #181f33);
}

.ffo-faq-article h3 {
  font-family: "Figtree", sans-serif;
  font-size: 1.125rem;
  font-weight: 600;
  margin: 1.25rem 0 0.5rem;
  color: var(--ffo-dark, #181f33);
}

.ffo-faq-article p {
  font-size: 1rem;
  line-height: 1.7;
  margin: 0 0 1rem;
  color: #334155;
}

.ffo-faq-article ul,
.ffo-faq-article ol {
  margin: 0 0 1rem;
  padding-left: 1.5rem;
  color: #334155;
}

.ffo-faq-article li {
  margin-bottom: 0.375rem;
  line-height: 1.6;
}

.ffo-faq-article a {
  color: var(--ffo-primary, #6CAA80);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.ffo-faq-article a:hover {
  color: #5a9470;
}

.ffo-faq-article img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 1rem 0;
}

.ffo-faq-article table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.9375rem;
}

.ffo-faq-article th,
.ffo-faq-article td {
  padding: 0.625rem 0.75rem;
  border: 1px solid #e2e8f0;
  text-align: left;
}

.ffo-faq-article th {
  background: #f8fafc;
  font-weight: 600;
}

/* ---------- Callout Boxes ---------- */
.ffo-faq-callout {
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  margin: 1.5rem 0;
  font-size: 0.9375rem;
  line-height: 1.6;
}

.ffo-faq-callout--tip,
.hs-callout-type-tip {
  background: #f0fdf4;
  border-left: 4px solid var(--ffo-primary, #6CAA80);
}

.ffo-faq-callout--note,
.hs-callout-type-note {
  background: #eff6ff;
  border-left: 4px solid #3b82f6;
}

.ffo-faq-callout--warning,
.hs-callout-type-warning {
  background: #fffbeb;
  border-left: 4px solid #f59e0b;
}

.ffo-faq-callout p:last-child,
.hs-callout-type-tip p:last-child,
.hs-callout-type-note p:last-child,
.hs-callout-type-warning p:last-child {
  margin-bottom: 0;
}

/* ---------- Related Articles ---------- */
.ffo-faq-related {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 2px solid #f0f0f0;
}

.ffo-faq-related__title {
  font-family: "Figtree", sans-serif;
  font-size: 1.125rem;
  font-weight: 700;
  margin: 0 0 1rem;
  color: var(--ffo-dark, #181f33);
}

.ffo-faq-related__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.75rem;
}

.ffo-faq-related__item {
  display: block;
  padding: 0.875rem 1rem;
  background: #f8fafc;
  border-radius: 8px;
  text-decoration: none;
  color: var(--ffo-dark, #181f33);
  font-size: 0.9375rem;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}

.ffo-faq-related__item:hover {
  background: #f0fdf4;
  color: var(--ffo-primary, #6CAA80);
}

/* ---------- Mobile Sidebar Toggle ---------- */
.ffo-faq-sidebar-toggle {
  display: none;
  width: 100%;
  padding: 0.75rem 1rem;
  font-family: "Figtree", sans-serif;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--ffo-dark, #181f33);
  background: #f5f7fa;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  margin-bottom: 1rem;
}

.ffo-faq-sidebar-toggle svg {
  float: right;
  transition: transform 0.2s;
}

.ffo-faq-sidebar-toggle.is-open svg {
  transform: rotate(180deg);
}

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .ffo-faq-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    padding: 2rem 1rem 3rem;
  }

  .ffo-faq-layout {
    gap: 2rem;
    padding: 1.5rem 1rem 3rem;
  }

  .ffo-faq-sidebar {
    flex: 0 0 240px;
  }
}

@media (max-width: 1300px) {
  :root {
    --faq-header-h: 70px;
  }
}

@media (max-width: 768px) {
  .ffo-faq-hero {
    padding: calc(var(--faq-header-h) + 2rem) 1rem 2rem;
  }

  .ffo-faq-hero h1 {
    font-size: 1.75rem;
  }

  .ffo-faq-grid {
    grid-template-columns: 1fr;
    padding: 1.5rem 1rem 2rem;
  }

  .ffo-faq-layout {
    flex-direction: column;
    gap: 0;
    padding: 1rem;
  }

  .ffo-faq-sidebar {
    position: static;
    flex: none;
    max-height: none;
    overflow: visible;
    display: none;
  }

  .ffo-faq-sidebar.is-mobile-open {
    display: block;
    margin-bottom: 1.5rem;
  }

  .ffo-faq-sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .ffo-faq-breadcrumbs {
    padding: calc(var(--faq-header-h) + 1rem) 1rem 0;
  }

  .ffo-faq-breadcrumbs {
    flex-direction: column;
    align-items: stretch;
  }

  .ffo-faq-search-bar {
    flex: none;
    max-width: 100%;
  }

  .ffo-faq-articles__header h1 {
    font-size: 1.375rem;
  }

  .ffo-faq-article h1 {
    font-size: 1.375rem;
  }

  .ffo-faq-article h2 {
    font-size: 1.125rem;
  }

  .ffo-faq-related__list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .ffo-faq-hero h1 {
    font-size: 1.5rem;
  }

  .ffo-faq-search__input {
    font-size: 0.875rem;
    padding: 0.75rem 1rem 0.75rem 2.5rem;
  }
}
