@import url('https://fonts.googleapis.com/css2?family=Dancing+Script:wght@400..700&family=Montserrat:wght@400;700&display=swap');

body, html {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: 'Montserrat', sans-serif; /* Set default readable font */
    font-size: 16px;
    line-height: 1.6;
}

body {
    /* Use background.jpeg as requested */
    background-image: url('../img/background.jpeg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed; /* Keeps background fixed during scroll */
    color: #333; /* Default text color for content on light backgrounds */
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* --- Typography Refinements --- */

/* Use Dancing Script selectively for main titles/headings */
h1, .main-title, .page-title, .bird-gallery-preview h2, .explore-page h1 {
    font-family: 'Dancing Script', cursive;
    font-weight: 700;
    color: #1a1a1a; /* Darker color for titles on light backgrounds */
}

/* Specific title styling */
.main-title { /* Home page title */
    font-size: clamp(2.5em, 6vw, 4.5em); /* Responsive font size */
    color: #fff; /* White on dark background */
    text-shadow: 2px 2px 5px rgba(0, 0, 0, 0.6);
    margin-bottom: 0.1em;
    animation: fadeIn 1s ease-out forwards; /* Add animation */
}

.subtitle, .page-subtitle {
    font-family: 'Montserrat', sans-serif; /* Readable font for subtitles */
    font-size: clamp(1em, 2.5vw, 1.5em);
    font-weight: 400;
    margin-bottom: 1.5em;
    color: #eee; /* Light on dark background */
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.5);
    animation: fadeIn 1s ease-out 0.3s forwards; /* Staggered animation */
    opacity: 0; /* Start hidden for animation */
}

.page-title { /* Titles on content pages */
    font-size: clamp(2em, 5vw, 3.5em);
    text-align: center;
    margin-bottom: 0.1em;
}

.page-subtitle {
    color: #555; /* Darker subtitle on light background */
    text-shadow: none;
    text-align: center;
}

/* Navigation font */
.main-nav a {
    font-family: 'Montserrat', sans-serif;
    font-size: 1em; /* Adjusted size */
    font-weight: 700; /* Bold */
    color: #fff;
    text-decoration: none;
    padding: 8px 0;
    position: relative;
    transition: color 0.3s ease;
}

/* Add underline effect on hover/active */
.main-nav a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: 0;
    left: 0;
    background-color: #ddd;
    transition: width 0.3s ease;
}

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

.main-nav a:hover,
.main-nav a.active {
    color: #ddd;
    border-bottom: none; /* Remove previous border */
}

/* --- Layout & General Styles --- */

.main-header {
    background-color: rgba(0, 0, 0, 0.7); /* Semi-transparent background for readability */
    padding: 10px 20px;
    position: fixed; /* Keeps menu at the top */
    width: 100%;
    top: 0;
    left: 0;
    z-index: 1000;
    box-sizing: border-box; /* Include padding in width calculation */
    transition: background-color 0.3s ease; /* Smooth transition if background changes */
}

.main-nav {
    display: flex;
    justify-content: space-between; /* Pushes links left, logo right */
    align-items: center;
    max-width: 1200px; /* Optional: constrain nav width */
    margin: 0 auto; /* Center nav if max-width is set */
}

.nav-links {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
}

.nav-links li {
    margin-right: 20px; /* Spacing between links */
}

.nav-links a {
    color: #fff;
    text-decoration: none;
    font-weight: bold;
    padding: 5px 0;
    transition: color 0.3s ease;
}

.nav-links a:hover,
.nav-links a.active { /* Add 'active' class dynamically for current page if needed */
    color: #ddd; /* Hover/active color */
    border-bottom: 2px solid #ddd;
}

.logo-container {
    height: 50px; /* Adjust based on your logo size */
}

.logo {
    height: 100%;
    width: auto; /* Maintain aspect ratio */
}

.landing-page {
    /* Ensure enough space for content */
    padding-top: 80px; /* Adjust based on header height to prevent content overlap */
    text-align: center; /* Center content like the h1 */
    min-height: 100vh; /* Ensure it takes full viewport height */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 80px 20px 40px; /* Adjust padding */
    box-sizing: border-box;
}

.home-content {
    /* Specific styles for home page content if needed */
}

.content-page {
    padding-top: 80px; /* Adjust based on header height */
    padding-left: 20px;
    padding-right: 20px;
    padding-bottom: 40px;
    max-width: 1200px;
    margin: 0 auto; /* Center content */
    color: #333; /* Change text color for content pages if needed */
    background-color: rgba(255, 255, 255, 0.95); /* Slightly less transparent */
    min-height: calc(100vh - 80px); /* Ensure it fills height below header */
    border-radius: 8px; /* Optional: rounded corners */
    margin-top: 100px; /* Add space below fixed header */
    margin-bottom: 40px;
}

.explore-page h1, .explore-page p {
    text-align: center;
    color: #1a1a1a; /* Darker text for the content area */
}

/* --- Home Page Gallery Preview --- */

.bird-gallery-preview {
    margin-top: 40px;
    width: 80%;
    max-width: 900px;
    background-color: rgba(0, 0, 0, 0.6); /* Semi-transparent background */
    padding: 20px;
    border-radius: 8px;
    animation: fadeIn 1s ease-out 0.6s forwards; /* Staggered animation */
    opacity: 0; /* Start hidden for animation */
    /* Ensure it doesn't stretch excessively */
    max-width: 90%; /* Adjust as needed */
    margin-left: auto;
    margin-right: auto;
}

.bird-gallery-preview h2 {
     font-family: 'Dancing Script', cursive; /* Apply script font */
     font-size: clamp(1.8em, 4vw, 2.5em);
     color: #fff;
}

.gallery-items {
    display: flex;
    justify-content: center; /* Center items if space allows */
    align-items: flex-start; /* Align items top */
    flex-wrap: wrap; /* Allow wrapping */
    gap: 20px; /* Increased gap */
}

.gallery-item {
    /* Remove flex-basis, let width control it */
    width: clamp(150px, 20vw, 220px); /* Slightly adjusted clamp */
    background-color: #fff;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    position: relative; /* Needed for potential overlays */
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    animation: fadeIn 0.8s ease-out forwards;
    /* Stagger animation delay using inline style --item-index */
    animation-delay: calc(0.8s + 0.15s * var(--item-index, 0));
    opacity: 0;
}

.gallery-item:hover {
    transform: translateY(-5px) scale(1.03); /* Lift and slightly scale on hover */
    box-shadow: 0 8px 15px rgba(0,0,0,0.3);
}

.gallery-item img {
    display: block;
    width: 100%;
    height: auto; /* Maintain aspect ratio */
    aspect-ratio: 1 / 1; /* Make images square, adjust if needed */
    object-fit: cover; /* Cover the area, cropping if necessary */
    transition: transform 0.3s ease;
}

.gallery-item:hover img {
    transform: scale(1.05); /* Slight zoom on hover */
}

/* --- Full Bird Gallery (birds.php) --- */

.birds-gallery-page {
    /* Specific styles if needed */
}

.full-bird-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(clamp(180px, 25vw, 280px), 1fr));
    gap: 25px;
    margin-top: 30px;
}

.bird-item {
    background-color: #fff;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    cursor: pointer;
    position: relative;
    opacity: 0;
    animation: fadeIn 0.6s ease-out forwards;
    animation-delay: calc(0.1s * var(--item-index, 0));
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex; /* Use flexbox for layout */
    flex-direction: column; /* Stack image and name vertically */
}

.bird-item:hover {
    transform: translateY(-5px); /* Keep lift effect, remove scale */
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
}

.bird-item img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 4 / 3; /* Adjust aspect ratio as desired */
    object-fit: cover;
    flex-grow: 1; /* Allow image to take available space */
}

.bird-name {
    padding: 12px 10px;
    text-align: center;
    font-weight: 600; /* Slightly bolder */
    background-color: #f8f8f8; /* Light background for the name */
    width: 100%;
    box-sizing: border-box;
    font-size: 0.95em;
    color: #333;
    flex-shrink: 0; /* Prevent name area from shrinking */
}

/* --- Explore Page / YouTube --- */

.explore-page {
    /* Specific styles if needed */
}

.youtube-gallery {
    display: grid;
    /* Increased minmax for larger items */
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 25px; /* Slightly increased gap */
    margin-top: 30px;
    position: relative; /* For loading overlay */
    min-height: 200px; /* Ensure space for loader */
}

/* Basic Loading Spinner */
.loader {
    border: 5px solid #f3f3f3; /* Light grey */
    border-top: 5px solid #c4302b; /* YouTube Red */
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

.video-item {
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 15px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    color: #333;
    /* Adjusted for vertical 9:16 aspect ratio */
    padding-bottom: 177.78%; /* (16 / 9) * 100% */
    height: 0;
    overflow: hidden;
    position: relative;
    /* Ensure animation is applied */
    opacity: 0;
    animation: fadeIn 0.8s ease-out forwards;
    /* Consider staggering if loading dynamically */
    /* animation-delay: calc(0.1s * var(--item-index, 0)); */
}

.video-item iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0; /* Remove default iframe border */
}

.video-item h3 {
    /* Adjust h3 positioning if needed, or remove if iframe is enough */
    /* Example: position absolute if you want it over the video */
    position: absolute;
    bottom: 10px; /* Example positioning */
    left: 10px; /* Example positioning */
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 5px;
    border-radius: 3px;
    font-size: 0.9em;
    z-index: 1; /* Ensure title is above iframe */
    /* Remove min-height if using absolute positioning */
    min-height: unset;
}

.video-item a {
    display: inline-block;
    background-color: #c4302b; /* YouTube red */
    color: #fff;
    padding: 8px 15px;
    text-decoration: none;
    border-radius: 4px;
    transition: background-color 0.3s ease;
}

.video-item a:hover {
    background-color: #a02620;
}

/* --- Lightbox Styles --- */
.lightbox {
    display: none; /* Hidden by default */
    position: fixed; /* Stay in place */
    z-index: 1001; /* Sit on top */
    padding-top: 60px; /* Location of the box */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto; /* Enable scroll if needed */
    background-color: rgba(0,0,0,0.9); /* Black w/ opacity */
    animation: fadeIn 0.3s ease-out;
}

.lightbox-content {
    margin: auto;
    display: block;
    max-width: 85%;
    max-height: 80vh;
    animation: zoomIn 0.3s ease-out;
}

#lightbox-caption {
    margin: auto;
    display: block;
    width: 80%;
    max-width: 700px;
    text-align: center;
    color: #ccc;
    padding: 15px 0;
    font-size: 1.1em;
    font-family: 'Montserrat', sans-serif;
}

.lightbox-close {
    position: absolute;
    top: 15px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    transition: 0.3s;
    cursor: pointer;
}

.lightbox-close:hover,
.lightbox-close:focus {
    color: #bbb;
    text-decoration: none;
    cursor: pointer;
}

/* Animation Keyframes (ensure they exist) */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes zoomIn {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* --- Accessibility & Misc --- */
img {
    max-width: 100%;
    height: auto;
}

/* Add focus styles for keyboard navigation */
a:focus, button:focus, [tabindex="0"]:focus {
    outline: 2px solid #c4302b; /* Example focus style */
    outline-offset: 2px;
}

/* --- Home Page Specific --- */

.about-preview {
    background-color: rgba(255, 255, 255, 0.85); /* Light background */
    padding: 25px 30px;
    border-radius: 8px;
    margin-top: 30px;
    margin-bottom: 40px;
    max-width: 800px;
    width: 90%;
    text-align: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    /* AOS animation will be added via data-aos attribute */
}

.about-preview h2 {
    font-family: 'Dancing Script', cursive;
    font-size: clamp(1.8em, 4vw, 2.5em);
    color: #2c3e50; /* Dark blue/grey color */
    margin-bottom: 15px;
}

.about-preview p {
    color: #34495e; /* Slightly lighter dark blue/grey */
    font-size: 1.1em;
    line-height: 1.7;
}

.cta-button {
    display: inline-block;
    background-color: #c4302b; /* Match YouTube red or choose theme color */
    color: #fff;
    padding: 12px 25px;
    border-radius: 5px;
    text-decoration: none;
    font-weight: bold;
    margin-top: 20px;
    transition: background-color 0.3s ease, transform 0.3s ease;
    /* AOS animation */
}

.cta-button:hover {
    background-color: #a02620;
    transform: translateY(-2px);
}

/* --- AOS adjustments (optional) --- */
/* Ensure elements start hidden if using AOS fade effects */
[data-aos] {
  /* opacity: 0; */ /* AOS handles this, but can be explicit */
  /* transition-property: transform, opacity; */ /* AOS handles this */
}

/* --- Footer Styles --- */
.main-footer-content {
    background-color: rgba(0, 0, 0, 0.8); /* Dark semi-transparent background */
    color: #ccc; /* Light grey text */
    text-align: center;
    padding: 15px 20px;
    margin-top: auto; /* Push footer to bottom if content is short */
    font-size: 0.9em;
    width: 100%;
    box-sizing: border-box;
}

.main-footer-content p {
    margin: 0;
}

/* --- Responsive Design (Media Queries) --- */

/* Medium screens (tablets, large phones) */
@media (max-width: 768px) {
    .main-nav {
        flex-direction: column; /* Stack logo and links */
        align-items: center;
    }

    .nav-links {
        margin-top: 10px; /* Add space below logo */
        justify-content: center; /* Center links */
        width: 100%;
    }

    .nav-links li {
        margin: 0 10px; /* Reduce spacing between links */
    }

    .logo-container {
        height: 40px; /* Slightly smaller logo */
    }

    /* Adjust padding for content pages */
    .landing-page,
    .content-page {
        padding-top: 120px; /* Increased padding due to taller header */
        padding-left: 15px;
        padding-right: 15px;
    }

    .content-page {
        margin-top: 140px; /* Increased margin due to taller header */
    }

    /* Adjust title sizes */
    .main-title {
        font-size: clamp(2em, 8vw, 3.5em);
    }
    .page-title {
        font-size: clamp(1.8em, 7vw, 3em);
    }
    .subtitle, .page-subtitle {
        font-size: clamp(0.9em, 4vw, 1.2em);
    }

    /* Adjust gallery layouts */
    .gallery-items {
        gap: 15px;
    }
    .gallery-item {
        width: clamp(120px, 30vw, 180px); /* Adjust clamp for smaller screens */
    }

    .full-bird-gallery {
        grid-template-columns: repeat(auto-fill, minmax(clamp(150px, 40vw, 220px), 1fr));
        gap: 15px;
    }

    .youtube-gallery {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); /* Allow single column */
        gap: 20px;
    }

    .about-preview {
        padding: 20px;
        width: 95%;
    }

    .about-preview h2 {
        font-size: clamp(1.6em, 5vw, 2.2em);
    }

    .about-preview p {
        font-size: 1em;
    }

    .cta-button {
        padding: 10px 20px;
        font-size: 0.95em;
    }

    /* Lightbox adjustments */
    .lightbox-content {
        max-width: 90%;
    }
    #lightbox-caption {
        font-size: 1em;
    }
    .lightbox-close {
        font-size: 35px;
        top: 10px;
        right: 25px;
    }
}

/* Small screens (most phones) */
@media (max-width: 480px) {
    .main-nav a {
        font-size: 0.9em;
    }

    .nav-links li {
        margin: 0 8px;
    }

    .landing-page,
    .content-page {
        padding-top: 110px; /* Adjust if needed */
    }
    .content-page {
        margin-top: 130px; /* Adjust if needed */
        padding: 15px;
    }

    .main-title {
        font-size: clamp(1.8em, 9vw, 3em);
    }
    .page-title {
        font-size: clamp(1.6em, 8vw, 2.5em);
    }
    .subtitle, .page-subtitle {
        font-size: clamp(0.8em, 4.5vw, 1.1em);
    }

    /* Ensure galleries stack nicely */
    .gallery-items {
        justify-content: center;
    }
    .gallery-item {
        width: clamp(100px, 40vw, 150px); /* Further adjust clamp */
    }

    .full-bird-gallery {
        grid-template-columns: repeat(auto-fill, minmax(clamp(130px, 45vw, 180px), 1fr));
        gap: 10px;
    }

    .bird-name {
        font-size: 0.85em;
        padding: 8px 5px;
    }

    .youtube-gallery {
        grid-template-columns: 1fr; /* Force single column */
        gap: 15px;
    }

    .video-item {
        /* Adjust padding-bottom if aspect ratio looks wrong on small screens */
    }

    .about-preview p {
        font-size: 0.95em;
    }

    .cta-button {
        width: 80%;
        text-align: center;
    }

    .main-footer-content {
        font-size: 0.8em;
    }
}
