/* ============================================
   Homepage Styles
   ============================================ */

/* --- Hero --- */

.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--space-32) var(--container-padding) var(--space-20);
  overflow: hidden;
  background: var(--rice-paper);
}

.hero__bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.hero__bg-element {
  position: absolute;
  opacity: 0.05;
  /* Parallax offset is set by JS as --parallax-y so the mirrored elements
     below keep their scaleX(-1) instead of being overwritten mid-scroll. */
  transform: translateY(var(--parallax-y, 0px));
  transition: transform 0.1s linear;
}

.hero__bg-element--mountain-left {
  bottom: -10%;
  left: -10%;
  width: 80%;
  max-width: 1000px;
  opacity: 0.08;
}

.hero__bg-element--mountain-right {
  bottom: -12%;
  right: -10%;
  width: 70%;
  max-width: 900px;
  opacity: 0.06;
  transform: translateY(var(--parallax-y, 0px)) scaleX(-1);
}

.hero__bg-element--bamboo-right {
  bottom: 0;
  right: 3%;
  width: 22%;
  max-width: 300px;
  opacity: 0.08;
  z-index: 2;
}

.hero__bg-element--bamboo-left {
  bottom: 0;
  left: 2%;
  width: 18%;
  max-width: 250px;
  opacity: 0.06;
  transform: translateY(var(--parallax-y, 0px)) scaleX(-1);
  z-index: 2;
}

.hero__bg-element--splash {
  top: 30%;
  left: 15%;
  width: 20%;
  max-width: 250px;
}

.hero__content {
  position: relative;
  z-index: var(--z-base);
  max-width: 900px;
}

/* --- Hero Lotus — same flower as nav, larger with dramatic bloom --- */

.lotus {
  width: clamp(140px, 18vw, 220px);
  aspect-ratio: 1 / 1;
  height: auto;
  margin: 0 auto var(--space-6);
  display: block;
  color: var(--vermillion-deep);
  overflow: visible;
}

.lotus__petal {
  transform-box: fill-box;
  transform-origin: 50% 100%;
  opacity: 0;
  transform: scale(0.05);
  animation: heroPetalBloom 1.2s cubic-bezier(0.22, 1.12, 0.46, 1) forwards;
  animation-delay: var(--d, 0s);
}

.lotus__center {
  transform-box: fill-box;
  transform-origin: 50% 50%;
  opacity: 0;
  transform: scale(0);
  animation: heroCenterBloom 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) 1.3s forwards;
}

@keyframes heroPetalBloom {
  0%   { transform: scale(0.05); opacity: 0; }
  55%  { opacity: var(--o, 0.5); }
  100% { transform: scale(1); opacity: var(--o, 0.5); }
}

@keyframes heroCenterBloom {
  0%   { transform: scale(0); opacity: 0; }
  60%  { transform: scale(1.2); opacity: 0.35; }
  100% { transform: scale(1); opacity: 0.35; }
}

@media (prefers-reduced-motion: reduce) {
  .lotus__petal,
  .lotus__center {
    animation: none !important;
    opacity: var(--o, 0.35) !important;
    transform: scale(1) !important;
  }
}

/* --- Music Toggle (homepage only) --- */

.music-toggle {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  z-index: 200;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  background: var(--rice-paper-white);
  color: var(--vermillion-deep);
  border: 1.5px solid var(--vermillion-deep);
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(155, 27, 42, 0.12);
  transition: background var(--duration-normal) var(--ease-out-expo),
              color var(--duration-normal) var(--ease-out-expo),
              transform var(--duration-normal) var(--ease-out-expo),
              box-shadow var(--duration-normal) var(--ease-out-expo);
  opacity: 0;
  transform: translateY(16px);
  animation: musicToggleIn 0.7s cubic-bezier(0.22, 1.12, 0.46, 1) 2.2s forwards;
}

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

.music-toggle:hover {
  background: var(--vermillion-deep);
  color: var(--rice-paper-white);
  transform: translateY(-2px);
  box-shadow: 0 6px 22px rgba(155, 27, 42, 0.22);
}

.music-toggle:focus-visible {
  outline: 2px solid var(--vermillion-deep);
  outline-offset: 3px;
}

.music-toggle--playing {
  background: var(--vermillion-deep);
  color: var(--rice-paper-white);
}

.music-toggle--playing::after {
  content: '';
  position: absolute;
  inset: -1.5px;
  border: 1.5px solid var(--vermillion-deep);
  border-radius: inherit;
  opacity: 0.35;
  animation: musicPulse 2.2s ease-in-out infinite;
  pointer-events: none;
}

@keyframes musicPulse {
  0%, 100% { transform: scale(1); opacity: 0.35; }
  50%      { transform: scale(1.08); opacity: 0; }
}

.music-toggle__icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.music-toggle__icon--pause { display: none; }
.music-toggle--playing .music-toggle__icon--play { display: none; }
.music-toggle--playing .music-toggle__icon--pause { display: block; }

@media (max-width: 640px) {
  .music-toggle { bottom: var(--space-4); right: var(--space-4); padding: var(--space-3); }
  .music-toggle__label { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .music-toggle { animation: none !important; opacity: 1 !important; transform: none !important; }
  .music-toggle--playing::after { animation: none !important; }
}

.hero__title {
  font-size: var(--text-5xl);
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: var(--tracking-tight);
  margin-bottom: var(--space-6);
  color: var(--ink-black);
}

.hero__subtitle {
  font-family: var(--font-body);
  font-size: var(--text-xl);
  font-weight: 400;
  color: var(--ink-medium);
  margin-bottom: var(--space-4);
  max-width: 600px;
  margin-inline: auto;
}

.hero__brush-stroke {
  width: clamp(180px, 30vw, 360px);
  height: auto;
  margin: 0 auto var(--space-10);
  color: var(--ink-wash);
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  justify-content: center;
  margin-top: var(--space-8);
}

.hero__scroll-hint {
  position: absolute;
  bottom: var(--space-8);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  color: var(--ink-light);
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(-8px); }
}

.hero__scroll-hint svg {
  width: 20px;
  height: 20px;
}

/* --- Programs Section --- */

.programs-section {
  background: var(--rice-paper-white);
}

.programs-section .section-header__chinese {
  font-family: var(--font-chinese);
  font-size: var(--text-3xl);
  color: var(--ink-faint);
  margin-bottom: var(--space-2);
  line-height: 1;
}

/* --- About Snippet Section --- */

.about-snippet {
  position: relative;
}

.about-snippet__text {
  --flow-space: var(--space-5);
}

.about-snippet__pullquote {
  position: relative;
  padding: var(--space-8) 0;
  margin: var(--space-8) 0;
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
}

.about-snippet__pullquote-chinese {
  font-family: var(--font-chinese);
  font-size: var(--text-3xl);
  color: var(--ink-faint);
  line-height: 1.2;
  margin-bottom: var(--space-2);
}

.about-snippet__pullquote-english {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-style: italic;
  color: var(--ink-medium);
}

/* --- Events Preview Section --- */

.events-preview {
  background: var(--rice-paper-warm);
}

.events-preview__grid {
  display: grid;
  gap: var(--space-6);
}

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

/* --- Gallery Preview Section --- */

.gallery-preview {
  overflow: hidden;
}

/* --- Gallery preview carousel ---
   One horizontal strip at every size. The old five-column mosaic couldn't
   survive narrow screens, and a single pattern is easier to reason about
   than two. Scroll-snap on touch, arrow buttons for mouse users. */

.gallery-preview__strip {
  position: relative;
  margin-top: var(--space-12);
}

.gallery-preview__mosaic {
  display: flex;
  gap: var(--space-4);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scroll-padding-inline: var(--container-padding);
  /* full-bleed to the screen edges, then pad back in */
  margin-inline: calc(-1 * var(--container-padding));
  padding-inline: var(--container-padding);
  scrollbar-width: none;
}

.gallery-preview__mosaic::-webkit-scrollbar { display: none; }

/* trailing spacer so the last photo can snap clear of the edge */
.gallery-preview__mosaic::after {
  content: '';
  flex: 0 0 var(--space-2);
}

.gallery-preview__item {
  flex: 0 0 clamp(240px, 26vw, 340px);
  aspect-ratio: 4 / 3;
  scroll-snap-align: center;
  display: block;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: var(--rice-paper-warm);
}

.gallery-preview__item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform var(--duration-slow, 0.5s) var(--ease-out-expo);
}

.gallery-preview__item:hover img,
.gallery-preview__item:focus-visible img {
  transform: scale(1.04);
}

@media (max-width: 767px) {
  .gallery-preview__item {
    flex: 0 0 78%;
  }
}

/* --- Carousel arrows (pointer devices only) --- */

.gallery-preview__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 44px;
  height: 44px;
  display: none;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--ink-faint);
  border-radius: 999px;
  background: var(--rice-paper-white);
  color: var(--ink-black);
  cursor: pointer;
  font-size: 1.25rem;
  line-height: 1;
  box-shadow: 0 4px 16px rgba(26, 26, 26, 0.10);
  transition: background var(--duration-normal) var(--ease-out-expo),
              color var(--duration-normal) var(--ease-out-expo),
              opacity var(--duration-normal) var(--ease-out-expo);
}

.gallery-preview__nav:hover {
  background: var(--ink-black);
  color: var(--rice-paper);
}

.gallery-preview__nav:focus-visible {
  outline: 2px solid var(--vermillion-deep);
  outline-offset: 3px;
}

.gallery-preview__nav[disabled] {
  opacity: 0.3;
  cursor: default;
}

.gallery-preview__nav--prev { left: calc(-1 * var(--space-4)); }
.gallery-preview__nav--next { right: calc(-1 * var(--space-4)); }

@media (hover: hover) and (pointer: fine) {
  .gallery-preview__nav { display: flex; }
}

@media (prefers-reduced-motion: reduce) {
  .gallery-preview__mosaic { scroll-behavior: auto; }
  .gallery-preview__item img { transition: none; }
  .gallery-preview__item:hover img { transform: none; }
}

.about-snippet__image {
  width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
  display: block;
}


/* --- Join / CTA Section --- */

.join-section {
  background: var(--ink-black);
  color: var(--rice-paper);
  position: relative;
  overflow: hidden;
}

.join-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(194, 58, 43, 0.06), transparent 50%),
    radial-gradient(ellipse at 80% 50%, rgba(184, 134, 11, 0.04), transparent 50%);
  pointer-events: none;
}

.join-section h2 {
  color: var(--rice-paper);
}

.join-section .section-header__desc {
  color: var(--ink-wash);
}

.join-section__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: var(--space-8);
  position: relative;
  z-index: var(--z-base);
}

.join-card {
  text-align: center;
  padding: var(--space-10) var(--space-6);
  border: 1px solid rgba(245, 240, 232, 0.08);
  border-radius: var(--radius-md);
  transition: border-color var(--duration-normal) var(--ease-in-out-soft),
              background var(--duration-normal) var(--ease-in-out-soft);
}

.join-card:hover {
  border-color: rgba(245, 240, 232, 0.2);
  background: rgba(245, 240, 232, 0.03);
}

.join-card__icon {
  font-size: var(--text-3xl);
  margin-bottom: var(--space-4);
  display: block;
}

.join-card__title {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  color: var(--rice-paper);
  margin-bottom: var(--space-3);
}

.join-card__text {
  color: var(--ink-wash);
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
  margin-bottom: var(--space-6);
  max-width: 30ch;
  margin-inline: auto;
}

/* --- Brush Stroke Dividers --- */

.brush-divider {
  display: block;
  width: clamp(120px, 20vw, 240px);
  height: auto;
  margin: 0 auto;
  color: var(--ink-faint);
}

/* --- Funding Partners --- */

.funders {
  background: var(--rice-paper-warm);
  padding: var(--space-16) 0;
}

.funders__list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: var(--space-12);
  list-style: none;
  margin: 0;
  padding: 0;
}

.funders__logo {
  display: block;
  /* Funder marks are shown unaltered — no grayscale/tint filters, since
     grant logo guidelines generally require accurate color reproduction. */
  transition: transform var(--duration-normal) var(--ease-out-expo);
}

.funders__logo:hover,
.funders__logo:focus-visible {
  transform: translateY(-2px);
}

.funders__logo img {
  display: block;
  width: clamp(180px, 22vw, 260px);
  height: auto;
}

.funders__credit {
  max-width: 58ch;
  margin: var(--space-10) auto 0;
  text-align: center;
  color: var(--ink-medium);
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
}

@media (prefers-reduced-motion: reduce) {
  .funders__logo {
    transition: none;
  }
}
