/* --- THEME & FONT SETUP --- */
:root {
    /* Light Mode Palette */
    --primary-color: #4CAF50; /* Vibrant Green */
    --secondary-color: #8D6E63; /* Muted Brown */
    --background-color: #FBFBFB;
    --surface-color: #FFFFFF;
    --text-color: #333333;
    --heading-color: #263238;
    --border-color: #E0E0E0;

    /* Fonts */
    --font-primary: 'Poppins', sans-serif;
    --font-monospace: 'Roboto Mono', monospace;
}

body.dark-mode {
    /* Dark Mode Palette */
    --primary-color: #66BB6A; /* Lighter Green for contrast */
    --secondary-color: #A1887F; /* Lighter Brown */
    --background-color: #121212;
    --surface-color: #1E1E1E;
    --text-color: #E0E0E0;
    --heading-color: #FFFFFF;
    --border-color: #424242;
}

/* --- GENERAL STYLING --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-primary);
    background-color: var(--background-color);
    color: var(--text-color);
    transition: background-color 0.3s ease, color 0.3s ease;
}

.container {
    max-width: 1200px;
    margin: auto;
    padding: 0 2rem;
}

h1, h2, h3 {
    color: var(--heading-color);
    font-weight: 700;
}

h2 {
    font-size: 2.8rem;
    text-align: center;
    margin-bottom: 1rem;
}

p.section-subtitle {
    text-align: center;
    max-width: 600px;
    margin: 0 auto 3rem auto;
    font-size: 1.1rem;
}

section {
    padding: 6rem 0;
}

/* --- HEADER & NAVIGATION --- */
header {
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.3s ease;
}

body.dark-mode header {
     background: rgba(30, 30, 30, 0.8);
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
    padding: 0 2rem;
}

nav .logo {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
}

nav .nav-menu ul {
    display: flex;
    list-style: none;
    gap: 2rem;
}

nav .nav-menu a {
    text-decoration: none;
    color: var(--heading-color);
    font-weight: 600;
    position: relative;
    padding-bottom: 5px;
}

nav .nav-menu a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--primary-color);
    transition: width 0.3s ease;
}

nav .nav-menu a:hover::after {
    width: 100%;
}

.nav-controls {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.theme-toggle-btn {
    background: none;
    border: none;
    color: var(--heading-color);
    font-size: 1.4rem;
    cursor: pointer;
}

.hamburger-menu {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 2rem;
    height: 2rem;
    background: transparent;
    border: none;
    cursor: pointer;
    z-index: 101;
}

.hamburger-menu span {
    width: 2rem;
    height: 0.25rem;
    background: var(--heading-color);
    border-radius: 10px;
    transition: all 0.3s linear;
    position: relative;
    transform-origin: 1px;
}

/* --- HERO SECTION --- */
.hero {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    background: url('so-many-vegetables-this-field.jpg') no-repeat center center/cover;
    color: white;
}

.hero-content h1 {
    font-size: 4rem;
    color: white;
    margin-bottom: 1rem;
}

.hero-content p {
    font-size: 1.3rem;
    margin-bottom: 2rem;
}

.cta-button {
    background: var(--primary-color);
    color: white;
    padding: 1rem 2.5rem;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 700;
    transition: transform 0.3s ease, background-color 0.3s ease;
}

.cta-button:hover {
    transform: translateY(-5px);
    background-color: #388E3C;
}

/* --- TECHNOLOGY / TIMELINE SECTION --- */
.tech-section {
    background-color: var(--surface-color);
}
.timeline {
    position: relative;
    max-width: 800px;
    margin: 0 auto;
}
.timeline::after {
    content: '';
    position: absolute;
    width: 3px;
    background-color: var(--primary-color);
    top: 0;
    bottom: 0;
    left: 50%;
    margin-left: -1.5px;
}
.timeline-item {
    padding: 10px 40px;
    position: relative;
    width: 50%;
}
.timeline-item:nth-child(odd) {
    left: 0;
    text-align: right;
}
.timeline-item:nth-child(even) {
    left: 50%;
    text-align: left;
}
.timeline-icon {
    position: absolute;
    width: 50px;
    height: 50px;
    line-height: 50px;
    background: var(--background-color);
    border: 3px solid var(--primary-color);
    border-radius: 50%;
    text-align: center;
    font-size: 1.5rem;
    color: var(--primary-color);
    top: 30px;
    z-index: 10;
}
.timeline-item:nth-child(odd) .timeline-icon {
    right: -25px;
}
.timeline-item:nth-child(even) .timeline-icon {
    left: -25px;
}
.timeline-content {
    padding: 20px 30px;
    background-color: var(--background-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.h{
    align-items: center;
    padding: 50px;
    font: 1em sans-serif;
}

/* --- CONTROL PANEL SECTION --- */
.control-panel-section {
    background-color: var(--background-color);
}
.panel-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
    background-color: var(--surface-color);
    padding: 2rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}
.panel-screens .screen {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 1rem;
    border: 2px solid var(--border-color);
}
.panel-screens img {
    width: 100%;
    display: block;
}
.live-indicator {
    position: absolute;
    top: 10px;
    left: 10px;
    background-color: #E53935;
    color: white;
    padding: 5px 10px;
    font-size: 0.8rem;
    font-family: var(--font-monospace);
    border-radius: 4px;
    font-weight: 700;
}
.panel-controls {
    text-align: center;
}
.panel-controls h3 {
    margin-bottom: 1rem;
    font-family: var(--font-monospace);
    text-transform: uppercase;
}
.d-pad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    width: 150px;
    height: 150px;
    margin: 0 auto 1.5rem auto;
}
.d-pad-btn {
    background-color: var(--background-color);
    border: 2px solid var(--border-color);
    color: var(--text-color);
    cursor: pointer;
    transition: background-color 0.2s;
}
.d-pad-btn:hover { background-color: var(--border-color); }
.d-pad .up { grid-area: 1 / 2 / 2 / 3; }
.d-pad .left { grid-area: 2 / 1 / 3 / 2; }
.d-pad .center { grid-area: 2 / 2 / 3 / 3; background-color: var(--surface-color); }
.d-pad .right { grid-area: 2 / 3 / 3 / 4; }
.d-pad .down { grid-area: 3 / 2 / 4 / 3; }

.status-bars { margin-bottom: 1.5rem; }
.status-bar { margin-bottom: 1rem; }

.status-bar label {
    display: flex;
    align-items: center;
    gap: 0.6rem; /* This adds space between the icon and text */
    font-family: var(--font-monospace);
    font-size: 0.8rem;
    margin-bottom: 0.3rem;
    text-align: left;
}
.status-bar .bar {
    height: 15px;
    background: var(--background-color);
    border: 1px solid var(--border-color);
    border-radius: 2px;
    padding: 2px;
}
.status-bar .bar span {
    display: block;
    height: 100%;
    background: var(--primary-color);
}
.action-buttons {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}
.action-btn {
    padding: 1rem;
    font-family: var(--font-monospace);
    font-weight: 700;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.2s;
}
.action-btn.analyze { background: var(--secondary-color); color: white; }
.action-btn.sprinkle { background: var(--primary-color); color: white; }

/* --- GALLERY SECTION --- */
.gallery-section {
    background-color: var(--surface-color);
}

.gallery-grid {
    display: grid;
    /* On larger screens, this will create up to 4 columns if space allows */
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
}

.gallery-item {
    background-color: var(--background-color);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.gallery-item:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 20px rgba(0,0,0,0.1);
}

.gallery-item img {
    width: 100%;
    height: 220px;
    object-fit: cover;
    display: block;
}

.gallery-text {
    padding: 1.5rem;
}

.gallery-text h3 {
    margin-bottom: 0.75rem;
    font-size: 1.4rem;
}

.gallery-text .description {
    font-size: 0.95rem;
    margin-bottom: 1rem;
    min-height: 60px; /* Ensures cards have a similar height */
}

.gallery-text .solution {
    font-size: 1rem;
    color: var(--primary-color);
}

.gallery-text .solution strong {
    color: var(--heading-color);
}

/* Special rule to make the "Solution:" text green in dark mode for better contrast */
body.dark-mode .gallery-text .solution strong {
    color: var(--primary-color);
}

/* Responsive adjustment for mobile */
@media (max-width: 768px) {
    .gallery-grid {
        grid-template-columns: 1fr; /* Stack cards vertically on mobile */
    }
}

/* --- ABOUT & FOOTER --- */
.about-section {
    text-align: center;
}
.about-section p {
    max-width: 800px;
    margin: 0 auto;
    font-size: 1.1rem;
}
footer {
    background-color: var(--surface-color);
    border-top: 1px solid var(--border-color);
    padding: 2rem 0;
}
.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.social-links a {
    color: var(--text-color);
    font-size: 1.5rem;
    margin-left: 1.5rem;
    transition: color 0.3s;
}
.social-links a:hover {
    color: var(--primary-color);
}

/* --- RESPONSIVE DESIGN --- */
@media (max-width: 992px) {
    h2 { font-size: 2.4rem; }
    .panel-grid { grid-template-columns: 1fr; }
    .timeline::after { left: 30px; }
    .timeline-item { width: 100%; padding-left: 80px; padding-right: 25px; }
    .timeline-item:nth-child(even) { left: 0; }
    .timeline-item:nth-child(odd) .timeline-icon, 
    .timeline-item:nth-child(even) .timeline-icon { left: 5px; }
    .timeline-item:nth-child(odd) { text-align: left; }
}

@media (max-width: 768px) {
    h1 { font-size: 2.8rem !important; }
    h2 { font-size: 2rem; }
    section { padding: 4rem 0; }
    .container { padding: 0 1.5rem; }
    
    /* Hamburger Menu Logic */
    .hamburger-menu { display: flex; }
    .nav-menu {
        position: fixed;
        top: 70px;
        right: 0;
        width: 100%;
        height: calc(100vh - 70px);
        background: var(--surface-color);
        flex-direction: column;
        justify-content: center;
        align-items: center;
        transform: translateX(100%);
        transition: transform 0.3s ease-in-out;
    }
    .nav-menu.is-active { transform: translateX(0); }
    .nav-menu ul { flex-direction: column; text-align: center; }
    .nav-menu a { font-size: 1.5rem; }
    .hamburger-menu.is-active span:nth-child(1) { transform: rotate(45deg); }
    .hamburger-menu.is-active span:nth-child(2) { opacity: 0; }
    .hamburger-menu.is-active span:nth-child(3) { transform: rotate(-45deg); transform-origin: 1px; }

    .footer-content { flex-direction: column; gap: 1rem; }
}