/* puja.to v2 — one-pager styles. Two themes: holud (light yellow + red), lalpaar (white + red). */

:root,
[data-theme="holud"] {
  --bg: #FFF8E1;
  --bg-2: #FFF1C7;
  --surface: #FFFFFF;
  --ink: #2B1A12;
  --muted: #6B4E3D;
  --line: #F0D9A6;
  --red: #B3121B;
  --red-2: #D7263D;
  --gold: #E8A200;
  --on-red: #FFFFFF;
  --shadow: 0 1px 2px rgba(80, 30, 0, .06), 0 8px 24px rgba(120, 50, 0, .08);
}

[data-theme="lalpaar"] {
  --bg: #FFFFFF;
  --bg-2: #FFF3F2;
  --surface: #FFFFFF;
  --ink: #1F1414;
  --muted: #6A5555;
  --line: #F2D4D2;
  --red: #C1121F;
  --red-2: #E03140;
  --gold: #D99A00;
  --on-red: #FFFFFF;
  --shadow: 0 1px 2px rgba(60, 0, 0, .05), 0 8px 24px rgba(120, 0, 0, .07);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body {
  margin: 0;
  font: 400 16px/1.55 Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
  transition: background-color .3s, color .3s;
}
[lang="bn"] { font-family: "Noto Serif Bengali", serif; }
a { color: var(--red); }
a:hover { color: var(--red-2); }
img { max-width: 100%; display: block; }
h1, h2, h3 { line-height: 1.15; margin: 0 0 .5rem; }
h1, h2 { font-family: "Playfair Display", Georgia, serif; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
.skip { position: absolute; left: -999px; top: 8px; background: var(--red); color: var(--on-red); padding: 8px 12px; z-index: 1000; border-radius: 6px; }
.skip:focus { left: 8px; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

/* Lal paar border: the red band that runs under the top bar and above the footer. */
.topbar, .footer { border-color: var(--red); border-style: solid; border-width: 0; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 500;
  display: flex; align-items: center; gap: 1rem;
  padding: .7rem clamp(1rem, 4vw, 3rem);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom-width: 4px;
}
.brand { display: flex; align-items: baseline; gap: .5rem; text-decoration: none; color: var(--red); }
.brand-bn { font-size: 1.5rem; font-weight: 700; }
.brand-en { font: 800 1.35rem "Playfair Display", serif; }
.topnav { display: flex; gap: 1.25rem; margin-left: auto; }
.topnav a { color: var(--ink); text-decoration: none; font-weight: 500; }
.topnav a:hover { color: var(--red); }
.theme-toggle {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .45rem .8rem; border-radius: 999px; cursor: pointer;
  border: 2px solid var(--red); background: var(--surface); color: var(--ink);
  font: 600 .85rem Inter, sans-serif;
}
.theme-toggle .swatch {
  width: 18px; height: 18px; border-radius: 50%;
  background: linear-gradient(135deg, var(--bg-2) 50%, var(--red) 50%);
  border: 1px solid var(--line);
}
@media (max-width: 640px) { .topnav { display: none; } .theme-toggle { margin-left: auto; } }

/* Area selector: a styled native dropdown in the top bar. */
.area-select {
  position: relative; display: inline-flex; align-items: center; gap: .35rem;
  padding: .15rem .4rem .15rem .7rem; border-radius: 999px; background: var(--surface); border: 2px solid var(--red);
}
.area-pin { font-size: .95rem; }
.area-select select {
  appearance: none; border: 0; background: transparent; color: var(--ink); cursor: pointer;
  font: 700 .92rem Inter, sans-serif; padding: .35rem 1.6rem .35rem .1rem;
  background-image: linear-gradient(45deg, transparent 50%, var(--red) 50%), linear-gradient(135deg, var(--red) 50%, transparent 50%);
  background-position: right .7rem center, right .4rem center; background-size: 5px 5px; background-repeat: no-repeat;
}
.area-select select:focus-visible { outline: none; }
.area-select:focus-within { outline: 3px solid var(--gold); outline-offset: 2px; }
.area-note { background: var(--bg-2); border: 1px dashed var(--red); border-radius: 12px; padding: .6rem .9rem; margin: 0 0 1rem; font-size: .9rem; }
@media (max-width: 640px) {
  .area-select select { font-size: .85rem; }
  .topbar { flex-wrap: nowrap; gap: .5rem; }
  .brand-bn { font-size: 1.25rem; }
  .brand-en { font-size: 1.1rem; }
  .theme-toggle { margin-left: auto; padding: .45rem; }
  .theme-toggle .theme-name { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
}

/* ---------- Hero ---------- */
.hero {
  display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: clamp(1.5rem, 4vw, 3.5rem); align-items: center;
  padding: clamp(2rem, 5vw, 4.5rem) clamp(1rem, 4vw, 3rem) 2rem;
  max-width: 1280px; margin: 0 auto;
}
.kicker { color: var(--red); font-weight: 600; letter-spacing: .02em; margin: 0 0 .75rem; }
.hero h1 { font-size: clamp(2.2rem, 5vw, 3.8rem); font-weight: 800; }
.hero h1 em { color: var(--red); font-style: italic; }
.lede { font-size: 1.1rem; color: var(--muted); max-width: 34rem; }
.stats { list-style: none; display: flex; flex-wrap: wrap; gap: .6rem; padding: 0; margin: 1.25rem 0; }
.stats li {
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: .55rem .9rem; box-shadow: var(--shadow); font-size: .9rem; color: var(--muted);
}
.stats b { display: block; font-size: 1.35rem; color: var(--red); font-family: "Playfair Display", serif; }
.cta-row { display: flex; flex-wrap: wrap; gap: .75rem; }
.btn {
  display: inline-flex; align-items: center; padding: .75rem 1.25rem; border-radius: 999px;
  font-weight: 600; text-decoration: none; border: 2px solid var(--red); transition: transform .15s, background .15s;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--red); color: var(--on-red); }
.btn-primary:hover { background: var(--red-2); color: var(--on-red); }
.btn-ghost { background: transparent; color: var(--red); }

/* 3D photo carousel: a ring of slides rotated with CSS transforms (driven by carousel.js). */
.carousel { position: relative; --radius: 400px; }
.carousel-scene {
  position: relative; height: clamp(300px, 34vw, 420px); perspective: 1400px;
  /* Keep side slides inside the carousel column; large rings (the hub's 11 photos) would cover the hero text. */
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  /* Soft floor glow under the ring. */
  background: radial-gradient(60% 18% at 50% 92%, color-mix(in srgb, var(--red) 22%, transparent), transparent 70%);
}
.carousel-ring {
  position: relative; width: min(70%, 400px); aspect-ratio: 4 / 3;
  transform-style: preserve-3d; transition: transform 1s cubic-bezier(.22, .8, .24, 1);
  touch-action: pan-y; cursor: grab; user-select: none;
  animation: carousel-float 6s ease-in-out infinite;
}
.carousel-ring:active { cursor: grabbing; }
@keyframes carousel-float { 0%, 100% { translate: 0 0; } 50% { translate: 0 -8px; } }
.carousel-slide {
  position: absolute; inset: 0; margin: 0; border-radius: 18px; overflow: hidden;
  background: #1a0d0d; box-shadow: 0 18px 40px -18px rgba(80, 0, 0, .55);
  border: 3px solid var(--surface); transition: opacity .8s, filter .8s, box-shadow .8s;
  filter: saturate(.75) brightness(.8); backface-visibility: hidden;
}
.carousel-slide img { width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.carousel-slide.is-active {
  filter: none; border-color: var(--gold);
  box-shadow: 0 0 0 1px var(--gold), 0 24px 50px -16px rgba(120, 20, 0, .6);
}
.carousel:not(.is-ready) .carousel-scene { visibility: hidden; }
.carousel-controls { display: flex; align-items: center; gap: .75rem; margin-top: .75rem; }
.carousel-btn {
  flex: 0 0 auto; width: 42px; height: 42px; border-radius: 50%; cursor: pointer;
  border: 2px solid var(--red); background: var(--surface); color: var(--red);
  font: 700 1.4rem/1 Inter, sans-serif; display: grid; place-items: center;
}
.carousel-btn:hover { background: var(--red); color: var(--on-red); }
.carousel-caption { flex: 1; margin: 0; text-align: center; font-size: .88rem; color: var(--muted); min-height: 2.6em; }
.carousel-credit { font-size: .78rem; white-space: nowrap; }
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; }
  .carousel-scene { height: 280px; }
  .carousel-ring { width: min(72%, 300px); }
}
@media (prefers-reduced-motion: reduce) {
  .carousel-ring { animation: none; }
}

/* ---------- Tithis ---------- */
.tithis { max-width: 1280px; margin: 0 auto; padding: 0 clamp(1rem, 4vw, 3rem); }
.tithi-strip {
  list-style: none; margin: 0; padding: .9rem; display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: .5rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow);
}
.tithi-strip li { text-align: center; padding: .4rem; border-radius: 10px; }
.tithi-strip .bn { font: 700 1.1rem "Noto Serif Bengali", serif; color: var(--red); }
.tithi-strip .date { font-weight: 600; }
.tithi-strip .name { font-size: .75rem; color: var(--muted); }
.tithi-strip li.is-today { background: var(--bg-2); outline: 2px solid var(--red); }

/* ---------- Tabs ---------- */
.pujas { max-width: 1280px; margin: 0 auto; padding: 3rem clamp(1rem, 4vw, 3rem); }
.section-head { margin-bottom: 1.25rem; }
.eyebrow { margin: 0; color: var(--red); font-weight: 700; }
.section-head h2 { font-size: clamp(1.8rem, 3.5vw, 2.6rem); }
.tabs {
  display: flex; gap: .4rem; overflow-x: auto; padding-bottom: .25rem; margin-bottom: 1rem;
  scrollbar-width: thin;
}
.tab {
  flex: 0 0 auto; padding: .6rem 1rem; border-radius: 999px; cursor: pointer;
  border: 2px solid var(--line); background: var(--surface); color: var(--ink);
  font: 600 .92rem Inter, sans-serif;
}
.tab .count {
  display: inline-block; min-width: 1.5em; margin-left: .35rem; padding: 0 .4em; border-radius: 999px;
  background: var(--bg-2); color: var(--red); font-size: .8rem;
}
.tab[aria-selected="true"] { background: var(--red); border-color: var(--red); color: var(--on-red); }
.tab[aria-selected="true"] .count { background: rgba(255, 255, 255, .22); color: var(--on-red); }

/* ---------- Map + cards ---------- */
.browse { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 1.25rem; align-items: start; }
.map-wrap { position: sticky; top: 84px; }
#map {
  height: min(70vh, 620px); border-radius: 16px; border: 1px solid var(--line);
  box-shadow: var(--shadow); background: var(--bg-2); z-index: 1;
}
.legend { list-style: none; display: flex; flex-wrap: wrap; gap: .4rem .9rem; padding: .6rem .2rem 0; margin: 0; font-size: .82rem; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: .35rem; vertical-align: middle; }
@media (max-width: 900px) {
  .browse { grid-template-columns: 1fr; }
  .map-wrap { position: static; }
  #map { height: 360px; }
}

.cards { display: grid; gap: .9rem; outline: none; }
.empty { padding: 2rem; text-align: center; color: var(--muted); background: var(--surface); border: 1px dashed var(--line); border-radius: 16px; }
.card {
  position: relative; background: var(--surface); border: 1px solid var(--line); border-left: 5px solid var(--region, var(--red));
  border-radius: 16px; padding: 1rem 1.1rem; box-shadow: var(--shadow); scroll-margin-top: 90px;
  transition: box-shadow .2s, transform .2s;
}
.card.is-active { box-shadow: 0 0 0 3px var(--gold), var(--shadow); }
.card-top { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; font-size: .8rem; color: var(--muted); }
.region-chip { font-weight: 700; color: var(--region); }
.card h3 { font-size: 1.12rem; margin: .3rem 0 .15rem; }
.card h3 button { all: unset; cursor: pointer; }
.card h3 button:hover { color: var(--red); }
.aka { font-size: .8rem; color: var(--muted); margin: 0 0 .3rem; }
.when { font-weight: 600; color: var(--red); margin: .1rem 0; }
.where { margin: 0 0 .5rem; color: var(--muted); font-size: .92rem; }
.badges { display: flex; flex-wrap: wrap; gap: .35rem; margin: .4rem 0; padding: 0; list-style: none; }
.badge { font-size: .74rem; font-weight: 600; padding: .18rem .55rem; border-radius: 999px; background: var(--bg-2); color: var(--ink); border: 1px solid var(--line); }
.badge.ok { background: #E8F5EC; color: #146C2E; border-color: #BFE3CA; }
.badge.warn { background: #FFF4DB; color: #7A4B00; border-color: #F3D9A0; }
.badge.red { background: var(--red); color: var(--on-red); border-color: var(--red); }
.featured-ribbon { position: absolute; top: -9px; right: 14px; background: var(--gold); color: #2B1A12; font-size: .7rem; font-weight: 700; padding: .15rem .6rem; border-radius: 999px; }
.highlights { margin: .35rem 0; padding-left: 1.1rem; font-size: .9rem; }
.notice { font-size: .84rem; background: var(--bg-2); border-radius: 10px; padding: .45rem .65rem; margin: .4rem 0; color: var(--ink); }
.actions { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .6rem; }
.actions a {
  font-size: .82rem; font-weight: 600; text-decoration: none; padding: .38rem .7rem; border-radius: 999px;
  border: 1.5px solid var(--red); color: var(--red); background: transparent;
}
.actions a.primary { background: var(--red); color: var(--on-red); }
.actions a:hover { background: var(--red-2); border-color: var(--red-2); color: var(--on-red); }
details.more { margin-top: .5rem; font-size: .9rem; }
details.more summary { cursor: pointer; font-weight: 600; color: var(--red); }
details.more table { width: 100%; border-collapse: collapse; margin-top: .4rem; font-size: .85rem; }
details.more td { padding: .3rem .4rem; border-top: 1px solid var(--line); vertical-align: top; }
details.more td:first-child { white-space: nowrap; color: var(--muted); width: 1%; }

/* Leaflet popups */
.leaflet-popup-content-wrapper { border-radius: 12px; }
.leaflet-popup-content { margin: 12px 14px; font: 14px/1.4 Inter, sans-serif; }
.popup-name { font-weight: 700; display: block; margin-bottom: 2px; }
.popup-link { font-weight: 600; }

/* ---------- Invitation-only ---------- */
.invites { margin-top: 2rem; padding: 1.1rem 1.25rem; border: 1px dashed var(--red); border-radius: 16px; background: var(--surface); }
.invites ul { margin: .5rem 0 0; padding-left: 1.1rem; columns: 2 240px; }
.invites li { margin-bottom: .3rem; }

/* ---------- Footer ---------- */
.footer { border-top-width: 6px; background: var(--bg-2); padding: 2rem clamp(1rem, 4vw, 3rem); }
.footer-grid { max-width: 1280px; margin: 0 auto; display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 1.5rem; }
.footer h3 { font-size: .95rem; text-transform: uppercase; letter-spacing: .06em; color: var(--red); }
.brand-foot { font: 800 1.3rem "Playfair Display", serif; color: var(--red); margin: 0 0 .4rem; }
.credits { list-style: none; padding: 0; margin: 0; font-size: .86rem; }
.credits li { margin-bottom: .45rem; }
.legal { max-width: 1280px; margin: 1.5rem auto 0; padding-top: 1rem; border-top: 1px solid var(--line); color: var(--muted); }
.legal b { color: var(--red); }
@media (max-width: 800px) { .footer-grid { grid-template-columns: 1fr; } }

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

/* No permitted photos: let the hero copy take the full width. */
.hero:has(.carousel[hidden]) { grid-template-columns: 1fr; }

/* ---------- Per-puja link + share panel ---------- */
.permalink { font-size: .8rem; text-decoration: none; margin-left: .35rem; opacity: .55; vertical-align: middle; }
.permalink:hover, .permalink:focus-visible { opacity: 1; }
.actions .share-btn, .actions .map-btn {
  font: 600 .82rem Inter, sans-serif; padding: .38rem .7rem; border-radius: 999px; cursor: pointer;
  border: 1.5px dashed var(--red); color: var(--red); background: var(--surface);
}
.actions .share-btn:hover, .actions .map-btn:hover { background: var(--red); color: var(--on-red); border-style: solid; }
.share-dialog {
  width: min(94vw, 460px); max-height: 94vh; overflow: auto; padding: 1rem 1.25rem 1.25rem;
  border: 0; border-top: 6px solid var(--red); border-radius: 16px; background: var(--surface); color: var(--ink);
  box-shadow: 0 30px 80px -20px rgba(60, 0, 0, .5);
}
.share-dialog::backdrop { background: rgba(30, 10, 10, .55); backdrop-filter: blur(2px); }
.share-close-row { display: flex; justify-content: flex-end; margin: -.25rem -.5rem 0 0; }
.share-close { border: 0; background: none; font-size: 1.6rem; line-height: 1; cursor: pointer; color: var(--muted); }
.share-dialog h3 { font: 800 1.35rem "Playfair Display", serif; margin: 0 0 .2rem; }
.share-sub { margin: 0 0 .8rem; color: var(--muted); font-size: .9rem; }
.share-link { display: flex; gap: .4rem; margin-bottom: .8rem; }
.share-link input {
  flex: 1; min-width: 0; font: 500 .85rem Inter, sans-serif; padding: .5rem .6rem;
  border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--ink);
}
.share-link button {
  flex: 0 0 auto; font: 600 .85rem Inter, sans-serif; padding: .5rem .8rem; border-radius: 10px; cursor: pointer;
  border: 0; background: var(--red); color: var(--on-red);
}
#share-preview { display: block; width: 100%; height: auto; border-radius: 12px; border: 1px solid var(--line); }
.share-actions { display: flex; gap: .6rem; margin-top: .9rem; flex-wrap: wrap; }
.share-actions .btn { padding: .6rem 1rem; font-size: .9rem; cursor: pointer; }
.share-status { min-height: 1.2em; margin: .5rem 0 0; font-size: .85rem; color: var(--muted); }

/* Make the hidden attribute win over component display rules (e.g. .stats is flex). */
[hidden] { display: none !important; }

/* ---------- Server-built pages: breadcrumbs, hub, puja page ---------- */
.crumbs { max-width: 1280px; margin: 0 auto; padding: 1rem clamp(1rem, 4vw, 3rem) 0; font-size: .85rem; }
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: .35rem; margin: 0; padding: 0; color: var(--muted); }
.crumbs li + li::before { content: "›"; margin-right: .35rem; }
.crumbs a { text-decoration: none; }
.tithis-h { font-size: 1.1rem; margin: 0 0 .5rem; }
.card h3 a { color: inherit; text-decoration: none; }
.card h3 a:hover { color: var(--red); text-decoration: underline; }
.actions .map-btn { border-style: solid; }
.panel-h { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.panels { min-width: 0; }

.city-cards { list-style: none; padding: 0; margin: 1.25rem 0 0; display: grid; gap: .7rem; }
.city-card a {
  display: grid; gap: .1rem; padding: .9rem 1.1rem; text-decoration: none; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-left: 5px solid var(--red);
  border-radius: 14px; box-shadow: var(--shadow); transition: transform .15s;
}
.city-card a:hover { transform: translateY(-2px); }
.city-name { font: 800 1.25rem "Playfair Display", serif; color: var(--red); }
.city-facts { color: var(--muted); font-size: .9rem; }
.city-go { font-weight: 600; font-size: .88rem; color: var(--red); }
.all-index .city-index { margin-bottom: 1.75rem; }
.city-index h3 { font-size: 1.35rem; }
.city-index h4 { margin: .8rem 0 .3rem; color: var(--red); font-size: .95rem; }
.puja-index { margin: 0; padding-left: 1.1rem; columns: 2 320px; font-size: .92rem; }
.puja-index li { margin-bottom: .3rem; break-inside: avoid; }

.puja-page { max-width: 1280px; margin: 0 auto; padding: 1.5rem clamp(1rem, 4vw, 3rem) 1rem; }
.puja-head { border-left: 6px solid var(--region, var(--red)); padding-left: 1rem; }
.puja-head h1 { font-size: clamp(2rem, 4.5vw, 3.2rem); font-weight: 800; }
.when.big { font-size: 1.25rem; }
.where.big { font-size: 1.05rem; color: var(--ink); }
.puja-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.5rem; margin-top: 1.5rem; align-items: start; }
.puja-details { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 1rem 1.2rem; box-shadow: var(--shadow); }
.puja-details h2 { font-size: 1.4rem; }
.puja-details table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.puja-details td { padding: .35rem .4rem; border-top: 1px solid var(--line); vertical-align: top; }
.puja-details td:first-child { white-space: nowrap; color: var(--muted); width: 1%; }
.puja-map #map { height: min(60vh, 460px); }
.more-pujas { max-width: 1280px; margin: 0 auto; padding: 1.5rem clamp(1rem, 4vw, 3rem) 3rem; }
.more-pujas h2 { font-size: 1.5rem; }
@media (max-width: 900px) { .puja-body { grid-template-columns: 1fr; } }
.city-links { max-width: 1280px; margin: 0 auto 1.25rem; font-size: .9rem; font-weight: 600; }

/* ---------- Written intros, season note, preview badge ---------- */
.about { max-width: 1280px; margin: 0 auto; padding: 2.5rem clamp(1rem, 4vw, 3rem) 0; }
.about h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); }
.about p { max-width: 72ch; color: var(--ink); }
.puja-intro { max-width: 72ch; margin: .6rem 0; }
.season-note {
  max-width: 1280px; margin: 1rem auto 0; padding: .8rem 1.1rem; border-radius: 12px;
  background: var(--red); color: var(--on-red); font-weight: 600;
}
.preview-badge {
  position: fixed; bottom: 12px; left: 12px; z-index: 1000; padding: .35rem .7rem; border-radius: 999px;
  background: #1f1414; color: #fff; font: 600 .75rem Inter, sans-serif; opacity: .85; pointer-events: none;
}
.no-ads { margin-top: .6rem; }
.no-ads b { color: var(--red); }
