/* =========================================================================
   STEP 1: The Blueprint
   We are setting up our global colors as variables so they are easy to change later, 
   and resetting the browser's default spacing so our design is consistent.
   ========================================================================= */
/* Defines global CSS variables for colors and themes. */
:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --bg-color: #f8fafc;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --white: #ffffff;
    --border: #e2e8f0;
}
/* A universal reset to remove default browser margins and paddings. */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
/* Sets the base font, background color, and text color for the entire site. */
body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.5;
}

/* =========================================================================
   STEP 2: Top Navigation (Intro to Flexbox)
   We use display: flex to easily place our logo on the far left and our 
   links on the far right using justify-content: space-between.
   ========================================================================= */
/* The main container for the top navigation bar. */
.top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #0f172a;
    padding: 1rem 2rem;
}
/* A flex container for the navigation links to space them out. */
.nav-links {
    display: flex;
    gap: 1.5rem;
}
/* Styling for individual navigation links. */
.back-link {
    color: var(--white);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}
/* The hover state for navigation links. */
.back-link:hover {
    color: #93c5fd;
}

/* =========================================================================
   STEP 3: The Hero Section (Stacking Layers)
   We are using absolute positioning and z-index to stack elements like a 
   sandwich: background image on the bottom (0), dark overlay in the middle (1), 
   and our text on top (2).
   ========================================================================= */
/* The main container for the large hero section at the top of the page. */
.hero {
    position: relative;
    color: var(--white);
    padding: 6rem 2rem;
    text-align: center;
    overflow: hidden;
}
/* The container that holds the rotating background images. */
#hero-backgrounds {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}
/* An individual background image slide. */
.hero-bg-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    opacity: 0;
    transition: opacity 1.5s ease-in-out;
}
/* The class that makes a background slide visible. */
.hero-bg-slide.active {
    opacity: 1;
}
/* A dark overlay to ensure the white text on top is readable. */
.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.75);
    z-index: 1;
}
/* The container for the hero's text content, keeping it centered. */
.hero-content {
    position: relative;
    z-index: 2;
    max-width: 800px;
    margin: 0 auto;
}

/* The main headline in the hero section. */
.hero h1 {
    font-size: 3.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    letter-spacing: -0.05em;
}
/* The paragraph of text below the main hero headline. */
.hero p {
    font-size: 1.125rem;
    color: #cbd5e1;
    margin-bottom: 2.5rem;
}

/* =========================================================================
   STEP 4: Search Bar & Upload Button
   We are putting the text input and the upload button inside a Flexbox 
   container with rounded corners to make them look like one single, 
   modern search bar.
   ========================================================================= */
/* The main wrapper for the search input and upload button. */
.search-container {
    display: flex;
    background: var(--white);
    border-radius: 50px;
    padding: 0.5rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    align-items: center;
}
/* The text input field for searching species. */
.search-input {
    flex: 1;
    border: none;
    padding: 1rem 1.5rem;
    font-size: 1rem;
    border-radius: 50px 0 0 50px;
    outline: none;
}
/* The "Upload Image" button. */
.upload-btn {
    background-color: var(--primary);
    color: var(--white);
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 50px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: background-color 0.2s;
}
/* The hover state for the upload button. */
.upload-btn:hover {
    background-color: var(--primary-hover);
}

/* =========================================================================
   STEP 5: The Species Directory (CSS Grid)
   This one line of CSS Grid code automatically creates a responsive grid 
   that shrinks and grows depending on the screen size, without us needing 
   to write complex rules.
   ========================================================================= */
/* The main container for the entire species directory section. */
.catalog {
    max-width: 1200px;
    margin: 4rem auto;
    padding: 0 2rem;
}
/* The header for the catalog, containing the title and species count. */
.catalog-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}
/* The responsive grid container that holds all the bird cards. */
.bird-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
}

/* =========================================================================
   STEP 6: Bird Cards & Hover Effects
   We are adding a hover effect using transform: translateY(-4px) so the card 
   slightly lifts up when the user points at it, making it feel interactive.
   ========================================================================= */
/* The main card element for a single bird species. */
.bird-card {
    background: var(--white);
    border-radius: 12px;
    border: 1px solid var(--border);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    cursor: pointer;
}
/* The hover effect that lifts the card up slightly. */
.bird-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
}
/* The top part of the card that contains the bird's image. */
.card-image {
    height: 220px;
    background-size: cover;
    background-position: center;
    position: relative;
    background-color: #e2e8f0;
}
/* The bottom part of the card containing all the textual information. */
.card-content {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    flex: 1;
}
/* The bird's common name inside the card. */
.card-content h3 {
    font-size: 1.25rem;
    color: var(--text-main);
}
/* The bird's scientific name, styled to be italic and muted. */
.scientific-name {
    font-style: italic;
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: 1rem;
}
/* The short description of the bird on the card. */
.description {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
}

/* =========================================================================
   STEP 7: Badges and Buttons
   We use absolute positioning again to pin the status badge to the top-right 
   corner of the bird image, and style the view button to match our brand colors.
   ========================================================================= */
/* The base style for the conservation status badge. */
.status {
    position: absolute;
    top: 1rem;
    right: 1rem;
    padding: 0.25rem 0.75rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--white);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
/* Style for the 'Critically Endangered' badge. */
.status.critical {
    color: #dc2626;
    border: 1px solid #fca5a5;
}
/* Style for the 'Vulnerable' badge. */
.status.vulnerable {
    color: #d97706;
    border: 1px solid #fcd34d;
}
/* Style for the 'Least Concern' badge. */
.status.least-concern {
    color: #16a34a;
    border: 1px solid #86efac;
}
/* Style for the 'Near Threatened' badge. */
.status.near-threatened {
    color: #ea580c;
    border: 1px solid #fdba74;
}
/* The "View Profile" button at the bottom of the card. */
.view-btn {
    margin-top: auto;
    width: 100%;
    padding: 0.75rem;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-main);
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}
/* The hover state for the view button, which is triggered when hovering over the entire card. */
.bird-card:hover .view-btn {
    border-color: var(--primary);
    color: var(--primary);
    background: #eff6ff;
}

/* =========================================================================
   STEP 8: The Footer
   The main page layout is done. We just add a dark footer to create a 
   clean stopping point for the user at the bottom of the page.
   ========================================================================= */
/* The main footer container for the entire site. */
.site-footer {
    background-color: #0f172a;
    color: #94a3b8;
    text-align: center;
    padding: 2.5rem 2rem;
    margin-top: 4rem;
    border-top: 1px solid #1e293b;
}
/* A wrapper for the footer content to control its maximum width. */
.footer-content {
    max-width: 800px;
    margin: 0 auto;
}
/* Styling for paragraph text within the footer. */
.site-footer p {
    margin: 0.25rem 0;
    font-size: 0.95rem;
    letter-spacing: 0.02em;
}
/* Styles the first line of text in the footer to be more prominent. */
.site-footer p:first-child {
    color: #cbd5e1;
    font-weight: 500;
}

/* =========================================================================
   STEP 9: Details Page & Media Queries
   This is for the individual bird profile page. We are using a @media query 
   to tell the browser: use 1 column for mobile, but switch to 2 columns 
   if the screen is wide enough for a desktop.
   ========================================================================= */
/* The main container for the content on the details page. */
.profile-container {
    max-width: 1000px;
    margin: 3rem auto;
    padding: 0 2rem;
    background: var(--white);
    border-radius: 16px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05);
}
/* The header section of the profile, containing the name and status badge. */
.profile-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 2.5rem 2.5rem 1.5rem 2.5rem;
    border-bottom: 1px solid var(--border);
}
/* The main heading (bird's name) on the details page. */
.profile-header h1 {
    font-size: 2.5rem;
    color: var(--text-main);
    line-height: 1.2;
    margin-bottom: 0.25rem;
}
/* A modifier to make the status badge work on the details page without absolute positioning. */
.static-status {
    position: static;
    display: inline-block;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
}
/* The grid layout for the main content area of the details page. */
.profile-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    padding: 2.5rem;
}
/* A media query to switch to a two-column layout on wider screens. */
@media (min-width: 768px) {
    .profile-grid {
        grid-template-columns: 1fr 1fr;
    }
}
/* A responsive container that maintains a 16:9 aspect ratio for embedded videos. */
.video-container {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    margin-top: 1.5rem;
    border-radius: 12px;
    overflow: hidden;
    background: #000;
}
/* Ensures the iframe (the video player) fills the video container. */
.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}
/* Subheadings within the profile info section (e.g., "Description", "Origin"). */
.profile-info h3 {
    font-size: 1.25rem;
    color: var(--text-main);
    margin-bottom: 0.75rem;
}
/* The main paragraph text for details like description and origin. */
.detail-text {
    color: var(--text-muted);
    font-size: 1.05rem;
    line-height: 1.7;
}
/* The container for the "Expert Advice" section, styled like a callout box. */
.expert-box {
    background: #eff6ff;
    border-left: 4px solid var(--primary);
    padding: 1.5rem;
    margin-top: 2rem;
    border-radius: 0 12px 12px 0;
}
/* The "Expert Advice" heading inside the callout box. */
.expert-box h4 {
    color: var(--primary);
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}
/* The paragraph text inside the expert advice box. */
.expert-box p {
    color: #1e3a8a;
    font-size: 1rem;
    line-height: 1.6;
}
/* A utility class for adding top margin. */
.mt-6 {
    margin-top: 1.5rem;
}
/* A utility class for adding top margin. */
.mt-4 {
    margin-top: 1rem;
}
/* The container for displaying an error message if a bird is not found. */
.error-container {
    text-align: center;
    padding: 5rem 2rem;
    max-width: 600px;
    margin: 4rem auto;
}

/* The "Learn More on Wikipedia" button on the details page. */
.learn-more-btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background-color: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
    text-align: center;
    width: 100%;
}
/* The hover state for the "Learn More" button. */
.learn-more-btn:hover {
    background-color: var(--primary);
    color: var(--white);
}
/* A media query to make the button's width automatic on larger screens. */
@media (min-width: 768px) {
    .learn-more-btn {
        width: auto;
    }
}

/* =========================================================================
   STEP 10: Video and Carousel (The End)
   Finally, we set up the containers for our YouTube videos and image carousels. 
   We use opacity: 0 and opacity: 1 so the images can smoothly crossfade 
   into each other later.
   ========================================================================= */
/* The main footer container for the entire site. */
.site-footer {
    background-color: #0f172a;
    color: #94a3b8;
    text-align: center;
    padding: 2.5rem 2rem;
    margin-top: 4rem;
    border-top: 1px solid #1e293b;
}
/* A wrapper for the footer content to control its maximum width. */
.footer-content {
    max-width: 800px;
    margin: 0 auto;
}
/* Styling for paragraph text within the footer. */
.site-footer p {
    margin: 0.25rem 0;
    font-size: 0.95rem;
    letter-spacing: 0.02em;
}
/* Styles the first line of text in the footer to be more prominent. */
.site-footer p:first-child {
    color: #cbd5e1;
    font-weight: 500;
}

/* The main container for the image carousel on the details page. */
.carousel-container {
    position: relative;
    height: 400px;
    border-radius: 12px;
    overflow: hidden;
    background-color: #e2e8f0;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.1);
}
/* A wrapper for the carousel slides. */
.carousel-images {
    position: absolute;
    width: 100%;
    height: 100%;
}
/* An individual image slide in the carousel. */
.carousel-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    opacity: 0;
    transition: opacity 0.6s ease-in-out;
}
/* The class that makes a carousel slide visible. */
.carousel-slide.active {
    opacity: 1;
    z-index: 1;
}
/* The container for the navigation dots at the bottom of the carousel. */
.carousel-dots-container {
    position: absolute;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.6);
    padding: 8px 12px;
    border-radius: 50px;
    z-index: 100;
    pointer-events: auto;
}
/* An individual navigation dot. */
.carousel-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    transition: all 0.3s ease;
}
/* The hover state for a navigation dot. */
.carousel-dot:hover {
    background-color: rgba(255, 255, 255, 0.8);
}
/* The style for the currently active navigation dot, making it wider. */
.carousel-dot.active {
    width: 24px;
    border-radius: 10px;
    background-color: #ffffff;
}