/* ============================================================
   生日快乐 · 彭冠乔
   纯 CSS / 无外部依赖
   ============================================================ */

:root {
  --bg: #070a14;
  --ink: #f5eee2;
  --ink-soft: rgba(245, 238, 226, 0.76);
  --ink-faint: rgba(245, 238, 226, 0.5);
  --gold: #e8c98f;
  --gold-deep: #c39a5b;
  --cream: #fff6e6;
  --rose: #e9a9a2;
  --serif: "Songti SC", "STSong", "Noto Serif SC", "Source Han Serif SC",
    "SimSun", "Georgia", serif;
  --sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC",
    system-ui, -apple-system, "Segoe UI", sans-serif;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scrollbar-width: none;
}

::-webkit-scrollbar { width: 0; height: 0; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  border-radius: 8px;
  background: rgba(232, 201, 143, 0.3);
  border: 2px solid transparent;
  background-clip: content-box;
}

body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.7;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  animation: pageIn 1.2s ease both;
}

@keyframes pageIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ---------------- 背景 ---------------- */

.bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  background:
    radial-gradient(120% 80% at 50% -10%, #16213d 0%, #0c1122 42%, #070a14 78%, #05070f 100%);
}

#stars {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.aurora {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.3;
  will-change: transform;
}

.aurora--gold {
  width: 52vw;
  height: 52vw;
  min-width: 340px;
  min-height: 340px;
  left: -10vw;
  top: -6vh;
  opacity: 0.32;
  background: radial-gradient(circle, rgba(255, 186, 104, 0.6), rgba(255, 152, 72, 0.16) 44%, rgba(255, 152, 72, 0) 68%);
  animation: drift 26s ease-in-out infinite alternate;
}

.aurora--rose {
  width: 70vw;
  height: 70vw;
  min-width: 380px;
  min-height: 380px;
  right: -22vw;
  bottom: -18vh;
  background: radial-gradient(circle, rgba(233, 169, 162, 0.42), rgba(160, 110, 180, 0.18) 45%, rgba(233, 169, 162, 0) 70%);
  animation: drift 32s ease-in-out infinite alternate-reverse;
}

@keyframes drift {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(4vw, 5vh, 0); }
}

.vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(120% 90% at 50% 45%, rgba(0, 0, 0, 0) 45%, rgba(0, 0, 0, 0.55) 100%);
}

.grain {
  position: absolute;
  inset: 0;
  opacity: 0.045;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/></filter><rect width='160' height='160' filter='url(%23n)'/></svg>");
  background-size: 160px 160px;
}

.cursor-glow {
  position: fixed;
  left: 0;
  top: 0;
  width: 420px;
  height: 420px;
  margin: -210px 0 0 -210px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 1;
  opacity: 0;
  transition: opacity 0.6s ease;
  background: radial-gradient(circle, rgba(232, 201, 143, 0.13), rgba(232, 201, 143, 0) 62%);
  will-change: transform;
}

@media (hover: hover) and (pointer: fine) {
  .cursor-glow { opacity: 1; }
}

/* ---------------- 布局 ---------------- */

main {
  position: relative;
  z-index: 2;
}

section {
  padding: clamp(72px, 13vh, 150px) 22px;
}

.hero {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding-bottom: clamp(40px, 8vh, 90px);
}

/* ---------------- 首屏 ---------------- */

.eyebrow {
  margin: 0 0 clamp(18px, 4vh, 34px);
  font-family: var(--sans);
  font-size: clamp(9px, 2.4vw, 11px);
  letter-spacing: 0.52em;
  text-indent: 0.52em;
  color: var(--gold);
  opacity: 0.9;
}

.name {
  margin: 0;
  display: flex;
  justify-content: center;
  gap: 0.02em;
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(3.6rem, 17.5vw, 10.5rem);
  line-height: 1.04;
  letter-spacing: 0.04em;
  background: linear-gradient(104deg, #9d6c2c 0%, #d9ae6e 20%, #f2d8a9 40%, #e0bb7d 56%, #b07f39 76%, #e9c68a 100%);
  background-size: 230% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  animation: shimmer 10s ease-in-out infinite;
  filter: drop-shadow(0 8px 34px rgba(232, 201, 143, 0.22));
}

@keyframes shimmer {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.name span {
  display: inline-block;
  opacity: 0;
  transform: translateY(0.42em) rotate(3deg);
  animation: nameIn 1.15s var(--ease) forwards;
}

@keyframes nameIn {
  to { opacity: 1; transform: translateY(0) rotate(0); }
}

.tagline {
  margin: clamp(22px, 4vh, 34px) 0 0;
  font-family: var(--serif);
  font-size: clamp(1rem, 3.6vw, 1.4rem);
  letter-spacing: 0.16em;
  color: var(--ink-soft);
  text-wrap: pretty;
}

.rule {
  display: flex;
  align-items: center;
  justify-content: center;
  width: min(240px, 56vw);
  margin: clamp(26px, 5vh, 44px) auto 0;
}

.rule span {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, rgba(232, 201, 143, 0), rgba(232, 201, 143, 0.6), rgba(232, 201, 143, 0));
}

.rule--soft span { background: linear-gradient(90deg, rgba(232, 201, 143, 0), rgba(232, 201, 143, 0.32), rgba(232, 201, 143, 0)); }

.scroll-hint {
  margin: clamp(30px, 6vh, 56px) 0 0;
  font-size: clamp(12px, 3.1vw, 13px);
  letter-spacing: 0.3em;
  color: rgba(245, 238, 226, 0.64);
  animation: breathe 3.4s ease-in-out infinite;
}

@keyframes breathe {
  0%, 100% { opacity: 0.72; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(4px); }
}

/* ---------------- 蛋糕 ---------------- */

.cake-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.cake-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  transform: scale(0.92);
}

.cake {
  position: relative;
  width: 320px;
  height: 340px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  outline: none;
}

.cake:focus-visible .plate { box-shadow: 0 0 0 2px rgba(232, 201, 143, 0.7); }

.halo {
  position: absolute;
  left: 50%;
  bottom: 26px;
  width: 400px;
  height: 400px;
  margin-left: -200px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 196, 120, 0.28), rgba(255, 170, 90, 0.1) 38%, rgba(255, 170, 90, 0) 66%);
  transition: opacity 1.1s ease;
  animation: haloPulse 4.4s ease-in-out infinite;
}

@keyframes haloPulse {
  0%, 100% { opacity: 0.72; }
  50% { opacity: 1; }
}

.cake.blown .halo {
  opacity: 0.18;
  animation: none;
}

/* 蜡烛 */
.candles {
  position: absolute;
  left: 50%;
  bottom: 196px;
  transform: translateX(-50%);
  display: flex;
  align-items: flex-end;
  gap: 30px;
}

.candle {
  position: relative;
  display: block;
  width: 10px;
  height: 54px;
  border-radius: 5px;
  background:
    repeating-linear-gradient(158deg, var(--cream) 0 5px, #efb9b2 5px 10px);
  box-shadow: inset -2px 0 3px rgba(0, 0, 0, 0.18), 0 3px 10px rgba(0, 0, 0, 0.35);
}

.candle.c1 { height: 48px; }
.candle.c2 { height: 58px; }
.candle.c3 { height: 50px; }

.candle .wick {
  position: absolute;
  left: 50%;
  top: -12px;
  width: 2px;
  height: 13px;
  margin-left: -1px;
  border-radius: 1px;
  background: #2a2118;
}

.candle .flame {
  position: absolute;
  left: 50%;
  top: -34px;
  width: 15px;
  height: 24px;
  margin-left: -7.5px;
  border-radius: 50% 50% 46% 46% / 62% 62% 38% 38%;
  background: radial-gradient(ellipse at 50% 74%, #ffffff 0%, #fff2c9 26%, #ffcb73 52%, #ff8b33 72%, rgba(255, 120, 30, 0) 78%);
  box-shadow:
    0 0 18px 6px rgba(255, 186, 96, 0.55),
    0 0 48px 16px rgba(255, 150, 60, 0.26),
    0 0 90px 34px rgba(255, 140, 50, 0.12);
  transform-origin: 50% 100%;
  animation: flicker 1.7s ease-in-out infinite;
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.candle:nth-child(2) .flame { animation-duration: 2.1s; animation-delay: -0.6s; }
.candle:nth-child(3) .flame { animation-duration: 1.45s; animation-delay: -1.1s; }

@keyframes flicker {
  0%, 100% { transform: translateY(0) scale(1) skewX(0deg); opacity: 1; }
  22% { transform: translateY(-1.5px) scale(1.05, 0.96) skewX(2deg); opacity: 0.94; }
  48% { transform: translateY(1px) scale(0.96, 1.05) skewX(-2.5deg); opacity: 1; }
  74% { transform: translateY(-1px) scale(1.03, 0.98) skewX(1.5deg); opacity: 0.9; }
}

.smoke {
  position: absolute;
  left: 50%;
  top: -26px;
  width: 8px;
  height: 8px;
  margin-left: -4px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(220, 220, 230, 0.5), rgba(220, 220, 230, 0) 70%);
  opacity: 0;
}

/* 熄灭时必须先停掉 flicker 动画：CSS 动画会覆盖这里的 opacity 声明 */
.cake.blown .flame {
  animation: none;
  opacity: 0;
  transform: translateY(-14px) scale(0.35);
  box-shadow: none;
}

.cake.blown .smoke {
  animation: smokeUp 2.6s ease-out forwards;
}

.candle:nth-child(2) .smoke { animation-delay: 0.12s; }
.candle:nth-child(3) .smoke { animation-delay: 0.22s; }

@keyframes smokeUp {
  0% { opacity: 0.55; transform: translateY(0) scale(0.6); }
  60% { opacity: 0.3; }
  100% { opacity: 0; transform: translateY(-62px) scale(2.6); }
}

/* 蛋糕体 */
.tier {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: block;
  border-radius: 8px 8px 12px 12px;
}

.tier--bottom {
  bottom: 30px;
  width: 258px;
  height: 104px;
  background: linear-gradient(180deg, #f7e2c0 0%, #e6c092 46%, #cfa270 78%, #bb8c5a 100%);
  box-shadow:
    inset 0 -14px 24px rgba(120, 70, 30, 0.22),
    inset 0 6px 10px rgba(255, 255, 255, 0.35),
    0 16px 34px rgba(0, 0, 0, 0.45);
}

.tier--top {
  bottom: 128px;
  width: 176px;
  height: 80px;
  background: linear-gradient(180deg, #fdf0d8 0%, #f3d7ad 48%, #e2b988 80%, #d1a471 100%);
  box-shadow:
    inset 0 -10px 18px rgba(120, 70, 30, 0.18),
    inset 0 5px 9px rgba(255, 255, 255, 0.45),
    0 12px 26px rgba(0, 0, 0, 0.4);
}

.frosting {
  position: absolute;
  left: 0;
  right: 0;
  top: -9px;
  display: block;
  height: 22px;
  border-radius: 10px 10px 3px 3px;
  background: linear-gradient(180deg, #fffdf8, #fdf1da);
  box-shadow: inset 0 -5px 9px rgba(190, 150, 100, 0.25), 0 4px 12px rgba(0, 0, 0, 0.18);
}

.frosting::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  height: 21px;
  background-image: radial-gradient(circle at 11px 0, #fdf1da 10.6px, rgba(253, 241, 218, 0) 11.2px);
  background-size: 22px 21px;
  background-repeat: repeat-x;
}

.speck {
  position: absolute;
  display: block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffd9d1, #d0615a);
  opacity: 0.95;
}

.speck--1 { left: 24px; top: 30px; }
.speck--2 { right: 30px; top: 46px; width: 5px; height: 5px; }
.speck--3 { left: 50%; top: 60px; width: 5px; height: 5px; }
.speck--4 { left: 40px; top: 34px; }
.speck--5 { right: 56px; top: 62px; width: 5px; height: 5px; }

.plate {
  position: absolute;
  left: 50%;
  bottom: 14px;
  width: 312px;
  height: 34px;
  margin-left: -156px;
  border-radius: 50%;
  background: radial-gradient(ellipse at 50% 40%, rgba(232, 201, 143, 0.3), rgba(232, 201, 143, 0.09) 46%, rgba(232, 201, 143, 0) 72%);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.26);
  transition: box-shadow 0.3s ease;
}

.cake-hint {
  margin: 8px 0 0;
  font-size: 12px;
  letter-spacing: 0.34em;
  color: rgba(245, 238, 226, 0.56);
  animation: breathe 3s ease-in-out infinite;
}

.cake.blown ~ .cake-hint,
.cake-wrap.blown .cake-hint {
  animation: none;
  opacity: 0;
  transition: opacity 0.8s ease;
}

/* 愿望揭晓 */
.wish {
  margin-top: clamp(28px, 6vh, 52px);
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  transform: translateY(18px);
  transition: opacity 1.2s var(--ease) 0.35s, transform 1.2s var(--ease) 0.35s, max-height 1.2s ease 0.35s;
}

.wish.show {
  opacity: 1;
  max-height: 520px;
  transform: translateY(0);
}

.wish-label {
  margin: 0 0 18px;
  font-size: 9.5px;
  letter-spacing: 0.55em;
  text-indent: 0.55em;
  color: var(--gold);
  opacity: 0.8;
}

.wish-text {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(1.35rem, 5.6vw, 2.1rem);
  line-height: 1.85;
  letter-spacing: 0.1em;
  background: linear-gradient(102deg, #f4e4c6, #fffaf0 45%, #e8c98f 90%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}

/* ---------------- 引文 ---------------- */

.quote-section {
  display: flex;
  justify-content: center;
  padding-top: 0;
}

.quote {
  position: relative;
  max-width: 620px;
  padding: clamp(34px, 6vh, 56px) clamp(24px, 6vw, 54px);
  text-align: center;
  border-top: 1px solid rgba(232, 201, 143, 0.15);
  border-bottom: 1px solid rgba(232, 201, 143, 0.15);
}

.quote::before,
.quote::after {
  content: "\201C";
  position: absolute;
  font-family: var(--serif);
  font-size: 64px;
  line-height: 1;
  color: rgba(232, 201, 143, 0.28);
}

.quote::before { left: 6px; top: 6px; }
.quote::after { content: "\201D"; right: 6px; bottom: -14px; }

.quote p {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(1.3rem, 5.2vw, 2rem);
  line-height: 2;
  letter-spacing: 0.14em;
  color: rgba(245, 238, 226, 0.88);
  text-wrap: pretty;
}

/* ---------------- 卡片 ---------------- */

.cards-section {
  max-width: 1080px;
  margin: 0 auto;
}

.section-title {
  margin: 0 0 clamp(30px, 6vh, 54px);
  text-align: center;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(1rem, 3.4vw, 1.2rem);
  letter-spacing: 0.42em;
  text-indent: 0.42em;
  color: rgba(245, 238, 226, 0.82);
}

.cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(14px, 2.6vw, 24px);
}

.card {
  position: relative;
  padding: clamp(26px, 4.4vw, 38px) clamp(22px, 3.4vw, 30px);
  border-radius: 18px;
  border: 1px solid rgba(232, 201, 143, 0.16);
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.015));
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: transform 0.55s var(--ease), border-color 0.55s ease, box-shadow 0.55s ease;
  overflow: hidden;
}

.card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(120% 80% at 0% 0%, rgba(232, 201, 143, 0.1), rgba(232, 201, 143, 0) 55%);
  opacity: 0;
  transition: opacity 0.55s ease;
}

.card:hover {
  transform: translateY(-6px);
  border-color: rgba(232, 201, 143, 0.38);
  box-shadow: 0 26px 56px rgba(0, 0, 0, 0.38);
}

.card:hover::after { opacity: 1; }

.card-no {
  display: block;
  margin-bottom: 16px;
  font-family: var(--serif);
  font-size: 11px;
  letter-spacing: 0.32em;
  color: var(--gold);
  opacity: 0.9;
}

.card h3 {
  margin: 0 0 14px;
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(1.1rem, 3.8vw, 1.28rem);
  letter-spacing: 0.1em;
  color: var(--ink);
}

.card p {
  margin: 0;
  font-size: clamp(0.9rem, 3.3vw, 0.97rem);
  line-height: 1.95;
  color: rgba(245, 238, 226, 0.78);
  text-wrap: balance; /* 中文三行块：均衡断行，避免末行孤字 */
}

/* ---------------- 页脚 ---------------- */

.footer {
  padding: clamp(50px, 9vh, 90px) 22px clamp(46px, 8vh, 80px);
  text-align: center;
}

.footer .rule { margin-bottom: 30px; }

.footer-name {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(1rem, 3.6vw, 1.15rem);
  letter-spacing: 0.5em;
  text-indent: 0.5em;
  color: var(--ink-soft);
}

.footer-sub {
  margin: 10px 0 0;
  font-size: 10.5px;
  letter-spacing: 0.34em;
  color: rgba(245, 238, 226, 0.58);
}

/* ---------------- 音乐开关 ---------------- */

.music {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 46px;
  height: 46px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(232, 201, 143, 0.3);
  background: rgba(12, 17, 34, 0.6);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--gold);
  cursor: pointer;
  transition: border-color 0.35s ease, background 0.35s ease, transform 0.35s ease;
  -webkit-tap-highlight-color: transparent;
}

.music:hover { border-color: rgba(232, 201, 143, 0.7); transform: translateY(-2px); }
.music:focus-visible { outline: 2px solid rgba(232, 201, 143, 0.6); outline-offset: 3px; }

.music svg {
  width: 17px;
  height: 17px;
  fill: currentColor;
  opacity: 0.9;
}

.music-bars {
  display: none;
  align-items: flex-end;
  gap: 2px;
  height: 12px;
}

.music-bars i {
  display: block;
  width: 2px;
  height: 4px;
  border-radius: 1px;
  background: currentColor;
  animation: bar 1s ease-in-out infinite;
}

.music-bars i:nth-child(2) { animation-delay: 0.18s; }
.music-bars i:nth-child(3) { animation-delay: 0.36s; }

@keyframes bar {
  0%, 100% { height: 4px; opacity: 0.6; }
  50% { height: 12px; opacity: 1; }
}

.music[aria-pressed="true"] .music-bars { display: flex; }
.music[aria-pressed="true"] svg { display: none; }

/* ---------------- 彩带 ---------------- */

.confetti {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 50;
  pointer-events: none;
}

/* ---------------- 入场动画 ---------------- */

.reveal-up {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 1.1s var(--ease), transform 1.1s var(--ease);
  will-change: opacity, transform;
}

.reveal-up.in {
  opacity: 1;
  transform: translateY(0);
}

/* ---------------- 响应式 ---------------- */

@media (max-width: 860px) {
  .cards { grid-template-columns: 1fr; }
  .card { backdrop-filter: none; -webkit-backdrop-filter: none; background: linear-gradient(160deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.015)); }
  /* 手机上弱化大面积模糊，省 GPU */
  .aurora { filter: blur(46px); opacity: 0.24; }
  .grain { opacity: 0.03; }
}

@media (max-width: 420px) {
  .cake-wrap { transform: scale(0.82); margin: -18px 0; }
  .candles { gap: 26px; }
  .music { right: 14px; bottom: 14px; }
}

@media (max-height: 680px) and (min-width: 421px) {
  .cake-wrap { transform: scale(0.86); }
}

/* ---------------- 无障碍 / 降级 ---------------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .reveal-up { opacity: 1; transform: none; }
  .name span { opacity: 1; transform: none; }
}

@media print {
  .bg, .music, .confetti, .cursor-glow { display: none !important; }
  body { background: #fff; color: #111; }
}
