/* ============================================================
   ĐẠO LÀM CON - Buddhist Design System
   Chùa Linh Quang - "Cung kính - Khiêm hoà"
   ============================================================ */

/* --- Google Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,600;0,700;1,400&family=Crimson+Text:ital,wght@0,400;0,600;0,700;1,400&family=Inter:wght@300;400;500;600&display=swap');

/* --- Design Tokens --- */
:root {
  /* Colors - from Chùa Linh Quang logo */
  --gold: #C8A951;
  --gold-light: #E8D48B;
  --gold-dark: #A68B3C;
  --maroon: #5B1A2A;
  --maroon-light: #7A2E3F;
  --maroon-dark: #3D0F1B;
  --cream: #FDF6E3;
  --warm-white: #FFFDF7;
  --parchment: #F5ECD7;
  --text-dark: #2D1810;
  --text-muted: #6B5744;
  --text-light: #9B8A78;
  --lotus-pink: #E8B4B8;
  --lotus-pink-light: #F2D4D6;
  --sage: #8B9A6B;
  --sage-light: #B5C09A;
  --border-gold: rgba(200, 169, 81, 0.3);
  --shadow-warm: rgba(93, 26, 42, 0.08);
  --shadow-gold: rgba(200, 169, 81, 0.15);

  /* Typography */
  --font-heading: 'Playfair Display', 'Georgia', serif;
  --font-verse: 'Crimson Text', 'Georgia', serif;
  --font-ui: 'Inter', system-ui, -apple-system, sans-serif;
  
  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;
  --space-4xl: 6rem;

  /* Border Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-full: 50%;

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 300ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 500ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-lotus: 800ms cubic-bezier(0.22, 1, 0.36, 1);

  /* Shadows */
  --shadow-sm: 0 1px 3px var(--shadow-warm), 0 1px 2px var(--shadow-gold);
  --shadow-md: 0 4px 12px var(--shadow-warm), 0 2px 6px var(--shadow-gold);
  --shadow-lg: 0 10px 30px var(--shadow-warm), 0 4px 12px var(--shadow-gold);
  --shadow-xl: 0 20px 50px var(--shadow-warm), 0 8px 20px var(--shadow-gold);
  --shadow-glow: 0 0 20px rgba(200, 169, 81, 0.2), 0 0 40px rgba(200, 169, 81, 0.1);
}

/* --- Reset & Base --- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
}

body {
  font-family: var(--font-verse);
  font-size: 18px;
  line-height: 1.8;
  color: var(--text-dark);
  background-color: var(--cream);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* Texture overlay for parchment feel */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: 
    radial-gradient(ellipse at 20% 50%, rgba(200, 169, 81, 0.03) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(232, 180, 184, 0.03) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 80%, rgba(139, 154, 107, 0.03) 0%, transparent 50%);
  pointer-events: none;
  z-index: -1;
}

img { max-width: 100%; height: auto; display: block; }
a { text-decoration: none; color: inherit; }

/* --- Header --- */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(253, 246, 227, 0.85);
  backdrop-filter: blur(20px) saturate(1.5);
  -webkit-backdrop-filter: blur(20px) saturate(1.5);
  border-bottom: 1px solid var(--border-gold);
  transition: var(--transition-normal);
}

.header.scrolled {
  background: rgba(253, 246, 227, 0.95);
  box-shadow: var(--shadow-md);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--space-sm) var(--space-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
}

.header-logo {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.header-logo img {
  width: 50px;
  height: 50px;
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-sm);
  transition: var(--transition-normal);
}

.header-logo img:hover {
  transform: scale(1.05);
  box-shadow: var(--shadow-glow);
}

.header-title {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--maroon);
  letter-spacing: 0.02em;
}

.header-subtitle {
  font-family: var(--font-ui);
  font-size: 0.7rem;
  font-weight: 400;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* --- Mobile Menu Button --- */
.menu-toggle {
  display: none;
  background: none;
  border: 2px solid var(--border-gold);
  border-radius: var(--radius-sm);
  padding: 8px;
  cursor: pointer;
  color: var(--maroon);
  transition: var(--transition-fast);
}

.menu-toggle:hover {
  background: var(--gold);
  color: var(--warm-white);
  border-color: var(--gold);
}

.menu-toggle svg {
  width: 24px;
  height: 24px;
  display: block;
}

/* --- Navigation --- */
.nav {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.nav-link {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  padding: 6px 14px;
  border-radius: 20px;
  transition: var(--transition-fast);
  white-space: nowrap;
  cursor: pointer;
  position: relative;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 2px;
  background: var(--gold);
  border-radius: 1px;
  transition: var(--transition-normal);
  transform: translateX(-50%);
}

.nav-link:hover {
  color: var(--maroon);
  background: rgba(200, 169, 81, 0.1);
}

.nav-link.active {
  color: var(--maroon);
  background: rgba(200, 169, 81, 0.15);
  font-weight: 600;
}

.nav-link.active::after {
  width: 60%;
}

/* --- Hero --- */
.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 120px var(--space-xl) var(--space-4xl);
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: 
    radial-gradient(circle at 50% 30%, rgba(200, 169, 81, 0.08) 0%, transparent 50%),
    radial-gradient(circle at 50% 70%, rgba(232, 180, 184, 0.06) 0%, transparent 40%);
  pointer-events: none;
}

.hero-lotus {
  width: 120px;
  height: 120px;
  margin-bottom: var(--space-xl);
  opacity: 0;
  animation: lotusBloom 1.5s var(--transition-lotus) 0.3s forwards;
  filter: drop-shadow(0 4px 12px rgba(200, 169, 81, 0.3));
}

.hero-logo {
  width: 140px;
  height: 140px;
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  margin-bottom: var(--space-2xl);
  opacity: 0;
  animation: fadeUp 1s ease 0.5s forwards;
}

.hero h1 {
  font-family: var(--font-heading);
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  font-weight: 700;
  color: var(--maroon);
  margin-bottom: var(--space-md);
  opacity: 0;
  animation: fadeUp 1s ease 0.8s forwards;
  letter-spacing: 0.03em;
}

.hero-tagline {
  font-family: var(--font-ui);
  font-size: clamp(0.85rem, 2vw, 1rem);
  font-weight: 400;
  color: var(--text-muted);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: var(--space-2xl);
  opacity: 0;
  animation: fadeUp 1s ease 1s forwards;
}

.hero-verse {
  max-width: 500px;
  font-family: var(--font-verse);
  font-size: clamp(1.1rem, 2.5vw, 1.4rem);
  line-height: 2.2;
  color: var(--text-dark);
  font-style: italic;
  position: relative;
  padding: var(--space-xl) var(--space-2xl);
  opacity: 0;
  animation: fadeUp 1s ease 1.2s forwards;
}

.hero-verse::before,
.hero-verse::after {
  font-family: var(--font-heading);
  font-size: 4rem;
  color: var(--gold-light);
  position: absolute;
  line-height: 1;
}

.hero-verse::before {
  content: '"';
  top: -10px;
  left: 0;
}

.hero-verse::after {
  content: '"';
  bottom: -30px;
  right: 0;
}

.hero-scroll {
  margin-top: var(--space-2xl);
  opacity: 0;
  animation: fadeUp 1s ease 1.5s forwards;
}

.hero-scroll a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  font-family: var(--font-ui);
  font-size: 0.8rem;
  color: var(--text-light);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transition: var(--transition-normal);
  cursor: pointer;
}

.hero-scroll a:hover {
  color: var(--gold-dark);
}

.scroll-arrow {
  width: 24px;
  height: 24px;
  animation: bounce 2s ease infinite;
}

/* --- Lotus Divider --- */
.lotus-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-lg);
  padding: var(--space-xl) 0;
}

.lotus-divider::before,
.lotus-divider::after {
  content: '';
  flex: 1;
  max-width: 120px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-light), transparent);
}

.lotus-divider svg {
  width: 40px;
  height: 40px;
  color: var(--gold);
  opacity: 0.6;
  flex-shrink: 0;
}

/* --- Chapter Section --- */
.chapter {
  max-width: 900px;
  margin: 0 auto;
  padding: var(--space-3xl) var(--space-lg);
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

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

/* Chapter Image */
.chapter-image-wrapper {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: var(--space-2xl);
  box-shadow: var(--shadow-lg);
  aspect-ratio: 16 / 9;
}

.chapter-image-wrapper::after {
  content: '';
  position: absolute;
  inset: 0;
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-lg);
  pointer-events: none;
}

.chapter-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 6s ease;
}

.chapter:hover .chapter-image {
  transform: scale(1.03);
}

/* Chapter Number */
.chapter-number {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  font-family: var(--font-ui);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--gold-dark);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: var(--space-md);
}

.chapter-number span {
  display: inline-block;
  width: 32px;
  height: 32px;
  line-height: 32px;
  text-align: center;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: var(--warm-white);
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0;
}

/* Chapter Title */
.chapter-title {
  font-family: var(--font-heading);
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 700;
  color: var(--maroon);
  margin-bottom: var(--space-lg);
  line-height: 1.3;
  position: relative;
}

.chapter-title::after {
  content: '';
  display: block;
  width: 60px;
  height: 3px;
  background: linear-gradient(90deg, var(--gold), var(--gold-light));
  border-radius: 2px;
  margin-top: var(--space-md);
}

/* Verse Content */
.verse-container {
  background: var(--warm-white);
  border-radius: var(--radius-lg);
  padding: var(--space-2xl) var(--space-2xl);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-gold);
  position: relative;
  overflow: hidden;
  text-align: center;
}

.verse-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--gold-light), var(--gold), var(--gold-light));
}

.verse-container::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--gold-light), var(--gold), var(--gold-light));
}

.verse-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-md);
  position: relative;
}

.verse-group:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
}

/* Small lotus dot separator between groups */
.verse-group:not(:last-child)::after {
  content: '◆';
  display: block;
  position: absolute;
  bottom: -2px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 6px;
  color: var(--gold);
  opacity: 0.5;
}

.verse-line {
  font-family: var(--font-verse);
  font-size: clamp(1.05rem, 2.5vw, 1.3rem);
  line-height: 1.9;
  color: var(--text-dark);
  transition: var(--transition-normal);
  padding: 2px 0;
  cursor: default;
}

.verse-line:hover {
  color: var(--maroon);
  text-shadow: 0 0 20px rgba(200, 169, 81, 0.15);
}

/* --- Footer --- */
.footer {
  text-align: center;
  padding: var(--space-4xl) var(--space-lg) var(--space-2xl);
  background: linear-gradient(180deg, var(--cream) 0%, var(--parchment) 100%);
  border-top: 1px solid var(--border-gold);
}

.footer-logo {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-full);
  margin: 0 auto var(--space-lg);
  box-shadow: var(--shadow-md);
  transition: var(--transition-normal);
}

.footer-logo:hover {
  box-shadow: var(--shadow-glow);
  transform: scale(1.05);
}

.footer-text {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-style: italic;
  color: var(--maroon);
  margin-bottom: var(--space-sm);
}

.footer-temple {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  color: var(--text-light);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.footer-copy {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  color: var(--text-light);
  margin-top: var(--space-xl);
}

/* --- Back to Top --- */
.back-to-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 48px;
  height: 48px;
  background: var(--gold);
  color: var(--warm-white);
  border: none;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
  transition: var(--transition-normal);
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  z-index: 90;
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.back-to-top:hover {
  background: var(--maroon);
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.back-to-top svg {
  width: 20px;
  height: 20px;
}

/* --- Floating Lotus Particles --- */
.lotus-particle {
  position: fixed;
  pointer-events: none;
  z-index: -1;
  opacity: 0;
  animation: floatUp 15s linear infinite;
}

@keyframes floatUp {
  0% {
    opacity: 0;
    transform: translateY(100vh) rotate(0deg);
  }
  10% {
    opacity: 0.15;
  }
  90% {
    opacity: 0.15;
  }
  100% {
    opacity: 0;
    transform: translateY(-10vh) rotate(360deg);
  }
}

/* --- Animations --- */
@keyframes lotusBloom {
  0% {
    opacity: 0;
    transform: scale(0.5) rotate(-10deg);
  }
  60% {
    transform: scale(1.05) rotate(2deg);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(25px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(8px);
  }
  60% {
    transform: translateY(4px);
  }
}

@keyframes shimmer {
  0% { background-position: -200% center; }
  100% { background-position: 200% center; }
}

/* --- Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  html { scroll-behavior: auto; }
}

/* --- Responsive: Tablet --- */
@media (max-width: 1024px) {
  .nav {
    display: none;
    position: fixed;
    top: 68px;
    left: 0;
    right: 0;
    background: rgba(253, 246, 227, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: var(--space-md) var(--space-lg);
    flex-direction: column;
    gap: var(--space-xs);
    box-shadow: var(--shadow-lg);
    border-bottom: 1px solid var(--border-gold);
    max-height: calc(100vh - 68px);
    overflow-y: auto;
  }

  .nav.open {
    display: flex;
    animation: fadeUp 0.3s ease;
  }

  .nav-link {
    width: 100%;
    text-align: center;
    padding: 12px 14px;
    font-size: 0.9rem;
  }

  .menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

/* --- Responsive: Mobile --- */
@media (max-width: 640px) {
  body { font-size: 16px; }

  .header-inner {
    padding: var(--space-sm) var(--space-md);
  }

  .header-logo img {
    width: 40px;
    height: 40px;
  }

  .header-title { font-size: 1.1rem; }

  .hero {
    min-height: 90vh;
    padding: 100px var(--space-md) var(--space-2xl);
  }

  .hero-logo {
    width: 100px;
    height: 100px;
  }

  .hero-verse {
    padding: var(--space-md);
  }

  .hero-verse::before, .hero-verse::after {
    font-size: 3rem;
  }

  .chapter {
    padding: var(--space-2xl) var(--space-md);
  }

  .verse-container {
    padding: var(--space-lg) var(--space-md);
  }

  .verse-line {
    font-size: 1rem;
  }

  .footer { padding: var(--space-2xl) var(--space-md) var(--space-lg); }

  .back-to-top {
    bottom: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
  }
}

