/*
Theme Name: まるde明太
Theme URI: https://marudementai.com/
Description: Twenty Twenty-Fiveを親テーマとする「まるde明太」専用子テーマです。
Author: 株式会社オッジ
Template: twentytwentyfive
Version: 1.2.3
Requires at least: 6.7
Requires PHP: 7.4
Text Domain: marudementai
*/

/* =========================================================
   まるde明太 LP — グローバルスタイル
   ※ 各セクションの見た目は home.php 内のインラインスタイルが基本。
     ここには全体共通の土台と、画面幅に応じたレイアウト切替を置く。
     - スマホ幅（〜639px）: 幅460pxの1カラム（インラインスタイルの既定）
     - タブレット幅（640〜899px）: 全幅・680pxラップ・2カラム中心
     - デスクトップ幅（900px〜）: 全幅・1160pxラップ・グリッド展開
   ========================================================= */

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: #EFE7D8;
  color: #3B372F;
  font-family: "Zen Kaku Gothic New", -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans JP", sans-serif;
  -webkit-font-smoothing: antialiased;
  line-height: 1.85;
  font-size: 15px;
}

/* WordPress block-theme integration */
body.marudementai-landing-page {
  margin: 0;
  padding: 0;
}
body.marudementai-landing-page > .wp-site-blocks {
  padding-block: 0;
}
.admin-bar .md-header,
.admin-bar .md-drawer {
  top: 32px !important;
}
@media (max-width: 782px) {
  .admin-bar .md-header,
  .admin-bar .md-drawer {
    top: 46px !important;
  }
}

a { color: var(--accent, #D6382B); text-decoration: none; }
a:hover { opacity: .85; }
img { display: block; max-width: 100%; }

/* ヒーローのロゴを浮かせるアニメーション */
@keyframes mdFloat { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }

/* --- responsive: SP (〜639px) --- */
@media (max-width: 639.98px) {
  /* 現場の声（3分割画像）：縦並びのまま一回り小さく表示。
     3枚とも同じ縮小率（約75%）で人物のスケールを揃える */
  .md-voices img:nth-child(1) { max-width: 255px !important; }
  .md-voices img:nth-child(2) { max-width: 300px !important; }
  .md-voices img:nth-child(3) { max-width: 293px !important; }
}

/* --- responsive: tablet (640–899px) ---
   SPの460pxカラムをそのまま使うと左右の余白が大きく不自然なため、
   全幅＋680pxラップの中間レイアウトに切り替える。 */
@media (min-width: 640px) and (max-width: 899.98px) {
  .md-root { max-width: 100% !important; box-shadow: none !important; }
  .md-wrap { max-width: 680px; margin: 0 auto; }
  .md-pad { padding-left: 44px !important; padding-right: 44px !important; padding-top: 70px !important; padding-bottom: 70px !important; }
  .md-hero { min-height: 90vh !important; padding: 80px 44px !important; }
  .md-hero-inner { max-width: 620px !important; }
  .md-h1 { font-size: 36px !important; }
  .md-h2 { font-size: 27px !important; }
  .md-lead { font-size: 15px !important; }
  /* 期待価値4カード：2×2グリッド */
  .md-grid2 { display: grid !important; grid-template-columns: repeat(2,1fr) !important; gap: 18px !important; align-items: stretch; }
  /* 食形態タグ：2列グリッド（5列は幅が足りないため） */
  .md-tags { display: grid !important; grid-template-columns: repeat(2, 1fr) !important; gap: 12px !important; }
  /* 現場の声（3分割画像）：横並び（幅比率で高さを揃える） */
  .md-voices { flex-direction: row !important; align-items: flex-end !important; justify-content: center !important; gap: 18px !important; }
  .md-voices img { max-width: none !important; min-width: 0; }
  .md-voices img:nth-child(1) { flex: 340 1 0; }
  .md-voices img:nth-child(2) { flex: 400 1 0; }
  .md-voices img:nth-child(3) { flex: 390 1 0; }
  /* 製品写真：横並び */
  .md-prodphotos { flex-direction: row !important; align-items: center !important; justify-content: center !important; gap: 24px !important; }
  .md-prodphotos img { min-width: 0; flex: 1 1 0; max-width: none !important; }
  /* 使い方：画像＋テキストの2カラム */
  .md-usage { display: grid !important; grid-template-columns: 1.1fr .9fr !important; gap: 26px !important; align-items: center; }
  /* 栄養成分＋原材料の2カラム */
  .md-prodgrid { display: grid !important; grid-template-columns: 1fr 1fr !important; gap: 20px 28px !important; align-items: start; }
  .md-form { max-width: 560px !important; margin-left: auto !important; margin-right: auto !important; }
  /* 固定CTAバー：コンテンツ幅に合わせて広げる */
  .md-sticky-inner { max-width: 680px !important; }
}

/* --- responsive: desktop uses full width --- */
@media (min-width: 900px) {
  .md-root { max-width: 100% !important; box-shadow: none !important; }
  .md-wrap { max-width: 1160px; margin: 0 auto; }
  .md-pad { padding-left: 6vw !important; padding-right: 6vw !important; padding-top: 90px !important; padding-bottom: 90px !important; }
  .md-hero { min-height: 94vh !important; padding: 90px 6vw !important; }
  .md-hero-inner { max-width: 760px !important; }
  .md-h1 { font-size: 46px !important; }
  .md-h2 { font-size: 32px !important; }
  .md-lead { font-size: 16px !important; }
  /* align-items: stretch で、同じ行のカードを最も高いカードに揃える
     （文字量のばらつきで高さがガタつくのを防ぐ） */
  .md-grid3 { display: grid !important; grid-template-columns: repeat(3,1fr) !important; gap: 22px !important; align-items: stretch; }
  .md-grid2 { display: grid !important; grid-template-columns: repeat(2,1fr) !important; gap: 22px !important; align-items: stretch; }
  .md-tags { flex-direction: row !important; flex-wrap: wrap !important; }
  .md-tags > div { flex: 1 1 150px; flex-direction: column !important; align-items: flex-start !important; gap: 6px !important; }
  .md-narrow { max-width: 900px !important; margin-left: auto !important; margin-right: auto !important; }
  .md-form { max-width: 560px !important; margin-left: auto !important; margin-right: auto !important; }
  .md-usage { display: grid !important; grid-template-columns: 1.1fr .9fr !important; gap: 34px !important; align-items: center; }
  .md-prodgrid { display: grid !important; grid-template-columns: 1fr 1fr !important; gap: 22px 46px !important; align-items: start; }
  .md-sticky-inner { max-width: 100% !important; justify-content: flex-end !important; align-items: center; gap: 16px !important; padding-left: 6vw !important; padding-right: 6vw !important; }
  .md-sticky-msg { display: block !important; }
  .md-sticky-inner > a { flex: 0 0 auto !important; padding-left: 34px !important; padding-right: 34px !important; }

  /* 現場の声（3分割画像）：SPは縦並び → デスクトップは横並び。
     flex-grow を画像の実寸幅（340/400/390px）にして、表示高さを揃える */
  .md-voices { flex-direction: row !important; align-items: flex-end !important; justify-content: center !important; gap: 24px !important; }
  .md-voices img { max-width: none !important; min-width: 0; }
  .md-voices img:nth-child(1) { flex: 340 1 0; }
  .md-voices img:nth-child(2) { flex: 400 1 0; }
  .md-voices img:nth-child(3) { flex: 390 1 0; }

  /* 製品写真（2分割画像）：SPは縦並び → デスクトップは横並び */
  .md-prodphotos { flex-direction: row !important; align-items: center !important; justify-content: center !important; gap: 32px !important; }
  .md-prodphotos img { min-width: 0; flex: 1 1 0; max-width: none !important; }
}

/* =========================================================
   以下は元バンドルには無い、運用上の細かな演出（任意で調整可）
   ========================================================= */

/* 固定CTAバー：ヒーロー（MV）が見えている間は隠し、
   スクロールで超えたら表示（切替は js/main.js が制御） */
.md-sticky {
  transform: translateY(110%);
  opacity: 0;
  transition: transform .35s ease, opacity .35s ease;
}
.md-sticky.is-visible {
  transform: translateY(0);
  opacity: 1;
}

/* 使い方ギャラリー：サムネイル選択でメイン画像を切替（js/main.js が制御）
   サムネイルは可変数（auto-fill）。増やしてもレイアウトが自動で追従する */
.md-usage-thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 8px;
}
.md-usage-thumb {
  padding: 0;
  border: 2px solid transparent;
  border-radius: 12px;
  overflow: hidden;
  background: none;
  cursor: pointer;
  opacity: .72;
  transition: opacity .2s ease, border-color .2s ease;
}
.md-usage-thumb img { width: 100%; height: 64px; object-fit: cover; }
.md-usage-thumb:hover { opacity: 1; }
.md-usage-thumb.is-active { border-color: var(--accent, #D6382B); opacity: 1; }
.md-usage-main-img { transition: opacity .2s ease; }

/* =========================================================
   固定ヘッダー ＋ SPドロワー
   ========================================================= */

/* 固定ヘッダーの高さぶん、本文を下げる（ヘッダーと重ならないように） */
:root { --md-header-h: 61px; }
.md-root { padding-top: var(--md-header-h); }
/* アンカー遷移時に固定ヘッダーへ潜り込まないようオフセット */
[id] { scroll-margin-top: calc(var(--md-header-h) + 10px); }

.md-header-brand { text-decoration: none; }

/* SP（〜639px）：ロゴ＋ハンバーガーのみ。ナビリンク・注文ボタンはドロワーへ */
.md-header-link,
.md-header-cta { display: none; transition: background-color .2s ease; }
.md-nav-toggle { display: inline-flex; }

@media (min-width: 640px) {
  /* デスクトップ／タブレット：インラインナビを表示、ハンバーガー非表示 */
  .md-header-link { display: inline-block; }
  .md-header-cta { display: inline-block; }
  .md-header-link:hover { background: rgba(214, 56, 43, .06); opacity: 1; }
  .md-nav-toggle { display: none; }
  .md-drawer, .md-drawer-overlay { display: none !important; }
}

/* ハンバーガーボタン（3本線 → 開くと×） */
.md-nav-toggle {
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 42px;
  height: 38px;
  padding: 0 8px;
  background: none;
  border: none;
  cursor: pointer;
}
.md-nav-toggle span {
  display: block;
  width: 100%;
  height: 2px;
  border-radius: 2px;
  background: #2E2A22;
  transition: transform .25s ease, opacity .2s ease;
}
.md-nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.md-nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.md-nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ドロワー本体（右からスライドイン） */
.md-drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  z-index: 100;
  width: 80%;
  max-width: 300px;
  display: flex;
  flex-direction: column;
  padding: 16px 18px calc(env(safe-area-inset-bottom, 0px) + 24px);
  background: #FFFDF9;
  box-shadow: -8px 0 30px rgba(90, 70, 40, .22);
  transform: translateX(100%);
  transition: transform .3s ease;
  overflow-y: auto;
}
.md-drawer.is-open { transform: translateX(0); }
.md-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.md-drawer-title { font-family: 'Zen Old Mincho', serif; font-weight: 700; font-size: 15px; color: #2E2A22; }
.md-drawer-close {
  font-size: 26px; line-height: 1;
  background: none; border: none; color: #6C6350; cursor: pointer; padding: 4px 8px;
}
.md-drawer-nav { display: flex; flex-direction: column; }
.md-drawer-nav a {
  font-size: 15px; font-weight: 700; color: #3B372F;
  padding: 15px 6px;
  border-bottom: 1px solid #F0E7D4;
}
.md-drawer-nav a:hover { color: var(--accent, #D6382B); opacity: 1; }
.md-drawer-cta {
  margin-top: 18px;
  text-align: center;
  color: #fff !important;
  background: var(--accent, #D6382B);
  border-radius: 999px !important;
  border-bottom: none !important;
  box-shadow: 0 6px 16px rgba(214, 56, 43, .32);
  padding: 15px 8px !important;
}

/* ドロワー背後のオーバーレイ */
.md-drawer-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(24, 16, 10, .42);
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s ease;
}
.md-drawer-overlay.is-open { opacity: 1; pointer-events: auto; }

/* ドロワー展開中は背面スクロールを固定 */
body.md-drawer-open { overflow: hidden; }

/* FAQ アコーディオン（開閉は js/main.js が制御） */
.md-faq-toggle { transition: background-color .2s ease; }
.md-faq-toggle:hover { background-color: rgba(214, 56, 43, .04) !important; }
.md-faq-a { animation: mdFaqOpen .22s ease; }
@keyframes mdFaqOpen {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* 固定ページ・投稿・アーカイブ */
.md-root--content {
  min-height: 100vh;
  max-width: 100% !important;
  box-shadow: none !important;
}
.md-content {
  width: min(100% - 40px, 860px);
  min-height: 60vh;
  margin: 0 auto;
  padding: 72px 0 96px;
}
.md-entry {
  padding: 28px 0;
  border-bottom: 1px solid #e7dcc4;
}
.md-entry-title {
  margin: 0 0 24px;
  color: #2e2a22;
  font-family: "Zen Old Mincho", serif;
  font-size: clamp(24px, 5vw, 38px);
  line-height: 1.5;
}
.md-entry-title a { color: inherit; }
.md-entry-content > * { max-width: 100%; }
.md-site-footer {
  padding: 28px 20px;
  background: #fbf6ec;
  color: #6c6350;
  text-align: center;
  font-size: 12px;
}
.md-site-footer p { margin: 0; }
.md-not-found { text-align: center; }
.md-error-code {
  margin: 0;
  color: var(--accent, #d6382b);
  font: 700 clamp(72px, 18vw, 140px)/1 "Zen Old Mincho", serif;
}
.md-content-button {
  display: inline-block;
  margin-top: 20px;
  padding: 13px 28px;
  border-radius: 999px;
  background: var(--accent, #d6382b);
  color: #fff;
  font-weight: 700;
}
