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

:root {
  --xuan: #0a0604;
  --xuan-card: #1a1410;
  --xuan-surface: #2c2418;
  --gold: #c9a05c;
  --gold-light: #f5e6b8;
  --gold-dark: #8b6914;
  --vermillion: #c43d3d;
  --vermillion-light: #d65a5a;
  --vermillion-dark: #a32e2e;
  --paper-dark: #f5f0e8;
  --paper-warm: #f5f0e6;
  --ink: #1a1410;
  --ink-light: #6b5d4d;
  --ink-muted: #8b7d6d;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Noto Serif SC', 'STKaiti', 'KaiTi', serif;
  background: var(--xuan);
  color: var(--paper-dark);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Custom font for logo */
@font-face {
  font-family: 'ZhiMangXing';
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url('/fonts/ZhiMangXing-subset.woff2') format('woff2');
}

.font-logo {
  font-family: 'ZhiMangXing', cursive;
}

/* Background layers */
.bg-layer {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.bg-gradient-layer {
  background: linear-gradient(to bottom, var(--xuan), var(--xuan-card), var(--xuan));
}

.bg-mountain {
  background-image: url('/images/temple-mountain.svg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0.20;
}

.bg-vignette {
  background: radial-gradient(ellipse at 50% 50%, rgba(10,6,4,0.55) 0%, rgba(10,6,4,0.35) 30%, transparent 60%, rgba(10,6,4,0.6) 100%);
}

.bg-top-glow {
  position: fixed;
  inset-inline: 0;
  top: 0;
  z-index: 0;
  height: 8rem;
  background: linear-gradient(to bottom, rgba(201,160,94,0.15), transparent);
}

/* Floating particles */
.particle {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(201,160,94,0.4);
  animation: glow-rise 5s ease-out infinite both;
}

@keyframes glow-rise {
  0% { transform: translateY(8px) scale(0.86); opacity: 0; }
  30% { opacity: 0.7; }
  70% { opacity: 0.4; }
  100% { transform: translateY(-40px) scale(0.5); opacity: 0; }
}

/* Header */
.header {
  position: fixed;
  top: 0;
  z-index: 50;
  width: 100%;
  height: 3.5rem;
  transition: all 0.3s ease;
  background: transparent;
}

.header.scrolled {
  background: rgba(10,6,4,0.92);
  backdrop-filter: blur(12px);
}

.header-inner {
  margin: 0 auto;
  display: flex;
  height: 100%;
  max-width: 1200px;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
}

.logo-link {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  text-decoration: none;
  color: var(--gold);
}

.logo-svg {
  width: 2.25rem;
  height: 2.25rem;
  flex-shrink: 0;
  filter: drop-shadow(0 0 8px rgba(201,160,94,0.4));
}

.logo-text {
  font-size: 1.4rem;
  font-family: 'ZhiMangXing', cursive;
  background: linear-gradient(180deg, #f5e6b8 0%, #c9a05c 50%, #8b6914 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 0.12em;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.3));
}

@media (min-width: 768px) {
  .logo-text {
    font-size: 1.65rem;
  }
}

/* Desktop Nav */
.desktop-nav {
  display: none;
  align-items: center;
  gap: 1.25rem;
}

@media (min-width: 768px) {
  .desktop-nav {
    display: flex;
  }
}

.nav-link {
  font-family: 'Noto Serif SC', 'STKaiti', serif;
  font-size: 0.875rem;
  color: var(--paper-dark);
  text-decoration: none;
  transition: color 0.15s ease;
}

.nav-link:hover {
  color: var(--gold);
}

/* Header right buttons */
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.music-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  border: 1px solid rgba(201,160,94,0.25);
  background: transparent;
  color: var(--paper-dark);
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
}

.music-btn:hover {
  border-color: rgba(201,160,94,0.4);
  color: var(--gold);
}

.recover-btn {
  display: none;
  align-items: center;
  gap: 0.5rem;
  border-radius: 9999px;
  border: 1px solid rgba(201,160,94,0.3);
  padding: 0.375rem 0.75rem;
  font-size: 0.875rem;
  color: var(--gold);
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s ease;
}

.recover-btn:hover {
  background: rgba(201,160,94,0.1);
}

@media (min-width: 768px) {
  .recover-btn {
    display: inline-flex;
  }
}

.gold-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  opacity: 0.3;
  transition: opacity 0.5s ease;
}

.gold-divider.show {
  opacity: 0.3;
}

/* Main */
.main {
  position: relative;
  z-index: 10;
  margin: 0 auto;
  min-height: calc(100vh - 3.5rem);
  width: 100%;
  padding-top: 3.5rem;
  padding-bottom: 6rem;
}

@media (min-width: 768px) {
  .main {
    padding-bottom: 2rem;
  }
}

.container {
  margin: 0 auto;
  max-width: 1200px;
  padding: 0 1rem 5rem;
}

/* Section padding */
.section {
  padding-bottom: 3rem;
}

@media (min-width: 768px) {
  .section {
    padding-bottom: 4rem;
  }
}

/* Hero Section */
.hero {
  display: flex;
  min-height: calc(100svh - 3.5rem);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  padding: 0 0.5rem;
  text-align: center;
}

@media (min-width: 768px) {
  .hero {
    min-height: calc(100vh - 3.5rem);
  }
}

.hero-logo-ring {
  position: relative;
  margin: 0 auto;
  display: flex;
  width: 5rem;
  height: 5rem;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid rgba(201,160,94,0.3);
  background: rgba(201,160,94,0.1);
  color: var(--gold);
}

.hero-logo-ring svg {
  width: 3rem;
  height: 3rem;
}

.ring-expand {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1.5px solid rgba(201,160,94,0.6);
  animation: ring-expand 3s ease-out infinite;
}

.ring-expand:nth-child(3) {
  animation-delay: 1.5s;
}

@keyframes ring-expand {
  0% { transform: scale(1); opacity: 0.7; }
  100% { transform: scale(1.6); opacity: 0; }
}

.hero-title {
  font-size: 3rem;
  letter-spacing: 0.2em;
  font-family: 'ZhiMangXing', cursive;
  background: linear-gradient(180deg, #f5e6b8 0%, #c9a05c 50%, #8b6914 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.4));
  line-height: 1.3;
}

@media (min-width: 768px) {
  .hero-title {
    font-size: 3.75rem;
  }
}

.hero-subtitle {
  margin: 0 auto;
  max-width: 28rem;
  font-size: 1rem;
  line-height: 2;
  color: rgba(245,240,232,0.85);
}

@media (min-width: 768px) {
  .hero-subtitle {
    font-size: 1.125rem;
  }
}

.hero-buttons {
  display: flex;
  width: 100%;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0 1rem;
}

@media (min-width: 640px) {
  .hero-buttons {
    width: auto;
    flex-direction: row;
    padding: 0;
  }
}

.hero-buttons a {
  width: 100%;
}

@media (min-width: 640px) {
  .hero-buttons a {
    width: auto;
  }
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: 'Noto Serif SC', 'STKaiti', serif;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
  letter-spacing: 0.05em;
  font-size: 1rem;
  white-space: nowrap;
}

.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 1px rgba(201,160,94,0.4);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.btn-primary {
  min-width: 180px;
  border-radius: 0.5rem;
  background: var(--vermillion);
  letter-spacing: 0.1em;
  color: white;
  box-shadow: 0 4px 6px -1px rgba(196,61,61,0.2);
  height: 3rem;
  padding: 0 2rem;
  font-size: 1.125rem;
}

.btn-primary:hover {
  background: var(--vermillion-light);
}

.btn-primary:active {
  background: var(--vermillion-dark);
}

.btn-primary.w-full {
  width: 100%;
}

@media (min-width: 640px) {
  .btn-primary.w-full {
    width: auto;
  }
}

.btn-outline {
  min-width: 180px;
  border-radius: 0.375rem;
  border: 1px solid rgba(201,160,94,0.4);
  background: transparent;
  color: var(--gold);
  height: 3rem;
  padding: 0 2rem;
  font-size: 1.125rem;
}

.btn-outline:hover {
  border-color: rgba(201,160,94,0.6);
  background: rgba(201,160,94,0.1);
}

.btn-outline.w-full {
  width: 100%;
}

@media (min-width: 640px) {
  .btn-outline.w-full {
    width: auto;
  }
}

/* Scroll indicator */
.scroll-indicator {
  animation: bounce 2s infinite;
  font-size: 0.875rem;
  color: rgba(245,240,232,0.65);
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); animation-timing-function: cubic-bezier(0.8, 0, 1, 1); }
  50% { transform: translateY(-6px); animation-timing-function: cubic-bezier(0, 0, 0.2, 1); }
}

/* Section Title */
.section-title {
  text-align: center;
  font-size: 1.875rem;
  letter-spacing: 0.2em;
  color: var(--gold);
  font-family: 'ZhiMangXing', cursive;
  margin-bottom: 2rem;
}

@media (min-width: 768px) {
  .section-title {
    font-size: 2.25rem;
  }
}

/* Card Grid */
.card-grid {
  display: grid;
  gap: 1rem;
}

@media (min-width: 768px) {
  .card-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .card-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Card */
.card {
  display: block;
  text-decoration: none;
  border-radius: 0.5rem;
  border: 1px solid rgba(201,160,94,0.2);
  background: rgba(26,20,16,0.95);
  padding: 1.25rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
  backdrop-filter: blur(4px);
  height: 100%;
  transition: all 0.3s ease;
}

.card:hover {
  border-color: rgba(201,160,94,0.4);
  box-shadow: 0 4px 20px rgba(201,160,94,0.15);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.card-icon {
  width: 2.25rem;
  height: 2.25rem;
}

.card-icon.vermillion {
  color: var(--vermillion);
}

.card-icon.gold {
  color: var(--gold);
}

.card-badge {
  border-radius: 9999px;
  border: 1px solid rgba(201,160,94,0.25);
  padding: 0.125rem 0.5rem;
  font-size: 0.75rem;
  color: rgba(201,160,94,0.8);
}

.card-title {
  font-size: 1.5rem;
  color: var(--paper-dark);
  margin-bottom: 0.5rem;
}

.card-desc {
  font-size: 1rem;
  color: rgba(245,240,232,0.8);
  line-height: 1.6;
}

/* Why Section */
.why-section {
  border-radius: 0.5rem;
  border: 1px solid rgba(201,160,94,0.2);
  background: rgba(26,20,16,0.95);
  padding: 1.25rem;
  text-align: center;
  transition: all 0.3s ease;
}

.why-section:hover {
  border-color: rgba(201,160,94,0.3);
}

.why-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 9999px;
  border: 1px solid rgba(201,160,94,0.3);
  padding: 0.25rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 500;
  background: linear-gradient(to right, rgba(201,160,94,0.2), rgba(201,160,94,0.05));
  color: var(--gold-dark);
  margin-bottom: 1rem;
}

.why-title {
  font-size: 1.5rem;
  letter-spacing: 0.1em;
  color: var(--gold);
  margin-bottom: 1.25rem;
}

@media (min-width: 768px) {
  .why-title {
    font-size: 1.875rem;
  }
}

.why-grid {
  display: grid;
  gap: 1rem;
}

@media (min-width: 768px) {
  .why-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.why-item {
  border-radius: 0.5rem;
  border: 1px solid rgba(201,160,94,0.15);
  background: rgba(44,36,24,0.4);
  padding: 1rem;
  text-align: left;
}

.why-item-label {
  font-family: 'ZhiMangXing', cursive;
  font-size: 1.125rem;
  color: var(--gold);
  margin-bottom: 0.25rem;
}

.why-item-text {
  margin-top: 0.5rem;
  font-size: 0.875rem;
  color: rgba(245,240,232,0.8);
  line-height: 1.6;
}

/* Book grid */
.book-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  padding-top: 0.5rem;
}

@media (min-width: 768px) {
  .book-grid {
    grid-template-columns: repeat(6, 1fr);
  }
}

.book-item {
  border-radius: 0.5rem;
  border: 1px solid rgba(201,160,94,0.15);
  background: rgba(44,36,24,0.7);
  padding: 0.75rem 0.5rem;
  text-align: center;
  font-size: 0.875rem;
  color: var(--paper-dark);
}

@media (min-width: 768px) {
  .book-item {
    font-size: 1rem;
  }
}

/* Incense / Share panels */
.panel-bordered {
  border-radius: 0.75rem;
  border-inline: 4px solid rgba(201,160,94,0.4);
  background: var(--paper-warm);
  padding: 1.5rem 2rem;
  color: var(--ink);
  text-align: center;
}

.panel-inner {
  margin: 0 auto;
  max-width: 28rem;
}

.panel-icon-wrap {
  margin: 0 auto;
  display: flex;
  width: 3.5rem;
  height: 3.5rem;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid rgba(196,61,61,0.3);
  background: rgba(196,61,61,0.1);
  margin-bottom: 0.5rem;
}

.panel-icon-wrap svg {
  width: 1.75rem;
  height: 1.75rem;
  color: var(--vermillion);
}

.panel-label {
  font-size: 0.875rem;
  color: var(--ink-light);
  margin-bottom: 0.5rem;
}

.panel-title {
  font-size: 1.5rem;
  letter-spacing: 0.1em;
  margin-bottom: 0.75rem;
}

@media (min-width: 768px) {
  .panel-title {
    font-size: 1.875rem;
  }
}

.panel-desc {
  font-size: 1rem;
  line-height: 1.8;
  color: var(--ink);
  margin-bottom: 1.25rem;
}

/* Footer */
.footer {
  border-top: 1px solid rgba(201,160,94,0.1);
  padding-top: 2.5rem;
  text-align: center;
  font-size: 0.875rem;
}

.footer-quote {
  line-height: 2;
}

.footer-quote.gold {
  color: rgba(201,160,94,0.8);
}

.footer-quote.muted {
  color: rgba(245,240,232,0.7);
}

.footer-quote.dim {
  color: rgba(245,240,232,0.65);
}

.footer-divider {
  margin: 1.25rem auto;
  width: 3rem;
  border-top: 1px solid rgba(201,160,94,0.15);
}

.footer-copy {
  font-size: 0.75rem;
  color: rgba(245,240,232,0.6);
}

/* Bottom Mobile Nav */
.bottom-nav {
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: 40;
  border-top: 1px solid rgba(201,160,94,0.2);
  background: rgba(26,20,16,0.97);
  backdrop-filter: blur(12px);
  display: flex;
}

@media (min-width: 768px) {
  .bottom-nav {
    display: none;
  }
}

.bottom-nav-inner {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  width: 100%;
  padding: 0.5rem 0.25rem;
  padding-bottom: max(env(safe-area-inset-bottom), 0.5rem);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.125rem;
  padding: 0.5rem 0;
  text-decoration: none;
  color: var(--ink-muted);
  font-size: 0.75rem;
  border-radius: 0.375rem;
  transition: color 0.15s ease;
}

.nav-item.active {
  color: var(--gold);
}

.nav-item svg {
  width: 1.25rem;
  height: 1.25rem;
}

/* Share FAB */
.share-fab {
  position: fixed;
  right: 0.75rem;
  z-index: 40;
  display: flex;
  width: 3rem;
  height: 3rem;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid rgba(201,160,94,0.5);
  background: linear-gradient(to bottom right, rgba(201,160,94,0.3), rgba(196,61,61,0.2));
  color: var(--gold);
  box-shadow: 0 4px 6px rgba(201,160,94,0.125);
  backdrop-filter: blur(8px);
  cursor: pointer;
  bottom: calc(env(safe-area-inset-bottom) + 150px);
  transition: all 0.15s ease;
}

.share-fab:hover {
  background: linear-gradient(to bottom right, rgba(201,160,94,0.4), rgba(196,61,61,0.3));
}

@media (min-width: 768px) {
  .share-fab {
    right: 1rem;
    width: 3.5rem;
    height: 3.5rem;
    bottom: 1rem;
  }
}

.share-fab svg {
  width: 1.25rem;
  height: 1.25rem;
}

@media (min-width: 768px) {
  .share-fab svg {
    width: 1.5rem;
    height: 1.5rem;
  }
}

/* Scroll Reveal */
.reveal {
  opacity: 0;
  transform: translateY(1.5rem);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Utility */
.hidden {
  display: none;
}

.no-line-height {
  line-height: 0;
}

/* Space Utilities */
.space-y-3 > * + * {
  margin-top: 0.75rem;
}

.space-y-4 > * + * {
  margin-top: 1rem;
}

.space-y-5 > * + * {
  margin-top: 1.25rem;
}

.space-y-6 > * + * {
  margin-top: 1.5rem;
}

.space-y-1 > * + * {
  margin-top: 0.25rem;
}

/* Gap utilities */
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-5 { gap: 1.25rem; }
.gap-6 { gap: 1.5rem; }
.gap-2-5 { gap: 0.625rem; }

/* Flex */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.shrink-0 { flex-shrink: 0; }
.contents { display: contents; }

/* Text */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-base { font-size: 1rem; }
.text-lg { font-size: 1.125rem; }
.text-2xl { font-size: 1.5rem; }
.text-3xl { font-size: 1.875rem; }
.text-5xl { font-size: 3rem; }

/* Tracking */
.tracking-widest { letter-spacing: 0.2em; }
.tracking-wider { letter-spacing: 0.1em; }

/* Leading */
.leading-loose { line-height: 2; }

/* Size */
.size-4 { width: 1rem; height: 1rem; }
.size-5 { width: 1.25rem; height: 1.25rem; }
.size-7 { width: 1.75rem; height: 1.75rem; }
.size-9 { width: 2.25rem; height: 2.25rem; }
.size-12 { width: 3rem; height: 3rem; }
.w-12 { width: 3rem; }
.w-full { width: 100%; }
.max-w-md { max-width: 28rem; }
.max-w-6xl { max-width: 1200px; }

/* Margins */
.mx-auto { margin-inline: auto; }
.mr-2 { margin-right: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.pt-2 { padding-top: 0.5rem; }
.pb-section { padding-bottom: 3rem; }
@media (min-width: 768px) {
  .pb-section { padding-bottom: 4rem; }
}

/* Border */
.rounded-full { border-radius: 9999px; }
.rounded-lg { border-radius: 0.5rem; }
.rounded-xl { border-radius: 0.75rem; }
.border { border: 1px solid; }
.border-t { border-top: 1px solid; }
.border-x-4 { border-inline: 4px solid; }

/* Colors */
.text-gold { color: var(--gold); }
.text-vermillion { color: var(--vermillion); }
.text-paper-dark { color: var(--paper-dark); }
.text-ink { color: var(--ink); }
.text-ink-light { color: var(--ink-light); }
.text-ink-muted { color: var(--ink-muted); }
.text-white { color: white; }

.bg-gold { background: var(--gold); }
.bg-vermillion { background: var(--vermillion); }
.bg-transparent { background: transparent; }

/* Opacity */
.opacity-0 { opacity: 0; }

/* Pointer events */
.pointer-events-none { pointer-events: none; }
