:root {
  /* White & red theme */
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #fff5f5;
  --ink: #5c0a0a;
  --ink-2: #9a3b3b;
  --line: #f6d4d4;
  --accent: #c8102e;
  --accent-ink: #ffffff;
  --accent-soft: #ffe4e6;
  --gold: #c8102e;
  --danger: #9f0d24;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(120, 10, 20, .06), 0 8px 24px rgba(120, 10, 20, .08);
  --serif: "Cormorant Garamond", Georgia, serif;
  --sans: "Mukta", system-ui, -apple-system, "Segoe UI", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.65 var(--sans);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; }
img { max-width: 100%; height: auto; }
a { color: var(--accent); }
h1, h2, h3 { font-family: var(--serif); line-height: 1.15; color: var(--ink); }
h1 { font-size: clamp(2.2rem, 5vw, 3.4rem); margin: 0 0 .3em; }
h2 { font-size: 1.9rem; margin: 1.2em 0 .4em; }
h3 { font-size: 1.4rem; margin: 1em 0 .3em; }
.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--ink-2); }
.small { font-size: .88rem; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand-mark {
  width: 38px; height: 38px; border-radius: 50%; flex: none;
  object-fit: cover; box-shadow: 0 0 0 2px var(--accent-soft);
}
.brand-name { font-family: var(--serif); font-weight: 700; font-size: 1.3rem; }
.nav { display: flex; gap: 4px; }
.nav a {
  text-decoration: none; color: var(--ink); padding: 8px 14px; border-radius: 999px; font-weight: 500;
}
.nav a:hover { background: var(--surface-2); }
.nav a.active { background: var(--accent-soft); color: var(--accent); }
.nav-toggle { display: none; background: none; border: 0; font-size: 1.5rem; color: var(--ink); cursor: pointer; padding: 6px 10px; }

@media (max-width: 720px) {
  .nav-toggle { display: block; }
  .nav { display: none; position: absolute; top: 64px; left: 0; right: 0; flex-direction: column; background: var(--bg); border-bottom: 1px solid var(--line); padding: 8px 16px 16px; }
  .site-header.open .nav { display: flex; }
  .brand-name { font-size: 1.1rem; }
}

/* Hero */
.hero {
  background:
    radial-gradient(1200px 400px at 85% -10%, #fecdd3 0%, transparent 60%),
    linear-gradient(180deg, var(--surface-2), var(--bg));
  border-bottom: 1px solid var(--line);
}
.hero-inner { display: grid; grid-template-columns: 1.3fr 1fr; gap: 40px; align-items: center; padding-top: 64px; padding-bottom: 64px; }
.hero-inner:has(.hero-photo[hidden]) { grid-template-columns: 1fr; text-align: center; }
.hero-inner:has(.hero-photo[hidden]) .hero-actions { justify-content: center; }
.eyebrow { text-transform: uppercase; letter-spacing: .15em; font-size: .8rem; color: var(--gold); font-weight: 600; margin: 0 0 8px; }
.lead { font-size: 1.2rem; color: var(--ink-2); margin: 0 0 24px; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.hero-photo img, .about-photo img { border-radius: var(--radius); box-shadow: var(--shadow); display: block; width: 100%; object-fit: cover; }
@media (max-width: 800px) {
  .hero-inner { grid-template-columns: 1fr; padding-top: 40px; padding-bottom: 40px; }
}

/* Home hero: logo, name and titles, then the Mahamandir photo */
.home-hero { text-align: center; }
.home-hero .wrap { padding-top: 36px; padding-bottom: 56px; display: flex; flex-direction: column; align-items: center; }
.home-logo { width: clamp(150px, 26vw, 220px); height: auto; margin-bottom: 12px; mix-blend-mode: multiply; }
.home-hero h1 { margin-bottom: .15em; }
.home-titles a { color: inherit; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
.home-titles a:hover { text-decoration-thickness: 2px; }
.home-titles { margin: 0 0 32px; display: flex; flex-direction: column; gap: 2px; font-size: clamp(1.15rem, 2.6vw, 1.45rem); font-weight: 600; color: var(--accent); letter-spacing: .03em; }
.home-temple { margin: 0; width: 100%; max-width: 1040px; }
.home-temple img { display: block; width: 100%; height: auto; border-radius: 18px; border: 4px solid #fff; box-shadow: 0 2px 4px rgba(120, 10, 20, .08), 0 18px 48px rgba(120, 10, 20, .18); }
.home-temple-caption { margin: 14px 0 28px; font-family: var(--serif); font-size: 1.35rem; font-weight: 600; color: var(--ink); }
.home-hero .hero-actions { justify-content: center; }
.home-video { width: 100%; max-width: 900px; aspect-ratio: 16 / 9; margin: 0 0 32px; border-radius: 16px; overflow: hidden; background: #000; box-shadow: 0 2px 4px rgba(120, 10, 20, .08), 0 18px 48px rgba(120, 10, 20, .18); }
.home-video iframe { display: block; width: 100%; height: 100%; border: 0; }

.page-head { padding: 48px 0 24px; text-align: center; }
.page-head .lead { margin-bottom: 0; }

/* Content */
.prose { max-width: 760px; margin: 0 auto; padding-top: 16px; padding-bottom: 16px; }
.prose img { border-radius: 10px; }
.prose blockquote { border-left: 3px solid var(--accent); margin: 1em 0; padding: .2em 1em; color: var(--ink-2); font-style: italic; }
.prose:empty { display: none; }
.about-layout { display: grid; grid-template-columns: 1fr; gap: 32px; padding-bottom: 48px; }
.about-layout:has(.about-photo:not([hidden])) { grid-template-columns: 340px 1fr; align-items: start; }
@media (max-width: 800px) { .about-layout:has(.about-photo:not([hidden])) { grid-template-columns: 1fr; } }
.about-layout .prose { margin: 0; max-width: none; padding-top: 0; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--accent); color: var(--accent-ink); border: 1px solid var(--accent);
  padding: 11px 22px; border-radius: 999px; font: 600 1rem var(--sans);
  text-decoration: none; cursor: pointer;
}
.btn:hover { filter: brightness(1.07); }
.btn:disabled { opacity: .6; cursor: wait; }
.btn-ghost { background: transparent; color: var(--accent); }
.btn-ghost:hover { background: var(--accent-soft); }
.btn-small { padding: 6px 14px; font-size: .9rem; }
.btn-block { width: 100%; }
.btn-danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.icon-btn { background: var(--surface); border: 1px solid var(--line); border-radius: 50%; width: 40px; height: 40px; cursor: pointer; font-size: 1.1rem; color: var(--ink); flex: none; }

/* Events grid */
.recent { padding-bottom: 56px; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; }
.event-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px; margin: 16px 0 56px; }
.event-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; text-decoration: none; color: inherit; box-shadow: var(--shadow);
  transition: transform .15s ease;
}
.event-card:hover { transform: translateY(-3px); }
.event-cover { position: relative; aspect-ratio: 4 / 3; background: var(--surface-2); display: grid; place-items: center; }
.event-cover img { width: 100%; height: 100%; object-fit: cover; }
.event-cover .count { position: absolute; right: 10px; bottom: 10px; background: rgba(200,16,46,.9); color: #fff; font-size: .8rem; padding: 2px 10px; border-radius: 999px; }
.no-photo { color: var(--ink-2); font-size: .9rem; }
.event-body { padding: 14px 16px 18px; }
.event-body h3 { margin: 6px 0 4px; font-size: 1.35rem; }
.event-body p { margin: 0; font-size: .92rem; }
.event-body .org { color: var(--gold); font-weight: 500; }
.tag { display: inline-block; font-size: .75rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--accent); background: var(--accent-soft); padding: 2px 10px; border-radius: 999px; }

/* Gallery tools */
.intro { text-align: center; padding-top: 0; }
.gallery-tools { display: flex; flex-direction: column; gap: 14px; margin: 16px 0 8px; }
.search input {
  width: 100%; padding: 14px 18px; font: inherit; border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
}
.search input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { font: 500 .95rem var(--sans); border: 1px solid var(--line); background: var(--surface); color: var(--ink); padding: 6px 16px; border-radius: 999px; cursor: pointer; }
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* Dialog + lightbox */
.event-dialog {
  width: min(1000px, calc(100vw - 24px)); max-height: calc(100vh - 24px);
  border: 0; border-radius: var(--radius); padding: 20px; background: var(--bg); color: var(--ink);
}
.event-dialog::backdrop { background: rgba(60, 0, 8, .6); }
.dialog-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.dialog-head h2 { margin: 0; }
.dialog-head p { margin: 4px 0 0; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; margin-top: 12px; }
.photo { padding: 0; border: 0; background: var(--surface-2); border-radius: 8px; overflow: hidden; aspect-ratio: 1; cursor: zoom-in; }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lightbox { position: fixed; inset: 0; z-index: 100; background: rgba(40, 0, 6, .94); display: flex; align-items: center; justify-content: center; }
.lightbox img { max-width: 94vw; max-height: 90vh; object-fit: contain; }
.lightbox .icon-btn { position: absolute; background: rgba(255,255,255,.15); color: #fff; border-color: transparent; }
.lb-close { top: 14px; right: 14px; }
.lb-prev { left: 10px; top: 50%; }
.lb-next { right: 10px; top: 50%; }

/* Footer */
.site-footer { border-top: 1px solid var(--line); background: var(--surface-2); padding: 20px 0; font-size: .9rem; color: var(--ink-2); }
.footer-inner { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.footer-inner nav { display: flex; gap: 16px; }
.footer-inner a { color: var(--ink-2); text-decoration: none; }

/* ------------------------------------------------ Admin */
.admin main { padding-top: 24px; padding-bottom: 64px; }
.auth-card { max-width: 440px; margin: 40px auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow); }
.auth-card h1 { font-size: 2rem; }
.form { display: flex; flex-direction: column; gap: 14px; }
.form.narrow { max-width: 420px; }
.form label, .field { display: flex; flex-direction: column; gap: 4px; font-weight: 500; font-size: .95rem; }
.label { font-weight: 500; font-size: .95rem; }
input, select, textarea {
  font: 400 1rem var(--sans); color: var(--ink);
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.span-2 { grid-column: span 2; }
@media (max-width: 640px) { .grid-2 { grid-template-columns: 1fr; } .span-2 { grid-column: auto; } }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.inline { flex-direction: row !important; align-items: center; gap: 8px !important; }
.inline select { width: auto; }
.divider { display: flex; align-items: center; gap: 10px; margin: 22px 0 14px; color: var(--ink-2); font-size: .88rem; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 200; max-width: calc(100vw - 32px); background: var(--accent); color: #fff; padding: 12px 20px; border-radius: 12px; box-shadow: var(--shadow); white-space: pre-line; }
.toast.error { background: var(--danger); outline: 3px solid #fff; }

.tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--line); margin-bottom: 20px; }
.tab { background: none; border: 0; border-bottom: 3px solid transparent; padding: 10px 14px; font: 600 .98rem var(--sans); color: var(--ink-2); cursor: pointer; white-space: nowrap; }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.panel h2 { margin-top: 0; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.panel-head h2 { margin: 0; }
.panel-head input { max-width: 320px; }

.editor { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.toolbar { display: flex; flex-wrap: wrap; gap: 2px; padding: 6px; background: var(--surface-2); border-bottom: 1px solid var(--line); position: sticky; top: 64px; z-index: 5; }
.toolbar button, .tb-file { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 4px 10px; font: 500 .9rem var(--sans); cursor: pointer; color: var(--ink); }
.toolbar button.active { background: var(--accent); color: #fff; }
.editor-area { min-height: 320px; padding: 16px; max-width: none; outline: none; }
.editor-html { border: 0; border-radius: 0; min-height: 320px; font: .9rem/1.5 ui-monospace, monospace; }
.hero-edit img { max-width: 260px; border-radius: 10px; display: block; margin-bottom: 8px; }
.file-btn { cursor: pointer; }

.dropzone {
  position: relative; border: 2px dashed var(--line); border-radius: var(--radius);
  padding: 28px 16px; text-align: center; background: var(--surface-2); cursor: pointer;
  display: flex; flex-direction: column; gap: 4px; align-items: center;
}
.dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 8px; margin-top: 10px; }
.thumbs.large { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
.thumb { position: relative; aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: var(--surface-2); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb-x, .thumb-star { position: absolute; top: 4px; width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(200,16,46,.85); color: #fff; cursor: pointer; font-size: .85rem; }
.thumb-x { right: 4px; }
.thumb-star { left: 4px; }
.thumb-star.on { background: #fff; color: var(--accent); }
.progress { position: relative; height: 26px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.progress div { height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.progress span { position: absolute; inset: 0; display: grid; place-items: center; font-size: .85rem; font-weight: 600; }

.ev-list { display: flex; flex-direction: column; gap: 8px; }
.ev-row { display: flex; align-items: center; gap: 12px; text-align: left; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 8px; cursor: pointer; font: inherit; color: inherit; }
.ev-row:hover { border-color: var(--accent); }
.ev-thumb { width: 64px; height: 64px; border-radius: 8px; overflow: hidden; background: var(--surface-2); flex: none; }
.ev-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ev-info { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.danger-zone { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--line); }
.cat-list { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.cat-list li { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.cat-list input { flex: 1; min-width: 160px; }
