:root {
    /* Updated Navy to 'pop' more - a richer, more vibrant deep blue */
    --navy: #00356B;
    --cream: #F9F7F2;
    /* Beige top/bottom, white middle */
    --beige-gradient: linear-gradient(180deg, #EFEAD8 0%, #FFFFFF 50%, #EFEAD8 100%);
    --gold-accent: #C5A059; /* A subtle gold for accents if needed */
    --text-color: #00356B;
}

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

body {
    font-family: 'Cormorant Garamond', serif;
    background: var(--beige-gradient);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    overflow-x: hidden;
}

.tribute-container {
    width: 100%;
    max-width: 800px;
    padding: 2rem;
}

.content-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2.5rem;
    opacity: 0; /* For fade-in animation */
    transform: translateY(20px);
    transition: opacity 1.5s ease-out, transform 1.5s ease-out;
}

.content-wrapper.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Typography */
.main-quote {
    font-size: 2.5rem;
    font-weight: 600;
    color: var(--navy);
    margin-bottom: 0.5rem;
    line-height: 1.2;
    font-style: italic;
}

.sub-quote {
    font-size: 1.35rem;
    font-weight: 400;
    color: var(--navy);
    opacity: 0.8;
}

/* Portrait Section */
.image-frame {
    position: relative;
    width: 300px;
    height: 300px; /* Circular or rounded square based on preference, image implies cutout/transparent */
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto;
}

.placeholder-image {
    width: 280px;
    height: 350px;
    background-color: rgba(14, 28, 54, 0.1);
    border: 2px solid var(--navy);
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 150px 150px 0 0; /* Arch shape as seen in some tributes, or just rounded */
    color: var(--navy);
    font-family: 'Montserrat', sans-serif;
    font-size: 0.9rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
}

/* If user adds an image later */
.portrait-img {
    width: 100%;
    height: auto;
    max-height: 400px;
    object-fit: contain;
    mask-image: linear-gradient(to bottom, black 85%, transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, black 85%, transparent 100%);
    filter: drop-shadow(0 10px 15px rgba(0, 53, 107, 0.15)); /* Adds a subtle blue shadow to make it pop */
}

/* Details Section */
.name {
    font-size: 1.8rem;
    font-weight: 600;
    color: var(--navy);
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    font-family: 'Montserrat', sans-serif; /* Clean contrast for name */
}

.divider {
    width: 60px;
    height: 2px;
    background-color: var(--navy);
    margin: 1rem auto;
    opacity: 0.3;
}

.dates {
    font-size: 1.2rem;
    font-family: 'Cormorant Garamond', serif;
    color: var(--navy);
    font-weight: 500;
}

/* Responsive Adjustments */
@media (max-width: 600px) {
    .tribute-container {
        padding-top: 4rem;
    }

    .main-quote {
        font-size: 2rem;
    }

    .sub-quote {
        font-size: 1.1rem;
    }

    .name {
        font-size: 1.4rem;
    }

    .image-frame {
        width: 250px;
        height: 300px;
    }

    .placeholder-image {
        width: 240px;
        height: 300px;
    }

    .top-nav {
        padding: 1rem;
    }
}

/* Memory Form Page Styles */
.top-nav {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    padding: 2rem;
    text-align: left;
    z-index: 10;
}

.back-link {
    text-decoration: none;
    color: var(--navy);
    font-family: 'Montserrat', sans-serif;
    font-size: 0.9rem;
    letter-spacing: 1px;
    font-weight: 500;
    transition: opacity 0.3s ease;
}

.back-link:hover {
    opacity: 0.7;
}

.form-section {
    width: 100%;
    max-width: 600px;
    margin-top: 1rem;
}

.memory-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    text-align: left;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-family: 'Montserrat', sans-serif;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--navy);
    letter-spacing: 0.5px;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="tel"],
.form-group textarea {
    padding: 1rem;
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(0, 53, 107, 0.2);
    border-radius: 4px;
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.1rem;
    color: var(--navy);
    transition: border-color 0.3s ease, background 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--navy);
    background: rgba(255, 255, 255, 0.9);
}

.checkbox-group {
    flex-direction: row;
    align-items: start;
    gap: 0.8rem;
}

.checkbox-group input[type="checkbox"] {
    margin-top: 0.2rem;
    width: 1.2rem;
    height: 1.2rem;
    cursor: pointer;
    accent-color: var(--navy);
}

.checkbox-group label {
    font-size: 0.85rem;
    line-height: 1.4;
    font-weight: 400;
    cursor: pointer;
}

.file-upload-wrapper {
    position: relative;
    width: 100%;
    height: 100px;
    border: 1px dashed rgba(0, 53, 107, 0.3);
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.4);
    transition: background 0.3s ease;
}

.file-upload-wrapper:hover {
    background: rgba(255, 255, 255, 0.7);
}

.file-upload-wrapper input[type="file"] {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}

.upload-placeholder {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: var(--navy);
    font-family: 'Montserrat', sans-serif;
    font-size: 0.9rem;
    pointer-events: none;
}

.submit-btn {
    margin-top: 1rem;
    padding: 1rem 2rem;
    background-color: var(--navy);
    color: var(--cream);
    border: none;
    font-family: 'Montserrat', sans-serif;
    font-size: 1rem;
    font-weight: 500;
    letter-spacing: 1px;
    cursor: pointer;
    transition: opacity 0.3s ease, transform 0.2s ease;
    align-self: center;
    min-width: 200px;
}

.submit-btn:hover {
    opacity: 0.9;
    transform: translateY(-2px);
}

/* Link styling for index page */
.share-memory-link {
    margin-top: 2rem;
    display: inline-block;
    text-decoration: none;
    padding: 1rem 2rem;
    background-color: var(--navy);
    color: var(--cream);
    font-family: 'Montserrat', sans-serif;
    font-size: 0.95rem;
    font-weight: 500;
    letter-spacing: 1px;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.share-memory-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 53, 107, 0.25);
}

.share-memory-link:active {
    transform: translateY(0);
}

/* ========================================
   Entry Overlay
   ======================================== */
.entry-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, #EFEAD8 0%, #F9F7F2 50%, #EFEAD8 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 1;
    transition: opacity 0.8s ease, visibility 0.8s ease;
}

.entry-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.entry-content {
    text-align: center;
    animation: fadeInUp 1s ease;
}

.entry-icon {
    font-size: 3.5rem;
    margin-bottom: 1.5rem;
    animation: flicker 3s ease-in-out infinite;
}

@keyframes flicker {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.entry-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: 2.5rem;
    font-weight: 600;
    color: var(--navy);
    margin-bottom: 0.5rem;
    font-style: italic;
}

.entry-subtitle {
    font-family: 'Montserrat', sans-serif;
    font-size: 1rem;
    color: var(--navy);
    opacity: 0.7;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 2.5rem;
}

.enter-btn {
    padding: 1rem 2.5rem;
    background-color: var(--navy);
    color: var(--cream);
    border: none;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.95rem;
    font-weight: 500;
    letter-spacing: 1.5px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.enter-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 53, 107, 0.25);
}

.enter-btn:active {
    transform: translateY(0);
}

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

/* ========================================
   Sound Controls
   ======================================== */
.sound-controls {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    z-index: 100;
    padding: 0.5rem 0.75rem;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    border-radius: 50px;
    box-shadow: 0 2px 15px rgba(0, 53, 107, 0.1);
    opacity: 1;
    transition: opacity 0.5s ease;
}

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

/* Sound Wave Animation */
.sound-wave {
    display: flex;
    align-items: center;
    gap: 3px;
    height: 20px;
    padding: 0 4px;
}

.sound-wave .bar {
    width: 3px;
    height: 100%;
    background-color: var(--navy);
    border-radius: 3px;
    animation: soundWave 1s ease-in-out infinite;
}

.sound-wave .bar:nth-child(1) {
    height: 40%;
    animation-delay: 0s;
}

.sound-wave .bar:nth-child(2) {
    height: 70%;
    animation-delay: 0.1s;
}

.sound-wave .bar:nth-child(3) {
    height: 100%;
    animation-delay: 0.2s;
}

.sound-wave .bar:nth-child(4) {
    height: 60%;
    animation-delay: 0.3s;
}

.sound-wave .bar:nth-child(5) {
    height: 30%;
    animation-delay: 0.4s;
}

@keyframes soundWave {
    0%, 100% {
        transform: scaleY(0.5);
    }
    50% {
        transform: scaleY(1);
    }
}

/* Paused state - bars don't animate */
.sound-wave.paused .bar {
    animation-play-state: paused;
    transform: scaleY(0.3);
}

/* Mute Button */
.mute-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--navy);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    padding: 0;
}

.mute-btn:hover {
    background: rgba(0, 53, 107, 0.1);
}

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

.mute-btn .icon-sound-off {
    display: none;
}

.mute-btn.muted .icon-sound-on {
    display: none;
}

.mute-btn.muted .icon-sound-off {
    display: block;
}

/* Mobile adjustments for sound controls */
@media (max-width: 600px) {
    .sound-controls {
        top: 1rem;
        right: 1rem;
        padding: 0.4rem 0.6rem;
    }

    .sound-wave {
        height: 16px;
    }

    .sound-wave .bar {
        width: 2.5px;
    }

    .mute-btn {
        width: 32px;
        height: 32px;
    }

    .mute-btn svg {
        width: 18px;
        height: 18px;
    }

    .entry-title {
        font-size: 2rem;
    }

    .entry-icon {
        font-size: 3rem;
    }
}
