/* ============================================
   Chinese Traditional Festivals - Global Styles
   ============================================ */

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: 'Georgia', 'Times New Roman', serif;
  color: #2c1810;
  background: #faf7f2;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }

/* --- Typography --- */
h1 { font-size: clamp(2rem, 5vw, 3.2rem); line-height: 1.2; }
h2 { font-size: clamp(1.5rem, 3.5vw, 2.2rem); line-height: 1.3; }
h3 { font-size: clamp(1.2rem, 2.5vw, 1.6rem); line-height: 1.4; }
p  { font-size: clamp(1rem, 1.8vw, 1.125rem); }

/* --- Color Palette --- */
:root {
  --red:        #c23b22;
  --red-dark:   #8b1a1a;
  --gold:       #d4a017;
  --gold-light: #f0d68a;
  --cream:      #faf7f2;
  --ink:        #2c1810;
  --ink-light:  #5a3e2b;
  --paper:      #fff8ef;
  --jade:       #2e8b57;
  --sky:        #4a90d9;
  --shadow:     rgba(44, 24, 16, .08);
}

/* --- Layout Helpers --- */
.container { width: min(90%, 1200px); margin: 0 auto; }
.section   { padding: clamp(2.5rem, 6vw, 5rem) 0; }
.grid-2    { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 480px), 1fr)); gap: 2rem; }
.grid-3    { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 1.5rem; }
.grid-4    { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 1.5rem; }
.text-center { text-align: center; }

/* --- Decorative Chinese Border --- */
.chinese-border {
  border: 2px solid var(--gold);
  position: relative;
  padding: 2rem;
}
.chinese-border::before,
.chinese-border::after {
  content: '◆';
  position: absolute;
  color: var(--gold);
  font-size: .75rem;
}
.chinese-border::before { top: -.5rem; left: 50%; transform: translateX(-50%); background: var(--cream); padding: 0 .5rem; }
.chinese-border::after  { bottom: -.5rem; left: 50%; transform: translateX(-50%); background: var(--cream); padding: 0 .5rem; }

/* ============================================
   HEADER / NAVIGATION
   ============================================ */
.site-header {
  background: linear-gradient(135deg, var(--red-dark) 0%, var(--red) 100%);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 20px rgba(139,26,26,.3);
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .75rem 0;
  flex-wrap: wrap;
}
.site-logo {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: .05em;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.site-logo .logo-icon { font-size: 1.8rem; }

/* Hamburger */
.menu-toggle {
  display: none;
  background: none;
  border: 2px solid rgba(255,255,255,.6);
  color: #fff;
  font-size: 1.4rem;
  padding: .3rem .6rem;
  border-radius: 6px;
  cursor: pointer;
  transition: .3s;
}
.menu-toggle:hover { background: rgba(255,255,255,.15); }

/* Nav */
.main-nav ul {
  list-style: none;
  display: flex;
  gap: .25rem;
  flex-wrap: wrap;
}
.main-nav a {
  display: block;
  padding: .5rem .85rem;
  border-radius: 6px;
  font-size: .92rem;
  font-family: 'Helvetica Neue', Arial, sans-serif;
  transition: background .25s, color .25s;
  white-space: nowrap;
}
.main-nav a:hover,
.main-nav a.active {
  background: rgba(255,255,255,.18);
}

/* Dropdown */
.nav-dropdown { position: relative; }
.nav-dropdown .dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: #fff;
  color: var(--ink);
  min-width: 220px;
  border-radius: 10px;
  box-shadow: 0 8px 30px var(--shadow);
  padding: .5rem 0;
  z-index: 200;
}
.nav-dropdown:hover .dropdown-menu { display: block; }
.dropdown-menu a {
  padding: .6rem 1.2rem;
  font-size: .88rem;
  color: var(--ink);
  border-radius: 0;
}
.dropdown-menu a:hover { background: #fef3e0; color: var(--red); }

/* ============================================
   HERO SECTION (Homepage)
   ============================================ */
.hero {
  background: linear-gradient(160deg, var(--red-dark) 0%, #6b1010 40%, #3a0808 100%);
  color: #fff;
  text-align: center;
  padding: clamp(4rem, 10vw, 7rem) 0;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 30%, rgba(212,160,23,.15) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(212,160,23,.1) 0%, transparent 50%);
  pointer-events: none;
}
.hero h1 {
  font-size: clamp(2.4rem, 6vw, 3.8rem);
  margin-bottom: .5rem;
  text-shadow: 0 2px 20px rgba(0,0,0,.3);
  position: relative;
}
.hero .subtitle {
  font-size: clamp(1rem, 2.5vw, 1.35rem);
  opacity: .9;
  font-style: italic;
  margin-bottom: 2rem;
  position: relative;
}
.hero .lantern { font-size: 2.5rem; display: inline-block; animation: sway 3s ease-in-out infinite; }
.hero .lantern:nth-child(2) { animation-delay: -1.5s; }
@keyframes sway {
  0%, 100% { transform: rotate(-5deg); }
  50%      { transform: rotate(5deg); }
}

/* Hero scroll hint */
.scroll-hint {
  margin-top: 2rem;
  position: relative;
}
.scroll-hint span {
  display: inline-block;
  animation: bounce 2s infinite;
  font-size: 1.5rem;
}
@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(8px); }
}

/* ============================================
   CALENDAR / TIMELINE
   ============================================ */
.calendar-section { background: var(--paper); }
.timeline {
  position: relative;
  padding: 2rem 0;
}
.timeline::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(to bottom, var(--gold), var(--red), var(--gold));
  transform: translateX(-50%);
}
.timeline-item {
  display: flex;
  align-items: center;
  margin-bottom: 2.5rem;
  position: relative;
}
.timeline-item:nth-child(odd) { flex-direction: row; }
.timeline-item:nth-child(even) { flex-direction: row-reverse; }
.timeline-item .tl-content {
  width: 45%;
  background: #fff;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 4px 20px var(--shadow);
  transition: transform .3s, box-shadow .3s;
}
.timeline-item .tl-content:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 30px rgba(44,24,16,.12);
}
.timeline-item .tl-dot {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 18px;
  height: 18px;
  background: var(--red);
  border: 3px solid var(--gold);
  border-radius: 50%;
  z-index: 2;
}
.tl-date {
  display: inline-block;
  background: linear-gradient(135deg, var(--red), var(--red-dark));
  color: #fff;
  padding: .2rem .7rem;
  border-radius: 20px;
  font-size: .82rem;
  font-family: 'Helvetica Neue', Arial, sans-serif;
  margin-bottom: .5rem;
}
.tl-content h3 { margin-bottom: .4rem; color: var(--red-dark); }
.tl-content p  { font-size: .95rem; color: var(--ink-light); }
.tl-link {
  display: inline-block;
  margin-top: .6rem;
  color: var(--red);
  font-weight: 600;
  font-size: .9rem;
  font-family: 'Helvetica Neue', Arial, sans-serif;
  border-bottom: 1px dashed var(--red);
  transition: .2s;
}
.tl-link:hover { color: var(--red-dark); border-bottom-style: solid; }

/* ============================================
   FEATURED FESTIVAL (Homepage card)
   ============================================ */
.featured-section { background: var(--cream); }
.featured-card {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2.5rem;
  align-items: center;
  background: #fff;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 8px 40px var(--shadow);
}
.featured-visual {
  background: linear-gradient(135deg, var(--red) 0%, var(--red-dark) 100%);
  color: #fff;
  padding: 3rem 2rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 320px;
}
.featured-visual .big-emoji { font-size: 5rem; margin-bottom: 1rem; }
.featured-visual h2 { margin-bottom: .5rem; }
.featured-visual .tagline { font-style: italic; opacity: .9; font-size: 1.05rem; }
.featured-body { padding: 2.5rem 2rem; }
.featured-body h3 { color: var(--red-dark); margin-bottom: 1rem; font-size: 1.5rem; }
.featured-body p { margin-bottom: 1rem; color: var(--ink-light); }
.featured-body .highlights {
  list-style: none;
  margin-top: 1rem;
}
.featured-body .highlights li {
  padding: .4rem 0;
  padding-left: 1.5rem;
  position: relative;
  font-size: .98rem;
}
.featured-body .highlights li::before {
  content: '◈';
  position: absolute;
  left: 0;
  color: var(--gold);
}

/* ============================================
   CULTURAL THEMES (Horizontal cross-sections)
   ============================================ */
.themes-section { background: var(--paper); }
.theme-card {
  background: #fff;
  border-radius: 14px;
  padding: 2rem 1.5rem;
  text-align: center;
  box-shadow: 0 4px 20px var(--shadow);
  transition: transform .3s, box-shadow .3s;
  border-top: 4px solid var(--gold);
}
.theme-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 10px 35px rgba(44,24,16,.12);
}
.theme-icon { font-size: 2.8rem; margin-bottom: 1rem; }
.theme-card h3 { color: var(--red-dark); margin-bottom: .6rem; }
.theme-card p  { font-size: .93rem; color: var(--ink-light); }
.theme-tags {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  justify-content: center;
}
.theme-tag {
  background: #fef3e0;
  color: var(--red);
  padding: .2rem .6rem;
  border-radius: 20px;
  font-size: .78rem;
  font-family: 'Helvetica Neue', Arial, sans-serif;
}

/* ============================================
   FESTIVAL DIRECTORY (Grid)
   ============================================ */
.directory-section { background: var(--cream); }
.festival-card {
  background: #fff;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 4px 20px var(--shadow);
  transition: transform .3s, box-shadow .3s;
  display: flex;
  flex-direction: column;
}
.festival-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 10px 35px rgba(44,24,16,.12);
}
.card-header {
  padding: 1.8rem 1.5rem 1.2rem;
  text-align: center;
  position: relative;
}
.card-header .card-emoji { font-size: 2.6rem; margin-bottom: .6rem; }
.card-header h3 { margin-bottom: .3rem; }
.card-header .cn-name { font-size: .88rem; color: var(--ink-light); }
.card-date {
  display: inline-block;
  background: linear-gradient(135deg, var(--red), var(--red-dark));
  color: #fff;
  padding: .15rem .6rem;
  border-radius: 20px;
  font-size: .78rem;
  font-family: 'Helvetica Neue', Arial, sans-serif;
  margin-top: .5rem;
}
.card-body {
  padding: 0 1.5rem 1.5rem;
  flex: 1;
}
.card-body p { font-size: .92rem; color: var(--ink-light); }
.card-footer {
  padding: .8rem 1.5rem;
  border-top: 1px solid #f0ebe3;
  text-align: center;
}
.card-link {
  color: var(--red);
  font-weight: 600;
  font-size: .9rem;
  font-family: 'Helvetica Neue', Arial, sans-serif;
  transition: .2s;
}
.card-link:hover { color: var(--red-dark); }

/* Card accent colors per festival */
.card-spring    .card-header { background: linear-gradient(135deg, #fce4ec, #f8bbd0); }
.card-lantern   .card-header { background: linear-gradient(135deg, #fff3e0, #ffe0b2); }
.card-qingming  .card-header { background: linear-gradient(135deg, #e8f5e9, #c8e6c9); }
.card-dragon    .card-header { background: linear-gradient(135deg, #e3f2fd, #bbdefb); }
.card-qixi      .card-header { background: linear-gradient(135deg, #fce4ec, #f3e5f5); }
.card-midautumn .card-header { background: linear-gradient(135deg, #fff8e1, #ffecb3); }
.card-double9   .card-header { background: linear-gradient(135deg, #efebe9, #d7ccc8); }
.card-winter    .card-header { background: linear-gradient(135deg, #e8eaf6, #c5cae9); }

/* ============================================
   FESTIVAL DETAIL PAGES
   ============================================ */
.festival-hero {
  color: #fff;
  text-align: center;
  padding: clamp(3.5rem, 8vw, 6rem) 0;
  position: relative;
  overflow: hidden;
}
.festival-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 30% 50%, rgba(255,255,255,.08) 0%, transparent 60%);
  pointer-events: none;
}
.festival-hero .hero-emoji { font-size: clamp(3rem, 8vw, 5rem); margin-bottom: .8rem; position: relative; }
.festival-hero h1 { position: relative; margin-bottom: .3rem; }
.festival-hero .cn-title { font-size: clamp(1.1rem, 2.5vw, 1.5rem); opacity: .85; position: relative; }
.festival-hero .hero-date {
  display: inline-block;
  background: rgba(255,255,255,.2);
  border: 1px solid rgba(255,255,255,.4);
  padding: .3rem 1rem;
  border-radius: 20px;
  font-size: .95rem;
  margin-top: 1rem;
  position: relative;
  font-family: 'Helvetica Neue', Arial, sans-serif;
}

/* Hero color themes per festival */
.hero-spring    { background: linear-gradient(160deg, #c62828, #8e0000); }
.hero-lantern   { background: linear-gradient(160deg, #e65100, #bf360c); }
.hero-qingming  { background: linear-gradient(160deg, #2e7d32, #1b5e20); }
.hero-dragon    { background: linear-gradient(160deg, #1565c0, #0d47a1); }
.hero-qixi      { background: linear-gradient(160deg, #ad1457, #880e4f); }
.hero-midautumn { background: linear-gradient(160deg, #f57f17, #e65100); }
.hero-double9   { background: linear-gradient(160deg, #4e342e, #3e2723); }
.hero-winter    { background: linear-gradient(160deg, #283593, #1a237e); }

/* Detail Content Area */
.festival-content { background: var(--cream); }
.content-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 2.5rem;
  align-items: start;
}
.main-content h2 {
  color: var(--red-dark);
  margin-bottom: 1rem;
  padding-bottom: .5rem;
  border-bottom: 2px solid var(--gold-light);
  display: flex;
  align-items: center;
  gap: .5rem;
}
.main-content h2 .section-icon { font-size: 1.4rem; }
.main-content p { margin-bottom: 1rem; color: var(--ink-light); }
.main-content ul, .main-content ol {
  margin: .8rem 0 1.2rem 1.5rem;
  color: var(--ink-light);
}
.main-content li { margin-bottom: .5rem; font-size: .98rem; }
.content-block { margin-bottom: 2.5rem; }

/* Sidebar */
.sidebar { position: sticky; top: 5rem; }
.info-box {
  background: #fff;
  border-radius: 14px;
  padding: 1.5rem;
  box-shadow: 0 4px 20px var(--shadow);
  margin-bottom: 1.5rem;
}
.info-box h3 {
  color: var(--red-dark);
  font-size: 1.05rem;
  margin-bottom: .8rem;
  padding-bottom: .5rem;
  border-bottom: 2px solid var(--gold-light);
}
.info-box .info-row {
  display: flex;
  justify-content: space-between;
  padding: .4rem 0;
  font-size: .9rem;
  border-bottom: 1px dashed #f0ebe3;
}
.info-box .info-row:last-child { border-bottom: none; }
.info-box .info-label { color: var(--ink-light); }
.info-box .info-value { font-weight: 600; color: var(--ink); }

/* Food Cards */
.food-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
  gap: 1.2rem;
  margin-top: 1rem;
}
.food-card {
  background: #fff;
  border-radius: 12px;
  padding: 1.5rem;
  text-align: center;
  box-shadow: 0 3px 15px var(--shadow);
  border-left: 4px solid var(--gold);
  transition: transform .3s;
}
.food-card:hover { transform: translateY(-3px); }
.food-card .food-emoji { font-size: 2.2rem; margin-bottom: .6rem; }
.food-card h4 { color: var(--red-dark); margin-bottom: .3rem; }
.food-card .cn-food { font-size: .82rem; color: var(--ink-light); margin-bottom: .4rem; }
.food-card p { font-size: .88rem; color: var(--ink-light); }

/* Custom List */
.custom-list {
  list-style: none;
  margin: 1rem 0;
}
.custom-list li {
  padding: .8rem 0 .8rem 2.5rem;
  position: relative;
  border-bottom: 1px solid #f0ebe3;
  font-size: .98rem;
  color: var(--ink-light);
}
.custom-list li:last-child { border-bottom: none; }
.custom-list li::before {
  content: attr(data-icon);
  position: absolute;
  left: 0;
  top: .8rem;
  font-size: 1.2rem;
}

/* Quick Nav for detail pages */
.quick-nav {
  background: var(--paper);
  border-bottom: 1px solid #e8e0d5;
  padding: .6rem 0;
  position: sticky;
  top: 3.5rem;
  z-index: 90;
}
.quick-nav .container {
  display: flex;
  gap: .3rem;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.quick-nav .container::-webkit-scrollbar { display: none; }
.quick-nav a {
  white-space: nowrap;
  padding: .35rem .8rem;
  border-radius: 20px;
  font-size: .82rem;
  font-family: 'Helvetica Neue', Arial, sans-serif;
  transition: .2s;
  color: var(--ink-light);
  border: 1px solid transparent;
}
.quick-nav a:hover,
.quick-nav a.active {
  background: #fff;
  color: var(--red);
  border-color: var(--gold-light);
}

/* Breadcrumb */
.breadcrumb {
  padding: .8rem 0;
  font-size: .85rem;
  font-family: 'Helvetica Neue', Arial, sans-serif;
  color: var(--ink-light);
}
.breadcrumb a { color: var(--red); }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb span { margin: 0 .4rem; opacity: .5; }

/* Related Festivals */
.related-section { background: var(--paper); }

/* ============================================
   FOOTER
   ============================================ */
.site-footer {
  background: linear-gradient(135deg, #2c1810 0%, #1a0f0a 100%);
  color: rgba(255,255,255,.7);
  text-align: center;
  padding: 2.5rem 0 1.5rem;
}
.site-footer p { font-size: .88rem; margin-bottom: .5rem; }
.footer-links {
  list-style: none;
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.footer-links a { color: var(--gold-light); font-size: .85rem; font-family: 'Helvetica Neue', Arial, sans-serif; }
.footer-links a:hover { color: #fff; }
.footer-divider { width: 60px; height: 2px; background: var(--gold); margin: 1rem auto; opacity: .4; }

/* Back to top */
.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 44px;
  height: 44px;
  background: var(--red);
  color: #fff;
  border: none;
  border-radius: 50%;
  font-size: 1.2rem;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(194,59,34,.4);
  opacity: 0;
  visibility: hidden;
  transition: .3s;
  z-index: 50;
}
.back-to-top.visible { opacity: 1; visibility: visible; }
.back-to-top:hover { background: var(--red-dark); transform: translateY(-2px); }

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 900px) {
  .content-grid { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .featured-card { grid-template-columns: 1fr; }
  .featured-visual { min-height: 200px; padding: 2rem 1.5rem; }
  .timeline::before { left: 1.5rem; }
  .timeline-item,
  .timeline-item:nth-child(even) { flex-direction: row; }
  .timeline-item .tl-content { width: calc(100% - 3.5rem); margin-left: 3rem; }
  .timeline-item .tl-dot { left: 1.5rem; }
}

@media (max-width: 700px) {
  .menu-toggle { display: block; }
  .main-nav {
    display: none;
    width: 100%;
    order: 3;
  }
  .main-nav.open { display: block; }
  .main-nav ul { flex-direction: column; gap: 0; }
  .main-nav a { padding: .7rem 1rem; border-radius: 0; }
  .nav-dropdown .dropdown-menu {
    position: static;
    box-shadow: none;
    background: rgba(255,255,255,.05);
    border-radius: 0;
    display: none;
  }
  .nav-dropdown.open .dropdown-menu { display: block; }
  .dropdown-menu a { color: rgba(255,255,255,.85); padding-left: 2rem; }
  .dropdown-menu a:hover { background: rgba(255,255,255,.1); color: #fff; }

  .section { padding: 2rem 0; }
  .food-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .container { width: 92%; }
  .chinese-border { padding: 1.2rem; }
  .hero { padding: 3rem 0; }
  .info-box .info-row { flex-direction: column; gap: .2rem; }
}

/* Print */
@media print {
  .site-header, .site-footer, .back-to-top, .quick-nav { display: none; }
  .festival-hero { padding: 2rem 0; }
  body { background: #fff; }
}
