/* ==========================================================================
   FESTIVAL SEVA CAMPAIGNS
   Side tab + slide-in card (all pages), inline banner (Home / Function Days),
   festival note on the booking form. Driven by assets/js/campaigns.js.
   Uses the colour and type tokens defined in style.css.
   ========================================================================== */

.cmp-root {
  font-family: var(--font-body);
}

.cmp-flame {
  color: #ffb300;
  animation: cmpFlicker 1.8s ease-in-out infinite;
}

@keyframes cmpFlicker {
  0%, 100% { opacity: 1; transform: scale(1); }
  35% { opacity: 0.75; transform: scale(0.92); }
  60% { opacity: 1; transform: scale(1.08); }
}

/* ---- Side tab (always visible on the left edge) -------------------------- */
.cmp-tab {
  position: fixed;
  left: 0;
  top: 50%;
  z-index: 1550;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 16px 5px;
  border: 2px solid var(--primary-gold);
  border-top: 0;
  border-radius: 0 0 10px 10px;
  background: var(--crimson-dark);
  color: #fff;
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  transform-origin: left top;
  transform: rotate(-90deg) translateX(-50%);
  transition: background 0.25s ease, opacity 0.25s ease;
}

.cmp-tab:hover,
.cmp-tab:focus-visible {
  background: var(--crimson-main);
}

.cmp-tab .cmp-flame {
  font-size: 1rem;
  transform: rotate(90deg);
  animation: none;
}

.cmp-tab-days {
  padding: 1px 8px;
  border-radius: 20px;
  background: var(--gold-gradient);
  color: var(--crimson-dark);
  font-size: 0.7rem;
  font-weight: 700;
}

.cmp-open .cmp-tab {
  opacity: 0;
  pointer-events: none;
}

/* ---- Slide-in card ------------------------------------------------------- */
.cmp-backdrop {
  display: none;
}

.cmp-card {
  position: fixed;
  left: 20px;
  top: 50%;
  z-index: 1700;
  width: 372px;
  max-width: calc(100vw - 40px);
  max-height: min(664px, calc(100vh - 32px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 2px solid var(--primary-gold);
  border-radius: var(--radius-md);
  background: var(--bg-cream);
  color: var(--text-primary);
  box-shadow: var(--shadow-lg), var(--gold-glow);
  transform: translate(calc(-100% - 40px), -50%);
  visibility: hidden;
  transition: transform 0.45s cubic-bezier(0.22, 0.9, 0.3, 1), visibility 0s linear 0.45s;
}

.cmp-open .cmp-card {
  transform: translate(0, -50%);
  visibility: visible;
  transition: transform 0.45s cubic-bezier(0.22, 0.9, 0.3, 1), visibility 0s;
}

.cmp-media {
  position: relative;
  flex: 0 0 auto;
  height: 150px;
  background: var(--crimson-dark);
}

.cmp-media img,
.cmp-band-media img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.cmp-media::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(27, 22, 20, 0.35) 0%, rgba(27, 22, 20, 0) 34%, rgba(74, 7, 17, 0.94) 100%);
  pointer-events: none;
}

.cmp-kicker {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: 20px;
  background: var(--gold-gradient);
  color: var(--crimson-dark);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

.cmp-close {
  position: absolute;
  top: 9px;
  right: 9px;
  z-index: 2;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(247, 208, 112, 0.7);
  border-radius: 50%;
  background: rgba(27, 22, 20, 0.72);
  color: #fff;
  font-size: 0.95rem;
  cursor: pointer;
  transition: var(--transition);
}

.cmp-close:hover,
.cmp-close:focus-visible {
  background: var(--crimson-main);
  transform: rotate(90deg);
}

.cmp-heading {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 11px;
  z-index: 2;
}

.cmp-heading h2,
.cmp-band-head h2 {
  margin: 0;
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.2;
}

.cmp-heading h2 {
  color: #fff;
  font-size: 1.32rem;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
}

.cmp-tamil {
  margin-top: 2px;
  color: #f7d070;
  font-size: 0.86rem;
  font-weight: 500;
}

.cmp-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 14px 16px 16px;
  overscroll-behavior: contain;
}

/* ---- Date + countdown ---------------------------------------------------- */
.cmp-when {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.cmp-date {
  color: var(--crimson-main);
  font-size: 0.86rem;
  font-weight: 700;
}

.cmp-date i {
  color: var(--primary-gold);
  margin-right: 3px;
}

.cmp-cd {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
}

.cmp-cd[hidden],
.cmp-cd-live[hidden] {
  display: none;
}

.cmp-cd-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 0 5px;
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-sm);
  background: var(--crimson-dark);
}

.cmp-cd-box b {
  color: #f7d070;
  font-family: var(--font-heading);
  font-size: 1.28rem;
  font-weight: 700;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}

.cmp-cd-box small {
  color: #f1e3c4;
  font-size: 0.62rem;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.cmp-cd-live {
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  background: var(--crimson-dark);
  color: #f7d070;
  font-size: 0.86rem;
  font-weight: 600;
  text-align: center;
}

.cmp-pitch {
  margin: 10px 0;
  color: var(--text-secondary);
  font-size: 0.84rem;
  line-height: 1.55;
}

/* ---- Seva tiers ---------------------------------------------------------- */
.cmp-tiers {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cmp-tier {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 11px;
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text-primary);
  text-decoration: none;
  transition: var(--transition);
}

.cmp-tier:hover,
.cmp-tier:focus-visible {
  border-color: var(--primary-gold);
  box-shadow: var(--shadow-gold);
  transform: translateX(3px);
}

.cmp-tier-featured {
  border-color: var(--primary-gold);
  background: #fff8e6;
}

.cmp-tier-icon {
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--crimson-dark);
  color: #f7d070;
  font-size: 0.88rem;
}

.cmp-tier-text {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.cmp-tier-text strong {
  color: var(--crimson-dark);
  font-size: 0.87rem;
  line-height: 1.3;
}

.cmp-tier-text small {
  color: var(--text-secondary);
  font-size: 0.74rem;
  line-height: 1.35;
}

.cmp-tier-price {
  flex: 0 0 auto;
  color: var(--crimson-main);
  font-size: 0.84rem;
  font-weight: 700;
  white-space: nowrap;
}

.cmp-tier-price i {
  margin-left: 3px;
  color: var(--primary-gold);
  font-size: 0.68rem;
}

/* ---- Prasadam promise + actions ------------------------------------------ */
.cmp-prasadam {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  padding: 10px 12px;
  border-left: 4px solid var(--saffron-warm);
  border-radius: 4px;
  background: var(--saffron-soft);
  color: var(--text-primary);
  font-size: 0.78rem;
  line-height: 1.5;
}

.cmp-prasadam i {
  margin-top: 2px;
  color: var(--saffron-warm);
  font-size: 1rem;
}

.cmp-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

/* Pinned under the scrolling part of the card so the button is always in view */
.cmp-foot {
  flex: 0 0 auto;
  margin-top: 0;
  padding: 10px 16px 12px;
  border-top: 1px solid var(--border-gold);
  background: var(--bg-ivory);
}

/* Gold line that runs down while a self-opened card waits to tuck away */
.cmp-foot {
  position: relative;
}

.cmp-autoclosing .cmp-foot::before {
  content: '';
  position: absolute;
  left: 0;
  top: -2px;
  width: 100%;
  height: 3px;
  background: var(--gold-gradient);
  transform-origin: left center;
  animation: cmpAutoClose 5s linear forwards;
}

@keyframes cmpAutoClose {
  from { transform: scaleX(1); }
  to { transform: scaleX(0); }
}

.cmp-cta,
.cmp-share {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 700;
  text-decoration: none;
  transition: var(--transition);
}

.cmp-cta {
  flex: 1 1 auto;
  background: var(--gold-gradient);
  color: var(--crimson-dark);
  box-shadow: var(--shadow-gold);
}

.cmp-cta:hover,
.cmp-cta:focus-visible {
  color: var(--crimson-dark);
  transform: translateY(-2px);
  filter: brightness(1.06);
}

.cmp-share {
  flex: 0 0 auto;
  border: 1px solid #128c4b;
  background: #fff;
  color: #0b6b38;
}

.cmp-share:hover,
.cmp-share:focus-visible {
  background: #128c4b;
  color: #fff;
}

.cmp-next {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--border-gold);
}

.cmp-next h3 {
  flex: 0 0 auto;
  margin: 0;
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.cmp-next ul {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.cmp-next li {
  color: var(--text-primary);
  font-size: 0.76rem;
}

.cmp-next li span:last-child {
  color: var(--crimson-main);
  font-weight: 600;
  white-space: nowrap;
}

.cmp-note {
  margin: 8px 0 0;
  color: var(--text-secondary);
  font-size: 0.68rem;
  line-height: 1.5;
}

/* ---- Inline banner (Home + Function Days) -------------------------------- */
.cmp-band-section {
  padding: 46px 0 8px;
  background: var(--bg-cream);
}

.cmp-band-inline {
  padding: 0;
  margin-bottom: 34px;
  background: none;
}

.cmp-band {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.4fr);
  overflow: hidden;
  border: 2px solid var(--primary-gold);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  box-shadow: var(--shadow-md);
}

.cmp-band-media {
  position: relative;
  min-height: 300px;
  background: var(--crimson-dark);
}

.cmp-band-media img {
  position: absolute;
  inset: 0;
}

.cmp-band-body {
  padding: 24px 26px;
}

.cmp-band-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
}

.cmp-band-head h2 {
  color: var(--crimson-dark);
  font-size: 1.7rem;
}

.cmp-band-head .cmp-tamil {
  color: var(--saffron-warm);
  font-size: 0.95rem;
}

.cmp-band-head .cmp-when {
  flex: 0 0 236px;
}

.cmp-band .cmp-pitch {
  margin: 14px 0;
  font-size: 0.92rem;
}

.cmp-band .cmp-tiers {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.cmp-band .cmp-tier {
  flex-wrap: wrap;
  align-items: flex-start;
}

.cmp-band .cmp-tier-text {
  flex: 1 1 calc(100% - 46px);
}

.cmp-band .cmp-tier-price {
  margin-left: 45px;
}

.cmp-band-foot {
  display: flex;
  align-items: stretch;
  gap: 14px;
  margin-top: 14px;
}

.cmp-band-foot .cmp-prasadam {
  flex: 1 1 auto;
  margin-top: 0;
}

.cmp-band-foot .cmp-actions {
  flex: 0 0 auto;
  align-items: center;
  margin-top: 0;
}

/* ---- Festival note on the booking form ----------------------------------- */
.cmp-occasion {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 18px;
  padding: 11px 13px;
  border: 1px solid var(--primary-gold);
  border-radius: var(--radius-sm);
  background: var(--crimson-dark);
  color: #fff;
  font-size: 0.86rem;
  line-height: 1.5;
}

.cmp-occasion strong {
  color: #f7d070;
}

.cmp-occasion .cmp-flame {
  font-size: 1.15rem;
}

.cmp-occasion button {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  margin-left: auto;
  border: 1px solid rgba(247, 208, 112, 0.6);
  border-radius: 50%;
  background: transparent;
  color: #fff;
  cursor: pointer;
}

.cmp-occasion button:hover,
.cmp-occasion button:focus-visible {
  background: var(--crimson-light);
}

/* ---- Tablet -------------------------------------------------------------- */
@media (max-width: 1024px) {
  .cmp-band {
    grid-template-columns: 1fr;
  }

  .cmp-band-media {
    min-height: 0;
    height: 210px;
  }
}

/* ---- Mobile: pill above the audio bar, card becomes a bottom sheet -------- */
@media (max-width: 768px) {
  .cmp-tab {
    top: auto;
    left: 12px;
    bottom: 74px;
    max-width: calc(100vw - 24px);
    padding: 8px 13px;
    border: 2px solid var(--primary-gold);
    border-radius: 50px;
    font-size: 0.78rem;
    transform: none;
  }

  .cmp-tab .cmp-flame {
    transform: none;
  }

  .cmp-tab-title {
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .cmp-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 1690;
    background: rgba(27, 22, 20, 0.6);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0s linear 0.3s;
  }

  .cmp-open .cmp-backdrop {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease, visibility 0s;
  }

  .cmp-card {
    left: 0;
    right: 0;
    top: auto;
    bottom: 0;
    width: auto;
    max-width: 520px;
    margin: 0 auto;
    max-height: 74vh;
    border-width: 2px 2px 0;
    border-radius: 18px 18px 0 0;
    transform: translateY(105%);
  }

  .cmp-open .cmp-card {
    transform: translateY(0);
  }

  .cmp-media {
    height: 150px;
  }

  .cmp-band-section {
    padding-top: 30px;
  }

  .cmp-band-body {
    padding: 18px 16px;
  }

  .cmp-band-head {
    flex-direction: column;
    gap: 12px;
  }

  .cmp-band-head h2 {
    font-size: 1.35rem;
  }

  .cmp-band-head .cmp-when {
    flex: 0 0 auto;
    width: 100%;
  }

  .cmp-band .cmp-tiers {
    grid-template-columns: 1fr;
  }

  .cmp-band .cmp-tier {
    flex-wrap: nowrap;
    align-items: center;
  }

  .cmp-band .cmp-tier-text {
    flex: 1 1 auto;
  }

  .cmp-band .cmp-tier-price {
    margin-left: 0;
  }

  .cmp-band-foot {
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cmp-flame {
    animation: none;
  }

  .cmp-card,
  .cmp-backdrop,
  .cmp-tier,
  .cmp-cta,
  .cmp-close {
    transition: none;
  }
}

@media print {
  .cmp-root,
  .cmp-band-section,
  .cmp-occasion {
    display: none !important;
  }
}
