/**
 * FAQセクション専用スタイル
 * RBS陸上教室 - よくあるご質問
 */

@layer pages {

/* ================================================================
   FAQ セクション基本設定
   ================================================================ */

#faq {
  background: var(--white);
  padding: var(--section-padding) 0;
  scroll-margin-top: var(--scroll-offset);
}

#faq h2 {
  position: relative;
  --heading-h2-size: clamp(1.9rem, 4.6vw, 3rem);
  --heading-h2-margin: clamp(3.25rem, 6vw, 4.75rem);
  --heading-h2-padding: clamp(1rem, 3vw, 1.75rem);
  --heading-h2-letter-spacing: -0.01em;
}

#faq h2::after {
  content: '';
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: 120px;
  height: 8px;
  background: var(--primary-blue);
  border-radius: var(--radius-xs);
}

.faq-list {
  max-width: 1000px;
  margin: 0 auto;
}

/* ================================================================
   FAQ アイテム
   ================================================================ */

.faq-item {
  background: var(--white);
  margin-bottom: 20px;
  border-radius: 15px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
  border: 2px solid transparent;
}

.faq-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
  border-color: var(--primary-blue);
}

.faq-item[open] {
  border-color: var(--primary-blue);
  box-shadow: 0 8px 30px rgba(74, 144, 226, 0.15);
}

/* ================================================================
   FAQ 質問部分 - 最適化されたレイアウト
   ================================================================ */

.faq-question {
  padding: 25px 25px 25px 70px;
  cursor: pointer;
  font-weight: 700;
  font-size: 18px;
  display: flex;
  justify-content: space-between;
  align-items: center; /* 中央揃えに変更 */
  transition: all 0.3s ease;
  color: var(--navy-dark);
  position: relative;
  background: var(--white);
  min-height: 60px; /* 十分な高さを確保 */
  line-height: 1.5;
  /* 統一された日本語改行設定 */
  word-break: auto-phrase;
  overflow-wrap: break-word;
  text-align: left;
  list-style: none;
}

.faq-question::-webkit-details-marker {
  display: none;
}

.faq-question::marker {
  display: none;
}

.faq-question:focus-visible {
  outline: 3px solid var(--primary-blue);
  outline-offset: 4px;
}

.faq-question-text {
  flex: 1;
}

.faq-question::before {
  content: 'Q';
  position: absolute;
  left: 25px;
  top: 50%;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  background: var(--primary-blue);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 800;
  flex-shrink: 0;
}

.faq-question:hover {
  background: rgba(74, 144, 226, 0.05);
}

.faq-item[open] .faq-question {
  background: var(--primary-blue);
  color: white;
}

.faq-item[open] .faq-question::before {
  background: white;
  color: var(--primary-blue);
}

/* ================================================================
   FAQ アイコン（展開/折りたたみ）- 簡潔化
   ================================================================ */

.faq-icon {
  font-size: 24px;
  color: var(--primary-blue);
  transition: all 0.3s ease;
  font-weight: 900;
  min-width: 24px;
  margin-left: 15px;
  flex-shrink: 0;
}

.faq-item[open] .faq-icon {
  transform: rotate(45deg);
  color: white;
}

/* ================================================================
   FAQ 回答部分
   ================================================================ */

.faq-answer {
  background: var(--white);
  padding: 0 25px 30px 70px;
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.faq-item:not([open]) .faq-answer {
  display: none;
}

.faq-item[open] .faq-answer {
  display: block;
  opacity: 1;
  transform: translateY(0);
  animation: fadeInUp 0.3s ease forwards;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.faq-answer p {
  line-height: 1.8;
  color: var(--navy-dark);
  font-size: 16px;
  font-weight: 500;
  margin: 20px 0 0 0;
  /* 自然な日本語改行設定 */
  word-break: auto-phrase;
  overflow-wrap: break-word;
  text-align: left;
  letter-spacing: 0.02em;
}

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

/* ================================================================
   レスポンシブ対応 - 統一されたブレークポイント
   ================================================================ */

/* タブレット (768px以下) */
@media (max-width: 768px) {
  #faq {
    padding: 60px 0;
  }
  
  #faq h2::after {
    bottom: 8px;
    width: 100px;
    height: 6px;
  }
  
  .faq-question {
    padding: 20px 20px 20px 55px;
    font-size: 16px;
    line-height: 1.4;
    min-height: 50px;
  }
  
  .faq-question::before {
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    font-size: 13px;
  }
  
  .faq-icon {
    font-size: 20px;
    margin-left: 10px;
  }
  
  .faq-answer {
    padding: 0 20px 25px 55px;
  }
  
  .faq-answer p {
    font-size: 15px;
    line-height: 1.7;
    margin-top: 15px;
    /* 自然な日本語改行設定 */
    word-break: auto-phrase;
    overflow-wrap: break-word;
    text-align: left;
  }
}

/* モバイル (480px以下) */
@media (max-width: 480px) {
  #faq {
    padding: 40px 0;
  }
  
  #faq h2::after {
    bottom: 6px;
    width: 80px;
    height: 5px;
  }
  
  .faq-question {
    padding: 18px 15px 18px 48px;
    font-size: 15px;
    line-height: 1.3;
    min-height: 45px;
  }
  
  .faq-question::before {
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    width: 26px;
    height: 26px;
    font-size: 12px;
  }
  
  .faq-icon {
    font-size: 18px;
    margin-left: 8px;
  }
  
  .faq-answer {
    padding: 0 15px 20px 48px;
  }
  
  .faq-answer p {
    font-size: 14px;
    line-height: 1.6;
    margin-top: 12px;
    /* 自然な日本語改行設定 */
    word-break: auto-phrase;
    overflow-wrap: break-word;
    text-align: left;
  }
  
  .faq-item {
    margin-bottom: 15px;
  }
}

/* 小さなモバイル (375px以下) */
@media (max-width: 375px) {
  .faq-question {
    padding: 16px 12px 16px 42px;
    font-size: 14px;
    line-height: 1.2;
    min-height: 40px;
  }
  
  .faq-question::before {
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    font-size: 11px;
  }
  
  .faq-answer {
    padding: 0 12px 18px 42px;
  }
  
  .faq-answer p {
    font-size: 13px;
    margin-top: 10px;
    line-height: 1.5;
    text-align: left;
    /* 自然な日本語改行設定 */
    word-break: auto-phrase;
    overflow-wrap: break-word;
  }
}

/* ================================================================
   アクセシビリティ対応 - 2025 Standards
   ================================================================ */

.faq-question:focus {
  outline: 2px solid var(--primary-blue);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(74, 144, 226, 0.2);
}

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

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
  .faq-item {
    border-width: 3px;
    border-color: currentColor;
  }
  
  .faq-question::before {
    border: 2px solid currentColor;
  }
  
  .faq-icon {
    font-weight: 900;
  }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
  .faq-answer {
    transition: none;
    animation: none;
  }
}

}
