/* ─── FAQ ─── */
.faq-list {
  display: flex;
  flex-direction: column;
  gap: 0;

  margin: 0 auto;
}

.faq-item {
  border-bottom: 1px solid var(--border);
  overflow: visible;
  background: var(--surface);
  transition: background-color var(--transition);
}

.faq-item:first-child {
  border-top: 1px solid var(--border);
}

/* Subtle background on hover for better affordance */
.faq-item:hover {
  background: var(--surface-2);
}

.faq-q {
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  color: var(--text);
  font-family: "DM Sans", sans-serif;
  font-size: 1rem; /* Slightly larger for better readability */
  font-weight: 600; /* Increased weight for better hierarchy */
  padding: 1.25rem 0.5rem; /* More horizontal padding for better touch area */
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem; /* More gap between text and icon */
  transition: all var(--transition);
  min-height: 48px; /* Slightly larger touch target */
  border-radius: 4px;
  position: relative;
}

/* Focus state - WCAG compliant focus ring */
.faq-q:focus,
.faq-q:focus-visible,
.faq-item:focus-within {
  outline: none !important;
  box-shadow: none !important;
}

.faq-q:hover {
  color: var(--accent);
  background: linear-gradient(
    to right,
    transparent,
    var(--focus-accent) 50%,
    transparent
  );
}

/* Question text - ensure proper contrast */
.faq-q span:first-child {
  flex: 1;
  line-height: 1.5;
  letter-spacing: -0.01em; /* Slight tightening for premium feel */
}

.faq-icon {
  width: 32px; /* Slightly larger */
  height: 32px;
  border: 2px solid var(--border-strong);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  color: var(--muted);
  flex-shrink: 0;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1); /* Smoother easing */
  background: var(--surface);
  aria-hidden: true;
}

/* Enhanced open state for icon */
.faq-item.open .faq-icon,
.faq-q[aria-expanded="true"] .faq-icon {
  background: var(--accent-50);
  border-color: var(--accent);
  color: var(--accent);
  transform: rotate(45deg);
  box-shadow: var(--shadow-accent);
}

.faq-a {
  max-height: 0;
  overflow: hidden;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 0.95rem; /* Slightly larger for readability */
  color: var(--muted);
  line-height: 1.7; /* Optimal line height for reading */
  padding: 0 0.5rem; /* Horizontal padding for text */
  will-change: max-height, padding; /* Performance optimization */
}

.faq-item.open .faq-a {
  max-height: 500px; /* Increased for longer answers */
  padding: 1rem 0.5rem 1.5rem 0.5rem; /* Bottom padding when open */
}

/* Answer content styling */
.faq-a > *:first-child {
  margin-top: 0.5rem; /* Small top margin for breathing room */
}

.faq-a p {
  margin: 0 0 1rem 0;
}

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

.faq-a code {
  font-family: "DM Mono", monospace;
  background: var(--surface2);
  padding: 0.2em 0.5em; /* Slightly larger padding */
  border-radius: 6px; /* Slightly more rounded */
  color: var(--accent-700);
  font-size: 0.9em; /* Slightly larger for readability */
  border: 1px solid var(--border-accent-subtle);
  white-space: nowrap;
  transition: all var(--transition);
}

/* Code block styling for multi-line code */
.faq-a pre {
  background: var(--surface2);
  padding: 1rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  overflow-x: auto;
  margin: 1rem 0;
}

.faq-a pre code {
  background: none;
  padding: 0;
  border: none;
  white-space: pre;
  color: var(--text);
  font-size: 0.9rem;
}

/* Lists in answers */
.faq-a ul,
.faq-a ol {
  margin: 0.5rem 0 1rem 0;
  padding-left: 1.5rem;
}

.faq-a li {
  margin: 0.25rem 0;
  color: var(--muted);
}

.faq-a li::marker {
  color: var(--accent);
}

/* Links in answers */
.faq-a a {
  color: var(--link);
  text-decoration: underline;
  text-decoration-color: var(--border-accent-subtle);
  text-underline-offset: 2px;
  transition: all var(--transition);
}

.faq-a a:hover {
  color: var(--link-hover);
  text-decoration-color: var(--accent);
}

/* Strong emphasis */
.faq-a strong {
  color: var(--text);
  font-weight: 600;
}

/* Responsive adjustments */
@media (max-width: 640px) {
  .faq-q {
    font-size: 0.95rem;
    padding: 1rem 0.25rem;
    gap: 1rem;
  }

  .faq-icon {
    width: 28px;
    height: 28px;
    font-size: 0.9rem;
  }

  .faq-a {
    font-size: 0.9rem;
  }
}

/* Print styles */
@media print {
  .faq-item {
    break-inside: avoid;
    border: 1px solid var(--border);
    margin-bottom: 1rem;
    padding: 1rem;
  }

  .faq-icon {
    display: none;
  }

  .faq-a {
    max-height: none;
    padding: 1rem 0 0 0;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .faq-q:hover {
    background: var(--surface2);
  }

  .faq-icon {
    border-width: 3px;
  }

  .faq-a {
    color: var(--text);
  }
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  .faq-q,
  .faq-icon,
  .faq-a {
    transition: none;
  }
}
