/* Reset and Base Styles with improved variables */
:root {
    --primary: #004D40;
    --secondary: #7CB342;
    --accent: #B71C1C;  /* Darkened for better contrast */
    --text: #222222;
    --background: #ffffff;
    --gray: #f5f5f5;
    --border-radius: 8px;
    --box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    --transition-speed: 0.3s;
    --nav-text: #003D33;  /* Darker shade for better contrast */
}

html {
    scroll-behavior: smooth;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    line-height: 1.6;
    color: var(--text);
    overflow-wrap: break-word;
    word-wrap: break-word;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Typography with focus states */
h1, h2, h3, h4, h5, h6 {
    margin-bottom: 1rem;
    color: var(--primary);
}

p {
    margin-bottom: 1rem;
}

img {
    max-width: 100%;
    height: auto;
    aspect-ratio: attr(width) / attr(height);
}

/* Layout */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    container-type: inline-size;
}

/* Header with improved accessibility */
header {
    background-color: var(--background);
    box-shadow: var(--box-shadow);
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1000;
    height: 72px; /* Added header height */
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
}

.logo {
    height: 40px;
}

.nav-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--primary);
    padding: 0.5rem;
}

nav a:hover,
nav a:focus-visible {
    color: var(--accent);
    outline: 1px solid var(--accent);
    outline-offset: 2px;
}

nav ul {
    display: flex;
    list-style: none;
    gap: 1rem; /* Reduced from 2rem */
}

nav a {
    text-decoration: none;
    color: var(--nav-text);
    font-weight: 500;
    transition: color var(--transition-speed);
    padding: 0.3rem; /* Reduced from 0.5rem */
    font-size: 0.9rem; /* Added to reduce text size */
}

nav a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Hero Section with Slider */
.hero {
    height: 80vh;
    position: relative;
    margin-top: 72px; /* Matches header height */
    overflow: hidden;
}

.hero-slider {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.1); /* Light placeholder while images load */
}

.slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    opacity: 0;
    transition: opacity 2s ease-in-out;
    will-change: opacity;
    backface-visibility: hidden;
    /* Add a dark tint to each slide */
    background-blend-mode: multiply;
    background-color: rgba(0, 0, 0, 0.3);
}
.hero-logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 2rem;
}

.hero-logo {
    width: 100px;
    height: auto;
}

@media (max-width: 768px) {
    .hero-logo-container {
        flex-direction: column;
        gap: 1rem;
    }
    
    .hero-logo {
        width: 80px;
    }
}

@keyframes slideShow {
    0% {
        opacity: 0;
    }
    4% {
        opacity: 0.85; /* Increased opacity for more intensity */
    }
    33% {
        opacity: 0.85;
    }
    37% {
        opacity: 0;
    }
    100% {
        opacity: 0;
    }
}

.slide1 {
    background-image: url('../img/trabsco_energy.jpeg');
    animation: slideShow 24s infinite;
}

.slide2 {
    background-image: url('../img/trabsco_energy01.png');
    animation: slideShow 24s infinite 8s; /* 8 second delay */
}

.slide3 {
    background-image: url('../img/trabsco_energy.png');
    animation: slideShow 24s infinite 16s; /* 16 second delay */
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, rgba(0,0,0,0.75), rgba(0,0,0,0.75));
    z-index: 1;
}

.hero-content {
    position: relative;
    color: white;
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem;
    text-align: center;
    z-index: 2;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    animation: fadeIn 1s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hero h1 {
    font-size: clamp(2rem, 5vw, 3rem);
    color: white;
    margin-bottom: 1.5rem;
}

.btn {
    display: inline-block;
    padding: 0.8rem 1.5rem;
    background-color: var(--accent);
    color: white;
    text-decoration: none;
    border-radius: var(--border-radius);
    transition: background-color var(--transition-speed);
    will-change: transform;
}

.btn:hover,
.btn:focus-visible {
    background-color: #8f1616;
    outline: 2px solid white;
    outline-offset: 2px;
}

.btn.loading {
    opacity: 0.7;
    cursor: wait;
    pointer-events: none;
}

/* Features Section */
.features {
    padding: 4rem 0;
    background-color: var(--gray);
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.feature-card {
    background: white;
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

.feature-card h3 {
    color: var(--primary);
    margin-bottom: 1rem;
}

/* Products Section */
.products {
    padding: 4rem 0;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.product-card {
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    padding: 2rem;
}

.product-card h3 {
    color: var(--primary);
    margin-bottom: 1rem;
}

.product-card ul {
    list-style: none;
}

.product-card li {
    margin-bottom: 0.5rem;
    padding-left: 1.5rem;
    position: relative;
}

.product-card li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--secondary);
}

/* Main Content */
main {
    padding: 4rem 0;
    /* Remove margin-top: 84px; as it's already on hero */
}

/* Section Styles */
.section {
    margin-bottom: 4rem;
}

.section-title {
    text-align: center;
    margin-bottom: 2rem;
}

/* Card Styles */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr));
    gap: 2rem;
}

.card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 2rem;
    transition: transform var(--transition-speed);
    will-change: transform;
}

@media (hover: hover) {
    .card:hover {
        transform: translateY(-5px);
    }
}

.card-icon {
    font-size: 3rem;
    color: var(--primary);
    margin-bottom: 1rem;
}

/* Form Styles */
.form-group {
    margin-bottom: 1rem;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    transition: border-color var(--transition-speed), box-shadow var(--transition-speed);
}

.form-group input:focus,
.form-group textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(0,77,64,0.2);
    outline: none;
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    :root {
        --background: #121212;
        --text: #ffffff;
        --gray: #1e1e1e;
        --nav-text: #90caf9;  /* Lighter blue for dark mode nav */
    }

    .card,
    .feature-card {
        background: #242424;
    }

    .form-group input,
    .form-group textarea {
        background: #333;
        border-color: #444;
        color: white;
    }

    .product-card {
        border-color: #444;
    }
}

/* Print Styles */
@media print {
    .nav-toggle,
    .hero::before,
    .hero::after,
    .btn {
        display: none;
    }

    body {
        color: black;
    }

    a {
        text-decoration: none;
        color: black;
    }

    .hero {
        height: auto;
        margin: 1cm 0;
    }

    .card,
    .feature-card {
        break-inside: avoid;
    }
}

/* Footer */
footer {
    background-color: var(--primary);
    color: white;
    padding: 4rem 0 2rem;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-column h3 {
    color: white;
    margin-bottom: 1rem;
}

.footer-column ul {
    list-style: none;
}

.footer-column ul li {
    margin-bottom: 0.5rem;
}

.footer-column a {
    color: white;
    text-decoration: none;
    padding: 0.2rem 0;
}

.footer-column a:hover,
.footer-column a:focus-visible {
    text-decoration: underline;
    outline: 2px solid white;
    outline-offset: 2px;
}
.footer-column a .fab {
    margin-right: 8px;
    text-decoration: underline;
}

.footer-column a:hover .fab {
    text-decoration: none;	
    color: #0077b5; /* LinkedIn brand color */
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid rgba(255,255,255,0.1);
}

/* Responsive Design */
@media (max-width: 768px) {
    .nav-toggle {
        display: block;
    }

    nav ul {
        display: none;
        position: absolute;
        top: 72px; /* Adjusted to match header height */
        left: 0;
        right: 0;
        background: var(--background);
        flex-direction: column;
        padding: 1rem;
        box-shadow: var(--box-shadow);
    }

    nav ul.active {
        display: flex;
    }

    nav li {
        margin: 0.3rem 0; /* Reduced from 0.5rem */
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    .slide {
        animation: none;
    }
    
    .slide1 {
        opacity: 1;
    }
    
    .slide2,
    .slide3 {
        display: none;
    }

    .hero::after,
    .hero::before,
    .hero-content,
    .card,
    .btn,
    nav a,
    .form-group input,
    .form-group textarea {
        animation: none;
        transition: none;
    }

    @keyframes kenBurns {
        0%, 33% {
            transform: scale(1);
        }
        33.01%, 66% {
            transform: scale(1.1);
        }
        66.01%, 100% {
            transform: scale(1.2);
        }
    }

    @keyframes gradientShift {
        0%, 50%, 100% {
            background: linear-gradient(45deg, rgba(0,0,0,0.5), rgba(0,0,0,0.3));
        }
    }
}

/* Responsive adjustments for hero images */
@media (max-width: 768px) {
    .slide {
        background-position: center center;
    }
}
.social-links {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-top: 2rem;
}

.social-link {
    font-size: 1.5rem;
    color: var(--primary);
    transition: color var(--transition-speed);
}

.social-link:hover {
    color: var(--accent);
}