/* --- Basic Styles --- */
html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f4f7f6;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

/* --- Header & Navigation --- */
header {
    text-align: center;
    padding: 60px 20px;
    border-bottom: 1px solid #ddd;
    position: relative;
    
    /* IMPORTANT: Replace 'header-background.jpg' 
      with the path to your scenic image.
    */
    background-image: linear-gradient(rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.4)), 
                      url('images/header.jpg');
    background-size: cover;
    background-position: center;
    color: #fff; 
}

header .profile-image {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    object-fit: cover;
    border: 5px solid #fff;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

header h1 {
    margin: 10px 0 5px 0;
    font-size: 2.5rem;
    color: #fff;
}

header p {
    font-size: 1.2rem;
    color: #f4f7f6;
    margin: 0;
}

nav {
    background-color: #fff;
    border-bottom: 1px solid #ddd;
    border-top: 1px solid #ddd;
    text-align: center;
    padding: 10px 0;
    position: -webkit-sticky; /* For Safari */
    position: sticky;
    top: 0;
    z-index: 10;
}

nav a {
    display: inline-block;
    padding: 10px 20px;
    text-decoration: none;
    color: #005f73;
    font-weight: 500;
}

nav a:hover {
    background-color: #e0f7fa;
    border-radius: 4px;
}

/* --- Section Styling --- */
section {
    padding: 40px 20px;
    margin-top: 20px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

section h2 {
    font-size: 2rem;
    color: #005f73;
    border-bottom: 2px solid #a8d5e5;
    padding-bottom: 10px;
    margin-top: 0;
}

/* --- Obituary Section --- */
#obituary p {
    font-size: 1.1rem;
    margin-bottom: 1.2em;
}

/* --- Timeline Section --- */
.timeline {
    position: relative;
    padding: 20px 0;
}

.timeline-item {
    display: flex;
    margin-bottom: 30px;
    position: relative;
}

.timeline-date {
    flex-shrink: 0;
    width: 100px;
    font-weight: bold;
    color: #005f73;
    padding-right: 20px;
    text-align: right;
}

.timeline-content {
    border-left: 3px solid #a8d5e5;
    padding-left: 30px;
}

/* Dot on the timeline */
/* .timeline-content::before { 
    content: '';
    position: absolute;
    left: 96px; 
    top: 5px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: #005f73;
    border: 2px solid #fff;
    z-index: 1;
} */

.timeline-content h3 {
    margin: 0 0 5px 0;
    font-size: 1.25rem;
}

.timeline-content p {
    margin: 0;
}

/* --- Gallery Section --- */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
}

.gallery-grid img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    transition: transform 0.3s, box-shadow 0.3s, opacity 0.3s;
    cursor: pointer; /* NEW: Add pointer cursor */
}

.gallery-grid img:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    opacity: 0.8; /* NEW: Add hover effect */
}

/* --- CTA Button (for Guestbook & Donate) --- */
.cta-button {
    display: inline-block;
    padding: 12px 25px;
    background-color: #005f73; /* Main theme color */
    color: #fff;
    text-decoration: none;
    font-weight: bold;
    border-radius: 8px;
    transition: background-color 0.3s;
    font-size: 1.1rem;
    margin-top: 10px;
}

.cta-button:hover {
    background-color: #004050; /* Darker shade */
}

/* --- Service Section --- */
#service p {
    font-size: 1.1rem;
}

/* --- Footer --- */
footer {
    text-align: center;
    padding: 30px 20px;
    margin-top: 30px;
    background-color: #2c3e50;
    color: #f4f7f6;
}

footer p {
    margin: 0;
}


/* ========================================
NEW: LIGHTBOX GALLERY STYLES (UPDATED FOR CENTERING)
========================================
*/
.lightbox-modal {
    display: none; /* Hidden by default - will be set to 'flex' by JS when opened */
    position: fixed; /* Stay in place */
    z-index: 1000; /* Sit on top */
    left: 0;
    top: 0;
    width: 100%; /* Full width */
    height: 100%; /* Full height */
    overflow: auto; 
    background-color: rgba(0,0,0,0.9); /* Black w/ opacity */
    
    /* KEY CHANGE: Use Flexbox to center the content */
    align-items: center; /* Center vertically */
    justify-content: center; /* Center horizontally */
    flex-direction: column; /* Stack image and caption vertically */
}

img#lightbox-img {
    height: 80vh;
}

.lightbox-content {
    /* KEY CHANGE: Removed 'margin: auto' and set strict max sizes relative to the viewport */
    display: block; 
    max-width: 90%; /* Image can take up to 90% of screen width */
    max-height: 90vh; /* Image can take up to 90% of viewport height */
    width: auto; /* Allow image to size naturally */
    height: auto;
    
    /* Add animation */
    animation-name: zoom;
    animation-duration: 0.5s;
}

.lightbox-caption {
    /* Positioning now handled by Flexbox in the parent (.lightbox-modal) */
    display: block;
    max-width: 85%;
    text-align: center;
    color: #ccc;
    padding: 10px 0;
    margin-top: 10px; /* Space between image and caption */
    font-size: 1.1rem;
    line-height: 1.4;
}

/* Animation for the zoom-in effect (remains the same) */
@keyframes zoom {
    from {transform: scale(0.1)}
    to {transform: scale(1)}
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 40px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    transition: 0.3s;
    z-index: 1001; /* Make sure the close button is on top of everything */
}

.lightbox-close:hover,
.lightbox-close:focus {
    color: #bbb;
    text-decoration: none;
    cursor: pointer;
}