@font-face { font-family: 'Tiro'; src: url(/fonts/TiroDevanagariHindi.ttf) format('truetype'); font-display: swap; }
@font-face { font-family: 'Noto'; src: url(/fonts/NotoSansDevanagari.ttf) format('truetype'); font-weight: 100 900; font-display: swap; }

:root {
  /* Taken from the sanctum: the painted sky behind the idol, gold leaf, marble, the
     kesar-red of the receipt, and the jade of the carved leaves. */
  --marble: #f6f7fa;
  --marble-2: #eceff5;
  --lapis: #22427a;
  --lapis-deep: #172d55;
  --sky: #c9daee;
  --gold: #b08a35;
  --gold-soft: #e4cf98;
  --kesar: #9c2a1e;
  --jade: #4f7e5d;
  --ink: #1a2035;
  --muted: #5a6280;
  --line: #d7dce8;
  --display: 'Tiro', 'Noto', serif;
  --body: 'Noto', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --gutter: clamp(16px, 4vw, 48px);
  --measure: 68ch;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body { margin: 0; background: var(--marble); color: var(--ink); font: 17px/1.7 var(--body); -webkit-font-smoothing: antialiased; }
img { max-width: 100%; display: block; }
a { color: var(--lapis); }
h1, h2, h3 { font-family: var(--display); font-weight: 400; line-height: 1.2; margin: 0; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; border-radius: 4px; }
[hidden] { display: none !important; }

.mantra {
  background: var(--lapis-deep); color: var(--gold-soft); font-family: var(--display);
  text-align: center; font-size: 15px; padding: 6px var(--gutter); letter-spacing: .02em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ---------- Nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 10px var(--gutter); background: rgba(246, 247, 250, .94); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-family: var(--display); font-size: 19px; }
.brand img { width: 38px; height: 38px; object-fit: cover; border-radius: 50% 50% 6px 6px; border: 1.5px solid var(--gold); }
.nav nav { display: flex; gap: 4px; align-items: center; }
.nav nav a { text-decoration: none; color: var(--ink); padding: 6px 12px; border-radius: 999px; font-size: 15.5px; }
.nav nav a:hover { background: var(--marble-2); }
.nav nav a.nav-cta { background: var(--lapis); color: #fff; }
.nav nav a.nav-cta:hover { background: var(--lapis-deep); }
.menu-btn { display: none; font: inherit; background: none; border: 1.5px solid var(--line); border-radius: 8px; padding: 4px 12px; color: var(--ink); }

/* ---------- Torana: the arched frame used for the idol and the live video ---------- */
.torana {
  position: relative; margin: 0; overflow: hidden; background: var(--sky);
  border-radius: 50% 50% 14px 14px / 34% 34% 14px 14px;
  box-shadow: 0 0 0 1.5px var(--gold), 0 0 0 8px var(--marble), 0 0 0 9.5px var(--gold-soft);
}

/* ---------- Hero ---------- */
.hero {
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: clamp(28px, 6vw, 88px);
  align-items: center; padding: clamp(32px, 6vw, 72px) var(--gutter) clamp(48px, 7vw, 96px); max-width: 1280px; margin: 0 auto;
}
.hero-img { aspect-ratio: 4 / 5; max-width: 500px; width: 100%; justify-self: center; }
.hero-img img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; }
.invocation { color: var(--kesar); font-family: var(--display); font-size: 18px; margin: 0 0 14px; }
.hero h1 { font-size: clamp(42px, 6.4vw, 84px); line-height: 1.12; color: var(--lapis-deep); }
.en-name { font-family: var(--display); font-size: clamp(18px, 2vw, 23px); color: var(--muted); margin: 14px 0 6px; }
.address { margin: 0; color: var(--ink); }
.now-card {
  display: grid; grid-template-columns: auto 1fr; column-gap: 14px; margin-top: 28px; padding: 14px 18px;
  border-left: 3px solid var(--gold); background: #fff; max-width: 440px;
}
.now-label { grid-column: 1 / -1; font-size: 14px; color: var(--muted); }
.now-title { font-family: var(--display); font-weight: 400; font-size: 22px; color: var(--lapis-deep); }
.now-time { align-self: end; justify-self: end; font-variant-numeric: tabular-nums; color: var(--kesar); font-weight: 600; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 10px 22px;
  border-radius: 999px; font: 600 16px/1.2 var(--body); text-decoration: none; cursor: pointer; border: 1.5px solid transparent;
}
.btn-primary { background: var(--lapis); color: #fff; }
.btn-primary:hover { background: var(--lapis-deep); }
.btn-primary:disabled { opacity: .6; cursor: progress; }
.btn-ghost { border-color: var(--lapis); color: var(--lapis); background: transparent; }
.btn-ghost:hover { background: #fff; }

/* ---------- Sections ---------- */
.section { padding: clamp(56px, 8vw, 104px) var(--gutter); max-width: 1280px; margin: 0 auto; }
.section-head { margin-bottom: 36px; max-width: var(--measure); }
.section-head h2, .section h2 { font-size: clamp(30px, 3.8vw, 46px); color: var(--lapis-deep); }
.section-head p { margin: 6px 0 0; color: var(--muted); }

/* Darshan */
.darshan { border-top: 1px solid var(--line); }
.darshan-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); gap: clamp(24px, 4vw, 56px); align-items: start; }
.video-frame { aspect-ratio: 16 / 11; border-radius: 50% 50% 14px 14px / 22% 22% 14px 14px; background: var(--lapis-deep); }
.video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video-empty { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; gap: 8px; padding: 18% 12% 8%; color: var(--sky); }
.video-empty strong { font-family: var(--display); font-weight: 400; font-size: clamp(22px, 2.6vw, 30px); color: #fff; }
.recordings h3 { font-size: 24px; color: var(--lapis-deep); margin-bottom: 12px; }
.rec-list { list-style: none; margin: 0; padding: 0; }
.rec-list li { display: grid; grid-template-columns: 96px 1fr; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); align-items: center; }
.rec-thumb { aspect-ratio: 16/9; background: var(--sky) center/cover; border-radius: 6px; border: 0; padding: 0; cursor: pointer; }
.rec-thumb:disabled { cursor: default; }
.rec-date { font-weight: 600; font-variant-numeric: tabular-nums; }
.rec-title { font-size: 14.5px; color: var(--muted); line-height: 1.45; }
.rec-actions { display: flex; gap: 14px; font-size: 14.5px; margin-top: 2px; }
.rec-actions button { font: inherit; background: none; border: 0; padding: 0; color: var(--lapis); text-decoration: underline; cursor: pointer; }
.rec-pending { color: var(--muted); font-size: 14px; }

/* Timings – a real sequence through the day, so it is drawn as one. */
.season-tabs { display: inline-flex; border: 1.5px solid var(--lapis); border-radius: 999px; overflow: hidden; margin-bottom: 10px; }
.season-tabs button { font: 600 15.5px var(--body); padding: 8px 18px; border: 0; background: transparent; color: var(--lapis); cursor: pointer; }
.season-tabs button small { font-weight: 400; opacity: .75; }
.season-tabs button[aria-pressed="true"] { background: var(--lapis); color: #fff; }
.season-tabs .now-dot { font-size: 12px; background: var(--gold); color: #fff; border-radius: 999px; padding: 1px 7px; margin-left: 4px; }
.season-note { margin: 0 0 22px; color: var(--muted); font-size: 15px; }
.timings { border-top: 1px solid var(--line); }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); border-top: 2px solid var(--lapis); }
.timeline li { position: relative; padding: 22px 16px 8px 0; }
.timeline li::before { content: ''; position: absolute; top: -7px; left: 0; width: 12px; height: 12px; border-radius: 50%; background: var(--marble); border: 2px solid var(--lapis); }
.timeline li.is-next::before { background: var(--gold); border-color: var(--gold); box-shadow: 0 0 0 5px rgba(176, 138, 53, .2); }
.timeline time { display: block; font-family: var(--display); font-size: 24px; color: var(--lapis-deep); font-variant-numeric: tabular-nums; }
.timeline .t-hi { display: block; font-weight: 600; }
.timeline .t-en { display: block; font-size: 14px; color: var(--muted); }

/* About */
.about { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: clamp(28px, 6vw, 88px); border-top: 1px solid var(--line); }
.about-text h2 { margin-bottom: 20px; }
.about-hi { font-family: var(--display); font-size: 21px; line-height: 1.8; max-width: var(--measure); margin: 0 0 16px; }
.about-en { color: var(--muted); max-width: var(--measure); margin: 0; }
.facts { margin: 0; align-self: start; border-top: 1px solid var(--gold); }
.facts div { display: grid; grid-template-columns: 110px 1fr; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; }

/* Office bearers: one timeline per post, newest tenure first */
.committee { border-top: 1px solid var(--line); }
.committee-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 28px 40px; }
.post h3 { font-size: 24px; color: var(--kesar); margin-bottom: 10px; }
.post h3 small { font-family: var(--body); font-size: 14px; color: var(--muted); }
.tenures { list-style: none; margin: 0; padding: 0 0 0 16px; border-left: 2px solid var(--line); }
.tenures li { position: relative; padding: 0 0 14px; }
.tenures li::before { content: ''; position: absolute; left: -22px; top: 8px; width: 10px; height: 10px; border-radius: 50%; background: var(--marble); border: 2px solid var(--muted); }
.tenures li.current::before { background: var(--gold); border-color: var(--gold); }
.tenures .years { display: block; font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.tenures li.current .years { color: var(--kesar); font-weight: 600; }
.tenures .name { display: block; font-family: var(--display); font-size: 21px; color: var(--ink); }
.tenures .name-en { display: block; color: var(--muted); font-size: 14px; }

/* Gallery */
.gallery { border-top: 1px solid var(--line); }
.gal-day { margin-bottom: 32px; }
.gal-day h3 { font-family: var(--body); font-weight: 600; font-size: 16px; color: var(--muted); margin-bottom: 12px; }
.gal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.gal-grid figure { margin: 0; }
.gal-grid img { aspect-ratio: 1; object-fit: cover; width: 100%; border-radius: 8px; }
.gal-grid figcaption { font-size: 14px; color: var(--muted); margin-top: 4px; }
.empty-note { color: var(--muted); }

/* Donor – a separate view: hidden on the home page, shown alone when opened from the menu. */
#my-donations { display: none; }
body.donor-view main > section { display: none; }
body.donor-view #my-donations { display: grid; min-height: calc(100vh - 220px); align-content: start; border-top: 0; }
.back-link { display: inline-block; margin-bottom: 18px; font-size: 15.5px; }
.back-link::before { content: '‹ '; }
.donor { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: clamp(28px, 6vw, 88px); border-top: 1px solid var(--line); }
.donor-intro p { max-width: 46ch; }
.donor-intro .en { color: var(--muted); font-size: 15.5px; }
.donor-panel { background: #fff; border: 1px solid var(--line); border-top: 3px solid var(--gold); padding: clamp(20px, 3vw, 36px); border-radius: 4px 4px 12px 12px; min-width: 0; }
.otp-form { display: grid; gap: 12px; max-width: 380px; }
.otp-form label { font-weight: 600; }
.field-row { display: flex; border: 1.5px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; }
.field-row:focus-within { border-color: var(--lapis); }
.prefix { padding: 12px 12px; background: var(--marble-2); color: var(--muted); }
.otp-form input { font: 600 20px var(--body); letter-spacing: .08em; padding: 10px 12px; border: 0; width: 100%; min-width: 0; background: transparent; color: var(--ink); }
#code { border: 1.5px solid var(--line); border-radius: 10px; letter-spacing: .4em; }
.otp-form input:focus { outline: none; }
#code:focus { border-color: var(--lapis); }
.form-msg { margin: 0; color: var(--kesar); min-height: 1.5em; font-size: 15px; }
.demo-otp { margin: 0; padding: 8px 12px; background: #fff7e3; border: 1px dashed var(--gold); border-radius: 8px; font-size: 15px; }
.link-btn { background: none; border: 0; color: var(--lapis); text-decoration: underline; font: inherit; justify-self: start; cursor: pointer; padding: 0; }

.st-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 18px; }
.st-filter { display: grid; gap: 10px; }
.st-periods { display: flex; flex-wrap: wrap; gap: 6px; }
.st-periods button { font: 600 14px var(--body); padding: 5px 12px; border-radius: 999px; border: 1.5px solid var(--line); background: #fff; color: var(--ink); cursor: pointer; }
.st-periods button[aria-pressed="true"] { background: var(--lapis); border-color: var(--lapis); color: #fff; }
.st-dates { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; }
.st-dates label { display: grid; gap: 2px; font-size: 13px; color: var(--muted); }
.st-dates input { font: 15px var(--body); padding: 6px 8px; border: 1.5px solid var(--line); border-radius: 8px; color: var(--ink); }
.st-show { min-height: 38px; padding: 6px 16px; }
.st-period { font-size: 14px; color: var(--muted); }
.st-alldue { margin: 0 0 6px; color: var(--kesar); font-size: 15px; }
.st-family + .st-family { margin-top: 32px; padding-top: 24px; border-top: 1px solid var(--line); }
.st-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.st-head h3 { font-size: 26px; color: var(--lapis-deep); }
.st-totals { display: grid; grid-template-columns: repeat(3, 1fr); margin: 18px 0 8px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.st-totals div { padding: 12px 10px 10px 0; }
.st-totals span { display: block; font-size: 14px; color: var(--muted); }
.st-totals b { font-family: var(--display); font-weight: 400; font-size: clamp(20px, 2.4vw, 26px); font-variant-numeric: tabular-nums; }
.st-totals .due b { color: var(--kesar); }
.st-section { margin-top: 24px; }
.st-section h4 { margin: 0 0 8px; font-size: 16px; }
.table-wrap { overflow-x: auto; }
.st-table { width: 100%; border-collapse: collapse; font-size: 15px; }
.st-table th, .st-table td { text-align: left; padding: 9px 8px 9px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.st-table th { font-size: 13.5px; color: var(--muted); font-weight: 600; }
.st-table .r { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pill { display: inline-block; font-size: 12.5px; padding: 1px 9px; border-radius: 999px; font-weight: 600; }
.pill.paid { background: #e3efe6; color: var(--jade); }
.pill.due { background: #f8e4e1; color: var(--kesar); }
.pill.partial { background: #fbf1da; color: #8a6514; }

/* Footer */
.footer {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px; padding: 32px var(--gutter);
  background: var(--lapis-deep); color: var(--sky);
}
.footer strong { font-family: var(--display); font-weight: 400; font-size: 21px; color: #fff; }
.footer p { margin: 4px 0 0; }
.footer-links { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.footer a { color: var(--gold-soft); }

/* Player */
.player { width: min(960px, 94vw); padding: 0; border: 0; border-radius: 12px; background: #000; }
.player::backdrop { background: rgba(10, 16, 32, .8); }
.player-frame { aspect-ratio: 16 / 9; }
.player-frame iframe { width: 100%; height: 100%; border: 0; display: block; }
.player .close { position: absolute; top: 6px; right: 8px; z-index: 2; background: rgba(0,0,0,.6); color: #fff; border: 0; width: 36px; height: 36px; border-radius: 50%; font-size: 22px; cursor: pointer; }

/* Single orchestrated moment: the idol's arch draws open on load. */
@media (prefers-reduced-motion: no-preference) {
  .hero-img { animation: unveil 1.2s cubic-bezier(.2, .7, .2, 1) both; }
  .hero-img img { animation: settle 1.6s cubic-bezier(.2, .7, .2, 1) both; }
  @keyframes unveil { from { clip-path: inset(100% 0 0 0 round 50% 50% 0 0); } to { clip-path: inset(0 0 0 0 round 0); } }
  @keyframes settle { from { transform: scale(1.08); } to { transform: none; } }
}

@media (max-width: 900px) {
  .hero, .darshan-grid, .about, .donor { grid-template-columns: 1fr; }
  .hero-img { max-width: 360px; }
  .hero-text { text-align: center; }
  .now-card { margin-left: auto; margin-right: auto; text-align: left; }
  .hero-actions { justify-content: center; }
  .menu-btn { display: block; }
  .nav nav { display: none; position: absolute; top: 100%; left: 0; right: 0; flex-direction: column; align-items: stretch; background: var(--marble); padding: 8px var(--gutter) 16px; border-bottom: 1px solid var(--line); }
  .nav nav.open { display: flex; }
  .nav nav a { padding: 12px; border-radius: 8px; }
}
@media (max-width: 760px) {
  /* Timings become a vertical line so the day reads top to bottom. */
  .timeline { grid-template-columns: 1fr; border-top: 0; border-left: 2px solid var(--lapis); margin-left: 6px; }
  .timeline li { padding: 4px 0 18px 22px; }
  .timeline li::before { top: 10px; left: -7px; }
}
@media (max-width: 520px) {
  body { font-size: 16px; }
  .mantra { font-size: 13px; }
  .brand span { font-size: 17px; }
  .st-totals { grid-template-columns: 1fr 1fr; }
  .st-table .hide-sm { display: none; }
  .rec-list li { grid-template-columns: 84px 1fr; }
}

.footer .powered { flex-basis: 100%; margin: 8px 0 0; padding-top: 14px; border-top: 1px solid rgba(201, 218, 238, .2); font-size: 13px; color: var(--sky); opacity: .75; text-align: center; }

/* Photo gallery: its own page, like the donor lookup */
#photos { display: none; }
body.photos-view main > section { display: none; }
body.photos-view #photos { display: block; min-height: calc(100vh - 220px); border-top: 0; }
.gal-open { display: block; width: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; }
.gal-open:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.gal-day h3 small { font-weight: 400; color: var(--muted); }
#all-photos, #more-photos { margin-top: 20px; }

/* Full-size photo with download */
.viewer { width: min(1100px, 96vw); max-height: 94vh; padding: 0; border: 0; border-radius: 12px; background: #0e1424; color: #fff; }
.viewer::backdrop { background: rgba(10, 16, 32, .88); }
.viewer img { display: block; max-width: 100%; max-height: calc(94vh - 64px); margin: 0 auto; object-fit: contain; }
.viewer-bar { display: flex; align-items: center; gap: 10px; padding: 10px 12px; }
.viewer-bar #viewer-caption { flex: 1; font-size: 15px; color: #dfe6f3; }
.viewer-nav, .viewer-close { background: rgba(255, 255, 255, .12); color: #fff; border: 0; width: 40px; height: 40px; border-radius: 50%; font-size: 24px; cursor: pointer; }
.viewer-bar .btn { min-height: 40px; padding: 6px 16px; }
