/* === RESET & BASE === */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --gold: #d4a53c;
    --deep-brown: #2c1e0f;
    --parchment: #ede2cc;
    --light-gold: #f5d88e;
    --warm-brown: #6b5234;
    --cream: #f7f0e3;
    --muted-tan: #a89478;
    --amber: #c47a2a;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--deep-brown);
    color: var(--parchment);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* === BOKEH BACKGROUND === */
.bokeh-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.bokeh-dot {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle, var(--light-gold) 0%, transparent 70%);
    opacity: 0;
    animation: bokehFloat 8s ease-in-out infinite;
}

@keyframes bokehFloat {
    0%, 100% { opacity: 0; transform: translateY(0) scale(1); }
    50% { opacity: 0.15; transform: translateY(-30px) scale(1.1); }
}

/* === HEADER === */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 1.5rem 2rem;
    background: linear-gradient(to bottom, var(--deep-brown) 60%, transparent);
    text-align: center;
}

.header-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
}

.header-flame {
    filter: drop-shadow(0 0 8px rgba(244, 216, 142, 0.6));
    animation: flameFlicker 3s ease-in-out infinite;
}

@keyframes flameFlicker {
    0%, 100% { transform: scaleY(1) scaleX(1); opacity: 0.9; }
    25% { transform: scaleY(1.05) scaleX(0.97); opacity: 1; }
    50% { transform: scaleY(0.97) scaleX(1.03); opacity: 0.85; }
    75% { transform: scaleY(1.03) scaleX(0.98); opacity: 0.95; }
}

.site-title {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: clamp(2.8rem, 6vw, 5.2rem);
    color: var(--light-gold);
    letter-spacing: -0.02em;
    text-shadow: 0 0 40px rgba(212, 165, 60, 0.3);
}

.site-tagline {
    font-family: 'Lora', serif;
    font-style: italic;
    font-weight: 400;
    font-size: clamp(0.9rem, 2vw, 1.1rem);
    color: var(--muted-tan);
    letter-spacing: 0.04em;
}

/* === MASONRY GRID === */
.masonry-container {
    position: relative;
    z-index: 1;
    columns: 3;
    column-gap: 1.2rem;
    padding: 2rem clamp(1rem, 4vw, 3rem);
    max-width: 1400px;
    margin: 0 auto;
}

/* === MEMORIAL CARDS === */
.memorial-card {
    break-inside: avoid;
    margin-bottom: 1.2rem;
    background: linear-gradient(145deg, rgba(107, 82, 52, 0.25) 0%, rgba(44, 30, 15, 0.6) 100%);
    border: 1px solid rgba(212, 165, 60, 0.15);
    border-radius: 6px;
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
    transition: transform 0.4s ease, box-shadow 0.4s ease, border-color 0.4s ease;
    cursor: default;
}

.memorial-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(ellipse at top left, rgba(245, 216, 142, 0.08) 0%, transparent 60%);
    pointer-events: none;
}

.memorial-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 32px rgba(212, 165, 60, 0.15), 0 0 60px rgba(245, 216, 142, 0.05);
    border-color: rgba(212, 165, 60, 0.35);
}

.memorial-card:hover .card-candle svg {
    filter: drop-shadow(0 0 12px rgba(245, 216, 142, 0.8));
}

/* Card size variants */
.card-tall {
    min-height: 320px;
}

.card-wide {
    min-height: 160px;
}

.card-square {
    min-height: 240px;
}

/* === CARD ELEMENTS === */
.card-candle {
    margin-bottom: 1rem;
}

.card-candle svg {
    filter: drop-shadow(0 0 6px rgba(245, 216, 142, 0.5));
    animation: flameFlicker 3s ease-in-out infinite;
}

/* Stagger flame animations */
.memorial-card:nth-child(2n) .card-candle svg { animation-delay: -0.7s; }
.memorial-card:nth-child(3n) .card-candle svg { animation-delay: -1.4s; }
.memorial-card:nth-child(5n) .card-candle svg { animation-delay: -2.1s; }
.memorial-card:nth-child(7n) .card-candle svg { animation-delay: -0.3s; }

.card-name {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: clamp(1.1rem, 2.5vw, 1.4rem);
    color: var(--light-gold);
    margin-bottom: 0.25rem;
    line-height: 1.3;
}

.card-dates {
    font-family: 'Inter', sans-serif;
    font-weight: 300;
    font-size: 0.8rem;
    color: var(--muted-tan);
    letter-spacing: 0.12em;
    margin-bottom: 0.8rem;
}

.card-epitaph {
    font-family: 'Lora', serif;
    font-weight: 400;
    font-size: 0.95rem;
    color: var(--parchment);
    line-height: 1.65;
    margin-bottom: 1rem;
    opacity: 0.9;
}

.card-lit-by {
    font-family: 'Inter', sans-serif;
    font-weight: 300;
    font-size: 0.75rem;
    color: var(--gold);
    opacity: 0.6;
    display: block;
    margin-top: auto;
}

/* === FOOTER === */
.site-footer {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 3rem 2rem 2rem;
    background: linear-gradient(to top, var(--deep-brown) 60%, transparent);
}

.footer-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.footer-flame {
    filter: drop-shadow(0 0 6px rgba(244, 216, 142, 0.4));
    animation: flameFlicker 4s ease-in-out infinite;
}

.footer-text {
    font-family: 'Lora', serif;
    font-style: italic;
    font-size: 0.95rem;
    color: var(--muted-tan);
}

.footer-count {
    font-family: 'Inter', sans-serif;
    font-weight: 300;
    font-size: 0.8rem;
    color: var(--gold);
    opacity: 0.5;
}

/* === CARD GLOW ON HOVER (radial cursor glow) === */
.memorial-card[data-glow]::after {
    content: '';
    position: absolute;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(245, 216, 142, 0.1) 0%, transparent 70%);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    transform: translate(-50%, -50%);
    top: var(--glow-y, 50%);
    left: var(--glow-x, 50%);
}

.memorial-card[data-glow]:hover::after {
    opacity: 1;
}

/* === SCROLL REVEAL === */
.memorial-card {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease, box-shadow 0.4s ease, border-color 0.4s ease;
}

.memorial-card.visible {
    opacity: 1;
    transform: translateY(0);
}

/* === RESPONSIVE === */
@media (max-width: 900px) {
    .masonry-container {
        columns: 2;
    }
}

@media (max-width: 560px) {
    .masonry-container {
        columns: 1;
    }
    .site-header {
        padding: 1rem;
    }
}
