/* styles.css */
:root {
    --primary-color: #d4af37; /* Elegant Gold */
    --bg-dark: #0f172a; /* Rich dark slate */
    --bg-darker: #020617;
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --glass-bg: rgba(255, 255, 255, 0.05); /* slightly higher opacity for clarity over vibrant bg */
    --glass-border: rgba(255, 255, 255, 0.2);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Outfit', sans-serif;
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    background: var(--bg-darker);
}

/* Dynamic Fading Slideshow Background */
.dynamic-bg {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    z-index: -1;
    overflow: hidden;
    background: var(--bg-darker);
}

.bg-slide {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background-size: cover;
    background-position: center;
    opacity: 0;
    will-change: opacity, transform;
    animation: fadeSlideshow 30s infinite;
}

.bg-slide:nth-child(1) { animation-delay: 0s; }
.bg-slide:nth-child(2) { animation-delay: 6s; }
.bg-slide:nth-child(3) { animation-delay: 12s; }
.bg-slide:nth-child(4) { animation-delay: 18s; }
.bg-slide:nth-child(5) { animation-delay: 24s; }

@keyframes fadeSlideshow {
    0% { opacity: 0; transform: scale(1); }
    10% { opacity: 1; }
    20% { opacity: 1; transform: scale(1.05); }
    25% { opacity: 0; transform: scale(1.08); }
    100% { opacity: 0; transform: scale(1.1); }
}

.bg-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(15, 23, 42, 0.7); /* Dark semi-transparent overlay */
    backdrop-filter: blur(8px); /* Keeps it classy while making photos highly visible */
}

.hero {
    text-align: center;
    padding: 6rem 2rem 3rem;
}

.family-name {
    font-family: 'Playfair Display', serif;
    font-size: clamp(3rem, 6vw, 5rem);
    letter-spacing: 2px;
    background: linear-gradient(to right, #fef08a, var(--primary-color), #fef08a);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: fadeInDown 1.2s ease-out;
}

.divider {
    height: 3px;
    width: 100px;
    background: var(--primary-color);
    margin: 1.5rem auto 1rem;
    border-radius: 2px;
}

.contact-email {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 1.1rem;
    letter-spacing: 1px;
    opacity: 0.9;
    transition: opacity 0.3s;
}
.contact-email:hover {
    opacity: 1;
    text-shadow: 0 0 10px rgba(212,175,55,0.5);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 3rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    margin-bottom: 4rem;
}

.about-section h2, .tree-section h2 {
    font-family: 'Playfair Display', serif;
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    text-align: center;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.about-section p {
    font-size: 1.15rem;
    line-height: 1.8;
    color: var(--text-secondary);
    text-align: justify;
    margin-bottom: 1rem;
    text-shadow: 0 1px 2px rgba(0,0,0,0.8);
}

.tree-section .subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    font-style: italic;
}

.tree-wrapper {
    min-height: 600px;
    display: flex;
    justify-content: flex-start; /* Prevents left-side cutoff on large trees */
    align-items: flex-start;
    padding: 2rem;
    overflow-x: auto;
}

/* Ensure the root node stays centered if it doesn't overflow */
.tree-wrapper > .tree-node-wrapper {
    margin: 0 auto;
}

/* Tree Styles */
.tree-node-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    padding: 0 1rem;
    transition: all 0.5s ease;
}

/* Connectors */
.children-container {
    display: flex;
    justify-content: center;
    margin-top: 3rem;
    position: relative;
    padding-top: 2rem;
}

.children-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    width: 2px;
    height: 2rem;
    background: var(--primary-color);
    transform: translateX(-50%);
}

.child-wrapper {
    position: relative;
    padding: 0 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.child-wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    width: 2px;
    height: 2rem;
    background: var(--primary-color);
    transform: translateX(-50%);
}

.child-wrapper:only-child::after, .child-wrapper:only-child::before {
    display: none;
}
.children-container.single-child::before {
    display: none;
}
.children-container.single-child {
    padding-top: 0;
}

/* Top Horizontal Line connecting siblings */
.children-container > .child-wrapper:first-child::after {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    width: 50%;
    height: 2px;
    background: var(--primary-color);
}
.children-container > .child-wrapper:last-child::after {
    content: '';
    position: absolute;
    top: 0;
    right: 50%;
    width: 50%;
    height: 2px;
    background: var(--primary-color);
}
.children-container > .child-wrapper:not(:first-child):not(:last-child)::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--primary-color);
}

.person-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 2;
    background: rgba(15, 23, 42, 0.9);
    padding: 1rem;
    border-radius: 16px;
    border: 1px solid var(--glass-border);
}

.person-card:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 10px 20px rgba(212, 175, 55, 0.3);
    border-color: var(--primary-color);
}

.couple-container {
    display: flex;
    gap: 1.5rem;
    position: relative;
    cursor: pointer;
}

/* Couple connector line */
.couple-container::after {
    content: '';
    position: absolute;
    top: 40px; /* middle of 80px avatar */
    left: 50%;
    width: 1.5rem;
    height: 2px;
    background: var(--primary-color);
    transform: translateX(-50%);
    z-index: 1;
}
.couple-container.single::after {
    display: none;
}

.avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--primary-color);
    background-color: var(--bg-dark);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

.person-name {
    font-weight: 600;
    font-size: 1rem;
    text-align: center;
    color: var(--text-primary);
}

.role-tag {
    font-size: 0.75rem;
    color: var(--primary-color);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.expand-hint {
    margin-top: 10px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    opacity: 0;
    transition: opacity 0.3s;
}

.tree-node-wrapper.has-children > .couple-container:hover .expand-hint {
    opacity: 1;
}

.children-container.hidden {
    display: none;
}

footer {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
    border-top: 1px solid var(--glass-border);
    margin-top: auto;
    position: relative;
    z-index: 10;
}

.location-container {
    margin-bottom: 1.5rem;
}

.location-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(212, 175, 55, 0.1);
    color: var(--primary-color) !important;
    padding: 0.75rem 1.5rem;
    border-radius: 30px;
    border: 1px solid var(--primary-color);
    text-decoration: none !important;
    font-weight: 600;
    transition: all 0.3s ease;
}

.location-btn svg {
    width: 20px;
    height: 20px;
}

.location-btn:hover {
    background: var(--primary-color);
    color: var(--bg-darker) !important;
    box-shadow: 0 5px 15px rgba(212, 175, 55, 0.4);
    transform: translateY(-2px);
}

footer p a {
    color: var(--primary-color);
    text-decoration: none;
}

footer p a:hover {
    text-decoration: underline;
}

/* Animations */
@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-30px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInScale {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

/* Modals & Events */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.modal.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-content {
    position: relative;
    max-width: 500px;
    width: 90%;
    padding: 2rem;
    background: var(--bg-dark);
    border: 1px solid var(--primary-color);
    box-shadow: 0 25px 50px rgba(0,0,0,0.8);
    border-radius: 20px;
    animation: fadeInDown 0.3s ease-out;
}

.close-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 28px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: color 0.3s;
}

.close-btn:hover {
    color: var(--primary-color);
}

.bio-text {
    line-height: 1.6;
    color: var(--text-secondary);
    text-align: justify;
}

/* Events Section */
.events-section {
    padding: 2rem 0;
    margin-bottom: 4rem;
}
.events-section h2 {
    font-family: 'Playfair Display', serif;
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 2rem;
    text-align: center;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}
.events-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.event-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    padding: 2rem;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
    backdrop-filter: blur(16px);
}

.event-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(212, 175, 55, 0.4);
}

.event-card h3 {
    margin-bottom: 10px;
    color: var(--primary-color);
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
}

.gallery-modal-content {
    max-width: 1000px;
    max-height: 90vh;
    overflow-y: auto;
    padding-right: 1.5rem; /* space for custom scrollbar */
}

/* Custom scrollbar for gallery modal */
.gallery-modal-content::-webkit-scrollbar {
    width: 6px;
}
.gallery-modal-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}
.gallery-modal-content::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 3px;
}

.photo-gallery {
    columns: 1;
    gap: 20px;
}

@media (min-width: 600px) {
    .photo-gallery { columns: 2; }
}

@media (min-width: 900px) {
    .photo-gallery { columns: 3; }
}

.photo-wrapper {
    break-inside: avoid;
    margin-bottom: 20px;
    position: relative;
    border-radius: 16px;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.6s cubic-bezier(0.165, 0.84, 0.44, 1) forwards;
    cursor: pointer;
    box-shadow: 0 8px 25px rgba(0,0,0,0.5);
    border: 1px solid var(--glass-border);
    transition: border-color 0.4s ease, box-shadow 0.4s ease;
}

.photo-wrapper img {
    width: 100%;
    display: block;
    height: auto;
    transition: transform 0.6s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.photo-wrapper:hover {
    border-color: var(--primary-color);
    box-shadow: 0 10px 30px rgba(212, 175, 55, 0.3);
}

.photo-wrapper:hover img {
    transform: scale(1.08);
}

.photo-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0) 50%);
    opacity: 0;
    transition: opacity 0.4s ease;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    padding-bottom: 2rem;
}

.photo-wrapper:hover .photo-overlay {
    opacity: 1;
}

.photo-overlay span {
    color: var(--primary-color);
    font-size: 2rem;
    transform: translateY(20px);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    text-shadow: 0 0 15px rgba(212, 175, 55, 0.8);
}

.photo-wrapper:hover .photo-overlay span {
    transform: translateY(0);
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
