/* アクセシビリティ向上のためのスタイル */

/* スクリーンリーダー専用のテキスト（視覚的には非表示） */
.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;
}

/* フォーカス時のスタイル改善 */
:focus {
  outline: 3px solid #0066CC;
  outline-offset: 2px;
}

/* ダークモードでのフォーカススタイル */
[data-theme="dark"] :focus {
  outline-color: #66B2FF;
}

/* ボタンとリンクのフォーカス */
button:focus,
a:focus,
select:focus,
input:focus,
textarea:focus {
  outline: 3px solid #0066CC;
  outline-offset: 2px;
  box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.25);
}

/* スキップリンクのスタイルはmain.cssで定義済み */

/* ハイコントラストモード対応 */
@media (prefers-contrast: high) {
  :root {
    --bg-primary: #fff;
    --text-primary: #000;
    --border-primary: #000;
  }
  
  button,
  .btn {
    border: 2px solid currentColor;
  }
}

/* 動きを減らす設定 */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* フォームフィールドのエラー状態 */
[aria-invalid="true"] {
  border-color: #dc3545 !important;
  box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}

/* エラーメッセージのスタイル */
.error-message[role="alert"] {
  color: #dc3545;
  font-weight: bold;
  margin-top: 0.25rem;
}

/* タブナビゲーション改善 */
[tabindex]:not([tabindex="-1"]):focus {
  outline: 3px solid #0066CC;
  outline-offset: 2px;
}

/* モバイルでのタップターゲットサイズ確保 */
@media (max-width: 768px) {
  button,
  a,
  select,
  input[type="submit"],
  input[type="button"] {
    min-height: 44px;
    min-width: 44px;
  }
}

/* aria-live領域のスタイル */
[aria-live="polite"],
[aria-live="assertive"] {
  position: relative;
}

/* 読み上げ順序の視覚的ヒント */
.reading-order-hint {
  position: relative;
}

.reading-order-hint::before {
  content: attr(data-reading-order);
  position: absolute;
  top: -20px;
  left: 0;
  font-size: 10px;
  color: #666;
  display: none;
}

/* デバッグモードでのみ表示 */
body.show-reading-order .reading-order-hint::before {
  display: block;
}

/* ランドマークの視覚的強調（デバッグ用） */
body.show-landmarks [role="banner"],
body.show-landmarks [role="main"],
body.show-landmarks [role="navigation"],
body.show-landmarks [role="complementary"],
body.show-landmarks [role="contentinfo"] {
  border: 2px dashed #0066CC;
  position: relative;
}

body.show-landmarks [role="banner"]::before,
body.show-landmarks [role="main"]::before,
body.show-landmarks [role="navigation"]::before,
body.show-landmarks [role="complementary"]::before,
body.show-landmarks [role="contentinfo"]::before {
  content: attr(role);
  position: absolute;
  top: 0;
  left: 0;
  background: #0066CC;
  color: white;
  padding: 2px 8px;
  font-size: 12px;
  z-index: 1;
}

/* フォーカストラップ用のスタイル */
.focus-trap {
  position: relative;
}

/* モーダルやダイアログのバックドロップ */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
}

/* カラーコントラスト改善 */
.high-contrast {
  filter: contrast(1.2);
}

/* テキストの読みやすさ向上 */
body {
  line-height: 1.6;
  letter-spacing: 0.02em;
}

/* リンクの下線を常に表示（アクセシビリティ向上） */
a:not(.btn):not(.share-btn):not(.feature-card):not(.logo):not(nav a):not(.skip-link) {
  text-decoration: underline;
  text-decoration-skip-ink: auto;
}

/* フォーカス可能要素の最小サイズ確保 */
[tabindex],
button,
a,
select,
input,
textarea {
  min-height: 24px;
  min-width: 24px;
}