/* Basic Reset & Typography */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    background-color: #1a1a1a; /* Dark background */
    color: #ffffff; /* White text */
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p, ul {
    margin: 0;
    padding: 0;
}

ul {
    list-style: none;
}

a {
    text-decoration: none;
    color: inherit;
}

img {
    max-width: 100%;
    display: block;
}

/* Header */
.site-header {
    border-bottom: 1px solid #333333; /* Darker border */
    padding: 1rem 1rem; /* Slightly reduced padding */
    background-color: #000000; /* Even darker for header */
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative; /* Needed for mobile logo centering */
    min-height: 70px; /* Match logo height to prevent collapse */
}

/* CHANGE #1: CENTER LOGO ON MOBILE */
.logo {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: auto;
}

.logo .grail-haus-logo {
    height: 70px; /* Your original height */
    width: auto;
    display: block; 
}

.main-nav {
    display: none; /* Hidden on mobile */
}

/* THIS IS THE FIX
  Changed ".main-nav ul" to ".main-nav > ul"
  This now only targets the main nav list, not the dropdown list.
*/
.main-nav > ul {
    display: flex;
    gap: 2rem; 
}

/* CHANGE #3: DESKTOP DROPDOWN STYLING (Part 1) */
.dropdown-item {
    position: relative;
}

.main-nav a {
    font-size: 0.9rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1.5px; 
    color: #ffffff;
    transition: color 0.3s ease; 
}

.main-nav a:hover {
    color: #aaaaaa; 
}

.header-icons {
    display: none; /* Hidden on mobile */
    gap: 1.5rem; 
}

.header-icons a {
    font-size: 0.9rem;
    font-weight: 500;
    text-transform: uppercase;
    color: #ffffff;
    transition: color 0.3s ease;
}

.header-icons a:hover {
    color: #aaaaaa;
}

.mobile-nav-toggle {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #ffffff; 
    z-index: 2; /* Ensure it's clickable above the centered logo */
}

/* Mobile Navigation */
.mobile-nav {
    /* CHANGE #2: SMOOTH DROPDOWN ANIMATION */
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-out; /* The animation */
    
    background-color: #000000; 
    border-bottom: 1px solid #333333;
    position: absolute; 
    width: 100%;
    z-index: 1000;
}

.mobile-nav.active {
    /* CHANGE #2: SMOOTH DROPDOWN ANIMATION */
    max-height: 50vh; 
}

.mobile-nav ul {
    display: flex;
    flex-direction: column;
}

.mobile-nav li {
    border-top: 1px solid #333333;
}

.mobile-nav a {
    display: block;
    padding: 1rem;
    font-weight: 500;
    color: #ffffff;
    transition: background-color 0.3s ease;
}

.mobile-nav a:hover {
    background-color: #2a2a2a;
}

/* CHANGE #3: DESKTOP DROPDOWN STYLING (Part 2) */
.dropdown-menu {
    display: none;
}


/* ... rest of your main content and footer CSS ... */
/* (No changes needed in .main-content or .site-footer) */

.main-content {
    max-width: 1400px;
    margin: 3rem auto; /* Increased margin */
    padding: 0 1rem;
}

.main-content h2 {
    font-size: 2rem; /* Larger heading */
    font-weight: 600; /* Bolder heading */
    margin-bottom: 2.5rem; /* More spacing */
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* 2 columns on mobile */
    gap: 1.5rem; /* Increased gap */
}

.product-item {
    text-align: left;
    background-color: #000000; /* Dark product background */
    padding-bottom: 1rem; /* Padding for info area */
    border: 1px solid #333333; /* Subtle border */
    transition: transform 0.3s ease; /* Hover effect */
}

.product-item:hover {
    transform: translateY(-5px); /* Lift on hover */
}

.product-image {
    background-color: #1a1a1a; /* Image placeholder background */
    margin-bottom: 1rem; /* More spacing */
}

.product-image img {
    width: 100%;
}

.product-info {
    padding: 0 1rem; /* Padding inside product info */
}

.product-brand {
    font-size: 0.85rem;
    color: #aaaaaa; /* Lighter grey for brand */
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.product-name {
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: #ffffff;
}

.product-price {
    font-size: 1.1rem;
    font-weight: 600;
    color: #ffffff;
}

/* Footer */
.site-footer {
    background-color: #000000; /* Dark footer */
    padding: 4rem 1rem; /* More padding */
    border-top: 1px solid #333333;
    margin-top: 4rem; /* More margin */
}

.footer-container {
    max-width: 1400px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr; /* Single column on mobile */
    gap: 2.5rem; /* Increased gap */
}

.footer-column h4 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #ffffff;
}

.footer-column ul {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.footer-column a {
    font-size: 0.9rem;
    color: #aaaaaa; /* Lighter grey for links */
    transition: color 0.3s ease;
}

.footer-column a:hover {
    color: #ffffff;
}

.footer-bottom {
    max-width: 1400px;
    margin: 3rem auto 0; /* More margin */
    padding-top: 2.5rem;
    border-top: 1px solid #333333;
    text-align: center;
    font-size: 0.8rem;
    color: #666666; /* Subtler copyright text */
}


/* Desktop Styles (Media Query) */
@media (min-width: 768px) {
    .mobile-nav-toggle {
        display: none;
    }

    /* CHANGE #1: RESET MOBILE LOGO STYLING */
    .logo {
        position: static;
        transform: none;
    }

    .main-nav {
        display: block;
    }

    .header-icons {
        display: flex;
    }

    .product-grid {
        grid-template-columns: repeat(4, 1fr); /* 4 columns on desktop */
        gap: 2rem; /* Increased gap */
    }

    .footer-container {
        grid-template-columns: repeat(3, 1fr); /* 3 columns on desktop */
    }

    /* CHANGE #3: DESKTOP DROPDOWN STYLING (Part 3) */
    .dropdown-menu {
        display: none; /* This rule will now work properly */
        position: absolute;
        top: 100%; /* Position right below the parent <li> */
        left: 0;
        background-color: #000000;
        border: 1px solid #333333;
        padding: 0.5rem 0;
        z-index: 1100;
        min-width: 200px; /* Set a minimum width */
    }

    .dropdown-menu li {
        border-top: none; /* Remove mobile border */
    }

    .dropdown-menu a {
        padding: 0.75rem 1.5rem;
        display: block; /* Make the whole area clickable */
        white-space: nowrap; /* Prevent line breaks */
    }

    .dropdown-menu a:hover {
        background-color: #2a2a2a; /* Use existing hover color */
    }

    /* This is the magic: show the menu when hovering the parent */
    .dropdown-item:hover .dropdown-menu {
        display: block;
    }
}

/* Adds vertical spacing to all section headings after the first one */
.product-grid + h2 {
    margin-top: 3rem;
}

/* === GRAIL RAIN EFFECT STYLES === */

#grail-rain-container {
    position: fixed; /* Stays in place on scroll */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden; /* Hides logos outside the screen */
    z-index: 0; /* Sits at the back, but not *behind* the body */
}

/* This is CRITICAL. We must tell all your main content
  to sit *on top of* the rain container.
*/
.main-content,
.site-footer {
    position: relative;
    z-index: 1; /* Sits above the rain */
}

.site-header,
.mobile-nav {
    position: relative;
    z-index: 2; /* Sits above the rain AND the main content */
}

.raining-logo {
    position: absolute;
    top: -100px; 
    
    /* These prefixes are for better browser support */
    -webkit-mask-image: url('logo-transparent.png');
    -webkit-mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    -webkit-mask-position: center;

    /* The JavaScript will now control this background-color */
    
    animation-name: fall;
    animation-timing-function: linear;
    animation-iteration-count: infinite;
}

/* The falling animation */
@keyframes fall {
    from {
        transform: translateY(0);
    }
    to {
        transform: translateY(110vh); /* 110vh makes sure it goes *past* the bottom */
    }
}

#preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #000000; /* Solid black background */
    z-index: 9999; /* Must be higher than header and rain */
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

/* The Logo Animation */
.loader-logo {
    width: 80px; /* Adjust size as needed */
    animation: pulse 2s infinite ease-in-out;
}

/* Creates a gentle breathing effect */
@keyframes pulse {
    0% { opacity: 0.4; transform: scale(0.95); }
    50% { opacity: 1; transform: scale(1); }
    100% { opacity: 0.4; transform: scale(0.95); }
}

/* The class JS will add to hide the loader */
.loader-hidden {
    opacity: 0;
    visibility: hidden;
}

.music-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 50px;
    cursor: pointer;
    font-family: sans-serif;
    font-size: 14px;
}

.music-btn:hover {
    background: rgba(0, 0, 0, 0.9);
}