/* MemoryMantle — memorial-preview component
 *
 * Used to render the "See a Memory Mantle in Action" Joe Soap demo on
 * landing pages (coming-soon.html, index.html). Pair with
 * /js/memorial-preview.js for the photo lightbox.
 *
 * Markup contract:
 *
 *   <div class="memorial-preview-container">
 *     <div class="preview-hero">
 *       <div class="preview-photo" style="background-image: url(...)"></div>
 *       <h2 class="preview-name">…</h2>
 *       <div class="preview-dates">…</div>
 *       <p class="preview-quote">…</p>
 *     </div>
 *     <div class="preview-content">
 *       <div class="preview-section">
 *         <h3 class="preview-section-title">…</h3>
 *         <p class="preview-text">…</p>
 *       </div>
 *       <div class="preview-section">
 *         <h3 class="preview-section-title">…</h3>
 *         <div class="preview-timeline">
 *           <div class="timeline-preview-item">
 *             <div class="timeline-content">
 *               <div class="timeline-year">…</div>
 *               <div class="timeline-event">…</div>
 *               <div class="timeline-desc">…</div>
 *             </div>
 *             <div class="timeline-photo-container">
 *               <img class="timeline-preview-photo"
 *                    onclick="openPreviewPhoto(this.src)"
 *                    src="…">
 *             </div>
 *           </div>
 *         </div>
 *       </div>
 *       <div class="preview-section">
 *         <h3 class="preview-section-title">…</h3>
 *         <div class="preview-gallery">
 *           <div class="preview-gallery-item"
 *                onclick="openPreviewPhoto('…')">
 *             <img src="…" alt="…">
 *           </div>
 *         </div>
 *       </div>
 *     </div>
 *   </div>
 *
 * Plus once per page (anywhere in <body>):
 *
 *   <div class="photo-modal" id="photo-modal" onclick="closePhotoModal()">
 *     <button class="photo-modal-close" onclick="closePhotoModal()">
 *       <i class="fas fa-times"></i>
 *     </button>
 *     <img id="modal-photo" src="" alt="Full size photo">
 *   </div>
 */

.memorial-preview-container {
    background: white;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 4px 30px rgba(0,0,0,0.1);
}

.preview-hero {
    background: linear-gradient(135deg, #142a20 0%, #234737 100%);
    color: white;
    padding: 3rem 2rem;
    text-align: center;
}

.preview-photo {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background-size: cover;
    background-position: center;
    margin: 0 auto 1.5rem;
    border: 4px solid white;
    box-shadow: 0 8px 30px rgba(0,0,0,0.3);
}

.preview-name {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.preview-dates {
    font-size: 1.1rem;
    opacity: 0.9;
    margin-bottom: 1rem;
}

.preview-quote {
    font-style: italic;
    opacity: 0.85;
    max-width: 500px;
    margin: 0 auto;
}

.preview-content {
    padding: 2rem;
}

.preview-section {
    margin-bottom: 2rem;
}

.preview-section-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.preview-text {
    color: #666666;
    line-height: 1.7;
}

.preview-timeline {
    position: relative;
    padding: 2rem 0;
    max-width: 900px;
    margin: 0 auto;
}

/* Center vertical line */
.preview-timeline::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(180deg, #f5edd8 0%, #e8d5b0 50%, #f5edd8 100%);
    transform: translateX(-50%);
}

.timeline-preview-item {
    position: relative;
    margin-bottom: 3rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: center;
}

.timeline-preview-item:last-child {
    margin-bottom: 0;
}

/* Timeline dot in center */
.timeline-preview-item::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 16px;
    height: 16px;
    background: #234737;
    border-radius: 50%;
    border: 4px solid white;
    box-shadow: 0 0 0 3px #234737;
    transform: translate(-50%, -50%);
    z-index: 10;
}

.timeline-content {
    padding: 1.5rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    border: 1px solid #e8e4df;
    transition: all 0.3s;
    position: relative;
}

.timeline-content:hover {
    box-shadow: 0 4px 20px rgba(0,0,0,0.12);
    border-color: #cbd5e1;
}

.timeline-content::after {
    content: '';
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-style: solid;
}

.timeline-preview-item:nth-child(odd) .timeline-content::after {
    right: -10px;
    border-width: 8px 0 8px 10px;
    border-color: transparent transparent transparent white;
}

.timeline-preview-item:nth-child(even) .timeline-content::after {
    left: -10px;
    border-width: 8px 10px 8px 0;
    border-color: transparent white transparent transparent;
}

.timeline-photo-container {
    position: relative;
}

.timeline-preview-item:nth-child(odd) .timeline-content {
    grid-column: 1;
    text-align: right;
}

.timeline-preview-item:nth-child(odd) .timeline-photo-container {
    grid-column: 2;
}

.timeline-preview-item:nth-child(even) .timeline-content {
    grid-column: 2;
    grid-row: 1;
    text-align: left;
}

.timeline-preview-item:nth-child(even) .timeline-photo-container {
    grid-column: 1;
    grid-row: 1;
}

.timeline-year {
    font-weight: 700;
    color: #2a2a2a;
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.timeline-event {
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

.timeline-desc {
    color: #6b7280;
    font-size: 0.9rem;
    line-height: 1.6;
}

.timeline-preview-photo {
    width: 100%;
    height: auto;
    aspect-ratio: 4/3;
    object-fit: cover;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}

.timeline-preview-photo:hover {
    transform: scale(1.03);
    box-shadow: 0 8px 25px rgba(0,0,0,0.25);
}

/* Gallery — square thumbnails in a 4-up grid */
.preview-gallery {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
}

.preview-gallery-item {
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s;
}

.preview-gallery-item:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.preview-gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Photo lightbox modal */
.photo-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.95);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.photo-modal.active {
    display: flex;
}

.photo-modal img {
    max-width: 95%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.5);
}

.photo-modal-close {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    background: white;
    border: none;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

.photo-modal-close:hover {
    background: #f0ede8;
    transform: scale(1.1);
}

/* Mobile — collapse the alternating-side timeline into a single column.
 * Hide the center dot/arrows; cards stack with photos beneath. */
@media (max-width: 768px) {
    .timeline-preview-item {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .timeline-preview-item::before {
        left: 10px;
        top: 10px;
        transform: none;
        width: 14px;
        height: 14px;
    }

    .timeline-content::after {
        display: none;
    }

    .timeline-preview-item:nth-child(odd) .timeline-content,
    .timeline-preview-item:nth-child(even) .timeline-content {
        grid-column: 1;
        grid-row: auto;
        text-align: left;
    }

    .timeline-preview-item:nth-child(odd) .timeline-photo-container,
    .timeline-preview-item:nth-child(even) .timeline-photo-container {
        grid-column: 1;
        grid-row: auto;
    }

    .preview-gallery {
        grid-template-columns: repeat(2, 1fr);
    }

    .preview-hero {
        padding: 2rem 1.25rem;
    }

    .preview-content {
        padding: 1.25rem;
    }
}
