/**
 * フロント用：ブロックエディタ・WordPress デフォルト CSS の上書き
 * style.css の後に読み込むことで、ブロック出力の見た目をテーマに合わせます。
 */

/* ===== ブロックレイアウト・blockGap（グループ・カラム） ===== */
.is-layout-flex {
  display: flex;
  gap: var(--wp--style--block-gap, 1.5em);
}
.is-layout-flex.is-vertical { flex-direction: column; }
.is-layout-flex.is-horizontal { flex-direction: row; }
.is-layout-flex.is-nowrap { flex-wrap: nowrap; }

.is-layout-grid {
  display: grid;
  gap: var(--wp--style--block-gap, 1.5em);
}

.wp-block-group.is-layout-flex,
.wp-block-group.is-layout-grid,
.wp-block-group .wp-block-group__inner-container {
  gap: var(--wp--style--block-gap, 1.5em);
}
.wp-block-group.is-layout-flex .wp-block-group__inner-container,
.wp-block-group .wp-block-group__inner-container.is-layout-flex {
  display: flex;
}
.wp-block-group.is-layout-grid .wp-block-group__inner-container,
.wp-block-group .wp-block-group__inner-container.is-layout-grid {
  display: grid;
}

.wp-block-columns {
  display: flex;
  flex-wrap: wrap;
  gap: var(--wp--style--block-gap, 1.5em);
  margin-bottom: 0;
}
/* ブロック共通：余白（PC / Mobile）をCSS変数で切り替え */
*[style*="--yoshimin-padding-desktop"] {
  padding: var(--yoshimin-padding-desktop) !important;
}
*[style*="--yoshimin-margin-desktop"] {
  margin: var(--yoshimin-margin-desktop) !important;
}
@media (max-width: 768px) {
  *[style*="--yoshimin-padding-mobile"] {
    padding: var(--yoshimin-padding-mobile) !important;
  }
  *[style*="--yoshimin-margin-mobile"] {
    margin: var(--yoshimin-margin-mobile) !important;
  }
}
@media (min-width: 782px) {
  .wp-block-columns:not(.is-not-stacked-on-mobile) {
    flex-wrap: nowrap;
  }
}
/* カラム：幅（スマートフォン）を SP で反映 */
@media (max-width: 781px) {
  .wp-block-column[style*="--column-mobile-width"] {
    flex-basis: var(--column-mobile-width) !important;
    max-width: var(--column-mobile-width);
  }
}
.is-layout-flex.is-content-justification-center { justify-content: center; }
.is-layout-flex.is-content-justification-right { justify-content: flex-end; }
.is-layout-flex.is-content-justification-left { justify-content: flex-start; }
.is-layout-flex.is-content-justification-space-between { justify-content: space-between; }

/* ===== 画像・キャプション ===== */
:where(figure) {
  margin: 0;
}

/* ===== リンク（ボタンブロック以外） ===== */
a:where(:not(.wp-element-button)) {
  text-decoration: none;
  color: inherit;
}

/* ===== ブロックコンテンツの縦方向の間隔 ===== */
.entry-content > * + *,
.editor-styles-wrapper > * + *,
.wp-block-post-content > * + * {
  margin-top: 1em;
}

/* ===== theme.json フォントサイズプリセットの行間 ===== */
.has-12-font-size,
.has-16-font-size,
.has-20-font-size,
.has-22-font-size {
  line-height: 1.7;
}

.has-24-font-size,
.has-28-font-size,
.has-32-font-size,
.has-36-font-size {
  line-height: 1.4;
}

.rte .has-20-font-size,
.rte .has-22-font-size,
.rte .has-24-font-size {
  line-height: 2.1;
}

/* ===== 見出しの基本スタイル ===== */
h1.wp-block-heading,
h2.wp-block-heading,
h3.wp-block-heading,
h4.wp-block-heading,
h5.wp-block-heading,
h6.wp-block-heading {
  font-weight: 700;
  line-height: 1.2;
  margin: 1.2em 0 0.6em;
}

h1.wp-block-heading:first-child,
h2.wp-block-heading:first-child,
h3.wp-block-heading:first-child,
h4.wp-block-heading:first-child,
h5.wp-block-heading:first-child,
h6.wp-block-heading:first-child {
  margin-top: 0;
}

h1.wp-block-heading:not(.has-text-color):not([style*="color"]),
h2.wp-block-heading:not(.has-text-color):not([style*="color"]),
h3.wp-block-heading:not(.has-text-color):not([style*="color"]),
h4.wp-block-heading:not(.has-text-color):not([style*="color"]),
h5.wp-block-heading:not(.has-text-color):not([style*="color"]),
h6.wp-block-heading:not(.has-text-color):not([style*="color"]) {
  color: var(--color-contrast, #000);
}

/* フォントサイズプリセット指定が無い見出し向けのフォールバック */
h1.wp-block-heading:not([style*="font-size"]):not(.has-custom-font-size):not(.has-12-font-size):not(.has-14-font-size):not(.has-16-font-size):not(.has-20-font-size):not(.has-22-font-size):not(.has-24-font-size):not(.has-28-font-size):not(.has-32-font-size):not(.has-36-font-size) {
  font-size: var(--wp--preset--font-size--36, 2.6rem);
}
h2.wp-block-heading:not([style*="font-size"]):not(.has-custom-font-size):not(.has-12-font-size):not(.has-14-font-size):not(.has-16-font-size):not(.has-20-font-size):not(.has-22-font-size):not(.has-24-font-size):not(.has-28-font-size):not(.has-32-font-size):not(.has-36-font-size) {
  font-size: var(--wp--preset--font-size--32, 2.4rem);
}
h3.wp-block-heading:not([style*="font-size"]):not(.has-custom-font-size):not(.has-12-font-size):not(.has-14-font-size):not(.has-16-font-size):not(.has-20-font-size):not(.has-22-font-size):not(.has-24-font-size):not(.has-28-font-size):not(.has-32-font-size):not(.has-36-font-size) {
  font-size: var(--wp--preset--font-size--28, 2.0rem);
}
h4.wp-block-heading:not([style*="font-size"]):not(.has-custom-font-size):not(.has-12-font-size):not(.has-14-font-size):not(.has-16-font-size):not(.has-20-font-size):not(.has-22-font-size):not(.has-24-font-size):not(.has-28-font-size):not(.has-32-font-size):not(.has-36-font-size) {
  font-size: var(--wp--preset--font-size--24, 1.7rem);
}
h5.wp-block-heading:not([style*="font-size"]):not(.has-custom-font-size):not(.has-12-font-size):not(.has-14-font-size):not(.has-16-font-size):not(.has-20-font-size):not(.has-22-font-size):not(.has-24-font-size):not(.has-28-font-size):not(.has-32-font-size):not(.has-36-font-size) {
  font-size: var(--wp--preset--font-size--20, 1.4rem);
}
h6.wp-block-heading:not([style*="font-size"]):not(.has-custom-font-size):not(.has-12-font-size):not(.has-14-font-size):not(.has-16-font-size):not(.has-20-font-size):not(.has-22-font-size):not(.has-24-font-size):not(.has-28-font-size):not(.has-32-font-size):not(.has-36-font-size) {
  font-size: var(--wp--preset--font-size--16, 1.1rem);
}

/* ===== リスト・引用のデフォルト余白 ===== */
.wp-block-quote {
  margin: 1em 0;
  padding-left: 1em;
  border-left: 4px solid var(--color-contrast, #000);
}
.wp-block-list {
  padding-left: 1.5em;
}

a:where(:not(.wp-element-button)) {
  text-decoration: none;
}
