/* =================================
   Memorial Website for Fred "Niles" Dover
   Color Scheme from Funeral Program
   ================================= */

:root {
    /* Colors from funeral program */
    --primary-tan: #D4C5A0;
    --primary-green: #1B4332;
    --dark-green: #0D2818;
    --light-tan: #E8DCC4;
    --text-dark: #2C2416;
    --text-light: #5A4E3C;
    
    /* Typography */
    --font-serif: 'Playfair Display', serif;
    --font-sans: 'Open Sans', sans-serif;
}

/* =================================
   Base Styles
   ================================= */

body {
    font-family: var(--font-sans);
    color: var(--text-dark);
    line-height: 1.6;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-serif);
    color: var(--primary-green);
}

.section-title {
    font-size: 2.5rem;
    font-weight: 700;
    position: relative;
    padding-bottom: 1rem;
    margin-bottom: 3rem;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 3px;
    background-color: var(--primary-green);
}

/* =================================
   Navigation
   ================================= */

#mainNav {
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

#mainNav .navbar-brand {
    font-family: var(--font-serif);
    color: var(--primary-green);
    font-weight: 700;
}

#mainNav .nav-link {
    color: var(--text-dark);
    font-weight: 500;
    padding: 0.5rem 1rem;
    transition: color 0.3s ease;
}

#mainNav .nav-link:hover,
#mainNav .nav-link.active {
    color: var(--primary-green);
}

/* =================================
   Hero Section
   ================================= */

.hero-section {
    padding-top: 120px;
    padding-bottom: 80px;
    background: linear-gradient(135deg, var(--light-tan) 0%, var(--primary-tan) 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
}

.hero-portrait {
    width: 300px;
    height: 300px;
    object-fit: cover;
    border-radius: 50%;
    border: 8px solid white;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.hero-section h1 {
    color: var(--text-dark);
    font-weight: 400;
}

.hero-section h2 {
    color: var(--primary-green);
    font-weight: 700;
}

.hero-section .lead {
    font-size: 1.5rem;
    color: var(--text-light);
}

/* =================================
   Obituary Section
   ================================= */

.obituary-content {
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--text-dark);
}

.obituary-content p {
    margin-bottom: 1.5rem;
}

/* =================================
   Video Section
   ================================= */

.ratio iframe {
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

/* =================================
   Photo Gallery
   ================================= */

#photoCarousel {
    max-width: 900px;
    margin: 0 auto;
}

/* Fixed height container to prevent jumping */
.carousel-inner {
    height: 600px; /* Fixed height for desktop */
    background-color: #f8f8f8;
    border-radius: 8px;
    position: relative;
}

/* Loading indicator for carousel */
.carousel-inner::before {
    content: 'Loading...';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #999;
    font-size: 14px;
    z-index: -1;
}

.carousel-item {
    height: 100%;
    position: relative;
}

.carousel-item img {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    border-radius: 8px;
    object-fit: contain;
}

/* Responsive carousel height */
@media (max-width: 768px) {
    .carousel-inner {
        height: 400px;
    }
}

@media (max-width: 576px) {
    .carousel-inner {
        height: 300px;
    }
}

/* Gallery grid view */
#photoGrid img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.3s ease;
}

#photoGrid img:hover {
    transform: scale(1.05);
}

/* Better carousel controls */
.carousel-control-prev,
.carousel-control-next {
    width: 10%;
    opacity: 0.9;
    transition: opacity 0.3s ease;
}

.carousel-control-prev:hover,
.carousel-control-next:hover {
    opacity: 1;
}

.carousel-control-prev-icon,
.carousel-control-next-icon {
    background-color: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    padding: 20px;
}

/* =================================
   Music Section
   ================================= */

.song-item {
    padding: 1.5rem;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    background-color: #fafafa;
    transition: box-shadow 0.3s ease;
}

.song-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.song-info h6 {
    margin-bottom: 0.25rem;
    color: var(--text-dark);
}

.song-controls {
    background-color: white;
    padding: 0.75rem;
    border-radius: 6px;
    border: 1px solid #dee2e6;
}

.play-pause-btn {
    min-width: 38px;
}

.audio-time {
    font-size: 0.875rem;
    color: #6c757d;
    white-space: nowrap;
}

.download-btn {
    white-space: nowrap;
}

.progress {
    background-color: #e9ecef;
}

.progress-bar {
    background-color: var(--primary-tan);
    transition: width 0.1s ease;
}

/* =================================
   Scripture & Poems
   ================================= */

.scripture-card {
    background-color: var(--light-tan);
    border: none;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.scripture-card .blockquote {
    font-family: var(--font-serif);
    font-size: 1.2rem;
    color: var(--text-dark);
}

.poem-card {
    background-color: white;
    border: 1px solid var(--primary-tan);
    margin-bottom: 2rem;
}

.poem-card h4 {
    color: var(--primary-green);
    font-family: var(--font-serif);
}

.poem-content {
    font-family: var(--font-serif);
    line-height: 1.8;
    white-space: pre-line;
}

/* =================================
   Funeral Program
   ================================= */

.program-page {
    cursor: pointer;
    transition: transform 0.3s ease;
}

.program-page:hover {
    transform: scale(1.02);
}

.program-page img {
    width: 100%;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

/* =================================
   Tribute Wall
   ================================= */

#tributeForm .form-control {
    border-color: var(--primary-tan);
}

#tributeForm .form-control:focus {
    border-color: var(--primary-green);
    box-shadow: 0 0 0 0.2rem rgba(27, 67, 50, 0.25);
}

/* Tribute Wall Column Layout */
#tributesDisplay {
    column-count: 2;
    column-gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.tribute-card {
    background-color: white;
    border: 1px solid var(--light-tan);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    margin-bottom: 1.5rem;
    break-inside: avoid;
    page-break-inside: avoid;
    -webkit-column-break-inside: avoid;
    display: inline-block;
    width: 100%;
}

.tribute-card h5 {
    color: var(--primary-green);
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
}

.tribute-date {
    color: var(--text-light);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.tribute-message {
    color: var(--text-dark);
    line-height: 1.6;
}

/* =================================
   Buttons
   ================================= */

.btn-primary {
    background-color: var(--primary-green);
    border-color: var(--primary-green);
}

.btn-primary:hover {
    background-color: var(--dark-green);
    border-color: var(--dark-green);
}

.btn-outline-primary {
    color: var(--primary-green);
    border-color: var(--primary-green);
}

.btn-outline-primary:hover {
    background-color: var(--primary-green);
    border-color: var(--primary-green);
}

/* =================================
   Back to Top Button
   ================================= */

#backToTop {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    display: none;
    z-index: 999;
    border: none;
    outline: none;
    background-color: var(--primary-green);
    cursor: pointer;
    padding: 0;
    border-radius: 50%;
    font-size: 20px;
    transition: background-color 0.3s;
}

#backToTop:hover {
    background-color: var(--dark-green);
}

/* =================================
   Footer
   ================================= */

footer {
    background-color: var(--primary-green) !important;
}

/* =================================
   Responsive Styles
   ================================= */

@media (max-width: 768px) {
    .hero-portrait {
        width: 200px;
        height: 200px;
    }
    
    .hero-section h2 {
        font-size: 2rem;
    }
    
    .section-title {
        font-size: 2rem;
    }
    
    #photoGrid img {
        height: 150px;
    }
}

/* =================================
   Loading States
   ================================= */

.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(27, 67, 50, 0.3);
    border-radius: 50%;
    border-top-color: var(--primary-green);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* =================================
   Lightbox Styles
   ================================= */

.lightbox-overlay {
    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;
    cursor: pointer;
}

.lightbox-container {
    position: relative;
    width: 90%;
    height: 90%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-image {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 40px;
    color: white;
    font-size: 40px;
    cursor: pointer;
    z-index: 10000;
}

.lightbox-close:hover {
    color: #ccc;
}

.lightbox-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    font-size: 30px;
    cursor: pointer;
    user-select: none;
    z-index: 10000;
    transition: all 0.3s ease;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.lightbox-arrow:hover {
    background-color: rgba(0, 0, 0, 0.9);
    transform: translateY(-50%) scale(1.1);
    border-color: rgba(255, 255, 255, 0.5);
}

.lightbox-arrow:active {
    transform: translateY(-50%) scale(0.95);
}

.lightbox-prev {
    left: 30px;
}

.lightbox-next {
    right: 30px;
}

/* Arrow icons with better visibility */
.lightbox-prev::after {
    content: '‹';
    margin-right: 2px;
}

.lightbox-next::after {
    content: '›';
    margin-left: 2px;
}

/* Navigation hint text */
.lightbox-nav-hint {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    text-align: center;
    background-color: rgba(0, 0, 0, 0.5);
    padding: 8px 20px;
    border-radius: 20px;
    z-index: 10000;
}

/* Photo counter */
.lightbox-counter {
    position: absolute;
    top: 20px;
    left: 20px;
    color: white;
    font-size: 16px;
    background-color: rgba(0, 0, 0, 0.5);
    padding: 8px 15px;
    border-radius: 20px;
    z-index: 10000;
}

@media (max-width: 768px) {
    .lightbox-arrow {
        width: 40px;
        height: 40px;
        font-size: 24px;
    }
    
    .lightbox-prev {
        left: 15px;
    }
    
    .lightbox-next {
        right: 15px;
    }
    
    .lightbox-nav-hint {
        font-size: 12px;
        padding: 6px 15px;
    }
    
    .lightbox-counter {
        font-size: 14px;
        padding: 6px 12px;
    }
    
    .lightbox-close {
        right: 20px;
        font-size: 35px;
    }
    
    /* Tribute wall responsive columns */
    #tributesDisplay {
        column-count: 1;
        column-gap: 1.5rem;
    }
}

/* Medium screens - adjust gap */
@media (min-width: 769px) and (max-width: 1199px) {
    #tributesDisplay {
        max-width: 900px;
        column-gap: 2rem;
    }
}

/* Large screens - wider columns */
@media (min-width: 1400px) {
    #tributesDisplay {
        max-width: 1400px;
        column-gap: 3rem;
    }
}
