/* ============================================================================
   Maa Koteshwari Seva Samiti Trust — Scroll Morph Hero (gallery.html)
   Vanilla adaptation of the React scroll-morph-hero component.
   ============================================================================ */

.smh-root {
    position: relative;
    background:
        radial-gradient(1100px 480px at 82% -180px, rgba(201, 162, 74, 0.16), transparent 70%),
        radial-gradient(900px 420px at -10% -120px, rgba(159, 52, 52, 0.4), transparent 65%),
        linear-gradient(180deg, #1c0404 0%, #2a0505 55%, #1c0404 100%);
    border-bottom: 1px solid rgba(201, 162, 74, 0.45);
    box-shadow: inset 0 0 120px rgba(0, 0, 0, 0.6);
    overflow: hidden;
}

.smh-root::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 50% 42%, rgba(201, 162, 74, 0.08), transparent 55%);
    pointer-events: none;
}

.smh-viewport {
    position: relative;
    height: min(90vh, 860px);
    overflow: hidden;
    touch-action: pan-y;
}

.smh-stage {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
}

/* ── Intro text (fades out) ── */
.smh-intro {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    pointer-events: none;
    padding: 0 24px;
    max-width: 100%;
}

.smh-intro-title {
    font-size: clamp(24px, 4.2vw, 46px);
    font-weight: 600;
    letter-spacing: -0.01em;
    line-height: 1.35;
    color: var(--cream-50);
    text-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
    margin: 0 0 16px;
}

.smh-intro-sub {
    margin: 0;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.22em;
    color: var(--gold-300);
}

/* ── Arc content (fades in after morph) ── */
.smh-arc-content {
    position: absolute;
    top: 10%;
    left: 0;
    right: 0;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    pointer-events: none;
    padding: 0 22px;
    opacity: 0;
}

.smh-arc-content h2 {
    font-size: clamp(26px, 4vw, 44px);
    color: var(--gold-300);
    margin: 0 0 12px;
    text-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.smh-arc-content p {
    margin: 0;
    font-size: 14px;
    line-height: 1.8;
    color: rgba(244, 240, 232, 0.78);
    max-width: 560px;
}

/* ── Flip cards ── */
.smh-card {
    position: absolute;
    width: 90px;
    height: 128px;
    cursor: pointer;
    perspective: 1000px;
    transform-style: preserve-3d;
    will-change: transform;
}

.smh-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.33, 1, 0.68, 1);
}

.smh-card:hover .smh-card-inner,
.smh-card:focus-visible .smh-card-inner {
    transform: rotateY(180deg);
}

.smh-face {
    position: absolute;
    inset: 0;
    overflow: hidden;
    border-radius: 10px;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.smh-front {
    background: #e5e0d6;
    box-shadow: 0 14px 30px -10px rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(201, 162, 74, 0.4);
}

.smh-front img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.smh-front::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.1);
    transition: background 0.3s var(--ease);
    pointer-events: none;
}

.smh-card:hover .smh-front::after {
    background: rgba(0, 0, 0, 0);
}

.smh-back {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    background: linear-gradient(160deg, #2a0505, var(--maroon-900));
    border: 1px solid rgba(201, 162, 74, 0.55);
    transform: rotateY(180deg);
    padding: 8px;
}

.smh-back-label {
    margin: 0;
    font-size: 8px;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--gold-400);
}

.smh-back-detail {
    margin: 0;
    font-size: 11px;
    font-weight: 600;
    color: var(--cream-50);
    text-align: center;
    line-height: 1.5;
}

@media (max-width: 640px) {
    .smh-viewport {
        height: min(88vh, 720px);
    }

    .smh-intro-sub {
        font-size: 10px;
        letter-spacing: 0.14em;
    }
}

@media (prefers-reduced-motion: reduce) {
    .smh-card-inner {
        transition: none;
    }
}