/* Reset and Base Styles */
:root {
    --primary-blue: #3b82f6; /* A slightly softer primary blue */
    --primary-blue-dark: #2563eb;
    --accent-green: #10b981;
    --text-dark: #1f2937;
    --text-medium: #4b5563;
    --text-light: #6b7280;
    --bg-light: #f4f7f6; /* Very light gray for body background */
    --bg-white: #ffffff;
    --border-light: #e5e7eb;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --border-radius-sm: 0.5rem;
    --border-radius-md: 0.75rem;
    --border-radius-lg: 1rem;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--text-medium);
    background-color: var(--bg-light);
}

/* Accessibility */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: #000;
    color: white;
    padding: 8px;
    text-decoration: none;
    z-index: 100;
}

.skip-link:focus {
    top: 0;
}

/* Header & Navigation */
.header {
    background: var(--bg-white);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid var(--border-light);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    height: 80px; /* Slightly increased height */
    gap: 40px; /* Add space between brand and nav menu */
}

.nav-brand {
    display: flex;
    align-items: center;
}

.brand-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: var(--primary-blue-dark);
    font-weight: 700;
    font-size: 1.6rem; /* Slightly larger brand text */
    letter-spacing: -0.5px;
}

.brand-logo {
    height: 40px; /* Adjust as needed */
    width: auto; /* Maintain aspect ratio */
    margin-right: 10px;
}

.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-around; /* Distribute space evenly */
    width: 30px; /* Slightly larger toggle */
    height: 25px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1001; /* Ensure it's above the menu when open */
}

.hamburger {
    width: 100%;
    height: 3px; /* Thicker lines */
    background: var(--text-dark);
    border-radius: 5px;
    transition: all 0.3s ease-in-out;
    transform-origin: 1px; /* Pivot point for rotation */
}

/* Hamburger animation */
.nav-toggle.active .hamburger:nth-child(1) {
    transform: rotate(45deg) translate(5px, 6px);
}

.nav-toggle.active .hamburger:nth-child(2) {
    opacity: 0; /* Hide middle line */
    transform: translateX(-20px);
}

.nav-toggle.active .hamburger:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -6px);
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 30px;
    align-items: center;
    justify-content: flex-start; /* Align nav items to start (left) */
}

.nav-item {
    position: relative; /* For proper dropdown positioning */
}

.nav-link {
    text-decoration: none;
    color: var(--text-medium);
    font-weight: 500;
    transition: color 0.3s ease, transform 0.2s ease;
    padding: 10px 0;
    position: relative; /* For underline effect */
}

.nav-link:hover {
    color: var(--primary-blue);
    transform: translateY(-2px); /* Subtle lift on hover */
}

/* Underline effect on hover */
.nav-link::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -5px;
    left: 0;
    background-color: var(--primary-blue);
    transition: width 0.3s ease-out;
}

.nav-link:hover::after {
    width: 100%;
}

/* Dropdown Menu */
.dropdown {
    position: relative;
}

.dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 8px; /* More space for the arrow */
    color: var(--text-medium);
    font-weight: 500;
    transition: color 0.3s ease;
    padding: 10px 0;
}

.dropdown-toggle:hover {
    color: var(--primary-blue);
}

.dropdown-toggle::after {
    content: '▼';
    font-size: 0.6rem; /* Smaller, subtler arrow */
    transition: transform 0.2s ease; /* Add transition for rotation */
}

/* Rotate arrow on hover or when dropdown is active */
.dropdown:hover .dropdown-toggle::after,
.dropdown.active .dropdown-toggle::after { /* Add .active for JS control */
    transform: rotate(180deg); /* Rotate arrow when dropdown is open */
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 15px); /* Slightly more space from toggle */
    left: 0;
    background: var(--bg-white);
    min-width: 220px; /* Slightly wider */
    box-shadow: var(--shadow-lg); /* More pronounced shadow */
    border-radius: var(--border-radius-md);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px); /* Animate from slightly below */
    transition: all 0.3s ease-out;
    list-style: none;
    padding: 10px 0;
    border: 1px solid var(--border-light);
    z-index: 1000; /* Ensure dropdown is above other content */
}

/* Use .show class for JavaScript toggle AND hover state for CSS-only */
.dropdown-menu.show,
.dropdown:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: block;
    padding: 12px 20px; /* More padding for items */
    color: var(--text-medium);
    text-decoration: none;
    transition: background 0.2s ease, color 0.2s ease;
    font-size: 0.95rem;
}

.dropdown-item:hover {
    background: var(--bg-light);
    color: var(--primary-blue);
}

/* Hero Section */
.hero {
    background: url('https://leong2599.github.io/sport_tools/images/hero-1.jpg') no-repeat center center/cover; /* Use full file system path */
    background-color: var(--primary-blue-dark); /* Fallback background color */
    color: var(--bg-white);
    padding: 120px 20px; /* Increased padding for more vertical space */
    text-align: center;
    position: relative;
    overflow: hidden; /* To contain any potential background effects */
}

/* Overlay for hero image to improve text readability */
.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.4); /* Dark semi-transparent overlay */
    z-index: 1;
    opacity: 1; /* Remove original pattern opacity */
    background-image: none; /* Remove subtle pattern, if any was there */
}

.hero-container {
    max-width: 900px; /* Slightly wider container for hero text */
    margin: 0 auto;
    position: relative;
    z-index: 2;
}

.hero h1 {
    font-size: 3.8rem; /* Slightly larger for impact */
    font-weight: 700;
    margin-bottom: 20px;
    line-height: 1.2;
    text-shadow: var(--shadow-sm); /* Subtle text shadow */
}

.hero-subtitle {
    font-size: 1.4rem; /* Slightly larger */
    margin-bottom: 40px;
    opacity: 0.95;
}

.hero-cta {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 14px 35px; /* Slightly more padding */
    text-decoration: none;
    border-radius: var(--border-radius-md); /* Use variable for border-radius */
    font-weight: 600;
    transition: all 0.3s ease; /* Smoother transition */
    cursor: pointer;
    border: none;
    font-size: 1.05rem; /* Slightly larger font */
}

.btn-primary {
    background: var(--primary-blue-dark);
    color: var(--bg-white);
    box-shadow: var(--shadow-md); /* Add shadow to primary button */
}

.btn-primary:hover {
    background: var(--primary-blue);
    transform: translateY(-3px); /* More pronounced lift effect */
    box-shadow: var(--shadow-lg); /* Larger shadow on hover */
}

.btn-secondary {
    background: transparent;
    color: var(--bg-white);
    border: 2px solid var(--bg-white);
}

.btn-secondary:hover {
    background: var(--bg-white);
    color: var(--primary-blue-dark);
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px; /* Consistent horizontal padding */
}

/* Tools Section */
.tools-section {
    padding: 80px 20px;
    background: var(--bg-light); /* Use the light background variable */
}

.tools-section h2 {
    text-align: center;
    font-size: 2.8rem; /* Slightly larger heading */
    margin-bottom: 60px;
    color: var(--text-dark); /* Use dark text variable */
}

.category-section {
    margin-bottom: 60px;
}

.category-section h3 {
    font-size: 2rem; /* Slightly larger sub-heading */
    margin-bottom: 30px;
    color: var(--primary-blue-dark); /* Use primary blue dark for category headings */
    display: flex;
    align-items: center;
    gap: 12px; /* Slightly increased gap */
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
}

.tool-card {
    background: var(--bg-white);
    padding: 30px;
    border-radius: var(--border-radius-md); /* Use variable for border-radius */
    box-shadow: var(--shadow-md); /* Use variable for shadow */
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease; /* Smoother transitions */
    border: 1px solid var(--border-light); /* Add subtle border */
}

.tool-card:hover {
    transform: translateY(-8px); /* More pronounced lift effect */
    box-shadow: var(--shadow-lg); /* Larger shadow on hover */
}

.tool-icon {
    font-size: 3.5rem; /* Slightly larger icon */
    margin-bottom: 20px;
    color: var(--primary-blue); /* Color icons with primary blue */
}

.tool-card h4 {
    font-size: 1.4rem; /* Slightly larger heading */
    margin-bottom: 15px;
    color: var(--text-dark); /* Use dark text variable */
}

.tool-card p {
    color: var(--text-light); /* Use light text variable */
    margin-bottom: 20px;
    line-height: 1.6;
}

.tool-link {
    color: var(--primary-blue-dark);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease;
}

.tool-link:hover {
    color: var(--primary-blue);
    text-decoration: underline;
}

/* Blog Preview Section */
.blog-preview {
    padding: 80px 20px;
    background: var(--bg-white); /* Blog section on white background */
}

.blog-preview h2 {
    text-align: center;
    font-size: 2.8rem;
    margin-bottom: 60px;
    color: var(--text-dark);
}

.blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); /* Adjusted minmax for better flow */
    gap: 40px;
    margin-bottom: 40px;
}

.blog-card {
    background: var(--bg-white);
    border-radius: var(--border-radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid var(--border-light); /* Add subtle border */
}

.blog-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
}

.blog-image {
    width: 100%;
    height: 220px; /* Slightly increased image height */
    object-fit: cover;
}

.blog-content {
    padding: 25px; /* Slightly reduced padding */
}

.blog-category {
    display: inline-block;
    background: var(--primary-blue);
    color: var(--bg-white);
    padding: 6px 16px; /* Adjusted padding */
    border-radius: var(--border-radius-sm);
    font-size: 0.85rem; /* Slightly smaller font */
    font-weight: 600;
    margin-bottom: 15px;
    text-transform: uppercase; /* Uppercase for category */
    letter-spacing: 0.5px;
}

.blog-card h3 {
    font-size: 1.5rem; /* Slightly larger heading */
    margin-bottom: 15px;
}

.blog-card h3 a {
    color: var(--text-dark);
    text-decoration: none;
    transition: color 0.3s ease;
}

.blog-card h3 a:hover {
    color: var(--primary-blue-dark);
}

.blog-card p {
    color: var(--text-light);
    margin-bottom: 20px;
    line-height: 1.6;
}

.blog-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--text-light);
}

.blog-cta {
    text-align: center;
}

/* Footer */
.footer {
    background: var(--text-dark); /* Dark background for footer */
    color: var(--bg-white);
    padding: 60px 20px 20px;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 40px;
    margin-bottom: 40px;
}

.footer-section h4 {
    font-size: 1.3rem; /* Slightly larger heading */
    margin-bottom: 20px;
    color: var(--primary-blue); /* Use primary blue for headings */
}

.footer-section p {
    color: var(--border-light); /* Lighter text for paragraphs */
    line-height: 1.6;
    margin-bottom: 20px;
}

.footer-links {
    list-style: none;
}

.footer-links li {
    margin-bottom: 10px;
}

.footer-links a {
    color: var(--border-light);
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-links a:hover {
    color: var(--primary-blue);
}

.social-links {
    display: flex;
    gap: 15px;
}

.social-links a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--text-medium); /* Darker background for social icons */
    color: var(--bg-white);
    text-decoration: none;
    border-radius: 50%;
    transition: background 0.3s ease, transform 0.2s ease;
}

.social-links a:hover {
    background: var(--primary-blue);
    transform: translateY(-3px); /* Lift effect on hover */
}

.newsletter-form {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.newsletter-form input {
    flex: 1;
    padding: 10px;
    border: 1px solid var(--border-light); /* Border from variable */
    border-radius: var(--border-radius-sm);
    font-size: 1rem;
    background-color: var(--bg-white);
    color: var(--text-dark);
}

.newsletter-form button {
    padding: 10px 20px;
    background: var(--primary-blue-dark);
    color: var(--bg-white);
    border: none;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    font-weight: 600;
    transition: background 0.3s ease, transform 0.2s ease;
}

.newsletter-form button:hover {
    background: var(--primary-blue);
    transform: translateY(-2px);
}

.footer-bottom {
    border-top: 1px solid var(--text-medium); /* Darker border for contrast */
    padding-top: 20px;
    text-align: center;
    color: var(--text-light); /* Lighter gray for bottom text */
}

.footer-bottom a {
    color: var(--primary-blue);
    text-decoration: none;
}

/* Responsive Design */
@media (max-width: 768px) {
    .nav-toggle {
        display: flex; /* Show hamburger on mobile */
    }
    
    .nav-menu {
        flex-grow: 1; /* Allow nav-menu to take available space */
        justify-content: flex-start; /* Align items to start (left) */
        display: flex; /* Ensure it's a flex container */
    
    
        position: fixed;
        left: -100%; /* Start off-screen */
        top: 80px; /* Below the header */
        flex-direction: column;
        background-color: var(--bg-white);
        width: 100%;
        max-width: 300px; /* Constrain width for slide-in effect */
        height: calc(100vh - 80px); /* Fill remaining viewport height */
        text-align: left; /* Align text left in mobile menu */
        transition: all 0.4s ease-in-out; /* Smooth slide-in/out */
        box-shadow: var(--shadow-lg); /* Deeper shadow for mobile menu */
        padding: 20px 0;
        border-top: 1px solid var(--border-light);
        overflow-y: auto; /* Enable scrolling for long menus */
    }

    .nav-menu.active {
        left: 0; /* Slide in */
        visibility: visible;
        z-index: 1000;
    }
    
    .nav-item {
        width: 100%; /* Full width for mobile items */
        margin-bottom: 5px; /* Space between items */
    }

    .nav-link {
        padding: 15px 20px; /* More padding for tap targets */
        border-bottom: 1px solid var(--border-light); /* Separator */
        color: var(--text-dark); /* Stronger color for mobile links */
    }

    .nav-link:hover {
        background-color: var(--bg-light); /* Highlight on hover/tap */
        color: var(--primary-blue-dark);
        transform: none; /* Remove lift effect on mobile */
    }

    .nav-link::after { /* Remove underline effect on mobile */
        display: none;
    }

    .dropdown-toggle {
        padding: 15px 20px;
        justify-content: space-between; /* Arrow to the right */
        width: 100%;
        border-bottom: 1px solid var(--border-light);
    }
    
    .dropdown-toggle::after {
        font-size: 0.9rem; /* Larger arrow for mobile */
    }

    .dropdown-menu {
        position: static; /* Stack dropdown items vertically */
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        background: var(--bg-light); /* Lighter background for sub-menu */
        border: none;
        border-radius: 0;
        padding: 0; /* Remove padding */
        margin-top: 0;
        padding-left: 20px; /* Indent sub-items */
    }

    .dropdown-item {
        padding: 10px 20px; /* Adjust padding for sub-items */
        font-size: 0.9rem;
        border-bottom: 1px solid var(--border-light);
    }
    
    /* Ensure dropdown items match nav-link hover style on mobile */
    .dropdown-item:hover {
        background: var(--bg-light);
        color: var(--primary-blue-dark);
    }

    .hero h1 {
        font-size: 3rem; /* Adjusted for smaller screens */
    }
    
    .hero-subtitle {
        font-size: 1.2rem;
    }
    
    .hero-cta {
        flex-direction: column;
        align-items: center;
    }
    
    .tools-grid {
        grid-template-columns: 1fr;
    }
    
    .blog-grid {
        grid-template-columns: 1fr;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
    }
    
    .social-links {
        justify-content: center;
    }
    
    .newsletter-form {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .hero {
        padding: 80px 20px; /* Slightly less padding on very small screens */
    }
    
    .hero h1 {
        font-size: 2.2rem;
    }
    
    .tools-section,
    .blog-preview {
        padding: 60px 20px;
    }
    
    .tool-card,
    .blog-content {
        padding: 20px;
    }
}

/* Animation Classes */
.fade-in {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Focus States for Accessibility */
.btn:focus,
.nav-link:focus,
.tool-link:focus {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .header,
    .footer,
    .hero-cta,
    .blog-cta {
        display: none;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.4;
    }
    
    .tool-card,
    .blog-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }
}