/* === css/components/faq.css === */
/* ==========================================================================
   FAQ Section - Часті питання
   Стиль як у прайс-секції: світлі картки, темний текст
   ========================================================================== */

.faq-section {
  padding: var(--section-padding-desktop);
  margin-bottom: var(--section-spacing-desktop);
  width: 100%;
  max-width: min(var(--content-width-desktop), var(--content-max-width));
  margin-left: auto;
  margin-right: auto;
}

/* Сітка 3 колонки з вирівнюванням */
.faq-section .faq-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--spacing-lg);
  margin-top: var(--spacing-lg);
  align-items: stretch; /* Стовпчики займають однакову висоту */
}

/* Стовпчики */
.faq-section .faq-column {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* Акордеони - Grid для однакової висоти елементів */
.faq-section .faq-accordion {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--spacing-sm);
  height: 100%; /* Займає всю висоту стовпчика */
  align-content: start; /* Вирівнювання по верхньому краю */
}

/* Однакова висота всіх елементів у стовпчику */
.faq-section .faq-item {
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.5);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 60px; /* Мінімальна висота для консистентності */
}

/* Заголовок акордеону - зарезервовано місце під 2 рядки */
.faq-section .faq-item__header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--spacing-xs);
  padding: var(--spacing-sm) var(--spacing-md);
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  font-size: var(--font-size-base);
  font-weight: 700;
  color: rgba(255, 255, 255, 0.95);
  transition: background-color 0.2s ease;
  flex-shrink: 0;
  height: calc(var(--font-size-base) * 1.4 * 2 + var(--spacing-sm) * 2); /* 2 рядки + padding */
  min-height: calc(var(--font-size-base) * 1.4 * 2 + var(--spacing-sm) * 2);
}

@media (hover: hover) and (pointer: fine) {
  .faq-section .faq-item__header:hover {
    background: rgba(255, 255, 255, 0.08);
  }
}

.faq-section .faq-item__header:focus-visible {
  outline: 2px solid rgba(100, 149, 237, 0.5);
  outline-offset: -2px;
}

.faq-section .faq-item__question {
  flex: 1 0 0;
  line-height: 1.4;
  min-width: 0;
  word-wrap: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 2; /* Обмеження до 2 рядків */
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Іконка */
.faq-section .faq-item__icon {
  font-size: var(--font-size-lg);
  font-weight: 700;
  color: var(--color-primary);
  flex-shrink: 0;
  transition: transform 0.2s ease;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
}

.faq-section .faq-item.accordion-item--open .faq-item__icon {
  transform: rotate(45deg);
}

/* Контент */
.faq-section .faq-item__content {
  padding: 0 var(--spacing-md);
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease;
  flex-shrink: 0;
}

.faq-section .faq-item.accordion-item--open .faq-item__content {
  padding: 0 var(--spacing-md) var(--spacing-md);
}

.faq-section .faq-item__content p {
  font-size: var(--font-size-sm);
  color: rgba(255, 255, 255, 0.8);
  line-height: 1.5;
  margin: 0;
  word-wrap: break-word;
}

/* Мобільна версія */
@media (width <= 1024px) {
  .faq-section .faq-grid {
    grid-template-columns: 1fr;
    gap: var(--spacing-md);
  }

  .faq-section .faq-column {
    height: auto;
  }

  .faq-section .faq-accordion {
    height: auto;
  }
}

@media (width <= 767px) {
  .faq-section {
    box-sizing: border-box;
    width: 100%;
    max-width: 100vw;
    max-width: calc(100vw - 2rem);
    padding: 1rem;
    margin-bottom: var(--section-spacing-mobile);
    overflow-x: hidden;
  }

  .faq-section .faq-accordion {
    gap: var(--spacing-xs);
  }

  .faq-section .faq-item__header {
    padding: var(--spacing-xs) var(--spacing-sm);
    font-size: var(--font-size-sm);
    height: calc(var(--font-size-sm) * 1.4 * 2 + var(--spacing-xs) * 2); /* 2 рядки + padding для mobile */
    min-height: calc(var(--font-size-sm) * 1.4 * 2 + var(--spacing-xs) * 2);
  }

  .faq-section .faq-item__question {
    font-size: var(--font-size-sm);
  }

  .faq-section .faq-item__icon {
    font-size: var(--font-size-base);
    width: 20px;
    height: 20px;
  }

  .faq-section .faq-item.accordion-item--open .faq-item__content {
    padding: 0 var(--spacing-sm) var(--spacing-sm);
  }

  .faq-section .faq-item__content p {
    font-size: var(--font-size-xs);
  }
}

/* ==========================================================================
   FAQ Page - Окрема сторінка FAQ
   ========================================================================== */

/* Фон (паралакс) */
.faq-background {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh; /* Fallback */
  height: 100dvh; /* iOS Dynamic Viewport */
  z-index: var(--z-background, -1);
  overflow: hidden;
  pointer-events: none; /* Важливо: не блокує кліки */
  contain: layout style paint; /* Ізоляція для продуктивності */

  /* Hardware acceleration - використовуємо наявний паттерн з header.css */
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;

  /* Явно вимикаємо blur якщо він застосовується через глобальні стилі */
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  filter: none;

  /* will-change тільки коли активний - додається через JS */
}

/* Активний стан (додається через JS) */
.faq-background--active {
  will-change: transform;
}

.faq-background__image {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: cover;
  object-position: center center;
  display: block;

  /* Запобігає мерехтінню на iOS - використовуємо наявний паттерн */
  -webkit-transform: translateZ(0);
  transform: translateZ(0);

  /* Явно вимикаємо blur */
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  filter: none;
}

/* Контент над фоном */
.faq-content[data-parallax-layer="content"] {
  position: relative;
  z-index: var(--z-content, 1);
  contain: layout style;
}

/* iOS Safari специфічні фікси */
@supports (-webkit-touch-callout: none) {
  .faq-background {
    height: 100dvh;

    /* Fallback для iOS < 15 */
    height: calc(var(--parallax-vh, 1vh) * 100);
  }

  /* iOS: зменшений blur, непрозоріший фон для кращого контрасту */
  .faq-section .faq-item,
  .faq-content .faq-item {
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    background: rgba(10, 10, 10, 0.65);
  }
}

/* Fallback для браузерів без підтримки backdrop-filter */
@supports not (backdrop-filter: blur(1px)) {
  .faq-section .faq-item,
  .faq-content .faq-item {
    background: rgba(15, 15, 15, 0.85);
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .faq-background {
    position: absolute;
  }
}

.faq-page {
  width: 100%;
  max-width: 95vw;
  max-width: 95dvw;
  margin: 0 auto;
}

@media (width >= 1024px) {
  .faq-page {
    max-width: min(var(--content-width-desktop), var(--content-max-width));
    padding: var(--section-padding-desktop);
  }
}

.faq-hero {
  text-align: center;
  margin-bottom: var(--spacing-xl);
}

.faq-hero__subtitle {
  font-size: var(--font-size-lg);
  color: var(--color-text-muted);
  margin-top: var(--spacing-sm);
}

.faq-content.glass-section {
  margin-bottom: var(--spacing-xl);
}

.faq-content .faq-accordion {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--spacing-md);
  max-width: 800px;
  margin: 0 auto;
}

.faq-content .faq-item {
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-md);
  background: rgba(0, 0, 0, 0.5);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  overflow: hidden;
  transition: box-shadow var(--transition-fast);
}

@media (hover: hover) {
  .faq-content .faq-item:hover {
    box-shadow: var(--glass-shadow);
  }
}

.faq-content .faq-item__header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--spacing-md);
  padding: var(--spacing-md) var(--spacing-lg);
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  font-size: var(--font-size-lg);
  font-weight: 700;
  color: rgba(255, 255, 255, 0.95);
  transition: background-color var(--transition-fast);
}

@media (hover: hover) and (pointer: fine) {
  .faq-content .faq-item__header:hover {
    background: rgba(255, 255, 255, 0.08);
  }
}

.faq-content .faq-item__header:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: -2px;
}

.faq-content .faq-item__question {
  flex: 1 0 0;
  line-height: 1.5;
}

.faq-content .faq-item__icon {
  font-size: var(--font-size-xl);
  font-weight: 700;
  color: var(--color-primary);
  flex-shrink: 0;
  transition: transform var(--transition-fast);
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
}

.faq-content .faq-item.accordion-item--open .faq-item__icon {
  transform: rotate(45deg);
}

.faq-content .faq-item__content {
  padding: 0 var(--spacing-lg);
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease;
}

.faq-content .faq-item.accordion-item--open .faq-item__content {
  padding: 0 var(--spacing-lg) var(--spacing-lg);
}

.faq-content .faq-item__answer {
  font-size: var(--font-size-base);
  color: rgba(255, 255, 255, 0.8);
  line-height: 1.6;
}

.faq-content .faq-item__answer p {
  margin: 0 0 var(--spacing-sm) 0;
}

.faq-content .faq-item__answer p:last-child {
  margin-bottom: 0;
}

.faq-empty {
  text-align: center;
  color: var(--color-text-muted);
  font-size: var(--font-size-lg);
  padding: var(--spacing-xl);
}

/* Мобільна версія для FAQ сторінки */
@media (width <= 767px) {
  .faq-hero {
    margin-bottom: var(--spacing-lg);
  }

  .faq-hero__subtitle {
    font-size: var(--font-size-base);
  }

  .faq-content .faq-accordion {
    gap: var(--spacing-sm);
  }

  .faq-content .faq-item__header {
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: var(--font-size-base);
  }

  .faq-content .faq-item__icon {
    font-size: var(--font-size-lg);
    width: 24px;
    height: 24px;
  }

  .faq-content .faq-item.accordion-item--open .faq-item__content {
    padding: 0 var(--spacing-md) var(--spacing-md);
  }

.faq-content .faq-item__answer {
  font-size: var(--font-size-sm);
  color: var(--ink-light);
}
}

.faq-page {
  max-width: 1080px;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 4rem;
  box-sizing: border-box;
}

.faq-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 0.85fr);
  gap: 1.5rem;
  align-items: center;
  justify-items: center;
  text-align: center;
  width: 100%;
  max-width: 100%;
  margin-bottom: 2.5rem;
  position: relative;
}

.faq-hero__copy,
.faq-hero__photo {
  min-width: 0;
  max-width: 100%;
}

.faq-hero__copy {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.faq-hero__title {
  font-family: var(--font-family-heading);
  font-size: clamp(2.2rem, 4.2vw, 4rem);
  font-weight: 650;
  line-height: 1.02;
  letter-spacing: -0.03em;
  color: var(--ink);
  margin: 0 0 1.5rem;
  text-align: center;
  max-width: 100%;
}

.faq-hero__cta {
  position: relative;
  z-index: 2;
}

.faq-hero__photo {
  position: relative;
  margin: 0;
  min-height: 280px;
}

.faq-hero__shot {
  display: block;
  width: 100%;
  height: auto;
  position: relative;
  z-index: 1;
}

.faq-hero__doodle {
  position: absolute;
  pointer-events: none;
  z-index: 2;
}

.faq-hero__doodle--bubble {
  width: 88px;
  left: 0;
  top: 18px;
}

.faq-hero__doodle--pencil {
  width: 72px;
  right: -8px;
  top: -18px;
}

.faq-hero__doodle--ben {
  width: min(220px, 58%);
  right: 4%;
  bottom: -28px;
  z-index: 3;
}

.faq-topics {
  position: relative;
  text-align: center;
  margin: 3.5rem 0 2rem;
}

.faq-topics__label {
  margin: 0 0 0.85rem;
  font-weight: 600;
  color: var(--ink);
}

.faq-topics__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.55rem;
}

.faq-topics__list a {
  display: inline-block;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.45rem 0.9rem;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  box-shadow: 0 6px 16px rgba(26, 26, 26, 0.05);
}

.faq-topics__list a:hover,
.faq-facts__item:hover,
.faq-path:hover {
  border-color: var(--amber);
}

.faq-topics__arrow {
  position: absolute;
  left: -40px;
  bottom: -30px;
  width: 160px;
  pointer-events: none;
}

.faq-topics__pencil {
  position: absolute;
  right: -10px;
  top: -20px;
  width: 70px;
  pointer-events: none;
}

.faq-content {
  position: relative;
}

.faq-doodle {
  display: none;
  pointer-events: none;
}

@media (min-width: 900px) {
  .faq-content .faq-accordion {
    margin-left: 8.5rem;
    margin-right: 9rem;
  }

  .faq-doodle {
    display: block;
    position: absolute;
    z-index: 1;
  }

  .faq-doodle--globe {
    width: 150px;
    left: -8px;
    top: 8rem;
  }

  .faq-doodle--flag {
    width: 150px;
    right: -6px;
    top: 17rem;
  }
}

.faq-facts {
  list-style: none;
  margin: 0 0 1.25rem;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
}

.faq-facts__item {
  text-decoration: none;
  color: inherit;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 0.9rem 1.05rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.faq-facts__icon {
  color: var(--amber);
  display: inline-flex;
}

.faq-facts__value {
  font-family: var(--font-family-heading);
  font-size: 1.85rem;
  line-height: 1;
  color: var(--ink);
}

.faq-facts__label {
  color: var(--graphite-soft);
  font-size: 0.86rem;
  line-height: 1.35;
}

.faq-path {
  text-decoration: none;
  color: inherit;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin: 0 0 1.75rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
}

.faq-path__title {
  margin: 0;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
}

.faq-path__track {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0;
  margin: 0;
  padding: 0;
  flex: 1;
}

.faq-path__track li {
  position: relative;
  flex: 1;
  text-align: center;
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--ink);
}

.faq-path__track li::before {
  content: "";
  display: block;
  width: 12px;
  height: 12px;
  margin: 0 auto 0.35rem;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--amber);
  position: relative;
  z-index: 1;
}

.faq-path__track li::after {
  content: "";
  position: absolute;
  top: 5px;
  left: 50%;
  width: 100%;
  height: 2px;
  background: var(--border);
}

.faq-path__track li.is-last::after {
  display: none;
}

.faq-path__track li.is-last::before {
  background: var(--amber);
}

.faq-help {
  margin-top: 2rem;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 1.25rem;
  align-items: center;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
}

.faq-help__photo {
  display: block;
  width: 100%;
  height: 220px;
  object-fit: cover;
  object-position: center 20%;
}

.faq-help__copy {
  padding: 1.25rem 1.5rem 1.25rem 0;
}

.faq-help__copy h2 {
  margin: 0 0 0.4rem;
  font-family: var(--font-family-heading);
  font-size: 1.7rem;
  color: var(--ink);
}

.faq-help__copy p {
  margin: 0 0 1rem;
  color: var(--graphite-soft);
  max-width: 36rem;
}

@media (max-width: 680px) {
  .faq-hero,
  .faq-help {
    grid-template-columns: 1fr;
  }

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

  .faq-hero__doodle--ben {
    width: 170px;
    bottom: -28px;
  }

  .faq-topics__arrow,
  .faq-topics__pencil {
    display: none;
  }

  .faq-help__photo {
    height: 220px;
  }

  .faq-help__copy {
    padding: 0 1rem 1.15rem;
  }

  .faq-path {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }
}

.faq-hero {
  text-align: center;
  margin-bottom: 2.5rem;
}

.faq-hero .section-title {
  font-family: var(--font-family-heading);
  color: var(--ink);
}

.faq-hero__subtitle {
  max-width: 42rem;
  color: var(--graphite-soft);
}

.faq-hero.glass-section,
.faq-content.glass-section {
  background: transparent;
  border: none;
  box-shadow: none;
}

.faq-content .faq-accordion {
  max-width: none;
}

.faq-content .faq-item {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.faq-content .faq-item__header,
.faq-content .faq-item__question {
  color: var(--ink);
  font-weight: 600;
}

.faq-content .faq-item__answer,
.faq-content .faq-item__answer p {
  color: var(--ink-light);
}
