/*=====================================================
  accessibility.css  — WCAG 2.1 AA 対応
  このファイルは削除・改変しないこと
  対応基準: WCAG 2.1 AA / JIS X 8341-3:2016
=====================================================*/
@import "settings.css";

/* ─────────────────────────────────────────
   1. スキップリンク (SC 2.4.1)
   ───────────────────────────────────────── */
.skip-link {
  position: absolute;
  top: -100%;
  left: 0;
  z-index: 9999;
  padding: 12px 24px;
  background: var(--color-main);
  color: #ffffff;
  font-size: 1.6rem;
  font-weight: var(--fw-bold);
  text-decoration: underline;
  border-radius: 0 0 var(--radius-sm) 0;
  transition: top .2s;
  white-space: nowrap;
}

.skip-link:focus {
  top: 0;
  outline: var(--focus-outline);
  outline-offset: var(--focus-offset);
}

/* ─────────────────────────────────────────
   2. 視覚的非表示（SR読み上げ用）(SC 1.3.1 / 4.1.2)
   ───────────────────────────────────────── */
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* ─────────────────────────────────────────
   3. フォーカスリング (SC 2.4.7)
   すべてのインタラクティブ要素に適用
   ───────────────────────────────────────── */
:focus {
  outline: none;
}

/* デフォルト除去 */
:focus-visible {
  outline: var(--focus-outline);
  outline-offset: var(--focus-offset);
  border-radius: var(--radius-sm);
}

/* ハイコントラスト環境での補完 */
@media (forced-colors: active) {
  :focus-visible {
    outline: 3px solid ButtonText;
  }
}

/* ─────────────────────────────────────────
   4. ターゲットサイズ (SC 2.5.5 / AA推奨44×44px以上)
   ───────────────────────────────────────── */
button,
input[type="submit"],
input[type="button"],
input[type="reset"],
.btn,
.nav-link,
.modal-close-btn,
.hamb-btn {
  min-height: 44px;
  min-width: 44px;
}

/* ─────────────────────────────────────────
   5. ハンバーガー aria-expanded 連動 (SC 4.1.2)
   ───────────────────────────────────────── */
.hamb-btn .hamb-bar {
  transition: transform var(--transition), opacity var(--transition);
}

.hamb-btn[aria-expanded="true"] .hamb-bar:nth-child(1) {
  transform: translateY(9px) rotate(45deg);
}

.hamb-btn[aria-expanded="true"] .hamb-bar:nth-child(2) {
  opacity: 0;
}

.hamb-btn[aria-expanded="true"] .hamb-bar:nth-child(3) {
  transform: translateY(-9px) rotate(-45deg);
}

/* ─────────────────────────────────────────
   6. モーダル (SC 4.1.2 / 2.1.1)
   role="dialog" + aria-modal="true" と併用
   ───────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(0, 0, 0, .6);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.is-open {
  display: flex;
}

body.modal-open {
  overflow: hidden;
}

.modal-dialog {
  position: relative;
  background: #ffffff;
  border-radius: var(--radius-lg);
  max-width: 800px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 40px;
  box-shadow: var(--shadow-md);
}

@media (max-width: 768px) {
  .modal-dialog {
    padding: 24px 20px;
  }
}

.modal-close-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 2px solid var(--color-border);
  border-radius: 50%;
  font-size: 2.0rem;
  color: var(--color-text);
  transition: background var(--transition);
}

.modal-close-btn:hover {
  background: var(--color-bg);
}

/* ─────────────────────────────────────────
   7. アコーディオン aria-expanded 連動 (SC 4.1.2)
   ───────────────────────────────────────── */
.acd-body {
  display: none;
}

[data-acd] .acd-body.is-open {
  display: block;
}

.acd-icon {
  transition: transform var(--transition);
  display: inline-block;
}

.acd-trigger[aria-expanded="true"] .acd-icon {
  transform: rotate(180deg);
}

/* FAQ アコーディオン */
.faq-a {
  display: none;
}

.faq-a.is-open {
  display: block;
}

.faq-icon {
  transition: transform var(--transition);
  display: inline-block;
}

.faq-q[aria-expanded="true"] .faq-icon {
  transform: rotate(180deg);
}

/* ─────────────────────────────────────────
   8. フォーム (SC 1.3.1 / 3.3.1 / 3.3.2)
   ───────────────────────────────────────── */
label {
  cursor: pointer;
  display: block;
  margin-bottom: 6px;
}

/* ラベルとinputはfor/idで明示的に紐付けること */

.form-error {
  color: #c0392b;
  font-size: 1.4rem;
  margin-top: 4px;
  display: flex;
  align-items: flex-start;
  gap: 4px;
}

.form-error::before {
  content: "⚠";
  flex-shrink: 0;
}

/* ─────────────────────────────────────────
   9. テーブル (SC 1.3.1)
   caption / scope 属性を必ず記述すること
   ───────────────────────────────────────── */
caption {
  font-weight: var(--fw-bold);
  text-align: left;
  margin-bottom: 8px;
  font-size: 1.4rem;
  color: #555;
}

/* ─────────────────────────────────────────
   10. 動きを抑制 (SC 2.3.3 AAA / ユーザー配慮)
   ───────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ─────────────────────────────────────────
   11. スライダー自動再生 停止ボタン (SC 2.2.2)
   ───────────────────────────────────────── */
.slider-pause-btn {
  position: absolute;
  bottom: 16px;
  right: 16px;
  z-index: 10;
  width: 44px;
  height: 44px;
  background: rgba(0, 0, 0, .5);
  border: 2px solid rgba(255, 255, 255, .8);
  border-radius: 50%;
  color: #ffffff;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition);
}

.slider-pause-btn:hover {
  background: rgba(0, 0, 0, .8);
}

.slider-pause-btn[aria-pressed="true"] .icon-pause {
  display: none;
}

.slider-pause-btn[aria-pressed="false"] .icon-play {
  display: none;
}

/* ─────────────────────────────────────────
   12. 外部リンク視覚的表示 (SC 2.4.4)
   ───────────────────────────────────────── */
/* a[target="_blank"]::after {
  content: " ↗";
  font-size: .75em;
}
※ 用途に応じてコメントを外して使用 */

/* ─────────────────────────────────────────
   13. 印刷スタイル
   ───────────────────────────────────────── */
@media print {

  .skip-link,
  .hamb-btn,
  nav,
  .modal-overlay,
  .slider-pause-btn {
    display: none !important;
  }

  a[href]::after {
    content: " (" attr(href) ")";
  }
}