/* ============ Tokens ============ */
:root {
  --maroon: #6E1423;
  --maroon-dark: #4A0D18;
  --maroon-soft: #8A2436;
  --gold: #C99A3A;
  --gold-light: #E7C078;
  --turmeric: #E7A93F;
  --cream: #FBF3E3;
  --sandalwood: #F3E6C8;
  --ink: #2E1B12;
  --ink-soft: #6B5544;
  --line: #E3D2AC;
  --header-h: 108px;
  --font-display: 'Tiro Telugu', 'Noto Sans Telugu', serif;
  --font-body: 'Noto Sans Telugu', 'Poppins', sans-serif;
  --font-ui: 'Poppins', 'Noto Sans Telugu', sans-serif;
  --shadow-soft: 0 6px 20px rgba(74, 13, 24, 0.12);
  --radius: 14px;
}

* { box-sizing: border-box; }
html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 12px);
  background: var(--cream); /* fallback: matches body so any rubber-band gap isn't blank white */
  overscroll-behavior-y: none; /* stops iOS Safari's bounce from exposing blank space above/below the page */
}

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--cream);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  padding-bottom: 64px; /* space for bottom nav */
  overscroll-behavior-y: none; /* stops Chrome/Android's pull-to-refresh gesture from firing */
  min-height: 100vh;
  min-height: 100dvh;
}

img { max-width: 100%; display: block; }
a { color: inherit; }

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--maroon);
  color: #fff;
  padding: 10px 16px;
  z-index: 999;
  border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

/* ============ Header (fixed) ============ */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  background: linear-gradient(180deg, var(--maroon) 0%, var(--maroon-dark) 100%);
  color: #fff;
  box-shadow: var(--shadow-soft);
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px 8px;
  gap: 12px;
}

.header-brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--sandalwood);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: inset 0 0 0 2px var(--gold);
}
.brand-icon { width: 24px; height: 24px; fill: var(--maroon); }

.brand-text { min-width: 0; }
.brand-name {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.15rem;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--gold-light);
}
.brand-place {
  margin: 1px 0 0;
  font-size: 0.72rem;
  color: #E9D9BE;
  font-family: var(--font-ui);
  letter-spacing: 0.02em;
}

.icon-btn {
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(231,192,120,0.4);
  color: var(--gold-light);
  width: 38px; height: 38px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
}
.icon-btn:active { background: rgba(255,255,255,0.22); }

.header-nav {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding: 0 12px 10px;
  scrollbar-width: none;
}
.header-nav::-webkit-scrollbar { display: none; }

.nav-link {
  flex-shrink: 0;
  font-family: var(--font-ui);
  font-size: 0.78rem;
  font-weight: 500;
  text-decoration: none;
  color: #EAD9BC;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.nav-link.active {
  background: var(--gold);
  color: var(--maroon-dark);
  font-weight: 600;
}

/* Signature: stepped gopuram silhouette under the header */
.gopuram-edge {
  height: 10px;
  width: 100%;
  background:
    linear-gradient(135deg, transparent 50%, var(--cream) 50%) 0 0/16px 10px repeat-x,
    linear-gradient(45deg, transparent 50%, var(--cream) 50%) 0 0/16px 10px repeat-x;
  background-position: 0 0, 8px 0;
}

/* ============ Update toast ============ */
.update-toast {
  position: fixed;
  top: calc(var(--header-h) + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(-12px);
  background: var(--ink);
  color: var(--gold-light);
  font-family: var(--font-ui);
  font-size: 0.8rem;
  padding: 9px 18px;
  border-radius: 999px;
  z-index: 90;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease, transform 0.35s ease;
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
}
.update-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ============ Hero ============ */
.hero {
  position: relative;
  margin-top: var(--header-h);
  min-height: 380px;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
}
.hero-banner {
  position: absolute;
  inset: 0;
  background: linear-gradient(160deg, var(--maroon-soft), var(--maroon-dark)) center/cover;
}
.hero-banner img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
}
.hero-banner-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(74,13,24,0.15) 0%, rgba(30,8,13,0.88) 100%);
}
.hero-content {
  position: relative;
  z-index: 2;
  padding: 28px 20px 30px;
  color: #fff;
}
.hero-eyebrow {
  font-family: var(--font-ui);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.7rem;
  color: var(--turmeric);
  margin: 0 0 6px;
  font-weight: 600;
}
.hero-title {
  font-family: var(--font-display);
  font-size: 1.7rem;
  line-height: 1.3;
  margin: 0 0 10px;
  color: #fff;
  text-shadow: 0 2px 10px rgba(0,0,0,0.35);
}
.hero-address {
  margin: 0 0 18px;
  font-size: 0.9rem;
  color: #E9D9BE;
}
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.btn {
  font-family: var(--font-ui);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: 999px;
  text-decoration: none;
  display: inline-block;
  border: 1px solid transparent;
}
.btn-gold { background: var(--gold); color: var(--maroon-dark); }
.btn-outline { border-color: rgba(255,255,255,0.6); color: #fff; }

.offline-badge {
  position: absolute;
  top: 12px; right: 12px;
  z-index: 3;
  background: rgba(0,0,0,0.55);
  color: var(--turmeric);
  font-family: var(--font-ui);
  font-size: 0.7rem;
  padding: 5px 11px;
  border-radius: 999px;
}

/* ============ Sections ============ */
.section {
  padding: 40px 18px 44px;
  max-width: 760px;
  margin: 0 auto;
}
.section-alt { background: var(--sandalwood); }

.section-title {
  font-family: var(--font-display);
  font-size: 1.35rem;
  color: var(--maroon);
  margin: 0 0 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.subsection-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--maroon);
  margin: 30px 0 14px;
}

.kalasha-dot {
  width: 14px; height: 16px;
  flex-shrink: 0;
  background: var(--gold);
  clip-path: polygon(50% 0%, 100% 45%, 78% 45%, 78% 100%, 22% 100%, 22% 45%, 0% 45%);
}

.about-text {
  font-size: 0.98rem;
  line-height: 1.8;
  color: var(--ink-soft);
  margin: 0 0 18px;
}

.puranam-list { display: flex; flex-direction: column; gap: 14px; }
.puranam-item {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.puranam-item summary {
  padding: 14px 16px;
  font-family: var(--font-ui);
  font-weight: 600;
  color: var(--maroon);
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.puranam-item summary::-webkit-details-marker { display: none; }
.puranam-item summary::after {
  content: '+';
  font-size: 1.2rem;
  color: var(--gold);
  transition: transform 0.2s ease;
}
.puranam-item[open] summary::after { transform: rotate(45deg); }
.puranam-item .puranam-body {
  padding: 0 16px 16px;
  font-size: 0.92rem;
  line-height: 1.75;
  color: var(--ink-soft);
}

/* ============ Timings ============ */
.timings-table-wrap {
  background: #fff;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
}
.timings-table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
.timings-table th {
  background: var(--maroon);
  color: var(--gold-light);
  font-family: var(--font-ui);
  font-weight: 600;
  text-align: left;
  padding: 10px 12px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.timings-table td {
  padding: 10px 12px;
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
}
.timings-table tr.today td { background: var(--sandalwood); color: var(--ink); font-weight: 600; }

/* ============ Sevas ============ */
.seva-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
.seva-card {
  background: #fff;
  border: 1px solid var(--line);
  border-left: 4px solid var(--gold);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.seva-card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
}
.seva-name { font-family: var(--font-ui); font-weight: 600; color: var(--maroon); font-size: 1rem; }
.seva-amount { font-family: var(--font-ui); font-weight: 700; color: var(--gold); font-size: 1.05rem; white-space: nowrap; }
.seva-desc { margin: 6px 0 0; font-size: 0.86rem; color: var(--ink-soft); line-height: 1.6; }

/* ============ Festivals timeline ============ */
.timeline { position: relative; padding-left: 26px; }
.timeline::before {
  content: '';
  position: absolute;
  left: 6px; top: 4px; bottom: 4px;
  width: 2px;
  background: var(--gold-light);
}
.timeline-item { position: relative; padding-bottom: 20px; }
.timeline-item::before {
  content: '';
  position: absolute;
  left: -26px; top: 3px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--gold);
  border: 2px solid #fff;
  box-shadow: 0 0 0 2px var(--gold);
}
.timeline-date {
  display: inline-block;
  font-family: var(--font-ui);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--maroon-dark);
  background: var(--turmeric);
  padding: 3px 10px;
  border-radius: 999px;
  margin-bottom: 6px;
}
.timeline-title { margin: 0 0 4px; font-weight: 600; color: var(--maroon); font-family: var(--font-ui); }
.timeline-desc { margin: 0; font-size: 0.86rem; color: var(--ink-soft); line-height: 1.6; }
.empty-note { color: var(--ink-soft); font-size: 0.9rem; }

/* ============ Gallery ============ */
.gallery-group { margin-bottom: 24px; }
.gallery-group h3 {
  font-family: var(--font-ui);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  margin: 0 0 10px;
}
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.gallery-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: 10px;
  overflow: hidden;
  background: var(--sandalwood);
  border: 1px solid var(--line);
}
.gallery-item img { width: 100%; height: 100%; object-fit: cover; }

/* ============ Devotee experiences ============ */
.experience-scroller {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 6px;
  scroll-snap-type: x mandatory;
}
.experience-card {
  scroll-snap-align: start;
  flex: 0 0 82%;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}
.experience-quote {
  font-size: 0.92rem;
  color: var(--ink);
  line-height: 1.7;
  margin: 0 0 10px;
  font-style: italic;
}
.experience-quote::before { content: '“'; color: var(--gold); font-weight: 700; }
.experience-quote::after { content: '”'; color: var(--gold); font-weight: 700; }
.experience-name { font-family: var(--font-ui); font-weight: 600; color: var(--maroon); font-size: 0.86rem; margin: 0; }
.experience-place { font-size: 0.76rem; color: var(--ink-soft); margin: 2px 0 0; }

.donor-list { display: flex; flex-direction: column; gap: 8px; }
.donor-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 0.88rem;
}
.donor-name { font-weight: 600; color: var(--ink); }
.donor-place { color: var(--ink-soft); font-size: 0.78rem; }
.donor-amount { font-family: var(--font-ui); font-weight: 700; color: var(--gold); }

/* ============ Map ============ */
.map-wrap {
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
  height: 300px;
}
.map-wrap iframe { width: 100%; height: 100%; border: 0; }

/* ============ Footer / Contact ============ */
.contact-footer {
  background: var(--maroon-dark);
  color: #EAD9BC;
  padding: 34px 18px 20px;
}
.contact-grid {
  max-width: 760px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}
.contact-block h3 {
  font-family: var(--font-display);
  color: var(--gold-light);
  font-size: 1.05rem;
  margin: 0 0 12px;
}
.contact-block p { margin: 0 0 8px; font-size: 0.88rem; }
.contact-block a { text-decoration: none; }
.social-links { display: flex; gap: 10px; flex-wrap: wrap; }
.social-links a {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  display: flex; align-items: center; justify-content: center;
  border: 1px solid rgba(231,192,120,0.35);
  font-size: 0.7rem;
  font-family: var(--font-ui);
  font-weight: 600;
  color: var(--gold-light);
  overflow: hidden;
}
.social-links a img {
  width: 20px;
  height: 20px;
  object-fit: contain;
}
.copyright {
  max-width: 760px;
  margin: 26px auto 0;
  padding-top: 16px;
  border-top: 1px solid rgba(231,192,120,0.2);
  font-size: 0.74rem;
  color: #C8B393;
  text-align: center;
}

/* ============ Bottom nav ============ */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 95;
  background: #fff;
  border-top: 1px solid var(--line);
  display: flex;
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  box-shadow: 0 -4px 16px rgba(74,13,24,0.08);
}
.bottom-nav-link {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  text-decoration: none;
  color: var(--ink-soft);
  font-family: var(--font-ui);
  font-size: 0.62rem;
  padding: 6px 2px;
  border-radius: 10px;
}
.bottom-nav-link.active { color: var(--maroon); }
.bottom-nav-link.active svg { fill: var(--gold); }

/* ============ Responsive ============ */
@media (min-width: 640px) {
  :root { --header-h: 98px; }
  .hero { min-height: 440px; }
  .hero-title { font-size: 2.1rem; }
  .seva-grid { grid-template-columns: repeat(2, 1fr); }
  .contact-grid { grid-template-columns: 1.3fr 1fr; }
  .gallery-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (min-width: 900px) {
  .bottom-nav { display: none; }
  body { padding-bottom: 0; }
  .header-nav { justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; animation: none !important; }
}

:focus-visible {
  outline: 3px solid var(--turmeric);
  outline-offset: 2px;
}
