/* General Reset & Base Styles */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
    line-height: 1.6;
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Theme Variables */
:root {
    --primary-color: #007bff;
    --secondary-color: #6c757d;
    --accent-color: #17a2b8;
    --light-bg: #f8f9fa;
    --light-text: #212529;
    --dark-bg: #1a1a1a; /* Darker background */
    --dark-text: #f8f9fa; /* Lighter text for dark mode */
    --nav-bg: rgba(255, 255, 255, 0.9); /* Slightly transparent white */
    --nav-text: #333;
    --nav-bg-dark: rgba(26, 26, 26, 0.9); /* Slightly transparent dark */
    --nav-text-dark: #f1f1f1;
    --footer-bg: #e9ecef;
    --footer-text: #6c757d;
    --footer-bg-dark: #111; /* Darker footer */
    --footer-text-dark: #aaa;
    --link-hover-color: #0056b3;
    --button-bg: var(--primary-color);
    --button-text: #fff;
    --button-hover-bg: #0056b3;
    --section-padding: 4rem 2rem; /* Generous padding */
    --border-color: #dee2e6;
    --border-color-dark: #444;
    --error-color: #dc3545;
}

body[data-theme="light"] {
    --bg-color: var(--light-bg);
    --text-color: var(--light-text);
    --nav-bg-color: var(--nav-bg);
    --nav-text-color: var(--nav-text);
    --footer-bg-color: var(--footer-bg);
    --footer-text-color: var(--footer-text);
    --current-border-color: var(--border-color);
}

body[data-theme="dark"] {
    --bg-color: var(--dark-bg);
    --text-color: var(--dark-text);
    --nav-bg-color: var(--nav-bg-dark);
    --nav-text-color: var(--nav-text-dark);
    --footer-bg-color: var(--footer-bg-dark);
    --footer-text-color: var(--footer-text-dark);
    --current-border-color: var(--border-color-dark);
    --link-hover-color: #3399ff; /* Lighter hover for dark mode */
    --button-hover-bg: #3399ff;
}

/* Typography */
h1, h2, h3 {
    line-height: 1.2;
    margin-bottom: 1rem;
    color: var(--text-color); /* Ensure headings inherit theme color */
}

h1 {
    font-size: 2.5rem; /* Responsive font size base */
}

h2 {
    font-size: 2rem;
    text-align: center;
    margin-bottom: 2rem;
}

h3 {
    font-size: 1.5rem;
}

p {
    margin-bottom: 1rem;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover, a:focus {
    color: var(--link-hover-color);
    text-decoration: underline;
    outline: 2px solid transparent; /* Basic focus outline removal, will add better later */
}

/* Add focus styles for accessibility */
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible {
    outline: 2px dashed var(--primary-color);
    outline-offset: 2px;
}


/* Layout */
.container { /* Optional container for centered content */
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1rem;
}

main {
    padding-top: 60px; /* Adjust based on nav height */
}

.content-section {
    padding: var(--section-padding);
    max-width: 900px; /* Limit content width for readability */
    margin: 0 auto; /* Center content sections */
}

/* Sticky Navigation */
.sticky-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background-color: var(--nav-bg-color);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    transition: background-color 0.3s ease;
}

.sticky-nav nav {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 60px;
}

.sticky-nav ul {
    list-style: none;
    display: flex;
    gap: 1.5rem;
}

.sticky-nav a {
    color: var(--nav-text-color);
    font-weight: 500;
    text-decoration: none;
    padding: 0.5rem 0;
    position: relative; /* For active indicator */
    transition: color 0.3s ease;
}

.sticky-nav a::after { /* Underline effect for active/hover */
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--primary-color);
    transition: width 0.3s ease;
}

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

.sticky-nav a.active {
    color: var(--primary-color); /* Highlight active link */
}

#theme-toggle {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--nav-text-color);
    transition: color 0.3s ease, transform 0.3s ease;
}

#theme-toggle:hover {
    transform: scale(1.1);
}

/* Hero Section */
.hero-section {
    min-height: 80vh; /* Adjust height as needed */
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: var(--section-padding);
    /* Placeholder background - replace with image or gradient */
    background: linear-gradient(135deg, #6e8efb, #a777e3);
    color: #fff; /* Text color for hero */
}

.hero-content h1 {
    font-size: 3rem; /* Larger heading for hero */
    margin-bottom: 1rem;
    color: #fff; /* Ensure heading is white */
}

.hero-content p {
    font-size: 1.2rem;
    margin-bottom: 2rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.cta-button {
    display: inline-block;
    background-color: #fff; /* Contrasting button */
    color: var(--primary-color);
    padding: 0.8rem 1.8rem;
    border-radius: 5px;
    font-weight: bold;
    text-decoration: none;
    transition: background-color 0.3s ease, color 0.3s ease, transform 0.2s ease;
}

.cta-button:hover, .cta-button:focus {
    background-color: #eee;
    color: var(--link-hover-color);
    transform: translateY(-2px);
    text-decoration: none; /* Remove underline on hover */
}

/* Features Section */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); /* Responsive grid */
    gap: 2rem;
    margin-top: 2rem;
}

.feature-item {
    background-color: var(--bg-color); /* Use theme background */
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid var(--current-border-color);
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    text-align: center;
}

.feature-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.feature-item h3 {
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

/* Contact Form */
#contact-form {
    max-width: 600px;
    margin: 2rem auto 0; /* Center form */
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid var(--current-border-color);
    border-radius: 4px;
    font-size: 1rem;
    background-color: var(--bg-color); /* Theme background */
    color: var(--text-color); /* Theme text */
    transition: border-color 0.3s ease, background-color 0.3s ease, color 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus {
    border-color: var(--primary-color);
    outline: none; /* Remove default outline, use focus-visible */
}

.form-group textarea {
    resize: vertical; /* Allow vertical resize */
}

.error-message {
    display: block;
    color: var(--error-color);
    font-size: 0.875rem;
    margin-top: 0.25rem;
    min-height: 1em; /* Prevent layout shifts */
}

/* Add invalid input styling */
input:invalid, textarea:invalid {
    border-color: var(--error-color);
}
input:invalid:focus, textarea:invalid:focus {
     border-color: var(--error-color); /* Keep border red on focus if invalid */
}


#contact-form button[type="submit"] {
    display: inline-block;
    background-color: var(--button-bg);
    color: var(--button-text);
    padding: 0.8rem 1.8rem;
    border: none;
    border-radius: 5px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

#contact-form button[type="submit"]:hover,
#contact-form button[type="submit"]:focus {
    background-color: var(--button-hover-bg);
    transform: translateY(-2px);
}

/* Footer */
footer {
    background-color: var(--footer-bg-color);
    color: var(--footer-text-color);
    text-align: center;
    padding: 1.5rem 1rem;
    margin-top: 3rem;
    font-size: 0.9rem;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    html {
        font-size: 15px; /* Slightly smaller base font on smaller screens */
    }

    h1 {
        font-size: 2.2rem;
    }

    h2 {
        font-size: 1.8rem;
    }

    .hero-section {
        min-height: 60vh;
    }

    .hero-content h1 {
        font-size: 2.5rem;
    }

    .sticky-nav nav {
        height: 50px; /* Smaller nav height */
        padding: 0 0.5rem;
    }

    .sticky-nav ul {
        gap: 0.8rem; /* Reduce gap */
    }
     .sticky-nav a {
        font-size: 0.9rem; /* Smaller nav links */
    }

    main {
        padding-top: 50px; /* Adjust for smaller nav */
    }

    .content-section {
        padding: 3rem 1rem; /* Less padding on smaller screens */
    }

    #theme-toggle {
        font-size: 1.3rem; /* Slightly smaller toggle */
    }
}

@media (max-width: 480px) {
    .sticky-nav nav {
        flex-direction: column; /* Stack nav items */
        height: auto;
        padding: 0.5rem;
    }
    .sticky-nav ul {
        margin-top: 0.5rem;
        justify-content: center; /* Center links */
    }
    main {
        padding-top: 90px; /* Adjust for stacked nav */
    }
     .hero-content h1 {
        font-size: 2rem;
    }
     .hero-content p {
        font-size: 1rem;
    }
    .cta-button {
        padding: 0.7rem 1.5rem;
        font-size: 0.9rem;
    }
}

/* Animations/Transitions (Example: Fade-in on scroll) */
/* Add JS later to add 'visible' class */
.content-section {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.content-section.visible {
    opacity: 1;
    transform: translateY(0);
}