:root {
    --color-dark: #2C5F4F;        /* Deep forest green for depth */
    --color-primary: #6BBF59;     /* Vibrant light green - agricultural */
    --color-secondary: #5BA3D0;   /* Professional light blue - tech/water */
    --color-text: #2D2D2D;        /* Dark gray for readability */
    --color-bg-light: #F5F5DC;    /* Cream/beige background */
    --color-cream: #FFF8E8;       /* Pure cream white */
    --color-accent: #4A9D7E;      /* Teal blend for accents */
}

:root {
    --page-bg-start: var(--color-cream);
    --page-bg-end: #F0E8D8; /* Slightly darker cream for gradient */
    --text-high: var(--color-text);
    --muted: #5A7A6B; /* Muted green-gray for secondary text */
}

/* FIX #2: FIXES HORIZONTAL SCROLL */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    background: linear-gradient(180deg, var(--page-bg-start), var(--page-bg-end));
    color: var(--text-high);
    max-width: 100vw;
    overflow-x: hidden;
}

/* Prevent accidental horizontal overflow from large images or elements */
body {
    overflow-x: hidden;
    overflow-y: auto; /* Ensure vertical scrolling is enabled */
    width: 100%;
    max-width: 100vw;
}

/* FIX #2: Resets browser default margin */
body {
    margin: 0;
    position: relative; /* Establish positioning context */
}

main{
    display: block;
    justify-items: center;
    flex: 1;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(90deg, var(--color-dark) 0%, var(--color-accent) 100%);
    padding: 8px 16px;
    position: -webkit-sticky; /* Safari */
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    margin: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

header img {
    border-radius: 8px;
}

/* basic utilities */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 16px;
}

/* --- FIX #1: RE-WRITTEN NAV LOGIC (MOBILE-FIRST) --- */

/* 1. Base styles are for mobile */
nav ul {
    /* Hidden by default on mobile */
    display: none; 
    
    /* These styles apply to the dropdown menu when it's open */
    flex-direction: column;
    position: absolute;
    right: 12px;
    top: calc(100% + 8px);
    background: var(--color-dark);
    padding: 12px;
    border-radius: 8px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.6);
    z-index: 1200;
    min-width: 180px;
    gap: 16px;
    margin: 0;
}

nav ul li {
    list-style: none;
    display: block; /* Change from inline-block for vertical menu */
}

nav ul li a {
    color: var(--color-cream);
    text-decoration: none;
    padding: 8px 10px;
    border-radius: 6px;
    display: block; /* Make links full-width in the dropdown */
    transition: all 0.3s;
}

nav ul li a:hover {
    background: rgba(255, 255, 255, 0.2);
    color: var(--color-primary);
}

/* 2. Show the hamburger by default on mobile */
#nav-toggle {
    display: block; /* Show hamburger */
    background: transparent;
    border: none;
    color: var(--color-primary);
    font-size: 26px;
    cursor: pointer;
    position: absolute; /* Position it correctly */
    right: 12px;
    top: 10px;
}

/* 3. This class (toggled by JS) shows the mobile menu */
header nav.open ul {
    display: flex;
}

/* 4. Desktop overrides (701px and up) */
@media screen and (min-width: 701px) {
    #nav-toggle {
        /* Hide hamburger on desktop */
        display: none; 
    }

    nav ul {
        /* Show nav list on desktop */
        display: flex; 
        
        /* Override all the mobile dropdown styles */
        flex-direction: row;
        position: static;
        background: transparent;
        padding: 0;
        border-radius: 0;
        box-shadow: none;
        min-width: 0;
        position: fixed;
        top: 0;
        z-index: 1000;
    }

    nav ul li {
        display: inline-block; /* Back to horizontal */
    }

    nav ul li a {
        display: inline-block; /* Back to inline */
    }
}
/* --- END OF NAV FIX --- */


@media screen and (max-width: 1400px) {
    /* This rule is correct for hiding items.
       Remember to apply class="exclude" to the <li> in your HTML!
    */
    .exclude {
        display: none !important;
    }

    /* make sure hidden anchors don't keep right margin */
    nav ul li a.exclude {
        margin-right: 0 !important;
    }

    /* use a non-wrapping header layout so visible nav items stay inline */
    header {
        display: flex;
        flex-wrap: nowrap; /* prevent nav from wrapping to a new line */
        align-items: center;
        gap: 10px;
        padding: 8px 12px;
        position: -webkit-sticky; /* Safari */
        position: fixed;
        top: 0;
        z-index: 1000;
    }

    /* ensure nav list doesn't wrap and has no bullets (forcefully) */
    header nav ul {
        list-style: none !important;
        margin: 0 !important;
        padding: 0 !important;
        padding-left: 0 !important;
        gap: 12px !important;
        flex-wrap: nowrap !important;
    }

    header nav ul li {
        list-style: none !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    header nav ul li a {
        color: var(--color-text) !important;
        text-decoration: none !important;
        padding: 8px 10px !important;
    }

    .hero {
        display: flex;
        gap: 24px;
        align-items: stretch;
        padding: 24px 16px;
        background: linear-gradient(180deg, rgba(6, 18, 26, 0.12), rgba(7, 26, 20, 0.06));
    }

    .hero-left {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 16px;
    }

    .hero-right {
        width: 380px;
        background: linear-gradient(180deg, rgba(0, 255, 192, 0.03), rgba(0, 163, 255, 0.02));
        padding: 28px;
        border-radius: 12px;
        box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
    }

    .hero-image-wrapper {
        position: relative;
        width: 100%;
        max-width: 320px;
        overflow: hidden;
        border-radius: 12px;
    }

    .hero-image {
        width: 100%;
        max-height: 250px;
        object-fit: contain;
        display: block;
        transform: scale(1);
        transition: transform 400ms cubic-bezier(.2, .8, .2, 1);
    }
}

/* phone-specific styles */
@media screen and (max-width: 700px) {
    /* All mobile nav styles are now the base styles,
       so these rules are no longer needed.
    */
    /* #nav-toggle { ... } */
    /* nav ul { ... } */
    /* header nav.open ul { ... } */
    /* header nav.open ul li a { ... } */
}

/* ================================================= */
/* IMAGE CAROUSEL / FADER */
/* ================================================= */
.carousel-container {
    position: relative;
    width: 100%;
    height: 500px;
    overflow: hidden;
    background: linear-gradient(135deg, var(--color-bg-light), var(--color-cream));
    margin: 10px 0px 0px 0px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 70px;
}

.carousel-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 1.5s ease-in-out;
    display: flex;
    align-items: center;
    justify-content: center;
}

.carousel-slide.active {
    opacity: 1;
    z-index: 1;
}

.carousel-slide img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}

/* Navigation Dots */
.carousel-dots {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 12px;
    z-index: 10;
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid var(--color-cream);
}

.dot:hover {
    background-color: rgba(255, 255, 255, 0.8);
    transform: scale(1.2);
}

.dot.active {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
    transform: scale(1.3);
}

/* Carousel Arrows */
.carousel-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(107, 191, 89, 0.7);
    color: white;
    border: none;
    font-size: 2.5rem;
    width: 50px;
    height: 50px;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s ease;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.carousel-arrow:hover {
    background: var(--color-primary);
    transform: translateY(-50%) scale(1.1);
}

.carousel-prev {
    left: 20px;
}

.carousel-next {
    right: 20px;
}

/* Responsive Carousel */
@media screen and (max-width: 768px) {
    .carousel-container {
        height: 350px;
    }
    
    .carousel-arrow {
        width: 40px;
        height: 40px;
        font-size: 2rem;
    }
    
    .carousel-prev {
        left: 10px;
    }
    
    .carousel-next {
        right: 10px;
    }
}

@media screen and (max-width: 480px) {
    .carousel-container {
        height: 280px;
    }
    
    .carousel-arrow {
        width: 35px;
        height: 35px;
        font-size: 1.5rem;
    }
}
/* ================================================= */
/* END CAROUSEL */
/* ================================================= */

/* HERO */
.hero {
    display: flex;
    gap: 24px;
    align-items: stretch;
    padding: 24px 16px;
    background: linear-gradient(135deg, rgba(107, 191, 89, 0.08), rgba(91, 163, 208, 0.08));
    border-radius: 12px;
    margin: 20px 16px;
}

.hero-left {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

/* Ensure hero columns cannot exceed the viewport width */
.hero, .hero-left, .hero-right {
    box-sizing: border-box;
    max-width: 100%;
}

.hero-right {
    width: 380px;
    background: linear-gradient(135deg, rgba(107, 191, 89, 0.12), rgba(91, 163, 208, 0.12));
    padding: 28px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(107, 191, 89, 0.3);
    margin: 0%;
}

.hero-image-wrapper {
    position: relative;
    width: 100%;
    max-width: 350px;
    overflow: hidden;
    border-radius: 12px;
}

.hero-image {
    width: 100%;
    max-height: 280px;
    object-fit: contain;
    display: block;
    transform: scale(1);
    transition: transform 400ms cubic-bezier(.2, .8, .2, 1);
}

/* Clamp hero/logo and all images to avoid overflow */
img, .hero-image, header img {
    max-width: 100%;
    height: auto;
    display: block;
}

.hero-image-wrapper:hover .hero-image {
    transform: scale(1.06) translateZ(0);
}

.hero-text {
    text-align: center;
    padding: 0 20px;
    max-width: 500px;
}

.hero-title {
    font-size: 28px;
    margin: 0 0 8px 0;
    font-weight: 700;
    color: var(--color-primary);
}

.hero-title span {
    color: var(--color-secondary);
}

.phrase {
    margin: 0;
    color: var(--text-high);
    line-height: 1.5;
    font-size: 15px;
}

.hero-right h1 {
    margin-top: 0;
    color: var(--color-primary);
}

.btn-primary {
    display: inline-block;
    margin-top: 12px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
    color: white;
    padding: 10px 16px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(107, 191, 89, 0.3);
    transition: all 0.3s;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(107, 191, 89, 0.5);
}

/* ABOUT */
.about-inner {
    padding: 32px 16px;
    background: linear-gradient(135deg, rgba(107, 191, 89, 0.08), rgba(91, 163, 208, 0.08));
    border-radius: 10px;
    max-width: 900px; /* constrain width so it centers nicely */
    margin: 20px auto; /* center the about block */
    border: 1px solid rgba(107, 191, 89, 0.2);
}

.about-inner h1 {
    color: var(--color-secondary);
}

.about-content {
    color: var(--text-high);
    line-height: 1.6;
}

.about-content ul {
    margin-left: 16px;
}

/* TESTIMONIALS */
/* Testimonials section container */
#testimonials {
    padding: 28px 16px;
}

.testimonials-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 900px;
    margin: 0 auto;
}

.test-slider {
    flex: 1;
    overflow: hidden;
}

.test-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    transition: transform 360ms ease;
}

.test-list li {
    min-width: 100%;
    padding: 20px;
    background: linear-gradient(135deg, rgba(107, 191, 89, 0.1), rgba(91, 163, 208, 0.1));
    color: var(--text-high);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(107, 191, 89, 0.2);
}

.test-prev,
.test-next {
    background: transparent;
    border: 2px solid var(--color-primary);
    color: var(--color-primary);
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.test-prev:hover,
.test-next:hover {
    background: var(--color-primary);
    color: white;
}

/* CONTACTS */
#contacts {
    padding: 28px 16px;
}

.contacts-grid {
    display: flex;
    gap: 24px;
    max-width: 900px;
    margin: 0 auto;
    justify-content: center; /* center the contact grid columns within the constrained width */
}

#contact-form {
    flex: 1;
    background: rgba(107, 191, 89, 0.08);
    padding: 18px;
    border-radius: 8px;
    border: 1px solid rgba(107, 191, 89, 0.2);
}

.contact-info {
    width: 300px;
    background: rgba(91, 163, 208, 0.08);
    padding: 18px;
    border-radius: 8px;
    color: var(--text-high);
    border: 1px solid rgba(91, 163, 208, 0.2);
}

#contact-form label {
    display: block;
    margin-top: 8px;
    color: var(--text-high);
}

#contact-form input,
#contact-form textarea {
    width: 100%;
    padding: 8px;
    border-radius: 6px;
    border: 2px solid var(--color-primary);
    background: white;
    color: var(--color-text);
    transition: all 0.3s;
}

#contact-form input:focus,
#contact-form textarea:focus {
    outline: none;
    border-color: var(--color-secondary);
    box-shadow: 0 0 8px rgba(91, 163, 208, 0.3);
}

.contact-info {
    width: 300px;
    background: rgba(91, 163, 208, 0.08);
    padding: 18px;
    border-radius: 8px;
    color: var(--color-text);
    border: 1px solid rgba(91, 163, 208, 0.2);
}

.contact-info a {
    color: var(--color-secondary);
    text-decoration: none;
    transition: color 0.3s;
}

.contact-info a:hover {
    color: var(--color-primary);
}

/* FOOTER */
footer {
    margin-top: 28px;
    background: linear-gradient(90deg, var(--color-dark) 0%, var(--color-accent) 100%);
    color: var(--color-cream);
    padding: 12px 16px;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.15);
}

.footer-inner {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9em;
}

.footer-nav a {
    color: var(--color-cream);
    margin-left: 12px;
    text-decoration: none;
    transition: opacity 0.3s;
}

.footer-nav a:hover {
    opacity: 0.8;
}

/* heading color for testimonial/contact matching bio heading */
#testimonials h1,
#contacts h1,
.about-inner h1 {
    color: var(--color-secondary);
    text-align: center; /* center section headings */
    margin-bottom: 12px;
}

/* Responsive tweaks */
@media screen and (max-width: 900px) {
    .hero {
        flex-direction: column;
    }

    .hero-right {
        width: 100%;
    }

    .contacts-grid {
        flex-direction: column;
    }

    .contact-info {
        width: 100%; /* Make info box full-width on mobile */
    }

    .testimonials-wrap {
        flex-direction: column;
    }
}

/* Laptop-specific: tighten hero so logo isn't oversized on typical laptop screens */
@media screen and (min-width: 1000px) and (max-width: 1440px) {
    .hero {
        padding: 20px 12px;
    }

    .hero-left {
        justify-content: flex-start;
    }

    .hero-image-wrapper {
        max-width: 300px;
    }

    .hero-image {
        max-height: 240px;
    }

    .hero-right {
        flex: 0 0 300px;
        max-width: 340px;
        padding: 18px;
    }
    
    .hero-text {
        max-width: 400px;
    }
}

/* Mobile: center testimonial slider and controls without breaking slider JS */
@media screen and (max-width: 700px) {
    /* Fix white margin on right side - ensure everything is contained */
    body, html {
        max-width: 100vw;
        overflow-x: hidden;
    }
    
    main, .container, .hero, .carousel-container {
        max-width: 100vw;
        overflow-x: hidden;
    }

    #testimonials {
        padding: 20px 12px;
    }

    .testimonials-wrap {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 12px;
        max-width: 100%;
        margin: 0 auto;
        padding: 0 12px;
    }

    .test-slider {
        width: 100%;
        max-width: 420px;
        box-sizing: border-box;
    }

    /* Keep .test-list as flex so the JS slider can translate it; ensure slides are full-width */
    .test-list {
        display: flex;
        flex-direction: row;
        width: 100%;
    }

    .test-list li {
        min-width: 100%;
        box-sizing: border-box;
        margin: 0 auto;
    }

    /* Center the prev/next buttons and make them visible inline */
    .test-prev,
    .test-next {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        margin: 6px auto;
        width: 44px;
        height: 36px;
    }

    /* Place both buttons side-by-side under the slider */
    .test-controls {
        display: flex;
        gap: 12px;
        justify-content: center;
        width: 100%;
    }
}

/* Fix for tablet/small desktop range (700px - 930px) - prevent right margin */
@media screen and (min-width: 701px) and (max-width: 930px) {
    body, html {
        max-width: 100vw;
        overflow-x: hidden;
    }
    
    main, .container, .hero, .carousel-container {
        max-width: 100vw;
        overflow-x: hidden;
    }
    
    .hero {
        margin: 20px 12px;
        padding: 20px 12px;
    }
    
    .hero-right {
        width: 100%;
        max-width: 340px;
    }
}

/* Fix for very small screens (below 470px) */
@media screen and (max-width: 470px) {
    body, html {
        max-width: 100vw;
        overflow-x: hidden;
        width: 100%;
    }
    
    main, .container, .hero, .carousel-container {
        max-width: 100vw;
        overflow-x: hidden;
        width: 100%;
    }
    
    .hero {
        margin: 10px 8px;
        padding: 16px 8px;
    }
    
    .carousel-container {
        margin: 10px 0;
    }
}