/* ============================================================
   FESTIVE DRESSING — motif layer + greeting ribbon
   Driven by js/festive.js, which sets data-festival on <html>.
   All of it is decorative and pointer-transparent.
   ============================================================ */

:root { --c-festive: var(--c-gold); }

/* ---------- Greeting strip ----------
   A full-width band flush with the top of the page. It used to be a floating
   pill, which fought the nav island for the same space and dropped its own
   message on narrow screens, leaving a chip that said nothing. */
.festbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: calc(var(--z-nav) + 2);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 2.3rem;
  padding: 0.4rem 2.6rem 0.4rem 1rem;
  padding-top: calc(0.4rem + env(safe-area-inset-top));
  background:
    radial-gradient(60% 300% at 50% 0%, color-mix(in srgb, var(--c-festive) 26%, transparent), transparent 70%),
    color-mix(in srgb, var(--c-bg-sunk) 88%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--c-festive) 38%, transparent);
  backdrop-filter: blur(16px) saturate(1.3);
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
  font-size: 0.74rem;
  line-height: 1.3;
  color: var(--c-ink-2);
  transform: translateY(-100%);
  transition: transform var(--d-slow) var(--ease-spring);
}
.festbar.is-in { transform: none; }

.festbar__dot {
  width: 6px; height: 6px; flex: 0 0 auto; border-radius: 50%;
  background: var(--c-festive);
  box-shadow: 0 0 10px var(--c-festive);
}
.festbar__name {
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 0.64rem;
  color: var(--c-festive);
  white-space: nowrap;
}
.festbar__name::after { content: "·"; margin-left: 0.45rem; color: var(--c-ink-4); }
.festbar__msg {
  color: var(--c-ink-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: min(72vw, 46rem);
}
.festbar__x {
  position: absolute;
  right: 0.45rem;
  top: 50%;
  translate: 0 -50%;
  width: 1.4rem; height: 1.4rem;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 0.95rem; line-height: 1;
  color: var(--c-ink-4);
  transition: color var(--d-fast) var(--ease-silk), background-color var(--d-fast) var(--ease-silk);
}
.festbar__x:hover { color: var(--c-ink); background: var(--c-surface-2); }

/* the floating nav drops below the strip while it is up */
html[data-festival] .nav { padding-top: calc(2.3rem + clamp(0.7rem, 0.3rem + 1.1vw, 1.6rem) + env(safe-area-inset-top)); }

@media (max-width: 560px) {
  .festbar { font-size: 0.68rem; padding-left: 0.75rem; }
  .festbar__name { display: none; }   /* the greeting already names the festival */
  .festbar__msg { max-width: calc(100vw - 4rem); }
}

/* ---------- Motif layer ---------- */
.festive {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
}
.festive i {
  position: absolute;
  top: -8vh;
  display: block;
  opacity: 0;
  will-change: transform, opacity;
  animation-name: festFall;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
  scale: var(--s, 1);
}
@keyframes festFall {
  0% { transform: translate3d(0, -10vh, 0) rotate(0deg); opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 1; }
  100% { transform: translate3d(2vw, 112vh, 0) rotate(220deg); opacity: 0; }
}

/* drift upward instead, for lanterns, floating lights and diyas */
.festive[data-motif="lights"] i,
.festive[data-motif="diya"] i,
.festive[data-motif="lantern"] i {
  top: auto;
  bottom: -8vh;
  animation-name: festRise;
}
@keyframes festRise {
  0% { transform: translate3d(0, 10vh, 0); opacity: 0; }
  12% { opacity: 0.9; }
  88% { opacity: 0.9; }
  100% { transform: translate3d(-3vw, -112vh, 0); opacity: 0; }
}

/* --- Songkran: water droplets --- */
.festive[data-motif="water"] i {
  width: 7px; height: 11px;
  border-radius: 50% 50% 50% 50% / 62% 62% 38% 38%;
  background: linear-gradient(180deg, rgba(174, 230, 248, 0.95), rgba(73, 182, 214, 0.5));
  box-shadow: 0 0 10px rgba(110, 205, 235, 0.6);
}

/* --- Loy Krathong / Chuseok: floating lights --- */
.festive[data-motif="lights"] i {
  width: 9px; height: 9px; border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #fff2cf, #e8b45e 55%, rgba(232, 180, 94, 0) 72%);
  box-shadow: 0 0 16px rgba(232, 180, 94, 0.8);
}

/* --- Christmas: snow --- */
.festive[data-motif="snow"] i {
  width: 6px; height: 6px; border-radius: 50%;
  background: radial-gradient(circle, #ffffff, rgba(255, 255, 255, 0.25) 70%, transparent);
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.7);
}

/* --- Lunar New Year: lanterns --- */
.festive[data-motif="lantern"] i {
  width: 13px; height: 17px;
  border-radius: 48% 48% 44% 44% / 38% 38% 54% 54%;
  background: linear-gradient(180deg, #f0786d, #c8372f);
  box-shadow: 0 0 16px rgba(224, 87, 79, 0.65), inset 0 2px 3px rgba(255, 255, 255, 0.35);
}
.festive[data-motif="lantern"] i::after {
  content: ""; position: absolute; left: 50%; bottom: -5px;
  width: 1px; height: 5px; translate: -50% 0;
  background: #e8b45e;
}

/* --- Diwali: diya lamps, a clay bowl under a flickering flame --- */
.festive[data-motif="diya"] i {
  width: 14px;
  height: 7px;
  border-radius: 0 0 50% 50% / 0 0 100% 100%;
  background: linear-gradient(180deg, #c9742f, #8a4a1c);
  box-shadow: 0 0 18px rgba(240, 161, 50, 0.55);
}
.festive[data-motif="diya"] i::before {
  /* the flame */
  content: "";
  position: absolute;
  left: 50%;
  bottom: 4px;
  width: 6px;
  height: 11px;
  translate: -50% 0;
  border-radius: 50% 50% 50% 50% / 68% 68% 32% 32%;
  background: radial-gradient(ellipse at 50% 72%, #fff6d8 0%, #ffd166 42%, #f0a132 70%, rgba(240, 161, 50, 0) 100%);
  animation: diyaFlicker 1.6s ease-in-out infinite;
}
.festive[data-motif="diya"] i::after {
  /* the glow it casts */
  content: "";
  position: absolute;
  left: 50%;
  bottom: 2px;
  width: 26px;
  height: 26px;
  translate: -50% 0;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 196, 92, 0.42) 0%, rgba(255, 196, 92, 0) 70%);
}
@keyframes diyaFlicker {
  0%, 100% { transform: scaleY(1) scaleX(1); opacity: 1; }
  35% { transform: scaleY(1.18) scaleX(0.9); opacity: 0.88; }
  65% { transform: scaleY(0.92) scaleX(1.06); opacity: 1; }
}

/* --- New Year: gold sparks --- */
.festive[data-motif="sparkle"] i {
  width: 4px; height: 4px; border-radius: 50%;
  background: #f6e2bb;
  box-shadow: 0 0 10px 1px rgba(229, 195, 137, 0.9);
}

/* --- Valentine's: hearts --- */
.festive[data-motif="hearts"] i {
  width: 11px; height: 10px;
  background: #d97f8e;
  box-shadow: 0 0 12px rgba(217, 127, 142, 0.55);
  clip-path: path("M5.5 10C2 7.4 0 5.6 0 3.4 0 1.5 1.4 0 3.2 0c1 0 1.8.4 2.3 1.2C6 .4 6.9 0 7.8 0 9.6 0 11 1.5 11 3.4c0 2.2-2 4-5.5 6.6z");
}

/* ---------- Accent recolouring while a festival runs ---------- */
html[data-festival="songkran"] .eyebrow::before,
html[data-festival="christmas"] .eyebrow::before,
html[data-festival="orthodox"] .eyebrow::before,
html[data-festival="cny"] .eyebrow::before,
html[data-festival="seollal"] .eyebrow::before,
html[data-festival="valentines"] .eyebrow::before {
  background: var(--c-festive);
  box-shadow: 0 0 12px var(--c-festive);
}
html[data-festival] .live__dot { box-shadow: 0 0 10px var(--c-festive); }

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