/* ボックスモデルをリセットし、ボーダーを設定 */
/* ============================================ */

*,
::before,
::after {
  box-sizing: border-box; /* パディングとボーダーを要素の合計幅と高さに含める */
  border-style: solid;   /* ボーダーのスタイルを実線に設定 */
  border-width: 0;       /* ボーダーの幅を0に設定 */
  min-width: 0;          /* 最小幅を0に設定 */
}

/* ドキュメント */
/* ============================================ */

/**
 * 1. 全てのブラウザでline-heightを調整
 * 2. iOSでの方向変更後のフォントサイズ調整を抑制
 * 3. iOSでのリンクのグレーのハイライト表示を削除
 */

html {
  line-height: 1.15; /* 1 */
  -webkit-text-size-adjust: 100%; /* 2 */
  text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent; /* 3 */
  overflow-wrap: anywhere; /* 収まらない場合に折り返す */
  word-break: normal; /* 単語の分割はデフォルトに依存 */
  line-break: strict; /* 禁則処理を厳格に適用 */
}

/* セクション */
/* ============================================ */

/**
 * 全てのブラウザでmarginを削除
 */

body {
  margin: 0;
}

/**
 * IEでのmain要素の表示を一貫させる
 */

main {
  display: block;
}

/* 垂直方向の余白 */
/* ============================================ */

p,
table,
blockquote,
address,
pre,
iframe,
form,
figure,
dl {
  margin: 0;
}

/* 見出し */
/* ============================================ */

h1,
h2,
h3,
h4,
h5,
h6 {
  font-size: inherit;   /* フォントサイズを親から継承 */
  font-weight: inherit; /* フォントウェイトを親から継承 */
  margin: 0;            /* マージンを削除 */
}

[tabindex='-1']:focus-visible {
  outline: none !important; /* tabindex="-1"でフォーカス可能になった要素のアウトラインを削除 */
}

/* リスト（列挙） */
/* ============================================ */

ul,
ol {
  margin: 0;       /* マージンを削除 */
  padding: 0;      /* パディングを削除 */
  list-style: none; /* リストのスタイルを削除 */
}

/* リスト（定義） */
/* ============================================ */

dd {
  margin-left: 0; /* 左マージンを削除 */
}

/* グループ化されたコンテンツ */
/* ============================================ */

/**
 * 1. Firefoxで正しいボックスサイジングを追加
 * 2. EdgeとIEでoverflowを表示
 */

hr {
  box-sizing: content-box; /* 1 */
  height: 0; /* 1 */
  overflow: visible; /* 2 */
  border-top-width: 1px; /* 上ボーダーの幅を設定 */
  margin: 0;             /* マージンを削除 */
  clear: both;           /* 両側のフロートをクリア */
  color: inherit;        /* 色を親から継承 */
}

/**
 * 1. 全てのブラウザでフォントサイズの継承とスケーリングを調整
 * 2. 全てのブラウザで"em"フォントサイジングを調整
 */

pre {
  font-family: monospace, monospace; /* 1 */
  font-size: inherit; /* 2 */
}

address {
  font-style: inherit; /* フォントスタイルを親から継承 */
}

/* テキストレベルの意味付け要素 */
/* ============================================ */

/**
 * IE 10以上でアクティブなリンクのグレーの背景を削除
 */

a {
  background-color: transparent; /* 背景色を透明に設定 */
  text-decoration: none;         /* テキスト装飾を削除 */
  color: inherit;                /* 色を親から継承 */
}

/**
 * 1. Chrome 57-で下ボーダーを削除
 * 2. Chrome, Edge, IE, Opera, Safariで正しいテキスト装飾を追加
 */

abbr[title] {
  text-decoration: underline dotted; /* 2: 点線のアンダーラインを追加 */
}

/**
 * Chrome, Edge, Safariで正しいフォントウェイトを追加
 */

b,
strong {
  font-weight: 700; /* フォントウェイトを太字に設定 */
}

u {
  text-underline-offset: 0.2em;
}

em {
  font-style: italic;
}

/**
 * 1. 全てのブラウザでフォントサイズの継承とスケーリングを調整
 * 2. 全てのブラウザで"em"フォントサイジングを調整
 */

code,
kbd,
samp {
  font-family: monospace, monospace; /* 1 */
  font-size: inherit; /* 2 */
}

/**
 * "small"のフォントサイズを追加
 * 取り消し線のために"del"を追加
 */
small {
  font-size: inherit;
}

del {
  text-decoration: line-through;
}

/**
 * "sub"と"sup"を垂直方向に揃える
 */
sub {
  vertical-align: bottom;
  font-size: 72%;
}

sup {
  vertical-align: top;
  font-size: 72%;
}


/* 置換コンテンツ */
/* ============================================ */

/**
 * 垂直方向の配置問題を防止
 */

svg,
img,
embed,
object,
iframe {
  vertical-align: middle; /* 垂直方向中央揃え */
}

/* フォーム */
/* ============================================ */

/**
 * フォームフィールドをスタイル可能にするためにリセット
 * 1. 特にiOSで、システム全体でフォーム要素をスタイル可能にする
 * 2. 親からtext-transformを継承する
 */

button,
input,
optgroup,
select,
textarea {
  vertical-align: middle;  /* 垂直方向中央揃え */
  color: inherit;          /* 色を親から継承 */
  font: inherit;           /* フォントを親から継承 */
  background: none;        /* 背景を削除 */
  border: none;            /* ボーダーを削除 */
  padding: 0;              /* パディングを削除 */
  margin: 0;               /* マージンを削除 */
  border-radius: 0;        /* ボーダーの角丸を削除 */
  text-align: inherit;     /* テキストの配置を親から継承 */
  text-transform: inherit; /* 2 */
  white-space: normal;     /* ホワイトスペースを標準に設定 */
}

button{
  outline: none;     /* アウトラインを削除 */
  appearance: none;  /* ネイティブの外観を削除 */
}

/**
 * クリック可能な要素のカーソルを調整
 */

button,
[type="button"],
[type="reset"],
[type="submit"] {
  cursor: pointer; /* カーソルをポインターに設定 */
}

button:disabled,
[type="button"]:disabled,
[type="reset"]:disabled,
[type="submit"]:disabled {
  cursor: default; /* 無効な要素のカーソルをデフォルトに設定 */
}

/**
 * Firefoxのアウトラインを改善し、入力要素やボタンのスタイルと統一
 */

:-moz-focusring {
  outline: auto; /* Firefoxのフォーカスリングを自動に設定 */
}

select:disabled {
  opacity: inherit; /* 無効なselect要素の透明度を継承 */
}

/**
 * パディングを削除
 */

option {
  padding: 0;
}

/**
 * fieldsetを非表示にリセット
 */

fieldset {
  margin: 0;     /* マージンを削除 */
  padding: 0;    /* パディングを削除 */
  min-width: 0;  /* 最小幅を0に設定 */
}

legend {
  padding: 0; /* パディングを削除 */
}

/**
 * Chrome, Firefox, Operaで正しい垂直方向の配置を追加
 */

progress {
  vertical-align: baseline; /* 垂直方向をベースラインに設定 */
}

/**
 * IE 10以上でデフォルトの垂直スクロールバーを削除
 */

textarea {
  overflow: auto; /* テキストエリアのオーバーフローを自動に設定 */
}

/**
 * Chromeでインクリメント/デクリメントボタンのカーソルスタイルを調整
 */

[type="number"]::-webkit-inner-spin-button,
[type="number"]::-webkit-outer-spin-button {
  height: auto; /* 高さ自動 */
}

/**
 * Safariでアウトラインスタイルを調整
 */

[type="search"] {
  outline-offset: -2px; /* 1: アウトラインオフセットを調整 */
}

/**
 * macOSのChromeとSafariで内部パディングを削除
 */

[type="submit"] {
  -webkit-appearance: none; /* ネイティブの外観を削除 */
  border-radius: 0;         /* ボーダーの角丸を削除 */
}

[type="search"]::-webkit-search-decoration {
  -webkit-appearance: none; /* 検索フィールドの装飾を削除 */
}

/**
 * 1. iOSとSafariでクリック可能な型のスタイル設定不能を修正
 * 2. フォントの継承を修正
 */

::-webkit-file-upload-button {
  -webkit-appearance: button; /* 1 */
  font: inherit; /* 2 */
}

/**
 * Firefoxの外観を修正
 */
[type="number"] {
  -moz-appearance: textfield; /* Firefoxでナンバー入力フィールドの外観をテキストフィールドに設定 */
}

/**
 * クリック可能なラベル
 */

label[for] {
  cursor: pointer; /* for属性を持つラベルのカーソルをポインターに設定 */
}

/* インタラクティブ要素 */
/* ============================================ */

/*
 * Edge, IE 10+, Firefoxで正しいdisplayを追加
 */

details {
  display: block; /* details要素をブロックレベル要素として表示 */
}

/*
 * 全てのブラウザで正しいdisplayを追加
 */

summary {
  display: list-item; /* summary要素をリストアイテムとして表示 */
}

/*
 * 編集可能なコンテンツのアウトラインを削除
 */

[contenteditable]:focus {
  outline: auto; /* contenteditable要素のフォーカス時にアウトラインを自動表示 */
}

/* テーブル */
/* ============================================ */

/**
 * 1. ChromeとSafariでテーブルのボーダー色の継承を修正
 */

table {
  width: 100%;
  border-color: inherit; /* 1 */
  border-collapse: collapse; /* ボーダーを結合 */
}

caption {
  text-align: left; /* キャプションを左揃え */
}

td,
th {
  vertical-align: top; /* 垂直方向を上揃え */
  padding: 0;          /* パディングを削除 */
}

th {
  text-align: left;    /* テキストを左揃え */
  font-weight: 700;    /* フォントウェイトを太字に設定 */
}

/* Firefox: ネストされた順序付きリストが親から番号付けを続ける問題を解決 */
ol {
  counter-reset: revert; /* カウンターをリセットして、リストの番号付けをデフォルトの動作に戻す */
}

/* 画像がコンテナを超えないように */
img {
  max-inline-size: 100%; /* インライン方向（幅）の最大サイズを100%に設定 */
  max-block-size: 100%;  /* ブロック方向（高さ）の最大サイズを100%に設定 */
}

/* Safari: <body>に`user-select:none`が設定されている場合にテキスト入力が機能しない問題を解決 */
input, textarea {
  -webkit-user-select: auto; /* Safariでユーザー選択を自動に設定 */
}

/* Safariのtextarea要素の'white-space'プロパティを元に戻す */
textarea {
  white-space: revert; /* white-spaceプロパティをデフォルトの動作に戻す */
}

/* meter要素をスタイル可能にするための最小限のスタイル */
meter {
  -webkit-appearance: revert; /* Webkitブラウザでのネイティブの外観を元に戻す */
  appearance: revert;         /* ネイティブの外観を元に戻す */
}

/* inputplaceholderのデフォルトのテキスト不透明度をリセット */
::placeholder {
  color: unset; /* 色を未設定状態（継承またはデフォルト）にする */
}

/* 'hidden'属性の機能を修正。
  display:revert; は属性値ではなく要素のデフォルト表示に戻します。
  :where()は特異度を下げるためにここで使用されていますが、[hidden]のデフォルトはdisplay: none;です。 */
:where([hidden]) {
    display: none; /* hidden属性を持つ要素を非表示にする */
}

/* Chromiumブラウザのバグに対するリセット
  - contenteditable属性が正しく機能するように修正。
  - webkit-user-select: auto; は、ラッパー要素でuser-select:noneを使用している場合にSafari用に追加 */
:where([contenteditable]:not([contenteditable="false"])) {
  -moz-user-modify: read-write;      /* Firefoxでコンテンツ編集を許可 */
  -webkit-user-modify: read-write;   /* Webkitブラウザでコンテンツ編集を許可 */
  overflow-wrap: break-word;         /* 長い単語を任意の場所で折り返す */
  -webkit-line-break: after-white-space; /* Safariでホワイトスペース後の改行を許可 */
  -webkit-user-select: auto;         /* Webkitブラウザでユーザー選択を自動に設定 */
}

/* ドラッグ機能を再度適用 - ChromiumとSafariにのみ存在する */
:where([draggable="true"]) {
  -webkit-user-drag: element; /* Webkitブラウザで要素のドラッグを許可 */
}

/* Modalのネイティブな挙動をリセット */
:where(dialog:modal) {
  all: revert;         /* 全てのプロパティを元に戻す */
  box-sizing: border-box; /* ボックスサイジングをボーダーボックスに設定 */
}

/* Safariのdetails summaryの三角形アイコンを削除 */
::-webkit-details-marker {
  display: none;
}