.nav-toggle { display: none; background: rgba(255,255,255,0.92); border: 1px solid rgba(0,0,0,0.08); cursor: pointer; padding: 8px 10px; border-radius: 999px; box-shadow: 0 6px 16px rgba(0,0,0,0.12); }
.nav-toggle .bar { display: block; width: 26px; height: 2.5px; background: var(--accent-color); margin: 5px 0; transition: transform .22s ease, opacity .22s ease, background-color .2s ease; border-radius: 2px; }

/* Animate hamburger to X when open */
.main-nav.open .nav-toggle .bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.main-nav.open .nav-toggle .bar:nth-child(2) { opacity: 0; }
.main-nav.open .nav-toggle .bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Mobile nav */
@media (max-width: 992px) {
  .nav-toggle { display: inline-block; }
  #primary-menu { display: none; flex-direction: column; align-items: stretch; width: 100%; opacity: 0; transform: translateY(-6px); transition: opacity .2s ease, transform .2s ease; }
  .main-nav.open #primary-menu {
    display: flex;
    position: absolute;
    top: 100%; left: 0; right: 0;
    background: var(--light-color);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    box-shadow: 0 12px 28px rgba(0,0,0,0.12);
    padding: .5rem 1rem 1rem;
    z-index: 1200;
    opacity: 1; transform: translateY(0);
  }
  .main-nav.open #primary-menu li { margin: .25rem 0; }
}

.link-like { background: none; border: 0; padding: 0; color: var(--text-light); text-decoration: underline; cursor: pointer; font: inherit; }
/* Base Styles */
:root {
    --primary-color: #1f1f1f;
    --secondary-color: #6b6b6b;
    --accent-color: #c8a23a; /* elegant gold, slightly deeper */
    --light-color: #f9f7f2; /* soft ivory */
    --dark-color: #2a2a2a;
    --text-color: #222;
    --text-light: #6c757d;
    --font-heading: 'Playfair Display', serif;
    --font-body: 'Montserrat', sans-serif;
    --font-script: 'Fleur De Leah', cursive;
    --transition: all 0.3s ease;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --border-radius: 4px;
}

/* Dark theme overrides */
[data-theme="dark"] {
    --light-color: #171717;
    --text-color: #e6e6e6;
    --text-light: #b5b5b5;
    --primary-color: #ececec;
    --dark-color: #0f0f0f;
    background: #0f0f0f;
    color: var(--text-color);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    font-size: 17px;
    line-height: 1.7;
    color: var(--text-color);
    background-color: #fff;
    overflow-x: hidden;
    padding-top: 36px; /* offset for fixed nav */
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 500;
    line-height: 1.2;
    margin-bottom: 1rem;
    color: var(--primary-color);
}

a {
    color: var(--primary-color);
    text-decoration: underline;
    transition: var(--transition);
}

a:hover {
    color: var(--accent-color);
    text-decoration-color: var(--accent-color);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.section {
    padding: 5rem 0;
}

.section h2 {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 3rem;
    position: relative;
    padding-bottom: 1rem;
}

.section h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 3px;
    background: linear-gradient(90deg, rgba(212,175,55,0) 0%, rgba(212,175,55,1) 50%, rgba(212,175,55,0) 100%);
}

.bg-light {
    background-color: var(--light-color);
}

.btn {
    display: inline-block;
    background-color: var(--accent-color);
    color: white;
    padding: 0.8rem 2rem;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 1rem;
    text-align: center;
    transition: var(--transition);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 500;
}

.btn:hover {
    background-color: #b88a22; /* darker gold for hover */
    color: #fff;
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.btn-outline {
    background-color: transparent;
    border: 2px solid var(--accent-color);
    color: var(--accent-color);
}

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

/* Header */
.hero {
    background: linear-gradient(rgba(0, 0, 0, 0.62), rgba(0, 0, 0, 0.62)), url('../images/hero-bg.jpg') no-repeat center center/cover;
    color: white;
    text-align: center;
    padding: 8rem 0;
    position: relative;
}

.hero h1 {
    font-size: 4rem;
    margin-bottom: 1rem;
    color: #ffffff;
    font-weight: 500;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.RememberingRosyTitle {
    font-family: var(--font-script);
    font-weight: 400;
    font-size: clamp(25px, 5vw, 3rem);
    color: var(--text-color);
    letter-spacing: 1px;
    position: relative;
    display: inline-block;
}

.hero-name {
    font-family: var(--font-script);
    font-weight: 400;
    font-size: clamp(3rem, 7vw, 6rem);
    color: #fff;
    letter-spacing: 1px;
    position: relative;
    display: inline-block;
}

.hero-name::after {
    content: "";
    display: block;
    width: 180px;
    height: 2px;
    background: linear-gradient(90deg, rgba(212,175,55,0) 0%, rgba(212,175,55,1) 50%, rgba(212,175,55,0) 100%);
    margin: .5rem auto 0;
}

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

.hero .subtitle {
    font-size: 1.4rem;
    font-style: italic;
    font-weight: 300;
    max-width: 800px;
    margin: 0 auto;
    color: #ececec;
}

/* Navigation */
.main-nav {
    background: rgba(255,255,255,0.85);
    -webkit-backdrop-filter: saturate(140%) blur(8px);
    backdrop-filter: saturate(140%) blur(8px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1200;
}

.main-nav .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.main-nav ul {
    display: flex;
    justify-content: center;
    list-style: none;
    padding: 5px 0;
    margin: 0;
    flex-wrap: wrap;
}

.main-nav li {
    margin: 0 1rem;
}

.main-nav a {
    color: var(--primary-color);
    font-weight: 500;
    padding: 0.5rem 0;
    position: relative;
    text-transform: uppercase;
    font-size: 0.9rem;
    letter-spacing: 1px;
}

.main-nav a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--accent-color);
    transition: var(--transition);
}

.main-nav a:hover::after,
.main-nav a:focus::after {
    width: 100%;
}

/* Obituary Section */
.obituary-content {
    display: flex;
    flex-wrap: wrap;
    gap: 3rem;
    align-items: center;
}

.obituary-image {
    flex: 1;
    min-width: 300px;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.obituary-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.obituary-image:hover img {
    transform: scale(1.03);
}

.obituary-text {
    flex: 2;
    min-width: 300px;
}

.obituary-text p {
    margin-bottom: 1.25rem;
    font-size: 1.05rem;
    line-height: 1.85;
    color: #2a2a2a;
}

/* Gallery Section */
.gallery-grid {
    margin-top: 2rem;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
}

/* Masonry variant */
.gallery-grid.masonry {
    column-count: 4;
    column-gap: 1rem;
    display: block;
}

@media (max-width: 1200px) { .gallery-grid.masonry { column-count: 3; } }
@media (max-width: 900px) { .gallery-grid.masonry { column-count: 2; } }
@media (max-width: 600px) { .gallery-grid.masonry { column-count: 1; } }

.gallery-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 1rem;
}

.gallery-item {
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition);
    aspect-ratio: 1;
}

.gallery-grid.masonry .gallery-item {
    break-inside: avoid;
    margin: 0 0 1rem;
    aspect-ratio: auto;
}

.gallery-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

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

/* Memories Section */
.gallery-caption {
    padding: .6rem .8rem;
    background: rgba(0,0,0,0.04);
    color: var(--text-light);
    font-size: .9rem;
}

.gallery-credit {
    font-size: .8rem;
    color: var(--text-light);
}

.memory-wall {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.memory-card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    border: 1px solid rgba(0,0,0,0.06);
    transition: var(--transition);
}

.memory-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.memory-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #eee;
}

.memory-name {
    font-weight: 600;
    color: var(--primary-color);
}

.memory-date {
    font-size: 0.8rem;
    color: var(--text-light);
}

.memory-content p {
    margin-bottom: 0;
    line-height: 1.7;
}

.memory-photo, .memory-video {
    margin-top: 1rem;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.memory-video video {
    width: 100%;
    height: auto;
    display: block;
}

.media-caption {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-top: 0.5rem;
}

/* Share Memory Form */
.memory-form {
    max-width: 700px;
    margin: 0 auto;
    background: white;
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-color);
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    font-family: var(--font-body);
    font-size: 1rem;
    transition: var(--transition);
}

.form-group input[type="text"]:focus,
.form-group input[type="email"]:focus,
.form-group textarea:focus {
    border-color: var(--accent-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(176, 162, 149, 0.2);
}

.form-group textarea {
    resize: vertical;
    min-height: 150px;
}

.checkbox-container {
    display: flex;
    align-items: center;
    position: relative;
    padding-left: 35px;
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
}

.checkbox-container input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    position: absolute;
    top: 0;
    left: 0;
    height: 25px;
    width: 25px;
    background-color: #eee;
    border-radius: 3px;
    transition: var(--transition);
}

.checkbox-container:hover input ~ .checkmark {
    background-color: #ddd;
}

.checkbox-container input:checked ~ .checkmark {
    background-color: var(--accent-color);
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
}

.checkbox-container input:checked ~ .checkmark:after {
    display: block;
}

.checkbox-container .checkmark:after {
    left: 9px;
    top: 5px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* Donation Section */
.donation-options {
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
}

.donation-options p {
    margin-bottom: 2rem;
    font-size: 1.1rem;
}

.charities {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.charity {
    background: white;
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.charity:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.charity h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.charity p {
    margin-bottom: 1.5rem;
    color: var(--text-light);
}

/* Footer */
.footer {
    background-color: var(--primary-color);
    color: white;
    text-align: center;
    padding: 2rem 0;
    font-size: 0.9rem;
}

.footer p {
    margin-bottom: 0.5rem;
}

/* Theme selector */
.theme-selector {
    margin-top: .5rem;
    display: inline-flex;
    gap: .5rem;
}
.theme-btn {
    appearance: none;
    border: 1px solid rgba(0,0,0,0.15);
    background: #fff;
    color: var(--primary-color);
    padding: .35rem .7rem;
    border-radius: 999px;
    font: inherit;
    cursor: pointer;
    transition: background-color .2s ease, color .2s ease, border-color .2s ease;
}
.theme-btn:hover { border-color: var(--accent-color); }
.theme-btn.active,
.theme-btn[aria-pressed="true"] {
    background: var(--accent-color);
    color: #fff;
    border-color: var(--accent-color);
}

/* Notification */
.notification {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: #4caf50;
    color: white;
    padding: 1rem 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    transform: translateY(100px);
    opacity: 0;
    transition: var(--transition);
    z-index: 1000;
}

.notification.show {
    transform: translateY(0);
    opacity: 1;
}

/* Slideshow Modal */
.slideshow-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.85);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.slideshow-modal.open { display: flex; }

.slideshow-stage {
    width: min(92vw, 1200px);
    height: min(78vh, 850px);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 30px 80px rgba(0,0,0,0.4);
    background: #000;
}

.slideshow-stage img,
.slideshow-stage video {
    position: absolute;
    inset: 0;
    transition: opacity .4s ease;
}

/* Images should always cover to avoid letterboxing */
.slideshow-stage img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Keep videos contained to preserve full frame */
.slideshow-stage video {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* Ken Burns animation for images */
.kenburns {
    animation: kenburns 18s linear infinite alternate;
    will-change: transform;
}

@keyframes kenburns {
    0% { transform: scale(1.18) translate3d(-3%, -2%, 0); }
    100% { transform: scale(1.35) translate3d(3%, 2%, 0); }
}

/* Variant keyframes for variety */
.kenburns-a { animation: kenburns-a 18s linear infinite alternate; will-change: transform; }
.kenburns-b { animation: kenburns-b 18s linear infinite alternate; will-change: transform; }
.kenburns-c { animation: kenburns-c 18s linear infinite alternate; will-change: transform; }

@keyframes kenburns-a {
    0% { transform: scale(1.18) translate3d(-4%, -2%, 0); }
    100% { transform: scale(1.35) translate3d(4%, 2%, 0); }
}

@keyframes kenburns-b {
    0% { transform: scale(1.2) translate3d(3%, -3%, 0); }
    100% { transform: scale(1.36) translate3d(-3%, 3%, 0); }
}

@keyframes kenburns-c {
    0% { transform: scale(1.16) translate3d(0, 4%, 0); }
    100% { transform: scale(1.34) translate3d(0, -4%, 0); }
}

.slideshow-caption {
    position: absolute;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%);
    color: #f1f1f1;
    font-family: var(--font-heading);
    font-size: 1.1rem;
    text-align: center;
    background: rgba(0,0,0,0.45);
    padding: .6rem 1rem;
    border-radius: 6px;
    max-width: 80vw;
}

.slideshow-caption small {
    display: block;
    font-size: .85rem;
    color: #d9d9d9;
    margin-top: .2rem;
}

.slideshow-close {
    position: absolute;
    top: 18px;
    right: 18px;
    font-size: 2rem;
    color: #fff;
    background: transparent;
    border: none;
    cursor: pointer;
}

.slideshow-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: #fff;
    background: rgba(255,255,255,0.15);
    border: none;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.5rem;
    display: grid;
    place-items: center;
    transition: background .2s ease, transform .2s ease;
}

.slideshow-nav:hover { background: rgba(255,255,255,0.25); transform: translateY(-50%) scale(1.05); }
.slideshow-nav.prev { left: 24px; }
.slideshow-nav.next { right: 24px; }

.slideshow-dots {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
}

.slideshow-dots button {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.4);
    cursor: pointer;
}

.slideshow-dots button.active { background: #fff; }

.slideshow-autoplay { position: absolute; top: 18px; left: 18px; }

/* Responsive Design */
@media (max-width: 992px) {
    .hero h1 {
        font-size: 3rem;
        color: #ffffff;
    }

    .RememberingRosyTitle {
        color: var(--light-color);
    }

    .section {
        padding: 4rem 0;
    }
    
    .obituary-content {
        flex-direction: column;
    }
    
    .obituary-image {
        width: 100%;
        max-width: 500px;
        margin: 0 auto 2rem;
    }
}

@media (max-width: 768px) {
    /* Place hamburger elegantly over hero */
    body { padding-top: 0; }
    .main-nav { background: transparent; box-shadow: none; }
    .main-nav .container { position: relative; }
    .nav-toggle { position: absolute; right: -4px; top: -4px; }
    /* Fullscreen dropdown overlay */
    .main-nav.open #primary-menu {
        position: fixed;
        top: 56px; left: 12px; right: 12px;
        border-radius: 10px;
        background: var(--dark-color);
        -webkit-backdrop-filter: blur(12px);
        backdrop-filter: blur(12px);
        padding: .75rem 1rem 1rem;
    }
    .hero {
        padding: 6rem 0;
    }
    
    .hero h1 {
        font-size: 2.5rem;
    }
    
    .hero .subtitle {
        font-size: 1.2rem;
    }
    
    .main-nav {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        background: rgba(0,0,0,0.5);
        -webkit-backdrop-filter: blur(10px);
        backdrop-filter: blur(10px);
        padding: 1rem;
        z-index: 1000;
    }
    
    .main-nav ul {
        flex-direction: column;
        align-items: center;
        padding: 0.5rem 0;
    }
    .main-nav li {
        margin: 0.3rem 0;
    }
    .main-nav a {
        color: #fff;
        text-decoration: none;
        transition: color 0.2s ease;
    }
    .main-nav a:hover {
        color: #ccc;
    }
    
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
    
    .memory-wall {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 576px) {
    .hero h1 {
        font-size: 2rem;
    }
    
    .hero .dates {
        font-size: 1.2rem;
    }
    
    .hero .subtitle {
        font-size: 1rem;
    }
    
    .section h2 {
        font-size: 2rem;
    }
    
    .memory-form {
        padding: 1.5rem;
    }
}

/* Print Styles */
@media print {
    .main-nav,
    .btn,
    .memory-form,
    .footer {
        display: none !important;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.5;
        color: #000;
        background: #fff;
    }
    
    .container {
        width: 100%;
        padding: 0;
    }
    
    .section {
        padding: 2rem 0;
        page-break-inside: avoid;
    }
    
    .hero {
        padding: 3rem 0;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    
    a {
        text-decoration: none;
        color: #000;
    }
    
    .gallery-grid {
        display: none;
    }
}
