/* =========================================================
   年賀狀收藏 — 樣式
   VOICE  : 可愛的和風新年
   IDEA   : 像一疊收在和紙信封裡的年賀狀
   PICTURE: 年賀狀本身，加上十二支印章板
   COLOUR : 和紙米白、朱紅、金、淡藍的霞、櫻花粉
   TYPE   : 全部用 Huninn（粉圓）；只有紅色印章用 Yusei Magic
   ========================================================= */
:root {
  --washi: #FBF3E4;
  --paper: #FFFDF8;
  --shu: #D9544A;          /* 朱紅（鳥居） */
  --shu-deep: #A93B32;
  --gold: #D6AC4E;
  --ink: #4A3226;
  --ink-soft: #8A6F5E;
  --sakura: #F7C9D3;
  --sora: #BBD6E8;         /* 霞的淡藍 */

  --radius: 22px;
  --shadow: 0 6px 18px rgba(74, 50, 38, .12);
  --maxw: 980px;

  /* 全站字體：粉圓（中日文都用這個） */
  --font: "Huninn", "Zen Maru Gothic", "Hiragino Maru Gothic ProN", "PingFang TC", system-ui, sans-serif;
  --font-hand: var(--font);
  /* 只有紅色印章用手寫感字體 */
  --font-stamp: "Yusei Magic", "Huninn", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; min-width: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 16px/1.75 var(--font);
  color: var(--ink);
  background-color: var(--washi);
  /* 和紙的纖維感 */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .55 0 0 0 0 .42 0 0 0 0 .3 0 0 0 .07 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  overflow-x: clip;
}
body.lb-open { overflow: hidden; }
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: inherit; }
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 max(18px, 4vw); }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }

/* ---------- 共用元件 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 10px 24px;
  background: var(--paper); color: var(--ink);
  border: 2.5px solid var(--ink); border-radius: 999px;
  box-shadow: 0 4px 0 var(--ink);
  font-weight: 700; text-decoration: none;
  transition: transform .12s, box-shadow .12s, background .2s;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { background: #FFF1D6; }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.btn.small { min-height: 40px; padding: 6px 16px; font-size: .95rem; }
.btn[disabled] { opacity: .35; pointer-events: none; }

/* 印章 */
.hanko {
  display: inline-grid; place-items: center;
  width: 44px; height: 44px; flex: none;
  background: var(--shu); color: #FFF6EE;
  border-radius: 10px;
  font: 1.45rem/1 var(--font-stamp);
  box-shadow: inset 0 0 0 3px var(--shu), inset 0 0 0 5px rgba(255,246,238,.75);
  transform: rotate(-6deg);
}
.hanko-lg { width: 64px; height: 64px; font-size: 2.1rem; border-radius: 14px; }

.kasumi { position: absolute; width: 120px; height: 46px; fill: var(--sora); opacity: .85; pointer-events: none; }

/* ---------- 語言切換 ---------- */
.lang {
  position: fixed; z-index: 60;
  top: calc(12px + env(safe-area-inset-top)); right: 12px;
  display: flex; padding: 3px;
  background: var(--paper); border: 2.5px solid var(--ink); border-radius: 999px;
  box-shadow: 0 3px 0 var(--ink);
}
.lang button {
  min-width: 40px; min-height: 34px; padding: 0 10px;
  border: 0; border-radius: 999px; background: transparent;
  font: inherit; font-size: .9rem; font-weight: 700; color: var(--ink-soft); cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.lang button[aria-pressed="true"] { background: #FDE7B8; color: var(--ink); }

/* =========================================================
   頁首
   ========================================================= */
.hero {
  position: relative; overflow: hidden;
  padding: calc(64px + env(safe-area-inset-top)) 0 56px;
  text-align: center;
  background:
    radial-gradient(circle at 50% 120%, rgba(247, 201, 211, .55), transparent 60%),
    radial-gradient(circle at 50% -10%, rgba(214, 172, 78, .22), transparent 55%);
  border-bottom: 6px solid var(--shu);
}
.hero::after { /* 朱紅下緣再加一條金線 */
  content: ""; position: absolute; left: 0; right: 0; bottom: 6px; height: 3px; background: var(--gold);
}
.hero-inner { position: relative; z-index: 1; }
.k1 { top: 34px; left: -18px; width: 150px; height: 58px; }
.k2 { bottom: 34px; right: -12px; transform: scaleX(-1); }
.title {
  margin: 14px 0 0;
  font: clamp(2.2rem, 9vw, 3.4rem)/1.1 var(--font-hand);
  letter-spacing: .04em;
  text-wrap: balance;
}
.years {
  display: inline-block; margin: 14px 0 0; padding: 2px 16px;
  font: 1.15rem/1.6 var(--font-hand); color: var(--shu-deep);
  border-top: 2px solid var(--gold); border-bottom: 2px solid var(--gold);
}
.years span:first-child { color: var(--gold); }
.lead { max-width: 30em; margin: 16px auto 0; font-weight: 700; text-wrap: balance; }

/* 飄落的櫻花瓣（唯一的動態，關閉動畫設定時會停止） */
.petals { position: absolute; inset: 0; pointer-events: none; }
.petal {
  position: absolute; top: -30px; width: 14px; height: 17px; fill: var(--sakura);
  animation: fall linear infinite;
}
@keyframes fall {
  0% { transform: translate(0, -20px) rotate(0); opacity: 0; }
  10% { opacity: .95; }
  100% { transform: translate(var(--drift), 420px) rotate(var(--spin)); opacity: 0; }
}

/* =========================================================
   區塊
   ========================================================= */
.section { margin: 44px 0; }
.section-title {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  margin: 0 0 20px;
  font: 1.6rem/1.3 var(--font-hand);
  text-align: center;
}
.section-title::before, .section-title::after {
  content: ""; width: 34px; height: 3px; border-radius: 3px; background: var(--gold);
}

/* ---------- 十二支印章板 ---------- */
.eto-section {
  padding: 22px 16px 20px;
  background: var(--paper);
  border: 2.5px solid var(--ink); border-radius: var(--radius);
  box-shadow: 0 5px 0 var(--ink);
}
.eto-board {
  display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px 6px;
  margin: 0; padding: 0; list-style: none;
}
.eto-board li { text-align: center; }
.eto-stamp {
  display: grid; place-items: center;
  width: min(52px, 100%); aspect-ratio: 1; margin: 0 auto;
  border-radius: 50%;
  font: 1.35rem/1 var(--font-stamp);
  border: 2px dashed #CDB9A6; color: #CDB9A6; background: transparent;
  transition: transform .2s;
}
.eto-board .done .eto-stamp {
  border: 2.5px solid var(--shu); background: var(--shu); color: #FFF6EE;
  box-shadow: inset 0 0 0 2px var(--shu), inset 0 0 0 4px rgba(255,246,238,.7);
  cursor: pointer;
}
.eto-board .done:nth-child(odd) .eto-stamp { transform: rotate(-8deg); }
.eto-board .done:nth-child(even) .eto-stamp { transform: rotate(6deg); }
.eto-board .done .eto-stamp:hover { transform: scale(1.12) rotate(0); }
.eto-board .eto-year { display: block; margin-top: 4px; font-size: .78rem; color: var(--ink-soft); }
.eto-board .done .eto-year { color: var(--ink); font-weight: 700; }
.eto-left { margin: 16px 0 0; text-align: center; font-weight: 700; color: var(--shu-deep); }

/* ---------- 年賀狀卡片 ---------- */
.cards {
  display: grid; gap: 30px 22px;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 270px), 1fr));
}
.card {
  position: relative; margin: 0;
  padding: 14px 14px 16px;
  background: var(--paper);
  border: 2.5px solid var(--ink); border-radius: var(--radius);
  box-shadow: 0 5px 0 var(--ink);
  transition: transform .25s;
}
.card:nth-child(odd) { transform: rotate(-.8deg); }
.card:nth-child(even) { transform: rotate(.8deg); }
.card:hover { transform: rotate(0) translateY(-4px); }
.card .hanko { position: absolute; top: -14px; left: -10px; z-index: 1; }
.card-img {
  display: block; width: 100%; padding: 0; border: 0; background: var(--washi);
  aspect-ratio: 1; border-radius: 14px; overflow: hidden; cursor: zoom-in;
}
.card-img img { width: 100%; height: 100%; object-fit: contain; }
.card-body { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; margin-top: 12px; }
.card-year { margin: 0; font: 2rem/1 var(--font-hand); }
.card-kanshi { margin: 4px 0 0; font-size: .92rem; color: var(--ink-soft); font-weight: 700; }
.chip {
  flex: none; padding: 2px 10px; border-radius: 999px;
  font-size: .8rem; font-weight: 700; white-space: nowrap;
  border: 2px solid var(--ink);
}
.chip.pencil { background: #FDE7B8; }
.chip.digital { background: #D6E8F4; }

/* 電繪 / 手繪 的分隔 */
.divider {
  grid-column: 1 / -1;
  display: flex; align-items: center; gap: 12px;
  margin: 4px 0; color: var(--ink-soft); font-weight: 700; font-size: .95rem;
}
.divider::before, .divider::after { content: ""; flex: 1; border-top: 2.5px dashed #D8C5B2; }

/* ---------- 其他插畫 ---------- */
.other { text-align: center; }

/* =========================================================
   頁尾
   ========================================================= */
.footer {
  position: relative; overflow: hidden;
  margin-top: 60px; padding: 34px 0 calc(30px + env(safe-area-inset-bottom));
  text-align: center;
  background: var(--paper);
  border-top: 6px solid var(--shu);
}
.k3 { top: 16px; left: 8%; width: 90px; height: 34px; opacity: .6; }
.footer-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.copyright { margin: 18px 0 0; font-size: .85rem; color: var(--ink-soft); }

/* =========================================================
   大圖
   ========================================================= */
.lightbox {
  position: fixed; inset: 0; z-index: 50;
  display: grid; place-items: center;
  padding: calc(14px + env(safe-area-inset-top)) 14px calc(14px + env(safe-area-inset-bottom));
  background: rgba(60, 38, 26, .78);
  animation: fadeIn .2s;
}
.lightbox[hidden] { display: none; }
.lb-panel {
  position: relative;
  display: grid; gap: 14px;
  width: min(100%, 920px); max-height: 100%;
  overflow-y: auto; overscroll-behavior: contain;
  padding: 18px;
  background: var(--paper);
  border: 3px solid var(--ink); border-radius: var(--radius);
  box-shadow: 0 6px 0 var(--ink);
  animation: pop .3s cubic-bezier(.34, 1.56, .64, 1);
}
.lb-close {
  position: absolute; top: 10px; right: 10px; z-index: 2;
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--paper); border: 2.5px solid var(--ink); box-shadow: 0 3px 0 var(--ink);
}
.lb-figure { margin: 0; background: var(--washi); border-radius: 14px; }
.lb-figure img { width: 100%; max-height: 62vh; object-fit: contain; }
.lb-head { display: flex; align-items: center; gap: 12px; padding-right: 48px; }
.lb-head h3 { margin: 0; font: 1.35rem/1.3 var(--font-hand); }
.lb-label { margin: 14px 0 2px; font-size: .8rem; font-weight: 700; color: var(--ink-soft); }
.greet-ja { margin: 0; font: 1.1rem/1.9 var(--font-hand); }
.greet-zh { margin: 0; }
html[lang="ja"] .lb-zh { display: none; }
.lb-nav { display: flex; justify-content: space-between; gap: 10px; }

@media (min-width: 760px) {
  .lb-panel { grid-template-columns: 1.25fr 1fr; align-items: center; padding: 24px; }
  .lb-figure img { max-height: 76vh; }
  .lb-nav { grid-column: 1 / -1; }
}

@keyframes fadeIn { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(.92); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .petals { display: none; }
  html { scroll-behavior: auto; }
}
