/* ===================================================
 * MLS ブロック フロント表示用 CSS
 * 編集モード外でも必要なスタイル
 * =================================================== */

/* ===================================================
 * ブロック外殻 — index.php セクション互換
 * 基準幅500px / padding 50px 30px を踏襲
 * spacer・heading は余白不要のため除外
 * =================================================== */

.mls-block {
  width: 500px;
  max-width: 100%;
  margin-left: auto;
  margin-right: auto;
  padding: 8px 30px;
  box-sizing: border-box;
}

/* 公開時のみ overflow を制限（編集時はツールバーが切れるため除外） */
.mode-flow .mls-block {
  overflow: hidden;
}
/* スライダーは常に overflow hidden（トラックがはみ出すため） */
.mls-block-slider {
  overflow: hidden;
}

/* spacer: 余白ブロックなので外殻padding不要 */
.mls-block-spacer {
  padding: 0;
}

/* heading: セクション間隔の責務を持つ（上余白でセクション分離） */
.mls-block-heading {
  padding: 16px 30px 0 30px;
}

/* heading 直後のブロックは上余白を潰してくっつける */
.mls-block-heading + .mls-block {
  padding-top: 0;
}

/* テーブルブロック: 横スクロールを許可 */
.mls-block-table,
.mls-block-table_json {
  overflow: visible;
}

/* ===================================================
 * 背景色クラス（複数ブロックに同じクラスで一体化）
 * 編集画面の classes フィールドで付与
 * =================================================== */
/*
 * 背景色プリセット（bg-section-*）
 * 追加方法: ここにクラスを追加し、block_editor.js の BG_PRESETS 配列にも追加
 */
.mls-block.bg-section-blue   { background: #dce3ed; }
.mls-block.bg-section-red    { background: #f5e0e0; }
.mls-block.bg-section-green  { background: #e0f0e8; }
.mls-block.bg-section-gray   { background: #f0f0f0; }
.mls-block.bg-section-dark   { background: #1c3264; color: #fff; }
.mls-block.bg-section-dark .mls-heading-main,
.mls-block.bg-section-dark p { color: #fff; }

/* 旧名互換 */
.mls-block.bg-gradient1 { background: #dce3ed; }

/* 同じ bg-section が連続するブロック間の隙間を潰す */
.mls-block[class*="bg-section-"] + .mls-block[class*="bg-section-"] {
  padding-top: 2px;
  padding-bottom: 2px;
  margin-top: -1px;
}
/* 背景グループ先頭: 下 padding を潰す */
.mls-block[class*="bg-section-"]:not([class*="bg-section-"] + [class*="bg-section-"]) {
  padding-bottom: 0;
}

/* text_rich: index.php セクション内テキスト互換デフォルト */
.mls-block-text_rich {
  padding-top: 4px;
  padding-bottom: 4px;
}
.mls-block-text_rich p {
  font-size: 0.95rem;
  line-height: 1.8;
  color: #333;
}

/* text_rich 直後の link_button もくっつける */
.mls-block-text_rich + .mls-block-link_button {
  padding-top: 0;
}

/* slider: 背景色あり（index.php .event-slider-section 踏襲） */
.mls-block-slider {
  background-color: #f9f9f9;
  padding: 40px 30px;
}

/* accordion: 背景色あり（index.php .vision-section 踏襲） */
.mls-block-accordion {
  background: #f8f9fa;
}

@media (max-width: 425px) {
  .mls-block {
    width: 100%;
    max-width: 100%;
    padding: 6px 20px;
  }
  .mls-block-spacer {
    padding: 0;
  }
  .mls-block-heading {
    padding: 12px 20px 0 20px;
  }
  .mls-block-heading + .mls-block {
    padding-top: 0;
  }
  .mls-block-slider {
    padding: 35px 20px;
  }
}

/* ===================================================
 * heading ブロック — index.php section-title 互換
 * デフォルト: 中央揃え / 1.75rem / 赤下線
 * =================================================== */

.mls-heading-main {
  font-size: 1.75rem;
  font-weight: 700;
  color: #333;
  margin-top: 0;
  margin-bottom: 1rem;
}

@media (max-width: 425px) {
  .mls-heading-main {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
  }
}

.mls-heading-wrap.mls-heading-center {
  text-align: center;
}

.mls-heading-wrap.mls-heading-right {
  text-align: right;
}

/* ===================================================
 * 画像ブロック配置
 * =================================================== */

.mls-img { box-sizing: border-box; }
.mode-edit .mls-img.is-empty {
  padding: 40px 20px;
  text-align: center;
  color: #94a3b8;
  background: #f1f5f9;
  border: 2px dashed #cbd5e1;
  border-radius: 12px;
  font-size: 14px;
}
.mode-edit .mls-img.is-empty::after {
  content: '\753B\50CF\FF08\672A\8A2D\5B9A\FF09';
}
.mls-img.mls-img-center { margin-left: auto; margin-right: auto; }
.mls-img.mls-img-right  { margin-left: auto; margin-right: 0; }

/* ===================================================
 * heading 赤い下線装飾
 * =================================================== */

.mls-heading-main.has-underline-red {
  position: relative;
  display: inline-block;
  padding-bottom: 10px;
}

.mls-heading-main.has-underline-red::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 3px;
  background-color: #dd3333;
}

/* heading 左縦線装飾 */
.mls-heading-main.has-left-border {
  border-left: 4px solid #dd3333;
  padding-left: 12px;
}

/* ===================================================
 * スライダーブロック フロント表示
 * =================================================== */

.mls-slider-container {
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
}

.mls-slider-wrapper {
  overflow: visible;
  padding: 20px 0;
}

.mls-slider-track {
  display: flex;
  transition: transform 0.5s ease;
}

.mls-slider-slide {
  flex: 0 0 100%;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.mls-slider-slide a {
  display: block;
  line-height: 0;
}

.mls-slider-image {
  width: 100%;
  height: 300px;
  object-fit: cover;
}

@media (max-width: 425px) {
  .mls-slider-image {
    height: 200px;
  }
}

/* ナビボタン */
.mls-slider-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 100%;
  display: flex;
  justify-content: space-between;
  padding: 0 10px;
  pointer-events: none;
  box-sizing: border-box;
}

.mls-slider-btn {
  width: 40px;
  height: 40px;
  background-color: rgba(255, 255, 255, 0.8);
  border: none;
  border-radius: 50%;
  color: #333;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  pointer-events: auto;
}

.mls-slider-btn:hover {
  background-color: #fff;
  transform: scale(1.1);
}

/* インジケーター */
.mls-slider-indicators {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 1rem;
}

.mls-slider-dot {
  width: 10px;
  height: 10px;
  background-color: rgba(0, 0, 0, 0.2);
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.3s ease;
  border: none;
  padding: 0;
}

.mls-slider-dot.active {
  background-color: #dd3333;
  transform: scale(1.2);
}

/* スライダー プレースホルダー（画像未設定時） */
.mls-slider-placeholder {
  padding: 40px 20px;
  text-align: center;
  color: #94a3b8;
  background: #f1f5f9;
  border: 2px dashed #cbd5e1;
  border-radius: 12px;
  font-size: 14px;
}

/* ===================================================
 * 特徴カードブロック（index.php デザイン踏襲）
 * =================================================== */

.mls-fcards-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

.mls-fcard {
  background-color: #fff;
  border-radius: 10px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
  padding: 2rem;
  text-align: center;
  transition: all 0.3s ease;
  box-sizing: border-box;
}

.mls-fcard:hover {
  transform: translateY(-5px);
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
}

.mls-fcard-icon {
  font-size: 2.5rem;
  color: var(--primary-color, #dd3333);
  margin-bottom: 1rem;
}

.mls-fcard-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #333;
  margin-bottom: 1rem;
}

.mls-fcard-desc {
  font-size: 0.875rem;
  color: #666;
  line-height: 1.6;
}

/* 特徴カード プレースホルダー */
.mls-fcards-placeholder {
  padding: 40px 20px;
  text-align: center;
  color: #94a3b8;
  background: #f1f5f9;
  border: 2px dashed #cbd5e1;
  border-radius: 12px;
  font-size: 14px;
}

/* ===================================================
 * リンクボタンブロック（index.php .features-button デザイン踏襲）
 * =================================================== */

.mls-link-button-wrap {
  text-align: center;
  margin-top: 1rem;
  margin-bottom: 1rem;
}

.mls-link-button {
  display: inline-block;
  background-color: #dd3333;
  color: #fff;
  padding: 1rem 2.5rem;
  border-radius: 30px;
  font-weight: 600;
  font-size: 16px;
  text-decoration: none;
  transition: all 0.3s ease;
  box-shadow: 0 5px 15px rgba(221, 51, 51, 0.3);
  cursor: pointer;
}

.mls-link-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
  filter: brightness(0.9);
}

/* ===================================================
 * スペーサーブロック
 * =================================================== */

.mls-spacer {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.mls-spacer-line {
  width: 100%;
  margin: 0 auto;
  border-width: 1px 0 0 0;
}

/* ===================================================
 * タイルパネルブロック（index.php .tile-* デザイン踏襲）
 * =================================================== */

.mls-tiles-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}

.mls-tile-item {
  position: relative;
  height: 250px;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  box-sizing: border-box;
}

.mls-tile-background {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.mls-tile-background img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.mls-tile-no-image {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #e2e8f0;
  color: #94a3b8;
  font-size: 14px;
}

.mls-tile-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(to bottom, rgba(0,0,0,0.3), rgba(0,0,0,0.7));
  display: flex;
  align-items: flex-end;
  padding: 2rem;
  transition: all 0.3s ease;
  box-sizing: border-box;
}

.mls-tile-item:hover .mls-tile-overlay {
  background: linear-gradient(to bottom, rgba(0,0,0,0.4), rgba(0,0,0,0.8));
}

.mls-tile-content {
  color: #fff;
}

.mls-tile-content h3 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.mls-tile-content p {
  font-size: 0.875rem;
  margin-bottom: 1rem;
  opacity: 0.9;
}

.mls-tile-button {
  display: inline-block;
  background-color: #dd3333;
  color: #fff;
  padding: 0.5rem 1.5rem;
  border-radius: 25px;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.3s ease;
}

.mls-tile-button:hover {
  background-color: #c92121;
  transform: translateY(-2px);
}

/* タイルパネル プレースホルダー */
.mls-tiles-placeholder {
  padding: 40px 20px;
  text-align: center;
  color: #94a3b8;
  background: #f1f5f9;
  border: 2px dashed #cbd5e1;
  border-radius: 12px;
  font-size: 14px;
}

/* ===================================================
 * アコーディオンブロック（index.php vision-toggle 風）
 * =================================================== */

.mls-accordion {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.mls-accordion-item {
  background: white;
  border-radius: 12px;
  margin-bottom: 1rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  transition: all 0.3s ease;
}

.mls-accordion-item:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.mls-accordion-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 1.5rem;
  background: white;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: inherit;
  text-align: left;
  transition: all 0.3s ease;
}

.mls-accordion-header:hover {
  background: #f8f9fa;
}

.mls-accordion-header.active {
  background: #f0f0f0;
}

.mls-accordion-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.mls-accordion-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: #dd3333;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.mls-accordion-title span {
  font-weight: 600;
  font-size: 1rem;
  color: #333;
}

.mls-accordion-arrow {
  font-size: 0.85rem;
  color: #888;
  transition: transform 0.35s ease;
  flex-shrink: 0;
}

.mls-accordion-item.active .mls-accordion-arrow {
  transform: rotate(180deg);
}

.mls-accordion-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease;
}

.mls-accordion-inner {
  padding: 1.25rem;
}

.mls-accordion-inner p {
  font-size: 0.925rem;
  color: #555;
  line-height: 1.7;
  margin-bottom: 1rem;
}

.mls-accordion-cta {
  text-align: center;
  margin-top: 0.5rem;
}

.mls-accordion-button {
  display: inline-block;
  background-color: #dd3333;
  color: #fff;
  padding: 0.6rem 1.8rem;
  border-radius: 25px;
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(221, 51, 51, 0.3);
}

.mls-accordion-button:hover {
  background-color: #c92121;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(221, 51, 51, 0.4);
}

/* アコーディオン プレースホルダー */
.mls-accordion-placeholder {
  padding: 40px 20px;
  text-align: center;
  color: #94a3b8;
  background: #f1f5f9;
  border: 2px dashed #cbd5e1;
  border-radius: 12px;
  font-size: 14px;
}

/* ===================================================
 * アイコンリンクブロック（index.php .event-button 風）
 * =================================================== */

.mls-icon-links {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: stretch;
}

.mls-icon-link-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.5rem;
  background: #fff;
  border: 2px solid #dd3333;
  border-radius: 8px;
  color: #dd3333;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  transition: all 0.3s ease;
  box-sizing: border-box;
  box-shadow: 0 2px 8px rgba(221, 51, 51, 0.1);
}

.mls-icon-link-item:hover {
  background-color: #dd3333;
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(221, 51, 51, 0.3);
}

.mls-icon-link-item i {
  font-size: 1.2rem;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}

.mls-icon-link-item span {
  flex: 1;
  text-align: left;
}

/* アイコンリンク プレースホルダー */
.mls-icon-links-placeholder {
  padding: 40px 20px;
  text-align: center;
  color: #94a3b8;
  background: #f1f5f9;
  border: 2px dashed #cbd5e1;
  border-radius: 12px;
  font-size: 14px;
}

/* ===================================================
 * レスポンシブ: 個別幅制御は外殻 .mls-block に移管済み
 * （旧 70%→95% ルールは削除）
 * =================================================== */

/* ===================================================
 * カスタムボックス（shape_rect）
 * =================================================== */
.mls-shape-rect {
  width: 100%;
  box-sizing: border-box;
}

/* HTMLモード時（設定値なし）: 外殻paddingを除去して幅いっぱいに */
.mls-block-shape_rect:has(.mls-shape-rect:empty),
.mls-block-shape_rect {
  padding-left: 0;
  padding-right: 0;
}

/* ===================================================
 * ハイライトカードブロック（stat_cards）
 * index.php .about-stats デザイン踏襲
 * =================================================== */

.mls-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-around;
  gap: 1rem;
  padding: 1rem 0;
}

.mls-stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  min-width: 80px;
  flex: 1;
}

.mls-stat-image {
  margin-bottom: 0.75rem;
}

.mls-stat-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid #dd3333;
}

.mls-stat-circle {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: #dd3333;
  border: 3px solid #dd3333;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 400;
  margin-bottom: 0.75rem;
  box-sizing: border-box;
}

.mls-stat-number {
  display: block;
  font-size: 1.4rem;
  font-weight: 700;
  color: #dd3333;
  line-height: 1.2;
  margin-bottom: 0.2rem;
}

.mls-stat-label {
  font-size: 0.85rem;
  color: #666;
  line-height: 1.3;
}

.mls-stat-placeholder {
  padding: 40px 20px;
  text-align: center;
  color: #94a3b8;
  background: #f1f5f9;
  border: 2px dashed #cbd5e1;
  border-radius: 12px;
  font-size: 14px;
}

@media (max-width: 425px) {
  .mls-stat-number {
    font-size: 1.2rem;
  }
  .mls-stat-icon,
  .mls-stat-circle {
    width: 56px;
    height: 56px;
    font-size: 0.9rem;
  }
}

/* ===================================================
 * 記事カードブロック（article_cards）
 * ヒーロー（注目）1件 + リスト表示
 * =================================================== */

/* --- ヒーロー（注目記事） --- */
.mls-acard-hero {
  display: block;
  text-decoration: none;
  color: inherit;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
  margin-bottom: 1rem;
}
.mls-acard-hero:hover {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14);
  transform: translateY(-2px);
}
.mls-acard-hero-img {
  width: 100%;
  height: auto;
  display: block;
}
.mls-acard-hero-body {
  padding: 14px 16px 12px;
  background: #fff;
}
.mls-acard-hero-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #222;
  line-height: 1.5;
  margin: 0 0 4px;
}
.mls-acard-hero-sub {
  font-size: 0.8rem;
  color: #888;
  margin: 0;
}

/* --- リスト（通常記事） --- */
.mls-acard-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.mls-acard-item {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: inherit;
  padding: 8px 0;
  border-bottom: 1px solid #f0f0f0;
  transition: background 0.2s ease;
}
.mls-acard-item:last-child {
  border-bottom: none;
}
.mls-acard-item:hover {
  background: #fafafa;
}
.mls-acard-thumb {
  width: 80px;
  height: 80px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
}
.mls-acard-thumb-empty {
  width: 80px;
  height: 80px;
  border-radius: 8px;
  background: #e8e8e8;
  flex-shrink: 0;
}
.mls-acard-text {
  flex: 1;
  min-width: 0;
}
.mls-acard-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: #222;
  line-height: 1.5;
  margin: 0 0 2px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.mls-acard-sub {
  font-size: 0.78rem;
  color: #999;
  margin: 0;
}

/* --- プレースホルダー --- */
.mls-acard-placeholder {
  padding: 40px 20px;
  text-align: center;
  color: #94a3b8;
  background: #f1f5f9;
  border: 2px dashed #cbd5e1;
  border-radius: 12px;
  font-size: 14px;
}

@media (max-width: 425px) {
  .mls-block-article_cards {
    padding-left: 6px;
    padding-right: 6px;
  }
  .mls-acard-hero-img {
    max-height: 220px;
    object-fit: cover;
    object-position: center top;
  }
  .mls-acard-hero-title {
    font-size: 1rem;
  }
  .mls-acard-thumb,
  .mls-acard-thumb-empty {
    width: 70px;
    height: 70px;
  }
  .mls-acard-title {
    font-size: 0.9rem;
  }
}

/* ===================================================
 * 2カラム横並び（.mls-row）
 * mainカラム幅648pxを使い、スマホでは縦落ち
 * =================================================== */

.mls-row {
  display: flex !important;
  flex-wrap: nowrap;
  flex-direction: row;
  align-items: stretch;
  gap: 0;
  width: 500px;
  max-width: 500px;
  margin: 0 auto;
  padding: 8px 30px;
  box-sizing: border-box;
}

/* row 内のブロックは外殻を解除し、col_span で幅制御 */
.mls-row > .mls-block {
  width: auto !important;
  max-width: none !important;
  margin: 0;
  padding: 12px;
  flex-grow: 0;
  flex-shrink: 0;
  min-width: 0;
}

/* row 内の画像: カラム高さいっぱいに cover で表示 */
.mls-row > .mls-block-image {
  display: flex;
}
.mls-row > .mls-block-image .mls-img {
  max-width: 100% !important;
  height: 100%;
}
.mls-row > .mls-block-image .mls-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 8px;
}

/* row 内の非画像ブロック（テキスト等）はカラム幅いっぱいに */
.mls-row > .mls-block .mls-img {
  max-width: 100% !important;
}
.mls-row > .mls-block img {
  max-width: 100%;
}

@media (max-width: 768px) {
  .mls-row {
    flex-direction: column;
    width: 100%;
    max-width: 100%;
    padding: 40px 20px;
  }
  .mls-row > .mls-block {
    flex-basis: 100% !important;
  }
}
