/* ==========================================================================
   1. Global Reset & Base Styles
   ========================================================================== */
* {
    padding: 0;
    margin: 0;
    box-sizing: border-box;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}

body {
    background-color: #f7f7f7;
    overflow-x: hidden;
}

/* /* ==========================================================================
   Base Desktop Header Styles
   ========================================================================== */
header {
    position: absolute;
    width: 100%;
    top: 0;
    left: 0;
    z-index: 100; /* High z-index to stay above hero graphics */
}

header nav {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 40px;
}

nav .logo {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #242424;
    z-index: 101; /* Keeps logo above the mobile menu overlay */
}

nav .logo img {
    width: 35px;
    height: 35px;
    object-fit: contain;
}

nav .nav-links {
    display: flex;
    align-items: center;
    gap: 25px;
}

nav .nav-links a {
    text-decoration: none;
    color: #444;
    font-weight: 500;
    transition: color 0.2s ease;
}

nav .nav-links a:hover {
    color: rgb(225, 0, 255);
}

nav .nav-links a.login-btn {
    background: #242424;
    color: #fff;
    padding: 8px 18px;
    border-radius: 20px;
}

/* Hide the toggle button on Desktop */
.menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 21px;
    background: transparent;
    border: none;
    cursor: pointer;
    z-index: 101; /* Keeps toggle button accessible over overlay */
}

.menu-toggle .bar {
    height: 3px;
    width: 100%;
    background-color: #242424;
    border-radius: 10px;
    transition: all 0.3s ease;
}

/* ==========================================================================
   Mobile Responsive Navigation Menu (768px and down)
   ========================================================================== */
@media (max-width: 768px) {
    header nav {
        padding: 20px;
        flex-direction: row;
    }

    /* Reveal hamburger menu icon */
    .menu-toggle {
        display: flex;
    }

    /* Transform navigation links into a fullscreen/dropdown drawer */
    nav .nav-links {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: rgba(255, 255, 255, 0.98); /* Blurs/covers screen nicely */
        flex-direction: column;
        justify-content: center;
        gap: 30px;
        z-index: 100;
        
        /* Hidden state (shifted completely offscreen up) */
        opacity: 0;
        pointer-events: none;
        transform: translateY(-100%);
        transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
    }

    /* Active state injected by JavaScript */
    nav .nav-links.active {
        opacity: 1;
        pointer-events: auto;
        transform: translateY(0);
    }

    nav .nav-links a {
        font-size: 1.5rem; /* Larger touch targets for mobile */
        font-weight: 600;
    }

    nav .nav-links a.login-btn {
        font-size: 1.2rem;
        padding: 12px 40px;
        border-radius: 30px;
    }

    /* Animate Hamburger Bars into an 'X' close button when active */
    .menu-toggle.active .bar:nth-child(1) {
        transform: translateY(9px) rotate(45deg);
    }

    .menu-toggle.active .bar:nth-child(2) {
        opacity: 0;
    }

    .menu-toggle.active .bar:nth-child(3) {
        transform: translateY(-9px) rotate(-45deg);
    }
}

/* ==========================================================================
   3. Hero Section Elements
   ========================================================================== */
.hero {
    gap: 30px;
    padding: 140px 20px 60px 20px; /* Enhanced top padding prevents overlap with header */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 75vh;
    width: 100%;
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
    text-align: center;
}

.hero .text {
    display: flex;
    flex-direction: column;
    gap: 15px;
    max-width: 750px;
}

.hero h1 {
    font-size: 3.5rem;
    font-weight: 800;
    color: rgb(36, 36, 36);
    line-height: 1.2;
}

.hero h1 span {
    color: transparent;
    background: linear-gradient(90deg, #e100ff, #00d9ff);
    -webkit-background-clip: text;
    background-clip: text;
}

.hero p {
    font-size: 1.1rem;
    color: #555;
    line-height: 1.6;
}

/* Hero Search Bar */
.hero form {
    width: 100%;
    display: flex;
    justify-content: center;
}

.hero input {
    padding: 18px 25px;
    width: 50%;
    max-width: 600px;
    border-radius: 10px; /* Pinterest rounded pill-style input box */
    border: 2px solid rgb(219, 219, 219);
    font-size: 1rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.03);
    transition: all 0.2s ease;
}

.hero input:focus {
    border-color: rgb(225, 0, 255);
    outline: none;
    box-shadow: 0 4px 20px rgba(225, 0, 255, 0.15);
}

form input::placeholder {
    font-size: 1rem;
    color: #999;
}

/* Explore Button */
.explore-btn {
    text-decoration: none;
    color: #242424;
    font-weight: 600;
    padding: 10px 24px;
    border: 2px solid #242424;
    border-radius: 10px;
    transition: all 0.2s ease;
}

.explore-btn:hover {
    background: #242424;
    color: #fff;
}

/* ==========================================================================
   4. Pinterest Masonry Image Grid
   ========================================================================== */
.grid-container {
    column-width: 260px; 
    column-gap: 20px;    
    max-width: 1300px;
    margin: 0 auto;
    padding: 0 20px 80px 20px; /* Bottom padding gives space at base of page */
}

.card {
    background-color: #fff;
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 20px; 
    break-inside: avoid; /* Prevents card breakdown splits across columns */
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.02);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.08);
}

.card img {
    width: 100%;
    display: block; 
    height: auto;   
    object-fit: cover;
}

.card-content {
    padding: 14px;
}

.card-content h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #222;
}

/* ==========================================================================
   5. Media Queries (Responsive Styling)
   ========================================================================== */

/* Tablet & Smaller Desktops */
@media (max-width: 1024px) {
    .hero input {
        width: 70%;
    }
    .hero h1 {
        font-size: 2.8rem;
    }
}

/* Mobile Devices */
@media (max-width: 768px) {
    header nav {
        padding: 20px;
        flex-direction: row;
        gap: 15px;
    }

    nav .nav-links {
        gap: 15px;
        flex-wrap: wrap;
        justify-content: center;
    }

    .hero {
        padding-top: 180px; /* Give room for stacked nav elements */
    }

    .hero h1 {
        font-size: 2.2rem;
    }

    .hero input {
        width: 90%;
        padding: 15px 20px;
    }
    
    .grid-container {
        column-width: 160px; /* Shrinks minimum size targets so 2 columns fit on mobile */
        column-gap: 12px;
        padding: 0 12px 40px 12px;
    }
    
    .card {
        margin-bottom: 12px;
        border-radius: 12px;
    }
}