/* Critical Above-the-Fold CSS for Immediate Rendering */

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

:root {
    --header-height: 80px;
    --primary-color: #5a5a47;
    --secondary-color: #a8a882;
    --bg-dark: #f5f3e7;
    --bg-darker: #d4d2a7;
    --bg-light: #a8a882;
    --text-light: #5a5a47;
    --text-muted: #6b6b58;
    --text-dark: #2c2c1f;
    --border-dark: #9a9a7d;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: var(--header-height, 80px);
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
    touch-action: pan-y;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--text-light);
    background: var(--bg-dark);
    overflow-x: hidden;
    position: relative;
    min-height: 100%;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: auto;
    touch-action: pan-y;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

section,
.hero,
.portfolio,
.about,
.contact,
[id] {
    scroll-margin-top: var(--header-height, 80px);
}

/* Header - Critical for Layout Shift Prevention */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(245, 243, 231, 0.95);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    min-height: var(--header-height, 80px);
    border-bottom: 1px solid var(--border-dark);
    will-change: transform;
}

.nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 2rem;
    min-height: var(--header-height, 80px);
    max-width: 1400px;
    margin: 0 auto;
    box-sizing: border-box;
}

.nav-brand {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.brand-title {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-light);
    letter-spacing: 2px;
    margin: 0;
    line-height: 1.2;
}

.brand-subtitle {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin: 0.2rem 0 0 0;
    letter-spacing: 1px;
    line-height: 1.2;
}

/* Hero Section - Critical for First Paint */
.hero {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--bg-dark) 0%, var(--bg-darker) 100%);
    display: flex;
    align-items: center;
    position: relative;
    overflow: hidden;
    padding-top: var(--header-height, 80px);
}

.hero-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
    width: 100%;
    min-height: calc(100vh - var(--header-height, 80px));
}

.hero-content {
    z-index: 2;
}

.hero-title {
    font-size: 3.8rem;
    font-weight: 700;
    letter-spacing: 2px;
    margin-bottom: 1rem;
    color: var(--text-light);
    line-height: 1.2;
    text-align: left;
    will-change: contents;
}

.hero-subtitle {
    font-size: 1.2rem;
    color: var(--text-muted);
    line-height: 1.7;
    margin-bottom: 2rem;
}

.hero-cta {
    display: flex;
    gap: 1.5rem;
    margin-top: 2rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.95rem 2.2rem;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1),
                box-shadow 0.35s cubic-bezier(0.2, 0.8, 0.2, 1),
                background-color 0.35s ease,
                border-color 0.35s ease,
                color 0.35s ease;
    cursor: pointer;
    border: 1.5px solid transparent;
    font-size: 0.95rem;
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: var(--text-light);
    color: var(--bg-dark);
    border-color: var(--text-light);
    box-shadow: 0 4px 15px rgba(90, 90, 71, 0.25);
    font-weight: 700;
}

.btn-secondary {
    background: transparent;
    color: var(--text-light);
    border: 2px solid var(--text-light);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

.hero-image {
    position: relative;
    height: 520px;
    border-radius: 12px;
    overflow: hidden;
    will-change: transform;
}

.hero-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

/* Mobile Optimization */
@media (max-width: 768px) {
    :root {
        --header-height: 75px;
    }

    .nav {
        padding: 0.6rem 1rem;
    }
    
    .brand-title {
        font-size: clamp(1.1rem, 4.5vw, 1.4rem);
        letter-spacing: 1px;
    }

    .brand-subtitle {
        font-size: clamp(0.55rem, 2.4vw, 0.72rem);
        letter-spacing: 0.5px;
    }
    
    .hero {
        padding-top: calc(var(--header-height, 75px) + 20px);
        padding-bottom: 40px;
        min-height: auto;
    }

    .hero-container {
        grid-template-columns: 1fr;
        gap: 2rem;
        padding: 0 1rem;
        text-align: center;
        min-height: auto;
    }
    
    .hero-title {
        font-size: clamp(1.8rem, 6vw, 2.5rem);
        text-align: center;
    }

    .hero-subtitle {
        font-size: clamp(0.9rem, 3.5vw, 1.05rem);
        text-align: center;
    }
    
    .hero-cta {
        justify-content: center;
        flex-direction: column;
        align-items: center;
        gap: 1rem;
    }
    
    .btn {
        width: 100%;
        max-width: 280px;
    }
    
    .hero-image {
        height: 340px;
        max-width: 380px;
        margin: 0 auto;
    }
}

/* Prevent Layout Shift */
.portfolio {
    padding: 80px 0;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    box-sizing: border-box;
}

@media (max-width: 768px) {
    .container {
        padding: 0 1rem;
    }
}

/* Contact Links */
.contact-item a,
.contact-item a:link,
.contact-item a:visited,
.contact-link,
a.contact-link {
    color: #4a4a37 !important;
    text-decoration: none !important;
}

.contact-item a:hover,
.contact-link:hover,
a.contact-link:hover {
    color: #1a1a12 !important;
    text-decoration: underline !important;
}
