:root {
    --color-primary: #0E3710; /* Dark green */
    --color-secondary: #609732; /* Medium green */
    --color-tertiary: #CAD593; /* Light green */
    --bg-color: #ffffff; /* White background */

    --font-body: Lexend, sans-serif;
    --font-headline: 'Kaushan Script', serif;
}

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

html {
    -webkit-text-size-adjust: 100%;
    overflow-x: hidden; /* Prevent horizontal scrolling globally */
}

body {
    min-height: 100vh;
    line-height: 1.25;
    font-size: clamp(1rem, 2.5vw, 1.5rem);
    font-family: var(--font-body);
    background-color: var(--bg-color);
    margin: 0; /* Remove default margin */
    padding: 2rem; /* Base padding */
    width: 100%; /* Ensure body doesn’t exceed viewport */
    max-width: 100vw; /* Cap at viewport width */
    overflow-x: hidden; /* Extra safety against scrolling */
}

/* Header Styling */
header {
    display: flex;
    width: 100%;
    background-color: var(--color-secondary);
    color: var(--bg-color);
    padding: 1rem;
    justify-content: space-between;
}

.header-content {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.logo {
    width: 150px;
    max-width: 100%;
    height: auto;
}

h1, h2, h3 {
    font-family: var(--font-headline);
}

h1 {
    font-size: clamp(2.5rem, 6vw, 4.5rem);
    margin: 0;
}

h2 {
    font-size: clamp(2.5rem, 5vw, 3.5rem);
}

h3 {
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    margin-bottom: 1rem;
}

nav {
    flex: 1;
    text-align: right;
}

/* Hero Section */
.hero {
    background-image: url("../images/hero-az-superstition-mountains.webp");
    background-size: cover;
    width: 100%;
    height: 400px;
    color: var(--bg-color);
    display: grid;
    align-items: center;
    justify-content: center;
}

.hero-content-background {
    background-color: var(--color-tertiary);
    width: 100%;
    height: 100%;
    opacity: 0.90;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
    border-radius: 8px;
}

.hero-content {
    text-align: center;
    padding: 2rem;
    position: relative;
    width: 100%; /* Ensure it fits */
    max-width: 100%; /* Prevent overflow */
}

.hero-content > *:not(.hero-content-background) {
    position: relative;
    z-index: 2;
}

/* Home Section */
.home-section {
    padding: 2rem;
    width: 100%;
    max-width: 100%; /* Prevent overflow */
}

.home-section:nth-child(even) {
    background-color: var(--color-primary);
    color: var(--bg-color);
}

.home-section img:not(#tech) {
    width: 300px;
    height: 300px;
    object-fit: contain;
    display: block;
    margin: 0 auto;
    max-width: 100%;
}

.home-section #tech {
    display: block;
    margin: 0 auto;
    width: 300px;
    height: auto;
    max-width: 100%;
    object-fit: contain;
}

.home-section article {
    width: 100%;
    max-width: 100%; /* Ensure text doesn’t overflow */
}

/* Footer Styling */
footer {
    background-color: var(--color-primary);
    color: var(--bg-color);
    padding: 2rem;
    border-top: 1px solid var(--color-tertiary);
    font-size: 0.875rem;
    width: 100%; /* Ensure full width */
    max-width: 100vw; /* Cap at viewport */
}

footer section {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 0 1rem;
}

footer .footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
    align-items: start;
}

.footer-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.footer-link {
    color: var(--color-tertiary);
    text-decoration: none;
    transition: color 0.3s ease, opacity 0.3s ease;
    opacity: 0.95;
}

.footer-link:hover {
    color: var(--color-secondary);
    opacity: 1;
}

.footer-link:focus {
    outline: 2px solid var(--color-secondary);
    outline-offset: 2px;
}

footer p:has(.footer-link) {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
}

footer p {
    margin: 0.75rem 0;
    line-height: 1.5;
}

/* Responsive Adjustments */
@media screen and (max-width: 768px) {
    body {
        padding: 1rem; /* Reduce padding */
    }

    header {
        flex-direction: column;
        padding: .5rem;
    }
    .header-content {
        flex-direction: row;
        justify-content: center;
        width: 100%;
        gap: 0.5rem;
    }
    .logo {
        width: 100px;
    }
    h1 {
        font-size: clamp(1.5rem, 4vw, 2.5rem);
    }
    nav {
        width: 100%;
        text-align: center;
        margin-top: 0.5rem;
    }

    .hero {
        height: 300px;
        padding: 1rem;
    }
    .hero-content {
        padding: 1rem;
    }

    .home-section {
        padding: 1rem;
        display: flex;
        flex-direction: column;
        gap: 1rem;
    }
    .home-section:nth-child(even) {
        flex-direction: column;
    }
    .home-section img:not(#tech) {
        width: 100%;
        height: auto;
        max-width: 250px;
    }
    .home-section #tech {
        width: 100%;
        height: auto;
        max-width: 250px;
        margin: 0 auto;
    }

    footer {
        padding: 1.5rem;
    }
    footer .footer-content {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    .footer-item {
        width: 100%;
    }
}

@media screen and (max-width: 480px) {
    body {
        padding: 0.5rem; /* Further reduce padding */
        font-size: clamp(0.875rem, 2vw, 1.25rem); /* Smaller base font */
    }

    .header-content {
        flex-direction: column;
        text-align: center;
    }
    .logo {
        width: 80px;
    }

    .hero {
        height: 250px;
    }
    .hero-content {
        padding: 0.5rem;
    }
    h2 {
        font-size: clamp(1.25rem, 3vw, 2rem);
    }
    h3 {
        font-size: clamp(1rem, 2.5vw, 1.5rem);
    }

    .home-section {
        padding: 0.5rem;
    }
    .home-section img:not(#tech) {
        max-width: 200px;
    }
    .home-section #tech {
        max-width: 200px;
        margin: 0 auto;
    }
}

@media screen and (min-width: 769px) {
    .home-section {
        display: flex;
        gap: 2rem;
        align-items: center;
    }
    .home-section img {
        margin: 0;
    }
    .home-section:nth-child(even) {
        flex-direction: row-reverse;
    }
}