/* Reset CSS - ブラウザ間のデフォルトスタイル差異を吸収 */

/* 主要HTML要素のリセット */
html,
body,
div,
span,
applet,
object,
iframe,
h1,
h2,
h3,
h4,
h5,
h6,
p,
blockquote,
pre,
a,
abbr,
acronym,
address,
big,
cite,
code,
del,
dfn,
em,
img,
ins,
kbd,
q,
s,
samp,
small,
strike,
strong,
sub,
sup,
tt,
var,
b,
u,
i,
center,
dl,
dt,
dd,
ol,
ul,
li,
fieldset,
form,
label,
legend,
table,
caption,
tbody,
tfoot,
thead,
tr,
th,
td,
article,
aside,
canvas,
details,
embed,
figure,
figcaption,
footer,
header,
hgroup,
menu,
nav,
output,
ruby,
section,
summary,
time,
mark,
audio,
video {
  margin: 0;
  padding: 0;
  border: 0;
  font-size: 100%;
  font: inherit;
  vertical-align: baseline;
}

/* HTML5セマンティック要素をblock表示に設定 */
article,
aside,
details,
figcaption,
figure,
footer,
header,
hgroup,
menu,
nav,
section {
  display: block;
}

/* ボディの行の高さを1に設定 */
body {
  line-height: 1;
}

/* リストスタイルをなしに設定 */
ol,
ul {
  list-style: none;
}

/* 引用符の削除 */
blockquote,
q {
  quotes: none;
}

blockquote:before,
blockquote:after,
q:before,
q:after {
  content: "";
  content: none;
}

/* テーブルの境界線モデルを collapse に設定 */
table {
  border-collapse: collapse;
  border-spacing: 0;
}

/* すべての要素にボーダーボックスを適用 */
*,
*:before,
*:after {
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
  box-sizing: border-box;
}

/* リンクの下線を削除 */
a {
  text-decoration: none;
}

/* ボタンの初期化 */
button,
input,
select,
textarea {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
}

button {
  background: none;
  border: none;
  cursor: pointer;
}

/* 画像の最大幅を100%に設定 */
img {
  max-width: 100%;
  height: auto;
  vertical-align: middle;
}

/* フォーカス時のアウトラインを統一 */
a:focus,
button:focus,
input:focus,
textarea:focus,
select:focus {
  outline: 2px solid #007cba;
  outline-offset: 2px;
}

/* 無効化された要素のスタイル統一 */
button:disabled,
input:disabled,
textarea:disabled,
select:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* 選択テキストのスタイル */
::-moz-selection {
  background: #b3d4fc;
  text-shadow: none;
}

::selection {
  background: #b3d4fc;
  text-shadow: none;
}

/* HTML5入力要素の初期化 */
input[type="search"] {
  -webkit-appearance: textfield;
  box-sizing: content-box;
}

input[type="search"]::-webkit-search-decoration,
input[type="search"]::-webkit-search-cancel-button {
  -webkit-appearance: none;
}

/* スピンボタンの削除 */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[type="number"] {
  -moz-appearance: textfield;
}

/* プレースホルダーのスタイル統一 */
::-webkit-input-placeholder {
  color: #999;
  opacity: 1;
}

::-moz-placeholder {
  color: #999;
  opacity: 1;
}

:-ms-input-placeholder {
  color: #999;
  opacity: 1;
}

::placeholder {
  color: #999;
  opacity: 1;
}

/* スクロールバーのスタイル統一（Webkit） */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

/* 印刷時の最適化 */
@media print {
  *,
  *:before,
  *:after {
    background: transparent !important;
    color: #000 !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }

  a,
  a:visited {
    text-decoration: underline;
  }

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

  abbr[title]:after {
    content: " (" attr(title) ")";
  }

  a[href^="#"]:after,
  a[href^="javascript:"]:after {
    content: "";
  }

  pre,
  blockquote {
    border: 1px solid #999;
    page-break-inside: avoid;
  }

  thead {
    display: table-header-group;
  }

  tr,
  img {
    page-break-inside: avoid;
  }

  img {
    max-width: 100% !important;
  }

  p,
  h2,
  h3 {
    orphans: 3;
    widows: 3;
  }

  h2,
  h3 {
    page-break-after: avoid;
  }
}

/* アクセシビリティの向上 */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* 縮小モーションを好むユーザー向けの設定 */
@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;
  }
}

/* ダークモードの基本対応 */
@media (prefers-color-scheme: dark) {
  ::-webkit-scrollbar-track {
    background: #2a2a2a;
  }

  ::-webkit-scrollbar-thumb {
    background: #555;
  }

  ::-webkit-scrollbar-thumb:hover {
    background: #777;
  }

  ::selection {
    background: #404040;
    color: #fff;
  }
}

/* フォーカス表示の改善（キーボードナビゲーション用） */
.js-focus-visible :focus:not(.focus-visible) {
  outline: none;
}

/* ハイコントラストモード対応 */
@media (prefers-contrast: high) {
  a:focus,
  button:focus,
  input:focus,
  textarea:focus,
  select:focus {
    outline: 3px solid;
    outline-offset: 2px;
  }
}
