:root {
    /* Color Palette */
    --color-bg-dark: #121212;
    --color-bg-light: #ffffff;
    --color-bg-offwhite: #f4f4f4;

    --color-primary: #587C39;
    /* Brand Green */
    --color-primary-dark: #3e5a26;

    --color-accent: #F9BB0B;
    /* Brand Gold */

    --color-text-main: #333333;
    --color-text-light: #666666;
    --color-text-inverse: #ffffff;

    --border-color: #e0e0e0;

    /* Dimensions */
    --container-width: 1200px;
    --nav-height: 80px;

    /* Typography */
    --font-heading: 'Roboto Condensed', sans-serif;
    --font-body: 'Roboto', sans-serif;
    --font-serif: 'Vollkorn', serif;
}

/* DARK MODE */
[data-theme="dark"] {
    --color-bg-light: #1a1a1a;
    --color-bg-offwhite: #222222;
    --color-text-main: #f0f0f0;
    --color-text-light: #cccccc;
    --border-color: #444;
}

/* Dark Mode Specific Overrides */
[data-theme="dark"] .contact-card,
[data-theme="dark"] .news-item,
[data-theme="dark"] .section .grid-3>div:not([data-modal]) {
    background-color: #2a2a2a;
    /* Dark gray cards */
    border-color: #444;
    color: #f0f0f0;
}

[data-theme="dark"] .contact-card p,
[data-theme="dark"] .news-content p {
    color: #cccccc;
}

[data-theme="dark"] .section.white {
    background-color: #1a1a1a;
}

[data-theme="dark"] .tag-title {
    background-color: #333;
    border-color: #555;
    color: #ddd;
}

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

html {
    scroll-behavior: smooth;
}

body {
    width: 100%;
    overflow-x: hidden;
    font-family: var(--font-body);
    color: var(--color-text-main);
    line-height: 1.6;
    background-color: var(--color-bg-light);
    padding-top: var(--nav-height);
    transition: background-color 0.3s ease, color 0.3s ease;
}

a {
    text-decoration: none;
    color: inherit;
    transition: all 0.3s ease;
}

img {
    max-width: 100%;
    display: block;
}

/* UTILITY */
.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 20px;
    position: relative;
}

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

.text-right {
    text-align: right;
}

.section {
    padding: 100px 0;
    width: 100%;
}

.section.dark {
    background-color: var(--color-bg-dark);
    color: var(--color-text-inverse);
}

.section.light {
    background-color: var(--color-bg-offwhite);
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}

.section.white {
    background-color: var(--color-bg-light);
}

/* FOOTER */
.section.footer {
    background-color: var(--color-bg-dark);
    padding: 80px 0 40px;
    border-top: 5px solid var(--color-accent);
    color: #ffffff !important;
}

.footer-grid {
    display: flex;
    justify-content: space-between;
    gap: 40px;
    flex-wrap: wrap;
}

.footer-col {
    flex: 1;
    min-width: 250px;
}

.footer-col h3 {
    color: #ffffff !important;
    font-size: 1.1rem;
    margin-bottom: 25px;
    border-bottom: 1px solid #ffffff;
    padding-bottom: 10px;
    display: inline-block;
}

.footer-col p,
.footer-col a {
    color: #ffffff !important;
    margin-bottom: 10px;
    font-size: 0.9rem;
}

.footer-col a {
    display: block;
    margin-bottom: 8px;
    transition: 0.3s;
}

.footer-col a:hover {
    color: var(--color-accent) !important;
    padding-left: 5px;
}

.footer-col.center-col {
    text-align: center;
}

/* MAP SECTION */
.section.map {
    background-color: #e5e5e5;
    padding: 80px 0;
    border: none !important;
}

[data-theme="dark"] .section.map {
    background-color: #333;
}

/* TYPOGRAPHY */
h1,
h2,
h3,
h4 {
    font-family: var(--font-heading);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 20px;
}

h1.main-heading {
    font-size: 3.5rem;
    line-height: 1.1;
    color: #ffffff !important;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

h2 {
    font-size: 2.5rem;
    color: var(--color-text-main);
}

h3 {
    font-size: 1.5rem;
    margin-bottom: 15px;
}

.text-center h2 {
    margin-left: auto;
    margin-right: auto;
}

.section.dark h2,
.section.dark h3 {
    color: var(--color-accent);
}

.section.dark p {
    color: rgba(255, 255, 255, 0.8);
}

.subheading {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 1.2rem;
    color: var(--color-accent);
    margin-bottom: 30px;
    text-transform: none;
}

.horizontal-bar {
    width: 60px;
    height: 4px;
    background-color: var(--color-accent);
    margin: 20px auto;
}

/* BUTTONS */
.btn {
    display: inline-block;
    padding: 14px 28px;
    font-family: var(--font-heading);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    border: 2px solid var(--color-accent);
    color: var(--color-accent);
    background: transparent;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    text-align: center;
}

.btn:hover {
    background-color: var(--color-accent);
    color: var(--color-bg-dark);
}

.btn.solid {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
    color: #ffffff;
}

.btn.solid:hover {
    background-color: var(--color-primary-dark);
    border-color: var(--color-primary-dark);
    color: #ffffff;
}

/* NAV */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--nav-height);
    background-color: rgba(18, 18, 18, 0.98);
    z-index: 1000;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-brand img {
    height: 40px;
    width: auto;
}

.nav-menu {
    display: flex;
    gap: 30px;
    align-items: center;
}

.nav-link {
    color: rgba(255, 255, 255, 0.8);
    text-transform: uppercase;
    font-weight: 700;
    font-family: var(--font-heading);
    letter-spacing: 1px;
    font-size: 0.9rem;
}

.nav-link:hover,
.nav-link.active {
    color: var(--color-accent);
}

.menu-toggle {
    display: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
}

/* HERO SLIDER */
.slider-container {
    width: 100%;
    height: 90vh;
    min-height: 600px;
    background-color: #000;
    position: relative;
    overflow: hidden;
}

.custom-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* FORCE COVER */
    background-size: cover !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
    transition: opacity 1s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.custom-slide::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
}

/* GRIDS Cards (Index) */
.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 50px;
    margin-top: 50px;
}

.section .grid-3>div:not([data-modal]) {
    background: white;
    padding: 60px 40px;
    border: 1px solid var(--border-color);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s ease;
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.section .grid-3>div:not([data-modal]):hover {
    transform: translateY(-8px);
    border-color: var(--color-primary);
}

.grid-3 img {
    height: 60px;
    width: auto;
    margin: 0 auto 40px;
    object-fit: contain;
    filter: brightness(0);
}

[data-theme="dark"] .section .grid-3 img {
    filter: invert(1);
}

/* CONTACT GRID */
.contact-grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-top: 40px;
    width: 100%;
}

.contact-card {
    background: white;
    padding: 30px 10px;
    text-align: center;
    border: 1px solid var(--border-color);
    border-bottom: 4px solid var(--color-primary);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    min-width: 0;
}

.contact-card img {
    filter: brightness(0);
    margin-bottom: 15px;
    width: 40px;
    height: 40px;
}

[data-theme="dark"] .contact-card img {
    filter: invert(1);
}

.contact-card span {
    display: block;
    font-weight: 700;
    margin: 10px 0 5px;
    color: var(--color-primary);
    text-transform: uppercase;
    font-size: 0.8rem;
    white-space: nowrap;
}

.contact-card p,
.contact-card a {
    font-size: 0.85rem;
    color: #555;
    margin: 0;
    word-break: break-word;
}

/* NEWS LAYOUT */
.news-item {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 40px;
    max-width: 1100px;
    margin: 40px auto;
    background: var(--color-bg-light);
    border: 1px solid var(--border-color);
}

.news-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.news-content {
    padding: 40px;
    text-align: left;
}

.tag-wrapper {
    margin: 10px 0 20px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.tag-title {
    font-size: 11px;
    background: var(--color-bg-offwhite);
    padding: 4px 12px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    color: #666;
    text-transform: uppercase;
    font-weight: 700;
}

.news-item:nth-child(even) {
    direction: rtl;
}

.news-item:nth-child(even)>* {
    direction: ltr;
}

/* RESPONSIVE OVERRIDES */
@media (max-width: 991px) {
    .contact-grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }

    /* ABOUT GRID FIX: Override the !important 5-column rule */
    .section.image .grid-3 {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}

@media (max-width: 768px) {

    /* NEWS FIX: Reset direction so image (first in DOM) is always top */
    .news-item:nth-child(even) {
        direction: ltr;
    }

    .news-item {
        grid-template-columns: 1fr;
        gap: 0;
    }

    /* Resize image on mobile */
    .news-item img {
        height: 250px;
        width: 100%;
        border-bottom: 1px solid var(--border-color);
    }

    .news-content {
        padding: 30px 20px;
    }

    /* ABOUT GRID MOBILE */
    .section.image .grid-3 {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

@media (max-width: 600px) {
    .contact-grid-4 {
        grid-template-columns: 1fr;
    }

    /* ABOUT GRID SMALL MOBILE */
    .section.image .grid-3 {
        grid-template-columns: 1fr !important;
    }
}

/* POPUP GRID */
.section.image .grid-3 {
    grid-template-columns: repeat(5, 1fr) !important;
    gap: 30px;
}

.section.image .grid-3 img {
    filter: none !important;
}

.section.image .grid-3>div {
    cursor: pointer;
    text-align: center;
    padding: 20px;
    border: 1px solid transparent;
    transition: all 0.3s;
}

.section.image .grid-3>div:hover {
    border-color: var(--color-accent);
    transform: translateY(-5px);
}

.icons-text {
    margin-top: 15px;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
}

/* MODAL */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-overlay.open {
    display: flex;
    opacity: 1;
}

.modal-content {
    background: var(--color-bg-light);
    padding: 50px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    border-top: 4px solid var(--color-primary);
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 30px;
    background: none;
    border: none;
    cursor: pointer;
    color: #aaa;
}

.modal-close:hover {
    color: var(--color-bg-dark);
}

.links-list .btn {
    text-align: left;
    background: #f4f4f4;
    color: #333;
    border: 1px solid #ddd;
    width: 100%;
    display: block;
    margin-bottom: 10px;
}

.links-list .btn:hover {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
}

[data-theme="dark"] .links-list .btn {
    background: #333;
    color: white;
    border-color: #555;
}

/* SCROLL ANIMATION */
.hidden-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s ease-out;
}

/* Disable scroll animation on mobile */
@media (max-width: 768px) {
    .hidden-scroll {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }
}

.show-scroll {
    opacity: 1;
    transform: translateY(0);
}

/* THEME SWITCHER ICON STYLING */
.theme-switch-footer {
    cursor: pointer;
    transition: transform 0.3s;
    display: inline-block;
}

.theme-switch-footer:hover {
    transform: scale(1.1);
}

.theme-switch-icon {
    width: 24px;
    height: 24px;
    filter: brightness(0) invert(1);
}

/* RESPONSIVE */
@media (max-width: 991px) {
    .contact-grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }

    /* ABOUT GRID TABLET */
    .section.image .grid-3.about-icons-grid {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}

@media (max-width: 768px) {

    /* NAVIGATION FIX */
    .nav-menu {
        top: 80px;
    }

    /* Reset direction so image (first in DOM) is always top */
    .news-item:nth-child(even) {
        direction: ltr;
    }

    .news-item {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .news-item img {
        height: 250px;
        width: 100%;
        border-bottom: 1px solid var(--border-color);
        order: -1;
    }

    .news-content {
        padding: 30px 20px;
    }

    /* SERVICES & GENERIC GRID MOBILE FIX */
    .grid-3 {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    /* ABOUT GRID MOBILE */
    .section.image .grid-3.about-icons-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    /* SLIDER TITLE RESPONSIVE */
    h1.main-heading {
        font-size: 3rem;
    }

    .slider-container {
        height: 70vh;
        min-height: 500px;
    }

    .menu-toggle {
        display: block;
    }

    .nav-menu {
        position: fixed;
        top: 80px;
        left: 0;
        width: 100%;
        flex-direction: column;
        background: rgba(18, 18, 18, 0.98);
        padding: 20px;
        display: none;
    }

    .nav-menu.open {
        display: flex;
    }

    .footer-grid {
        flex-direction: column;
        text-align: center;
    }

    .contact-card {
        flex: 1 1 100%;
    }
}

@media (max-width: 600px) {
    .contact-grid-4 {
        grid-template-columns: 1fr;
    }

    /* ABOUT GRID SMALL MOBILE: 1 Column */
    .section.image .grid-3.about-icons-grid {
        grid-template-columns: 1fr !important;
    }

    h1.main-heading {
        font-size: 2.5rem;
    }

    /* Ensure no horizontal overflow */
    body,
    html {
        overflow-x: hidden;
    }
}