/*
WP投稿本文（WYSIWYG）用ブリッジクラス
TinyMCEで直接クラス付与できるよう、サイト本体のコンポーネントと同等の見た目を提供する
※ /assets/style.css のCSS変数（--main* --accent* --font-* --icon-*）に依存するため、
  本ファイルより先に /assets/style.css を読み込むこと
*/

.wp-editor > p + p {
  margin-top: 1em;
}

.wp-editor p {
  color: var(--main01);
  letter-spacing: 0.009375rem;
  font-size: 0.9375rem;
  font-weight: 500;
  line-height: 1.8;
}

.wp-editor > blockquote {
  margin: 1em 0;
  padding: 0.5em 1em;
  margin-left: 1em;
  color: #666;
  border-left: 0.5rem solid #ccc;
  border-radius: 0.5rem 0 0 0.5rem;
}

.wp-editor ul {
  margin: 0.5em 0;
}

.wp-editor ul li {
  position: relative;
  text-indent: -1.1em;
  margin-left: 1.1em;
}

.wp-editor ul li::before {
  content: '\02022';
  font-size: inherit;
  color: var(--main01-02);
  width: 1em;
  height: 1em;
  line-height: 1;
  margin: 0 0.27em;
}

.wp-editor ol {
  margin: 0.5em 0;
  list-style-type: decimal;
  margin-left: 1.3em;
}

.wp-editor > table:not(.wp-editor-column) {
  width: 100% !important;
  margin: 0.5em 0;
}

.wp-editor > table:not(.wp-editor-column) td {
  word-break: break-all;
}

.wp-editor img.alignleft {
  display: block;
  float: none;
  margin-right: auto;
  margin-left: 0;
}

.wp-editor img.alignright {
  display: block;
  float: none;
  margin-right: 0;
  margin-left: auto;
}

.wp-editor img.aligncenter {
  display: block;
  float: none;
  margin-right: auto;
  margin-left: auto;
}

.wp-editor .wp-ttl1 {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.6;
  color: var(--main01);
  letter-spacing: 0.06rem;
  @media (width >= 561px) {
    font-size: 1.5rem;
  }
}

.wp-editor .wp-ttl2 {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.6;
  color: var(--accent01);
  letter-spacing: 0.055rem;
  @media (width >= 561px) {
    font-size: 1.375rem;
  }
}

.wp-editor .wp-btn1,
.wp-editor .wp-btn2 {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  min-width: 10.875rem;
  padding: 1.125rem 1.75rem 1.125rem 2.375rem;
  border: 1px solid var(--accent02);
  border-radius: 1.875rem;
  background-color: var(--main08);
  font-size: 0.9375rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--accent02);
  text-align: center;
  text-decoration: none;
}

.wp-editor .wp-btn1::after,
.wp-editor .wp-btn2::after {
  content: '';
  display: inline-block;
  width: 1.125rem;
  height: 0.4375rem;
  flex-shrink: 0;
  background-color: currentColor;
  mask: var(--icon-arrow) no-repeat center / contain;
}

.wp-editor .wp-btn2::after {
  width: 1.125rem;
  height: 1.125rem;
  mask: var(--icon-btn-external) no-repeat center / contain;
}

.wp-editor .wp-btn1:hover,
.wp-editor .wp-btn2:hover {
  background-color: var(--accent02);
  border-color: transparent;
  color: var(--main07);
}

.wp-editor .wp-table1 {
  width: 100%;
  border-collapse: collapse;
}

.wp-editor .wp-table1 tr {
  border-bottom: 1px dashed var(--main03);
}

.wp-editor .wp-table1 tr:first-child {
  border-top: 1px dashed var(--main03);
}

.wp-editor .wp-table1 th,
.wp-editor .wp-table1 td {
  padding: 1.25rem 0.625rem;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.8;
  color: var(--main01);
  letter-spacing: 0.035rem;
  text-align: left;
  vertical-align: middle;
}

.wp-editor .wp-table1 th {
  width: 6.25rem;
  @media (width >= 561px) {
    width: 12.625rem;
    padding: 1.75rem 2.5rem;
  }
}
.wp-editor .wp-table1 td {
  @media (width >= 561px) {
    padding: 1.75rem 2.5rem;
  }
}

/* wp-editor-column: 「横並び 画像/文章」 */
.wp-editor-column {
  width: 100% !important;
}

.wp-editor-column > th,
.wp-editor-column td {
  border: none !important;
  padding: 0.8rem 0;
  display: block;

  @media (width < 561px) {
    width: 100% !important;
  }

  @media (width >= 561px) {
    display: inline-block;
    vertical-align: top;
    padding: 0 1rem;
  }
}

.wp-editor-column > th:first-child,
.wp-editor-column td:first-child {
  padding-left: 0;
}

.wp-editor-column > th:last-child,
.wp-editor-column td:last-child {
  padding-right: 0;
}

.wp-editor-column > th > p + p,
.wp-editor-column td > p + p {
  margin-top: 1.2rem;
}

.wp-editor-column table th,
.wp-editor-column table td {
  padding: 1rem 0 0;

  @media (width >= 561px) {
    width: 100% !important;
    padding: 0.8rem 0 0;
  }
}

.wp-editor-column table tr:first-child th,
.wp-editor-column table tr:first-child td {
  padding: 0;

  @media (width >= 561px) {
    padding: 0;
  }
}

/* 画像 */
.wp-image1 img {
  width: 100%;
}

.wp-image2 img {
  width: 100%;

  @media (width >= 561px) {
    width: 70%;
  }
}

.wp-image3 img {
  width: 100%;

  @media (width >= 561px) {
    width: 40%;
  }
}

/* Sugar Calendar（[sugarcalendar_events_calendar]） */
/* SP（767px以下）をPCと同じ見た目で横スクロール表示にする。
   setSugarCalendarResponsive.tsがプラグイン本体のSP用@media(max-width:767px)規則を
   丸ごと削除しているため、残るのはこのデスクトップ用の基本スタイルのみ。
   ただしグリッド自体（.calendar-month）には元々幅の指定が無く1fr列が画面幅に合わせて
   縮むため、min-widthで実質デスクトップ表示時と同じ幅に固定し、はみ出し分は
   base-container側の横スクロールで見せる。 */
.sugar-calendar-block__base-container {
  overflow-x: auto;
}
.sugar-calendar-block__calendar-month {
  min-width: 48rem;
}

/* イベントクリック時のポップアップ（クリック位置に出る小さな吹き出し）を
   画面中央固定の全体モーダル風に変更する。
   位置・サイズはfloating-ui（JS）がインラインstyleで都度上書きしてくるため、
   !importantで固定値に強制する。
   背景の暗転は「js-sugar-calendar-event-popover-active」がbodyに付与される
   タイミングに合わせ、bodyの::beforeで表現する（装飾用オーバーレイのため疑似要素）。
   このクラスはsetSugarCalendarPopover.tsが付与する専用クラスで、プラグイン標準の
   「sugar-calendar-block__popovers__active」は使わない。後者は月選択・カレンダー選択
   ・表示切替などの小さいポップオーバー全種共通のフラグで、それらを開いただけでも
   背景が暗転してしまうため。
   背景暗転クリックで閉じる挙動はプラグイン標準のclosePopoversOnBodyClickが
   そのまま効くため、JS側の追加対応は不要。 */
body.js-sugar-calendar-event-popover-active::before {
  content: '';
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9998;
}

.sugar-calendar-block__popover__event {
  background-color: var(--main07) !important;
  position: fixed !important;
  inset: 0;
  width: 60% !important;
  max-width: unset !important;
  margin: auto !important;
  max-height: 90vh;
  overflow-y: auto;
  /* プラグイン本体のCSS（style-index.css）がこの後に読み込まれ、同じセレクタで
     z-index:99を指定しているため、!important無しだと後勝ちで負けて背景暗転(z-index:9998)
     の下に潜ってしまう */
  z-index: 9999 !important;
  @media (width < 961px) {
    max-height: 75vh;
    width: 80% !important;
  }
  @media (width < 561px) {
    width: 95% !important;
  }
}

.sugar-calendar-block__popover__event__container {
  width: 100% !important;
  padding: 5rem 10rem !important;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.5rem 0;
  @media (width < 961px) {
    padding: 5rem 4rem !important;
  }
  @media (width < 561px) {
    padding: 2rem 3rem !important;
  }
}

/* ポップアップ内の画像（setSugarCalendarResponsive.tsが描画。アイキャッチ未設定時は
   dummy.jpgをフォールバック表示） */
.sugar-calendar-popover-image {
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-radius: 0.5rem;
}
.sugar-calendar-popover-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sugar-calendar-block__calendar-month__body__day {
  min-height: 6rem !important;
}

/* 閉じるボタン（setSugarCalendarPopover.tsがJSで挿入。.eventにposition:fixed済みのため
   中間の.containerを介さずここを基準に右上へ配置される） */
.sugar-calendar-popover-close {
  position: absolute;
  top: 2rem;
  right: 2rem;
  padding: 0.6rem;
  border-radius: 50%;
  background-color: var(--accent02);
  cursor: pointer;
  transition: var(--anim-speed);
  @media (width < 961px) {
    top: 0.5rem;
    right: 0.5rem;
  }
  
}

.sugar-calendar-popover-close:hover {
  opacity: 0.7;
}

.sugar-calendar-popover-close-icon {
  display: block;
  width: 1.2rem;
  height: 1.2rem;
  background-color: var(--color-white);
  mask: var(--icon-close-x) no-repeat center / contain;
  @media (width < 561px) {
    width: 0.8rem;
    height: 0.8rem;
  }
}

.sugar-calendar-block__popover__event__container .wp-editor {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* イベントラベルの高さを2remに統一する。
   プラグインは各日セルにイベント枠を上から順に積み、同じ週の中で段を揃えるため、
   ラベルを表示しない日にも位置合わせ用の透明な枠を置いている
   （multi-day-overflow: 複数日イベントの2日目以降・opacity:0 / spacer_small: 複数日イベント用20px / spacer_full: 1日イベント用36px）。
   表示ラベルだけ高さを変えるとこれらとズレて3段目以降が前の段に重なるため、全て同じ高さに揃える */
.sugar-calendar-block__calendar-month__body__day__events-container__event-multi-day-start.sugar-calendar-block__event-cell,
.sugar-calendar-block__calendar-month__body__day__events-container__event-multi-day-start-overflow.sugar-calendar-block__event-cell,
.sugar-calendar-block__calendar-month__body__day__events-container__event-multi-day-overflow.sugar-calendar-block__event-cell,
.sugar-calendar-block__calendar-month__body__day__events-container__spacer_small,
.sugar-calendar-block__calendar-month__body__day__events-container__spacer_full {
  height: 2rem !important;
}

/* 1日のみのイベント: プラグイン標準は左ボーダーのみ（背景色なし）のため、複数日イベントと同じラベル表示に揃える。
   背景色はインラインstyleでborder-colorにしか出力されないため、同色の背景を持つ
   子要素（__mobile。SP用ドット）をラベル全面に敷いて背景として使う */
.sugar-calendar-block__calendar-month__body .sugar-calendar-block__event-cell:not([class*='multi-day']) {
  position: relative;
  z-index: 0;
  display: flex;
  align-items: center;
  height: 2rem;
  margin-right: 12px;
  border-left: 0;
  border-radius: 10px;
  overflow: hidden;
  white-space: nowrap;
}
.sugar-calendar-block__calendar-month__body .sugar-calendar-block__event-cell:not([class*='multi-day']) .sugar-calendar-block__event-cell__mobile {
  display: block;
  position: absolute;
  inset: 0;
  z-index: -1;
  width: auto;
  height: auto;
  border-radius: 0;
}
.sugar-calendar-block__calendar-month__body .sugar-calendar-block__event-cell:not([class*='multi-day']) .sugar-calendar-block__event-cell__time {
  display: none;
}
.sugar-calendar-block__calendar-month__body .sugar-calendar-block__event-cell:not([class*='multi-day']) .sugar-calendar-block__event-cell__title {
  display: block;
  overflow: hidden;
  padding-right: 12px;
  font-size: 12px;
  font-weight: 500;
  line-height: 16px;
  color: #fff;
  text-overflow: ellipsis;
}

.sugar-calendar-block__calendar-month__header__day {
  background-color: #e9e9e9a5 !important;
}
