/* 할머니의 추억 상자 — 공통 스타일
   레이아웃: 연한 종이색 바탕 위에 장밋빛 포인트, 본문은 바탕체, 마음을 전하는 말은 손글씨 */
:root {
  color-scheme: light;
  --paper: #fbf5f0;
  --paper-deep: #f6e9e2;
  --card: #fffdfb;
  --ink: #45302c;
  --ink-soft: #7d6660;
  --brown: #6f4a37;
  --rose: #c9506a;
  --rose-deep: #a93c56;
  --rose-pale: #f3d3d6;
  --line: #ead9d1;
  --sage: #eef0e4;
  --apricot: #fbeadb;
  --blush: #f9e6e1;
  --font-body: "Gowun Batang", "Nanum Myeongjo", "AppleMyungjo", "Batang", serif;
  --font-hand: "Nanum Pen Script", "Gowun Batang", cursive;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.8;
  word-break: keep-all;
  -webkit-font-smoothing: antialiased;
}
/* 편지 페이지로 넘어갈 때 화면이 잔잔히 사라집니다 (site.js) */
body { transition: opacity .45s ease; }
body.page-leave { opacity: 0; }
img, video { max-width: 100%; display: block; }
a { color: inherit; }
h1, h2, h3 { text-wrap: balance; margin: 0; font-weight: 700; }
p { margin: 0; }
:focus-visible { outline: 2px solid var(--rose); outline-offset: 3px; border-radius: 4px; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 24px; }

/* 머리말 */
.site-header { background: var(--paper); position: sticky; top: 0; z-index: 20; }
.site-header .wrap { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; padding-top: 30px; padding-bottom: 26px; }
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; font-size: 32px; font-weight: 700; letter-spacing: 0.02em; color: var(--ink); letter-spacing: 0.01em; -webkit-text-stroke: 0.3px var(--ink); }
.logo svg { width: 30px; height: 30px; flex: none; }
.nav { display: flex; align-items: center; justify-content: center; gap: 8px 48px; flex-wrap: wrap; }
.nav a { text-decoration: none; font-size: 16px; color: var(--ink-soft); padding: 4px 0; border-bottom: 1px solid transparent; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--rose-deep); border-bottom-color: var(--rose); }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font: inherit; font-size: 16px; font-weight: 700; color: #fff; text-decoration: none;
  background: var(--rose); border: 0; border-radius: 999px; padding: 10px 24px; cursor: pointer;
  box-shadow: 0 6px 16px -8px var(--rose-deep);
  transition: background .2s;
  touch-action: manipulation;
}
.btn:hover { background: var(--rose-deep); }
.btn svg { width: 16px; height: 16px; }
.btn.bgm-btn { position: fixed; top: 12px; right: 14px; z-index: 30; background-color: var(--paper); width: 28px; height: 28px; padding: 0; justify-content: center; border-radius: 50%; color: var(--rose); border: 1px solid var(--rose-pale); box-shadow: none; flex: none; }
.bgm-btn:hover { background: var(--rose-pale); }
/* 버튼은 작게 보이지만, 손가락으로 누르기 쉽도록 누르는 영역은 44px 이상으로 넓힙니다 */
.bgm-btn::after { content: ""; position: absolute; top: -10px; right: -10px; bottom: -10px; left: -10px; border-radius: 50%; }
.bgm-btn svg { width: 13px; height: 13px; }
.bgm-btn span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.bgm-btn[aria-pressed="false"] { opacity: .5; }

/* 첫 화면 */
.hero { position: relative; overflow: hidden; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 500px); align-items: center; gap: 0; }
.hero-text { position: relative; z-index: 1; padding: 28px 0 28px clamp(0px, 6vw, 90px); }
.hero-photo { -webkit-mask-image: linear-gradient(to right, transparent 0, rgba(0,0,0,.5) 28%, #000 55%); mask-image: linear-gradient(to right, transparent 0, rgba(0,0,0,.5) 28%, #000 55%); margin-left: -120px; }
.hero-photo img { width: 100%; height: auto; }
.hand { font-family: var(--font-hand); color: var(--rose); font-size: 32px; line-height: 1.3; }
.hero h1 { font-size: clamp(32px, 4.4vw, 54px); line-height: 1.2; margin: 8px 0 14px; letter-spacing: 0.01em; }
.hero h1 span { display: block; padding-left: 0.7em; white-space: nowrap; }
.rule { width: 30px; height: 2px; background: var(--rose); border: 0; margin: 0 0 24px; }
.hero p.lead { font-size: 19px; margin-bottom: 28px; line-height: 1.7; }
.hero .btn, .more .btn { padding: 7px 20px; font-size: 14.5px; }
.more { text-align: center; margin-top: 24px; }
.press { display: flex; justify-content: center; align-items: flex-start; gap: 4px; margin-top: 8px; font-family: var(--font-hand); font-size: 26px; line-height: 1.2; color: var(--rose); transform: rotate(-3deg); animation: nudge 1.6s ease-in-out infinite; }
.press svg { width: 26px; height: 30px; flex: none; margin-top: -4px; }
@keyframes nudge { 0%, 100% { transform: rotate(-3deg) translateY(0); } 50% { transform: rotate(-3deg) translateY(-5px); } }
.sprig { position: absolute; width: 84px; opacity: .9; pointer-events: none; }
.hero .sprig { left: 16px; bottom: 30px; width: 64px; }

/* 구역 공통 */
section { padding: 48px 0; }
.sec-title { font-size: 28px; display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.sec-title svg { width: 24px; height: 24px; color: var(--rose); flex: none; }

/* 이야기 + 추억 보관소 */
.memory-row { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.6fr); gap: 36px; align-items: start; }
.story { position: relative; padding: 4px 30px 24px 0; border-right: 1px solid var(--line); height: 100%; }
.story h2 { color: var(--rose-deep); font-size: 30px; line-height: 1.5; margin-bottom: 22px; }
.story h2::after { content: ""; display: block; width: 32%; height: 1px; background: var(--line); opacity: .7; transform: scaleY(.6); margin: 20px auto 0; }
.story h2 em { font-style: normal; display: block; font-family: var(--font-hand); font-size: 38px; font-weight: 400; color: var(--rose); }
.story p { font-size: 18px; line-height: 2; padding-right: 44px; }
.story .sprig { right: 20px; bottom: 0; width: 46px; }
.gallery { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; list-style: none; margin: 0; padding: 0; }
.gallery figure { margin: 0; }
.gallery img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 14px; box-shadow: 0 10px 24px -16px rgba(80, 40, 30, .6); }
.gallery figcaption { text-align: center; margin-top: 12px; font-size: 18px; }

/* 기억 속 할머니 */
.remember { padding: 0; }
.remember .wrap { padding-top: 44px; padding-bottom: 44px; }
.remember::before, .remember::after { content: ""; display: block; width: min(32%, 360px); height: 1px; background: var(--line); opacity: .7; transform: scaleY(.6); margin: 0 auto; }
.remember .sec-title { justify-content: center; }
.traits { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.trait { border-radius: 14px; padding: 20px 20px 22px; text-align: center; }
.trait:nth-child(1) { background: var(--sage); }
.trait:nth-child(2) { background: var(--apricot); }
.trait:nth-child(3) { background: var(--blush); }
.trait svg { width: 48px; height: 48px; margin: 0 auto 8px; display: block; flex: none; }
.trait h3 { font-size: 21px; margin-bottom: 8px; }
.trait p { font-size: 16px; color: var(--ink-soft); line-height: 1.75; }

/* 편지 · 영상 · 메시지 */
.trio { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 30px; align-items: start; }
.trio h2 { font-size: 21px; display: flex; align-items: center; gap: 8px; margin-bottom: 16px; }
.trio h2 svg { width: 22px; height: 22px; color: var(--rose); flex: none; }
.note { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 26px 26px 22px; position: relative; }
.note p { font-size: 16.5px; line-height: 2.05; }
.note .sign { text-align: right; color: var(--ink-soft); margin-top: 18px; font-size: 15px; }
.note .seal { position: absolute; left: 18px; bottom: 12px; width: 42px; height: 42px; }
.film video { width: 100%; height: auto; aspect-ratio: 1 / 1; border-radius: 12px; background: #2a1c1a; box-shadow: 0 12px 28px -18px rgba(80, 40, 30, .7); }
.film p { text-align: center; margin-top: 12px; font-size: 16px; color: var(--ink-soft); }
.messages { list-style: none; margin: 0; padding: 0; background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
.messages li { display: grid; grid-template-columns: 48px minmax(0, 1fr); gap: 14px; padding: 14px 16px; align-items: start; }
.messages li + li { background: linear-gradient(rgba(234, 217, 209, .7), rgba(234, 217, 209, .7)) top center / 32% 1px no-repeat; }
.avatar { width: 48px; height: 48px; border-radius: 50%; background: var(--rose-pale); color: var(--rose-deep); display: grid; place-items: center; font-weight: 700; font-size: 17px; }
.avatar { overflow: hidden; }
.avatar svg { width: 100%; height: 100%; display: block; }
.avatar.a-mom { background: #f6e6e4; }
.avatar.a-aunt { background: #f6ecdf; }
.avatar.a-kid { background: #edf0e4; }
.messages b { display: block; font-size: 16px; line-height: 1.4; margin-bottom: 2px; }
.messages p { font-size: 15.5px; line-height: 1.7; color: var(--ink-soft); overflow-wrap: anywhere; white-space: normal; }
.messages div { min-width: 0; }

/* 맺음말 */
.site-footer { background: var(--rose-pale); text-align: center; padding: 22px 20px 26px; position: relative; }
.site-footer strong { display: flex; justify-content: center; align-items: center; gap: 8px; font-size: 21px; }
.site-footer strong svg { width: 20px; height: 20px; color: var(--rose); flex: none; }
.site-footer strong svg { width: 20px; height: 20px; color: var(--rose); }
.site-footer p { color: var(--ink-soft); font-size: 15.5px; margin-top: 6px; line-height: 1.7; }

/* 나의 엄마에게 */
.letter-page { padding: 32px 0 44px; background: linear-gradient(var(--paper), var(--paper-deep)); }
.letter-head { text-align: center; margin-bottom: 8px; }
.letter-head h1 { font-size: clamp(32px, 5vw, 46px); margin-top: 4px; }
.letter-head p.sub { color: var(--ink-soft); margin-top: 8px; }
.envelope { position: relative; max-width: 940px; margin: 0 auto; padding: 190px 0 96px; }
.env-flap { position: absolute; top: 0; left: 0; right: 0; height: 262px; background: #eebcc4; clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.env-body { position: absolute; left: 0; right: 0; top: 250px; bottom: 0; background: #ecb5be; border-radius: 4px; box-shadow: 0 24px 40px -28px rgba(120, 50, 60, .7); }
.env-body::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 84px; background: linear-gradient(#e9aeb8, #e6a8b3); border-radius: 0 0 4px 4px; clip-path: polygon(0 100%, 3% 0, 97% 0, 100% 100%); }
.postcard {
  position: relative; margin: 0 2.2% 0; background: #fffaf8; display: grid; grid-template-columns: minmax(0, 0.92fr) minmax(0, 1fr);
  box-shadow: 0 10px 26px -14px rgba(90, 40, 40, .55);
  animation: rise 1.1s ease-out both;
}
@keyframes rise { from { transform: translateY(46px); } to { transform: none; } }
.postcard .photo { padding: 44px 40px; display: flex; align-items: center; justify-content: center; border-right: 2px dashed #b9aaa6; }
.postcard .photo img { width: 100%; max-width: 330px; box-shadow: 0 6px 16px -10px rgba(60, 30, 20, .6); }
.postcard .words { padding: 36px 44px 40px; }
.postcard .to { font-family: var(--font-hand); font-size: 40px; color: var(--rose-deep); line-height: 44px; margin-bottom: 0; }
.postcard .lines {
  font-family: var(--font-hand); font-size: 27px; line-height: 44px; color: var(--ink);
  background-image: repeating-linear-gradient(to bottom, transparent 0, transparent 43px, #b8aba6 43px, #b8aba6 44px);
}
.postcard .lines p + p { margin-top: 44px; }
.postcard .lines .from { text-align: right; color: var(--rose-deep); margin-top: 0; }
.back { text-align: center; margin-top: 28px; }

/* 떠오르는 꽃 */
#petals { position: fixed; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 15; }

@media (max-width: 1040px) {
  .trio { grid-template-columns: 1fr; gap: 40px; }
  .film video { max-width: 520px; margin: 0 auto; }
}
@media (max-width: 900px) {
  .memory-row { grid-template-columns: 1fr; gap: 40px; }
  .story { border-right: 0; padding: 0; }
}
@media (max-width: 640px) {
  body { font-size: 16px; line-height: 1.7; }
  .wrap { padding: 0 16px; }
  .site-header .wrap { padding-top: 28px; padding-bottom: 24px; gap: 0; }
  .logo { font-size: 25px; }
  .logo svg { width: 22px; height: 22px; }
  .nav { gap: 4px 36px; }
  .nav a { font-size: 15px; }
  .btn.bgm-btn { width: 26px; height: 26px; padding: 0; top: 10px; right: 10px; }
  .bgm-btn svg { width: 11px; height: 11px; }
  .hero-grid { grid-template-columns: 1fr; }
  .hero-photo { order: -1; margin: 0 -16px; -webkit-mask-image: linear-gradient(to bottom, #000 42%, rgba(0,0,0,.45) 74%, transparent 98%); mask-image: linear-gradient(to bottom, #000 42%, rgba(0,0,0,.45) 74%, transparent 98%); }
  .hero-text { padding: 0 0 38px; margin-top: -26px; text-align: center; }
  .hand { font-size: 24px; }
  .hero h1 { font-size: 27px; margin: 6px 0 12px; }
  .hero h1 span { display: inline; padding: 0; }
  .rule { width: 26px; margin: 0 auto 22px; }
  .hero p.lead { font-size: 17px; margin-bottom: 26px; }
  .hero .sprig { display: none; }
  .btn { padding: 9px 20px; font-size: 15px; }
  section { padding: 38px 0; }
  .remember .wrap { padding-top: 36px; padding-bottom: 36px; }
  .sec-title { font-size: 23px; margin-bottom: 18px; }
  .story h2 { font-size: 23px; margin-bottom: 20px; }
  .story h2 em { font-size: 32px; display: inline; margin-right: 6px; }
  .story p { font-size: 16.5px; line-height: 1.8; padding-right: 44px; }
  .story .sprig { right: 0; bottom: 14px; width: 40px; }
  .gallery { gap: 8px; }
  .gallery img { border-radius: 10px; }
  .gallery figcaption { font-size: 14px; margin-top: 8px; line-height: 1.4; }
  .traits { grid-template-columns: 1fr; grid-auto-rows: 1fr; gap: 14px; }
  .trait { display: grid; grid-template-columns: 44px minmax(0, 1fr); column-gap: 14px; align-items: center; text-align: left; padding: 12px 16px; }
  .trait svg { width: 44px; height: 44px; margin: 0; grid-row: span 2; }
  .trait h3 { font-size: 18px; margin: 0; }
  .trait p { font-size: 15px; line-height: 1.55; }
  .trio h2 { font-size: 20px; margin-bottom: 14px; }
  .note { padding: 20px 20px 18px; }
  .note p { font-size: 16px; line-height: 1.85; }
  .note .sign { margin-top: 16px; }
  .film p { margin-top: 8px; font-size: 15px; }
  .messages li { padding: 12px 14px; }
  .site-footer strong { font-size: 18px; }
  .site-footer p { font-size: 14px; }
  .letter-page { padding: 18px 0 30px; }
  .letter-head h1 { font-size: 32px; margin-top: 0; }
  .envelope { padding: 84px 0 40px; }
  .env-flap { height: 120px; }
  .env-body { top: 112px; }
  .env-body::after { height: 40px; }
  .postcard { grid-template-columns: 1fr; }
  .postcard .photo { border-right: 0; border-bottom: 2px dashed #b9aaa6; padding: 18px; }
  .postcard .photo img { max-width: 220px; }
  .postcard .words { padding: 14px 20px 22px; }
  .postcard .to { line-height: 38px; font-size: 34px; }
  .postcard .lines { font-size: 24px; line-height: 38px; background-image: repeating-linear-gradient(to bottom, transparent 0, transparent 37px, #b8aba6 37px, #b8aba6 38px); }
  .postcard .lines p + p { margin-top: 0; text-indent: 0; }
  .back { margin-top: 18px; }
}
/* 아주 좁은 휴대폰 (가로 360px 미만) */
@media (max-width: 359px) {
  .hand { font-size: 22px; }
  .hero h1 { font-size: 25px; }
  .story h2 { font-size: 21px; }
  .story h2 em { font-size: 29px; }
  .story p { font-size: 15.5px; padding-right: 40px; }
  .story p br { display: none; }   /* 좁은 화면에서는 정해 둔 줄바꿈 대신 폭에 맞춰 자연스럽게 흐르게 합니다 */
  .gallery { gap: 6px; }
  .gallery figcaption { font-size: 12.5px; white-space: nowrap; }
  .note { padding: 18px 16px 16px; }
  .note p { font-size: 15.5px; }
  .press { font-size: 24px; }
  .postcard .words { padding: 12px 16px 20px; }
  .postcard .to { font-size: 31px; }
  .postcard .lines { font-size: 22px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .postcard { animation: none; }
  .press { animation: none; }
}
