/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2c3e50;
    --secondary-color: #34495e;
    --accent-color: #7f8c8d;
    --text-color: #333;
    --text-light: #666;
    --bg-light: #f8f9fa;
    --bg-white: #ffffff;
    --border-color: #e0e0e0;
    --spacing: 1rem;
    --spacing-lg: 2rem;
    --max-width: 1200px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-light);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Navigation */
.navbar {
    background-color: var(--primary-color);
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.nav-container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--spacing);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 600;
    color: white;
    text-decoration: none;
    letter-spacing: 1px;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav-menu a {
    color: white;
    text-decoration: none;
    transition: opacity 0.3s;
}

.nav-menu a:hover {
    opacity: 0.8;
}

/* Hero Section */
.hero {
    background-color: var(--primary-color);
    background-size: cover !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
    background-attachment: scroll;
    color: white;
    padding: 4rem var(--spacing);
    text-align: center;
    position: relative;
    min-height: 500px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(44, 62, 80, 0.7);
    z-index: 1;
}

.hero-content {
    position: relative;
    z-index: 2;
}


.hero h1 {
    font-size: 3rem;
    font-weight: 300;
    margin-bottom: 1rem;
    letter-spacing: 2px;
}

.hero-subtitle {
    font-size: 1.2rem;
    font-weight: 300;
    opacity: 0.9;
}

/* Container */
.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--spacing);
}

/* Sections */
.intro {
    padding: var(--spacing-lg) var(--spacing);
    background-color: var(--bg-white);
}

.intro h2 {
    font-size: 2rem;
    font-weight: 300;
    margin-bottom: var(--spacing);
    color: var(--primary-color);
}

.intro p {
    font-size: 1.1rem;
    margin-bottom: var(--spacing);
    color: var(--text-light);
    max-width: 800px;
}

/* Page Header */
.page-header {
    background-color: var(--bg-white);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    padding: var(--spacing-lg) var(--spacing);
    text-align: center;
    border-bottom: 1px solid var(--border-color);
    position: relative;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.page-header-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.85);
    z-index: 1;
}

.page-header .container {
    position: relative;
    z-index: 2;
}

.page-header h1 {
    font-size: 2.5rem;
    font-weight: 300;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

.page-subtitle {
    font-size: 1.1rem;
    color: var(--text-light);
}

/* Search Section */
.search-section {
    padding: var(--spacing-lg) var(--spacing);
    background-color: var(--bg-white);
    border-bottom: 1px solid var(--border-color);
}

.search-box {
    display: flex;
    gap: 1rem;
    max-width: 600px;
    margin: 0 auto;
    flex-wrap: wrap;
}

.search-box input {
    flex: 1;
    min-width: 200px;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-family: inherit;
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.search-box button {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-family: inherit;
    transition: background-color 0.3s;
}

#searchButton {
    background-color: var(--primary-color);
    color: white;
}

#searchButton:hover {
    background-color: var(--secondary-color);
}

.btn-secondary {
    background-color: var(--accent-color);
    color: white;
}

.btn-secondary:hover {
    background-color: var(--secondary-color);
}

.search-results {
    text-align: center;
    margin-top: 1rem;
    color: var(--text-light);
}

/* Memorial Grid */
.memorial-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: var(--spacing-lg);
    padding: var(--spacing-lg) var(--spacing);
}

.memorial-card {
    background-color: var(--bg-white);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.3s, box-shadow 0.3s;
    text-decoration: none;
    color: inherit;
    display: block;
}

.memorial-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.memorial-card-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
}

.memorial-card-content {
    padding: var(--spacing);
    min-height: 120px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.memorial-card h3 {
    font-size: 1.5rem;
    font-weight: 400;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

.memorial-card p {
    color: var(--text-light);
    font-size: 0.95rem;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.view-all {
    text-align: center;
    padding: var(--spacing-lg) var(--spacing);
}

.btn {
    display: inline-block;
    padding: 0.75rem 2rem;
    background-color: var(--primary-color);
    color: white;
    text-decoration: none;
    border-radius: 4px;
    transition: background-color 0.3s;
    font-size: 1rem;
}

.btn:hover {
    background-color: var(--secondary-color);
}

/* Memorial Page */
.memorial-page {
    max-width: 100%;
    margin: 0;
    padding: 0;
    background-color: var(--bg-light);
    min-height: 60vh;
}

.memorial-hero-section {
    position: relative;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    padding: 4rem var(--spacing);
    text-align: center;
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.memorial-hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(44, 62, 80, 0.7);
    z-index: 1;
}

.memorial-hero-content {
    position: relative;
    z-index: 2;
    max-width: var(--max-width);
    margin: 0 auto;
}

.memorial-page-content {
    max-width: 900px;
    margin: 0 auto;
    padding: var(--spacing-lg) var(--spacing);
    background-color: var(--bg-white);
}

.memorial-header {
    text-align: center;
    margin-bottom: var(--spacing-lg);
    padding-bottom: var(--spacing-lg);
    border-bottom: 1px solid var(--border-color);
}

.memorial-header h1 {
    font-size: 2.5rem;
    font-weight: 300;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

.memorial-header .memorial-dates {
    color: var(--text-light);
    font-size: 1.1rem;
}

.memorial-tribute {
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--text-color);
    margin-bottom: var(--spacing-lg);
}

.memorial-tribute p {
    margin-bottom: 1rem;
}

/* Photo Gallery */
.photo-gallery {
    margin: var(--spacing-lg) 0;
}

.photo-gallery h2 {
    font-size: 1.8rem;
    font-weight: 300;
    margin-bottom: var(--spacing);
    color: var(--primary-color);
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: var(--spacing);
}

.gallery-item {
    position: relative;
    cursor: pointer;
    overflow: hidden;
    border-radius: 4px;
    aspect-ratio: 1;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
    display: block;
}

.gallery-item:hover img {
    transform: scale(1.05);
}

.gallery-item::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0);
    transition: background 0.3s;
}

.gallery-item:hover::after {
    background: rgba(0,0,0,0.1);
}

/* Lightbox */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.9);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
}

.lightbox-close {
    position: absolute;
    top: 2rem;
    right: 2rem;
    background: none;
    border: none;
    color: white;
    font-size: 3rem;
    cursor: pointer;
    width: 50px;
    height: 50px;
    line-height: 50px;
    text-align: center;
    transition: opacity 0.3s;
}

.lightbox-close:hover {
    opacity: 0.7;
}

.lightbox-prev,
.lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    font-size: 3rem;
    cursor: pointer;
    width: 60px;
    height: 60px;
    line-height: 60px;
    text-align: center;
    transition: background 0.3s;
}

.lightbox-prev:hover,
.lightbox-next:hover {
    background: rgba(255,255,255,0.3);
}

.lightbox-prev {
    left: 2rem;
}

.lightbox-next {
    right: 2rem;
}

.lightbox-caption {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    text-align: center;
    padding: 0.5rem 1rem;
    background: rgba(0,0,0,0.5);
    border-radius: 4px;
}

/* Utilities */
.loading {
    text-align: center;
    padding: var(--spacing-lg);
    color: var(--text-light);
}

.no-results {
    text-align: center;
    padding: var(--spacing-lg);
    color: var(--text-light);
    font-size: 1.1rem;
}

/* Footer */
footer {
    margin-top: auto;
    background-color: var(--primary-color);
    color: white;
    padding: var(--spacing) var(--spacing);
    text-align: center;
}

footer p {
    margin: 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .hero h1 {
        font-size: 2rem;
    }

    .hero-subtitle {
        font-size: 1rem;
    }

    .memorial-grid {
        grid-template-columns: 1fr;
    }

    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }

    .nav-menu {
        gap: 1rem;
    }

    .lightbox-prev,
    .lightbox-next {
        font-size: 2rem;
        width: 40px;
        height: 40px;
        line-height: 40px;
    }

    .lightbox-prev {
        left: 1rem;
    }

    .lightbox-next {
        right: 1rem;
    }

    .lightbox-close {
        top: 1rem;
        right: 1rem;
        font-size: 2rem;
        width: 40px;
        height: 40px;
        line-height: 40px;
    }

    .search-box {
        flex-direction: column;
    }

    .search-box input,
    .search-box button {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .hero {
        padding: 2rem var(--spacing);
    }

    .intro h2,
    .page-header h1 {
        font-size: 1.8rem;
    }
}

/* Accessibility */
*:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

button:focus,
a:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .navbar,
    .search-section,
    footer,
    .lightbox,
    .btn {
        display: none;
    }

    .memorial-page {
        max-width: 100%;
    }
}