/* =========================================================
   布丁 & 草莓 — 樣式
   顏色都集中在 :root，想微調色系改這裡就好
   ========================================================= */
:root {
  --cream: #FFF8E7;
  --cream-2: #FFFDF5;
  --ging-light: #FCEFB4;
  --ging-dark: rgba(247, 220, 126, 0.6);
  --apricot: #F6C987;
  --apricot-soft: #FBE2BC;
  --brown: #5C3D24;
  --brown-soft: #8B6A4E;
  --sunflower: #F2B33D;

  --pudding: #E0A96D;       /* 布丁：淺焦糖 */
  --pudding-soft: #F8E3C8;
  --strawberry: #8A5A3C;    /* 草莓：深可可 */
  --strawberry-soft: #EAD6C6;

  --radius: 28px;
  --border: 3px solid var(--brown);
  --shadow: 0 5px 0 rgba(92, 61, 36, 0.85);
  --maxw: 520px;
  --nav-h: 76px;

  --font: "Huninn", "Zen Maru Gothic", "PingFang TC", "Hiragino Maru Gothic ProN", system-ui, sans-serif;
}
html[lang="en"] .bottom-nav a { min-width: 64px; }
html[lang="ja"] { --font: "Zen Maru Gothic", "Huninn", "Hiragino Maru Gothic ProN", system-ui, sans-serif; }

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--brown);
  line-height: 1.75;
  background-color: var(--cream);
  /* 淡淡的貓掌底紋 */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'%3E%3Cg fill='%23E9CFA0' fill-opacity='0.35'%3E%3Cellipse cx='30' cy='38' rx='9' ry='8'/%3E%3Ccircle cx='19' cy='26' r='4'/%3E%3Ccircle cx='27' cy='20' r='4'/%3E%3Ccircle cx='36' cy='20' r='4'/%3E%3Ccircle cx='43' cy='27' r='4'/%3E%3Cellipse cx='88' cy='94' rx='9' ry='8'/%3E%3Ccircle cx='77' cy='82' r='4'/%3E%3Ccircle cx='85' cy='76' r='4'/%3E%3Ccircle cx='94' cy='76' r='4'/%3E%3Ccircle cx='101' cy='83' r='4'/%3E%3C/g%3E%3C/svg%3E");
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 12px);
}
body.intro-open { overflow: hidden; }
img { max-width: 100%; display: block; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 18px; }

/* ---------- 淡化背景照片 ---------- */
.bg-photo {
  position: fixed; inset: -20px; z-index: -2;
  background: center / cover no-repeat;
  opacity: 0.22;
  filter: blur(3px) saturate(0.9);
}
.bg-veil {
  position: fixed; inset: 0; z-index: -1;
  background: linear-gradient(180deg, rgba(255,248,231,0.55), rgba(255,248,231,0.85));
}

/* ---------- 黃白格紋 ---------- */
.gingham {
  background-color: #FFF6D6;
  background-image:
    linear-gradient(90deg, var(--ging-dark) 50%, transparent 50%),
    linear-gradient(var(--ging-dark) 50%, transparent 50%);
  background-size: 28px 28px;
}

/* ---------- 可愛按鈕 ---------- */
.btn-cute {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 12px 26px;
  background: var(--apricot);
  border: var(--border); border-radius: 999px;
  box-shadow: 0 4px 0 var(--brown);
  font-size: 1.1rem; font-weight: 700; text-decoration: none; color: var(--brown);
  transition: transform .12s, box-shadow .12s, background .2s;
  -webkit-tap-highlight-color: transparent;
}
.btn-cute:hover { background: #F8D39B; }
.btn-cute:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--brown); }
.btn-cute.small { padding: 6px 16px; font-size: .95rem; }

.btn-bounce { animation: bounce 1.6s ease-in-out infinite; }
@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  40% { transform: translateY(-8px); }
  60% { transform: translateY(-2px); }
}

/* ---------- 語言切換 ---------- */
.lang {
  position: fixed; z-index: 60;
  top: calc(12px + env(safe-area-inset-top)); right: 12px;
  display: flex; padding: 3px;
  background: var(--cream-2); border: 2.5px solid var(--brown); border-radius: 999px;
  box-shadow: 0 3px 0 var(--brown);
}
.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(--brown-soft); cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.lang button[aria-pressed="true"] { background: var(--apricot); color: var(--brown); }

/* =========================================================
   ① 開場
   ========================================================= */
.intro {
  position: fixed; inset: 0; z-index: 50;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 18px; padding: 56px 18px 28px;
  background-color: #FFF6D6;
  background-image:
    linear-gradient(90deg, var(--ging-dark) 50%, transparent 50%),
    linear-gradient(var(--ging-dark) 50%, transparent 50%);
  background-size: 28px 28px;
  transition: opacity .5s, visibility .5s;
}
.intro.closed { opacity: 0; visibility: hidden; }

.intro-skip {
  position: absolute; top: calc(12px + env(safe-area-inset-top)); left: 12px;
  background: none; border: none; font-size: .95rem; text-decoration: underline; opacity: .7;
}

.intro-stage {
  position: relative;
  width: min(82vw, 56vh, 400px);
  aspect-ratio: 3 / 4;
  border: var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow);
  background: var(--cream-2);
}
.intro-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: calc(var(--radius) - 3px); }
.intro-reveal { opacity: 0; transform: scale(.6); }

.intro.revealed .intro-hidden { animation: knock .45s ease-in-out, fadeAway .35s .45s forwards; }
.intro.revealed .intro-reveal { animation: popIn .6s .55s cubic-bezier(.34, 1.56, .64, 1) forwards; }

@keyframes knock {
  0%, 100% { transform: translateX(0) rotate(0); }
  25% { transform: translateX(-6px) rotate(-2deg); }
  50% { transform: translateX(6px) rotate(2deg); }
  75% { transform: translateX(-4px) rotate(-1deg); }
}
@keyframes fadeAway { to { opacity: 0; transform: scale(.9); } }
@keyframes popIn {
  0% { opacity: 0; transform: scale(.6); }
  100% { opacity: 1; transform: scale(1); }
}

.intro-actions { display: grid; place-items: center; min-height: 110px; }
.intro-actions > * { grid-area: 1 / 1; }
.intro-hi, .intro-down { opacity: 0; pointer-events: none; transform: translateY(10px); transition: opacity .4s, transform .4s; }
.intro-hi { margin: 0 0 70px; font-size: 1.2rem; font-weight: 700; text-align: center; }
.intro-down { margin-top: 40px; }
.intro.revealed #introKnock { opacity: 0; pointer-events: none; transition: opacity .2s; animation: none; }
.intro.revealed .intro-hi { opacity: 1; transform: none; transition-delay: 1s; }
.intro.revealed .intro-down { opacity: 1; transform: none; pointer-events: auto; transition-delay: 1.3s; }
.intro-down .arrow { display: inline-block; animation: bounce 1.4s infinite; }

/* 噴出來的小粒子 */
.burst { position: absolute; inset: 0; pointer-events: none; }
.particle {
  position: absolute; left: 50%; top: 50%;
  font-size: 1.9rem; z-index: 2;
  animation: burst 1.2s ease-out forwards;
}
@keyframes burst {
  0% { transform: translate(-50%, -50%) scale(.3) rotate(0); opacity: 1; }
  100% { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(1.1) rotate(var(--rot)); opacity: 0; }
}

/* =========================================================
   頁首
   ========================================================= */
.site-header {
  padding: calc(40px + env(safe-area-inset-top)) 0 30px;
  text-align: center;
  border-bottom: var(--border);
}
.title-bubble {
  position: relative; display: inline-block;
  margin: 0; padding: 10px 30px;
  background: var(--apricot); border: var(--border); border-radius: 999px;
  box-shadow: var(--shadow);
  font-size: clamp(1.7rem, 7vw, 2.2rem); line-height: 1.3;
}
.title-bubble .flower { position: absolute; left: -12px; bottom: -14px; font-size: 1.6rem; animation: sway 3s ease-in-out infinite; }
@keyframes sway { 0%, 100% { transform: rotate(-10deg); } 50% { transform: rotate(10deg); } }
.subtitle { margin: 16px 0 0; font-weight: 700; }

/* =========================================================
   區塊
   ========================================================= */
.section {
  margin: 34px 0;
  padding: 22px 16px 24px;
  background: rgba(255, 253, 245, 0.92);
  border: var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow);
  scroll-margin-top: 20px;
}
.section-title {
  display: table; margin: -42px auto 18px;
  padding: 4px 22px;
  background: var(--apricot); border: var(--border); border-radius: 999px;
  font-size: 1.25rem;
}
.cat-section.pudding .section-title { background: var(--pudding); }
.cat-section.strawberry .section-title { background: var(--strawberry); color: #FFF6E6; }
.hint { margin: 6px 0 0; text-align: center; font-size: .9rem; opacity: .65; }

/* ---------- 輪播 ---------- */
.carousel { position: relative; }
.track {
  display: flex; gap: 12px;
  overflow-x: auto; scroll-snap-type: x mandatory;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
  border-radius: 20px;
}
.track::-webkit-scrollbar { display: none; }
.track img { -webkit-user-drag: none; user-select: none; }
.track.dragging { scroll-snap-type: none; cursor: grabbing; user-select: none; }
.track.dragging img { cursor: grabbing; }
@media (hover: hover) and (pointer: fine) {
  .track { cursor: grab; }
}
.slide { flex: 0 0 100%; margin: 0; scroll-snap-align: center; }
.carousel figure.slide {
  aspect-ratio: 4 / 5;
  border: var(--border); border-radius: 20px; overflow: hidden;
  background: var(--cream);
}
.carousel figure.slide img { width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; }

.carousel--peek .track { padding: 4px 4px 10px; }
.carousel--peek .slide { flex-basis: 86%; }

.nav-btn {
  position: absolute; top: calc(50% - 14px); transform: translateY(-50%);
  width: 38px; height: 38px; border-radius: 50%;
  background: rgba(255, 253, 245, .9); border: var(--border);
  font-size: 1.5rem; line-height: 1; padding: 0 0 4px;
  box-shadow: 0 3px 0 var(--brown);
}
.nav-btn { transition: opacity .25s, transform .12s, box-shadow .12s; }
.nav-btn.is-hidden { opacity: 0; pointer-events: none; }
.nav-btn.prev { left: 8px; }
.nav-btn.next { right: 8px; }
.nav-btn:active { transform: translateY(calc(-50% + 2px)); box-shadow: 0 1px 0 var(--brown); }

.dots { display: flex; justify-content: center; gap: 8px; margin-top: 12px; }
.dots button {
  width: 10px; height: 10px; padding: 0; border-radius: 999px;
  border: 2px solid var(--brown); background: transparent;
  transition: width .25s, background .25s;
}
.dots button.active { width: 26px; background: var(--sunflower); }

/* ---------- 檔案卡 ---------- */
.profile-card {
  padding: 20px 16px;
  border: var(--border); border-radius: 24px;
  box-shadow: 0 4px 0 var(--brown);
  text-align: center;
}
.profile-card.pudding { background: var(--pudding-soft); }
.profile-card.strawberry { background: var(--strawberry-soft); }
.avatar {
  width: 128px; height: 128px; margin: 0 auto 8px;
  border-radius: 50%; overflow: hidden; border: var(--border);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-card.pudding .avatar img { object-position: 50% 30%; }
.profile-card.strawberry .avatar img { object-position: 30% 45%; }
.profile-name { margin: 4px 0 8px; font-size: 1.45rem; }
.stats { display: flex; justify-content: center; gap: 8px; margin: 0 0 12px; }
.stats > div {
  flex: 1; max-width: 92px; padding: 4px 0;
  background: var(--cream-2); border: 2px solid var(--brown); border-radius: 14px;
}
.stats dt { font-size: .78rem; opacity: .7; }
.stats dd { margin: 0; font-weight: 700; }
.tags { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 0; padding: 0; list-style: none; }
.tags li {
  padding: 2px 12px; border-radius: 999px; border: 2px solid var(--brown);
  font-size: .9rem; font-weight: 700;
}
.pudding .tags li { background: var(--pudding); }
.strawberry .tags li { background: var(--strawberry); color: #FFF6E6; }

/* ---------- 對話泡泡 ---------- */
.speech {
  position: relative;
  margin: 26px 4px 0; padding: 14px 18px;
  background: var(--apricot-soft);
  border: var(--border); border-radius: 22px;
}
.speech::before, .speech::after {
  content: ""; position: absolute; left: 34px;
  border-style: solid; border-color: transparent;
}
.speech::before { top: -17px; border-width: 0 12px 17px; border-bottom-color: var(--brown); }
.speech::after { top: -12px; left: 37px; border-width: 0 9px 13px; border-bottom-color: var(--apricot-soft); }

/* ---------- 小時候 ---------- */
.polaroid {
  margin: 0 auto; padding: 12px 12px 4px; max-width: 420px;
  background: #fff; border: var(--border); border-radius: 8px;
  box-shadow: var(--shadow);
  transform: rotate(-2deg);
  transition: transform .3s;
}
.polaroid:hover { transform: rotate(0); }
.polaroid img { border-radius: 4px; cursor: zoom-in; }
.polaroid figcaption { padding: 8px 4px; text-align: center; }

/* ---------- 合照牆 ---------- */
.gallery { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.gallery figure {
  margin: 0; aspect-ratio: 1;
  border: var(--border); border-radius: 18px; overflow: hidden;
  background: var(--cream);
}
.gallery figure:first-child { grid-column: span 2; aspect-ratio: 4 / 3; }
.gallery img { width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; transition: transform .3s; }
.gallery img:hover { transform: scale(1.04); }
.gallery .placeholder {
  display: grid; place-items: center; text-align: center;
  border-style: dashed; color: var(--brown-soft); font-weight: 700;
}

/* =========================================================
   頁尾
   ========================================================= */
.site-footer { padding: 26px 0 22px; text-align: center; border-top: var(--border); font-weight: 700; }
.site-footer p { margin: 0 0 12px; }
.footer-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-bottom: 12px; }
.copyright { font-size: .85rem; opacity: .7; }

/* =========================================================
   底部小圓鈕列
   ========================================================= */
.bottom-nav {
  position: fixed; left: 50%; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 40;
  transform: translateX(-50%);
  display: flex; gap: 6px; padding: 6px 10px;
  background: var(--cream-2); border: var(--border); border-radius: 999px;
  box-shadow: 0 4px 0 var(--brown);
  transition: opacity .3s, transform .3s;
}
body.intro-open .bottom-nav { opacity: 0; transform: translate(-50%, 30px); pointer-events: none; }
.bottom-nav a {
  display: flex; flex-direction: column; align-items: center;
  min-width: 58px; padding: 2px 6px; white-space: nowrap;
  border-radius: 999px; text-decoration: none; color: var(--brown);
  font-size: .72rem; font-weight: 700; line-height: 1.3;
  transition: background .2s, transform .2s;
  -webkit-tap-highlight-color: transparent;
}
.bottom-nav .ico { font-size: 1.35rem; transition: transform .2s; }
.bottom-nav a.active { background: var(--apricot); }
.bottom-nav a.active .ico { transform: translateY(-2px) scale(1.12); }

/* =========================================================
   點開大圖
   ========================================================= */
.lightbox {
  position: fixed; inset: 0; z-index: 70;
  display: grid; place-items: center; padding: 20px;
  background: rgba(60, 40, 22, .85);
  animation: fadeIn .2s;
}
.lightbox[hidden] { display: none; }
.lightbox img {
  max-width: 100%; max-height: 85vh;
  border: 4px solid var(--cream); border-radius: 18px;
  animation: popIn .3s cubic-bezier(.34, 1.56, .64, 1);
}
.lightbox-close {
  position: absolute; top: calc(14px + env(safe-area-inset-top)); right: 14px;
  width: 42px; height: 42px; border-radius: 50%;
  background: var(--cream); border: var(--border); font-size: 1.1rem;
}
@keyframes fadeIn { from { opacity: 0; } }

/* 平板、電腦：內容維持手機寬度置中 */
@media (min-width: 700px) {
  .section { padding: 26px 24px 28px; }
}

/* 使用者關閉動畫時，尊重設定 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  html { scroll-behavior: auto; }
}
