/* ==========================================================================
   blocks.css - カスタムブロック（フロント / エディタ共通）
   ========================================================================== */

/* --------------------------------------------------------------------------
   記事見出し H2〜H6（標準「見出し」ブロック + セクション見出し）
   H2: ネイビー帯 + 左下三角
   H3: ブルー下線
   H4: 赤左線
   H5: 太字のみ
   H6: グレー太字
   -------------------------------------------------------------------------- */

.article-body :is(h2, h3, h4, h5, h6).wp-block-heading,
.editor-styles-wrapper :is(h2, h3, h4, h5, h6).wp-block-heading,
.article-body :is(h2, h3, h4, h5, h6).kyoutei-section-heading,
.editor-styles-wrapper :is(h2, h3, h4, h5, h6).kyoutei-section-heading {
  margin: 0;
  padding: 0;
  border: none;
  background: none;
  box-shadow: none;
  border-radius: 0;
  text-align: left;
  line-height: 1.5;
}

/* H2 — ネイビー帯 + 左下三角 */
.article-body :is(h2.wp-block-heading, h2.kyoutei-section-heading):not(.is-style-section-blue),
.editor-styles-wrapper :is(h2.wp-block-heading, h2.kyoutei-section-heading):not(.is-style-section-blue) {
  position: relative;
  margin: 2em 0 1.6em;
  padding: 12px 16px 14px;
  font-size: 20px;
  font-weight: 700;
  color: var(--c-white, #fff);
  background-color: var(--c-navy-800, #0d3564);
}

.article-body :is(h2.wp-block-heading, h2.kyoutei-section-heading):not(.is-style-section-blue)::after,
.editor-styles-wrapper :is(h2.wp-block-heading, h2.kyoutei-section-heading):not(.is-style-section-blue)::after {
  content: "";
  position: absolute;
  bottom: -8px;
  left: 20px;
  width: 0;
  height: 0;
  border-top: 8px solid var(--c-navy-800, #0d3564);
  border-right: 6px solid transparent;
  border-left: 6px solid transparent;
}

/* H3 — ブルー下線 */
.article-body :is(h3.wp-block-heading, h3.kyoutei-section-heading):not(.is-style-section-blue),
.editor-styles-wrapper :is(h3.wp-block-heading, h3.kyoutei-section-heading):not(.is-style-section-blue) {
  margin: 1.8em 0 1.2em;
  padding: 0 0 10px;
  font-size: 18px;
  font-weight: 700;
  color: var(--c-text, #1e2b3a);
  border-bottom: 2px solid var(--c-blue-600, #1560ac);
}

/* H4 — 赤左線 */
.article-body :is(h4.wp-block-heading, h4.kyoutei-section-heading):not(.is-style-section-blue),
.editor-styles-wrapper :is(h4.wp-block-heading, h4.kyoutei-section-heading):not(.is-style-section-blue) {
  margin: 1.6em 0 1em;
  padding: 2px 0 2px 14px;
  font-size: 16px;
  font-weight: 700;
  color: var(--c-text, #1e2b3a);
  border-left: 5px solid var(--c-red, #e0483c);
}

/* H5 — 太字のみ */
.article-body :is(h5.wp-block-heading, h5.kyoutei-section-heading):not(.is-style-section-blue),
.editor-styles-wrapper :is(h5.wp-block-heading, h5.kyoutei-section-heading):not(.is-style-section-blue) {
  margin: 1.4em 0 0.8em;
  font-size: 15px;
  font-weight: 700;
  color: var(--c-text, #1e2b3a);
}

/* H6 — グレー太字 */
.article-body :is(h6.wp-block-heading, h6.kyoutei-section-heading):not(.is-style-section-blue),
.editor-styles-wrapper :is(h6.wp-block-heading, h6.kyoutei-section-heading):not(.is-style-section-blue) {
  margin: 1.2em 0 0.6em;
  font-size: 14px;
  font-weight: 700;
  color: var(--c-text-sub, #5c6b7d);
}

.article-body :is(h2, h3, h4, h5, h6).wp-block-heading:not(.is-style-section-blue) + p,
.editor-styles-wrapper :is(h2, h3, h4, h5, h6).wp-block-heading:not(.is-style-section-blue) + p,
.article-body :is(h2, h3, h4, h5, h6).kyoutei-section-heading + p,
.editor-styles-wrapper :is(h2, h3, h4, h5, h6).kyoutei-section-heading + p {
  margin-top: 1em;
}

.article-body h2.wp-block-heading:not(.is-style-section-blue) + p,
.editor-styles-wrapper h2.wp-block-heading:not(.is-style-section-blue) + p,
.article-body h2.kyoutei-section-heading + p,
.editor-styles-wrapper h2.kyoutei-section-heading + p {
  margin-top: 1.4em;
}

/* --------------------------------------------------------------------------
   目次
   -------------------------------------------------------------------------- */

.kyoutei-toc {
  position: relative;
  margin: 28px 0;
  padding: 28px 24px 20px;
  background-color: #f3eef8;
  border: 1px solid #e6dbf0;
  border-radius: var(--radius, 8px);
}

.kyoutei-toc__label {
  position: absolute;
  top: 0;
  left: 16px;
  margin: 0;
  padding: 5px 14px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  color: var(--c-white, #fff);
  background: linear-gradient(135deg, #f06ba8 0%, #e84898 100%);
  border-radius: 0 0 6px 6px;
}

.kyoutei-toc__list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: toc;
}

.kyoutei-toc__list li {
  margin: 0;
  padding: 0;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.6;
}

.kyoutei-toc__list a {
  color: var(--c-text, #1e2b3a);
  text-decoration: underline;
  text-decoration-color: rgba(232, 72, 152, 0.35);
  text-underline-offset: 3px;
}

.kyoutei-toc__list li.is-level-3 {
  padding-left: 1.1em;
  font-size: 13px;
  font-weight: 400;
}

.kyoutei-toc__note {
  margin: 0 0 10px;
  font-size: 11px;
  line-height: 1.5;
  color: var(--c-text-mute, #8a97a6);
}

/* --------------------------------------------------------------------------
   マーカー（黄）— インライン + 段落スタイル
   -------------------------------------------------------------------------- */

.kyoutei-marker-yellow,
mark.kyoutei-marker-yellow,
.editor-styles-wrapper .kyoutei-marker-yellow {
  background: linear-gradient(transparent 58%, #fff176 58%);
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  color: inherit;
}

.is-style-marker-yellow {
  background: linear-gradient(transparent 58%, #fff176 58%);
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

.is-style-section-blue {
  position: relative;
  margin-top: 1.8em;
  margin-bottom: 1em;
  padding-left: 16px;
  font-size: 20px;
  font-weight: 900;
  line-height: 1.4;
}

.is-style-section-blue::before {
  content: "";
  position: absolute;
  top: 2px;
  bottom: 2px;
  left: 0;
  width: 5px;
  background-color: var(--c-blue-600, #1560ac);
  border-radius: 2px;
}

/* --------------------------------------------------------------------------
   会話・ポイントボックス（article.css と共通クラスをエディタでも使用）
   -------------------------------------------------------------------------- */

.editor-styles-wrapper .chat-section,
.article-body .chat-section {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin: 28px 0;
}

.editor-styles-wrapper .chat-row,
.article-body .chat-row {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: flex-start;
  gap: 12px;
  max-width: 92%;
}

.editor-styles-wrapper .chat-row-left,
.article-body .chat-row-left {
  align-self: flex-start;
  flex-direction: row;
}

.editor-styles-wrapper .chat-row-right,
.article-body .chat-row-right {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.editor-styles-wrapper .chat-avatar,
.article-body .chat-avatar {
  flex: 0 0 72px;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 72px;
  margin: 0;
  text-align: center;
}

.editor-styles-wrapper .chat-avatar img,
.article-body .chat-avatar img {
  width: 56px;
  height: 56px;
  margin-inline: auto;
  object-fit: cover;
  object-position: center top;
  border: 2px solid var(--c-line, #dde5ee);
  border-radius: 50%;
}

.editor-styles-wrapper .chat-name,
.article-body .chat-name {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--c-text-sub, #5c6b7d);
}

.editor-styles-wrapper .chat-name small,
.article-body .chat-name small {
  display: block;
  font-size: 10px;
  font-weight: 500;
  color: var(--c-text-mute, #8a97a6);
}

.editor-styles-wrapper .chat-bubble,
.article-body .chat-bubble {
  position: relative;
  flex: 1;
  min-width: 0;
  padding: 14px 18px;
  font-size: 14px;
  line-height: 1.75;
  border-radius: 12px;
  border: 1px solid var(--chat-bubble-border, #dde2e8);
  background-color: var(--chat-bubble-bg, #f0f2f5);
}

.editor-styles-wrapper .chat-bubble--hakase,
.article-body .chat-bubble--hakase {
  --chat-bubble-bg: #fdeef4;
  --chat-bubble-border: #f5c6dc;
}

.editor-styles-wrapper .chat-bubble--assistant,
.article-body .chat-bubble--assistant {
  --chat-bubble-bg: var(--c-blue-050, #f2f7fd);
  --chat-bubble-border: var(--c-blue-100, #e5eefa);
}

.editor-styles-wrapper .chat-bubble-left,
.article-body .chat-bubble-left {
  border-top-left-radius: 4px;
}

.editor-styles-wrapper .chat-bubble-left::before,
.article-body .chat-bubble-left::before {
  content: "";
  position: absolute;
  top: 18px;
  left: -8px;
  width: 0;
  height: 0;
  border-top: 7px solid transparent;
  border-bottom: 7px solid transparent;
  border-right: 8px solid var(--chat-bubble-border, #dde2e8);
}

.editor-styles-wrapper .chat-bubble-left::after,
.article-body .chat-bubble-left::after {
  content: "";
  position: absolute;
  top: 19px;
  left: -6px;
  width: 0;
  height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-right: 7px solid var(--chat-bubble-bg, #f0f2f5);
}

.editor-styles-wrapper .chat-bubble-right,
.article-body .chat-bubble-right {
  border-top-right-radius: 4px;
}

.editor-styles-wrapper .chat-bubble-right::before,
.article-body .chat-bubble-right::before {
  content: "";
  position: absolute;
  top: 18px;
  right: -8px;
  width: 0;
  height: 0;
  border-top: 7px solid transparent;
  border-bottom: 7px solid transparent;
  border-left: 8px solid var(--chat-bubble-border, #dde2e8);
}

.editor-styles-wrapper .chat-bubble-right::after,
.article-body .chat-bubble-right::after {
  content: "";
  position: absolute;
  top: 19px;
  right: -6px;
  width: 0;
  height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-left: 7px solid var(--chat-bubble-bg, #f0f2f5);
}

.editor-styles-wrapper .point-box,
.article-body .point-box {
  margin: 32px 0;
  overflow: hidden;
  background-color: #f2f7fc;
  border: 1px solid #b8d4ef;
  border-radius: var(--radius, 8px);
}

.editor-styles-wrapper .point-box-label,
.article-body .point-box-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 8px 18px;
  font-size: 14px;
  font-weight: 700;
  color: var(--c-white, #fff);
  background-color: var(--c-navy-800, #0d3564);
  border-radius: 0 0 var(--radius-sm, 4px) 0;
}

.editor-styles-wrapper .point-box-body,
.article-body .point-box-body {
  padding: 18px 22px 22px;
  font-size: 14px;
  line-height: 1.85;
}

.editor-styles-wrapper .point-box-body ul,
.article-body .point-box-body ul {
  margin: 0.8em 0;
  padding-left: 1.4em;
  list-style: disc;
}

.editor-styles-wrapper .point-box-body ol,
.article-body .point-box-body ol {
  margin: 0.8em 0;
  padding-left: 1.4em;
  list-style: decimal;
}

.editor-styles-wrapper .point-box-body li + li,
.article-body .point-box-body li + li {
  margin-top: 0.35em;
}

/* --------------------------------------------------------------------------
   情報ボックス（黄）
   -------------------------------------------------------------------------- */

.editor-styles-wrapper .kyoutei-info-box,
.article-body .kyoutei-info-box {
  margin: 32px 0;
}

.editor-styles-wrapper .kyoutei-info-box__head,
.article-body .kyoutei-info-box__head {
  margin: 0;
  padding: 0 0 0 8px;
}

.editor-styles-wrapper .kyoutei-info-box__label,
.article-body .kyoutei-info-box__label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 7px 16px 6px;
  font-size: 13px;
  font-weight: 700;
  color: #2e7d32;
  background-color: #eceff1;
  border-radius: 6px 6px 0 0;
  position: relative;
}

.editor-styles-wrapper .kyoutei-info-box__label::after,
.article-body .kyoutei-info-box__label::after {
  content: "";
  position: absolute;
  left: 18px;
  bottom: -8px;
  width: 0;
  height: 0;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-top: 8px solid #eceff1;
}

.editor-styles-wrapper .kyoutei-info-box__label i,
.article-body .kyoutei-info-box__label i {
  font-size: 12px;
}

.editor-styles-wrapper .kyoutei-info-box__body,
.article-body .kyoutei-info-box__body {
  padding: 20px 22px 22px;
  font-size: 14px;
  line-height: 1.85;
  background-color: #fff9e6;
  border: 1px solid #e8dfc4;
  border-radius: 0 var(--radius, 8px) var(--radius, 8px) var(--radius, 8px);
}

.editor-styles-wrapper .kyoutei-info-box__body > :first-child,
.article-body .kyoutei-info-box__body > :first-child {
  margin-top: 0;
}

.editor-styles-wrapper .kyoutei-info-box__body > :last-child,
.article-body .kyoutei-info-box__body > :last-child {
  margin-bottom: 0;
}

.editor-styles-wrapper .kyoutei-info-box__body ul,
.article-body .kyoutei-info-box__body ul {
  margin: 0;
  padding-left: 1.4em;
  list-style: disc;
}

.editor-styles-wrapper .kyoutei-info-box__body li,
.article-body .kyoutei-info-box__body li {
  margin-bottom: 0.35em;
}

.editor-styles-wrapper .kyoutei-info-box__body li:last-child,
.article-body .kyoutei-info-box__body li:last-child {
  margin-bottom: 0;
}

/* --------------------------------------------------------------------------
   引用ボックス（灰）
   -------------------------------------------------------------------------- */

.editor-styles-wrapper .kyoutei-quote-box,
.article-body .kyoutei-quote-box {
  position: relative;
  margin: 32px 0;
  padding: 28px 24px 22px;
  background-color: #f3f3f3;
  border: none;
  border-radius: var(--radius, 8px);
}

.editor-styles-wrapper .kyoutei-quote-box__mark,
.article-body .kyoutei-quote-box__mark {
  position: absolute;
  top: 8px;
  left: 16px;
  font-size: 56px;
  line-height: 1;
  font-weight: 700;
  color: #d0d0d0;
  font-family: Georgia, "Times New Roman", serif;
  pointer-events: none;
}

.editor-styles-wrapper .kyoutei-quote-box__body,
.article-body .kyoutei-quote-box__body {
  position: relative;
  z-index: 1;
  padding: 8px 0 0 28px;
  font-size: 14px;
  line-height: 1.9;
}

.editor-styles-wrapper .kyoutei-quote-box__body > :first-child,
.article-body .kyoutei-quote-box__body > :first-child {
  margin-top: 0;
}

.editor-styles-wrapper .kyoutei-quote-box__body > :last-child,
.article-body .kyoutei-quote-box__body > :last-child {
  margin-bottom: 0;
}

.editor-styles-wrapper .kyoutei-quote-box__footer,
.article-body .kyoutei-quote-box__footer {
  margin: 16px 0 0;
  padding: 0 4px 0 28px;
  text-align: right;
  font-size: 13px;
  font-style: normal;
}

.editor-styles-wrapper .kyoutei-quote-box__footer cite,
.article-body .kyoutei-quote-box__footer cite {
  font-style: normal;
  color: #555;
}

.editor-styles-wrapper .kyoutei-quote-box__footer a,
.article-body .kyoutei-quote-box__footer a {
  color: #1565c0;
  text-decoration: underline;
}

.editor-styles-wrapper .kyoutei-quote-box__footer a:hover,
.article-body .kyoutei-quote-box__footer a:hover {
  text-decoration: none;
}

/* --------------------------------------------------------------------------
   エディタ専用 UI
   -------------------------------------------------------------------------- */

.kyoutei-block-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.kyoutei-block-toolbar button.is-primary {
  background: #e84898;
  border-color: #e84898;
}

.kyoutei-toc-editor-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 8px;
  margin-bottom: 8px;
  align-items: center;
}

.editor-styles-wrapper .chat-bubble br,
.article-body .chat-bubble br,
.editor-styles-wrapper .point-box-body br,
.article-body .point-box-body br,
.editor-styles-wrapper .kyoutei-quote-box__body br,
.article-body .kyoutei-quote-box__body br {
  display: block;
  margin-bottom: 0.4em;
  content: "";
}

.editor-styles-wrapper .kyoutei-info-box__body br,
.article-body .kyoutei-info-box__body br,
.editor-styles-wrapper .kyoutei-info-box__content br,
.article-body .kyoutei-info-box__content br {
  display: block;
  margin-bottom: 0.4em;
  content: "";
}

.editor-styles-wrapper .kyoutei-info-box__content,
.article-body .kyoutei-info-box__content {
  min-height: 1.5em;
}

.editor-styles-wrapper .kyoutei-info-box__content > :first-child,
.article-body .kyoutei-info-box__content > :first-child {
  margin-top: 0;
}

.editor-styles-wrapper .kyoutei-info-box__content > :last-child,
.article-body .kyoutei-info-box__content > :last-child {
  margin-bottom: 0;
}

.editor-styles-wrapper [data-type="kyoutei/chat"] .block-editor-block-list__block-edit,
.editor-styles-wrapper [data-type="kyoutei/chat"] .chat-section {
  width: 100%;
}

.editor-styles-wrapper [data-type="kyoutei/chat"] .chat-row {
  width: 100%;
}

/* --------------------------------------------------------------------------
   画像出典
   -------------------------------------------------------------------------- */

.article-body .kyoutei-image-source,
.editor-styles-wrapper .kyoutei-image-source,
.article-fv-media .kyoutei-image-source,
.article-hero .kyoutei-image-source {
  margin: 0;
  padding: 8px 0 0;
  font-size: 12px;
  line-height: 1.6;
  color: var(--c-text-sub, #5c6b7d);
  text-align: right;
}

.article-body .kyoutei-image-source cite,
.editor-styles-wrapper .kyoutei-image-source cite,
.article-fv-media .kyoutei-image-source cite,
.article-hero .kyoutei-image-source cite {
  font-style: normal;
}

.article-body .kyoutei-image-source a,
.editor-styles-wrapper .kyoutei-image-source a,
.article-fv-media .kyoutei-image-source a,
.article-hero .kyoutei-image-source a {
  color: var(--c-blue-600, #1560ac);
  text-decoration: underline;
}

.article-body .kyoutei-image-source a:hover,
.editor-styles-wrapper .kyoutei-image-source a:hover,
.article-fv-media .kyoutei-image-source a:hover,
.article-hero .kyoutei-image-source a:hover {
  text-decoration: none;
}

.editor-styles-wrapper .kyoutei-image-source--editor {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed var(--c-line, #dde5ee);
}

.article-fv-media .kyoutei-image-source,
.article-hero .kyoutei-image-source {
  padding: 8px 16px 0;
  text-align: right;
}

.article-body .wp-block-image .kyoutei-image-source {
  padding: 8px 0 0;
}
