/*
 *  のし紙の帯と紅の水引を表紙に置くテーマ（いろは・椿・紺・桜・菊・若竹）に共通の見た目。
 *  本体は form/templates/form/noshi/main.html。
 *
 *  テーマごとに違うのは色だけで、各テーマの theme.css が .ns--<slug> に下の変数を入れる。
 *  表紙の帯の後ろの柄と区切りの帯は、テーマの art.html・strip.html（SVG の図形）。
 *  PC では中央に紙面の幅（--page）で置く。Bootstrap などの既成の CSS は読まない。
 *  書体は本文・見出し・表紙ともしっぽり明朝。見出しの文字は水引（theme 5）と同じ（日本語だけ）。下に短い線。
 *
 *  変数（既定値はいろは）
 *    --paper        紙面の地         --body-bg   紙面の外（PC の左右）
 *    --ink          文字             --ink-soft  控えめな文字
 *    --accent       見出しの線・時刻・ボタンなど   --line  罫線
 *    --tint         協賛の欄の地     --photo-bg  写真が読み込まれる前の地
 *    --cover-bg     表紙の柄が出る前の地
 *    --band-shadow  表紙の帯の下の影（背景の柄に合わせて濃さを変える）
 */

:root {
  --paper: #FBF7EE;
  --body-bg: #EDE6D7;
  --ink: #3D4A40;
  --ink-soft: #7A7D70;
  --accent: #BE4A3A;
  --line: #E4DAC6;
  --tint: #F5EEDF;
  --photo-bg: #F1EADB;
  --cover-bg: #F3EAD6;
  --band: #EDE8DF;
  --band-shadow: rgba(110, 96, 75, .28);
  --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.ns {
  margin: 0;
  background: var(--body-bg);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 15px;
  line-height: 2;
  letter-spacing: .12em;
  -webkit-font-smoothing: antialiased;
}

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

.ns-page {
  position: relative;
  max-width: var(--page);
  margin: 0 auto;
  background: var(--paper);
  overflow: hidden;
  box-shadow: 0 0 40px rgba(61, 74, 64, .1);
}

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

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

/* 柄・図形の定義だけの <svg>（noshi/defs.html と各テーマの patterns.html）。display: none にすると柄が描かれなくなるので、見えない所へ置く */
.ns-defs { position: absolute; width: 0; height: 0; overflow: hidden; }

.ns-cover {
  position: relative;
  height: 100vh;
  height: 100svh;
  min-height: 560px;
  overflow: hidden;
  background: var(--cover-bg);
}
/* 縦横比が違っても、水引（viewBox の上下の真ん中）が画面の真ん中に来る（slice） */
.ns-cover__art { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.ns-band { fill: var(--band); }
.ns-band-shadow { fill: var(--band-shadow); }

/* 題字は水引の上、家の名前は水引の下。どちらも左に寄せる。
 * 題字の大きさは、幅 320px の画面でも右の梅結び（viewBox の x=342）との間が 16px 以上空くようにしてある */
.ns-cover__title,
.ns-cover__families {
  position: absolute;
  left: 22px;
  font-weight: 500;
  line-height: 1.3;
  white-space: nowrap;
}
.ns-cover__title {
  bottom: calc(50% + 16px);
  font-size: min(26px, 6.4vw);
  letter-spacing: .14em;
}
.ns-cover__title span { display: inline-block; }
.ns-cover__families {
  top: calc(50% + 20px);
  display: flex;
  gap: 1em;
  font-size: min(22px, 5.6vw);
  letter-spacing: .2em;
}

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

.ns-section {
  position: relative;
  padding: 64px 28px;
  text-align: center;
}
.ns-section--tint { background: var(--tint); }

/* 見出し。文字は水引（form/static/mizuhiki/css/theme.css）と同じ。下には水引のような短い紅の線 */
.ns-heading {
  margin-bottom: 40px;
  font-size: 20px;
  font-weight: 500;
  line-height: 1.6;
  letter-spacing: .3em;
}
.ns-heading span { display: inline-block; padding-left: .3em; }   /* 字間の分だけ右へずれるのを戻す */
.ns-heading::after {
  content: '';
  display: block;
  width: 28px;
  height: 3px;
  margin: 16px auto 0;
  border-radius: 2px;
  background: var(--accent);
}

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

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

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

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

/* 区切りの帯。表紙と同じ柄（strip.html） */
.ns-strip { display: block; width: 100%; height: 20px; }

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

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

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

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

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

.ns-closing { margin-top: 8px; font-size: 14px; line-height: 2.2; }

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

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

/* 拡大表示 */
.ns-lightbox {
  max-width: min(92vw, 640px);
  padding: 0;
  border: 0;
  background: var(--paper);
  color: var(--ink);
}
.ns-lightbox::backdrop { background: rgba(40, 36, 30, .78); }
.ns-lightbox img { width: 100%; max-height: 78vh; object-fit: contain; background: #222; }
.ns-lightbox p { padding: 10px 16px 14px; font-size: 14px; text-align: center; }
.ns-lightbox p:empty { display: none; }
.ns-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;
}

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

/* ───── プレビュー（編集中の確認画面）─────
 *
 *  上の「マイページへ」は form/css/common_style.css が作る。
 *  下の「編集」「共有用ページ」は、このテーマが Bootstrap を読まないので、ここで形を付ける。
 */
.ns--preview { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
.ns .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);
}
.ns .header .btn {
  flex: 1;
  max-width: 240px;
  padding: 10px 12px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  font-family: var(--serif);
  font-size: 14px;
  line-height: 1.4;
  letter-spacing: .1em;
  text-align: center;
  text-decoration: none;
}
.ns .header .preview-btn { background: #fff; color: var(--accent); }


/* ───── 動き ─────
 *
 *  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 .ns-heading.reveal { transform: none; }
.js .ns-heading span { letter-spacing: .7em; transition: letter-spacing 1.6s var(--ease); }
.js .ns-heading.is-in span { letter-spacing: .3em; }
.js .ns-heading::after { transform: scaleX(0); transition: transform .8s var(--ease) .8s; }
.js .ns-heading.is-in::after { transform: none; }

/* 表紙。のし紙の帯は最初から置いておき、まわりにテーマの柄（.ns-tile）が順に置かれる。
 * そのあと水引が左から渡されて梅結びが開き、題字が左から書かれ、家の名前が現れる。
 * （帯を半透明から濃くすると、途中で下の柄が透けて霧のように見えるため、帯は動かさない） */
.ns-tile, .ns-knot { transform-box: fill-box; transform-origin: center; }
.js .ns-tile { opacity: 0; transform: scale(.92); }
.js .ns-cord { stroke-dasharray: 100; stroke-dashoffset: 100; }
.js .ns-knot { opacity: 0; transform: scale(.3) rotate(-120deg); }
.js .ns-cover__title span { clip-path: inset(-20% 100% -20% 0); }
.js .ns-cover__families { opacity: 0; transform: translateY(10px); }

.ns-tile { transition: opacity .7s var(--ease), transform .7s var(--ease); transition-delay: calc(var(--i, 0) * 35ms); }
.ns-cord { transition: stroke-dashoffset 1.3s var(--brush) .9s; }
.ns-knot { transition: opacity .6s var(--ease) 2s, transform 1s cubic-bezier(.34, 1.56, .64, 1) 2s; }
.ns-cover__title span { transition: clip-path 2s var(--brush) 2.4s; }
.ns-cover__families { transition: opacity 1.2s var(--ease) 3.8s, transform 1.2s var(--ease) 3.8s; }

.js.is-ready .ns-tile { opacity: 1; transform: none; }
.js.is-ready .ns-cord { stroke-dashoffset: 0; }
.js.is-ready .ns-knot { opacity: 1; transform: none; }
.js.is-ready .ns-cover__title span { clip-path: inset(-20% -5% -20% 0); }
.js.is-ready .ns-cover__families { opacity: 1; transform: none; }

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