/* --- 1. MUUTTUJAT JA TEEMAT --- */
:root {
    /* --- VAALEA TILA (OLETUS) --- */
    --bg: #e5e7eb;
    --card: #ffffff;
    --text: #111827;
    --text-muted: #4b5563;
    
    /* Viininpunainen korostus */
    --accent: #800020; 
    --accent-hover: #5a0016;
    --accent-text: #ffffff; /* Teksti napin päällä */

    /* Elementit */
    --glass: rgba(255, 255, 255, 0.95);
    --border: rgba(0, 0, 0, 0.1);
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    --tag-bg: #f3f4f6;

    /* Asettelu */
    --max-width: 1000px;
}

/* --- TUMMA TILA (Automaattinen päivitys) --- */
body.dark-mode {
    --bg: #121212;
    --card: #1e1e1e;
    --text: #e0e0e0;
    --text-muted: #a0a0a0;

    /* PYYDETTY: Tummempi viininpunainen tummassa tilassa */
    --accent: #500014; 
    /* Hoverissa hieman kirkkaampi tummassa tilassa, jotta käyttäjä huomaa sen */
    --accent-hover: #6e001c; 

    /* Elementit tummassa tilassa */
    --glass: rgba(30, 30, 30, 0.95); /* Tumma lasi */
    --border: rgba(255, 255, 255, 0.1); /* Vaalea reunus erottuvuuteen */
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    --tag-bg: #2d2d2d;
}

/* --- 2. PERUSASETUKSET (RESET) --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg);
    color: var(--text);
    font-family: 'Inter', system-ui, sans-serif;
    line-height: 1.5;
    /* Sujuva animaatio värinvaihdossa */
    transition: background-color 0.3s ease, color 0.3s ease;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--text);
}

p {
    color: var(--text);
}

a {
    text-decoration: none;
    color: inherit;
}

/* --- 3. NAVIGAATIO --- */
.navbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: var(--glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    height: 70px;
    display: flex;
    align-items: center;
    transition: background 0.3s ease, border-color 0.3s ease;
}

.nav-container {
    max-width: var(--max-width);
    width: 100%;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
}

.nav-links {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 15px;
}

.nav-links a {
    color: var(--text-muted);
    font-weight: 600;
    font-size: 14px;
    transition: 0.2s;
}

.nav-links a:hover {
    color: var(--accent);
}

.nav-cta {
    background: var(--accent);
    color: var(--accent-text) !important;
    padding: 8px 15px;
    border-radius: 8px;
    transition: background 0.2s ease;
}

.nav-cta:hover {
    background: var(--accent-hover);
}

/* --- 4. DROPDOWN --- */
.dropdown {
    position: relative;
    padding: 10px 0;
}

.dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--card);
    min-width: 160px;
    border-radius: 10px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    overflow: hidden;
    z-index: 1001;
}

.dropdown:hover .dropdown-content,
.dropdown.open .dropdown-content {
    display: block;
}

.dropdown-content a {
    padding: 12px 16px;
    display: block;
    color: var(--text-muted);
}

.dropdown-content a:hover {
    background: var(--bg); /* Käyttää taustaväriä hoverissa */
    color: var(--accent);
}

/* --- 5. RAKENNE & KORTIT --- */
.container {
    max-width: var(--max-width);
    margin: 20px auto;
    padding: 0 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.card {
    background: var(--card);
    color: var(--text);
    padding: 24px;
    border-radius: 16px;
    box-shadow: var(--shadow);
    border: 1px solid transparent; /* Valmius reunukselle */
    /* Tärkeä tummassa tilassa erottuvuuden vuoksi: */
    transition: background-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease; 
}

/* Tumman tilan hienosäätö korteille */
body.dark-mode .card {
    border: 1px solid var(--border);
}

/* Profiili */
.profile {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--bg);
}

/* Sivupalkki ja Pääsisältö */
aside, main {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Taidot ja Tagit */
.skill-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.bar {
    background: var(--tag-bg);
    height: 8px;
    border-radius: 10px;
    overflow: hidden;
}

.bar i {
    display: block;
    height: 100%;
    background: var(--accent);
}

.tag {
    display: inline-block;
    background: var(--tag-bg);
    color: var(--text);
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    margin: 2px;
    border: 1px solid var(--border);
}

/* Footer */
footer {
    text-align: center;
    padding: 40px 0;
    color: var(--text-muted);
    font-size: 13px;
    width: 100%;
}

/* --- 6. PROJEKTISIVU --- */
.projects-layout {
    display: flex !important;
    flex-direction: column !important;
    max-width: 900px;
    margin: 0 auto;
}

.project-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    width: 100%;
}

.project-card {
    background: var(--card);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    text-align: center;
    min-height: 180px;
    padding: 24px;
    border-radius: 16px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.project-card:hover {
    transform: translateY(-5px);
    border-color: var(--accent);
}

.tech-stack {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
    margin: 15px 0;
}

.tech-tag {
    background: var(--tag-bg);
    color: var(--text);
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 0.9em;
    font-weight: bold;
}

.status-badge {
    display: inline-block;
    background: #4caf50; /* Vihreä on ok pitää kiinteänä tai muuttaa muuttujaksi */
    color: white;
    padding: 5px 15px;
    border-radius: 5px;
    margin-bottom: 20px;
}

.project-btn {
    display: inline-block;
    background: var(--accent);
    color: var(--accent-text) !important;
    padding: 10px 20px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    margin-top: 15px;
    transition: background 0.2s ease, transform 0.1s ease;
    align-self: center;
}

.project-btn:hover {
    background: var(--accent-hover);
    transform: scale(1.05);
}

/* Teeman vaihtopainike */
.theme-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 8px;
    color: var(--text);
    display: flex;
    align-items: center;
    border-radius: 50%;
    transition: transform 0.2s ease, background 0.2s ease;
}

.theme-btn:hover {
    background: var(--tag-bg);
}

.theme-btn:active {
    transform: scale(0.9);
}

/* --- 7. MEDIATIEDUSTELUT (RESPONSIIVISUUS) --- */

/* Mobiili (alle 768px) */
@media screen and (max-width: 768px) {
    .project-grid {
        grid-template-columns: 1fr;
    }
}

/* Tietokone (yli 881px) */
@media screen and (min-width: 881px) {
    .container {
        display: grid;
        grid-template-columns: 320px 1fr;
        grid-template-areas: 
            "header header"
            "aside main"
            "footer footer";
        gap: 24px;
        margin: 40px auto;
    }

    header.card {
        grid-area: header;
        text-align: left;
    }

    .profile {
        flex-direction: row;
    }

    aside { grid-area: aside; }
    main { grid-area: main; }
    footer { grid-area: footer; }

    .nav-links {
        gap: 2rem;
    }
}