/* ============================================================
   午餐系統 · DinnerSystem — Memorial Stylesheet
   Direction: Immersive Editorial / Interactive Data Flow
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f0e9d8;
  --bg-deep: #e6dcc4;
  --bg-darker: #1a1815;
  --ink: #1f1d1a;
  --ink-soft: #4a463f;
  --ink-mute: #7a7367;
  --line: #c9bda5;
  --line-strong: #9a8e74;
  --accent: #a85d2a;        /* burnt orange — newsprint accent */
  --accent-deep: #6b3a14;
  --paper: #faf6ec;
  --paper-warm: #f4ecd8;
  --gold: #b8964a;
}

/* Hide default cursor on desktop where custom cursor works */
@media (pointer: fine) {
  body { cursor: none; }
  a, button, .stat { cursor: none; }
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  background-image:
    radial-gradient(circle at 12% 8%,  rgba(184, 150, 74, 0.12), transparent 55%),
    radial-gradient(circle at 88% 92%, rgba(168, 93, 42, 0.08),  transparent 55%);
  color: var(--ink);
  font-family: "Noto Serif TC", "Cormorant Garamond", "Songti TC", serif;
  font-size: 18px;
  line-height: 1.85;
  letter-spacing: 0.01em;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Custom Cursor ---------- */
.custom-cursor {
  position: fixed;
  top: 0; left: 0;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--accent);
  pointer-events: none;
  z-index: 10000;
  transform: translate(-50%, -50%);
  transition: width 0.3s cubic-bezier(0.2, 0.8, 0.2, 1), 
              height 0.3s cubic-bezier(0.2, 0.8, 0.2, 1),
              background 0.3s cubic-bezier(0.2, 0.8, 0.2, 1),
              mix-blend-mode 0.3s ease;
  mix-blend-mode: multiply;
}

.custom-cursor.hover {
  width: 64px; height: 64px;
  background: var(--paper);
  mix-blend-mode: difference;
}

/* ---------- Canvas Background ---------- */
.data-stream {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  opacity: 0.8;
}

/* ---------- Texture overlays ---------- */
.grain {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 1000;
  opacity: 0.4;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.1  0 0 0 0 0.08  0 0 0 0 0.05  0 0 0 0.18 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

.vignette {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 999;
  box-shadow: inset 0 0 220px rgba(60, 40, 20, 0.18);
}

/* ---------- Container ---------- */
.container {
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  padding: 0 32px;
  position: relative;
  z-index: 1;
}
.container.narrow { max-width: 700px; }
.container.wide   { max-width: 1180px; }

/* ============================================================
   HERO — asymmetric type sculpture
   ============================================================ */
.hero {
  min-height: calc(100vh - 44px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 80px 24px 100px;
  position: relative;
  text-align: center;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.bg-year {
  position: absolute;
  font-family: "Cormorant Garamond", serif;
  font-weight: 600;
  font-size: clamp(180px, 36vw, 540px);
  line-height: 0.85;
  color: var(--line);
  opacity: 0.55;
  letter-spacing: -0.02em;
  user-select: none;
  white-space: nowrap;
  will-change: transform;
}

.bg-year-1 { top: -2vw; left: -3vw; transform: rotate(-4deg); }
.bg-year-2 { bottom: -4vw; right: -3vw; color: var(--accent); opacity: 0.18; transform: rotate(3deg); }

.hero-inner {
  max-width: 820px;
  width: 100%;
  position: relative;
  z-index: 2;
}

.kicker {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.36em;
  color: var(--accent-deep);
  margin-bottom: 56px;
  text-transform: uppercase;
  padding: 8px 18px;
  border-top: 1px solid var(--accent);
  border-bottom: 1px solid var(--accent);
  animation: fade-in 1.2s ease both;
}

.kicker .dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--accent);
}

.logo {
  width: 150px;
  height: 150px;
  object-fit: contain;
  margin: 0 auto 32px;
  display: block;
  filter: grayscale(0.2) contrast(0.92) sepia(0.08);
  animation: rise 1.4s cubic-bezier(.2,.8,.2,1) both;
}

.title {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  margin-bottom: 36px;
  animation: rise 1.6s cubic-bezier(.2,.8,.2,1) both;
}

.title-school {
  font-size: clamp(13px, 1.4vw, 16px);
  font-weight: 500;
  letter-spacing: 0.5em;
  color: var(--accent-deep);
  line-height: 1;
  text-indent: 0.5em;
  margin-bottom: 4px;
}

.title-cn {
  font-size: clamp(60px, 10vw, 120px);
  font-weight: 900;
  letter-spacing: 0.18em;
  color: var(--ink);
  line-height: 1;
  text-indent: 0.18em;
  text-shadow: 1px 1px 0 rgba(168, 93, 42, 0.08);
}

.title-en {
  font-family: "Cormorant Garamond", serif;
  font-style: italic;
  font-size: clamp(15px, 1.8vw, 19px);
  font-weight: 500;
  color: var(--ink-mute);
  letter-spacing: 0.32em;
  text-transform: uppercase;
  text-indent: 0.32em;
  margin-top: 6px;
}

.years {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 26px;
  font-family: "Cormorant Garamond", serif;
  font-size: clamp(36px, 4.5vw, 56px);
  font-weight: 600;
  color: var(--ink);
  letter-spacing: 0.08em;
  margin-bottom: 56px;
  animation: rise 1.8s cubic-bezier(.2,.8,.2,1) both;
}

.years .year { position: relative; }
.years .dash {
  width: 60px; height: 2px;
  background: var(--accent);
  position: relative;
}
.years .dash::before, .years .dash::after {
  content: ""; position: absolute; top: 50%; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); transform: translateY(-50%);
}
.years .dash::before { left: -3px; }
.years .dash::after  { right: -3px; }

.lede {
  font-size: clamp(17px, 1.6vw, 21px);
  color: var(--ink-soft);
  line-height: 1.95;
  margin-bottom: 22px;
  text-wrap: balance;
  animation: rise 2s cubic-bezier(.2,.8,.2,1) both;
}

.lede.en {
  font-family: "Cormorant Garamond", serif;
  font-style: italic;
  font-size: clamp(15px, 1.3vw, 18px);
  color: var(--ink-mute);
  letter-spacing: 0.02em;
}

.scroll-hint {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.4em;
  color: var(--ink-mute);
  text-transform: uppercase;
  animation: fade-in 2.4s ease both;
  z-index: 3;
}

.scroll-hint .line {
  width: 1px;
  height: 60px;
  background: linear-gradient(to bottom, var(--ink-mute), transparent);
  animation: line-pulse 2.4s ease-in-out infinite;
}

/* ============================================================
   SECTIONS
   ============================================================ */
.section {
  padding: 160px 24px 140px;
  position: relative;
}

.section + .section {
  border-top: 1px solid var(--line);
}

.section-mark {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 32px;
}
.section-mark.center { justify-content: center; }

.section-mark .numeral {
  font-family: "Cormorant Garamond", serif;
  font-style: italic;
  font-size: 22px;
  font-weight: 500;
  color: var(--accent);
  letter-spacing: 0.04em;
}

.section-mark .rule {
  flex: 1; height: 1px;
  background: var(--line-strong);
  max-width: 80px;
}
.section-mark.center .rule { max-width: 50px; }

.eyebrow {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.4em;
  color: var(--accent);
  text-transform: uppercase;
  margin-bottom: 28px;
}
.eyebrow.center { text-align: center; }
.center { text-align: center; }

h2 {
  font-size: clamp(30px, 4.6vw, 52px);
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: 0.04em;
  color: var(--ink);
  margin-bottom: 72px;
  text-wrap: balance;
}

/* ============================================================
   STORY
   ============================================================ */
.story-body p {
  font-size: clamp(16px, 1.4vw, 19px);
  color: var(--ink-soft);
  line-height: 2;
  margin-bottom: 28px;
  letter-spacing: 0.02em;
}

.story-body p.drop::first-letter {
  font-family: "Cormorant Garamond", serif;
  font-size: 5em;
  font-weight: 700;
  float: left;
  line-height: 0.9;
  margin: 0.05em 0.14em 0 0;
  color: var(--accent-deep);
}

.story-body strong {
  color: var(--ink);
  font-weight: 700;
  letter-spacing: 0.05em;
  background: linear-gradient(transparent 65%, rgba(168, 93, 42, 0.25) 65%);
  padding: 0 2px;
  transition: color 0.3s;
}

.story-body em {
  font-family: "Cormorant Garamond", serif;
  font-style: italic;
  color: var(--accent-deep);
  font-size: 1.1em;
  letter-spacing: 0.04em;
}

.pull {
  margin: 56px -8% 56px;
  padding: 36px 40px;
  border-top: 3px solid var(--ink);
  border-bottom: 1px solid var(--ink);
  font-family: "Cormorant Garamond", serif;
  font-style: italic;
  font-size: clamp(22px, 2.6vw, 32px);
  font-weight: 500;
  text-align: center;
  color: var(--ink);
  line-height: 1.4;
  position: relative;
  background: var(--paper-warm);
  text-wrap: balance;
}

.pull::before, .pull::after {
  content: "✦";
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  color: var(--accent);
  font-size: 14px;
}
.pull::before { left: 14px; }
.pull::after  { right: 14px; }

/* ============================================================
   STATS — 3D Magnetic Cards
   ============================================================ */
.stats {
  background: var(--bg-deep);
  overflow: hidden;
  perspective: 1000px;
}

.watermark {
  position: absolute;
  font-family: "Noto Serif TC", serif;
  font-weight: 900;
  font-size: clamp(360px, 60vw, 880px);
  line-height: 0.85;
  color: var(--ink);
  opacity: 0.04;
  top: -8%;
  right: -8%;
  user-select: none;
  pointer-events: none;
  z-index: 0;
}

.stat-grid-v2 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: minmax(180px, auto);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  position: relative;
  z-index: 1;
}

.stat {
  background: var(--paper);
  padding: 44px 32px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  transform-style: preserve-3d;
  will-change: transform;
}

/* Base states for cards */
.stat::before {
  content: "";
  position: absolute; inset: 0;
  background: radial-gradient(circle at center, rgba(255,255,255,0.8) 0%, transparent 80%);
  opacity: 0;
  transition: opacity 0.3s;
  z-index: -1;
  pointer-events: none;
}
.stat:hover::before { opacity: 1; }

.stat-grid-v2 .span-2 { grid-column: span 2; }

.stat-grid-v2 .hero-stat {
  grid-column: span 2;
  grid-row: span 2;
  background: var(--ink);
  color: var(--paper);
  padding: 56px 44px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-start;
}

.stat-grid-v2 .hero-stat::before {
  background: radial-gradient(circle at center, rgba(255,255,255,0.1) 0%, transparent 80%);
}

.stat-grid-v2 .hero-stat .stat-num {
  font-family: "Cormorant Garamond", serif;
  font-size: clamp(140px, 18vw, 240px);
  font-weight: 500;
  color: var(--paper);
  line-height: 0.85;
  letter-spacing: -0.02em;
  transform: translateZ(30px);
}

.stat-grid-v2 .hero-stat .stat-suffix {
  font-family: "Cormorant Garamond", serif;
  font-style: italic;
  font-size: clamp(40px, 5vw, 64px);
  font-weight: 400;
  color: var(--gold);
  margin-top: -16px;
  margin-bottom: 24px;
  letter-spacing: 0.04em;
  transform: translateZ(20px);
}

.stat-grid-v2 .hero-stat .stat-label {
  font-family: "Noto Serif TC", serif;
  font-size: 14px;
  letter-spacing: 0.3em;
  color: rgba(250, 246, 236, 0.65);
  text-transform: none;
  transform: translateZ(10px);
}

.stat-grid-v2 .stat-num {
  font-family: "Cormorant Garamond", serif;
  font-size: clamp(44px, 5.4vw, 68px);
  font-weight: 500;
  color: var(--ink);
  line-height: 1;
  margin-bottom: 18px;
  letter-spacing: 0.02em;
  transform: translateZ(20px);
}

.stat-grid-v2 .stat-label {
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.24em;
  color: var(--ink-mute);
  text-transform: uppercase;
  line-height: 1.7;
  transform: translateZ(10px);
}

.stat-grid-v2 .featured {
  background: var(--accent-deep);
  color: var(--paper);
}
.stat-grid-v2 .featured::before {
  background: radial-gradient(circle at center, rgba(255,255,255,0.15) 0%, transparent 80%);
}

.stat-grid-v2 .featured .stat-num {
  font-size: clamp(80px, 10vw, 140px);
  color: var(--paper);
  line-height: 1;
  margin-bottom: 12px;
}

.stat-grid-v2 .featured .stat-label { color: rgba(250, 246, 236, 0.85); }
.stat-grid-v2 .featured .stat-label span { color: rgba(250, 246, 236, 0.55); display: block; margin-top: 4px; }

.stat-grid-v2 .featured .stat-extra {
  margin-top: 14px;
  font-family: "Cormorant Garamond", serif;
  font-style: italic;
  font-size: 16px;
  color: var(--gold);
  letter-spacing: 0.04em;
  transform: translateZ(15px);
}

/* ============================================================
   QUOTE
   ============================================================ */
.quote { padding: 140px 24px; background: var(--paper-warm); }

blockquote { text-align: center; position: relative; }

blockquote::before {
  content: "“";
  position: absolute;
  top: -100px;
  left: 50%;
  transform: translateX(-50%);
  font-family: "Cormorant Garamond", serif;
  font-size: 240px;
  color: var(--accent);
  opacity: 0.2;
  line-height: 1;
  z-index: 0;
}

blockquote p {
  position: relative;
  font-family: "Noto Serif TC", serif;
  font-size: clamp(20px, 2.4vw, 28px);
  font-weight: 500;
  color: var(--ink);
  line-height: 2;
  letter-spacing: 0.06em;
  z-index: 1;
  text-wrap: balance;
}

blockquote footer {
  margin-top: 48px;
  font-family: "Cormorant Garamond", serif;
  font-style: italic;
  font-size: 18px;
  color: var(--ink-mute);
  letter-spacing: 0.1em;
}

/* ============================================================
   FAREWELL
   ============================================================ */
.farewell { background: var(--paper); }

.farewell-body p {
  font-size: clamp(16px, 1.4vw, 19px);
  color: var(--ink-soft);
  line-height: 2;
  margin-bottom: 28px;
  text-align: center;
  letter-spacing: 0.02em;
  text-wrap: balance;
}

.farewell-body p.big {
  font-size: clamp(22px, 2.6vw, 32px);
  color: var(--ink);
  font-weight: 700;
  margin: 56px 0;
  line-height: 1.6;
  letter-spacing: 0.06em;
}

/* Dynamic Rubber-stamp */
.stamp {
  display: flex;
  justify-content: center;
  margin: 72px 0 56px;
  perspective: 500px;
}

.stamp-inner {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 44px;
  border: 4px double var(--accent);
  color: var(--accent);
  font-family: "JetBrains Mono", monospace;
  text-transform: uppercase;
  transform: rotate(-4deg);
  position: relative;
  background: rgba(168, 93, 42, 0.04);
  box-shadow:
    inset 0 0 0 1px var(--accent-deep),
    0 0 0 6px var(--paper);
  opacity: 0.85;
  will-change: transform;
}

.stamp-inner::before {
  content: ""; position: absolute; inset: 8px; border: 1px solid var(--accent); pointer-events: none;
}

.stamp-top { font-size: 12px; letter-spacing: 0.5em; margin-bottom: 4px; text-indent: 0.5em; }
.stamp-mid { font-size: 28px; font-weight: 500; letter-spacing: 0.16em; text-indent: 0.16em; line-height: 1; }
.stamp-bot { font-size: 11px; letter-spacing: 0.3em; margin-top: 6px; text-indent: 0.3em; color: var(--accent-deep); }

.sign-off {
  margin-top: 40px !important;
  font-family: "Cormorant Garamond", serif;
  font-style: italic;
  font-size: 22px !important;
  color: var(--accent-deep) !important;
  letter-spacing: 0.06em;
}

.sign-off-en {
  font-style: italic;
  font-size: 16px;
  color: var(--ink-mute);
  letter-spacing: 0.04em;
}

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
  border-top: 2px double var(--ink);
  padding: 80px 24px 60px;
  text-align: center;
  background: var(--bg-deep);
}

.footer-logo {
  width: 56px; height: 56px; object-fit: contain; margin-bottom: 24px; opacity: 0.6; filter: grayscale(0.4);
}

.site-footer p {
  font-size: 13px; color: var(--ink-soft); letter-spacing: 0.24em; text-transform: uppercase; font-family: "JetBrains Mono", monospace; line-height: 1.8;
}

.site-footer p.muted {
  color: var(--ink-mute); font-style: italic; text-transform: none; letter-spacing: 0.06em; font-family: "Cormorant Garamond", serif; font-size: 16px; margin-top: 8px;
}

/* ============================================================
   REVEAL ANIMATIONS (Staggered up)
   ============================================================ */
.reveal {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 1.2s ease, transform 1.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.reveal.in {
  opacity: 1;
  transform: translateY(0);
}

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } }
@keyframes line-pulse {
  0%, 100% { transform: scaleY(1); transform-origin: top; opacity: 0.7; }
  50%      { transform: scaleY(0.4); opacity: 0.2; }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
  .stat-grid-v2 { grid-template-columns: repeat(2, 1fr); }
  .stat-grid-v2 .hero-stat { grid-column: span 2; grid-row: span 1; padding: 44px 32px; }
  .stat-grid-v2 .span-2 { grid-column: span 2; }
}

@media (max-width: 760px) {
  body { font-size: 16px; cursor: auto !important; }
  .custom-cursor { display: none; }

  .hero { padding: 50px 20px 90px; min-height: auto; }
  .logo { width: 110px; height: 110px; margin-bottom: 24px; }
  .kicker { font-size: 9px; letter-spacing: 0.24em; gap: 10px; margin-bottom: 36px; padding: 6px 12px; }
  .years { font-size: 32px; gap: 16px; margin-bottom: 40px; }
  .years .dash { width: 36px; }
  .bg-year { font-size: 30vw; opacity: 0.35; }

  .section { padding: 100px 20px 90px; }
  h2 { margin-bottom: 56px; }

  .pull { margin: 40px 0; padding: 28px 24px; }

  .stat-grid-v2 { grid-template-columns: 1fr; }
  .stat-grid-v2 .hero-stat, .stat-grid-v2 .span-2 { grid-column: span 1; }

  blockquote::before { font-size: 160px; top: -60px; }

  .stamp-inner { padding: 18px 28px; }
  .stamp-mid { font-size: 20px; }

  .scroll-hint { display: none; }
  .watermark { font-size: 80vw; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}