/* Fix for mobile 100vh issue */
:root {
    --vh: 1vh;
}

.hero,
.lock-screen {
    height: 100vh; /* Fallback */
    height: calc(var(--vh, 1vh) * 100);
}

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Playfair Display', serif;
    background: #0a0a0a;
    color: #f5f5f5;
    line-height: 1.6;
    overflow-x: hidden;
}

/* Lock Screen Styles */
.lock-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: linear-gradient(rgba(10, 10, 10, 0.95), rgba(10, 10, 10, 0.98)), 
                url('https://images.unsplash.com/photo-1518568814500-bf0f8d125f46?ixlib=rb-4.0.3&auto=format&fit=crop&w=1920&q=80') center/cover no-repeat;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    text-align: center;
    padding: 2rem;
}

.lock-content {
    max-width: 800px;
    background: rgba(255, 255, 255, 0.05);
    padding: 3rem;
    border-radius: 25px;
    border: 2px solid rgba(255, 107, 139, 0.3);
    backdrop-filter: blur(10px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.lock-subtitle {
    font-size: 1.5rem;
    color: #ddd;
    margin-bottom: 2rem;
    font-family: 'Crimson Pro', serif;
}

.lock-hint {
    margin-top: 2rem;
    padding: 1.5rem;
    background: rgba(255, 107, 139, 0.08);
    border-radius: 15px;
    border: 1px solid rgba(255, 107, 139, 0.2);
}

.lock-hint p {
    margin: 0.5rem 0;
    color: #ccc;
}

.lock-hint i {
    color: #ff6b8b;
    margin-right: 10px;
}

.secret-note {
    margin-top: 2rem;
    padding: 1rem;
    background: rgba(107, 139, 255, 0.1);
    border-radius: 10px;
    border: 1px dashed rgba(107, 139, 255, 0.3);
}

.secret-code {
    background: rgba(255, 255, 255, 0.1);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-family: monospace;
    color: #6b8bff;
}

/* Full website initially hidden */
.full-website {
    opacity: 0;
    animation: fadeIn 1s ease forwards;
    animation-delay: 0.5s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Navigation */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    background: rgba(10, 10, 10, 0.9);
    padding: 1rem 0;
    z-index: 1000;
    backdrop-filter: blur(10px);
}

.navbar ul {
    display: flex;
    justify-content: center;
    list-style: none;
    flex-wrap: wrap;
}

.navbar li {
    margin: 0 1.5rem;
}

.navbar a {
    color: #f5f5f5;
    text-decoration: none;
    font-family: 'Crimson Pro', serif;
    font-size: 1.1rem;
    padding: 0.5rem 1rem;
    transition: all 0.3s;
    border-bottom: 2px solid transparent;
}

.navbar a:hover {
    color: #ff6b8b;
    border-bottom: 2px solid #ff6b8b;
}

/* Hero Section */
.hero {
    height: 100vh;
    background: linear-gradient(rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.7)), 
                url('https://images.unsplash.com/photo-1518568814500-bf0f8d125f46?ixlib=rb-4.0.3&auto=format&fit=crop&w=1920&q=80') center/cover no-repeat;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding-top: 60px;
}

.hero-overlay {
    max-width: 900px;
    padding: 2rem;
}

.hero-title {
    font-family: 'Dancing Script', cursive;
    font-size: 5rem;
    color: #ff6b8b;
    margin-bottom: 1rem;
    text-shadow: 0 0 20px rgba(255, 107, 139, 0.5);
}

.hero-subtitle {
    font-size: 1.5rem;
    margin-bottom: 3rem;
    color: #ddd;
}

/* Countdown */
.countdown-container {
    background: rgba(255, 255, 255, 0.05);
    padding: 2rem;
    border-radius: 20px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

#countdown {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin: 2rem 0;
    flex-wrap: wrap;
}

#countdown div {
    background: rgba(255, 107, 139, 0.1);
    padding: 1.5rem;
    border-radius: 15px;
    min-width: 120px;
    border: 1px solid rgba(255, 107, 139, 0.3);
}

#countdown span {
    font-size: 3rem;
    font-weight: bold;
    color: #ff6b8b;
    display: block;
}

.birthday-message {
    font-size: 2.5rem;
    color: #ff6b8b;
    font-family: 'Dancing Script', cursive;
    min-height: 60px;
    margin-top: 1rem;
}

/* Unlock animation */
.unlock-message {
    background: rgba(255, 107, 139, 0.1);
    padding: 1.5rem;
    border-radius: 15px;
    margin-top: 2rem;
    border: 1px solid rgba(255, 107, 139, 0.3);
    animation: fadeIn 1s ease;
}

.unlock-message p {
    margin: 0.5rem 0;
    color: #fff;
}

.unlock-message i {
    color: #ff6b8b;
    margin-right: 10px;
}

/* Sections */
.section {
    padding: 5rem 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.dark {
    background: rgba(20, 20, 20, 0.9);
    border-radius: 30px;
    margin: 3rem auto;
}

.section-title {
    text-align: center;
    font-size: 2.8rem;
    margin-bottom: 3rem;
    color: #ff6b8b;
    font-family: 'Crimson Pro', serif;
}

.section-title i {
    margin-right: 1rem;
}

.section-subtitle {
    text-align: center;
    color: #aaa;
    margin-bottom: 3rem;
    font-style: italic;
}

/* ============================================
   UPDATED TIMELINE WITH BETTER IMAGE DISPLAY
   ============================================ */

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

.timeline-line {
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(to bottom, 
        rgba(255, 107, 139, 0.2), 
        rgba(255, 107, 139, 0.8), 
        rgba(255, 107, 139, 0.2));
    transform: translateX(-50%);
    z-index: 1;
}

.timeline-item {
    display: flex;
    align-items: center;
    margin-bottom: 6rem;
    position: relative;
    z-index: 2;
}

.timeline-item.reverse {
    flex-direction: row-reverse;
}

.timeline-img-container {
    flex: 1;
    position: relative;
    margin: 0 3rem;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    transition: all 0.5s ease;
    width: 80%; /* Reduced width to 80% */
}

.timeline-item.reverse .timeline-img-container {
    transform: perspective(1000px) rotateY(10deg);
}

.timeline-img-container:hover {
    transform: perspective(1000px) rotateY(0deg) scale(1.05);
    box-shadow: 0 30px 60px rgba(255, 107, 139, 0.2);
}

.timeline-img {
    width: 100%;
    height: auto; /* Changed from fixed height to auto */
    max-height: 400px; /* Maximum height */
    object-fit: contain; /* Changed from cover to contain to show full image */
    display: block;
    transition: transform 0.5s ease;
    background: rgba(0, 0, 0, 0.2); /* Background for images with transparency */
}

.timeline-img-container:hover .timeline-img {
    transform: scale(1.05);
}

.timeline-date {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.9));
    color: white;
    padding: 2rem 1.5rem 1rem;
    font-family: 'Crimson Pro', serif;
    font-size: 1.2rem;
    font-weight: bold;
    text-align: center;
}

.timeline-content {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    padding: 2.5rem;
    border-radius: 20px;
    border: 1px solid rgba(255, 107, 139, 0.2);
    backdrop-filter: blur(10px);
    position: relative;
    margin: 0 3rem;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
    width: 80%; /* Reduced width to 80% */
}

.timeline-icon {
    position: absolute;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #ff6b8b, #ffa36c);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
    box-shadow: 0 5px 15px rgba(255, 107, 139, 0.4);
    z-index: 3;
}

.timeline-content h3 {
    color: #ff6b8b;
    font-size: 1.8rem;
    margin-bottom: 1rem;
    font-family: 'Crimson Pro', serif;
    text-align: center;
}

.timeline-content p {
    color: #ddd;
    line-height: 1.8;
    margin-bottom: 1.5rem;
    text-align: center;
    font-size: 1.1rem;
}

.timeline-quote {
    background: rgba(255, 107, 139, 0.1);
    padding: 1.2rem;
    border-radius: 12px;
    border-left: 3px solid #ff6b8b;
    font-style: italic;
    color: #aaa;
    text-align: center;
    margin-top: 1.5rem;
    font-family: 'Crimson Pro', serif;
}

.timeline-quote i {
    color: #ff6b8b;
    margin: 0 0.5rem;
}

.timeline-memory {
    background: rgba(107, 139, 255, 0.1);
    padding: 1rem;
    border-radius: 10px;
    text-align: center;
    color: #6b8bff;
    margin-top: 1.5rem;
    font-size: 0.95rem;
}

.timeline-memory i {
    margin-right: 0.5rem;
}

/* ============================================
   UPDATED 25 REASONS WITH BETTER IMAGE DISPLAY
   ============================================ */

.reasons-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
    margin-bottom: 4rem;
}

.reason-card {
    background: rgba(30, 30, 30, 0.9);
    border-radius: 15px;
    overflow: hidden;
    transition: transform 0.3s ease;
    border: 1px solid rgba(255, 107, 139, 0.2);
    width: 85%; /* Reduced width to 85% */
    margin: 0 auto; /* Center the cards */
}

.reason-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 30px rgba(255, 107, 139, 0.15);
}

.reason-image-container {
    position: relative;
    width: 100%;
    height: 220px; /* Fixed container height */
    overflow: hidden;
}

.reason-image {
    width: 100%;
    height: 100%;
    background-size: contain !important; /* Changed from cover to contain */
    background-position: center center !important;
    background-repeat: no-repeat !important;
    background-color: rgba(0, 0, 0, 0.1); /* Add background for transparent images */
    cursor: pointer;
    position: relative;
    transition: transform 0.5s ease;
}

.reason-image:hover {
    transform: scale(1.05);
}

/* Reason number badge */
.reason-image::after {
    content: attr(data-reason);
    position: absolute;
    top: 12px;
    left: 12px;
    background: rgba(255, 107, 139, 0.9);
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1rem;
    z-index: 2;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
}

/* Click hint */
.reason-image::before {
    content: 'Click to read';
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 6px 15px;
    border-radius: 20px;
    font-size: 0.8rem;
    opacity: 0.9;
    z-index: 2;
    transition: all 0.3s ease;
}

.reason-image:hover::before {
    background: rgba(255, 107, 139, 0.9);
    padding: 6px 20px;
}

.reason-content {
    padding: 1.5rem;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(40, 40, 40, 0.95);
}

.reason-card.active .reason-content {
    max-height: 500px;
    opacity: 1;
    padding: 1.5rem;
}

.reason-content h3 {
    color: #ff6b8b;
    margin-bottom: 0.8rem;
    font-size: 1.3rem;
    display: flex;
    align-items: center;
}

.reason-content h3::before {
    content: '❤️';
    margin-right: 10px;
    font-size: 1.1rem;
}

.reason-content p {
    color: #ddd;
    line-height: 1.6;
    font-size: 1rem;
}

.all-reasons {
    background: rgba(255, 107, 139, 0.05);
    padding: 2rem;
    border-radius: 15px;
    border: 1px solid rgba(255, 107, 139, 0.2);
    width: 85%; /* Reduced width to 85% */
    margin: 0 auto; /* Center it */
}

.all-reasons ol {
    columns: 2;
    list-style-position: inside;
    margin-top: 1rem;
}

.all-reasons li {
    margin-bottom: 0.5rem;
    padding-left: 1rem;
}

/* ============================================
   OTHER SECTIONS
   ============================================ */

/* Poem */
.poem-container {
    max-width: 800px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.03);
    padding: 3rem;
    border-radius: 20px;
    border: 1px solid rgba(255, 107, 139, 0.3);
    width: 85%; /* Reduced width to 85% */
}

.poem {
    font-family: 'Crimson Pro', serif;
    font-size: 1.2rem;
    line-height: 1.8;
    text-align: center;
}

.poem h3 {
    color: #ff6b8b;
    margin-bottom: 2rem;
    font-size: 1.8rem;
}

.poem p {
    margin-bottom: 1.5rem;
}

.poem-signature {
    text-align: right;
    font-style: italic;
    color: #aaa;
    margin-top: 2rem;
}

/* Music Player */
.music-player {
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
    width: 85%; /* Reduced width to 85% */
}

.song-note {
    margin-top: 2rem;
    padding: 1.5rem;
    background: rgba(255, 107, 139, 0.05);
    border-radius: 15px;
}

.song-note h3 {
    color: #ff6b8b;
    margin-bottom: 1rem;
}

/* Letter */
.letter-container {
    max-width: 800px;
    margin: 0 auto;
    width: 85%; /* Reduced width to 85% */
}

.letter {
    background: rgba(255, 255, 255, 0.03);
    padding: 3rem;
    border-radius: 20px;
    border: 1px solid rgba(255, 107, 139, 0.3);
    font-family: 'Crimson Pro', serif;
    font-size: 1.1rem;
    line-height: 1.8;
}

.letter-date {
    text-align: right;
    color: #aaa;
    margin-bottom: 2rem;
}

.letter p {
    margin-bottom: 1.5rem;
}

.letter ul {
    margin-left: 2rem;
    margin-bottom: 1.5rem;
}

.letter li {
    margin-bottom: 0.5rem;
}

.signature {
    font-family: 'Dancing Script', cursive;
    font-size: 1.8rem;
    color: #ff6b8b;
    margin-top: 2rem;
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem;
    background: rgba(10, 10, 10, 0.9);
    border-top: 1px solid rgba(255, 107, 139, 0.2);
    width: 100%;
}

.pulse {
    animation: pulse 1.5s infinite;
    color: #ff6b8b;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

/* Tablet */
@media (max-width: 1024px) {
    .timeline-img-container,
    .timeline-content,
    .reason-card,
    .poem-container,
    .music-player,
    .letter-container,
    .all-reasons {
        width: 90%; /* Slightly wider on tablet */
    }
    
    .reasons-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
    
    .reason-image-container {
        height: 200px;
    }
    
    .timeline-img {
        max-height: 350px;
    }
}

/* Mobile */
@media (max-width: 768px) {
    .hero-title {
        font-size: 3rem;
    }
    
    .lock-content {
        padding: 2rem;
    }
    
    #countdown {
        gap: 1rem;
    }
    
    #countdown div {
        min-width: 80px;
        padding: 1rem;
    }
    
    #countdown span {
        font-size: 2rem;
    }
    
    /* Timeline adjustments for mobile */
    .timeline-item,
    .timeline-item.reverse {
        flex-direction: column !important;
        margin-bottom: 4rem;
    }
    
    .timeline-img-container,
    .timeline-content {
        margin: 1rem 0;
        width: 95% !important; /* Almost full width on mobile */
    }
    
    .timeline-line {
        left: 30px;
    }
    
    .timeline-img-container {
        transform: none !important;
    }
    
    .timeline-img-container:hover {
        transform: scale(1.03) !important;
    }
    
    .timeline-icon {
        left: 30px;
        transform: translateX(0);
    }
    
    .timeline-img {
        max-height: 300px;
    }
    
    /* Navigation */
    .navbar ul {
        justify-content: space-around;
    }
    
    .navbar li {
        margin: 0 0.5rem;
    }
    
    /* 25 Reasons adjustments */
    .reasons-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .reason-card,
    .poem-container,
    .music-player,
    .letter-container,
    .all-reasons {
        width: 95% !important; /* Almost full width on mobile */
    }
    
    .reason-image-container {
        height: 180px;
    }
    
    .all-reasons ol {
        columns: 1;
    }
    
    /* Sections */
    .section {
        padding: 3rem 1rem;
    }
    
    .section-title {
        font-size: 2rem;
    }
    
    .reason-image::before {
        font-size: 0.7rem;
        padding: 5px 12px;
    }
    
    .reason-image::after {
        width: 28px;
        height: 28px;
        font-size: 0.9rem;
    }
}

/* Small Phones */
@media (max-width: 480px) {
    .hero-title {
        font-size: 2.5rem !important;
    }
    
    #countdown div {
        min-width: 70px;
        padding: 0.8rem;
    }
    
    #countdown span {
        font-size: 1.8rem;
    }
    
    .section-title {
        font-size: 1.8rem;
    }
    
    .timeline-img {
        max-height: 250px;
    }
    
    .reason-image-container {
        height: 160px;
    }
    
    .reason-content {
        padding: 1.2rem;
    }
    
    .reason-card.active .reason-content {
        padding: 1.2rem;
    }
    
    .poem {
        font-size: 1rem;
    }
    
    .letter {
        padding: 2rem;
    }
    
    .navbar ul {
        padding: 0 0.5rem;
    }
    
    .navbar a {
        font-size: 0.85rem;
        padding: 0.3rem 0.5rem;
    }
    
    .reason-image::before {
        font-size: 0.65rem;
        padding: 4px 10px;
    }
    
    .reason-image::after {
        width: 24px;
        height: 24px;
        font-size: 0.8rem;
    }
}

/* Extra small phones */
@media (max-width: 360px) {
    .reason-image-container {
        height: 140px;
    }
    
    .timeline-img {
        max-height: 200px;
    }
    
    .reason-content h3 {
        font-size: 1.1rem;
    }
    
    .reason-content p {
        font-size: 0.9rem;
    }
}

/* ============================================
   TOUCH DEVICE OPTIMIZATIONS
   ============================================ */

@media (hover: none) and (pointer: coarse) {
    /* Remove hover effects on touch devices */
    .timeline-img-container:hover,
    .reason-card:hover {
        transform: none !important;
    }
    
    .timeline-img-container:hover .timeline-img,
    .reason-image:hover {
        transform: none !important;
    }
    
    /* Increase tap target sizes */
    .navbar a,
    .reason-image,
    .timeline-img-container {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Add active states for touch feedback */
    .navbar a:active,
    .reason-image:active {
        opacity: 0.7;
        transform: scale(0.98) !important;
    }
    
    /* Show click hint always on touch devices */
    .reason-image::before {
        opacity: 1;
    }
}

/* ============================================
   IMAGE QUALITY OPTIMIZATIONS
   ============================================ */

/* Ensure images don't pixelate when scaled */
.reason-image,
.timeline-img {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    -ms-interpolation-mode: bicubic;
}

/* High DPI screens */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .reason-image,
    .timeline-img {
        image-rendering: auto;
    }
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    .reason-card:hover,
    .timeline-img-container:hover,
    .reason-image:hover,
    .timeline-img-container:hover .timeline-img {
        transform: none !important;
        transition: none !important;
    }
    
    .pulse {
        animation: none;
    }
}

/* ============================================
   FALLBACK FOR BROKEN/MISSING IMAGES
   ============================================ */

.reason-image[style*="undefined"],
.reason-image[style*="YOUR_IMAGE"],
.reason-image[style*="null"],
.reason-image[style*="undefined"]:hover,
.reason-image[style*="YOUR_IMAGE"]:hover,
.reason-image[style*="null"]:hover {
    background: linear-gradient(135deg, #ff6b8b, #ffa36c) !important;
    position: relative;
}

.reason-image[style*="undefined"]::after,
.reason-image[style*="YOUR_IMAGE"]::after,
.reason-image[style*="null"]::after {
    content: '❤️' !important;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2rem;
    background: none !important;
    width: auto !important;
    height: auto !important;
    box-shadow: none !important;
}

/* ============================================
   ACCESSIBILITY IMPROVEMENTS
   ============================================ */

.reason-image:focus,
.timeline-img-container:focus {
    outline: 2px solid #ff6b8b;
    outline-offset: 3px;
}

/* Screen reader only text */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
