/* --- Base & Scrollbar --- */
:root {
    --dark-bg: #0f0c29;
    --mid-bg: #302b63;
    --light-bg: #24243e;
    --gold-text: #FFD700;
    --light-text: #E0E0E0;
    --glow-color: rgba(255, 215, 0, 0.5);
}

::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: var(--dark-bg);
}

::-webkit-scrollbar-thumb {
    background-color: var(--gold-text);
    border-radius: 20px;
    border: 2px solid var(--dark-bg);
}

body {
    font-family: 'Lato', sans-serif;
    background-color: var(--dark-bg);
    color: var(--light-text);
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

/* --- Animated Starry Background --- */
#star-background {
    position: fixed;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: -1;
    background: 
        radial-gradient(ellipse at top, rgba(255, 20, 147, 0.1) 0%, transparent 50%),
        radial-gradient(ellipse at bottom, #1b2735 0%, #090a0f 100%);
    animation: backgroundShift 20s ease-in-out infinite alternate;
}

@keyframes backgroundShift {
    0% { 
        background: 
            radial-gradient(ellipse at top, rgba(255, 20, 147, 0.1) 0%, transparent 50%),
            radial-gradient(ellipse at bottom, #1b2735 0%, #090a0f 100%);
    }
    50% { 
        background: 
            radial-gradient(ellipse at top left, rgba(255, 215, 0, 0.05) 0%, transparent 50%),
            radial-gradient(ellipse at bottom right, #2d1b69 0%, #0f0c29 100%);
    }
    100% { 
        background: 
            radial-gradient(ellipse at top right, rgba(138, 43, 226, 0.08) 0%, transparent 50%),
            radial-gradient(ellipse at bottom left, #24243e 0%, #090a0f 100%);
    }
}

/* Floating particles */
.floating-particles {
    position: absolute;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.particle {
    position: absolute;
    display: block;
    pointer-events: none;
    width: 6px;
    height: 6px;
    background: rgba(255, 215, 0, 0.6);
    border-radius: 50%;
    animation: float 15s infinite linear;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
}

.particle:nth-child(1) { left: 10%; animation-delay: 0s; animation-duration: 15s; }
.particle:nth-child(2) { left: 20%; animation-delay: 2s; animation-duration: 18s; }
.particle:nth-child(3) { left: 30%; animation-delay: 4s; animation-duration: 12s; }
.particle:nth-child(4) { left: 40%; animation-delay: 6s; animation-duration: 20s; }
.particle:nth-child(5) { left: 50%; animation-delay: 8s; animation-duration: 16s; }
.particle:nth-child(6) { left: 60%; animation-delay: 10s; animation-duration: 14s; }
.particle:nth-child(7) { left: 70%; animation-delay: 12s; animation-duration: 22s; }
.particle:nth-child(8) { left: 80%; animation-delay: 14s; animation-duration: 19s; }
.particle:nth-child(9) { left: 90%; animation-delay: 16s; animation-duration: 17s; }

@keyframes float {
    0% {
        transform: translateY(100vh) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(-100px) rotate(360deg);
        opacity: 0;
    }
}

#stars {
    width: 1px; 
    height: 1px; 
    background: transparent;
    box-shadow: 
        1776px 1423px #FFF, 1234px 876px #FFF, 1987px 345px #FFF, 567px 1789px #FFF,
        1345px 234px #FFF, 890px 1567px #FFF, 1678px 987px #FFF, 234px 1345px #FFF,
        1890px 567px #FFF, 456px 1234px #FFF, 1567px 890px #FFF, 789px 1456px #FFF,
        1234px 678px #FFF, 567px 1890px #FFF, 1456px 234px #FFF, 890px 1567px #FFF,
        1678px 345px #FFF, 234px 1789px #FFF, 1890px 456px #FFF, 567px 1234px #FFF;
    animation: animStar 50s linear infinite, twinkle 3s ease-in-out infinite alternate;
}

#stars2 {
    width: 2px; 
    height: 2px; 
    background: transparent;
    box-shadow: 
        1234px 567px #FFF, 890px 1234px #FFF, 1567px 890px #FFF, 234px 1567px #FFF,
        1890px 345px #FFF, 456px 1890px #FFF, 1234px 567px #FFF, 789px 1234px #FFF,
        1567px 345px #FFF, 234px 1890px #FFF, 1890px 567px #FFF, 456px 1234px #FFF;
    animation: animStar 100s linear infinite, twinkle 2s ease-in-out infinite alternate;
    animation-delay: 1s;
}

#stars3 {
    width: 3px; 
    height: 3px; 
    background: transparent;
    box-shadow: 
        890px 234px #FFD700, 1234px 890px #FFF, 567px 1234px #FFD700, 1890px 567px #FFF,
        345px 1890px #FFD700, 1567px 345px #FFF, 234px 1567px #FFD700, 1890px 234px #FFF;
    animation: animStar 150s linear infinite, twinkle 4s ease-in-out infinite alternate;
    animation-delay: 2s;
}

@keyframes twinkle {
    0% { opacity: 0.3; }
    100% { opacity: 1; }
}

@keyframes animStar {
    from { transform: translateY(0px); }
    to { transform: translateY(-2000px); }
}

/* Add subtle moving shapes */
.background-shapes {
    position: absolute;
    width: 100%;
    height: 100%;
    overflow: hidden;
    opacity: 0.1;
}

.shape {
    position: absolute;
    border-radius: 50%;
    background: linear-gradient(45deg, var(--gold-text), transparent);
    animation: moveShapes 25s linear infinite;
}

.shape:nth-child(1) {
    width: 100px;
    height: 100px;
    left: -50px;
    top: 20%;
    animation-delay: 0s;
}

.shape:nth-child(2) {
    width: 150px;
    height: 150px;
    right: -75px;
    top: 60%;
    animation-delay: 8s;
}

.shape:nth-child(3) {
    width: 80px;
    height: 80px;
    left: 50%;
    top: -40px;
    animation-delay: 15s;
}

@keyframes moveShapes {
    0% { transform: translateX(0) translateY(0) rotate(0deg); }
    100% { transform: translateX(100vw) translateY(-100vh) rotate(360deg); }
}

/* --- Timeline Layout --- */
#journey-timeline {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    padding: 5vh 20px;
    position: relative;
}

.timeline-item {
    padding: 50px 20px;
    margin: 0 auto 10vh auto;
    opacity: 0;
    transform: translateY(50px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
    position: relative;
}

.timeline-item.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.content {
    background: rgba(36, 36, 62, 0.5);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 30px 40px;
    text-align: center;
    border: 1px solid rgba(255, 105, 180, 0.3);
    box-shadow: 0 0 20px var(--glow-color), inset 0 0 15px rgba(48, 43, 99, 0.5), 0 0 30px rgba(255, 105, 180, 0.1);
}

/* --- Content Styling --- */
header.timeline-item {
    min-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20vh;
}

header h1 {
    font-family: 'Playfair Display', serif;
    font-size: 3.5em;
    color: var(--gold-text);
    margin: 0;
    text-shadow: 0 0 15px var(--glow-color);
}

.subtitle {
    font-size: 1.5em;
    margin-top: 10px;
    color: var(--light-text);
    font-weight: 300;
}

h2 {
    font-family: 'Playfair Display', serif;
    color: var(--gold-text);
    font-size: 2.5em;
    margin-top: 0;
    margin-bottom: 30px;
    text-shadow: 0 0 10px var(--glow-color);
}

/* --- Timer Section --- */
#timer {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.time-box {
    background: transparent;
    border-radius: 15px;
    min-width: 120px;
    position: relative;
    padding: 2px;
}
.time-box::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 15px;
    padding: 2px;
    background: linear-gradient(145deg, var(--gold-text), #a97a00);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
}
.time-box > div {
    background: var(--light-bg);
    padding: 15px 20px;
    border-radius: 13px;
}
.time-box span {
    display: block;
    font-size: 2.8em;
    font-weight: 700;
    color: var(--gold-text);
}

/* --- Quote & Letter --- */
#daily-quote {
    font-family: 'Playfair Display', serif;
    font-style: italic;
    font-size: 1.6em;
    color: var(--light-text);
    max-width: 700px;
    margin: 0 auto;
    line-height: 1.6;
}

.letter {
    text-align: left;
    line-height: 1.8;
    font-size: 1.1em;
    font-weight: 300;
}
.letter p {
    margin-bottom: 15px;
}

/* --- Gallery Section --- */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}
.gallery-item {
    aspect-ratio: 1 / 1;
    border-radius: 10px;
    background: rgba(0,0,0,0.3) center/cover;
    border: 1px solid rgba(255, 215, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Playfair Display', serif;
    font-size: 1.2em;
    color: var(--light-text);
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
}
.gallery-item:hover {
    transform: scale(1.05);
    box-shadow: 0 0 25px var(--glow-color);
}

/* --- Popup Styles --- */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease, visibility 0s 0.5s linear;
}
.popup-overlay.show {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.5s ease;
}
.popup-content {
    background: var(--light-bg);
    padding: 30px 40px;
    border-radius: 20px;
    box-shadow: 0 0 30px var(--glow-color);
    width: 90%;
    max-width: 600px;
    text-align: center;
    position: relative;
    border: 1px solid var(--gold-text);
    transform: scale(0.7);
    opacity: 0;
    transition: transform 0.5s cubic-bezier(0.18, 0.89, 0.32, 1.28), opacity 0.5s ease;
}
.popup-overlay.show .popup-content {
    transform: scale(1);
    opacity: 1;
}
.close-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 30px;
    color: var(--gold-text);
    cursor: pointer;
    transition: transform 0.2s ease, text-shadow 0.2s ease;
}
.close-btn:hover {
    transform: scale(1.2);
    text-shadow: 0 0 10px var(--glow-color);
}
.popup-content h2 {
    border-bottom: 1px solid rgba(255, 215, 0, 0.3);
    padding-bottom: 15px;
}
.popup-letter {
    text-align: left;
    margin-top: 20px;
    line-height: 1.7;
    font-size: 1.1em;
    color: var(--light-text);
}
.popup-letter p {
    margin-bottom: 15px;
    font-style: italic;
}

/* --- Floating Rose Petals --- */
.floating-roses {
    position: absolute;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
}

.rose-petal {
    position: absolute;
    display: block;
    pointer-events: none;
    width: 12px;
    height: 12px;
    background: linear-gradient(45deg, #ff69b4, #ff1493);
    border-radius: 50% 80% 50% 80%;
    animation: floatRose 20s infinite linear;
    box-shadow: 0 0 8px rgba(255, 105, 180, 0.4);
}

.rose-petal:nth-child(1) { left: 5%; animation-delay: 0s; animation-duration: 18s; }
.rose-petal:nth-child(2) { left: 15%; animation-delay: 3s; animation-duration: 22s; }
.rose-petal:nth-child(3) { left: 25%; animation-delay: 6s; animation-duration: 16s; }
.rose-petal:nth-child(4) { left: 35%; animation-delay: 9s; animation-duration: 24s; }
.rose-petal:nth-child(5) { left: 45%; animation-delay: 12s; animation-duration: 20s; }
.rose-petal:nth-child(6) { left: 55%; animation-delay: 15s; animation-duration: 18s; }
.rose-petal:nth-child(7) { left: 65%; animation-delay: 18s; animation-duration: 26s; }
.rose-petal:nth-child(8) { left: 75%; animation-delay: 21s; animation-duration: 19s; }
.rose-petal:nth-child(9) { left: 85%; animation-delay: 24s; animation-duration: 21s; }
.rose-petal:nth-child(10) { left: 95%; animation-delay: 27s; animation-duration: 17s; }

@keyframes floatRose {
    0% {
        transform: translateY(100vh) rotate(0deg) scale(0.8);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    50% {
        transform: translateY(50vh) rotate(180deg) scale(1);
        opacity: 0.8;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(-100px) rotate(360deg) scale(0.6);
        opacity: 0;
    }
}

/* --- Enhanced Responsive Design --- */
@media (max-width: 768px) {
    body { 
        padding: 0 10px; 
        font-size: 14px;
    }
    
    header h1 { 
        font-size: 2.2em; 
        line-height: 1.2;
    }
    
    .subtitle { 
        font-size: 1.1em; 
        margin-top: 15px;
    }
    
    h2 { 
        font-size: 1.8em; 
        margin-bottom: 20px;
    }
    
    .content { 
        padding: 20px 15px; 
        margin: 0 5px;
    }
    
    #timer { 
        gap: 8px; 
        justify-content: center;
    }
    
    .time-box { 
        min-width: 70px; 
        flex: 1;
        max-width: 80px;
    }
    
    .time-box span { 
        font-size: 1.6em; 
    }
    
    .time-box > div {
        padding: 10px 8px;
    }
    
    #daily-quote {
        font-size: 1.2em;
        line-height: 1.5;
    }
    
    .letter {
        font-size: 1em;
        line-height: 1.6;
    }
    
    .gallery-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .popup-content {
        width: 95%;
        padding: 20px;
        margin: 10px;
    }
    
    .popup-letter {
        font-size: 1em;
    }
    
    .timeline-item {
        padding: 30px 10px;
        margin-bottom: 5vh;
    }
    
    header.timeline-item {
        min-height: 70vh;
        margin-bottom: 10vh;
    }
}

@media (max-width: 480px) {
    header h1 { 
        font-size: 1.8em; 
    }
    
    h2 { 
        font-size: 1.5em; 
    }
    
    .time-box span { 
        font-size: 1.4em; 
    }
    
    #daily-quote {
        font-size: 1.1em;
    }
    
    .content {
        padding: 15px 10px;
    }
}

/* Tablet specific styles */
@media (min-width: 769px) and (max-width: 1024px) {
    header h1 { 
        font-size: 3em; 
    }
    
    h2 { 
        font-size: 2.2em; 
    }
    
    .content { 
        padding: 25px 30px; 
    }
    
    #timer { 
        gap: 15px; 
    }
    
    .time-box { 
        min-width: 100px; 
    }
    
    .time-box span { 
        font-size: 2.4em; 
    }
}

/* --- First Time Visit Popup --- */
.first-visit-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(15px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.8s ease, visibility 0s 0.8s linear;
}

.first-visit-popup.show {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.8s ease;
}

.first-visit-content {
    background: linear-gradient(135deg, var(--light-bg) 0%, var(--mid-bg) 100%);
    padding: 40px;
    border-radius: 25px;
    box-shadow: 0 0 50px var(--glow-color), 0 0 100px rgba(255, 105, 180, 0.3);
    width: 90%;
    max-width: 500px;
    text-align: center;
    position: relative;
    border: 2px solid var(--gold-text);
    transform: scale(0.5) rotateY(90deg);
    opacity: 0;
    transition: transform 0.8s cubic-bezier(0.18, 0.89, 0.32, 1.28), opacity 0.8s ease;
}

.first-visit-popup.show .first-visit-content {
    transform: scale(1) rotateY(0deg);
    opacity: 1;
}

.first-visit-content h2 {
    color: var(--gold-text);
    font-size: 2.2em;
    margin-bottom: 20px;
    text-shadow: 0 0 15px var(--glow-color);
}

.first-visit-message {
    font-size: 1.2em;
    line-height: 1.6;
    color: var(--light-text);
    margin-bottom: 30px;
    font-style: italic;
}

.first-visit-message p {
    margin-bottom: 15px;
}

.enter-btn {
    background: linear-gradient(45deg, var(--gold-text), #ff69b4);
    color: var(--dark-bg);
    border: none;
    padding: 15px 30px;
    border-radius: 25px;
    font-size: 1.1em;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 5px 15px rgba(255, 215, 0, 0.3);
}

.enter-btn:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 8px 25px rgba(255, 215, 0, 0.5);
}

.floating-hearts {
    position: absolute;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
}

.heart {
    position: absolute;
    color: #ff69b4;
    font-size: 20px;
    animation: floatHeart 6s infinite ease-in-out;
    opacity: 0;
}

.heart:nth-child(1) { left: 10%; animation-delay: 0s; }
.heart:nth-child(2) { left: 20%; animation-delay: 1s; }
.heart:nth-child(3) { left: 30%; animation-delay: 2s; }
.heart:nth-child(4) { left: 70%; animation-delay: 0.5s; }
.heart:nth-child(5) { left: 80%; animation-delay: 1.5s; }
.heart:nth-child(6) { left: 90%; animation-delay: 2.5s; }

@keyframes floatHeart {
    0% {
        transform: translateY(100px);
        opacity: 0;
    }
    20% {
        opacity: 1;
    }
    80% {
        opacity: 1;
    }
    100% {
        transform: translateY(-100px);
        opacity: 0;
    }
}

/* Mobile adjustments for first visit popup */
@media (max-width: 768px) {
    .first-visit-content {
        padding: 25px 20px;
        margin: 20px;
    }
    
    .first-visit-content h2 {
        font-size: 1.8em;
    }
    
    .first-visit-message {
        font-size: 1.1em;
    }
    
    .enter-btn {
        padding: 12px 25px;
        font-size: 1em;
    }
}

@media (max-width: 480px) {
    .first-visit-content {
        padding: 20px 15px;
    }
    
    .first-visit-content h2 {
        font-size: 1.5em;
    }
    
    .first-visit-message {
        font-size: 1em;
    }
}
