/* CSS Variables for Premium Design */
:root {
    --primary: #52B788;      /* Natural soft green */
    --primary-light: #74C69D;
    --primary-dark: #2D6A4F;
    --secondary: #95D5B2;    /* Moss */
    --accent: #E0A96D;       /* Wood */
    --dark: #04100C;         /* Very dark */
    --light: #16241E;        /* Dark panel */
    --white: #F4F7F5;        /* Soft White for text */
    --text: #A7BCAE;         /* Muted light text */
    --text-dark: #E4EBE6;    /* Brightest text for headings */
    --gray: #2A3B32;         /* Dark border */
    
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
    
    --transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    --shadow-sm: 0 8px 24px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 16px 32px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 24px 48px rgba(0, 0, 0, 0.08);
    --radius: 24px;
}

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

html {
    scroll-behavior: smooth;
    scroll-padding-top: 80px;
}

body {
    font-family: var(--font-body);
    color: var(--text);
    line-height: 1.6;
    background-color: var(--dark);
    background-image: linear-gradient(rgba(4, 16, 12, 0.8), rgba(4, 16, 12, 0.8)), url('images/bg_forest_soft.jpg');
    background-size: cover;
    background-attachment: fixed;
    background-position: center;
    overflow-x: hidden;
    position: relative;
    -webkit-text-size-adjust: 100%;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    color: var(--text-dark);
    line-height: 1.2;
}

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

ul {
    list-style: none;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

.section-padding {
    padding: 100px 0;
}

.text-center {
    text-align: center;
}

.bg-light {
    background-color: transparent; /* Overridden by section backgrounds */
}

.bg-dark {
    background-color: var(--dark);
}

.text-white {
    color: var(--white);
}

.text-white p {
    color: rgba(255, 255, 255, 0.8);
}

/* Typography Classes */
.section-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    position: relative;
    display: inline-block;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 0;
    width: 60px;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    border-radius: 2px;
}

.text-center .section-title::after {
    left: 50%;
    transform: translateX(-50%);
}

.section-subtitle {
    font-size: 1.125rem;
    max-width: 700px;
    margin: 0 auto 3rem;
    color: var(--text);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 32px;
    border-radius: 50px;
    font-weight: 600;
    font-family: var(--font-heading);
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
    border: 2px solid transparent;
}

.btn-sm {
    padding: 10px 24px;
    font-size: 0.875rem;
}

.btn-block {
    width: 100%;
    display: flex;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: var(--white);
    box-shadow: 0 4px 15px rgba(0, 119, 182, 0.3);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 119, 182, 0.4);
    color: var(--white);
}

.btn-outline {
    background: transparent;
    border-color: var(--white);
    color: var(--white);
}

.btn-outline:hover {
    background: var(--white);
    color: var(--primary-dark);
    transform: translateY(-3px);
}

.team .btn-outline {
    border-color: var(--primary);
    color: var(--primary);
}
.team .btn-outline:hover {
    background: var(--primary);
    color: var(--white);
}

/* Header & Nav */
#main-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    padding: 20px 0;
    transition: var(--transition);
}

#main-header.scrolled {
    background-color: rgba(8, 28, 21, 0.95);
    backdrop-filter: blur(10px);
    padding: 15px 0;
    box-shadow: var(--shadow-sm);
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    position: relative;
}

.main-nav {
    display: flex;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-mark {
    display: flex;
    flex-shrink: 0;
    line-height: 0;
}

.logo-mark svg {
    width: 36px;
    height: 36px;
    display: block;
}

.logo-text {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 1.5rem;
    color: var(--white);
    letter-spacing: -0.5px;
    transition: var(--transition);
}

.logo-text .highlight {
    color: var(--primary-light);
}

#main-header.scrolled .logo-text {
    color: var(--primary-dark);
}

#main-header.scrolled .logo-mark rect {
    fill: var(--primary);
}

.nav-links a.nav-extra {
    opacity: 0.75;
    font-size: 0.85rem;
}

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

.nav-links a {
    color: var(--white);
    font-weight: 500;
    font-size: 0.95rem;
    position: relative;
}

.nav-links a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -4px;
    left: 0;
    background-color: var(--primary-light);
    transition: var(--transition);
}

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

#main-header.scrolled .nav-links a {
    color: var(--text-dark);
}

.mobile-menu-btn {
    display: none;
    background: transparent;
    border: none;
    cursor: pointer;
    width: 30px;
    height: 20px;
    position: relative;
    z-index: 1001;
}

.mobile-menu-btn span {
    display: block;
    width: 100%;
    height: 2px;
    background-color: var(--white);
    position: absolute;
    left: 0;
    transition: var(--transition);
}

#main-header.scrolled .mobile-menu-btn span {
    background-color: var(--primary-dark);
}

.mobile-menu-btn span:nth-child(1) { top: 0; }
.mobile-menu-btn span:nth-child(2) { top: 9px; }
.mobile-menu-btn span:nth-child(3) { top: 18px; }

/* Hero Section */
.hero {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding-top: 80px;
}

.hero-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    /* Soft fade to bottom */
    mask-image: linear-gradient(to bottom, black 80%, transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, black 80%, transparent 100%);
}

.hero-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scale(1.05);
    animation: slowZoom 20s infinite alternate;
}

@keyframes slowZoom {
    0% { transform: scale(1); }
    100% { transform: scale(1.1); }
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        to right,
        rgba(4, 16, 12, 0.9) 0%,
        rgba(16, 44, 32, 0.7) 50%,
        rgba(255, 255, 255, 0) 100%
    );
}

/* Storymap Line */
.story-line {
    position: absolute;
    top: 100vh;
    bottom: 0;
    left: 50%;
    width: 2px;
    background: linear-gradient(to bottom, transparent, var(--primary), var(--secondary), transparent);
    transform: translateX(-50%);
    z-index: 0;
    opacity: 0.3;
}
@media (max-width: 768px) {
    .story-line {
        left: 20px;
    }
}

.hero-content {
    color: var(--white);
    max-width: 800px;
    position: relative;
    z-index: 1;
}

.hero-subtitle {
    font-family: var(--font-heading);
    font-size: 1.125rem;
    font-weight: 600;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 1rem;
}

.hero-title {
    font-size: 4.5rem;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 1.5rem;
    color: var(--white);
}

.hero-description {
    font-size: 1.25rem;
    font-weight: 300;
    margin-bottom: 2.5rem;
    max-width: 600px;
    color: rgba(255, 255, 255, 0.9);
}

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

/* Services Section */
.services {
    position: relative;
    z-index: 1;
}

.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
    gap: 30px;
}

.service-card {
    background: rgba(22, 46, 36, 0.75);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 40px 30px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    border: 1px solid var(--gray);
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.service-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.4s ease;
    z-index: -1;
}

.service-card:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-lg);
    border-color: transparent;
}

.service-card:hover::before {
    transform: scaleX(1);
}

.service-icon {
    width: 60px;
    height: 60px;
    background: var(--light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
    color: var(--primary);
    transition: var(--transition);
}

.service-card:hover .service-icon {
    background: var(--primary);
    color: var(--white);
    transform: rotateY(180deg);
}

a.service-card {
    display: block;
    color: var(--text);
}
a.service-card:hover {
    color: var(--text);
}
a.service-card h3 {
    color: var(--text-dark);
}

.service-card h3 {
    font-size: 1.25rem;
    margin-bottom: 12px;
}

/* Subpage Styles */
.hero-subpage {
    position: relative;
    padding: 150px 0 80px;
    text-align: center;
    border-bottom: 1px solid var(--gray);
}
.hero-subpage .hero-title {
    font-size: 3.5rem;
    margin-bottom: 1rem;
}
.hero-subpage-icon {
    width: 80px;
    height: 80px;
    background: var(--light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px;
    color: var(--primary);
}
.subpage-content {
    padding: 60px 0 100px;
}
.subpage-content p {
    font-size: 1.125rem;
    margin-bottom: 1.5rem;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}
.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 40px;
    font-weight: 500;
    color: var(--text-dark);
}
.back-btn:hover {
    color: var(--primary);
}
.subpage-image {
    width: 100%;
    max-width: 800px;
    height: 400px;
    object-fit: cover;
    border-radius: var(--radius);
    margin: 40px auto;
    display: block;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--gray);
}
.tech-theme-bg {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background-image: 
        linear-gradient(rgba(4, 16, 12, 0.9), rgba(4, 16, 12, 0.9)),
        linear-gradient(rgba(82, 183, 136, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(82, 183, 136, 0.05) 1px, transparent 1px);
    background-size: 100% 100%, 40px 40px, 40px 40px;
    z-index: -2;
}

/* Info Section */
.info-section {
    position: relative;
    z-index: 1;
}

.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    align-items: center;
}

.info-image-container {
    position: relative;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.info-image {
    width: 100%;
    height: auto;
    border-radius: var(--radius);
    transition: var(--transition);
}

.info-image-container:hover .info-image {
    transform: scale(1.05);
}

.experience-badge {
    position: absolute;
    bottom: -20px;
    right: -20px;
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    color: var(--white);
    width: 150px;
    height: 150px;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    border: 8px solid var(--dark);
    box-shadow: var(--shadow-md);
    z-index: 2;
}

.experience-badge .number {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    font-weight: 800;
    line-height: 1;
}

.experience-badge .text {
    font-size: 0.875rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.info-content .subsection-title {
    font-size: 1.5rem;
    margin: 1.5rem 0 1rem;
    color: var(--primary-dark);
}

.info-content p {
    margin-bottom: 1.5rem;
}

/* Projects Section */
.projects {
    position: relative;
    z-index: 1;
}

.projects-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
}

.project-card {
    display: block;
    color: inherit;
    text-decoration: none;
    background: rgba(22, 46, 36, 0.75);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    border: 1px solid var(--gray);
    cursor: pointer;
}

.project-card:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
    color: inherit;
}

.project-link-hint {
    display: inline-block;
    margin-top: 12px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--primary-light);
}

.project-image-container {
    width: 100%;
    height: 250px;
    overflow: hidden;
}

.project-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.project-card:hover .project-image {
    transform: scale(1.05);
}

.project-content {
    padding: 30px;
}

.project-content h3 {
    margin-bottom: 12px;
}

/* Team Section */
.team {
    position: relative;
    z-index: 1;
}

.team-card {
    max-width: 800px;
    margin: 0 auto;
    background: rgba(22, 46, 36, 0.75);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 40px;
    padding: 60px;
    position: relative;
    text-align: center;
    box-shadow: var(--shadow-lg);
}

.team-portrait-container {
    width: 160px;
    height: 160px;
    margin: 0 auto 30px;
    border-radius: 50%;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 119, 182, 0.2);
    border: 4px solid var(--white);
}

.team-portrait {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.team-portrait-container:hover .team-portrait {
    transform: scale(1.1);
}

.team-card::before {
    content: '"';
    font-family: Georgia, serif;
    font-size: 8rem;
    color: var(--gray);
    position: absolute;
    top: 20px;
    left: 30px;
    opacity: 0.5;
    line-height: 1;
}

.team-role {
    color: var(--primary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.875rem;
    display: block;
    margin-bottom: 8px;
}

.team-name {
    font-size: 2rem;
    margin-bottom: 24px;
}

.team-content p {
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
    color: var(--text-dark);
    position: relative;
    z-index: 1;
}

.team-content p:last-of-type {
    margin-bottom: 0;
}

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

.contact-desc {
    margin-bottom: 40px;
    font-size: 1.1rem;
    max-width: 500px;
}

.contact-details {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.contact-details li {
    display: flex;
    align-items: flex-start;
    gap: 20px;
}

.icon-wrapper {
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    flex-shrink: 0;
}

.detail-content span {
    display: block;
    font-size: 0.875rem;
    color: var(--accent);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.detail-content a,
.detail-content p {
    color: var(--white);
    font-size: 1.125rem;
    font-weight: 500;
}

.detail-content a:hover {
    color: var(--primary-light);
}

.contact-form-container {
    background: rgba(22, 46, 36, 0.75);
    padding: 40px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
}

.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-dark);
    font-weight: 500;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 14px 16px;
    background-color: rgba(4, 16, 12, 0.6);
    color: var(--white);
    border: 1px solid var(--gray);
    border-radius: 8px;
    font-family: var(--font-body);
    font-size: 1rem;
    transition: var(--transition);
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 119, 182, 0.1);
}

/* Footer */
footer {
    background: #04100C;
    color: var(--white);
    padding: 40px 0;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.footer-logo p {
    font-size: 0.875rem;
    color: rgba(255,255,255,0.6);
    margin-top: 8px;
}

.footer-links p {
    color: rgba(255,255,255,0.6);
    font-size: 0.875rem;
}

/* Animations */
.fade-up {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.fade-in {
    opacity: 0;
    transition: opacity 1s ease;
}

.fade-up.visible,
.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

.delay-1 { transition-delay: 0.1s; }
.delay-2 { transition-delay: 0.2s; }
.delay-3 { transition-delay: 0.3s; }

/* Responsive */
@media (max-width: 992px) {
    .hero-title {
        font-size: clamp(2rem, 6vw, 3.5rem);
    }
    .hero-subpage .hero-title {
        font-size: clamp(1.75rem, 5.5vw, 2.75rem);
    }
    .info-grid, .contact-grid, .projects-grid {
        grid-template-columns: 1fr;
        gap: 40px;
    }
    .experience-badge {
        bottom: 20px;
        right: 20px;
    }
    .team-card {
        padding: 40px 24px;
    }

    /* Hamburger earlier — extra nav items (Logo, Feedback, Översikt) */
    .mobile-menu-btn {
        display: block;
        flex-shrink: 0;
    }
    .main-nav {
        position: static;
    }
    .nav-links {
        position: fixed;
        top: 0;
        right: 0;
        width: min(320px, 88vw);
        height: 100vh;
        height: 100dvh;
        background: rgba(8, 28, 21, 0.98);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        flex-direction: column;
        align-items: stretch;
        padding: 88px 0 32px;
        gap: 0;
        box-shadow: -8px 0 32px rgba(0, 0, 0, 0.35);
        border-left: 1px solid var(--gray);
        transform: translateX(105%);
        transition: transform 0.35s ease;
        overflow-y: auto;
        z-index: 1000;
        list-style: none;
    }
    .nav-links.active {
        transform: translateX(0);
    }
    .nav-links li {
        width: 100%;
    }
    .nav-links a {
        display: block;
        padding: 16px 24px;
        color: var(--text-dark) !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.06);
        font-size: 1rem;
    }
    .nav-links a::after {
        display: none;
    }
    .nav-links a.nav-extra {
        opacity: 1;
        color: var(--primary-light) !important;
    }
    #main-header.mobile-open {
        background: rgba(8, 28, 21, 0.98);
    }
    #main-header.mobile-open .logo-text {
        color: var(--white);
    }
    #main-header.mobile-open .mobile-menu-btn span {
        background-color: var(--white);
    }
    .mobile-menu-btn.active span:nth-child(1) {
        transform: rotate(45deg);
        top: 9px;
    }
    .mobile-menu-btn.active span:nth-child(2) {
        opacity: 0;
    }
    .mobile-menu-btn.active span:nth-child(3) {
        transform: rotate(-45deg);
        top: 9px;
    }
}

@media (max-width: 768px) {
    body {
        background-attachment: scroll; /* fixed is buggy on iOS */
    }
    .section-padding {
        padding: 70px 0;
    }
    .container {
        padding: 0 16px;
    }
    .hero {
        min-height: 100svh;
        min-height: 100dvh;
        padding-top: 72px;
    }
    .hero-title {
        font-size: clamp(1.85rem, 8vw, 2.5rem);
        line-height: 1.15;
    }
    .hero-description {
        font-size: 1rem;
    }
    .hero-actions {
        flex-direction: column;
        width: 100%;
    }
    .hero-actions .btn {
        width: 100%;
        text-align: center;
    }
    .btn {
        max-width: 100%;
    }
    .logo-text {
        font-size: 1.15rem;
    }
    .logo-mark svg {
        width: 32px;
        height: 32px;
    }
    .section-title {
        font-size: 1.75rem;
    }
    .section-subtitle {
        font-size: 1rem;
    }
    .hero-subpage {
        padding: 120px 0 48px;
    }
    .subpage-image {
        height: auto;
        max-height: 260px;
        margin: 24px auto;
    }
    .subpage-content {
        padding: 40px 0 72px;
    }
    .subpage-content p {
        font-size: 1rem;
    }
    .service-card {
        padding: 28px 20px;
    }
    .project-image-container {
        height: 200px;
    }
    .team-card {
        border-radius: 24px;
        padding: 32px 20px;
    }
    .team-portrait-container {
        width: 120px;
        height: 120px;
    }
    .contact-form-container,
    .contact-info {
        width: 100%;
    }
    .footer-content {
        flex-direction: column;
        text-align: center;
    }
    /* Avoid hover-lift feeling broken on touch */
    .service-card:hover,
    .project-card:hover {
        transform: none;
    }
    .form-group input,
    .form-group textarea,
    .contact-form input,
    .contact-form textarea {
        font-size: 16px; /* iOS: no auto-zoom on focus */
        width: 100%;
        max-width: 100%;
    }
}

@media (max-width: 380px) {
    .logo-text .highlight {
        display: none;
    }
    .hero-title {
        font-size: 1.7rem;
    }
}
