/* =============================================================
 * editor-style.css
 * ---------------------------------------------------------------
 * お知らせ投稿(news)の編集画面と single-news フロントの両方で同じ
 * 見た目になるように、本文ブロックに最小限のスタイルを適用する。
 *
 * スコープ:
 *   - 管理画面ブロックエディタ: .editor-styles-wrapper
 *   - フロント本文ラッパ:         .p-page-news-detail__body
 *
 * 設計方針:
 *   - :where() で specificity:0 を維持し、既存 BEM クラスを邪魔しない
 *   - reset.scss / base.scss で消した list-style / margin を復元
 *   - 標準ブロックの見た目はできるだけ温存
 *   - style.css の design token を CSS 変数で局所的に再定義
 * ============================================================= */

:where(.p-page-news-detail__body, .editor-styles-wrapper) {
  --c-primary: #213d79;
  --c-accent: #99c7e8;
  --c-text: #34373c;
  --c-border: #c0cbcf;
  --c-bg-soft-gray: #f9f8f8;
}

/* 管理画面ブロックエディタはテーマ body の font-family を継承しないため、
   ここでフロント($font-jp)と同じフォントスタックを明示する。
   フロント側は base.scss の body 指定で既に適用済みなので対象外。 */
:where(.editor-styles-wrapper),
:where(.editor-styles-wrapper) p,
:where(.editor-styles-wrapper) li,
:where(.editor-styles-wrapper) th,
:where(.editor-styles-wrapper) td,
:where(.editor-styles-wrapper) h1,
:where(.editor-styles-wrapper) h2,
:where(.editor-styles-wrapper) h3,
:where(.editor-styles-wrapper) h4,
:where(.editor-styles-wrapper) h5,
:where(.editor-styles-wrapper) h6 {
  font-family: "M PLUS Rounded 1c", "Hiragino Maru Gothic ProN", "Hiragino Sans", system-ui, sans-serif;
}

/* === Headings ============================================== */
/* h2: p-home-info__heading 参考 (青色 + accent ドット)。
   h1(投稿タイトル, .p-page-news-detail__title)は PC 24px なので
   h2 はそれより小さい 20px。 */

:where(.p-page-news-detail__body, .editor-styles-wrapper) h2 {
  display: flex;
  column-gap: 12px;
  align-items: center;
  margin: 2em 0 0.75em;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.6;
  color: var(--c-primary);
}

:where(.p-page-news-detail__body, .editor-styles-wrapper) h2::before {
  flex-shrink: 0;
  width: 12px;
  height: 12px;
  content: "";
  background-color: var(--c-accent);
  border-radius: 50%;
}

:where(.p-page-news-detail__body, .editor-styles-wrapper) h3 {
  margin: 1.75em 0 0.5em;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.6;
  color: var(--c-text);
}

:where(.p-page-news-detail__body, .editor-styles-wrapper) h4 {
  margin: 1.5em 0 0.5em;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.6;
  color: var(--c-primary);
}

:where(.p-page-news-detail__body, .editor-styles-wrapper) h5 {
  margin: 1.5em 0 0.5em;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.6;
  color: var(--c-text);
}

:where(.p-page-news-detail__body, .editor-styles-wrapper) h6 {
  margin: 1.25em 0 0.5em;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.6;
  color: var(--c-text);
}

/* === Paragraph ============================================== */
/* フロントは _page-news-detail.scss が `> p` を本文サイズで描画する。
   ここではエディタ側の段落マージンを揃えるためだけに最小限指定。 */

:where(.editor-styles-wrapper) p {
  margin: 0 0 1em;
  line-height: 1.8;
  color: var(--c-text);
}

/* === Links ================================================== */
/* base.scss が a { text-decoration: none } としているため、本文内では下線を復活 */

:where(.p-page-news-detail__body, .editor-styles-wrapper) a {
  color: var(--c-primary);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

:where(.p-page-news-detail__body, .editor-styles-wrapper) a:hover {
  text-decoration: none;
}

/* === Lists ================================================== */
/* base.scss で ul/ol の list-style / padding / margin が全部消されているので
   本文用に標準スタイルを再現する。 */

:where(.p-page-news-detail__body, .editor-styles-wrapper) ul,
:where(.p-page-news-detail__body, .editor-styles-wrapper) ol {
  padding-left: 1.75em;
  margin: 1em 0;
}

:where(.p-page-news-detail__body, .editor-styles-wrapper) ul {
  list-style: disc;
}

:where(.p-page-news-detail__body, .editor-styles-wrapper) ol {
  list-style: decimal;
}

:where(.p-page-news-detail__body, .editor-styles-wrapper) li {
  margin: 0.25em 0;
  line-height: 1.8;
  color: var(--c-text);
}

:where(.p-page-news-detail__body, .editor-styles-wrapper) li > ul,
:where(.p-page-news-detail__body, .editor-styles-wrapper) li > ol {
  margin: 0.25em 0;
}

/* === Table (c-schedule 参考) ================================ */
/* th: 紺背景 + 白文字 / td: 薄グレー枠線。 */

/* table 系のみ :where() を外して通常スペシフィシティ(0,1,2)に上げる。
   ブロックエディタの `.wp-block-table th, .wp-block-table td { border: 1px solid }`
   (0,1,1) を確実に上書きするため。 */
.p-page-news-detail__body table,
.editor-styles-wrapper table {
  width: 100%;
  margin: 1em 0;
  border-collapse: collapse;
  border-spacing: 0;
}

.p-page-news-detail__body table th,
.editor-styles-wrapper table th {
  padding: 12px 16px;
  font-weight: 500;
  line-height: 1.4;
  color: #fff;
  text-align: center;
  background-color: var(--c-primary);
  border: 0;
  border-bottom: 1px solid var(--c-border);
}

.p-page-news-detail__body table td,
.editor-styles-wrapper table td {
  padding: 12px 16px;
  line-height: 1.6;
  color: var(--c-text);
  vertical-align: middle;
  border: 0;
  border-bottom: 1px solid var(--c-border);
}

/* === Images / figure ======================================== */

:where(.p-page-news-detail__body, .editor-styles-wrapper) img {
  max-width: 100%;
  height: auto;
}

:where(.p-page-news-detail__body, .editor-styles-wrapper) figure {
  margin: 1.5em 0;
}

:where(.p-page-news-detail__body, .editor-styles-wrapper) figcaption {
  margin-top: 0.5em;
  font-size: 13px;
  line-height: 1.6;
  color: var(--c-text);
  text-align: center;
}

/* === Blockquote ============================================= */

:where(.p-page-news-detail__body, .editor-styles-wrapper) blockquote {
  padding: 12px 16px;
  margin: 1em 0;
  background-color: var(--c-bg-soft-gray);
  border-left: 3px solid var(--c-accent);
}

:where(.p-page-news-detail__body, .editor-styles-wrapper) blockquote > * {
  margin: 0;
}

/* === Code =================================================== */

:where(.p-page-news-detail__body, .editor-styles-wrapper) code {
  padding: 2px 6px;
  font-family: monospace;
  font-size: 0.9em;
  background-color: var(--c-bg-soft-gray);
  border-radius: 3px;
}

:where(.p-page-news-detail__body, .editor-styles-wrapper) pre {
  padding: 12px 16px;
  margin: 1em 0;
  overflow-x: auto;
  font-family: monospace;
  background-color: var(--c-bg-soft-gray);
  border-radius: 4px;
}

:where(.p-page-news-detail__body, .editor-styles-wrapper) pre code {
  padding: 0;
  background: none;
}

/* === Horizontal rule ======================================== */

:where(.p-page-news-detail__body, .editor-styles-wrapper) hr {
  margin: 2em 0;
  border: 0;
  border-top: 1px solid var(--c-border);
}
