/* -------------------------------------------------
   THEME VARIABLES
--------------------------------------------------*/
:root {
    color-scheme: light;
    --bg: #f5f5f3;
    --bg-dot: rgba(0, 0, 0, 0.3);
    --bg-dot-size: 1px;
    --bg-grid-size: 24px;
    --surface: #f5f5f3;
    --surface-soft: #f5f5f3;
    --text: #1d1d20;
    --muted: #6e6f78;
    --accent: #2e6eb5;
    --border: #f5f5f3;
    --shadow: 0 20px 45px rgba(60, 63, 71, 0.08);
    --card-bg: rgba(255, 255, 255, 0.85);
    --card-border: rgba(109, 113, 121, 0.12);
    --card-blur: 4px;

    /* C++ */
    --tag-cpp-bg: rgba(200, 60, 60, 0.18);
    --tag-cpp-text: #7a2e2e;

    --tag-c-bg: rgba(0, 102, 204, 0.18);   /* mjuk blå bakgrund */
    --tag-c-text: #004c99;                /* djupare blå text */


    --tag-cmake-bg: rgba(0, 150, 136, 0.18);  /* teal/grön-blå mix */
    --tag-cmake-text: #00695c;               /* mörkare teal */



    /* React */
    --tag-react-bg: rgba(97, 218, 251, 0.18);
    --tag-react-text: #2a4a55;

    /* Node */
    --tag-node-bg: rgba(60, 135, 58, 0.15);
    --tag-node-text: #2d4a2d;
}

body[data-theme="dark"] {
    color-scheme: dark;
    --bg: #1a1a1a;
    --bg-dot: rgba(255, 255, 255, 0.3);
    --bg-dot-size: 1px;
    --bg-grid-size: 24px;
    --surface: #1a1a1a;
    --surface-soft: #1a1a1a;
    --text: #ffffff;
    --muted: #c9c9c9;
    --accent: #6ea8ff;
    --border: #1a1a1a;
    --shadow: 0 20px 45px rgba(0, 0, 0, 0.24);
    --card-bg: rgba(26, 26, 26, 0.75);
    --card-border: rgba(255, 255, 255, 0.08);
    --card-blur: 6px;

    --tag-cpp-bg: rgba(255, 100, 100, 0.28);
    --tag-cpp-text: #ffb3b3;

    --tag-c-bg: rgba(0, 140, 255, 0.28);  /* ljusare blå glow */
    --tag-c-text: #66c2ff;               /* ljus blå text */


    --tag-cmake-bg: rgba(0, 200, 180, 0.30); /* ljusare teal glow */
    --tag-cmake-text: #80fff0;               /* neon-teal text */


    /* React */
    --tag-react-bg: rgba(97, 218, 251, 0.35);
    --tag-react-text: #c8f6ff;

    /* Node */
    --tag-node-bg: rgba(60, 200, 80, 0.30);
    --tag-node-text: #b8ffcc;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    background:
        radial-gradient(circle, var(--bg-dot) var(--bg-dot-size), transparent 0);
    background-size: var(--bg-grid-size) var(--bg-grid-size);
    z-index: -1;
}


/* -------------------------------------------------
   GLOBAL
--------------------------------------------------*/
html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg);
    margin: 0;
    font-family: system-ui, sans-serif;
}

/* -------------------------------------------------
   HEADER
--------------------------------------------------*/
header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 28px 48px;
    background: var(--surface);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.logo {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--muted);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.menu-toggle {
    display: none;
    font-size: 1.8rem;
    background: none;
    border: none;
    color: var(--text);
    cursor: pointer;
    z-index: 2999;
}

/* -------------------------------------------------
   NAVIGATION
--------------------------------------------------*/
nav {
    display: flex;
    gap: 48px;
}

nav a {
    color: var(--muted);
    font-size: 0.95rem;
    font-weight: 500;
    transition: color 0.2s ease;
    letter-spacing: 0.01em;
}

nav button {
    width: 25px;
}

/* -------------------------------------------------
   MOBILE MENU
--------------------------------------------------*/
.mobile-menu {
    display: none;
    flex-direction: column;
    gap: 20px;
    background: var(--surface);
    padding: 20px;
    position: absolute;
    top: 70px;
    right: 20px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    z-index: 2000;
}

/* -------------------------------------------------
   HERO SECTION
--------------------------------------------------*/
.hero {
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: 80px 0 56px;
    text-align: center;
}

.hero-content {
    text-align: center;
    justify-self: center;
    padding: 10px;
    margin: 32px 0 0;
    color: var(--muted);
    line-height: 1.8;
    font-size: 1.1rem;
    font-weight: 400;
    animation: heroFadeIn 2s ease-out both;
}

.hero h1 {
    margin: 0;
    font-size: clamp(2.8rem, 5.5vw, 4rem);
    line-height: 1.15;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.section-divider {
    width: 100%;
    height: 1px;
    margin: 28px 0 0;
    background: linear-gradient(90deg, transparent, rgba(109, 113, 121, 0.25), transparent);
}

.scroll-arrow {
    font-size: 3rem;
    color: var(--accent);
    margin-top: 32px;
    animation: arrowBounce 1.8s ease-in-out infinite;
    /* arrowColorShift 5s ease-in-out infinite; */
    opacity: 0.7;
}

/* -------------------------------------------------
   PROJECTS
--------------------------------------------------*/

.projects-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr); 
    gap: 32px;
    padding: 40px 0;
    max-width: 900px;
    margin: 0 auto; 
}


.project-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between; 
    background: var(--card-bg);
    backdrop-filter: blur(var(--card-blur));
    border-radius: 20px;
    padding: 24px;
    box-shadow: var(--shadow);
    max-width: 320px;
    margin: 40px auto;
    transition: transform .25s ease, box-shadow .25s ease;
    border: 1px solid var(--card-border);
}



.project-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 30px 55px rgba(60, 63, 71, 0.14);
}

/* Image */
.project-card .project-image {
    width: 100%;
    height: 180px;
    border-radius: 14px;
    object-fit: cover;
    margin-bottom: 16px;
}

/* Category tag */
.project-card .project-category {
    background: rgba(0,0,0,0.05);
    color: var(--text);
    padding: 4px 10px;
    border-radius: 6px;
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    margin-bottom: 10px;
}

/* Title */
.project-card .project-title {
    margin: 0;
    color: var(--text);
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    margin-bottom: 12px;
}

/* Tech tags */
.project-card .tech-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.project-card .tech-tags span {
    background: rgba(46, 110, 181, 0.12);
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--muted);
}

/* Description */
.project-card .project-description {
    flex-grow: 1;
    margin: 0 0 20px;
    line-height: 1.55;
    font-size: 0.95rem;
    color: var(--muted);
}

.tech-tags span.cpp {
    background: var(--tag-cpp-bg);
    color: var(--tag-cpp-text);
}

.tech-tags span.c {
    background: var(--tag-c-bg);
    color: var(--tag-c-text);
}

.tech-tags span.cmake {
    background: var(--tag-cmake-bg);
    color: var(--tag-cmake-text);
}

.tech-tags span.react {
    background: var(--tag-react-bg);
    color: var(--tag-react-text);
}

.tech-tags span.node {
    background: var(--tag-node-bg);
    color: var(--tag-node-text);
}


/* -------------------------------------------------
   FUN BUTTONS (Try + Read More)
--------------------------------------------------*/

.project-actions {
    display: flex;
    gap: 12px;
    margin-top: 16px;
}

/* Try Demo Button */
.try-demo {
    flex: 1;
    padding: 10px 16px;
    background: var(--accent);
    color: white;
    border-radius: 10px;
    font-weight: 600;
    text-decoration: none;
    text-align: center;
    position: relative;
    overflow: hidden;
    transition: transform .2s ease, box-shadow .2s ease;
}

/* Fun hover effect */
.try-demo:hover {
    transform: translateY(-3px) scale(1.03);
    box-shadow: 0 10px 25px rgba(46, 110, 181, 0.35);
}

/* Read More Button */
.read-more {
    flex: 1;
    padding: 10px 16px;
    background: rgba(46, 110, 181, 0.12);
    color: var(--accent);
    border-radius: 10px;
    font-weight: 600;
    text-decoration: none;
    text-align: center;
    transition: transform .2s ease, background-color .2s ease;
}

.read-more:hover {
    background: rgba(46, 110, 181, 0.18);
    transform: translateY(-3px);
}


/* -------------------------------------------------
   FOOTER
--------------------------------------------------*/


footer {
    padding: 64px 48px 72px;
    text-align: center;
    font-size: 0.85rem;
    color: var(--muted);
    opacity: 0.85;
    letter-spacing: 0.01em;
    position: relative;
}

footer::before {
    content: "";
    display: block;
    width: 100%;
    height: 1px;
    margin-bottom: 32px;
    background: linear-gradient(90deg, transparent, rgba(109, 113, 121, 0.25), transparent);
}

.footer-socials {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 24px;
}

.footer-socials .social-link {
    padding: 10px 0;
    width: 120px; 
    text-align: center;
    background: rgba(46, 110, 181, 0.06);
    border-radius: 8px;
    color: var(--muted);
    font-weight: 500;
    transition: all 0.2s ease;
}


.footer-socials .social-link:hover {
    background: rgba(46, 110, 181, 0.12);
    color: var(--text);
    transform: translateY(-2px);
}


.theme-toggle {
    font-family: "Segoe UI Symbol", "Arial Unicode MS", "Noto Sans Symbols", sans-serif;
    font-variant-emoji: text;
    color: var(--text);
    background: none;
    border: none;
    outline: none;
    padding: 0;
    margin: 0;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 999;
}

.sun-icon {
    width: 1.25rem;
    height: 1.25rem;
    fill: var(--text);
}




.mobile-theme-toggle {
    display: none;
}

.desktop-theme-toggle {
    display: inline-block;
}




/* -------------------------------------------------
   BANNER
--------------------------------------------------*/

.banner {
    position: relative;
    width: 100%;
    height: 250px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.banner-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
}

.banner-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to bottom,
        rgba(0,0,0,0.25),
        rgba(0,0,0,0.55)
    );
    pointer-events: none;
}

.banner-text {
    position: absolute;
    bottom: 48px;
    text-align: center;
    color: white;
    text-align: justify;
    text-align-last: center;
}

/* CASE STUDY label */
.banner-label {
    display: inline-block;
    font-size: 0.85rem;
    letter-spacing: 0.18em;
    font-weight: 700;
    opacity: 0.85;
    margin-bottom: 12px;
}

/* Main title */
.banner-title {
    font-size: clamp(1.8rem, 4vw, 3rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    text-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

/* -------------------------------------------------
   CASE STUDY SECTIONS
--------------------------------------------------*/

.case-section {
    max-width: 900px;
    margin: 60px auto;
    padding: 0 24px;
    color: var(--text);
}

.case-section h2 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 16px;
    letter-spacing: -0.01em;
}

.case-section h3 {
    font-size: 1.35rem;
    font-weight: 600;
    margin-top: 32px;
    margin-bottom: 12px;
}

.case-section p {
    line-height: 1.7;
    font-size: 1rem;
    color: var(--muted);
    margin-bottom: 16px;
}

.case-section ul {
    margin: 16px 0 32px;
    padding-left: 20px;
}

.case-section li {
    margin-bottom: 10px;
    line-height: 1.6;
    color: var(--muted);
}

/* Divider between sections */
.case-divider {
    width: 100%;
    height: 1px;
    margin: 48px 0;
    background: linear-gradient(90deg, transparent, rgba(109,113,121,0.25), transparent);
}

.resume-button {
    display: inline-block;
    align-items: center;
    justify-content: center;
    margin-left: auto;
    margin-right: auto;
    gap: 8px;
    margin-top: 28px;
    padding: 12px 26px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 14px;
    text-decoration: none;
    color: var(--accent);
    background: transparent;
    border: 2px solid rgba(46, 110, 181, 0.35);
    transition: all 0.25s ease;
    margin-top: 32px;
}


.resume-button:hover {
    box-shadow: 0 0 12px rgba(46, 110, 181, 0.35);
    background: rgba(46, 110, 181, 0.08); /* mjuk highlight */
    border-color: rgba(46, 110, 181, 0.55);
    transform: translateY(-2px);
}

.resume-icon {
    font-size: 1.1rem;
    opacity: 0.8;
    display: flex;
    align-items: center;
    justify-content: center;
}


/* ABOUT SECTION */
.about-section {
    max-width: 900px;
    margin: 80px auto;
    padding: 0 24px;
}

.about-section h2 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 32px;
    letter-spacing: -0.01em;
    color: var(--text);
    text-align: center;
}

/* About card */
.about-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(var(--card-blur));
    padding: 28px;
    border-radius: 16px;
    box-shadow: var(--shadow);
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
    transition: transform .25s ease, box-shadow .25s ease;
}

.about-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 30px 55px rgba(60, 63, 71, 0.14);
}

/* Label */
.about-label {
    display: inline-block;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    margin-bottom: 16px;
    opacity: 0.85;
    color: var(--accent);
}

/* Text */
.about-text {
    line-height: 1.7;
    font-size: 1rem;
    color: var(--muted);
    margin-bottom: 16px;
}

/* CONTACT SECTION */
.contact-section {
    max-width: 900px;
    margin: 80px auto;
    padding: 0 24px;
}

.contact-section h2 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 32px;
    letter-spacing: -0.01em;
    color: var(--text);
    text-align: center;
}

/* Grid layout */
.contact-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 24px;
}

/* Contact cards */
.contact-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(var(--card-blur));
    padding: 24px;
    border-radius: 16px;
    box-shadow: var(--shadow);
    text-align: center;
    transition: transform .25s ease, box-shadow .25s ease;
}

.contact-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 30px 55px rgba(60, 63, 71, 0.14);
}

/* Labels */
.contact-label {
    display: inline-block;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    margin-bottom: 12px;
    opacity: 0.85;
}

/* Email text */
.contact-email {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
    margin: 0;
}

/* Color themes */
.contact-card.personal .contact-label {
    color: var(--accent);
}

.contact-card.academic .contact-label {
    color: #b85c00;
}

/* SKILLS SECTION */
.skills-section {
    max-width: 900px;
    margin: 80px auto;
    padding: 0 24px;
}

.skills-section h2 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 32px;
    letter-spacing: -0.01em;
    color: var(--text);
    text-align: center;
}

.skills-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(var(--card-blur));
    padding: 28px;
    border-radius: 16px;
    box-shadow: var(--shadow);
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
    transition: transform .25s ease, box-shadow .25s ease;
}

.skills-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 30px 55px rgba(60, 63, 71, 0.14);
}

.skills-label {
    display: inline-block;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    margin-bottom: 20px;
    opacity: 0.85;
    color: var(--accent);
}

.skills-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.skill-tag {
    background: rgba(46, 110, 181, 0.12);
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--muted);
}

.mobile-menu.open {
    display: flex;
}

.menu-icon {
    width: 24px;
    height: 24px;
}





/* -------------------------------------------------
   MOBILE RESPONSIVE
--------------------------------------------------*/
@media (max-width: 600px) {

    header {
        padding: 16px 24px;
        z-index: 1000;
        position: sticky;
    }

    .menu-toggle {
        display: block;
        z-index: 2000;
    }

    .header-actions {
        display: none;
    }


    .hero {
        display: grid;    
        place-items: center;
        min-height: calc(100vh - 80px);
        padding: 0 16px;
        text-align: center;
    }

    .hero-content {
        max-width: 100%;
        text-align: center;
        animation: heroFadeIn 1s ease-out both;
    }

    .hero h1 {
        font-size: x-large;
    }

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

    .footer-socials .social-link {
        width: 80px;  
        padding: 8px 0;  
        font-size: 0.8rem;
    }

    .theme-toggle {
        font-family: "Segoe UI Symbol", "Arial Unicode MS", "Noto Sans Symbols", sans-serif;
        /* font-variant-emoji: text; */
        color: var(--text);
        background: none;
        border: none;
        outline: none;
        padding: 0;
        margin: 0;
        font-size: 1.5rem;
        cursor: pointer;
        z-index: 999;
        
    }

    .sun-icon {
        width: 1.25rem;
        height: 1.25rem;
        fill: var(--text);
    }


    /* Visa mobil-knappen */
    .mobile-theme-toggle {
        display: inline-block;
        font-size: 1.6rem;
        margin-right: 12px;
    }

    /* Dölj desktop-knappen */
    .desktop-theme-toggle {
        display: none;
        font-size: 1.6rem;
        margin-right: 12px;
    }

    .banner {
        position: relative;
        width: 100%;
        height: 250px;
        overflow: hidden;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .banner-image {
        width: 100%;
        height: 100%;
        object-fit: cover;
        object-position: center;
        display: block;
    }

    .banner-text {
        max-width: 320px;
        padding: 0 16px;
        text-align: justify;
        text-align-last: center;
    }

    .back-button {
        background: none;
        border: none;
        padding: 6px;
        cursor: pointer;
        color: var(--text);
        display: flex;
        align-items: center;
        justify-content: center;
        transition: opacity .2s ease;
    }

    .back-button:hover {
        opacity: 0.7;
    }

    .back-button:focus,
    .back-button:focus-visible {
        outline: none;
    }

    .back-icon {
        width: 26px;
        height: 26px;
    }


}

/* -------------------------------------------------
   ANIMATIONS
--------------------------------------------------*/
@keyframes heroFadeIn {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes arrowBounce {
    0% { transform: translateY(0); opacity: 0.5; }
    50% { transform: translateY(16px); opacity: 1; }
    100% { transform: translateY(0); opacity: 0.5; }
}

@keyframes arrowColorShift {
    0%   { color: rgba(255, 120, 120, 0.8); }  /* mjuk röd */
    33%  { color: rgba(120, 255, 120, 0.8); }  /* mjuk grön */
    66%  { color: rgba(120, 120, 255, 0.8); }  /* mjuk blå */
    100% { color: rgba(255, 120, 120, 0.8); }
}

