/*
 *  水引（theme 5）
 *
 *  白い紙に、熨斗と金・紅の水引。三つ折りの顔合わせしおりの和の組みを、
 *  スマホの縦スクロールに直したもの。PC では中央に紙面の幅（--page）で置く。
 *  Bootstrap などの既成の CSS は読まない。
 *
 *  見出しの下の線（金3本・紅3本）は画像を使わず CSS で描く。
 *  表紙の熨斗（noshi.webp）と水引（knot.webp）だけが画像（form/static/mizuhiki/images/）。
 *  どちらも画像AIで作り、白地を透過にして WebP にしたもの。
 */

:root {
  --paper: #FBFAF7;
  --ink: #3F3B3A;
  --ink-soft: #7A7472;
  --gold: #E2CF8E;
  --gold-deep: #A98E3E;
  --red: #DC6E73;
  --red-deep: #C2505A;
  --line: #ECE8E1;
  --page: 480px;
  --serif: 'Shippori Mincho', 'Hiragino Mincho ProN', 'Yu Mincho', serif;
  --ease: cubic-bezier(.22, .61, .36, 1);
  /* 筆で書くように、書き始めと終わりをゆっくりに */
  --brush: cubic-bezier(.45, .05, .35, 1);
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body.mz {
  margin: 0;
  background: #EFEDE8;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 15px;
  line-height: 2;
  letter-spacing: .08em;
  -webkit-font-smoothing: antialiased;
}

/* 初期化は :where() で優先度を 0 にする。個別の指定に負けるように */
:where(.mz) img { max-width: 100%; height: auto; display: block; }
:where(.mz) a { color: var(--red-deep); }
:where(.mz) :is(h1, h2, h3, p, ol, ul, dl, figure) { margin: 0; padding: 0; }
:where(.mz) :is(ol, ul) { list-style: none; }

.mz-page {
  position: relative;
  max-width: var(--page);
  margin: 0 auto;
  background: var(--paper);
  overflow: hidden;
  box-shadow: 0 0 40px rgba(63, 59, 58, .08);
}

.mz-muted { color: var(--ink-soft); }

/* ───── 表紙 ───── */

.mz-cover {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  /* 熨斗袋と同じく、水引を上下の真ん中に掛ける。題字は上半分の下寄せ、家の名前は下半分の上寄せ。
   * 上下の padding は同じ値にしておくこと（違うと真ん中がずれる） */
  display: grid;
  grid-template-rows: 1fr auto 1fr;
  justify-items: center;
  padding: 52px 24px 52px;
  text-align: center;
}

/* 熨斗。右上に、紙の上端から下げて */
.mz-noshi {
  position: absolute;
  top: 3vh;
  right: 9%;
  width: 14%;
  max-width: 64px;
  pointer-events: none;
}

.mz-cover__title {
  writing-mode: vertical-rl;
  font-size: min(28px, 3.3vh);   /* 背の低い画面でも、題字が上半分に収まるように */
  font-weight: 500;
  line-height: 1;
  letter-spacing: .28em;
  align-self: end;
  margin-bottom: 3vh;
}
.mz-cover__title span { display: inline-block; padding: .2em .3em; }

/* 水引。左が金・右が紅で、真ん中で結ぶ。紙面の幅いっぱいに置き、紐を左右の端まで通す */
.mz-band {
  width: calc(100% + 48px);
  max-width: none !important;
  /* 画像の中で横の紐は高さの 84% にある。下に余白（高さの 68% ぶん）を足して、紐を行の真ん中に置く。
   * 高さ = 幅 × 242/1200、余白の % は親の内側の幅（= 帯の幅 − 48px）が基準なので
   *   0.68 × 242/1200 × (100% + 48px) ≒ 13.75% + 6.6px */
  margin: 0 -24px calc(13.75% + 6.6px);
  pointer-events: none;
}

.mz-cover__families {
  display: flex;
  flex-direction: row-reverse;   /* 縦書きなので、先に書いた家（男性側）を右に */
  justify-content: center;
  gap: 1.3em;
  align-self: start;
  margin-top: 3vh;
  font-size: min(26px, 3.2vh);
  font-weight: 500;
  line-height: 1;
  letter-spacing: .3em;
}
.mz-cover__families span { writing-mode: vertical-rl; }


.mz-scroll {
  position: absolute;
  left: 50%;
  bottom: 22px;
  width: 1px;
  height: 46px;
  margin-left: -.5px;
  background: var(--line);
  overflow: hidden;
}
.mz-scroll span {
  position: absolute;
  left: 0;
  top: -46px;
  width: 1px;
  height: 46px;
  background: var(--red);
  animation: mz-scroll 2.4s var(--ease) infinite;
}
@keyframes mz-scroll { to { transform: translateY(92px); } }

/* ───── セクション ───── */

.mz-section {
  position: relative;
  padding: 72px 28px;
  text-align: center;
}
.mz-section--tint { background: #F6F4EF; }

/* 見出しと、その下の水引の線（金3本・紅3本） */
.mz-heading {
  margin-bottom: 40px;
  font-size: 20px;
  font-weight: 500;
  line-height: 1.6;
  letter-spacing: .3em;
}
.mz-heading span { display: inline-block; padding-left: .3em; }   /* 字間の分だけ右へずれるのを戻す */
.mz-heading::after,
.mz-rule {
  content: '';
  display: block;
  height: 7px;
  margin: 18px -4px 0;
  background:
    repeating-linear-gradient(to bottom, var(--gold) 0 1px, transparent 1px 3px) left / 50% 100% no-repeat,
    repeating-linear-gradient(to bottom, var(--red) 0 1px, transparent 1px 3px) right / 50% 100% no-repeat;
}

.mz-text { font-size: 15px; line-height: 2.3; }

/* 当日の予定 */
.mz-venue { margin-bottom: 36px; }
.mz-venue__date { font-size: 22px; letter-spacing: .08em; line-height: 1.5; }
.mz-venue__date small { font-size: 14px; }
.mz-venue__time { display: block; font-size: 17px; color: var(--ink-soft); }
.mz-venue__name { margin-top: 14px; font-size: 17px; font-weight: 600; }
.mz-venue__address { font-size: 13px; color: var(--ink-soft); line-height: 1.8; }

/* 地図。Google の埋め込みは配色を指定できないので、filter で彩度を落として紙の色に寄せる */
.mz-map {
  margin: -8px auto 40px;
  overflow: hidden;
  border: 1px solid var(--line);
}
.mz-map iframe {
  display: block;
  width: 100%;
  height: 240px;
  border: 0;
  filter: grayscale(.7) sepia(.18) brightness(1.03);
}

/* 当日の流れと今後の予定 */
.mz-list { max-width: 300px; margin: 0 auto; }
.mz-list > div {
  display: flex;
  gap: 16px;
  padding: 11px 4px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}
.mz-list dt { flex: 0 0 7em; color: var(--red-deep); letter-spacing: .08em; white-space: nowrap; }
.mz-list dd { margin: 0; flex: 1; }
/* 時刻・日付が未入力の行は列を詰める */
.mz-list dt:empty { display: none; }

.mz-button {
  display: inline-block;
  margin-top: 16px;
  padding: 8px 26px;
  border: 1px solid var(--red);
  font-size: 13px;
  text-decoration: none;
  color: var(--red-deep);
  letter-spacing: .14em;
  transition: background .3s, color .3s;
}
.mz-button:hover, .mz-button:focus-visible { background: var(--red); color: #fff; }

/* 広告。中央に寄せ、前後に余白を取る */
.mz-ad { margin: 48px auto 0; text-align: center; }
.mz-ad .google_ads_rec { display: flex; justify-content: center; }

/* 協賛 */
.mz-affiliates { display: grid; gap: 40px; }
.mz-affiliate img { margin: 0 auto 12px; height: auto; }
.mz-affiliate p { font-size: 13px; line-height: 1.9; }
.mz-affiliate__name { font-weight: 600; font-size: 15px !important; margin-bottom: 6px !important; }
.mz-affiliate__pick { color: var(--red-deep); margin-top: 8px !important; }

/* プロフィール */
.mz-couple { display: grid; grid-template-columns: 1fr 1fr; gap: 20px 18px; align-items: start; }
.mz-portrait { aspect-ratio: 3 / 4; overflow: hidden; background: #F1EEE8; }
.mz-portrait img { width: 100%; height: 100%; object-fit: cover; }
.mz-person__name { margin-top: 12px; font-size: 17px; font-weight: 600; letter-spacing: .14em; }
.mz-person__en { font-size: 11px; letter-spacing: .16em; color: var(--ink-soft); line-height: 1.6; }
.mz-person--gold .mz-person__name { border-bottom: 2px solid var(--gold); padding-bottom: 4px; }
.mz-person--red .mz-person__name { border-bottom: 2px solid var(--red); padding-bottom: 4px; }
.mz-person__prof { margin-top: 10px; font-size: 13px; line-height: 1.95; text-align: left; overflow-wrap: anywhere; }

/* 家族 */
.mz-family { margin: 0 auto 44px; }
.mz-family + .mz-ad { margin: 0 auto 44px; }
.mz-family__title { margin-bottom: 22px; font-size: 22px; font-weight: 500; letter-spacing: .3em; }
.mz-family--gold .mz-family__title, .mz-family--gold .mz-members__rel { color: var(--gold-deep); }
.mz-family--red .mz-family__title, .mz-family--red .mz-members__rel { color: var(--red-deep); }
.mz-members { display: grid; grid-template-columns: 1fr 1fr; gap: 30px 14px; }
.mz-members__rel { margin-bottom: 8px; font-size: 18px; font-weight: 500; line-height: 1; }
.mz-photo {
  width: 108px;
  aspect-ratio: 1;
  margin: 0 auto 12px;
  border-radius: 50%;
  overflow: hidden;
  background: #F1EEE8;
}
.mz-photo img { width: 100%; height: 100%; object-fit: cover; }
.mz-members__name { font-size: 16px; font-weight: 600; letter-spacing: .14em; line-height: 1.6; }
.mz-members__prof { margin-top: 4px; font-size: 12px; line-height: 1.75; color: var(--ink-soft); overflow-wrap: anywhere; }

/* 出会いから今まで。写真と文を左右交互に */
.mz-story { display: grid; gap: 30px; text-align: left; }
.mz-story__item { display: grid; grid-template-columns: 55% 1fr; gap: 14px; align-items: center; }
.mz-story__item:nth-child(even) { grid-template-columns: 1fr 55%; }
.mz-story__item:nth-child(even) .mz-story__photo { order: 2; }
.mz-story__item:nth-child(even) .mz-story__body { text-align: right; }
/* 長い文を右寄せにすると読みにくいので、日付と題だけ右に寄せる */
.mz-story__item:nth-child(even) .mz-story__text { text-align: left; }
.mz-story__item--text { grid-template-columns: 1fr !important; text-align: center; }
.mz-story__item--text .mz-story__body { text-align: center !important; }
.mz-story__photo img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.mz-story__date { font-size: 13px; color: var(--red-deep); letter-spacing: .1em; line-height: 1.7; }
.mz-story__title { font-size: 15px; font-weight: 600; line-height: 1.7; }
.mz-story__text { margin-top: 4px; font-size: 12px; line-height: 1.85; overflow-wrap: anywhere; }

/* 思い出 */
.mz-gallery { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.mz-gallery li:first-child { grid-column: 1 / -1; }
.mz-gallery figure { position: relative; overflow: hidden; cursor: zoom-in; }
.mz-gallery img { width: 100%; aspect-ratio: 1; object-fit: cover; transition: transform .8s var(--ease); }
.mz-gallery li:first-child img { aspect-ratio: 4 / 3; }
.mz-gallery figure:hover img { transform: scale(1.04); }
.mz-gallery figcaption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 18px 10px 8px;
  font-size: 12px;
  line-height: 1.5;
  color: #fff;
  text-align: left;
  background: linear-gradient(transparent, rgba(40, 32, 30, .55));
}
.mz-gallery__ad { grid-column: 1 / -1; display: flex; justify-content: center; padding: 16px 0; }

/* 拡大表示 */
.mz-lightbox {
  max-width: min(92vw, 640px);
  padding: 0;
  border: 0;
  background: var(--paper);
  color: var(--ink);
}
.mz-lightbox::backdrop { background: rgba(40, 32, 30, .78); }
.mz-lightbox img { width: 100%; max-height: 78vh; object-fit: contain; background: #222; }
.mz-lightbox p { padding: 10px 16px 14px; font-size: 14px; text-align: center; }
.mz-lightbox p:empty { display: none; }
.mz-lightbox__close {
  position: absolute;
  top: 6px;
  right: 8px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: rgba(251, 250, 247, .85);
  color: var(--ink);
  font-size: 24px;
  line-height: 36px;
  cursor: pointer;
}

/* 結び */
.mz-footer { position: relative; padding: 24px 28px 64px; text-align: center; }
.mz-footer .mz-rule { margin: 0 0 40px; }
/* 他のテーマと同じロゴ。書体は bloom と同じ M+ 1c Thin のサブセット（4KB・この名前の字だけ入っている） */
@font-face {
  font-family: 'mz-mplus';
  src: url("../fonts/mplus-1c-thin.5223838dc4ed.ttf") format('truetype');
}
.mz-footer__brand { display: inline-flex; align-items: center; gap: 0; text-decoration: none; color: #000 !important; }
.mz-footer__brand img { width: 18px; height: auto; }
.mz-footer__brand span { font-family: 'mz-mplus', Arial, serif; font-size: 16px; letter-spacing: 0; }

/* ───── プレビュー（編集中の確認画面）─────
 *
 *  上の「マイページへ」は form/css/common_style.css が作る。
 *  下の「編集」「共有用ページ」は、このテーマが Bootstrap を読まないので、ここで形を付ける。
 */
.mz--preview { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
.mz .header {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 100;
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  background: rgba(251, 250, 247, .92);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  border-top: 1px solid var(--line);
}
.mz .header .btn {
  flex: 1;
  max-width: 240px;
  padding: 10px 12px;
  border: 1px solid var(--red);
  background: var(--red);
  color: #fff;
  font-family: var(--serif);
  font-size: 14px;
  line-height: 1.4;
  letter-spacing: .1em;
  text-align: center;
  text-decoration: none;
}
.mz .header .preview-btn { background: #fff; color: var(--red-deep); }

/* プレビューのときのヘッダー（common_style.css）と重ならないように */
.header-top + .header + .mz-page .mz-cover { padding-top: 102px; padding-bottom: 102px; }
.header-top + .header + .mz-page .mz-noshi { top: calc(3vh + 50px); }

/* ───── 動き ─────
 *
 *  html.js のときだけ「出現前」にする。JS が読めない環境では最初から全部見える。
 *  動きを減らす設定の端末では一切動かさない（末尾）。
 */

.js .reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 1s var(--ease), transform 1s var(--ease);
  transition-delay: calc(var(--i, 0) * 90ms);
}
.js .reveal.is-in { opacity: 1; transform: none; }

/* 見出し。字間を詰めながら現れ、そのあと水引の線が真ん中から左右へ伸びる */
.js .mz-heading.reveal { transform: none; }
.js .mz-heading span { letter-spacing: .7em; transition: letter-spacing 1.6s var(--ease); }
.js .mz-heading.is-in span { letter-spacing: .3em; }
.js .mz-heading::after { clip-path: inset(0 50% 0 50%); transition: clip-path 1.6s var(--brush) .5s; }
.js .mz-heading.is-in::after { clip-path: inset(0 0 0 0); }

/* 表紙。熨斗と水引はその場で一度に現れる（端から描いたり動かしたりすると、画像らしさが目立つため）。
 * 題字だけは上から書かれる */
.js .mz-noshi, .js .mz-band { opacity: 0; }
.js .mz-cover__title span { clip-path: inset(-10% -20% 100% -20%); }
.js .mz-cover__families { opacity: 0; transform: translateY(12px); }

.mz-noshi { transition: opacity 1.6s var(--ease) .2s; }
.mz-cover__title span { transition: clip-path 2.4s var(--brush) .6s; }
.mz-band { transition: opacity 1.6s var(--ease) 1.8s; }
.mz-cover__families { transition: opacity 1.4s var(--ease) 3s, transform 1.4s var(--ease) 3s; }

.js.is-ready .mz-noshi, .js.is-ready .mz-band { opacity: 1; }
.js.is-ready .mz-cover__title span { clip-path: inset(-10% -20% -10% -20%); }
.js.is-ready .mz-cover__families { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .mz *, .mz *::before, .mz *::after { animation: none !important; transition: none !important; }
  .js .reveal, .js .mz-noshi, .js .mz-band,
  .js .mz-cover__families { opacity: 1 !important; transform: none !important; }
  .js .mz-cover__title span, .js .mz-heading::after { clip-path: none !important; }
  .js .mz-heading span { letter-spacing: .3em !important; }
}
