/* CSS Layers for clean cascade management */
@layer reset, base, theme, components, utilities;

@layer reset {
    /* Modern CSS Reset */
    *, *::before, *::after {
        box-sizing: border-box;
        margin: 0;
        padding: 0;
    }

    html {
        scroll-behavior: smooth;
        -webkit-text-size-adjust: 100%;
        scroll-padding-top: 80px; /* Offset for sticky header */
    }

    body {
        min-height: 100vh;
        text-rendering: optimizeSpeed;
        line-height: 1.6;
        font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
        overflow-x: hidden;
    }

    /* Remove default list styles and link text-decoration */
    ul, ol {
        list-style: none;
    }

    a {
        text-decoration: none;
        color: inherit;
    }

    img, picture, svg, video {
        display: block;
        max-width: 100%;
        height: auto;
    }

    input, button, textarea, select {
        font: inherit;
        background: transparent;
        border: none;
    }

    /* Accessibility Skip Link styling */
    .skip-link {
        position: absolute;
        top: -100px;
        left: 20px;
        background: var(--accent-color);
        color: white;
        padding: 10px 20px;
        border-radius: 4px;
        z-index: 9999;
        transition: top 0.3s;

        &:focus-visible {
            top: 20px;
            outline: 3px solid white;
        }
    }
}

@layer theme {
    /* Define color-scheme on root */
    :root {
        color-scheme: light dark;

        /* Core Design Tokens */
        --font-heading: 'Outfit', sans-serif;

        /* Fluid Typography Scales */
        --fs-h1: clamp(2.2rem, 1.2rem + 4vw, 3.8rem);
        --fs-h2: clamp(1.8rem, 1.1rem + 2.5vw, 2.6rem);
        --fs-h3: clamp(1.4rem, 1.0rem + 1.8vw, 2.0rem);
        --fs-body: clamp(0.95rem, 0.9rem + 0.2vw, 1.1rem);
        --fs-small: clamp(0.8rem, 0.75rem + 0.15vw, 0.95rem);

        /* Transitions */
        --transition-smooth: 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
        --transition-slow: 0.5s cubic-bezier(0.25, 0.8, 0.25, 1);
        --transition-spring: 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);

        /* Border Radius */
        --radius-sm: 8px;
        --radius-md: 16px;
        --radius-lg: 24px;
        --radius-circle: 50%;

        /* Theme colors via light-dark() */
        --bg-primary: light-dark(#f8f9fc, #0b0d11);
        --bg-secondary: light-dark(#ffffff, #12161f);
        
        --text-primary: light-dark(#1f2937, #f3f4f6);
        --text-secondary: light-dark(#4b5563, #9ca3af);
        --text-muted: light-dark(#6b7280, #6b7280);
        
        --accent-color: #d9822b; /* Construction Gold/Copper */
        --accent-hover: #b86214;
        --accent-rgb: 217, 130, 43;

        --card-bg: light-dark(rgba(255, 255, 255, 0.85), rgba(18, 22, 31, 0.65));
        --card-border: light-dark(rgba(0, 0, 0, 0.05), rgba(255, 255, 255, 0.05));
        
        --glass-bg: light-dark(rgba(255, 255, 255, 0.75), rgba(11, 13, 17, 0.75));
        --glass-border: light-dark(rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0.06));

        --shadow-sm: light-dark(0 1px 3px rgba(0,0,0,0.05), 0 1px 3px rgba(0,0,0,0.3));
        --shadow-md: light-dark(0 4px 6px rgba(0,0,0,0.05), 0 4px 10px rgba(0,0,0,0.4));
        --shadow-lg: light-dark(0 10px 25px rgba(0,0,0,0.08), 0 10px 30px rgba(0,0,0,0.5));
        
        --header-bg: light-dark(rgba(248, 249, 252, 0.8), rgba(11, 13, 17, 0.8));
    }

    /* Force light/dark class overrides from JS */
    html.light {
        color-scheme: light;
    }
    html.dark {
        color-scheme: dark;
    }

    /* Interpolation Color Spaces for supported browsers */
    :root {
        --in-oklab: ;
        --in-oklch: ;
    }
    @supports (linear-gradient(in oklab, white, black)) {
        :root {
            --in-oklab: in oklab;
            --in-oklch: in oklch;
        }
    }
}

@layer base {
    body {
        background-color: var(--bg-primary);
        color: var(--text-primary);
        font-size: var(--fs-body);
        transition: background-color var(--transition-smooth), color var(--transition-smooth);
    }

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

    /* Accessibility Outline on keyboard navigation */
    *:focus-visible {
        outline: 3px solid var(--accent-color);
        outline-offset: 4px;
    }

    /* Custom Selection Styling */
    ::selection {
        background-color: var(--accent-color);
        color: white;
    }

    /* Custom Scrollbar */
    scrollbar-color: var(--accent-color) var(--bg-secondary);
    scrollbar-width: thin;
}

@layer components {
    /* Header and Navigation */
    .main-header {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 80px;
        z-index: 1000;
        background-color: var(--header-bg);
        backdrop-filter: blur(12px);
        border-bottom: 1px solid var(--glass-border);
        transition: background-color var(--transition-smooth), border-color var(--transition-smooth);

        .header-container {
            max-width: 1280px;
            height: 100%;
            margin: 0 auto;
            padding: 0 24px;
            display: flex;
            align-items: center;
            justify-content: space-between;
        }

        .logo {
            font-family: var(--font-heading);
            font-size: 1.5rem;
            font-weight: 800;
            letter-spacing: -0.03em;
            color: var(--text-primary);
            transition: color var(--transition-smooth);
            
            .logo-accent {
                color: var(--accent-color);
            }
        }

        .nav-list {
            display: flex;
            gap: 32px;
        }

        .nav-link {
            font-weight: 500;
            color: var(--text-primary);
            font-size: 0.95rem;
            transition: color var(--transition-smooth);
            position: relative;
            padding: 8px 0;

            &::after {
                content: '';
                position: absolute;
                bottom: 0;
                left: 0;
                width: 0;
                height: 2px;
                background-color: var(--accent-color);
                transition: width var(--transition-smooth);
            }

            &:hover, &:focus {
                color: var(--accent-color);

                &::after {
                    width: 100%;
                }
            }
        }
    }

    .header-actions {
        display: flex;
        align-items: center;
        gap: 16px;
    }

    /* Buttons */
    .btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        padding: 12px 28px;
        font-weight: 600;
        font-size: 0.95rem;
        border-radius: var(--radius-sm);
        cursor: pointer;
        transition: transform var(--transition-smooth), background-color var(--transition-smooth), color var(--transition-smooth), box-shadow var(--transition-smooth);
        min-block-size: 44px; /* Accessible touch target */
        text-align: center;

        &:active {
            transform: scale(0.96);
        }

        &.btn-primary {
            background-color: var(--accent-color);
            color: white;
            box-shadow: 0 4px 14px rgba(var(--accent-rgb), 0.2);

            &:hover, &:focus {
                background-color: var(--accent-hover);
                box-shadow: 0 6px 20px rgba(var(--accent-rgb), 0.35);
            }
        }

        &.btn-secondary {
            background-color: var(--bg-secondary);
            color: var(--text-primary);
            border: 1px solid var(--card-border);
            box-shadow: var(--shadow-sm);

            &:hover, &:focus {
                background-color: var(--bg-primary);
                border-color: var(--accent-color);
                color: var(--accent-color);
            }
        }

        &.btn-full {
            width: 100%;
        }
    }

    /* Theme Toggle */
    .theme-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        border-radius: var(--radius-sm);
        cursor: pointer;
        color: var(--text-primary);
        background-color: var(--bg-secondary);
        border: 1px solid var(--card-border);
        transition: background-color var(--transition-smooth), color var(--transition-smooth), border-color var(--transition-smooth);

        &:hover, &:focus {
            color: var(--accent-color);
            border-color: var(--accent-color);
        }

        .sun-icon {
            display: none;
        }

        .moon-icon {
            display: block;
        }
    }

    /* Switch toggle states based on current color-scheme */
    html.dark .theme-toggle,
    :root:has(input[type="checkbox"]:checked) .theme-toggle {
        .sun-icon {
            display: block;
        }
        .moon-icon {
            display: none;
        }
    }

    /* Sun/Moon icons adapt dynamically */
    @media (prefers-color-scheme: dark) {
        html:not(.light) .theme-toggle {
            .sun-icon {
                display: block;
            }
            .moon-icon {
                display: none;
            }
        }
    }

    /* Hamburger Menu Toggle */
    .mobile-nav-toggle {
        display: none;
        flex-direction: column;
        justify-content: space-between;
        width: 32px;
        height: 24px;
        cursor: pointer;
        z-index: 1010;

        .hamburger-bar {
            width: 100%;
            height: 3px;
            background-color: var(--text-primary);
            border-radius: 4px;
            transition: transform var(--transition-smooth), opacity var(--transition-smooth), background-color var(--transition-smooth);
        }

        &[aria-expanded="true"] {
            .hamburger-bar:nth-child(1) {
                transform: translateY(10px) rotate(45deg);
            }
            .hamburger-bar:nth-child(2) {
                opacity: 0;
            }
            .hamburger-bar:nth-child(3) {
                transform: translateY(-11px) rotate(-45deg);
            }
        }
    }

    /* Hero Section */
    .hero-section {
        min-height: 100vh;
        display: flex;
        align-items: center;
        background-size: cover;
        background-position: center;
        background-repeat: no-repeat;
        padding-top: 100px;
        padding-bottom: 60px;
        position: relative;
        isolation: isolate;

        .hero-container {
            max-width: 1280px;
            width: 100%;
            margin: 0 auto;
            padding: 0 24px;
        }

        .hero-content {
            max-width: 650px;
            color: white;
        }

        .hero-subtitle {
            display: inline-block;
            font-family: var(--font-heading);
            font-weight: 600;
            text-transform: uppercase;
            letter-spacing: 0.1em;
            color: var(--accent-color);
            margin-bottom: 16px;
            font-size: 0.95rem;
        }

        .hero-title {
            font-size: var(--fs-h1);
            text-wrap: balance;
            margin-bottom: 24px;
            line-height: 1.15;
        }

        .hero-description {
            font-size: var(--fs-body);
            color: #d1d5db;
            margin-bottom: 40px;
            text-wrap: pretty;
        }

        .hero-buttons {
            display: flex;
            flex-wrap: wrap;
            gap: 16px;
        }
    }

    /* Shared Section Layouts */
    .section-container {
        max-width: 1280px;
        margin: 0 auto;
        padding: 100px 24px;
    }

    .section-badge {
        display: inline-block;
        font-family: var(--font-heading);
        font-size: 0.85rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.08em;
        color: var(--accent-color);
        margin-bottom: 12px;
    }

    .section-title {
        font-size: var(--fs-h2);
        margin-bottom: 24px;
        color: var(--text-primary);
        text-wrap: balance;
    }

    .section-subtitle {
        font-size: var(--fs-body);
        color: var(--text-secondary);
        max-width: 650px;
        margin-bottom: 50px;
        text-wrap: pretty;
    }

    .section-paragraph {
        margin-bottom: 20px;
        color: var(--text-secondary);
        text-wrap: pretty;
        
        &:last-of-type {
            margin-bottom: 32px;
        }
    }

    /* About Section */
    .about-grid {
        display: grid;
        grid-template-columns: 1.2fr 1fr;
        gap: 64px;
        align-items: center;
    }

    .features-list {
        display: flex;
        flex-direction: column;
        gap: 24px;
    }

    .feature-item {
        display: flex;
        gap: 16px;

        .feature-icon-wrapper {
            flex-shrink: 0;
            width: 48px;
            height: 48px;
            border-radius: var(--radius-sm);
            background-color: light-dark(rgba(217, 130, 43, 0.08), rgba(217, 130, 43, 0.15));
            color: var(--accent-color);
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .feature-title {
            font-size: 1.15rem;
            margin-bottom: 6px;
        }

        .feature-desc {
            font-size: var(--fs-small);
            color: var(--text-secondary);
        }
    }

    /* Glass Panel Styling */
    .glass-panel {
        background: var(--glass-bg);
        backdrop-filter: blur(16px);
        border: 1px solid var(--glass-border);
        box-shadow: var(--shadow-lg);
    }

    .about-stats-container {
        display: flex;
        justify-content: center;
        align-items: center;
    }

    .about-stats-card {
        padding: 48px;
        border-radius: var(--radius-lg);
        width: 100%;
        max-width: 500px;
        
        .stats-heading {
            font-size: 1.3rem;
            margin-bottom: 32px;
            text-align: center;
            text-transform: uppercase;
            letter-spacing: 0.05em;
        }
    }

    .stats-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 32px;
    }

    .stat-box {
        display: flex;
        flex-direction: column;
        align-items: center;
        text-align: center;

        .stat-number {
            font-family: var(--font-heading);
            font-size: 2.8rem;
            font-weight: 800;
            color: var(--accent-color);
            line-height: 1;
            margin-bottom: 8px;
        }

        .stat-label {
            font-size: 0.85rem;
            font-weight: 600;
            color: var(--text-primary);
        }
    }

    /* Services Section */
    .services-grid {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: 32px;
    }

    .service-card {
        background-color: var(--bg-secondary);
        border: 1px solid var(--card-border);
        border-radius: var(--radius-md);
        padding: 40px;
        box-shadow: var(--shadow-sm);
        transition: transform var(--transition-smooth), border-color var(--transition-smooth), box-shadow var(--transition-smooth);

        &:hover, &:focus-within {
            transform: translateY(-8px);
            border-color: var(--accent-color);
            box-shadow: var(--shadow-lg);
        }

        .service-icon-box {
            width: 64px;
            height: 64px;
            border-radius: var(--radius-sm);
            background-color: light-dark(rgba(217, 130, 43, 0.06), rgba(217, 130, 43, 0.12));
            color: var(--accent-color);
            display: flex;
            align-items: center;
            justify-content: center;
            margin-bottom: 28px;
            transition: background-color var(--transition-smooth), color var(--transition-smooth);
        }

        &:hover .service-icon-box {
            background-color: var(--accent-color);
            color: white;
        }

        .service-card-title {
            font-size: 1.25rem;
            margin-bottom: 16px;
        }

        .service-card-desc {
            font-size: var(--fs-small);
            color: var(--text-secondary);
            text-wrap: pretty;
        }
    }

    /* Portfolio Section */
    .portfolio-filters {
        display: flex;
        justify-content: center;
        flex-wrap: wrap;
        gap: 12px;
        margin-bottom: 48px;
    }

    .filter-btn {
        padding: 10px 24px;
        font-weight: 600;
        font-size: 0.9rem;
        border-radius: 30px;
        cursor: pointer;
        background-color: var(--bg-secondary);
        color: var(--text-secondary);
        border: 1px solid var(--card-border);
        transition: background-color var(--transition-smooth), color var(--transition-smooth), border-color var(--transition-smooth);

        &:hover, &:focus {
            color: var(--accent-color);
            border-color: var(--accent-color);
        }

        &.active {
            background-color: var(--accent-color);
            color: white;
            border-color: var(--accent-color);
            box-shadow: 0 4px 12px rgba(var(--accent-rgb), 0.15);
        }
    }

    .portfolio-grid {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
        gap: 32px;
    }

    .portfolio-item {
        border-radius: var(--radius-md);
        overflow: hidden;
        aspect-ratio: 1;
        box-shadow: var(--shadow-sm);
        transition: opacity var(--transition-smooth), transform var(--transition-smooth);

        &.hidden-item {
            display: none;
        }

        .portfolio-image-wrapper {
            position: relative;
            width: 100%;
            height: 100%;
            overflow: hidden;
            background-color: var(--bg-secondary);

            img {
                width: 100%;
                height: 100%;
                object-fit: cover;
                transition: transform var(--transition-slow);
            }
        }

        .portfolio-overlay {
            position: absolute;
            inset: 0;
            background: linear-gradient(to top var(--in-oklab), rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0.4) 60%, transparent 100%);
            display: flex;
            align-items: flex-end;
            padding: 32px;
            opacity: 0;
            transition: opacity var(--transition-smooth);
        }

        &:hover, &:focus-within {
            .portfolio-overlay {
                opacity: 1;
            }
            img {
                transform: scale(1.08);
            }
        }

        .portfolio-info {
            color: white;
            transform: translateY(20px);
            transition: transform var(--transition-smooth);
        }

        &:hover .portfolio-info, &:focus-within .portfolio-info {
            transform: translateY(0);
        }

        .portfolio-item-cat {
            font-size: 0.75rem;
            text-transform: uppercase;
            font-weight: 700;
            letter-spacing: 0.05em;
            color: var(--accent-color);
            display: block;
            margin-bottom: 8px;
        }

        .portfolio-item-title {
            font-size: 1.3rem;
            margin-bottom: 4px;
        }

        .portfolio-item-loc {
            font-size: 0.85rem;
            color: #d1d5db;
        }
    }

    /* Contact Section */
    .contact-grid {
        display: grid;
        grid-template-columns: 1fr 1.2fr;
        gap: 64px;
    }

    .contact-details {
        display: flex;
        flex-direction: column;
        gap: 32px;
        margin: 40px 0;
    }

    .contact-detail-item {
        display: flex;
        gap: 20px;
        align-items: flex-start;

        .contact-detail-icon {
            flex-shrink: 0;
            width: 48px;
            height: 48px;
            border-radius: var(--radius-sm);
            background-color: light-dark(rgba(217, 130, 43, 0.08), rgba(217, 130, 43, 0.15));
            color: var(--accent-color);
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .detail-label {
            display: block;
            font-size: 0.8rem;
            font-weight: 600;
            text-transform: uppercase;
            letter-spacing: 0.05em;
            color: var(--text-muted);
            margin-bottom: 4px;
        }

        .detail-value {
            font-size: 1.15rem;
            font-weight: 600;
            color: var(--text-primary);
            transition: color var(--transition-smooth);

            &[href]:hover {
                color: var(--accent-color);
            }
        }

        .address-text {
            font-style: normal;
            line-height: 1.4;
        }
    }

    .map-placeholder {
        padding: 32px;
        border-radius: var(--radius-md);
        display: flex;
        flex-direction: column;
        
        .map-indicator {
            font-size: 0.8rem;
            text-transform: uppercase;
            font-weight: 700;
            color: var(--accent-color);
            margin-bottom: 8px;
        }

        .map-city {
            font-family: var(--font-heading);
            font-size: 1.3rem;
            font-weight: 700;
            margin-bottom: 8px;
        }

        .map-text {
            font-size: var(--fs-small);
            color: var(--text-secondary);
        }
    }

    /* Contact Form */
    .contact-form-container {
        background-color: var(--bg-secondary);
        border: 1px solid var(--card-border);
        box-shadow: var(--shadow-md);
        border-radius: var(--radius-lg);
        padding: 48px;
    }

    .form-title {
        font-size: 1.5rem;
        margin-bottom: 32px;
    }

    .form-group {
        display: flex;
        flex-direction: column;
        gap: 8px;
        margin-bottom: 24px;
    }

    .form-label {
        font-size: 0.85rem;
        font-weight: 600;
        color: var(--text-primary);
    }

    .form-input {
        width: 100%;
        background-color: var(--bg-primary);
        border: 1px solid var(--card-border);
        border-radius: var(--radius-sm);
        padding: 14px 18px;
        color: var(--text-primary);
        font-size: 0.95rem;
        transition: border-color var(--transition-smooth), box-shadow var(--transition-smooth);

        &::placeholder {
            color: var(--text-muted);
            opacity: 0.7;
        }

        &:focus {
            outline: none;
            border-color: var(--accent-color);
            box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.15);
        }
    }

    .form-textarea {
        min-height: 150px;
        resize: vertical;
    }

    .form-checkbox-group {
        margin-bottom: 32px;
    }

    .checkbox-label {
        display: flex;
        gap: 12px;
        cursor: pointer;
        align-items: flex-start;
    }

    .form-checkbox {
        flex-shrink: 0;
        margin-top: 4px;
        width: 18px;
        height: 18px;
        accent-color: var(--accent-color);
        cursor: pointer;
    }

    .checkbox-text {
        font-size: 0.8rem;
        color: var(--text-secondary);
        line-height: 1.4;
    }

    /* Validity Styling via :user-invalid */
    .form-input:user-invalid,
    .form-checkbox:user-invalid {
        border-color: #ef4444;
        
        &:focus {
            box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
        }
    }

    /* Error Messages */
    .form-error-msg {
        display: none;
        font-size: 0.75rem;
        font-weight: 500;
        color: #ef4444;
        margin-top: 4px;
    }

    /* Show error messages when fields are invalid and form has class 'submitted' */
    .contact-form.submitted {
        .form-input:invalid + .form-error-msg,
        .form-checkbox-group:has(.form-checkbox:invalid) .form-error-msg {
            display: block;
        }
    }

    /* Loading Spinner */
    .spinner {
        display: none;
        width: 20px;
        height: 20px;
        border: 2px solid rgba(255,255,255,0.3);
        border-radius: 50%;
        border-top-color: white;
        animation: spin 0.8s linear infinite;
        margin-left: 12px;
    }

    #form-submit.loading {
        .btn-text {
            opacity: 0.8;
        }
        .spinner {
            display: inline-block;
        }
        pointer-events: none;
    }

    @keyframes spin {
        to { transform: rotate(360deg); }
    }

    /* Notification Alerts */
    .form-notification {
        margin-top: 24px;
        padding: 16px 20px;
        border-radius: var(--radius-sm);
        font-size: 0.9rem;
        font-weight: 500;
        text-align: center;
        transition: opacity var(--transition-smooth);

        &.success {
            background-color: light-dark(#ecfdf5, #064e3b);
            color: light-dark(#047857, #34d399);
            border: 1px solid light-dark(#a7f3d0, #047857);
        }

        &.error {
            background-color: light-dark(#fef2f2, #7f1d1d);
            color: light-dark(#b91c1c, #fca5a5);
            border: 1px solid light-dark(#fecaca, #b91c1c);
        }

        &.hidden {
            display: none;
        }
    }

    /* Footer */
    .main-footer {
        background-color: light-dark(#111827, #07090c);
        color: #d1d5db;
        border-top: 1px solid var(--glass-border);

        .footer-container {
            max-width: 1280px;
            margin: 0 auto;
            padding: 80px 24px 40px;
            display: grid;
            grid-template-columns: 1.5fr 1fr 1fr;
            gap: 64px;
        }

        .footer-logo {
            font-family: var(--font-heading);
            font-size: 1.5rem;
            font-weight: 800;
            color: white;
            display: inline-block;
            margin-bottom: 20px;
            
            .logo-accent {
                color: var(--accent-color);
            }
        }

        .footer-description {
            font-size: 0.9rem;
            color: #9ca3af;
            max-width: 320px;
        }

        .footer-title {
            color: white;
            font-size: 1.1rem;
            margin-bottom: 24px;
        }

        .footer-links {
            display: flex;
            flex-direction: column;
            gap: 12px;

            a {
                font-size: 0.9rem;
                transition: color var(--transition-smooth);

                &:hover {
                    color: var(--accent-color);
                }
            }
        }

        .footer-contact-column {
            font-size: 0.9rem;
            p {
                margin-bottom: 12px;
            }
        }

        .footer-bottom {
            max-width: 1280px;
            margin: 0 auto;
            padding: 30px 24px;
            border-top: 1px solid rgba(255,255,255,0.05);
            text-align: center;
            font-size: 0.8rem;
            color: #6b7280;
        }
    }
}

@layer utilities {
    /* Utility hidden class */
    .hidden {
        display: none !important;
    }
}

/* ------------------------------------------------------------- */
/* Scroll-driven Entry Animations using CSS View Timeline        */
/* ------------------------------------------------------------- */
@media (prefers-reduced-motion: no-preference) {
    @supports ((animation-timeline: view()) and (animation-range: entry)) {
        @keyframes fade-in-up {
            from {
                opacity: 0;
                transform: translateY(60px) scale(0.97);
            }
            to {
                opacity: 1;
                transform: translateY(0) scale(1);
            }
        }

        .about-section, 
        .services-section, 
        .portfolio-section, 
        .contact-section {
            /* Declare animation-timeline AFTER to prevent shorthand resets */
            animation: fade-in-up auto linear backwards;
            animation-timeline: view();
            animation-range: entry 10% entry 35%;
        }
    }
}

/* CSS Fallback transition for unsupported browsers (Firefox, older Safaris) */
@supports not ((animation-timeline: view()) and (animation-range: entry)) {
    .reveal-on-scroll {
        opacity: 0;
        transform: translateY(50px) scale(0.97);
        transition: opacity var(--transition-slow), transform var(--transition-slow);

        &.reveal-visible {
            opacity: 1;
            transform: translateY(0) scale(1);
        }
    }
}

/* ------------------------------------------------------------- */
/* Media Queries for Responsiveness                              */
/* ------------------------------------------------------------- */
@media (max-width: 1024px) {
    .about-grid, .contact-grid {
        grid-template-columns: 1fr;
        gap: 48px;
    }

    .about-stats-container {
        justify-content: flex-start;
    }

    .about-stats-card {
        max-width: 100%;
        padding: 32px;
    }
}

@media (max-width: 768px) {
    /* Header and Mobile Navigation */
    .main-header {
        .nav-menu {
            position: fixed;
            top: 80px;
            left: 0;
            width: 100%;
            height: calc(100vh - 80px);
            background-color: var(--bg-primary);
            padding: 40px 24px;
            border-top: 1px solid var(--card-border);
            transform: translateX(-100%);
            transition: transform var(--transition-smooth);
            z-index: 999;
            box-shadow: var(--shadow-lg);

            &.active {
                transform: translateX(0);
            }
        }

        .nav-list {
            flex-direction: column;
            gap: 24px;
        }

        .nav-link {
            font-size: 1.2rem;
            display: block;
        }

        .mobile-nav-toggle {
            display: flex;
        }
    }

    .hero-section {
        padding-top: 120px;
        .hero-title {
            margin-bottom: 16px;
        }
        .hero-description {
            margin-bottom: 32px;
        }
    }

    .section-container {
        padding: 60px 24px;
    }

    .services-grid {
        grid-template-columns: 1fr;
    }

    .contact-form-container {
        padding: 32px 24px;
    }

    .main-footer {
        .footer-container {
            grid-template-columns: 1fr;
            gap: 40px;
        }
    }
}
