/* 모두의 청첩장 하객 화면 (src/invite/page.ts가 이 파일과 view.js를 부른다) */
/* 레이아웃: 폰 한 장 폭(최대 440px) 종이 한 장을 위에서 아래로 넘기는 청첩장. 섹션마다 넉넉한 여백, 장식은 커버 하나에만 */
:root {
  --frame: #DDE3DA;   /* 폰 밖 여백 */
  --paper: #EEF1EC;   /* 회녹색 종이 */
  --card: #F8FAF6;
  --ink: #23302B;
  --sub: #5F6B64;
  --line: #D5DCD3;
  --olive: #5E6B4E;   /* 포인트 */
  --rose: #B97C7C;    /* 날짜·하트에만 */
  --display: "Gowun Batang", "Nanum Myeongjo", serif;
  --body: "Noto Sans KR", system-ui, sans-serif;
  --latin: "Cormorant Garamond", Georgia, serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--frame); color: var(--ink); font-family: var(--body); font-size: 15px; line-height: 1.7; }
.sheet { max-width: 440px; margin: 0 auto; background: var(--paper); min-height: 100%; overflow: hidden; }
section { padding: 56px 24px; text-align: center; }
section + section { border-top: 1px solid var(--line); }
.eyebrow { font-family: var(--latin); font-style: italic; font-size: 19px; color: var(--olive); letter-spacing: .04em; }
h2 { font-family: var(--display); font-weight: 700; font-size: 22px; margin: 6px 0 22px; text-wrap: balance; }
p { margin: 0; }
.muted { color: var(--sub); font-size: 14px; }
button { font: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--olive); outline-offset: 3px; }


/* 커버 */
.cover { padding: 0 0 40px; border: 0; }
.cover canvas, .cover .cover-img { display: block; width: 100%; aspect-ratio: 4 / 5; max-width: 100%; }
.cover .names { font-family: var(--display); font-size: 30px; margin-top: 30px; letter-spacing: .06em; }
.cover .names span { color: var(--rose); font-size: 20px; margin: 0 12px; vertical-align: 4px; }
.cover .when { margin-top: 10px; font-size: 15px; }
.cover .where { color: var(--sub); font-size: 14px; }
.cover .date-latin { font-family: var(--latin); font-style: italic; font-size: 22px; color: var(--olive); margin-top: 18px; }

/* 인사말 + AI 문구 */
.greet p.text { font-family: var(--display); font-size: 16px; line-height: 2.1; white-space: pre-line; }
.ai { margin-top: 28px; display: inline-flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.ai small { width: 100%; color: var(--sub); font-size: 12px; }
.ai button { border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 999px; padding: 6px 14px; font-size: 13px; }
.ai button[aria-pressed="true"] { background: var(--olive); color: var(--card); border-color: var(--olive); }
.family { margin-top: 34px; display: grid; gap: 6px; font-size: 15px; }
.family b { font-family: var(--display); font-size: 17px; margin-left: 6px; }

/* 달력 */
.cal { max-width: 300px; margin: 0 auto; }
.cal .month { font-family: var(--latin); font-style: italic; font-size: 22px; color: var(--olive); }
.cal table { width: 100%; border-collapse: collapse; margin-top: 12px; font-variant-numeric: tabular-nums; }
.cal th { font-weight: 500; font-size: 12px; color: var(--sub); padding: 6px 0; }
.cal th:first-child, .cal td:first-child { color: var(--rose); }
.cal td { padding: 7px 0; font-size: 14px; }
.cal td.day span { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--rose); color: var(--card); font-weight: 700; }
.dday { margin-top: 22px; font-size: 15px; }
.dday b { color: var(--rose); font-size: 18px; }

/* 갤러리 */
.gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.gallery button { border: 0; padding: 0; background: none; }
.gallery canvas { display: block; width: 100%; aspect-ratio: 1; max-width: 100%; }
.gallery button:first-child { grid-column: span 2; grid-row: span 2; }
.lightbox { position: fixed; inset: 0; z-index: 10; background: rgba(20, 26, 23, .92); display: grid; place-items: center; padding: 24px; }
.lightbox canvas { width: min(100%, 420px); aspect-ratio: 4 / 5; max-width: 100%; }
.lightbox p { color: #E6EBE4; font-size: 13px; margin-top: 12px; text-align: center; }

/* 오시는 길 */
.map { background: var(--card); border: 1px solid var(--line); border-radius: 6px; aspect-ratio: 16 / 9; max-width: 100%; display: grid; place-items: center; color: var(--sub); font-size: 13px; }
.addr { margin-top: 18px; font-family: var(--display); font-size: 17px; }
.links { margin-top: 14px; display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.links a { text-decoration: none; color: var(--ink); border: 1px solid var(--line); background: var(--card); border-radius: 6px; padding: 8px 14px; font-size: 13px; }
.route { margin-top: 26px; text-align: left; display: grid; gap: 14px; font-size: 14px; }
.route b { display: block; font-size: 13px; color: var(--olive); letter-spacing: .02em; }

/* 참석 여부 */
form { text-align: left; display: grid; gap: 14px; background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 22px 18px; }
label { font-size: 13px; color: var(--sub); display: grid; gap: 6px; }
input, select, textarea { font: inherit; font-size: 15px; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; width: 100%; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.seg button { border: 1px solid var(--line); background: var(--paper); color: var(--ink); border-radius: 6px; padding: 10px; }
.seg button[aria-pressed="true"] { background: var(--olive); color: var(--card); border-color: var(--olive); }
.submit { border: 0; background: var(--ink); color: var(--card); border-radius: 6px; padding: 13px; font-weight: 700; }
.done { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 26px 18px; font-family: var(--display); font-size: 16px; }
.tally { margin-top: 16px; font-size: 12px; color: var(--sub); }

/* 계좌 */
details { text-align: left; background: var(--card); border: 1px solid var(--line); border-radius: 8px; }
details + details { margin-top: 10px; }
summary { padding: 14px 16px; font-weight: 500; cursor: pointer; list-style: none; display: flex; justify-content: space-between; }
summary::after { content: "열기"; color: var(--sub); font-size: 12px; }
details[open] summary::after { content: "접기"; }
.acc { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--line); font-size: 14px; }
.acc div { flex: 1; min-width: 0; }
.acc small { display: block; color: var(--sub); font-size: 12px; }
.acc button { border: 1px solid var(--line); background: var(--paper); color: var(--ink); border-radius: 6px; padding: 6px 10px; font-size: 12px; white-space: nowrap; }

/* 방명록 */
.notes { display: grid; gap: 10px; text-align: left; margin-top: 18px; }
.note { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; }
.note b { font-size: 13px; }
.note p { font-size: 14px; margin-top: 4px; }
.write { display: grid; grid-template-columns: 1fr auto; gap: 6px; }
.write input:first-child { grid-column: 1 / -1; }
.write button { border: 0; background: var(--olive); color: var(--card); border-radius: 6px; padding: 0 16px; }

footer { padding: 34px 24px 44px; text-align: center; font-size: 12px; color: var(--sub); border-top: 1px solid var(--line); }
footer a { color: var(--olive); }
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--ink); color: var(--card); padding: 9px 16px; border-radius: 999px; font-size: 13px; z-index: 20; }
/* ── 움직임 (모션 연구 1단계): 시간 120/220/420ms, 들어올 땐 ease-out, 멈출 땐 스프링 ── */
:root { --m-out: cubic-bezier(.2, .7, .2, 1); --m-spring: cubic-bezier(.2, .9, .25, 1.15); }
@supports (transition-timing-function: linear(0, 1)) { :root { --m-spring: linear(0, .006, .025 2.8%, .101 6.1%, .539 18.9%, .721 25.3%, .849 31.5%, .937 38.1%, .968 41.8%, .991 45.7%, 1.006 50.1%, 1.015 55%, 1.017 63.9%, 1.001); } }
.cover .names i.chs, .cover .names i.ch { font-style: inherit; }
.cover .names i.ch { display: inline-block; }
@media (prefers-reduced-motion: no-preference) {
  /* 첫 화면 이름: 한 글자씩 흐림 → 또렷 */
  .sheet.rev .cover .names .ch, .sheet.rev .cover .names .chx { animation: m-blur 820ms var(--m-out) both; animation-delay: calc(var(--i) * 55ms + 120ms); }
  .sheet.rev .cover .date-latin, .sheet.rev .cover .bigdate { animation: m-up 760ms var(--m-out) both; }
  .sheet.rev .cover .when, .sheet.rev .cover .where, .sheet.rev .cover .badge { animation: m-up 700ms var(--m-out) both; animation-delay: 680ms; }
  /* 달력의 그날: 동그라미가 그려지고 날짜가 톡 */
  .cal td.day.pre .ring circle { stroke-dashoffset: 126; }
  .cal td.day.pre span { transform: scale(.55); opacity: 0; }
  .cal td.day.drawn .ring circle { transition: stroke-dashoffset 1s var(--m-out) .25s; }
  .cal td.day.drawn span { transition: transform 620ms var(--m-spring), opacity 220ms; }
  /* 화면이 아래에서 차례로 들어오기 (스크롤 연동을 지원하는 브라우저만, 펼친 화면은 제외) */
  @supports (animation-timeline: view()) {
    @media (max-width: 699.98px) {
      .sheet:not(.bugo) > section:not(.cover) > * { animation: m-in linear both; animation-timeline: view(); animation-range: entry 0px entry 180px; }
    }
  }
}
@keyframes m-blur { from { opacity: 0; filter: blur(10px); transform: translateY(10px) scale(1.08); } }
@keyframes m-up { from { opacity: 0; transform: translateY(8px); } }
@keyframes m-in { from { opacity: 0; transform: translateY(26px); } }
.cal td.day { position: relative; }
.cal td.day .ring { position: absolute; left: 50%; top: 50%; width: 44px; height: 44px; transform: translate(-50%, -50%) rotate(-90deg); overflow: visible; pointer-events: none; }
.cal td.day .ring circle { fill: none; stroke: var(--rose); stroke-width: 1.2; stroke-dasharray: 126; stroke-dashoffset: 0; }
.cal td.day span { position: relative; }

/* 템플릿: 같은 내용에 색·글꼴·배치만 바꾼다 */
.sheet[data-tpl="modern"] { --paper: #FAFAF8; --card: #FFFFFF; --ink: #1C1C1C; --sub: #6B6B6B; --line: #E4E4E0; --olive: #1C1C1C; --rose: #1C1C1C; --display: "Noto Serif KR", serif; }
.sheet[data-tpl="modern"] section { text-align: left; }
.sheet[data-tpl="modern"] .cal, .sheet[data-tpl="modern"] .links { margin-left: 0; justify-content: flex-start; }
.sheet[data-tpl="romantic"] { --paper: #F7ECEA; --card: #FCF6F4; --ink: #3B2A2A; --sub: #7E6662; --line: #EBD6D2; --olive: #A35D5D; --rose: #C77F7F; --display: "Nanum Myeongjo", serif; }
.sheet { background: var(--paper); color: var(--ink); transition: background .3s; }
/* 커버 배치 */
.cover[data-layout="arch"] canvas { width: calc(100% - 64px); margin: 32px auto 0; border-radius: 999px 999px 0 0; }
.cover[data-layout="frame"] canvas { width: calc(100% - 48px); margin: 24px auto 0; outline: 1px solid var(--line); outline-offset: 8px; }
/* 갤러리 배치 */
.gallery[data-layout="slide"] { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: 8px; margin-inline: -24px; padding-inline: 24px; }
.gallery[data-layout="slide"] button { flex: 0 0 78%; scroll-snap-align: center; }
.gallery[data-layout="slide"] button:first-child { grid-column: auto; grid-row: auto; }
.gallery[data-layout="slide"] canvas { aspect-ratio: 4 / 5; }
.gallery[data-layout="collage"] { grid-template-columns: 1fr 1fr; gap: 8px; }
.gallery[data-layout="collage"] button:first-child { grid-column: 1 / -1; grid-row: auto; }
.gallery[data-layout="collage"] button:nth-child(3n+2) canvas, .gallery[data-layout="collage"] button:nth-child(3n) canvas { aspect-ratio: 3 / 4; }
.gallery[data-layout="collage"] button:first-child canvas { aspect-ratio: 16 / 10; }
/* 꾸미기 패널 (만드는 사람 화면 미리보기) */
[hidden] { display: none !important; }

/* 효과 오버레이와 음악 버튼 */
#fx { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 4; }
.music { position: fixed; top: calc(14px + env(safe-area-inset-top, 0px)); right: 14px; z-index: 6; border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 999px; padding: 6px 12px; font-size: 12px; box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.music[aria-pressed="true"] { background: var(--olive); color: var(--card); border-color: var(--olive); }

/* 결혼 전·당일·후 모드 */
.sheet[data-mode="before"] [data-show]:not([data-show~="before"]),
.sheet[data-mode="day"] [data-show]:not([data-show~="day"]),
.sheet[data-mode="after"] [data-show]:not([data-show~="after"]) { display: none; }
.personal { margin: 0 auto 26px; max-width: 320px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; font-family: var(--display); font-size: 16px; line-height: 1.8; }
.personal small { display: block; font-family: var(--body); font-size: 12px; color: var(--sub); margin-top: 6px; }
.badge { display: inline-block; background: var(--rose); color: var(--card); font-size: 12px; font-weight: 700; border-radius: 999px; padding: 3px 12px; margin-bottom: 12px; }
.timeline { text-align: left; display: grid; gap: 0; margin-top: 8px; }
.timeline div { display: grid; grid-template-columns: 64px 1fr; gap: 12px; padding: 12px 0; border-bottom: 1px dashed var(--line); font-size: 15px; font-variant-numeric: tabular-nums; }
.timeline time { color: var(--sub); }
.timeline .now { color: var(--rose); font-weight: 700; }
.timeline .now time { color: var(--rose); }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 18px; text-align: left; }
.facts p { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; font-size: 13px; }
.facts b { display: block; font-size: 15px; color: var(--ink); }
.upload { margin-top: 22px; display: grid; gap: 10px; }
.upload .upbtn { display: block; background: var(--olive); color: var(--card); border-radius: 8px; padding: 14px; font-size: 15px; font-weight: 700; cursor: pointer; text-align: center; }
.upload input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.shots { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.shots img, .shots canvas { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; max-width: 100%; }
.ledger { width: 100%; border-collapse: collapse; font-size: 14px; text-align: left; font-variant-numeric: tabular-nums; }
.ledger th { font-size: 12px; color: var(--sub); font-weight: 500; padding: 8px 6px; border-bottom: 1px solid var(--line); }
.ledger td { padding: 10px 6px; border-bottom: 1px solid var(--line); }
.ledger td:nth-child(3) { text-align: right; }
.ledger input { width: 18px; height: 18px; accent-color: var(--olive); }
.ledger-sum { display: flex; justify-content: space-between; margin-top: 12px; font-size: 13px; color: var(--sub); }
.quiz { display: grid; gap: 14px; text-align: left; }
.q { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px; }
.q p { font-weight: 500; margin-bottom: 10px; }
.q .opts { display: grid; gap: 6px; }
.q .opts button { text-align: left; border: 1px solid var(--line); background: var(--paper); color: var(--ink); border-radius: 6px; padding: 9px 12px; font-size: 14px; }
.q .opts button.right { background: var(--olive); color: var(--card); border-color: var(--olive); }
.q .opts button.wrong { opacity: .5; text-decoration: line-through; }

.ownerbar { position: sticky; top: 0; z-index: 7; background: var(--ink); color: var(--card); font-size: 12px; text-align: center; padding: 7px 12px; }
.ownerbar a { color: var(--card); font-weight: 700; }
.empty { color: var(--sub); font-size: 13px; }
.cover .cover-img { object-fit: cover; }
.cover[data-layout="arch"] .cover-img { width: calc(100% - 64px); margin: 32px auto 0; border-radius: 999px 999px 0 0; }
.cover[data-layout="frame"] .cover-img { width: calc(100% - 48px); margin: 24px auto 0; outline: 1px solid var(--line); outline-offset: 8px; }
.gallery img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; max-width: 100%; }
.gallery[data-layout="slide"] img { aspect-ratio: 4 / 5; }
.gallery[data-layout="collage"] button:first-child img { aspect-ratio: 16 / 10; }
.gallery[data-layout="collage"] button:nth-child(3n+2) img, .gallery[data-layout="collage"] button:nth-child(3n) img { aspect-ratio: 3 / 4; }
.upload label:not(.upbtn) { text-align: left; }
.share-btns { display: grid; gap: 8px; max-width: 320px; margin: 0 auto; }
.share-btns .kakao { border: 0; background: #FEE500; color: #191919; border-radius: 8px; padding: 13px; font-weight: 700; font-size: 15px; }
.share-btns .ghostbtn { border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 8px; padding: 12px; font-size: 14px; }

/* ── 템플릿 확장 (2026-10-03): 색·글꼴·종이 질감만 바꾼다. 내용 구조는 같다 ── */
.sheet[data-tpl="garden"] { --paper: #F1F5EC; --card: #FBFDF8; --ink: #22362A; --sub: #5A6E5F; --line: #D3E0CC; --olive: #3F6B47; --rose: #D98E73; --display: "Gowun Batang", serif; }
.sheet[data-tpl="garden"] .cover::after { content: ""; display: block; height: 18px; margin: 18px auto 0; width: 120px; background: radial-gradient(circle at 10px 9px, var(--olive) 5px, transparent 6px) 0 0 / 24px 18px repeat-x; opacity: .5; }
.sheet[data-tpl="midnight"] { --paper: #141B2D; --card: #1D263B; --ink: #F2EBDD; --sub: #B6B1A6; --line: #2C3753; --olive: #D8B56A; --rose: #E3C27E; --display: "Noto Serif KR", serif; }
.sheet[data-tpl="midnight"] .names, .sheet[data-tpl="midnight"] h2 { color: #F7E7C1; }
.sheet[data-tpl="midnight"] input, .sheet[data-tpl="midnight"] select { background: #141B2D; color: var(--ink); }
.sheet[data-tpl="hanji"] { --paper: #F4ECDC; --card: #FBF6EA; --ink: #2E2418; --sub: #6E5E49; --line: #E2D3B6; --olive: #9C2F2A; --rose: #9C2F2A; --display: "Song Myung", "Nanum Myeongjo", serif; }
.sheet[data-tpl="hanji"] { background-image: radial-gradient(rgba(120, 90, 50, .05) 1px, transparent 1px); background-size: 6px 6px; }
.sheet[data-tpl="hanji"] section + section { border-top: 0; box-shadow: inset 0 1px 0 var(--line), inset 0 4px 0 var(--paper), inset 0 5px 0 var(--line); }
.sheet[data-tpl="hanji"] .eyebrow { font-family: var(--display); font-style: normal; letter-spacing: .3em; }
.sheet[data-tpl="film"] { --paper: #EFE7DA; --card: #F7F1E6; --ink: #3A2F26; --sub: #7A6A5A; --line: #DED0BC; --olive: #8A5A3B; --rose: #B5654A; --display: "Nanum Myeongjo", serif; }
.sheet[data-tpl="film"] img, .sheet[data-tpl="film"] canvas { filter: sepia(.28) contrast(1.05) saturate(.9); }
.sheet[data-tpl="film"] .gallery img { border: 6px solid #FFFDF8; box-shadow: 0 2px 6px rgba(0,0,0,.12); }
.sheet[data-tpl="letter"] { --paper: #FBF8F1; --card: #FFFFFF; --ink: #2B3340; --sub: #6A7380; --line: #DCE3EC; --olive: #3D5A80; --rose: #E07A5F; --display: "Nanum Pen Script", "Gowun Batang", cursive; }
.sheet[data-tpl="letter"] .greet { background-image: repeating-linear-gradient(transparent 0 33px, var(--line) 33px 34px); }
.sheet[data-tpl="letter"] .greet .text, .sheet[data-tpl="letter"] .names { font-size: 1.25em; }
.sheet[data-tpl="spring"] { --paper: #FFF6F4; --card: #FFFFFF; --ink: #3A2D33; --sub: #85707A; --line: #F6DCE0; --olive: #E58FA1; --rose: #F2A65A; --display: "Gowun Dodum", "Gowun Batang", sans-serif; }
.sheet[data-tpl="spring"] .badge, .sheet[data-tpl="spring"] .cal td.day span { background: var(--olive); }
.sheet[data-tpl="noir"] { --paper: #FFFFFF; --card: #F5F5F5; --ink: #111111; --sub: #666666; --line: #E5E5E5; --olive: #111111; --rose: #111111; --display: "Noto Serif KR", serif; }
.sheet[data-tpl="noir"] img, .sheet[data-tpl="noir"] canvas { filter: grayscale(1) contrast(1.05); }
.sheet[data-tpl="noir"] .names { letter-spacing: .2em; font-weight: 700; }

/* 커버 모양 추가 */
.cover[data-layout="circle"] canvas, .cover[data-layout="circle"] .cover-img { width: 72%; aspect-ratio: 1; margin: 40px auto 0; border-radius: 50%; }
.cover[data-layout="polaroid"] canvas, .cover[data-layout="polaroid"] .cover-img { width: calc(100% - 72px); margin: 36px auto 0; border: 12px solid #FFFFFF; border-bottom-width: 48px; box-shadow: 0 6px 20px rgba(0,0,0,.15); transform: rotate(-2deg); }
/* 갤러리 배치 추가 */
.gallery[data-layout="polaroid"] { grid-template-columns: 1fr 1fr; gap: 14px; padding: 6px; }
.gallery[data-layout="polaroid"] button:first-child { grid-column: auto; grid-row: auto; }
.gallery[data-layout="polaroid"] button { background: #FFFFFF; padding: 6px 6px 20px; box-shadow: 0 3px 10px rgba(0,0,0,.12); }
.gallery[data-layout="polaroid"] button:nth-child(odd) { transform: rotate(-2deg); }
.gallery[data-layout="polaroid"] button:nth-child(even) { transform: rotate(2deg); }

/* 첫 화면 연출 */
.intro { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; background: var(--paper); transition: opacity .8s ease, visibility .8s; }
.intro.gone { opacity: 0; visibility: hidden; }
.intro .env { position: relative; width: 240px; height: 160px; background: var(--card); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 10px 30px rgba(0,0,0,.12); cursor: pointer; }
.intro .env::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 92px; background: var(--paper); border: 1px solid var(--line); border-radius: 8px 8px 0 0; clip-path: polygon(0 0, 100% 0, 50% 100%); transform-origin: top; transition: transform .7s ease; }
.intro.open .env::before { transform: rotateX(180deg); }
.intro .seal { position: absolute; left: 50%; top: 92px; transform: translate(-50%, -50%); width: 46px; height: 46px; border-radius: 50%; background: var(--rose); color: #FFFFFF; display: grid; place-items: center; font-size: 18px; box-shadow: 0 2px 6px rgba(0,0,0,.2); }
.intro p { position: absolute; top: calc(50% + 110px); left: 0; right: 0; text-align: center; font-family: var(--display); color: var(--sub); }
.sheet.zoom .cover canvas, .sheet.zoom .cover .cover-img { animation: coverzoom 9s ease-out both; }
@keyframes coverzoom { from { transform: scale(1.12); } to { transform: scale(1); } }
.sheet.fadein .cover .names, .sheet.fadein .cover .when, .sheet.fadein .cover .where, .sheet.fadein .cover .date-latin { animation: fadeup 1.4s ease both; }
.sheet.fadein .cover .when { animation-delay: .4s; } .sheet.fadein .cover .where { animation-delay: .6s; }
@keyframes fadeup { from { opacity: 0; transform: translateY(14px); } }
@media (prefers-reduced-motion: reduce) { .sheet.zoom .cover canvas, .sheet.zoom .cover .cover-img, .sheet.fadein .cover * { animation: none !important; } }

/* 한복: 백자 바탕 + 색동 띠, 다홍·쪽빛 */
.sheet[data-tpl="hanbok"] { --paper: #F7F3EA; --card: #FFFCF5; --ink: #2B2420; --sub: #6E625A; --line: #E7DCCB; --olive: #2B4C7E; --rose: #C0392B; --display: "Song Myung", "Nanum Myeongjo", serif; }
.sheet[data-tpl="hanbok"]::before, .sheet[data-tpl="hanbok"] footer::before { content: ""; display: block; height: 10px; background: linear-gradient(90deg, #C0392B 0 20%, #F2C14E 20% 40%, #8BBF5A 40% 60%, #2B4C7E 60% 80%, #E58FA1 80% 100%); }
.sheet[data-tpl="hanbok"] footer::before { margin: -34px -24px 24px; }
.sheet[data-tpl="hanbok"] .eyebrow { font-family: var(--display); font-style: normal; letter-spacing: .3em; color: var(--rose); }
.sheet[data-tpl="hanbok"] .names span { color: var(--rose); }
.sheet[data-tpl="hanbok"] .cover::after { content: "❀"; display: block; margin-top: 14px; color: var(--rose); font-size: 20px; }
/* 크리스마스: 전나무 초록 + 산타 빨강 + 금색 전구 줄 */
.sheet[data-tpl="christmas"] { --paper: #F7F3EC; --card: #FFFDF8; --ink: #1F3B2C; --sub: #5C6B60; --line: #E2DCCF; --olive: #1E5631; --rose: #B3202A; --display: "Gowun Batang", serif; }
.sheet[data-tpl="christmas"] .cover { position: relative; }
.sheet[data-tpl="christmas"] .cover::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 26px; z-index: 2;
  background: radial-gradient(circle at 12px 16px, #B3202A 6px, transparent 7px) 0 0 / 72px 26px repeat-x, radial-gradient(circle at 36px 18px, #E8C77A 6px, transparent 7px) 0 0 / 72px 26px repeat-x, radial-gradient(circle at 60px 16px, #1E5631 6px, transparent 7px) 0 0 / 72px 26px repeat-x, linear-gradient(#1E5631, #1E5631) 0 6px / 100% 2px no-repeat; }
.sheet[data-tpl="christmas"] .eyebrow { color: var(--rose); }
.sheet[data-tpl="christmas"] .cover::after { content: "🎄 Merry Wedding 🎄"; display: block; margin-top: 12px; font-family: var(--latin); font-style: italic; color: var(--olive); }
.sheet[data-tpl="christmas"] .cal td.day span { background: var(--rose); box-shadow: 0 0 0 3px #E8C77A; }

/* 템플릿 추가 2 */
.sheet[data-tpl="ocean"] { --paper: #EEF5F8; --card: #FAFDFE; --ink: #1D3446; --sub: #5A7385; --line: #D3E3EC; --olive: #2F6E95; --rose: #5FA8C8; --display: "Noto Serif KR", serif; }
.sheet[data-tpl="lavender"] { --paper: #F4F1F9; --card: #FDFCFF; --ink: #352E45; --sub: #74698A; --line: #E2DBEF; --olive: #7C68A8; --rose: #B497D6; --display: "Gowun Batang", serif; }
.sheet[data-tpl="luxe"] { --paper: #0E0E0E; --card: #191919; --ink: #F3EBDD; --sub: #B3A994; --line: #2A2723; --olive: #C9A45C; --rose: #C9A45C; --display: "Noto Serif KR", serif; }
.sheet[data-tpl="luxe"] .names, .sheet[data-tpl="luxe"] h2 { color: #E9D3A3; letter-spacing: .08em; }
.sheet[data-tpl="luxe"] section + section { border-top-color: #3A332A; }
.sheet[data-tpl="luxe"] input, .sheet[data-tpl="luxe"] select { background: #0E0E0E; color: var(--ink); }
.sheet[data-tpl="autumn"] { --paper: #F7EFE6; --card: #FFFAF4; --ink: #3B2A1E; --sub: #7E6655; --line: #E8D8C6; --olive: #A0522D; --rose: #D2783C; --display: "Nanum Myeongjo", serif; }
.sheet[data-tpl="mint"] { --paper: #EFF8F4; --card: #FBFEFC; --ink: #1F3A33; --sub: #5C7A70; --line: #D2EADF; --olive: #3E9B7F; --rose: #F29E8E; --display: "Gowun Dodum", sans-serif; }

/* 돌잔치 */
.cover .names.dol { display: grid; gap: 4px; }
.cover .names.dol small { font-size: 18px; color: var(--sub); letter-spacing: .02em; }
.dolj { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.dolj button { position: relative; display: grid; grid-template-columns: auto 1fr auto; grid-template-rows: auto auto; column-gap: 10px; align-items: center; text-align: left; border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 12px; padding: 12px; overflow: hidden; }
.dolj .e { grid-row: span 2; font-size: 26px; }
.dolj b { font-size: 15px; }
.dolj small { grid-column: 2; color: var(--sub); font-size: 12px; }
.dolj .pct { grid-row: 1 / span 2; grid-column: 3; font-size: 13px; font-weight: 700; color: var(--olive); font-variant-numeric: tabular-nums; }
.dolj .bar { position: absolute; left: 0; bottom: 0; right: 0; height: 4px; background: transparent; }
.dolj .bar em { display: block; height: 100%; width: 0; background: var(--rose); transition: width .8s cubic-bezier(.2, .9, .25, 1.08); }
.dolj button.mine { border-color: var(--olive); box-shadow: 0 0 0 1px var(--olive); }
.sheet[data-tpl="dol"] { --paper: #FFF9EC; --card: #FFFFFF; --ink: #3A3226; --sub: #85796A; --line: #F1E6CC; --olive: #E8A23B; --rose: #F2C14E; --display: "Jua", "Gowun Dodum", sans-serif; }
.sheet[data-tpl="dol"] .cover::after { content: "🎈 ⭐ 🎂 ⭐ 🎈"; display: block; margin-top: 12px; letter-spacing: .3em; }

/* 부고: 흑백, 장식 최소 */
.sheet[data-tpl="mourning"] { --paper: #FFFFFF; --card: #F7F7F6; --ink: #1E1E1E; --sub: #6B6B6B; --line: #E3E3E1; --olive: #3A3A3A; --rose: #3A3A3A; --display: "Nanum Myeongjo", "Noto Serif KR", serif; }
.sheet[data-tpl="mourning-gray"] { --paper: #F2F2F0; --card: #FAFAF9; --ink: #232323; --sub: #6E6E6E; --line: #DDDDDA; --olive: #444444; --rose: #444444; --display: "Nanum Myeongjo", "Noto Serif KR", serif; }
.bugo section { padding: 40px 24px; }
.bugo-top { padding-top: 56px !important; }
.bugo .hanja { font-family: var(--display); font-size: 40px; letter-spacing: .4em; padding-left: .4em; color: var(--ink); }
.bugo .gukhwa { width: 56px; height: 56px; color: var(--sub); margin: 18px auto 0; display: block; }
.bugo .portrait { width: 132px; height: 168px; object-fit: cover; border-radius: 66px / 84px; margin: 22px auto 0; display: block; filter: grayscale(1); border: 4px solid var(--card); box-shadow: 0 0 0 1px var(--line); max-width: 100%; }
.bugo .dname { font-family: var(--display); font-size: 28px; margin-top: 18px; display: grid; gap: 4px; }
.bugo .dname small { font-size: 14px; color: var(--sub); font-family: var(--body); }
.bugo .rip { margin-top: 12px; color: var(--sub); font-size: 14px; letter-spacing: .1em; }
.bugo .thanks-note { margin-top: 14px; font-family: var(--display); }
.bugo .text { font-family: var(--display); font-size: 15px; line-height: 2.1; white-space: pre-line; }
.bugo .eyebrow { font-family: var(--display); font-style: normal; letter-spacing: .3em; color: var(--ink); font-size: 15px; margin-bottom: 18px; }
.mourners { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; max-width: 280px; margin-inline: auto; }
.mourners li { display: grid; grid-template-columns: 70px 1fr; text-align: left; gap: 12px; font-size: 15px; }
.mourners span { color: var(--sub); }
.sched { margin: 0 auto; max-width: 320px; display: grid; gap: 10px; text-align: left; }
.sched div { display: grid; grid-template-columns: 56px 1fr; gap: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.sched dt { color: var(--sub); font-size: 14px; }
.sched dd { margin: 0; font-size: 15px; }
.bugo .share-btns .kakao { background: #3A3A3A; color: #FFFFFF; }
.bugo footer.quiet { padding: 18px; font-size: 11px; color: #AAAAAA; border: 0; }
.bugo footer.quiet a { color: #AAAAAA; text-decoration: none; }
.kmap { width: 100%; aspect-ratio: 16 / 10; border-radius: 8px; margin-top: 14px; border: 1px solid var(--line); max-width: 100%; }

/* 송금 버튼·연락하기·우리 이야기 */
.paybtn { border-radius: 6px; padding: 6px 10px; font-size: 12px; font-weight: 700; text-decoration: none; white-space: nowrap; }
.paybtn.kp { background: #FFEB00; color: #191919; }
.paybtn.ts { background: #0064FF; color: #FFFFFF; }
.contacts { display: grid; gap: 8px; text-align: left; }
.contact { display: flex; align-items: center; gap: 8px; background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; font-size: 14px; }
.contact span { flex: 1; min-width: 0; }
.contact a { border: 1px solid var(--line); background: var(--paper); color: var(--ink); border-radius: 6px; padding: 6px 12px; font-size: 12px; text-decoration: none; }
.story { display: grid; gap: 18px; text-align: left; }
.story .sq { font-family: var(--display); font-weight: 700; margin: 0 0 6px; color: var(--rose); }
.story .sa { margin: 0; line-height: 1.9; white-space: pre-line; }

/* 에디토리얼 커버: 매거진(사진 위 글씨) · 큰 날짜 · 세로 이름 */
.cover { position: relative; }
.cover .bigdate { display: none; }
.cover[data-layout="magazine"] { padding: 0; }
.cover[data-layout="magazine"] canvas, .cover[data-layout="magazine"] .cover-img { aspect-ratio: 3 / 4.4; }
.cover[data-layout="magazine"] .cover-text { position: absolute; inset: auto 0 0 0; padding: 120px 24px 34px; color: #FFFFFF; background: linear-gradient(to top, rgba(0,0,0,.62), rgba(0,0,0,.25) 60%, transparent); text-align: left; }
.cover[data-layout="magazine"] .names { color: #FFFFFF; font-size: 38px; margin-top: 6px; letter-spacing: .02em; line-height: 1.2; }
.cover[data-layout="magazine"] .names span { color: #FFFFFF; opacity: .85; margin: 0 8px; }
.cover[data-layout="magazine"] .names.dol small { color: rgba(255,255,255,.85); }
.cover[data-layout="magazine"] .date-latin { color: rgba(255,255,255,.9); margin-top: 0; font-size: 20px; letter-spacing: .12em; }
.cover[data-layout="magazine"] .when, .cover[data-layout="magazine"] .where { color: rgba(255,255,255,.92); }
.cover[data-layout="magazine"] .badge { background: #FFFFFF; color: var(--ink); }
.cover[data-layout="type"] { padding-top: 44px; display: flex; flex-direction: column; align-items: center; }
.cover[data-layout="type"] .bigdate { order: -1; }
.cover[data-layout="type"] .cover-text { width: 100%; }
.cover[data-layout="type"] .bigdate { display: block; font-family: var(--latin); font-size: 112px; line-height: .9; letter-spacing: -.02em; color: var(--ink); font-variant-numeric: lining-nums; }
.cover[data-layout="type"] .bigdate i { color: var(--rose); font-style: normal; }
.cover[data-layout="type"] canvas, .cover[data-layout="type"] .cover-img { width: calc(100% - 96px); aspect-ratio: 3 / 4; margin: 28px auto 0; }
.cover[data-layout="type"] .date-latin { display: none; }
.cover[data-layout="vertical"] { padding-top: 32px; }
.cover[data-layout="vertical"] canvas, .cover[data-layout="vertical"] .cover-img { width: calc(100% - 104px); margin: 0 24px 0 auto; aspect-ratio: 3 / 4.2; }
.cover[data-layout="vertical"] .names { position: absolute; left: 22px; top: 40px; margin: 0; writing-mode: vertical-rl; font-size: 30px; letter-spacing: .3em; line-height: 1.4; }
.cover[data-layout="vertical"] .names span { margin: 14px 0; vertical-align: 0; }
.cover[data-layout="vertical"] .names.dol { display: block; }
.cover[data-layout="vertical"] .names.dol small { font-size: 16px; margin-top: 12px; }
.cover[data-layout="vertical"] .cover-text { text-align: right; padding-right: 24px; }

.videos { display: grid; gap: 12px; }
.videos video { width: 100%; border-radius: 10px; background: #000; display: block; }

/* ── 펼친 화면 (폴더블을 펼쳤을 때·태블릿): 종이 청첩장처럼 두 쪽 펼침면 ──
   왼쪽 쪽 = 첫 화면(커버·부고 머리)이 그 자리에 머물고, 오른쪽 쪽 = 나머지 내용이 넘어간다.
   view.js의 WIDE 조건과 같게 유지할 것 */
@media (min-width: 700px) and (min-height: 500px) {
  .sheet { max-width: 1040px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); overflow: clip; box-shadow: 0 0 60px rgba(0,0,0,.08); }
  .sheet > .ownerbar { position: fixed; top: 0; left: 0; right: 0; z-index: 7; }
  .sheet > .spread-left { grid-column: 1; grid-row: 1 / span 60; position: sticky; top: 0; align-self: start; height: 100vh; height: 100dvh; overflow: auto; display: flex; flex-direction: column; justify-content: center; border-right: 1px solid var(--line); }
  .sheet > section:not(.spread-left), .sheet > footer { grid-column: 2; }
  .sheet > .spread-left .cal { width: 100%; max-width: 340px; }
  .sheet > .spread-left .cal table { table-layout: fixed; }
  .sheet > .spread-left > * { max-width: 100%; }
  .sheet > .spread-left canvas, .sheet > .spread-left .cover-img { max-height: 62vh; object-fit: cover; }
  .cover.spread-left[data-layout="magazine"] canvas, .cover.spread-left[data-layout="magazine"] .cover-img { max-height: none; height: 100%; }
  .cover.spread-left[data-layout="magazine"] { justify-content: flex-end; }
  .cover.spread-left[data-layout="magazine"] > .cover-img, .cover.spread-left[data-layout="magazine"] > canvas { position: absolute; inset: 0; width: 100%; aspect-ratio: auto; }
  /* 커버가 오른쪽 쪽으로 가면 사진 높이를 줄여 한눈에 */
  .cover:not(.spread-left) .cover-img, .cover:not(.spread-left) canvas { max-height: 70vh; object-fit: cover; }
  /* 펼치는 순간: 오른쪽 쪽이 책장처럼 열린다 */
  /* 펼치는 순간: 오른쪽 쪽을 덮은 표지가 책처럼 왼쪽으로 넘어가며 열리고, 왼쪽 쪽은 흐릿하다가 또렷해진다 */
  .sheet.unfold > .spread-left { animation: leftfocus 1.2s cubic-bezier(.3, .6, .2, 1) both; }
  .sheet.unfold > section:not(.spread-left), .sheet.unfold > footer { animation: rightreveal 1.2s ease both; }
}
/* 접히는 선(힌지)을 알려 주는 폴더블: 두 쪽을 힌지 양옆에 딱 맞춰 글자가 접힌 곳에 걸리지 않게 */
@media (horizontal-viewport-segments: 2) {
  .sheet { max-width: none; grid-template-columns: env(viewport-segment-width 0 0) env(viewport-segment-width 1 0); column-gap: calc(env(viewport-segment-left 1 0) - env(viewport-segment-right 0 0)); }
}
@keyframes leftfocus { 0% { filter: blur(14px) brightness(.82); transform: scale(1.03); } 55% { filter: blur(5px) brightness(.92); } 100% { filter: none; transform: none; } }
@keyframes rightreveal { 0%, 35% { opacity: .55; } 100% { opacity: 1; } }
/* 표지: 오른쪽 쪽 위에 잠깐 붙였다가 왼쪽 가장자리를 축으로 넘긴다 (뒷면은 숨김 → 반쯤 넘어가면 사라짐) */
.bookflip { position: fixed; top: 0; bottom: 0; z-index: 30; transform-origin: left center; backface-visibility: hidden; pointer-events: none;
  background: linear-gradient(to right, rgba(0,0,0,.16), rgba(0,0,0,0) 14%), var(--paper); box-shadow: -18px 0 40px rgba(0,0,0,.18);
  display: grid; place-items: center; text-align: center; color: var(--ink); animation: flipopen 1.2s cubic-bezier(.45, .05, .25, 1) forwards; }
.bookflip .bt { font-family: var(--display); font-size: 30px; letter-spacing: .08em; line-height: 1.5; padding: 0 24px; }
.bookflip .bd { font-family: var(--latin); font-style: italic; color: var(--olive); font-size: 20px; margin-top: 10px; }
.bookflip .bl { width: 56px; height: 1px; background: var(--line); margin: 22px auto; }
@keyframes flipopen { 0% { transform: perspective(2200px) rotateY(0deg); } 100% { transform: perspective(2200px) rotateY(-180deg); } }
@media (prefers-reduced-motion: reduce) { .sheet.unfold > *, .bookflip { animation: none !important; display: none; } }

/* 안내 말씀 · 글씨 크기 (어르신 하객을 위해 크게) */
.notice { white-space: pre-line; line-height: 1.9; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; text-align: left; font-size: 15px; }
.sheet[data-fs="l"] > section { zoom: 1.14; }
.sheet[data-fs="s"] > section { zoom: .92; }

/* 생중계 버튼 */
.live { display: block; width: fit-content; margin: 0 auto 18px; padding: 8px 18px; border-radius: 999px; background: #C62828; color: #fff; font-size: 14px; font-weight: 700; text-decoration: none; letter-spacing: .02em; }

/* ── 답장 봉투 · 지금 진행 순서 · 방명록 쌓임 · 복사 ✓ · 샘플 띠 ── */
.sent .env { position: relative; width: 168px; height: 104px; margin: 4px auto 18px; background: var(--card); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 10px 24px rgba(35, 48, 43, .10); }
.sent .flap { position: absolute; inset: 0 0 auto; height: 62px; background: var(--paper, var(--card)); border-bottom: 1px solid var(--line); clip-path: polygon(0 0, 100% 0, 50% 100%); transform-origin: top; }
.sent .seal { position: absolute; left: 50%; top: 40px; width: 44px; height: 44px; margin-left: -22px; border-radius: 50%; background: var(--rose); color: #fff; font: 700 12px/44px var(--body); font-style: normal; text-align: center; transform: rotate(-8deg); }
.acc button.copied { background: var(--ink); color: var(--card); border-color: var(--ink); }
.timeline .past { opacity: .5; }
.timeline .now time { position: relative; }
.timeline .now time::before { content: ""; position: absolute; left: -12px; top: 50%; width: 7px; height: 7px; margin-top: -3.5px; border-radius: 50%; background: var(--rose); }
.samplebar { position: fixed; z-index: 30; left: 50%; top: calc(8px + env(safe-area-inset-top, 0px)); transform: translateX(-50%); display: flex; align-items: center; gap: 2px; padding: 4px; border-radius: 999px; background: rgba(35, 48, 43, .88); color: #fff; font: 600 12px/1 var(--body); backdrop-filter: blur(8px); white-space: nowrap; box-shadow: 0 6px 18px rgba(0, 0, 0, .18); }
.samplebar span { padding: 0 8px 0 10px; opacity: .7; }
.samplebar a { color: #fff; text-decoration: none; padding: 7px 10px; border-radius: 999px; }
.samplebar a[aria-current] { background: rgba(255, 255, 255, .18); }
.samplebar a.make { background: var(--rose); }
@media (prefers-reduced-motion: no-preference) {
  form.sending { animation: rs-out .42s cubic-bezier(.4, 0, .2, 1) forwards; pointer-events: none; }
  .sent .env { animation: rs-env .36s cubic-bezier(.2, .7, .2, 1) both; }
  .sent .flap { animation: rs-flap .42s .3s cubic-bezier(.2, .7, .2, 1) both; }
  .sent .seal { animation: rs-seal .5s .62s cubic-bezier(.2, .9, .25, 1.25) both; }
  .sent .done { animation: m-up .5s .9s cubic-bezier(.2, .7, .2, 1) both; }
  .note.new { animation: nt-in .5s cubic-bezier(.2, .9, .25, 1.15) both; }
  .timeline .now time::before { animation: now-ping 1.8s ease-out infinite; }
}
@keyframes rs-out { to { opacity: 0; transform: translateY(36px) scale(.86); } }
@keyframes rs-env { from { opacity: 0; transform: translateY(16px); } }
@keyframes rs-flap { from { transform: scaleY(-1); } }
@keyframes rs-seal { from { opacity: 0; transform: scale(2.1) rotate(-20deg); } }
@keyframes nt-in { from { opacity: 0; transform: translateY(-14px) scale(.97); } }
@keyframes now-ping { 0% { box-shadow: 0 0 0 0 rgba(185, 124, 124, .55); } 100% { box-shadow: 0 0 0 9px rgba(185, 124, 124, 0); } }

@media (prefers-reduced-motion: no-preference) { .dolj button.picked { animation: pick .5s cubic-bezier(.2, .9, .25, 1.3); } .dolj button.picked .e { animation: pick-e .6s cubic-bezier(.2, .9, .25, 1.3); } }
@keyframes pick { 40% { transform: scale(1.04); } }
@keyframes pick-e { 30% { transform: translateY(-6px) rotate(-8deg); } 60% { transform: translateY(0) rotate(6deg); } }
.samplemore { text-align: center; padding-bottom: 90px; }
.samplemore .links { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 14px; }
.samplemore .links a { border: 1px solid var(--line); background: var(--card); color: var(--ink); text-decoration: none; border-radius: 999px; padding: 8px 14px; font-size: 14px; }
.samplemore .muted { color: var(--sub); font-size: 13px; margin-top: 12px; }
body:has(.samplebar) .music { top: calc(60px + env(safe-area-inset-top, 0px)); }
