/* Global Styles */
:root {
    --bg-color: #0a0f1a;
    --accent-color: #4fd1c5;
    --accent-gradient: linear-gradient(135deg, #4fd1c5 0%, #0ea5e9 100%);
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --card-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --nav-bg: rgba(10, 15, 26, 0.85);
    --footer-bg: #05080f;
}

[data-theme="light"] {
    --bg-color: #f0f4f8;
    --text-primary: #1a202c;
    --text-secondary: #4a5568;
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(0, 0, 0, 0.1);
    --card-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.1);
    --nav-bg: rgba(240, 244, 248, 0.85);
    --footer-bg: #e2e8f0;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'JetBrains Mono', monospace;
    color: var(--accent-color);
}

a {
    color: var(--accent-color);
    text-decoration: none;
    transition: all 0.3s ease;
}

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

/* Animations */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

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

/* Navbar */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    padding: 1.5rem 0;
    z-index: 1000;
    transition: all 0.4s ease;
}

.navbar.scrolled {
    padding: 0.8rem 0;
    background: var(--nav-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--glass-border);
    box-shadow: 0 10px 30px rgba(0,0,0,0.4);
}

.nav-container {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.logo {
    position: absolute;
    left: 2rem;
}

.theme-toggle {
    position: absolute;
    right: 5rem;
    cursor: pointer;
    font-size: 1.2rem;
    color: var(--accent-color);
    z-index: 1001;
    transition: all 0.3s ease;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
}

.theme-toggle:hover {
    transform: scale(1.1);
    background: rgba(79, 209, 197, 0.1);
}

.mobile-toggle {
    position: absolute;
    right: 2rem;
    display: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--accent-color);
    z-index: 1001;
    transition: all 0.3s ease;
}

.nav-cv {
    padding: 0.5rem 1rem;
    background: var(--accent-gradient);
    color: var(--bg-color) !important;
    border-radius: 8px;
    font-weight: 600 !important;
    transition: all 0.3s ease;
}

.nav-cv:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(79, 209, 197, 0.3);
}

.nav-cv::after {
    display: none !important;
}

.navbar ul {
    display: flex;
    list-style: none;
    gap: 2rem;
    align-items: center;
}

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

.nav-links a:not(.nav-cv)::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--accent-gradient);
    transition: width 0.3s ease;
}

.nav-links a:not(.nav-cv):hover {
    color: var(--accent-color);
}

.nav-links a:not(.nav-cv):hover::after {
    width: 100%;
}

.mobile-toggle.active {
    color: #fff;
}

/* Hero Section */
.hero {
    height: 100vh;
    display: flex;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(79, 209, 197, 0.1) 0%, transparent 70%);
    top: -200px;
    right: -100px;
    pointer-events: none;
}

.hero::after {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(14, 165, 233, 0.08) 0%, transparent 70%);
    bottom: -100px;
    left: -100px;
    pointer-events: none;
}

.hero-container {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    align-items: center;
    gap: 4rem;
}

.hero-text-sequence {
    display: flex;
    flex-direction: column;
}

.hero-greeting {
    display: block;
    color: var(--accent-color);
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.4rem;
    margin-bottom: 0.5rem;
    min-height: 1.8rem;
    visibility: visible;
    opacity: 1;
}

.hero-name {
    font-size: 5.5rem;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 1rem;
    color: var(--text-primary);
    letter-spacing: -2px;
    min-height: 12rem; /* Säkerställ tillräckligt utrymme för att undvika hopp */
    visibility: visible;
    opacity: 1;
    display: block;
}

.hero-subtitle {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    min-height: 3.5rem;
    opacity: 1;
    color: var(--accent-color); /* Fallback */
    visibility: visible;
    display: block;
}

.hero-desc {
    font-size: 1.15rem;
    color: var(--text-secondary);
    max-width: 550px;
    margin-bottom: 2.5rem;
    min-height: 8rem; /* Ökad för att rymma hela texten utan hopp */
    opacity: 1;
    visibility: visible;
    display: block;
}

.hero-btns {
    display: flex;
    gap: 1.5rem;
    pointer-events: none; /* Deaktivera tills animationen är klar */
}

.hero-btns.visible {
    pointer-events: auto;
}

.btn {
    padding: 1rem 2.5rem;
    border-radius: 12px;
    font-weight: 600;
    display: inline-block;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--accent-gradient);
    color: var(--bg-color);
    border: none;
    box-shadow: 0 4px 15px rgba(79, 209, 197, 0.3);
}

.btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(79, 209, 197, 0.4);
    color: var(--bg-color);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--accent-color);
    color: var(--accent-color);
    box-shadow: none;
}

.btn-outline:hover {
    background: rgba(79, 209, 197, 0.05);
    border-color: #0ea5e9;
    color: #0ea5e9;
}

/* Hero Image */
.hero-image {
    position: relative;
    display: flex;
    justify-content: center;
    opacity: 1 !important;
    transform: none !important;
}

.image-border {
    position: relative;
    padding: 12px;
    border-radius: 24px;
    background: var(--accent-gradient);
    box-shadow: 0 20px 40px rgba(0,0,0,0.4);
    animation: fadeIn 1s ease-out forwards;
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

/* Morph borttagen enligt önskemål */
@keyframes morph {
    0% { border-radius: 24px; }
    50% { border-radius: 40px; }
    100% { border-radius: 24px; }
}

.hero-image img {
    width: 100%;
    max-width: 350px;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: inherit;
    border: 5px solid var(--bg-color);
    transition: transform 0.5s ease;
}

/* Sections General */
section {
    padding: 100px 0;
}

.section-title {
    font-size: 3rem;
    margin-bottom: 4rem;
    text-align: center;
    position: relative;
    text-transform: uppercase;
    letter-spacing: 3px;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 4px;
    background: var(--accent-gradient);
    border-radius: 2px;
}

/* About Preview */
.about-preview {
    background: rgba(255, 255, 255, 0.02);
    text-align: center;
}

.about-preview p {
    max-width: 700px;
    margin: 0 auto 2.5rem;
    font-size: 1.2rem;
}

/* Projects Grid */
.projects-container {
    max-width: 1400px;
    margin: 0 auto;
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 4rem;
    margin-top: 3rem;
}

.project-card {
    background: var(--glass-bg);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    overflow: hidden;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.project-card:hover {
    transform: translateY(-15px) scale(1.02);
    border-color: var(--accent-color);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.project-video-container {
    width: 100%;
    height: 450px; /* Betydligt ökad höjd för att videon ska ta mer plats */
    overflow: hidden;
    position: relative;
    background: #000; /* Svart bakgrund bakom videon */
}

.project-video, 
.project-card img {
    width: 100%;
    height: 100%;
    object-fit: contain; /* Behåller hela videon synlig utan beskärning */
    transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    filter: brightness(1.1); /* Gör videon lite ljusare */
}

.project-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 15, 26, 0.2); /* Mycket svagare overlay som standard */
    pointer-events: none;
    transition: background 0.4s ease;
}

.project-card:hover .project-overlay {
    background: rgba(10, 15, 26, 0.05); /* Nästan helt transparent vid hover */
}

.project-card:hover .project-video {
    transform: scale(1.05); /* En mer subtil zoom som inte skär av kanterna för mycket */
}

.project-info {
    padding: 2rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.project-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-bottom: 0.5rem;
}

.tag {
    padding: 0.4rem 0.8rem;
    background: rgba(79, 209, 197, 0.1);
    border: 1px solid rgba(79, 209, 197, 0.2);
    color: var(--accent-color);
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.project-card h3 {
    font-size: 1.6rem;
    color: var(--text-primary);
    margin: 0;
}

.project-card p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.project-footer {
    margin-top: auto;
    padding-top: 1rem;
}

.project-link {
    font-weight: 700;
    color: var(--accent-color);
    display: flex;
    align-items: center;
    gap: 0.8rem;
    font-size: 1rem;
}

.project-link i {
    font-size: 1.2rem;
    transition: transform 0.3s ease;
}

.project-link:hover i {
    transform: rotate(15deg) scale(1.2);
}

/* 
   KONTAKT-KORT 
*/
.contact-preview {
    text-align: center;
}

.contact-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 3rem; /* Ökat för snyggare layout */
    margin-top: 3rem;
}

.contact-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    padding: 2.5rem;
    border-radius: 20px;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--text-primary);
    text-decoration: none;
}

.contact-card span {
    color: var(--accent-color);
    font-weight: 500;
    margin-top: 0.5rem;
}

.contact-card:hover {
    background: rgba(79, 209, 197, 0.05);
    transform: translateY(-10px); /* Lyfter uppåt istället för bara skala */
    border-color: var(--accent-color);
    color: var(--text-primary);
}

.contact-card:hover span {
    text-decoration: underline;
}

.contact-card i {
    font-size: 2.5rem;
    color: var(--accent-color);
    margin-bottom: 1rem;
}

/* 
   FOOTER OCH SOCIALA LÄNKAR 
*/
footer {
    padding: 4rem 0 2rem;
    background: var(--footer-bg);
    border-top: 1px solid var(--glass-border);
}

.footer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
}

/* Avstånd mellan sociala ikoner i footern */
.footer-socials {
    display: flex;
    gap: 3rem; /* Ökat mellanrum för att det ska se snyggare ut */
}

.footer-socials a {
    font-size: 1.8rem;
    color: var(--text-secondary);
    transition: all 0.3s ease;
}

.footer-socials a:hover {
    color: var(--accent-color);
    transform: translateY(-5px);
}

/* Copyright text stil */
footer p {
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.9rem;
}

/* Tech Banner Styles */
.tech-banner {
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    overflow: hidden;
    padding: 2rem 0;
    position: relative;
    border-top: 1px solid var(--glass-border);
    border-bottom: 1px solid var(--glass-border);
    margin: 2rem 0;
    transition: background 0.3s ease;
}

[data-theme="light"] .tech-banner {
    background: rgba(0, 0, 0, 0.05);
}

.tech-banner::before,
.tech-banner::after {
    content: "";
    height: 100%;
    position: absolute;
    width: 150px;
    z-index: 2;
    pointer-events: none;
}

.tech-banner::before {
    left: 0;
    top: 0;
    background: linear-gradient(to right, var(--bg-color) 0%, transparent 100%);
}

.tech-banner::after {
    right: 0;
    top: 0;
    background: linear-gradient(to left, var(--bg-color) 0%, transparent 100%);
}

.tech-track {
    display: flex;
    width: calc(250px * 24); /* 12 ikoner * 2 för loopen */
    animation: scroll 40s linear infinite;
}

.tech-item {
    width: 250px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    filter: grayscale(1) opacity(0.5);
}

[data-theme="light"] .tech-item {
    filter: grayscale(0.8) opacity(0.7);
}

.tech-item:hover {
    filter: grayscale(0) opacity(1);
    transform: scale(1.1);
}

.tech-item i {
    font-size: 2.5rem;
    color: var(--accent-color);
}

.tech-item span {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
}

@keyframes scroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(calc(-250px * 12)); }
}

/* Turkos färg för copyright-texten i ljust läge */
[data-theme="light"] .footer-copyright {
    color: var(--accent-color);
    opacity: 1;
    font-weight: 500;
}

/* Responsive */
@media (max-width: 1024px) {
    .hero-name { font-size: 4rem; }
    .hero-image img { width: 300px; height: 300px; }
}

@media (max-width: 768px) {
    .mobile-toggle { display: block; }
    
    .theme-toggle {
        right: 5rem;
    }
    
    .nav-links {
        position: fixed;
        top: 0;
        right: -100%;
        width: 100%;
        height: 100vh;
        background: rgba(10, 15, 26, 0.95);
        backdrop-filter: blur(20px);
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        transition: all 0.5s cubic-bezier(0.77, 0.2, 0.05, 1.0);
        z-index: 1000;
    }

    [data-theme="light"] .nav-links {
        background: rgba(240, 244, 248, 0.95);
    }

    .nav-links.active {
        right: 0;
    }

    .navbar ul {
        flex-direction: column;
        align-items: center;
        gap: 3rem;
    }

    .navbar ul li a {
        font-size: 1.5rem;
        font-weight: 700;
    }

    .hero-container {
        display: flex;
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 2rem;
        padding-top: 2rem;
    }

    .hero-content {
        order: 2;
        width: 100%;
    }

    .hero-image {
        order: 1;
        width: 100%;
        max-width: 250px;
    }

    .hero-name { 
        font-size: 3rem; 
        min-height: auto; 
        margin-bottom: 0.5rem;
    }
    
    .hero-subtitle { 
        font-size: 1.8rem; 
        min-height: auto;
        margin-bottom: 1rem;
    }
    
    .hero-desc { 
        font-size: 1rem;
        min-height: auto; 
        margin: 0 auto 2rem;
    }
    
    .hero-btns { 
        flex-direction: row; 
        justify-content: center;
        width: 100%; 
        gap: 1rem;
    }
    
    .btn { 
        padding: 0.8rem 1.5rem;
        font-size: 0.9rem;
    }

    .scroll-down {
        display: none;
    }
}

/* Video Lightbox Modal */
.video-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
    display: none; /* Dold som standard */
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.video-modal.active {
    display: flex;
    opacity: 1;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(8px);
    cursor: pointer;
}

.modal-content {
    position: relative;
    width: 90%;
    max-width: 1000px;
    background: var(--bg-color);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 2001;
    border: 1px solid var(--glass-border);
}

.video-modal.active .modal-content {
    transform: scale(1);
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 2002;
    transition: all 0.3s ease;
    font-size: 1.2rem;
}

.modal-close:hover {
    background: var(--accent-color);
    color: var(--bg-color);
    transform: rotate(90deg);
}

.video-wrapper {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 Aspect Ratio */
    height: 0;
}

.video-wrapper video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    cursor: zoom-in; /* Indikerar att den kan förstoras */
}

/* Gör projektvideos klickbara */
.project-video-container {
    cursor: pointer;
    position: relative;
}

.project-video-container::after {
    content: '\f04b'; /* Play-ikon */
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    font-size: 3rem;
    color: #fff;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 2;
    pointer-events: none;
}

.project-video-container:hover::after {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.project-video-container:hover .project-overlay {
    background: rgba(0, 0, 0, 0.4);
}

/* Scroll Indicator */
.scroll-down {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    color: var(--accent-color);
    font-size: 1.5rem;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {transform: translateY(0) translateX(-50%);}
    40% {transform: translateY(-10px) translateX(-50%);}
    60% {transform: translateY(-5px) translateX(-50%);}
}