/* --- SELF-HOSTED FONTS --- */
@font-face {
    font-family: 'Roboto Light';
    src: url('fonts/Roboto-Light.woff2') format('woff2');
    font-weight: 300;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Montserrat';
    src: url('fonts/Montserrat-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

/* --- GLOBAL STYLES --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: #ffffff;
    color: #444444;
    font-family: 'Roboto Light', sans-serif;
    font-weight: 300; 
    line-height: 1.6;
    overflow-x: hidden; 
}

h1, h2, h3 {
    font-family: 'Montserrat', sans-serif;
    font-weight: 400; 
    color: #444444;
    text-transform: uppercase;
    letter-spacing: 2px;
}

/* --- HEADER & LOGO --- */
header {
    position: relative;
    width: 100%;
    height: auto;
    margin-bottom: 80px;
}

.header-bg {
    width: 100%;
    height: auto; 
    display: block; 
    opacity: 0; 
    visibility: hidden; /* NEW: Prevents partial loads */
    transition: opacity 1.2s ease-in-out, visibility 1.2s; /* NEW: Syncs visibility with the fade */
}

.header-bg.is-loaded {
    opacity: 1; 
    visibility: visible; /* NEW: Shows image only when 100% loaded */
}

.logo {
    position: absolute;
    top: 20px; 
    left: 50%;
    transform: translateX(-50%); 
    z-index: 2; 
    max-width: 150px;
    height: auto;
}

/* --- HERO TEXT --- */
.hero-text {
    position: absolute;
    top: 50%; 
    left: 50%;
    transform: translate(-50%, -50%); 
    z-index: 2; 
    text-align: center;
    width: 100%;
    padding: 0 10px; 
}

.hero-text h1 {
    font-family: 'Montserrat', sans-serif;
    font-weight: 400;
    font-size: 16px; 
    color: #ffffff !important; 
    margin: 5px 0; 
    letter-spacing: 4px; 
    text-shadow: 0px 2px 15px rgba(0, 0, 0, 0.4); 
}

/* --- STICKY HEADER --- */
.sticky-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background-color: rgba(255, 255, 255, 0.95); 
    padding: 20px 0; 
    text-align: center;
    z-index: 1000; 
    transform: translateY(-100%); 
    transition: transform 0.4s ease-in-out; 
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05); 
}

.sticky-header.is-visible {
    transform: translateY(0); 
}

.sticky-logo {
    max-width: 100px; 
    height: auto;
    display: block;
    margin: 0 auto;
}

/* --- NAVIGATION & OVERLAYS --- */
.desktop-nav {
    position: absolute;
    top: 25px;
    right: 5vw;
    z-index: 10;
    display: none; 
}

.desktop-nav a {
    font-family: 'Montserrat', sans-serif;
    font-weight: 400;
    font-size: 14px;
    color: #444444; 
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-left: 30px;
    transition: opacity 0.3s;
}

.sticky-nav {
    top: 50%;
    transform: translateY(-50%);
}

.desktop-nav a:hover {
    opacity: 0.6;
}

/* Hamburgermeny */
.hamburger {
    position: absolute;
    top: 30px;
    right: 20px;
    width: 22px; 
    height: 13px; 
    cursor: pointer;
    z-index: 10;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.sticky-hamburger {
    top: 50%;
    transform: translateY(-50%);
}

.hamburger span {
    display: block;
    width: 100%;
    height: 2px; 
    background-color: #444444;
    border-radius: 1px; 
}

/* Full Page Overlays */
.full-page-overlay, .mobile-overlay {
    position: fixed;
    top: -100%; 
    left: 0;
    width: 100%;
    height: 100%;
    background-color: white;
    z-index: 2000;
    transition: top 0.5s cubic-bezier(0.77, 0, 0.175, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.full-page-overlay.is-open, .mobile-overlay.is-open {
    top: 0;
}

.close-overlay {
    position: absolute;
    top: 30px;
    right: 30px;
    font-size: 24px;
    cursor: pointer;
    color: #444444;
}

.overlay-content {
    max-width: 800px;
    text-align: center;
}

.overlay-content p {
    font-family: 'Roboto Light', sans-serif;
    font-size: 1.1rem;
    line-height: 1.8;
    color: #444444;
}

.contact-big-link {
    font-family: 'Roboto Light', sans-serif;
    font-size: 1.5rem;
    color: #444444;
    text-decoration: none;
    border-bottom: 1px solid #444444;
}

/* Mobilmeny styling */
.mobile-menu-content {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.mobile-menu-content a {
    font-family: 'Montserrat', sans-serif;
    font-size: 1.5rem;
    color: #444444;
    text-decoration: none;
    margin: 20px 0;
    text-transform: uppercase;
}

@media (min-width: 768px) {
    .desktop-nav { display: block; }
    .hamburger { display: none; }
}

.scroll-to-top {
    cursor: pointer;
}

/* --- SECTIONS --- */
.portfolio-section {
    margin-bottom: 80px;
}

.text-container {
    padding: 0 20px;
    text-align: center;
    margin-bottom: 30px;
}

.text-container h2 {
    font-size: 1.2rem;
    margin-bottom: 15px;
}

.text-container p {
    font-size: 0.95rem;
    max-width: 600px;
    margin: 0 auto;
}

/* --- IMAGES (Mobile First = Full Width) --- */
.image-container img {
    width: 100%;
    display: block;
    margin-bottom: 10px; 
}

.side-by-side {
    display: grid;
    grid-template-columns: 1fr 1fr; 
    gap: 10px; 
}

@media (min-width: 768px) {
    .side-by-side {
        gap: 20px; 
    }
}

/* --- FOOTER --- */
footer {
    text-align: center;
    padding: 80px 20px 100px 20px;
}

.footer-text {
    font-family: 'Roboto Light', sans-serif;
    font-weight: 300;
    color: #444444;
    line-height: 1.8; 
    margin: 0;
}

.footer-link {
    color: #444444; 
    text-decoration: none; 
    border-bottom: 1px solid #444444; 
    padding-bottom: 2px;
    transition: opacity 0.3s ease;
}

.footer-link:hover {
    opacity: 0.6; 
}

/* --- DESKTOP ADJUSTMENTS --- */
@media (min-width: 768px) {
    
    .hero-text h1 {
        font-size: 21px; 
    }

    .text-container {
        padding: 0;
    }
    
    .image-container {
        width: 100%; 
        padding: 0 5vw; 
        display: flex;
        flex-direction: column;
        align-items: center; 
    }
    
    .image-container img {
        width: 100%;
        max-width: 2000px; 
        margin-bottom: 20px;
    }

    .side-by-side {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 20px;
        max-width: 2200px; 
        margin: 0 auto; 
    }
}

/* --- SCROLL ANIMATION STYLES --- */
.animate-on-scroll {
    opacity: 0;
    visibility: hidden; /* NEW: Keeps elements truly invisible before scroll */
    transform: translateY(40px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out, visibility 0.8s;
    will-change: opacity, transform;
}

/* 1. General elements fade in when visible on screen */
.animate-on-scroll.is-visible {
    opacity: 1;
    visibility: visible; /* NEW */
    transform: translateY(0);
}

/* 2. Images must stay completely hidden if they are on screen but NOT finished downloading */
img.animate-on-scroll.is-visible {
    opacity: 0; 
    visibility: hidden; /* NEW */
}

/* 3. Images finally fade in ONLY when they are BOTH on screen AND 100% loaded */
img.animate-on-scroll.is-visible.is-loaded {
    opacity: 1;
    visibility: visible; /* NEW */
}