.faq {
  padding: 80px 0;
}

.faq__header {
  text-align: center;
  margin-bottom: 64px;
}

.faq__title {
  margin-bottom: 24px;
}

.faq__title h2 {
  font-size: 2.5rem;
  line-height: 1.3;
  letter-spacing: -0.01em;
  font-weight: 700;
  color: var(--heading);
}

.faq__description {
  font-size: 1.25rem;
  line-height: 1.5;
  color: var(--foreground);
  max-width: 838px;
  margin: 0 auto;
}

.faq__accordion {
  max-width: 844px;
  margin: 0 auto;
}

.faq__item {
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 16px;
  overflow: hidden;
  transition: all 0.3s ease;
  box-shadow: 0px 10px 50px 3px #275c8d1a;
}

.faq__item:last-child {
  margin-bottom: 0;
}

.faq__item:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.faq__button {
  width: 100%;
  background: none;
  border: none;
  padding: 24px;
  border-radius: 24px;
  background: var(--background);
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  transition: all 0.3s ease;
  position: relative;
}

.faq__button-content {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
}

.faq__icon {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  background-color: #f4f8fb;
  color: var(--foreground);
  flex-shrink: 0;
  display: grid;
  place-items: center;
  box-shadow: 0px 6px 18px 4px #1e52831a;
}

.faq__question {
  font-size: 1rem;
  line-height: 1.5;
  font-weight: 700;
  color: var(--heading);
  flex: 1;
}

.faq__chevron {
  width: 20px;
  height: 20px;
  color: var(--foreground);
  flex-shrink: 0;
  transition: transform 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.faq__chevron svg {
  width: 100%;
  height: 100%;
}

.faq__button[aria-expanded="true"] .faq__chevron {
  transform: rotate(180deg);
}

.faq__panel {
  max-height: 0;
  overflow: hidden;
  background-color: var(--background);
  transition: max-height 0.3s ease;
}

/* CSS-only fallback when JavaScript is disabled */
.faq__panel[aria-hidden="false"] {
  max-height: 1000px;
}

.faq__answer {
  padding: 0 24px 24px 64px;
  color: var(--foreground);
  font-size: 1rem;
  line-height: 1.6;
}

.faq__answer p {
  margin-bottom: 16px;
}

.faq__answer p:last-child {
  margin-bottom: 0;
}

.faq__answer h1,
.faq__answer h2,
.faq__answer h3,
.faq__answer h4,
.faq__answer h5,
.faq__answer h6 {
  color: var(--heading);
  margin-bottom: 12px;
  margin-top: 24px;
}

.faq__answer h1:first-child,
.faq__answer h2:first-child,
.faq__answer h3:first-child,
.faq__answer h4:first-child,
.faq__answer h5:first-child,
.faq__answer h6:first-child {
  margin-top: 0;
}

.faq__answer ul,
.faq__answer ol {
  margin-bottom: 16px;
  padding-left: 24px;
}

.faq__answer li {
  margin-bottom: 8px;
}

.faq__answer a {
  color: var(--secondary);
  text-decoration: underline;
}

.faq__answer a:hover {
  color: var(--primary);
}

.faq__answer strong {
  font-weight: 700;
  color: var(--heading);
}

.faq__answer em {
  font-style: italic;
}

.faq__answer code {
  background-color: rgba(255, 79, 88, 0.1);
  color: var(--primary);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: monospace;
  font-size: 0.875rem;
}

.faq__answer pre {
  background-color: rgba(74, 85, 101, 0.05);
  padding: 16px;
  border-radius: 8px;
  overflow-x: auto;
  margin-bottom: 16px;
}

.faq__answer pre code {
  background: none;
  padding: 0;
  color: var(--foreground);
}

/* Responsive Design */
@media (max-width: 768px) {
  .faq {
    padding: 60px 0;
  }

  .faq__header {
    margin-bottom: 48px;
  }

  .faq__title h2 {
    font-size: 2rem;
  }

  .faq__description {
    font-size: 1.125rem;
  }

  .faq__button {
    padding: 20px;
  }

  .faq__button-content {
    gap: 12px;
  }

  .faq__question {
    font-size: 1rem;
  }

  .faq__answer {
    padding: 0 20px 20px 56px;
  }
}

@media (max-width: 480px) {
  .faq {
    padding: 40px 0;
  }

  .faq__header {
    margin-bottom: 32px;
  }

  .faq__title h2 {
    font-size: 1.75rem;
  }

  .faq__description {
    font-size: 1rem;
  }

  .faq__button {
    padding: 16px;
  }

  .faq__button-content {
    gap: 8px;
  }

  .faq__question {
    font-size: 0.875rem;
  }

  .faq__answer {
    padding: 0 16px 16px 20px;
    font-size: 0.875rem;
  }
}

/* Animation for smooth accordion opening/closing */
.faq__panel {
  will-change: max-height;
}

.faq__chevron {
  will-change: transform;
}

/* Focus management for keyboard navigation */
.faq__button:focus {
  z-index: 1;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .faq__item {
    border-width: 2px;
  }

  .faq__button:focus-visible {
    outline-width: 3px;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .faq__button,
  .faq__chevron,
  .faq__panel,
  .faq__item {
    transition: none;
  }

  .faq__chevron {
    transform: none !important;
  }
}
