/* ==========================================================================
   RadhaNaam.in - Global styles
   Loaded after Bootstrap 5 and tokens.css. Bootstrap handles grid/utilities;
   this file only covers brand look, layout shell and shared components.
   ========================================================================== */

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-latin);
  font-size: var(--fs-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--color-link); }
a:hover { color: var(--color-heading); }

.deva {
  font-family: var(--font-devanagari-display);
}

::selection { background: var(--color-rose-300); color: var(--color-heading); }

:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ---- Skip link ---- */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--color-blue-900);
  color: var(--color-text-inverse);
  padding: var(--space-2) var(--space-3);
  z-index: 2000;
  border-radius: 0 0 var(--radius-sm) 0;
}
.skip-link:focus { left: 0; }

/* ---- Header / Nav ---- */
.site-header {
  background: var(--color-header-bg);
  backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 1030;
}

.brand {
  font-weight: 800;
  font-size: 1.25rem;
  color: var(--color-heading) !important;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  text-decoration: none;
}
.brand-logo {
  height: 40px;
  width: auto;
  display: block;
}
@media (max-width: 575.98px) {
  .brand-logo { height: 32px; }
}

.nav-link {
  color: var(--color-text) !important;
  font-weight: 600;
  padding: 0.5rem 0.9rem !important;
}
.nav-link.active,
.nav-link[aria-current="page"] {
  color: var(--color-heading) !important;
}

/* ---- Mobile bottom tab bar ----
   On phones this replaces "collapsed desktop nav" as the primary navigation:
   an intentional, always-visible bar for the 4 most frequent destinations,
   plus a "More" tab. "More" reuses the existing #mainNav collapse (Challenge,
   About, language, theme, Start Chanting) rather than duplicating it - see
   the media query below, which re-anchors that same panel as a bottom sheet
   instead of letting it expand inline at the top of the page. */
.bottom-tab-bar { display: none; }

@media (max-width: 767.98px) {
  .site-header .navbar-toggler { display: none; }

  body { padding-bottom: calc(60px + env(safe-area-inset-bottom, 0px)); }

  .bottom-tab-bar {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1030;
    background: var(--color-header-bg);
    backdrop-filter: saturate(140%) blur(8px);
    border-top: 1px solid var(--color-border);
    box-shadow: var(--shadow-md);
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  /* The shared header collapse, repurposed as a bottom sheet anchored just
     above the tab bar (instead of expanding inline in the header) whenever
     it's opened from the "More" tab on a phone-width viewport. */
  #mainNav.collapse {
    position: fixed;
    left: 0;
    right: 0;
    top: auto;
    bottom: calc(60px + env(safe-area-inset-bottom, 0px));
    max-height: 70vh;
    overflow-y: auto;
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
    box-shadow: var(--shadow-lg);
    z-index: 1029;
    padding: var(--space-3);
    margin: 0;
  }
}

.tab-link {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 60px;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--color-text-muted);
  text-decoration: none;
  background: none;
  border: none;
  padding: 6px 2px;
}
.tab-link i { font-size: 1.15rem; }
.tab-link.active,
.tab-link[aria-current="page"] { color: var(--color-blue-700); }

.theme-toggle-btn {
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-heading);
  border-radius: 50%;
  width: 44px;
  height: 44px;
  font-size: 1.05rem;
  line-height: 1;
  cursor: pointer;
  transition: transform var(--transition-fast), background var(--transition-base);
}
.theme-toggle-btn:hover { background: var(--color-rose-100); }
.theme-toggle-btn:active { transform: scale(0.92); }

.lang-switcher {
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-heading);
  border-radius: var(--radius-full);
  height: 44px;
  padding: 0 1.6rem 0 0.8rem;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
}
.lang-switcher:hover { background: var(--color-rose-100); }

.btn-brand {
  background: var(--color-blue-900);
  border: 1px solid var(--color-blue-900);
  color: var(--color-text-inverse);
  border-radius: var(--radius-full);
  font-weight: 700;
  padding: 0.6rem 1.4rem;
  transition: transform var(--transition-fast), background var(--transition-base);
}
.btn-brand:hover { background: var(--color-blue-700); color: var(--color-text-inverse); transform: translateY(-1px); }
.btn-brand:active { transform: translateY(0); }

.btn-glow { position: relative; overflow: hidden; }
.btn-glow::after {
  content: '';
  position: absolute;
  top: 0;
  left: -60%;
  width: 35%;
  height: 100%;
  background: linear-gradient(120deg, transparent, rgba(255, 255, 255, 0.55), transparent);
  transform: skewX(-20deg);
  animation: btn-shine 3.4s ease-in-out infinite;
}
@keyframes btn-shine {
  0%   { left: -60%; }
  35%  { left: 130%; }
  100% { left: 130%; }
}
@media (prefers-reduced-motion: reduce) {
  .btn-glow::after { display: none; }
}

.btn-outline-brand {
  background: transparent;
  border: 1px solid var(--color-heading);
  color: var(--color-heading);
  border-radius: var(--radius-full);
  font-weight: 700;
  padding: 0.6rem 1.4rem;
}
.btn-outline-brand:hover { background: var(--color-rose-100); color: var(--color-heading); }

.btn-soft-rose {
  background: var(--color-surface-rose);
  border: 1px solid var(--color-rose-300);
  color: var(--color-heading);
  border-radius: var(--radius-full);
  font-weight: 700;
  padding: 0.6rem 1.4rem;
}
.btn-soft-rose:hover { background: var(--color-rose-300); }

/* ---- Footer ---- */
.site-footer {
  background: var(--color-bg-alt);
  border-top: 1px solid var(--color-border);
  color: var(--color-text-muted);
}
.site-footer a { color: var(--color-text-muted); text-decoration: underline; }
.site-footer a:hover { color: var(--color-heading); }

/* ---- Hero ---- */
.hero {
  position: relative;
  overflow: hidden;
  padding: var(--space-6) 0 0;
  text-align: center;
  background: linear-gradient(180deg, var(--color-bg) 0%, var(--color-surface-rose) 100%);
}
.hero-decor {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.hero-sunburst {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 200vmax;
  height: 200vmax;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: repeating-conic-gradient(
    rgba(18, 60, 122, 0.06) 0deg 8deg,
    transparent 8deg 30deg,
    rgba(212, 144, 13, 0.07) 30deg 38deg,
    transparent 38deg 60deg
  );
  animation: hero-sunburst-spin 90s linear infinite;
}
@keyframes hero-sunburst-spin {
  to { transform: translate(-50%, -50%) rotate(360deg); }
}
.hero-glow {
  position: absolute;
  top: -25%;
  left: 50%;
  width: 50rem;
  height: 50rem;
  max-width: 140vw;
  transform: translateX(-50%);
  background: radial-gradient(circle, rgba(18, 60, 122, 0.16) 0%, rgba(212, 144, 13, 0.14) 45%, transparent 72%);
  animation: hero-breathe 9s ease-in-out infinite;
}
@keyframes hero-breathe {
  0%, 100% { transform: translateX(-50%) scale(1); opacity: 0.85; }
  50%      { transform: translateX(-50%) scale(1.08); opacity: 1; }
}
.hero-petal {
  position: absolute;
  font-size: 1.7rem;
  opacity: 0.55;
  animation: hero-petal-drift 6s ease-in-out infinite;
}
@keyframes hero-petal-drift {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50%      { transform: translateY(-16px) rotate(12deg); }
}
.hero-content { position: relative; z-index: 1; }
@media (prefers-reduced-motion: reduce) {
  .hero-glow, .hero-petal, .hero-sunburst { animation: none; }
}

.hero-wave { display: block; width: 100%; height: 48px; position: relative; z-index: 1; }
.hero-wave-path { fill: var(--color-bg); }

.hero-scroll-cue {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  margin-top: var(--space-4);
  border-radius: 50%;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-heading);
  font-size: 1.1rem;
  text-decoration: none;
  animation: hero-bounce 1.8s ease-in-out infinite;
}
.hero-scroll-cue:hover { color: var(--color-heading); }
@keyframes hero-bounce {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(6px); }
}
@media (prefers-reduced-motion: reduce) {
  .hero-scroll-cue { animation: none; }
}
.hero-deva {
  font-family: var(--font-devanagari-display);
  font-size: var(--fs-hero);
  color: var(--color-heading);
  line-height: 1.1;
  margin-bottom: var(--space-2);
}
.hero-brand-tagline {
  font-size: clamp(0.75rem, 2vw, 0.95rem);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--color-gold-text);
  font-weight: 700;
  margin-bottom: var(--space-3);
}
.hero-tagline {
  font-family: var(--font-script);
  font-weight: 700;
  font-size: clamp(1.6rem, 5.5vw, 3rem);
  color: var(--color-heading);
  white-space: nowrap;
}
@media (max-width: 420px) {
  /* Even the narrowest phones keep this on one line - it just shrinks further. */
  .hero-tagline { font-size: clamp(1.3rem, 7.2vw, 1.6rem); }
}
.hero-sub {
  color: var(--color-text-muted);
  max-width: 40rem;
  margin: var(--space-3) auto var(--space-4);
}

/* ---- Live counter - plain, no card/box, just big digits ---- */
.live-counter {
  max-width: 28rem;
  margin: 0 auto var(--space-4);
}
.live-counter .count {
  font-weight: 800;
  font-size: clamp(3rem, 14vw, 5rem);
  line-height: 1;
  color: var(--color-heading);
  font-variant-numeric: tabular-nums;
}
.live-counter .count-label {
  margin-top: var(--space-2);
  color: var(--color-gold-text);
  font-weight: 700;
  letter-spacing: 0.06em;
  font-size: var(--fs-small);
}
.live-counter .participants {
  margin-top: var(--space-1);
  font-size: var(--fs-small);
  color: var(--color-text-muted);
}

/* ---- Generic section / card ---- */
.section { padding: var(--space-6) 0; }
.section-alt { background: var(--color-bg-alt); }
.section-title { font-size: var(--fs-h2); color: var(--color-heading); font-weight: 800; }
.section-title i { color: var(--color-gold-500); }
.section-lead { color: var(--color-text-muted); max-width: 42rem; }

/* ---- Loading skeleton ----
   For the brief window before a live-stats callback resolves (either to
   real numbers or to the "offline" message) - sized to roughly match the
   number/line it stands in for, and never left stuck since the calling
   code always removes this class once it has a definitive answer. */
.skel {
  display: inline-block;
  min-width: 3ch;
  height: 1em;
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, var(--color-border) 25%, var(--color-rose-100) 50%, var(--color-border) 75%);
  background-size: 200% 100%;
  animation: skel-shimmer 1.4s ease-in-out infinite;
  color: transparent !important;
  vertical-align: middle;
}
@keyframes skel-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
@media (prefers-reduced-motion: reduce) {
  .skel { animation: none; background: var(--color-border); }
}

.eyebrow {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-gold-text);
  margin-bottom: 0.4rem;
}

.card-soft {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--space-4);
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}
.card-hover:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }

/* ---- "How it works" steps ---- */
.steps-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-4);
  text-align: center;
}
.step-item { max-width: 12rem; }
.step-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--color-surface-rose);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  margin: 0 auto var(--space-2);
  box-shadow: var(--shadow-sm);
}
.step-icon i { color: var(--color-blue-700); font-size: 1.6rem; }
.card-soft h3 i { color: var(--color-blue-700); }
.step-item h3 { font-size: 1rem; color: var(--color-heading); font-weight: 700; margin-bottom: 0.25rem; }
.step-item p { font-size: var(--fs-small); color: var(--color-text-muted); margin: 0; }
.step-arrow { color: var(--color-rose-400); font-size: 1.5rem; align-self: center; }
@media (max-width: 767.98px) {
  .step-arrow { display: none; }
}

/* ---- Scroll reveal ---- */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 650ms ease, transform 650ms ease;
}
.reveal.is-visible { opacity: 1; transform: translateY(0); }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
}

/* ---- Activity feed ---- */
.activity-feed { list-style: none; padding: 0; margin: 0; }
.activity-feed li {
  padding: var(--space-2) 0;
  border-bottom: 1px dashed var(--color-border);
  color: var(--color-text-muted);
  font-size: var(--fs-small);
}
.activity-feed li:last-child { border-bottom: none; }

/* ---- Country stats table ---- */
.country-list { list-style: none; padding: 0; margin: 0; }
.country-list li {
  display: flex;
  justify-content: space-between;
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--color-border);
}
.country-list li:last-child { border-bottom: none; }
.country-list .num { font-weight: 700; color: var(--color-heading); font-variant-numeric: tabular-nums; }

/* ---- Progress ---- */
.progress-brand {
  height: 0.9rem;
  border-radius: var(--radius-full);
  background: var(--color-rose-100);
}
.progress-brand .progress-bar {
  background: linear-gradient(90deg, var(--color-blue-700), var(--color-gold-500));
}

/* ---- Sync status pill ---- */
.sync-status {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: var(--fs-small);
  color: var(--color-text-muted);
}
.sync-dot {
  width: 0.5rem; height: 0.5rem; border-radius: 50%;
  background: var(--color-success);
  transition: background var(--transition-base);
}
.sync-status[data-state="offline"] .sync-dot { background: var(--color-warning); }
.sync-status[data-state="error"] .sync-dot { background: var(--color-danger); }

/* ---- Utilities ---- */
.text-maroon { color: var(--color-heading); }
.text-muted-brand { color: var(--color-text-muted); }
.bg-rose { background: var(--color-surface-rose); }
.tap-target { min-height: 44px; min-width: 44px; }

@media (max-width: 575.98px) {
  .hero { padding: var(--space-5) 0 var(--space-4); }
}

/* ---- Blog (list + post pages, server-rendered by functions/blog.js) ---- */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  gap: var(--space-4);
  margin-top: var(--space-4);
}
.blog-card {
  display: block;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  padding: 0;
}
.blog-card-cover {
  width: 100%;
  height: 10rem;
  object-fit: cover;
  display: block;
}
.blog-card-body { padding: var(--space-3); }
.blog-post-cover {
  width: 100%;
  max-height: 22rem;
  object-fit: cover;
  border-radius: var(--radius-lg);
}
.blog-cover-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--color-gold-300), var(--color-bg-alt));
  font-size: 2.5rem;
}
.blog-post-cover.blog-cover-placeholder { height: 12rem; }
.blog-tags { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.blog-tag {
  display: inline-block;
  font-size: var(--fs-small);
  font-weight: 600;
  color: var(--color-blue-700);
  background: var(--color-rose-100);
  border-radius: var(--radius-full);
  padding: 0.2rem 0.7rem;
}
.blog-post-body {
  color: var(--color-text);
  line-height: 1.8;
}
.blog-post-body h2, .blog-post-body h3 { color: var(--color-heading); margin-top: var(--space-4); }
.blog-post-body p { margin-bottom: var(--space-3); }
.blog-post-body img { max-width: 100%; border-radius: var(--radius-md); }
.blog-post-body a { color: var(--color-link); }
.blog-post-body blockquote {
  border-left: 3px solid var(--color-gold-300);
  padding-left: var(--space-3);
  color: var(--color-text-muted);
  font-style: italic;
  margin: var(--space-3) 0;
}
