/*
 *  赤い糸（theme 6）
 *
 *  白い紙に、えんじ1色の線画（赤い糸で結ばれた手・着物のふたり・指輪・扇）。
 *  三つ折りの顔合わせしおりの組みを、スマホの縦スクロールに直したもの。
 *  PC では中央に紙面の幅（--page）で置く。Bootstrap などの既成の CSS は読まない。
 *
 *  見出しは筆記体の英字（Meddon）に日本語を小さく添える。
 *  線画（form/static/akaito/images/）は画像AIで作り、白地を透過にして
 *  色を --red（#8A1621）の1色に揃えた WebP。
 */

:root {
  --paper: #FFFFFF;
  --ink: #3A3434;
  --ink-soft: #77706F;
  --red: #8A1621;
  --red-soft: #B5646B;
  --line: #E9E4E2;
  --page: 480px;
  --serif: 'Zen Old Mincho', 'Hiragino Mincho ProN', 'Yu Mincho', serif;
  --script: 'Meddon', cursive;
  --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.ak {
  margin: 0;
  background: #F1EEEC;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 15px;
  line-height: 2;
  letter-spacing: .12em;
  -webkit-font-smoothing: antialiased;
}

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

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

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

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

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

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

/* 赤い糸の手。紙面の幅いっぱいに置き、腕と袖を左右の端まで通す */
.ak-thread {
  width: calc(100% + 48px);
  max-width: none !important;
  margin: 0 -24px;
  pointer-events: none;
}

.ak-cover__families {
  display: flex;
  justify-content: center;
  gap: 1.2em;
  align-self: start;
  margin-top: 4vh;
  font-size: min(22px, 2.8vh);
  line-height: 1;
  letter-spacing: .2em;
}

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

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

.ak-section {
  position: relative;
  padding: 64px 28px;
  text-align: center;
}
.ak-section--tint { background: #FAF6F5; }

/* 見出し。筆記体の英字と、その下に小さな日本語 */
.ak-heading { margin-bottom: 36px; font-weight: 400; }
.ak-heading__en {
  display: block;
  font-family: var(--script);
  font-size: 30px;
  line-height: 1.5;
  letter-spacing: 0;
  color: var(--red);
}
.ak-heading__ja {
  display: block;
  font-size: 12px;
  line-height: 1.8;
  letter-spacing: .3em;
  padding-left: .3em;   /* 字間の分だけ右へずれるのを戻す */
}

.ak-text { font-size: 14px; line-height: 2.4; }

/* 本日の流れ */
.ak-venue { margin-bottom: 36px; }
.ak-venue__date { font-size: 20px; letter-spacing: .08em; line-height: 1.5; }
.ak-venue__date small { font-size: 13px; }
.ak-venue__time { display: block; font-size: 16px; color: var(--ink-soft); }
.ak-venue__name { margin-top: 14px; font-size: 17px; font-weight: 600; }
.ak-venue__address { font-size: 12px; color: var(--ink-soft); line-height: 1.8; }

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

/* 当日の予定と今後の予定。ボタニカルと同じく、時刻・日付の列を揃えて左寄せにし、点線で区切る */
.ak-list { max-width: 300px; margin: 0 auto; }
.ak-list > div {
  display: flex;
  gap: 16px;
  padding: 12px 4px;
  border-bottom: 1px dashed var(--line);
  text-align: left;
}
.ak-list dt { flex: 0 0 7.5em; color: var(--red); letter-spacing: .08em; white-space: nowrap; }
.ak-list dd { margin: 0; flex: 1; text-align: left; }
/* 時刻・日付が未入力の行は列を詰める（空の列の分だけ予定が右へずれるため） */
.ak-list dt:empty { display: none; }

/* 指輪・扇。見本の三つ折りの隅に置かれた小さな線画 */
.ak-ornament { width: 76px; margin-top: 36px; }
.ak-ornament--left { margin-right: auto; }
.ak-ornament--right { margin-left: auto; width: 70px; }

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

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

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

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

/* 家族紹介。家の名前の左右に細い線 */
.ak-family { margin: 0 auto 44px; }
.ak-family + .ak-ad { margin: 0 auto 44px; }
.ak-family__title {
  display: flex;
  align-items: center;
  gap: 1.2em;
  margin-bottom: 26px;
  font-size: 15px;
  font-weight: 400;
  letter-spacing: .2em;
}
.ak-family__title::before,
.ak-family__title::after { content: ''; flex: 1; height: 1px; background: var(--ink); }
.ak-members { display: grid; grid-template-columns: 1fr 1fr; gap: 28px 16px; }
.ak-photo {
  width: 96px;
  aspect-ratio: 1;
  margin: 0 auto 10px;
  border-radius: 50%;
  overflow: hidden;
  background: #F3F0EF;
}
.ak-photo img { width: 100%; height: 100%; object-fit: cover; }
.ak-members__name { font-size: 14px; letter-spacing: .14em; line-height: 1.7; }
.ak-members__rel { margin-right: .8em; color: var(--red); }
.ak-members__rel:empty { display: none; }
.ak-members__prof { margin-top: 4px; font-size: 12px; line-height: 1.85; color: var(--ink-soft); overflow-wrap: anywhere; }

.ak-closing { margin-top: 8px; font-size: 14px; line-height: 2.2; }
#family .ak-ornament { margin-top: 20px; }

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

/* 思い出。見本のように大小を組み合わせる。
 * 3枚で1組（大1・小2）にし、大きい写真を左・右と交互に置く。
 * 枚数が3の倍数でないときは、最後の写真を広げて隙間を埋める。
 * 広告の li を数えないよう、:nth-child(... of .ak-gallery__photo) で数える */
.ak-gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-flow: dense;
  gap: 5px;
}
.ak-gallery__photo:nth-child(6n + 1 of .ak-gallery__photo) { grid-column: 1 / span 2; grid-row: span 2; }
.ak-gallery__photo:nth-child(6n + 4 of .ak-gallery__photo) { grid-column: 2 / span 2; grid-row: span 2; }
/* 1組の最初の1枚だけが残ったら、横いっぱいに */
.ak-gallery__photo:nth-child(3n + 1 of .ak-gallery__photo):nth-last-child(1 of .ak-gallery__photo) { grid-column: 1 / -1; grid-row: auto; }
.ak-gallery__photo:nth-child(3n + 1 of .ak-gallery__photo):nth-last-child(1 of .ak-gallery__photo) img { aspect-ratio: 3 / 2; }
/* 大1・小1で終わったら、小を縦に2段ぶん伸ばす */
.ak-gallery__photo:nth-child(3n + 2 of .ak-gallery__photo):nth-last-child(1 of .ak-gallery__photo) { grid-row: span 2; }
.ak-gallery figure { position: relative; height: 100%; overflow: hidden; cursor: zoom-in; }
.ak-gallery img { width: 100%; height: 100%; aspect-ratio: 1; object-fit: cover; transition: transform .8s var(--ease); }
.ak-gallery figure:hover img { transform: scale(1.04); }
.ak-gallery figcaption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 16px 8px 6px;
  font-size: 11px;
  line-height: 1.5;
  letter-spacing: .04em;
  color: #fff;
  text-align: left;
  background: linear-gradient(transparent, rgba(40, 30, 30, .55));
}
.ak-gallery__ad { grid-column: 1 / -1; grid-row: auto !important; display: flex; justify-content: center; padding: 16px 0; }

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

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

/* ───── プレビュー（編集中の確認画面）─────
 *
 *  上の「マイページへ」は form/css/common_style.css が作る。
 *  下の「編集」「共有用ページ」は、このテーマが Bootstrap を読まないので、ここで形を付ける。
 */
.ak--preview { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
.ak .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(255, 255, 255, .92);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  border-top: 1px solid var(--line);
}
.ak .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;
}
.ak .header .preview-btn { background: #fff; color: var(--red); }

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

/* ───── 動き ─────
 *
 *  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 .ak-heading.reveal { transform: none; }
.js .ak-heading__en { clip-path: inset(-20% 100% -20% 0); transition: clip-path 1.6s var(--brush); }
.js .ak-heading__ja { opacity: 0; transition: opacity 1s var(--ease) 1s; }
.js .ak-heading.is-in .ak-heading__en { clip-path: inset(-20% -5% -20% 0); }
.js .ak-heading.is-in .ak-heading__ja { opacity: 1; }

/* 表紙。題字は上から書かれ、そのあと赤い糸の手がその場で現れる
 * （端から描いたり動かしたりすると、画像らしさが目立つため。水引と同じ） */
.js .ak-thread { opacity: 0; }
.js .ak-cover__title span { clip-path: inset(-10% -20% 100% -20%); }
.js .ak-cover__families { opacity: 0; transform: translateY(12px); }

.ak-cover__title span { transition: clip-path 2.4s var(--brush) .3s; }
.ak-thread { transition: opacity 1.8s var(--ease) 1.6s; }
.ak-cover__families { transition: opacity 1.4s var(--ease) 2.8s, transform 1.4s var(--ease) 2.8s; }

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

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .ak *, .ak *::before, .ak *::after { animation: none !important; transition: none !important; }
  .js .reveal, .js .ak-thread, .js .ak-heading__ja,
  .js .ak-cover__families { opacity: 1 !important; transform: none !important; }
  .js .ak-cover__title span, .js .ak-heading__en { clip-path: none !important; }
}
