/* 
    CONSTRUCTIONS & CIVILS AFRICA - Premium Design System (Audio Feedback Update)
    Stack: Space Grotesk (Headings) + Inter (Body)
    Colors: Dark Base, Light Blue, Red
*/

:root {
    /* Color Palette */
    --base-dark: #0a0a0c;
    --base-dark-soft: #141418;
    --accent-red: #e63946;
    --accent-blue: #3b82f6; /* Updated to Light Blue */
    --accent-blue-glow: rgba(59, 130, 246, 0.3);
    --whisper-accent: rgba(255, 255, 255, 0.03);
    --white: #ffffff;
    --text-muted: rgba(255, 255, 255, 0.6);
    --border-glass: rgba(255, 255, 255, 0.1);
    
    /* Typography */
    --font-heading: 'Space Grotesk', sans-serif;
    --font-body: 'Inter', sans-serif;
    
    /* Layout */
    --container-max: 1400px;
    --section-padding: clamp(3rem, 6vw, 6rem); /* Tightened from 5-10rem */
    --lateral-margin: clamp(2rem, 5vw, 6rem); 
    
    /* Transitions */
    --transition-std: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

/* --- Reset & Base --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    background: var(--base-dark);
}

body {
    font-family: var(--font-body);
    color: var(--white);
    background: var(--base-dark);
    line-height: 1.7;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.1;
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition-std);
}

/* --- UI Enhancement Elements --- */
.noise-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
    opacity: 0.05;
    pointer-events: none;
    z-index: 9999;
}

/* --- Layout Utils --- */
.container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 var(--lateral-margin);
}

.section-padding {
    padding: var(--section-padding) 0;
}

/* --- Navbar --- */
nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    padding: 15px 0;
    background: #f8f8f8; /* Permanent light gray */
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    transition: var(--transition-smooth);
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo img {
    height: 55px; /* Increased size as requested */
    width: auto;
    display: block;
}

.nav-links a {
    color: #000000; /* Black text */
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    position: relative;
    opacity: 0.8;
}

.nav-links a:hover, .nav-links a.active {
    opacity: 1;
    color: var(--accent-red);
}

.nav-links {
    display: flex;
    gap: 30px; /* Tightened from 40px */
    list-style: none;
}

.nav-links a {
    font-size: 0.9rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    position: relative;
    opacity: 0.7;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 1px;
    background: var(--accent-red);
    transition: var(--transition-std);
}

.nav-links a:hover, .nav-links a.active {
    opacity: 1;
}

.nav-links a:hover::after, .nav-links a.active::after {
    width: 100%;
}

/* --- Buttons --- */
.btn {
    padding: 1rem 2.5rem;
    border-radius: 4px; /* More industrial square look */
    font-family: var(--font-heading);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    transition: var(--transition-std);
}

.btn-primary {
    background: var(--accent-red);
    color: var(--white);
}

.btn-primary:hover {
    background: #f84b59;
    transform: translateY(-3px);
}

.btn-outline {
    border: 1px solid var(--accent-blue);
    background: transparent;
    color: var(--white);
}

.btn-outline:hover {
    background: var(--accent-blue);
}

/* --- Split Hero Section --- */
.hero-split {
    height: 100vh;
    display: flex;
    position: relative;
    background: var(--base-dark);
    overflow: hidden;
}

.hero-left {
    position: absolute;
    top: 0;
    left: 0;
    width: 55%; /* Slight overlap for slant */
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 0 var(--lateral-margin);
    z-index: 5;
    clip-path: polygon(0 0, 100% 0, calc(100% - 10vw) 100%, 0 100%);
    overflow: hidden;
}

.hero-right {
    position: absolute;
    top: 0;
    right: 0;
    width: 55%; /* Slight overlap for slant */
    height: 100%;
    z-index: 3;
    clip-path: polygon(10vw 0, 100% 0, 100% 100%, 0 100%);
    overflow: hidden;
}

.hero-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top; /* Do not crop the top of the building */
}

/* Removed slanted-divider as we now use clip-paths for better precision */

#grid-motion-canvas {
    position: absolute;
    inset: 0;
    z-index: 1;
    opacity: 0.2;
}

/* --- Section Titles --- */
.section-header {
    margin-bottom: 2.5rem;
}

.section-dark {
    background: var(--base-dark);
    color: var(--white);
}

.section-light {
    background: #ffffff;
    color: #0a0a0c;
}

.section-light .text-muted {
    color: rgba(0, 0, 0, 0.6);
}

.section-header .tag {
    color: var(--accent-blue);
    text-transform: uppercase;
    letter-spacing: 0.4em; /* Matched hero-tag */
    font-size: 1.25rem;    /* Matched hero-tag */
    font-weight: 700;     /* Matched hero-tag */
    margin-bottom: 1rem;
    display: block;
}

.section-header h2 {
    font-size: clamp(2.5rem, 5vw, 4rem);
}

.hero-left h1 {
    font-size: clamp(2rem, 3.8vw, 4.8rem); /* Reduced further to clear the slanted edge */
    white-space: nowrap; 
    letter-spacing: -0.04em;
    margin-bottom: 1.5rem;
}

.hero-tag {
    display: block;
    color: var(--accent-red);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4em;
    font-size: 1.25rem;
    margin-bottom: 1.2rem;
    text-shadow: 0 0 15px rgba(230, 57, 70, 0.3);
}

.hero-left p {
    font-size: 1.15rem; /* Reduced slightly for better hierarchy */
    max-width: 600px;
    color: var(--text-muted);
    margin-bottom: 2.5rem; /* Added margin to match the rest of the layout */
}

.hero-btns {
    display: flex;
    gap: 20px;
}

/* --- Services Grid --- */
.services-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
}

@media (max-width: 992px) {
    .services-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .services-grid {
        grid-template-columns: 1fr;
    }
}

/* --- Glassmorphism --- */
.glass-card {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-glass);
    padding: 1.5rem; /* Tightened from 2.5rem */
    transition: var(--transition-std);
}

/* --- Preloader --- */
#preloader {
    position: fixed;
    inset: 0;
    background: var(--base-dark);
    z-index: 99999;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 2.8rem;
}

/* Circular dot loader */
.loader-graphic {
    display: flex;
    align-items: center;
    gap: 10px;
}

.loader-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    animation: dotPulse 1.4s ease-in-out infinite;
}

.loader-dot:nth-child(1) {
    background: var(--accent-blue);
    animation-delay: 0s;
}
.loader-dot:nth-child(2) {
    background: var(--accent-red);
    animation-delay: 0.22s;
}
.loader-dot:nth-child(3) {
    background: var(--accent-blue);
    animation-delay: 0.44s;
}
.loader-dot:nth-child(4) {
    background: var(--accent-red);
    animation-delay: 0.66s;
}
.loader-dot:nth-child(5) {
    background: var(--accent-blue);
    animation-delay: 0.88s;
}

@keyframes dotPulse {
    0%, 100% { transform: scale(0.6); opacity: 0.3; }
    50%       { transform: scale(1.2); opacity: 1; }
}

.loader-logo {
    opacity: 0;
    transition: opacity 1s ease;
    height: 52px;
    width: auto;
}

.loader-text {
    opacity: 0;
    font-family: var(--font-body);
    font-size: 0.65rem;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.35);
    transition: opacity 1s ease;
}

.loader-logo.visible,
.loader-text.visible {
    opacity: 1;
}

/* --- Secondary Loader --- */
.secondary-loader {
    position: fixed;
    inset: 0;
    background: var(--base-dark);
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s ease;
}

.secondary-loader.active {
    opacity: 1;
    pointer-events: all;
}

.secondary-loader .loader-graphic {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* --- Commitment Split Section --- */
.commitment-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    align-items: stretch;
}

.commitment-text {
    padding-right: 4rem;
    border-right: 1px solid rgba(0,0,0,0.12);
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0;
}

.commitment-image-container {
    min-height: 420px;
    overflow: hidden;
    padding-left: 4rem;
    display: flex;
    align-items: center;
}

.commitment-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
}

@media (max-width: 992px) {
    .commitment-split {
        grid-template-columns: 1fr;
    }
    .commitment-text {
        padding-right: 0;
        border-right: none;
        border-bottom: 1px solid rgba(0,0,0,0.1);
        padding-bottom: 2rem;
        margin-bottom: 2rem;
    }
    .commitment-image-container {
        padding-left: 0;
        min-height: 280px;
    }
}

/* --- Slideshow / Carousel --- */
.slideshow-container {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.slide {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 1s ease-in-out;
    z-index: 1;
}

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

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

/* --- Projects Split Layout --- */
.projects-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    align-items: stretch;
    min-height: 520px;
}

.projects-categories {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding-right: 3rem;
    border-right: 1px solid rgba(0,0,0,0.12);
    justify-content: center;
}

.project-cat-card {
    background: #fff;
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: 4px;
    padding: 1.4rem 1.6rem;
    cursor: pointer;
    transition: var(--transition-std);
    display: flex;
    align-items: center;
    gap: 1.2rem;
}

.project-cat-card:hover,
.project-cat-card.active {
    border-color: var(--accent-red);
    background: rgba(230,57,70,0.04);
}

.project-cat-card.active .project-cat-icon {
    color: var(--accent-red);
}

.project-cat-icon {
    color: rgba(0,0,0,0.3);
    flex-shrink: 0;
    transition: color var(--transition-std);
}

.project-cat-info h3 {
    font-size: 1.05rem;
    margin-bottom: 0.25rem;
    color: #0a0a0c;
}

.project-cat-info p {
    font-size: 0.82rem;
    color: rgba(0,0,0,0.5);
    line-height: 1.4;
}

.projects-slideshow-panel {
    padding-left: 3rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.projects-active-label {
    font-family: var(--font-heading);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.3em;
    color: var(--accent-red);
    margin-bottom: 1rem;
    font-weight: 600;
}

.projects-main-slideshow {
    height: 420px;
    border-radius: 4px;
    overflow: hidden;
}

@media (max-width: 992px) {
    .projects-split {
        grid-template-columns: 1fr;
    }
    .projects-categories {
        padding-right: 0;
        border-right: none;
        border-bottom: 1px solid rgba(0,0,0,0.1);
        padding-bottom: 2rem;
        margin-bottom: 2rem;
        flex-direction: row;
        flex-wrap: wrap;
    }
    .project-cat-card { flex: 1 1 calc(50% - 0.5rem); }
    .projects-slideshow-panel { padding-left: 0; }
    .projects-main-slideshow { height: 280px; }
}

/* =============================================
   MOBILE OPTIMIZATION
   ============================================= */

/* Hide hamburger on desktop */
.hamburger { display: none; }

/* Tablet */
@media (max-width: 992px) {
    .hero-split {
        flex-direction: column;
        height: auto;
        min-height: 100vh;
    }
    .hero-left {
        position: relative;
        width: 100%;
        clip-path: none;
        padding: 140px var(--lateral-margin) 60px;
    }
    .hero-right {
        position: relative;
        width: 100%;
        height: 50vw;
        min-height: 260px;
        clip-path: none;
    }
    .hero-left h1 {
        white-space: normal;
        font-size: clamp(2rem, 6vw, 3.5rem);
    }
    .nav-cta { display: none; }
    .projects-category-grid {
        grid-template-columns: 1fr;
    }
}

/* Mobile */
@media (max-width: 768px) {
    .nav-links {
        display: none;
        position: fixed;
        top: 80px;
        left: 0;
        width: 100%;
        background: #f8f8f8;
        flex-direction: column;
        padding: 1.5rem var(--lateral-margin);
        gap: 1.5rem;
        border-bottom: 1px solid rgba(0,0,0,0.1);
        z-index: 999;
    }
    .nav-links.open { display: flex; }

    .hamburger {
        display: flex;
        flex-direction: column;
        gap: 5px;
        cursor: pointer;
        background: none;
        border: none;
        padding: 6px;
    }
    .hamburger span {
        display: block;
        width: 24px;
        height: 2px;
        background: #000;
        transition: var(--transition-std);
        border-radius: 2px;
    }
    .hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
    .hamburger.open span:nth-child(2) { opacity: 0; }
    .hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

    /* About grid stacks */
    .about.html [style*="grid-template-columns: 1fr 1fr"],
    [style*="grid-template-columns: 1fr 1fr"] {
        grid-template-columns: 1fr !important;
    }

    .commitment-split {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    .commitment-divider { display: none; }
    .commitment-image-container { min-height: 260px; }

    .glass-card { padding: 1.2rem; }

    .hero-btns { flex-direction: column; gap: 12px; }
    .btn { justify-content: center; text-align: center; }

    .project-cat-slideshow { height: 220px; }

    .about-slideshow { height: 260px !important; }
}

/* --- Gallery Grid --- */
.gallery-section .section-header h2 {
    color: var(--white);
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.gallery-item {
    position: relative;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    border-radius: 4px;
    cursor: pointer;
    border: 1px solid var(--border-glass);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.5s var(--transition-smooth);
}

.gallery-item:hover img {
    transform: scale(1.05);
}

.gallery-placeholder {
    width: 100%;
    height: 100%;
    background: var(--base-dark-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition-std);
}

.gallery-placeholder span {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: var(--text-muted);
    font-family: var(--font-heading);
}

.gallery-item:hover .gallery-placeholder {
    background: #1e1e24;
}

/* overlay on hover for real images */
.gallery-item::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.3);
    opacity: 0;
    transition: opacity var(--transition-std);
}

.gallery-item:hover::after {
    opacity: 1;
}

.gallery-item.gallery-hidden {
    display: none;
}

.gallery-see-more {
    text-align: center;
    margin-top: 2.5rem;
}

@media (max-width: 992px) {
    .gallery-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
    .gallery-grid { grid-template-columns: 1fr; }
}

/* --- Lightbox --- */
.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.94);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.lightbox.open {
    opacity: 1;
    pointer-events: all;
}

.lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 85vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

#lightboxImg {
    max-width: 90vw;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 4px;
    display: none;
}

#lightboxImg.visible {
    display: block;
}

.lightbox-placeholder {
    width: 60vw;
    max-width: 700px;
    height: 45vw;
    max-height: 500px;
    background: var(--base-dark-soft);
    border: 1px solid var(--border-glass);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-placeholder span {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: var(--text-muted);
    font-family: var(--font-heading);
}

.lightbox-placeholder.hidden {
    display: none;
}

.lightbox-counter {
    position: absolute;
    bottom: -2.2rem;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.75rem;
    letter-spacing: 0.15em;
    color: var(--text-muted);
    font-family: var(--font-heading);
    text-transform: uppercase;
    white-space: nowrap;
}

.lightbox-close {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    background: none;
    border: 1px solid var(--border-glass);
    color: var(--white);
    font-size: 1.8rem;
    width: 44px;
    height: 44px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: var(--transition-std);
    z-index: 2;
}

.lightbox-close:hover {
    background: var(--accent-red);
    border-color: var(--accent-red);
}

.lightbox-arrow {
    background: none;
    border: 1px solid var(--border-glass);
    color: var(--white);
    font-size: 2.5rem;
    width: 52px;
    height: 52px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: var(--transition-std);
    flex-shrink: 0;
    margin: 0 1.5rem;
}

.lightbox-arrow:hover {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
}

/* Small mobile */
@media (max-width: 480px) {
    .hero-left h1 { font-size: 2rem; }
    .section-header h2 { font-size: 1.8rem; }
    .hero-left { padding-top: 120px; }
    .loader-logo { height: 36px; }
}
