/*
 * 汎用見出しパターン 番号付き見出し
 */

/* 最上位のhタグに適用されるスタイル */
.number-heading-block {
  position: relative;
  padding-left: 35px;
  align-items: center;
  margin: 1em 0 !important;
  background: none !important;
  padding: 0 0 0 33px !important;
  border: none !important;
  box-shadow: none !important;
}

/* 番号の擬似要素 */
.number-heading-block::before {
  content: attr(data-number-prefix);
  /* data属性から番号を取得 */
  position: absolute;
  left: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  background: #ffb07c;
  border-radius: 50%;
  color: white;
  font-weight: bold;
  line-height: 1;
  margin: 3px;
}

/* 見出しレベル別のサイズ設定 */
.number-heading-block[data-heading='h2'] {
  font-size: 24px;
  font-weight: bold;
  line-height: 1.6;
}

.number-heading-block[data-heading='h2']::before {
  width: 22px;
  height: 22px;
  font-size: 12px;
}

.number-heading-block[data-heading='h3'] {
  font-size: 22px;
  font-weight: bold;
  line-height: 1.6;
}

.number-heading-block[data-heading='h3']::before {
  width: 20px;
  height: 20px;
  font-size: 11px;
}

.number-heading-block[data-heading='h4'] {
  font-size: 20px;
  font-weight: bold;
  line-height: 1.6;
}

.number-heading-block[data-heading='h4']::before {
  width: 18px;
  height: 18px;
  font-size: 10px;
}

/* エディター専用スタイル */
.wp-block-editor .number-heading-block.is-selected {
  border: 1px dashed #007cba;
  border-radius: 4px;
  padding: 0.5em;
}

.number-heading-block::after {
  display: none !important;
  content: none !important;
}

/* ツールバーアイコン */
.number-icon {
  display: inline-block;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background-color: #007cba;
  color: white;
  text-align: center;
  line-height: 20px;
  font-size: 12px;
  font-weight: bold;
}

.wp-block-editor .number-icon {
  background-color: #007cba;
  color: white;
}

.wp-block-editor .number-icon:hover {
  background-color: #005a87;
}

/* 番号の編集用入力フィールド */
.heading-number-input {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  height: 100%;
  background: transparent;
  border: 2px solid #007cba;
  border-radius: 50%;
  color: white;
  font-weight: bold;
  text-align: center;
  font-size: 12px;
  outline: none;
}

/* 番号をクリック可能にする */
.heading-number {
  cursor: pointer;
  transition: background-color 0.2s;
}

.heading-number:hover {
  background-color: rgba(255, 255, 255, 0.2);
}