/* ═══════════════════════════════════════════════
   DESIGN TOKENS
═══════════════════════════════════════════════ */
:root {
    --bg: #f6f0e4;
    --bg-soft: #fff8ee;
    --surface: rgba(255, 251, 244, 0.92);
    --surface-strong: #fffdf8;
    --text: #26170f;
    --muted: #705b4a;
    --brand: #8f291f;
    --brand-dark: #5f160f;
    --accent: #d6a236;
    --accent-light: rgba(214, 162, 54, 0.15);
    --border: rgba(72, 42, 20, 0.12);
    --shadow-sm: 0 4px 16px rgba(65, 32, 15, 0.08);
    --shadow: 0 20px 60px rgba(65, 32, 15, 0.12);
    --shadow-lg: 0 32px 80px rgba(65, 32, 15, 0.18);
    --radius: 24px;
    --radius-sm: 16px;
    --radius-xs: 10px;
    --transition: 200ms ease;
    --nav-h: 64px;
}

/* ═══════════════════════════════════════════════
   CROSS-PLATFORM BASE RESETS
═══════════════════════════════════════════════ */
*, *::before, *::after {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent; /* removes grey flash on iOS/Android tap */
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--nav-h) + 8px);
    -webkit-text-size-adjust: 100%; /* prevent iOS auto-resize of text */
    text-size-adjust: 100%;
    height: -webkit-fill-available; /* iOS Safari full-height fix */
}

::selection {
    background: rgba(214, 162, 54, 0.3);
    color: var(--brand-dark);
}

body {
    margin: 0;
    font-family: 'Manrope', sans-serif;
    color: var(--text);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;     /* macOS/iOS crisp text */
    -moz-osx-font-smoothing: grayscale;      /* Firefox macOS */
    text-rendering: optimizeLegibility;
    background:
        radial-gradient(circle at top left, rgba(214, 162, 54, 0.22), transparent 28%),
        radial-gradient(circle at bottom right, rgba(143, 41, 31, 0.16), transparent 26%),
        linear-gradient(180deg, #fdf7ed 0%, #f4ead8 100%);
    min-height: 100vh;
    min-height: 100svh; /* small viewport height — no address-bar overflow on mobile */
    min-height: -webkit-fill-available;
}

img {
    display: block;
    width: 100%;
    -webkit-user-drag: none;   /* prevent image drag on desktop Safari */
    -webkit-user-select: none; /* prevent long-press image pop-up on iOS */
    user-select: none;
}

a {
    color: inherit;
    text-decoration: none;
}

/* Touch action on all interactive elements removes 300ms tap delay */
a, button, [role="button"],
.gallery-thumb, .lightbox-thumb, .gallery-stage {
    touch-action: manipulation;
}

/* ═══════════════════════════════════════════════
   SKIP NAV (Accessibility)
═══════════════════════════════════════════════ */
.skip-nav {
    position: absolute;
    top: -100%;
    left: 1rem;
    z-index: 9999;
    padding: 0.75rem 1.25rem;
    background: var(--brand);
    color: #fff;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    font-weight: 600;
    transition: top var(--transition);
}

.skip-nav:focus {
    top: 0;
}

/* ═══════════════════════════════════════════════
   NAVIGATION
═══════════════════════════════════════════════ */
.nav-wrap {
    position: -webkit-sticky; /* iOS Safari < 15 */
    position: sticky;
    top: 0;
    z-index: 200;
    background: rgba(246, 240, 228, 0.85);
    -webkit-backdrop-filter: blur(24px) saturate(1.4);
    backdrop-filter: blur(24px) saturate(1.4);
    border-bottom: 1px solid transparent;
    transition: border-color var(--transition), box-shadow var(--transition);
    /* Safe area for iPhone notch/Dynamic Island */
    padding-top: env(safe-area-inset-top);
}

.nav-wrap.is-scrolled {
    border-color: var(--border);
    box-shadow: 0 2px 24px rgba(65, 32, 15, 0.1);
}

.nav {
    width: min(1180px, calc(100% - 2rem));
    margin: 0 auto;
    height: var(--nav-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.brand {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-shrink: 0;
    text-decoration: none;
    min-width: 0;
}

/* ── Vaishnava Symbol Mark (Shankha · Namam · Chakra) ── */
.brand-mark {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    flex-shrink: 0;
    transition: transform var(--transition);
}

.brand:hover .brand-mark {
    transform: scale(1.06);
}

/* ── Row of three symbols ── */
.vmark-row {
    display: flex;
    align-items: flex-end;
    gap: 5px;
    line-height: 1;
}

/* ── Shankha (Conch) ── */
.vmark-shankha {
    font-size: 1.55rem;
    line-height: 1;
    filter: drop-shadow(0 1px 2px rgba(65, 32, 15, 0.18));
}

/* ── Sudarshana Chakra (Wheel) ── */
.vmark-chakra {
    font-size: 1.55rem;
    line-height: 1;
    color: var(--accent);
    text-shadow: 0 0 8px rgba(214, 162, 54, 0.4);
}

/* ── Namam (Urdhva Pundra — the 3-stripe Vaishnava tilak) ── */
.vmark-namam {
    display: inline-flex;
    align-items: flex-end;
    gap: 2px;
    height: 28px;
    margin-bottom: 1px;
}

.vmark-namam i {
    display: block;
    font-style: normal;
    border-radius: 50% 50% 0 0;
}

/* Left band — white/cream arch */
.vmark-namam i:nth-child(1),
.vmark-namam i:nth-child(3) {
    width: 7px;
    height: 21px;
    background: #fff4e2;
    border: 1.5px solid rgba(143, 41, 31, 0.32);
    border-bottom: none;
}

/* Centre stripe — saffron red */
.vmark-namam i:nth-child(2) {
    width: 5px;
    height: 28px;
    background: #c41e1e;
    border-radius: 3px 3px 0 0;
}

/* ── "Ram · Chitha" devotional text ── */
.vmark-names {
    display: block;
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--brand);
    letter-spacing: 0.12em;
    text-align: center;
    white-space: nowrap;
    line-height: 1;
}

/* ── Large variants (footer) ── */
.vmark-row-lg {
    gap: 7px;
}

.vmark-row-lg .vmark-shankha,
.vmark-row-lg .vmark-chakra {
    font-size: 2rem;
}

.vmark-namam-lg {
    height: 36px;
    gap: 3px;
}

.vmark-namam-lg i:nth-child(1),
.vmark-namam-lg i:nth-child(3) {
    width: 9px;
    height: 27px;
}

.vmark-namam-lg i:nth-child(2) {
    width: 7px;
    height: 36px;
}

.vmark-names-lg {
    font-size: 0.88rem;
    letter-spacing: 0.14em;
    margin-top: 2px;
}

.brand-kicker {
    letter-spacing: 0.14em;
    text-transform: uppercase;
    font-size: 0.72rem;
    color: var(--muted);
    margin: 0;
    white-space: nowrap;
}

.brand-name {
    display: block;
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.1;
    color: var(--text);
    white-space: nowrap;
}

.nav-links {
    display: flex;
    gap: 0.15rem;
    align-items: center;
}

.nav-links a {
    padding: 0.5rem 0.85rem;
    border-radius: 999px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--muted);
    white-space: nowrap;
    transition: color var(--transition), background var(--transition);
}

.nav-links a:hover {
    color: var(--text);
    background: rgba(72, 42, 20, 0.06);
}

.nav-links a.is-active {
    color: var(--brand);
    background: rgba(143, 41, 31, 0.08);
    font-weight: 600;
}

/* Hamburger — hidden on desktop */
.nav-hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 44px;  /* Apple HIG minimum touch target */
    height: 44px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    background: transparent;
    cursor: pointer;
    box-shadow: none;
    flex-shrink: 0;
}

.nav-hamburger span {
    display: block;
    height: 2px;
    width: 100%;
    background: var(--text);
    border-radius: 2px;
    transition: transform 260ms ease, opacity 260ms ease;
    transform-origin: center;
}

.nav-hamburger.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-hamburger.is-open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.nav-hamburger.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ═══════════════════════════════════════════════
   LAYOUT CONTAINERS
═══════════════════════════════════════════════ */
.hero,
.section,
.stats,
.footer-inner,
.dashboard {
    width: min(1180px, calc(100% - 2rem));
    margin: 0 auto;
}

/* ═══════════════════════════════════════════════
   HERO
═══════════════════════════════════════════════ */
.hero {
    padding: 4.5rem 0 5rem;
}

.hero-content {
    display: flex;
    gap: 2.5rem;
    align-items: stretch;
}

.hero-copy,
.hero-card {
    flex: 1;
    min-width: 0;
}

.hero-copy h1 {
    margin: 0.75rem 0 1rem;
    font-family: 'Cormorant Garamond', serif;
    font-size: clamp(2.8rem, 6vw, 5.6rem);
    line-height: 0.94;
}

.hero-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 0.5rem;
}

.hero-actions .btn {
    min-height: 48px;
}

/* ═══════════════════════════════════════════════
   TYPOGRAPHY
═══════════════════════════════════════════════ */
.eyebrow,
.card-label,
.card-date,
.section-note,
.stat span,
.brand-kicker,
.contact-note {
    letter-spacing: 0.12em;
    text-transform: uppercase;
    font-size: 0.78rem;
    color: var(--muted);
    margin: 0;
}

.eyebrow {
    margin-bottom: 0.5rem;
}

.section-heading h2,
.auth-card h1,
.dashboard-header h1,
.hero-card-title,
.gallery-card-body h3,
.blog-card h3,
.prayer-card h3,
.contact-card h3,
.empty-state h3,
.panel-heading h2 {
    font-family: 'Cormorant Garamond', serif;
}

.section-heading h2,
.auth-card h1,
.dashboard-header h1 {
    margin: 0.4rem 0 0;
    font-size: clamp(2.3rem, 4vw, 3.6rem);
    line-height: 1.02;
}

.lead,
.section-text,
.hero-card p,
.gallery-card p,
.blog-card p,
.prayer-card p,
.auth-card p,
.panel-heading p,
table,
label {
    color: var(--muted);
    line-height: 1.75;
}

.section-text {
    max-width: 760px;
    font-size: 1.08rem;
    margin-top: 1.25rem;
}

/* ═══════════════════════════════════════════════
   BUTTONS
═══════════════════════════════════════════════ */
.btn,
button,
input,
textarea,
select {
    font: inherit;
}

.btn,
button[type="submit"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    border: 0;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--brand), var(--brand-dark));
    color: #fff8f2;
    padding: 0.9rem 1.6rem;
    font-weight: 600;
    cursor: pointer;
    touch-action: manipulation;
    transition: transform var(--transition), box-shadow var(--transition), filter var(--transition);
    box-shadow: 0 8px 24px rgba(95, 22, 15, 0.28);
    min-height: 44px; /* WCAG / Apple HIG minimum touch target */
    -webkit-appearance: none;
}

.btn:hover,
button[type="submit"]:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 32px rgba(95, 22, 15, 0.34);
    filter: brightness(1.05);
}

.btn:active,
button[type="submit"]:active {
    transform: translateY(0);
    filter: brightness(0.97);
}

.btn-secondary {
    background: linear-gradient(135deg, #c98f23, #9f6f15);
    box-shadow: 0 8px 24px rgba(159, 111, 21, 0.26);
}

.btn-secondary:hover {
    box-shadow: 0 14px 32px rgba(159, 111, 21, 0.32);
}

.btn-outline {
    background: transparent;
    color: var(--brand-dark);
    border: 1.5px solid rgba(95, 22, 15, 0.24);
    box-shadow: none;
}

.btn-outline:hover {
    background: rgba(143, 41, 31, 0.06);
    box-shadow: none;
    filter: none;
}

.btn-sm {
    padding: 0.5rem 1.1rem;
    font-size: 0.88rem;
    min-height: 36px;
}

/* ── Focus Visible ────────────────────────────── */
:focus-visible {
    outline: 2.5px solid var(--accent);
    outline-offset: 3px;
    border-radius: 4px;
}

/* ═══════════════════════════════════════════════
   CARDS (shared)
═══════════════════════════════════════════════ */
.hero-card,
.gallery-card,
.blog-card,
.prayer-card,
.contact-card,
.panel,
.auth-card,
.stat,
.empty-state {
    background: var(--surface);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    border-radius: var(--radius);
}

.hero-card {
    padding: 2rem;
    align-self: flex-end;
    max-width: 360px;
    width: 100%;
}

.hero-card-title {
    font-size: clamp(1.35rem, 2.5vw, 1.8rem);
    margin: 0.5rem 0 0.75rem;
    line-height: 1.15;
}

/* ═══════════════════════════════════════════════
   SECTION LAYOUT
═══════════════════════════════════════════════ */
.section {
    padding: 3rem 0 5rem;
}

.intro {
    padding-top: 4rem;
}

.section-heading.split {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.section-note {
    max-width: 340px;
    text-align: right;
    font-size: 0.9rem;
    line-height: 1.6;
}

/* ═══════════════════════════════════════════════
   STATS
═══════════════════════════════════════════════ */
.stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.4rem;
    padding-bottom: 0;
}

.stat,
.prayer-card,
.panel,
.empty-state {
    padding: 1.5rem;
}

.stat strong {
    display: block;
    margin-top: 0.5rem;
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.3rem;
}

/* ═══════════════════════════════════════════════
   GALLERY
═══════════════════════════════════════════════ */
.gallery-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

.gallery-card {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(280px, 0.8fr);
    align-items: stretch;
    overflow: hidden;
    transition: transform var(--transition), box-shadow var(--transition);
}

.gallery-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.gallery-visual {
    padding: 1rem;
    border-right: 1px solid var(--border);
    background:
        linear-gradient(180deg, rgba(255, 247, 234, 0.6), rgba(248, 236, 214, 0.15)),
        radial-gradient(circle at top, rgba(214, 162, 54, 0.14), transparent 40%);
}

.gallery-stage {
    position: relative;
    display: block;
    width: 100%;
    padding: 0;
    background: none;
    border: 0;
    box-shadow: none;
    cursor: zoom-in;
    overflow: hidden;
    border-radius: 20px;
    -webkit-appearance: none;
}

.gallery-stage:focus-visible {
    outline-offset: 6px;
}

.gallery-stage img {
    height: min(72vh, 560px);
    min-height: 300px;
    object-fit: contain;
    background: rgba(88, 45, 18, 0.05);
    border-radius: 20px;
    transition: transform 400ms ease;
    user-select: none;
    -webkit-user-select: none;
}

.gallery-stage:hover img {
    transform: scale(1.015);
}

.gallery-expand {
    position: absolute;
    right: 0.9rem;
    bottom: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.55rem 1rem;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 600;
    color: #fff;
    background: rgba(38, 23, 15, 0.72);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    letter-spacing: 0.04em;
    transition: background var(--transition);
    pointer-events: none;
}

.gallery-stage:hover .gallery-expand {
    background: rgba(143, 41, 31, 0.88);
}

.gallery-thumbs,
.lightbox-thumbs,
.current-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 0.6rem;
    margin-top: 0.9rem;
}

.gallery-thumb,
.lightbox-thumb {
    padding: 0;
    border: 2.5px solid transparent;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.55);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    cursor: pointer;
    transition: border-color var(--transition), transform var(--transition);
    min-height: 44px; /* touch target */
}

.gallery-thumb:hover,
.lightbox-thumb:hover {
    transform: scale(1.04);
}

.gallery-thumb img,
.lightbox-thumb img,
.current-gallery-grid img {
    height: 80px;
    object-fit: cover;
}

.gallery-thumb.is-active,
.lightbox-thumb.is-active {
    border-color: var(--accent);
}

.gallery-count {
    display: inline-flex;
    margin-bottom: 0.25rem;
    color: var(--brand);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    background: rgba(143, 41, 31, 0.08);
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
}

.gallery-card-body,
.blog-card-body {
    padding: 1.4rem;
}

.gallery-card-body h3,
.blog-card h3 {
    margin: 0.35rem 0 0.6rem;
    font-size: clamp(1.25rem, 2vw, 1.65rem);
    line-height: 1.15;
}

/* ═══════════════════════════════════════════════
   BLOG
═══════════════════════════════════════════════ */
.blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.blog-card {
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform var(--transition), box-shadow var(--transition);
}

.blog-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.blog-card-image {
    overflow: hidden;
}

.blog-card-image img {
    height: 260px;
    object-fit: cover;
    transition: transform 400ms ease;
}

.blog-card:hover .blog-card-image img {
    transform: scale(1.04);
}

.blog-card-body {
    flex: 1;
}

/* ═══════════════════════════════════════════════
   PRAYERS
═══════════════════════════════════════════════ */
.prayer-layout {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.4rem;
}

.prayer-card {
    transition: transform var(--transition), box-shadow var(--transition);
}

.prayer-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.prayer-icon {
    font-size: 2rem;
    margin-bottom: 1rem;
    line-height: 1;
}

.prayer-card h3 {
    margin: 0 0 0.6rem;
    font-size: 1.5rem;
    line-height: 1.2;
}

/* ═══════════════════════════════════════════════
   CONTACT SECTION
═══════════════════════════════════════════════ */
.contact-layout {
    display: grid;
    grid-template-columns: 1fr 1.15fr;
    gap: 2rem;
    align-items: start;
    margin-top: 2rem;
}

.contact-info {
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
}

.contact-card {
    padding: 1.5rem;
    display: flex;
    gap: 1.1rem;
    align-items: flex-start;
    transition: transform var(--transition), box-shadow var(--transition);
}

.contact-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.contact-card-icon {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    background: var(--accent-light);
    border: 1px solid rgba(214, 162, 54, 0.22);
    border-radius: var(--radius-xs);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--brand);
    margin-top: 0.1rem;
}

.contact-card-text {
    flex: 1;
    min-width: 0;
}

.contact-card h3 {
    margin: 0 0 0.45rem;
    font-size: 1.4rem;
    line-height: 1.1;
}

.contact-card address {
    font-style: normal;
    color: var(--muted);
    line-height: 1.75;
    margin: 0 0 0.9rem;
    font-size: 0.95rem;
}

.contact-phone {
    display: inline-block;
    font-size: 1.35rem;
    font-family: 'Cormorant Garamond', serif;
    font-weight: 700;
    color: var(--brand);
    margin-bottom: 0.3rem;
    letter-spacing: 0.02em;
    transition: opacity var(--transition);
}

.contact-phone:hover {
    opacity: 0.75;
}

.contact-note {
    display: block;
    margin-top: 0.25rem;
}

.contact-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--brand);
    font-weight: 600;
    font-size: 0.9rem;
    transition: gap var(--transition), opacity var(--transition);
}

.contact-link:hover {
    opacity: 0.75;
    gap: 0.6rem;
}

/* ── Timing rows ──────────────────────────────── */
.timing-rows {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.4rem;
}

.timing-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    padding: 0.55rem 0.85rem;
    background: rgba(214, 162, 54, 0.07);
    border-radius: var(--radius-xs);
    border: 1px solid rgba(214, 162, 54, 0.12);
}

.timing-label {
    color: var(--muted);
    font-size: 0.88rem;
    font-weight: 600;
    white-space: nowrap;
}

.timing-value {
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 700;
    text-align: right;
}

.timing-special {
    background: rgba(143, 41, 31, 0.05);
    border-color: rgba(143, 41, 31, 0.16);
    border-style: dashed;
}

.timing-special .timing-label,
.timing-special .timing-value {
    color: var(--brand);
}

/* ── Map ──────────────────────────────────────── */
.contact-map {
    position: -webkit-sticky;
    position: sticky;
    top: calc(var(--nav-h) + 16px);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.map-wrap {
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    aspect-ratio: 4 / 3;
    background: rgba(88, 45, 18, 0.05);
}

.map-wrap iframe {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
    min-height: 300px;
}

.map-caption {
    display: flex;
    align-items: flex-start;
    gap: 0.45rem;
    font-size: 0.8rem;
    color: var(--muted);
    line-height: 1.55;
    margin: 0;
}

.map-caption svg {
    flex-shrink: 0;
    margin-top: 2px;
    opacity: 0.7;
}

/* ═══════════════════════════════════════════════
   EMPTY STATES
═══════════════════════════════════════════════ */
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem 2rem;
}

.empty-icon {
    display: block;
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.38;
}

.empty-state h3 {
    margin: 0 0 0.5rem;
    font-size: 1.7rem;
}

/* ═══════════════════════════════════════════════
   DIVIDER
═══════════════════════════════════════════════ */
.section-divider {
    width: min(960px, calc(100% - 4rem));
    margin: 0 auto;
    border: none;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    opacity: 0.38;
}

/* ═══════════════════════════════════════════════
   FOOTER
═══════════════════════════════════════════════ */
.footer {
    margin-top: 3rem;
    padding: 3rem 0;
    padding-bottom: calc(3rem + env(safe-area-inset-bottom));
    border-top: 1px solid var(--border);
    background: rgba(38, 23, 15, 0.03);
}

.footer-inner {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: start;
    gap: 2.5rem 3rem;
}

.footer-brand {
    display: flex;
    align-items: center;
    gap: 1rem;
    grid-column: 1;
}

.footer-divine {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
    opacity: 0.85;
}

.footer-name {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.2rem;
    font-weight: 700;
    margin: 0 0 0.2rem;
}

.footer-tagline {
    color: var(--muted);
    font-size: 0.86rem;
    margin: 0;
    line-height: 1.6;
}

/* ── Footer nav columns ───────────────────────── */
.footer-nav-group {
    display: flex;
    gap: 3rem;
}

.footer-nav-col {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.footer-nav-heading {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--muted);
    margin: 0 0 0.2rem;
}

.footer-nav-col a {
    font-size: 0.88rem;
    color: var(--muted);
    transition: color var(--transition);
}

.footer-nav-col a:hover {
    color: var(--brand);
}

/* ── Footer contact strip ─────────────────────── */
.footer-contact-strip {
    grid-column: 1 / -1;
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    padding: 1rem 1.25rem;
    background: var(--accent-light);
    border: 1px solid rgba(214, 162, 54, 0.2);
    border-radius: var(--radius-sm);
}

.footer-contact-item {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.88rem;
    color: var(--text);
    font-weight: 600;
    transition: color var(--transition);
    min-height: 44px;
}

.footer-contact-item:hover {
    color: var(--brand);
}

.footer-contact-item svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
    color: var(--brand);
    opacity: 0.8;
}

.footer-copy {
    grid-column: 1 / -1;
    color: var(--muted);
    font-size: 0.8rem;
    margin: 0;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
}

/* ═══════════════════════════════════════════════
   SCROLL TO TOP
═══════════════════════════════════════════════ */
.scroll-top {
    position: fixed;
    bottom: calc(2rem + env(safe-area-inset-bottom));
    right: 2rem;
    z-index: 150;
    width: 48px;
    height: 48px;
    padding: 0;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand), var(--brand-dark));
    color: #fff;
    box-shadow: 0 8px 24px rgba(95, 22, 15, 0.32);
    border: none;
    cursor: pointer;
    touch-action: manipulation;
    transition: transform var(--transition), box-shadow var(--transition), opacity 300ms ease;
    opacity: 0;
    pointer-events: none;
    -webkit-appearance: none;
}

.scroll-top.is-visible {
    opacity: 1;
    pointer-events: auto;
}

.scroll-top:hover {
    transform: translateY(-3px);
    box-shadow: 0 14px 32px rgba(95, 22, 15, 0.38);
}

/* ═══════════════════════════════════════════════
   FADE-UP ANIMATIONS
   (respects prefers-reduced-motion)
═══════════════════════════════════════════════ */
@media (prefers-reduced-motion: no-preference) {
    .fade-up {
        opacity: 0;
        transform: translateY(28px);
        transition: opacity 520ms ease, transform 520ms ease;
    }

    .fade-up.is-visible {
        opacity: 1;
        transform: none;
    }
}

/* ═══════════════════════════════════════════════
   LIGHTBOX
═══════════════════════════════════════════════ */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: grid;
    place-items: center;
    padding: max(1rem, env(safe-area-inset-top)) 1rem max(1rem, env(safe-area-inset-bottom));
}

.lightbox[hidden] {
    display: none;
}

.lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(12, 7, 4, 0.86);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}

.lightbox-panel {
    position: relative;
    width: min(1120px, 100%);
    max-height: calc(100vh - 2rem);
    max-height: calc(100dvh - 2rem);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding: 1.75rem;
    border-radius: 28px;
    background: #fbf5ea;
    box-shadow: 0 32px 96px rgba(0, 0, 0, 0.36);
}

.lightbox-close {
    position: absolute;
    top: 1.1rem;
    right: 1.1rem;
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: 50%;
    background: rgba(38, 23, 15, 0.1);
    border: none;
    cursor: pointer;
    color: var(--text);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: none;
    touch-action: manipulation;
    transition: background var(--transition);
}

.lightbox-close:hover {
    background: rgba(38, 23, 15, 0.2);
    transform: none;
}

.lightbox-title {
    margin: 0.4rem 0 1rem;
    font-family: 'Cormorant Garamond', serif;
    font-size: clamp(1.8rem, 4vw, 3rem);
    padding-right: 3.5rem;
    line-height: 1.15;
}

.lightbox-image-wrap {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.lightbox-image {
    flex: 1;
    min-width: 0;
    height: min(72vh, 720px);
    height: min(72dvh, 720px);
    object-fit: contain;
    border-radius: 20px;
    background: rgba(88, 45, 18, 0.06);
    user-select: none;
    -webkit-user-select: none;
}

.lightbox-arrow {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    padding: 0;
    border-radius: 50%;
    background: rgba(38, 23, 15, 0.1);
    border: none;
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: none;
    touch-action: manipulation;
    transition: background var(--transition), transform var(--transition);
}

.lightbox-arrow:hover {
    background: rgba(38, 23, 15, 0.2);
    transform: scale(1.1);
}

.lightbox-arrow[hidden] {
    visibility: hidden;
    pointer-events: none;
}

.lightbox-thumbs {
    margin-top: 1rem;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 0.6rem;
}

/* ═══════════════════════════════════════════════
   ADMIN SHARED
═══════════════════════════════════════════════ */
.admin-body {
    min-height: 100vh;
}

.auth-shell,
.dashboard {
    padding: 3rem 0;
    width: min(1180px, calc(100% - 2rem));
    margin: 0 auto;
}

.auth-card {
    width: min(520px, calc(100% - 2rem));
    margin: 0 auto;
    padding: 2.5rem;
}

.admin-grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 1.4rem;
    margin: 2rem 0;
}

.panel-heading {
    margin-bottom: 1.25rem;
}

.panel-heading h2 {
    margin: 0;
    font-size: 2rem;
}

.dashboard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.dashboard-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.dashboard-actions .btn {
    min-height: 44px;
}

.admin-form,
.auth-form {
    display: grid;
    gap: 1rem;
}

.current-gallery {
    display: grid;
    gap: 0.75rem;
}

.current-gallery-grid {
    margin-top: 0;
}

label {
    display: grid;
    gap: 0.45rem;
    font-weight: 600;
    color: var(--muted);
    line-height: 1.75;
}

input,
textarea,
select {
    width: 100%;
    padding: 0.9rem 1rem;
    border-radius: var(--radius-sm);
    border: 1.5px solid rgba(57, 33, 18, 0.16);
    background: var(--surface-strong);
    color: var(--text);
    /* Minimum 16px prevents iOS Safari zoom on input focus */
    font-size: max(16px, 1rem);
    transition: border-color var(--transition), box-shadow var(--transition);
    -webkit-appearance: none;
    appearance: none;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(214, 162, 54, 0.18);
}

textarea {
    resize: vertical;
    min-height: 80px;
}

.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    font-weight: 500;
}

.alert-success {
    background: rgba(33, 122, 74, 0.12);
    color: #165536;
    border: 1px solid rgba(33, 122, 74, 0.2);
}

.alert-error {
    background: rgba(164, 32, 32, 0.1);
    color: #7f1111;
    border: 1px solid rgba(164, 32, 32, 0.18);
}

.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    color: var(--muted);
    line-height: 1.75;
}

th, td {
    padding: 0.95rem 0.75rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
}

th {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--muted);
    white-space: nowrap;
}

.table-actions {
    display: flex;
    align-items: center;
    gap: 0.9rem;
}

.text-link,
.danger-button {
    color: var(--brand);
    background: none;
    border: 0;
    padding: 0.25rem 0;
    cursor: pointer;
    font-weight: 600;
    box-shadow: none;
    touch-action: manipulation;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    transition: opacity var(--transition);
}

.text-link:hover,
.danger-button:hover {
    opacity: 0.7;
    transform: none;
    box-shadow: none;
    filter: none;
}

.danger-button {
    color: #8e1e18;
}

/* ═══════════════════════════════════════════════
   RESPONSIVE — TABLET & MOBILE
═══════════════════════════════════════════════ */

/* ── Large tablet ── */
@media (max-width: 1180px) {
    .hero {
        padding-bottom: 4rem;
    }

    .gallery-card {
        grid-template-columns: minmax(0, 1.2fr) minmax(260px, 0.9fr);
    }

    .footer-nav-group {
        gap: 2rem;
    }
}

/* ── Tablet landscape ── */
@media (max-width: 1024px) {
    .stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .prayer-layout {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .blog-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .gallery-stage img {
        height: min(62vh, 500px);
        min-height: 260px;
    }

    .contact-layout {
        grid-template-columns: 1fr 1fr;
    }
}

/* ── Tablet portrait ── */
@media (max-width: 900px) {
    .hero-content,
    .section-heading.split,
    .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .section-note {
        max-width: none;
        text-align: left;
    }

    .stats,
    .prayer-layout,
    .admin-grid {
        grid-template-columns: 1fr;
    }

    .gallery-card {
        grid-template-columns: 1fr;
    }

    .gallery-visual {
        border-right: 0;
        border-bottom: 1px solid var(--border);
    }

    .gallery-stage img {
        height: min(60vh, 460px);
        min-height: 220px;
    }

    .hero-card {
        max-width: none;
    }

    /* Contact: stack on tablet portrait */
    .contact-layout {
        grid-template-columns: 1fr;
    }

    .contact-map {
        position: static;
    }

    .map-wrap {
        aspect-ratio: 16 / 9;
    }

    /* Footer: collapse */
    .footer-inner {
        grid-template-columns: 1fr;
    }

    .footer-nav-group {
        gap: 2.5rem;
    }
}

/* ── Mobile (hamburger breakpoint) ── */
@media (max-width: 768px) {
    :root {
        --nav-h: 60px;
    }

    /* Show hamburger, hide desktop links */
    .nav-hamburger {
        display: flex;
    }

    .nav-links {
        display: none;
        position: fixed;
        inset: 0;
        /* Safe area top for notch phones */
        padding-top: calc(var(--nav-h) + env(safe-area-inset-top) + 2rem);
        padding-bottom: calc(3rem + env(safe-area-inset-bottom));
        z-index: 190;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 0.25rem;
        background: rgba(246, 240, 228, 0.97);
        -webkit-backdrop-filter: blur(24px) saturate(1.6);
        backdrop-filter: blur(24px) saturate(1.6);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .nav-links.is-open {
        display: flex;
    }

    .nav-links a {
        font-size: 1.5rem;
        font-family: 'Cormorant Garamond', serif;
        padding: 0.85rem 2.5rem;
        color: var(--text);
        width: 100%;
        text-align: center;
        border-radius: 0;
    }

    .nav-links a:hover,
    .nav-links a.is-active {
        background: rgba(143, 41, 31, 0.06);
        color: var(--brand);
        border-radius: var(--radius-sm);
    }

    .nav-links .btn-outline {
        margin-top: 1.5rem;
        font-size: 1rem;
        font-family: 'Manrope', sans-serif;
        padding: 0.75rem 2rem;
    }

    .brand-name {
        font-size: 1.3rem;
    }

    /* Scale symbols down on mobile nav */
    .vmark-row .vmark-shankha,
    .vmark-row .vmark-chakra {
        font-size: 1.25rem;
    }

    .vmark-namam {
        height: 24px;
    }

    .vmark-namam i:nth-child(1),
    .vmark-namam i:nth-child(3) {
        width: 6px;
        height: 18px;
    }

    .vmark-namam i:nth-child(2) {
        width: 4px;
        height: 24px;
    }

    .hero {
        padding-top: 3rem;
        padding-bottom: 4rem;
    }

    .hero-content {
        gap: 1.75rem;
    }

    .hero-actions {
        width: 100%;
    }

    .hero-actions .btn {
        flex: 1 1 180px;
    }

    .stats,
    .prayer-layout,
    .blog-grid,
    .contact-layout {
        grid-template-columns: 1fr;
    }

    .section {
        padding: 2rem 0 3.5rem;
    }

    .gallery-card-body,
    .blog-card-body,
    .panel,
    .auth-card,
    .stat,
    .prayer-card,
    .contact-card,
    .empty-state {
        padding: 1.25rem;
    }

    .lightbox-panel {
        padding: 1.25rem;
        border-radius: 20px;
    }

    .contact-card {
        flex-direction: row;
        gap: 1rem;
    }

    .timing-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.2rem;
        padding: 0.65rem 0.85rem;
    }

    .timing-value {
        text-align: left;
        font-size: 0.95rem;
    }

    .map-wrap {
        aspect-ratio: 4 / 3;
    }

    .footer-contact-strip {
        flex-direction: column;
        gap: 0.75rem;
    }

    .footer-nav-group {
        gap: 2rem;
    }

    .scroll-top {
        bottom: calc(1.5rem + env(safe-area-inset-bottom));
        right: 1.25rem;
        width: 44px;
        height: 44px;
    }
}

/* ── Mobile landscape (short viewport) ── */
@media (max-width: 768px) and (max-height: 500px) and (orientation: landscape) {
    .nav-links {
        padding-top: calc(var(--nav-h) + 0.5rem);
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 0;
    }

    .nav-links a {
        font-size: 1.1rem;
        padding: 0.75rem 1.25rem;
        width: auto;
    }

    .hero {
        padding-top: 2rem;
        padding-bottom: 2.5rem;
    }
}

/* ── Small phone ── */
@media (max-width: 640px) {
    .hero,
    .section,
    .stats,
    .footer-inner {
        width: min(100% - 1.25rem, 1180px);
    }

    .hero-copy h1 {
        font-size: clamp(2.2rem, 8vw, 2.8rem);
    }

    .blog-card-image img {
        height: 220px;
    }

    .gallery-stage img,
    .lightbox-image {
        height: auto;
        min-height: 0;
        max-height: 65vh;
    }

    .gallery-thumbs,
    .lightbox-thumbs,
    .current-gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(68px, 1fr));
        gap: 0.5rem;
    }

    .gallery-thumb img,
    .lightbox-thumb img,
    .current-gallery-grid img {
        height: 68px;
    }

    /* Arrow buttons hidden on small phones (use thumbnails instead) */
    .lightbox-arrow {
        display: none;
    }

    .contact-card {
        gap: 0.85rem;
    }

    .contact-phone {
        font-size: 1.2rem;
    }

    .footer-nav-group {
        flex-direction: column;
        gap: 1.5rem;
    }
}

/* ── Very small phone (iPhone SE 1st gen, etc.) ── */
@media (max-width: 375px) {
    .hero,
    .section,
    .stats,
    .footer-inner {
        width: min(100% - 1rem, 1180px);
    }

    /* Hide "Ram · Chitha" label on very tight screens — symbols still show */
    .vmark-names {
        display: none;
    }

    .vmark-row .vmark-shankha,
    .vmark-row .vmark-chakra {
        font-size: 1.1rem;
    }

    .vmark-namam {
        height: 20px;
        gap: 1px;
    }

    .vmark-namam i:nth-child(1),
    .vmark-namam i:nth-child(3) {
        width: 5px;
        height: 15px;
    }

    .vmark-namam i:nth-child(2) {
        width: 4px;
        height: 20px;
    }

    .hero-copy h1 {
        font-size: 2rem;
    }

    .section-heading h2,
    .auth-card h1,
    .dashboard-header h1,
    .lightbox-title {
        font-size: 1.9rem;
    }

    .hero-card,
    .gallery-card,
    .blog-card,
    .prayer-card,
    .contact-card,
    .panel,
    .auth-card,
    .stat,
    .empty-state,
    .lightbox-panel {
        border-radius: 18px;
    }

    .map-wrap {
        border-radius: 18px;
    }

    .contact-card {
        flex-direction: column;
        gap: 0.75rem;
    }

    .contact-card-icon {
        width: 40px;
        height: 40px;
    }
}

/* ── Action button full-width on small phones ── */
@media (max-width: 480px) {
    .hero-actions .btn,
    .dashboard-actions .btn {
        flex: 1 1 100%;
    }

    .gallery-expand {
        right: 0.6rem;
        bottom: 0.6rem;
        padding: 0.45rem 0.75rem;
        font-size: 0.76rem;
    }

    th, td {
        padding: 0.8rem 0.55rem;
        font-size: 0.9rem;
    }

    .table-actions {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.45rem;
    }
}

/* ── High-DPI / Retina adjustments ── */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .gallery-thumb img,
    .lightbox-thumb img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* ── Tablets with fine pointer (iPad with keyboard, etc.) ── */
@media (hover: none) and (pointer: coarse) {
    /* Remove hover transform effects on touch-only devices */
    .gallery-card:hover,
    .blog-card:hover,
    .prayer-card:hover,
    .contact-card:hover {
        transform: none;
        box-shadow: var(--shadow);
    }

    .gallery-stage:hover img {
        transform: none;
    }

    .blog-card:hover .blog-card-image img {
        transform: none;
    }
}
