/* ==========================================================================
   1. CSS VARIABLES & RESET
   ========================================================================== */
:root {
    --primary: #1c2b39;
    --accent: #b38b2d;
    --light: #f4f6f8;
    --dark: #111;
    --white: #ffffff;
    --transition: 0.3s ease;
    --shadow: 0 10px 30px rgba(0,0,0,0.06);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

html, body {
    font-family: 'Inter', sans-serif; 
    line-height: 1.6; 
    color: #222; 
    overflow-x: hidden;
    width: 100%;
    position: relative;
}

.container { width: 90%; max-width: 1200px; margin: auto; }

section { padding: 90px 0; }

.bg-light { background: var(--light); }

h1, h2, h3 { font-weight: 800; margin-bottom: 20px; color: var(--primary); }

p { margin-bottom: 15px; }

/* ==========================================================================
   2. COMPONENTS
   ========================================================================== */
.btn-primary {
    background: var(--accent);
    color: var(--white);
    padding: 14px 28px;
    text-decoration: none;
    font-weight: 600;
    display: inline-block;
    transition: var(--transition);
    border: none;
    cursor: pointer;
}

.btn-primary:hover { opacity: 0.9; transform: translateY(-2px); }

.btn-secondary {
    border: 2px solid var(--white);
    padding: 12px 24px;
    text-decoration: none;
    color: var(--white);
    transition: var(--transition);
}

.btn-secondary:hover { background: var(--white); color: var(--primary); }

/* ==========================================================================
   3. HEADER & NAVIGATION
   ========================================================================== */
header {
    background: var(--white);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 12px rgba(0,0,0,0.05);
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
}

.logo img { height: 50px; display: block; }

nav ul { list-style: none; display: flex; gap: 35px; }

nav a { 
    text-decoration: none; 
    font-weight: 600; 
    color: var(--primary); 
    transition: var(--transition); 
}

nav a:hover { color: var(--accent); }

.hamburger { display: none; font-size: 28px; cursor: pointer; color: var(--primary); }

@media(max-width: 992px) {
    .hamburger { display: block; }
    nav {
        position: absolute;
        top: 80px;
        right: 0;
        width: 100%;
        background: var(--white);
        display: none;
        box-shadow: 0 10px 20px rgba(0,0,0,0.1);
    }
    nav.active { display: block; }
    nav ul { flex-direction: column; padding: 20px; gap: 20px; text-align: center; }
    .desktop-btn { display: none; }
}

/* ==========================================================================
   4. SECTIONS
   ========================================================================== */
/* Hero */
.hero {
    height: 85vh;
    background: linear-gradient(rgba(0,0,0,0.65), rgba(0,0,0,0.65)), 
                url('https://images.unsplash.com/photo-1503387762-592deb58ef4e') center/cover no-repeat;
    display: flex;
    align-items: center;
    color: var(--white);
}

.hero h1 { font-size: 48px; color: var(--white); }

.hero-btns {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: left;
    width: 100%;
    margin-top: 2rem;
}

.hero-btns .btn-primary, 
.hero-btns .btn-secondary {
    white-space: nowrap;
    min-width: 180px;
    display: inline-flex;
    justify-content: center;
    align-items: center;
}

@media (max-width: 768px) {
    .hero h1 { 
        font-size: 1.8rem;
        /*word-break: break-word;*/
    }
    .hero-btns {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .hero h1 {
        font-size: 1.45rem;
        line-height: 1.3;
    }
    .hero-btns {
        flex-direction: column;
        align-items: left;
        gap: 12px;
        padding: 0 10%; /* Lisab külgedele õhku */
    }
    .hero-btns .btn-primary, 
    .hero-btns .btn-secondary {
        width: 100%; /* Nupud on täislaiuses ja seega sama pikkusega */
        max-width: 280px; /* Piirab laiust, et nupud ei läheks liiga "välja veninud" */
        box-sizing: border-box;
    }
}

@media (max-width: 360px) {
    .hero h1 {
        font-size: 1.3rem;
    }
}

/* Services Grid */
.services-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 30px; }

.service-box {
    grid-column: span 2;
    background: var(--white);
    padding: 40px;
    box-shadow: var(--shadow);
    border-bottom: 4px solid transparent;
    transition: var(--transition);
}

.service-box:hover { border-color: var(--accent); transform: translateY(-5px); }

/* Grid Layout Adjustments */
.services-grid .service-box:nth-child(4) { grid-column: 2 / span 2; }
.services-grid .service-box:nth-child(5) { grid-column: 4 / span 2; }

@media(max-width: 992px) {
    .services-grid { grid-template-columns: repeat(2, 1fr); }
    .service-box, 
    .services-grid .service-box:nth-child(4), 
    .services-grid .service-box:nth-child(5) { 
        grid-column: span 1; 
    }
}

@media(max-width: 600px) { .services-grid { grid-template-columns: 1fr; } }

/* Portfolio */
.portfolio-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 30px; }

.project-card {
    background: var(--white);
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: var(--transition);
    border-radius: 4px;
    overflow: hidden;
}

.project-card img { width: 100%; height: 250px; object-fit: cover; display: block; }

.project-content { padding: 25px; }

/* ==========================================================================
   5. MODAL SYSTEM
   ========================================================================== */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.9);
    padding: 40px 15px;
    z-index: 2000;
    overflow-y: auto;
}

.modal-content {
    background: var(--white);
    max-width: 900px;
    margin: 0 auto;
    padding: 40px;
    position: relative;
    border-radius: 8px;
}

.close-btn {
    position: sticky;
    top: 0;
    float: right;
    background: var(--white);
    padding: 8px 15px;
    font-weight: 700;
    cursor: pointer;
    z-index: 10;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.gallery { display: flex; flex-direction: column; gap: 20px; margin-top: 30px; }

.gallery img {
    width: 100%;
    max-height: 700px;
    object-fit: cover;
    background: #f0f0f0;
    border-radius: 4px;
}

/* ==========================================================================
   6. CONTACT & FOOTER
   ========================================================================== */
.contact-wrapper { display: grid; grid-template-columns: 1fr 1fr; gap: 60px; }

form input, form textarea {
    width: 100%;
    padding: 15px;
    margin-bottom: 20px;
    border: 1px solid #ddd;
    font-family: inherit;
    border-radius: 4px;
}

#form-status-msg {
            display: none;
            padding: 15px;
            margin-top: 10px;
            border-radius: 5px;
            font-weight: 600;
        }
        #form-status-msg.success {
            display: block;
            background-color: #d4edda;
            color: #155724;
            border: 1px solid #c3e6cb;
        }
        #form-status-msg.error {
            display: block;
            background-color: #f8d7da;
            color: #721c24;
            border: 1px solid #f5c6cb;
        }

footer { background: var(--primary); color: var(--white); text-align: center; padding: 50px 0; }

@media(max-width: 768px) {
    .contact-wrapper { grid-template-columns: 1fr; }
    section { padding: 60px 0; }
}