/* ============================================================
   TYYLI.CSS – Vanhat hyvät niksit
   ============================================================ */

/* ---------- PERUSASETUKSET ---------- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Roboto, system-ui, sans-serif;
    background-color: #fcfcf9;
    color: #2a2a2a;
    line-height: 1.7;
    font-weight: 400;
    -webkit-font-smoothing: antialiased;
}

a {
    text-decoration: none;
    color: inherit;
}

.container {
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* ---------- HEADER – korjattu linjaus ---------- */
header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;          /* <-- linjaa logon ja linkit samalle korkeudelle */
    justify-content: space-between;
    padding: 1.2rem 2rem;
    background: rgba(252, 252, 249, 0.92);
    backdrop-filter: blur(8px);
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    gap: 0.8rem 1.5rem;
}

.logo {
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    white-space: nowrap;
}
.logo span {
    font-weight: 300;
    color: #3d6b4f;
}

/* Navigaatio – tasavälinen, siisti rivi */
nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 1.2rem;           /* <-- tasaväli, rivittyy siististi */
    flex: 1 1 auto;
    justify-content: center;
}

nav a {
    font-weight: 500;
    color: #3d3d3d;
    transition: color 0.2s;
    font-size: 0.95rem;
    white-space: nowrap;
}
nav a:hover {
    color: #E67E22;
}
nav a.aktiivinen {
    border-bottom: 3px solid #3d6b4f;
    padding-bottom: 4px;
}

/* ---------- KIELIVALINTA DROPDOWN (korjattu) ---------- */
.lang-switch {
    position: relative;
    display: inline-block;
    margin-left: 0.5rem;
}

.dropbtn {
    background: none;
    border: none;
    font-size: 0.85rem;
    color: #3a3a3a;
    cursor: pointer;
    font-family: inherit;
    letter-spacing: 0.06em;
    padding: 6px 10px;
    border-radius: 4px;
    transition: background 0.2s;
    white-space: nowrap;
}
.dropbtn:hover {
    background: #f0ede5;
}

.dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    background: #ffffff;
    min-width: 150px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
    border-radius: 8px;
    padding: 8px 0;
    z-index: 100;
    border: 1px solid #ece9e0;
}

.dropdown-content a {
    display: block;
    padding: 8px 20px;
    color: #3a3a3a;
    text-decoration: none;
    font-size: 0.85rem;
    border-bottom: none !important;
    transition: background 0.15s;
}
.dropdown-content a:hover {
    background: #f4f1ea;
}
.dropdown-content a.active {
    background: #f0ede5;
    font-weight: 500;
    color: #1a1a1a;
}

/* Näytetään dropdown hoverilla */
.lang-switch:hover .dropdown-content {
    display: block;
}
.lang-switch:hover .dropbtn {
    opacity: 0.8;
}

/* ---------- HERO (DIAESITYS) ---------- */
.hero {
    position: relative;
    padding: 6rem 2rem 5rem;
    text-align: center;
    color: #fff;
    overflow: hidden;
    min-height: 400px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.hero-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}
.hero-bg img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 1.5s ease-in-out;
    position: absolute;
    top: 0;
    left: 0;
}
.hero-bg img.active {
    opacity: 1;
}

.hero h1,
.hero .sub-hero,
.hero p,
.hero .btn {
    position: relative;
    z-index: 1;
}

.hero h1 {
    font-size: 4rem;
    font-weight: 300;
    letter-spacing: -1px;
    margin-bottom: 0.3rem;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.7);
}
.hero .sub-hero {
    font-size: 1.8rem;
    font-weight: 600;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.7);
    margin-bottom: 1rem;
}
.hero p {
    font-size: 1.3rem;
    max-width: 700px;
    margin: 0 auto 2rem;
    opacity: 0.95;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8);
}

.hero .btn {
    background: #E67E22;
    color: #fff;
    padding: 1rem 3rem;
    border-radius: 50px;
    font-weight: 600;
    font-size: 1.1rem;
    border: none;
    cursor: pointer;
    transition: background 0.25s, transform 0.15s;
}
.hero .btn:hover {
    background: #d35400;
    transform: translateY(-2px);
}

/* ---------- KORTIT – tasakorkeus ja siisti asettelu ---------- */
.kortit {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.8rem;
    padding: 3rem 2rem;
}

.kortti {
    background: #fff;
    border-radius: 20px;
    padding: 1.8rem 1.2rem;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.04);
    transition: transform 0.25s, box-shadow 0.3s;
    border: 1px solid rgba(0, 0, 0, 0.04);
    text-align: center;
    display: flex;
    flex-direction: column;
    height: 100%;                 /* <-- pakottaa saman korkeuden */
    word-break: break-word;       /* <-- estää tekstin ulosvuodon */
}

.kortti:hover {
    transform: translateY(-4px);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.08);
}

.kortti .ikoni {
    font-size: 2.4rem;
    margin-bottom: 0.6rem;
    display: block;
}

.kortti h3 {
    font-size: 1.2rem;            /* hieman pienempi, mahtuu paremmin */
    margin-bottom: 0.6rem;
    color: #1a1a1a;
    line-height: 1.3;
}

.kortti p {
    color: #555;
    font-size: 0.95rem;
    flex: 1;                      /* vie ylimääräisen tilan, tasaa korkeutta */
    margin-bottom: 0.8rem;
}

.kortti .linkki {
    display: inline-block;
    font-weight: 600;
    transition: color 0.2s, border-color 0.2s;
    border-bottom: 2px solid transparent;
    margin-top: 0.3rem;
    align-self: center;
}
.kortti .linkki:hover {
    border-bottom-color: #3d6b4f;
}

/* ---------- ALALINNAT (FOOTER) ---------- */
.ala-linkit {
    text-align: center;
    padding: 2.5rem 2rem 2rem;
    border-top: 1px solid #e0d6c8;
    margin-top: 2rem;
}
.ala-linkit a {
    display: inline-block;
    margin: 0 0.8rem;
    font-weight: 500;
    color: #4a4a4a;
    transition: color 0.2s;
    font-size: 0.95rem;
}
.ala-linkit a:hover {
    color: #E67E22;
}

/* ---------- RESPONSIIVISUUS ---------- */
@media (max-width: 820px) {
    header {
        flex-direction: column;
        align-items: center;
        gap: 0.8rem;
        padding: 1rem;
    }
    nav {
        justify-content: center;
        gap: 0.4rem 1rem;
    }
    .lang-switch {
        margin-left: 0;
    }
    .hero h1 {
        font-size: 2.8rem;
    }
    .hero .sub-hero {
        font-size: 1.5rem;
    }
    .hero p {
        font-size: 1.1rem;
    }
    .kortit {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 1.2rem;
        padding: 2rem 1rem;
    }
    .kortti {
        padding: 1.2rem 0.8rem;
    }
    .kortti h3 {
        font-size: 1rem;
    }
    .kortti p {
        font-size: 0.85rem;
    }
    .ala-linkit a {
        margin: 0 0.5rem;
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    .hero h1 {
        font-size: 2rem;
    }
    .hero .sub-hero {
        font-size: 1.2rem;
    }
    .hero p {
        font-size: 1rem;
    }
    .kortit {
        grid-template-columns: 1fr 1fr;
        gap: 0.8rem;
        padding: 1.5rem 0.8rem;
    }
    .kortti {
        padding: 1rem 0.6rem;
    }
    .kortti h3 {
        font-size: 0.9rem;
    }
    .kortti p {
        font-size: 0.8rem;
    }
    nav a {
        font-size: 0.8rem;
    }
    .dropbtn {
        font-size: 0.75rem;
        padding: 4px 6px;
    }
    .dropdown-content a {
        font-size: 0.75rem;
        padding: 6px 12px;
    }
    .ala-linkit a {
        margin: 0 0.3rem;
        font-size: 0.75rem;
    }
}

/* ---------- KUVAT ESILATAUKSEEN (piilossa) ---------- */
.preload-images {
    position: absolute;
    left: -9999px;
    top: -9999px;
    width: 0;
    height: 0;
    overflow: hidden;
    pointer-events: none;
}
.preload-images img {
    display: block;
    width: 0;
    height: 0;
}

/* ============================================================
   EVÄSTEBANNERI
   ============================================================ */

.cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #1a1a1a;
    color: #f0f0f0;
    padding: 1rem 2rem;
    z-index: 9999;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.2);
    font-size: 0.95rem;
    line-height: 1.5;
    border-top: 4px solid #3d6b4f; /* Sama vihreä kuin muissa korostuksissa */
    transform: translateY(0);
    transition: transform 0.4s ease;
    display: none; /* Piilotetaan oletuksena, JavaScript näyttää tarvittaessa */
}

.cookie-banner.hidden {
    transform: translateY(100%);
    pointer-events: none;
}

.cookie-banner-content {
    max-width: 1120px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.cookie-banner p {
    margin: 0;
    flex: 1 1 300px;
}

.cookie-banner a {
    color: #FFD700;
    text-decoration: underline;
}

.cookie-banner-buttons {
    display: flex;
    gap: 0.8rem;
    flex-wrap: wrap;
}

.btn-cookie {
    background: #3d6b4f;
    color: #fff;
    border: none;
    border-radius: 30px;
    padding: 0.6rem 1.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
    font-family: inherit;
    font-size: 0.95rem;
    white-space: nowrap;
}

.btn-cookie:hover {
    background: #2a5238;
    transform: translateY(-2px);
}

.btn-cookie-secondary {
    background: transparent;
    border: 2px solid #777;
    color: #ccc;
}

.btn-cookie-secondary:hover {
    background: rgba(255,255,255,0.05);
    border-color: #aaa;
    color: #fff;
}

/* Responsiivisuus */
@media (max-width: 600px) {
    .cookie-banner {
        padding: 1rem;
    }
    .cookie-banner-content {
        flex-direction: column;
        text-align: center;
    }
    .cookie-banner-buttons {
        width: 100%;
        justify-content: center;
    }
    .btn-cookie {
        flex: 1;
        text-align: center;
        padding: 0.6rem 1rem;
    }
}

/* ============================================================
   ARTIKKELIEN TYYLIT – VÄLJEMPI RYTMI JA HIMMEÄMMÄT LÄHTEET
   ============================================================ */

/* ---------- H2-otsikoiden väljempi rytmi ---------- */
h2 {
    font-size: 1.6rem;
    font-weight: 500;
    color: #1a1a1a;
    margin-top: 3.2rem;        /* reilummin tilaa yläpuolelle */
    margin-bottom: 1rem;        /* hieman tilaa alapuolelle */
    line-height: 1.3;
    letter-spacing: -0.01em;
}

/* Ensimmäinen H2 ei tarvitse niin suurta yläväliä */
.container > h2:first-of-type {
    margin-top: 1.8rem;
}

/* H3-otsikot (esim. "Yhteenveto", "Lähteet") */
h3 {
    font-size: 1.25rem;
    font-weight: 500;
    color: #1a1a1a;
    margin-top: 2.4rem;
    margin-bottom: 0.7rem;
    line-height: 1.35;
}

/* Kappaleiden väliin hieman lisää ilmavuutta */
.container p {
    margin-bottom: 1.1rem;
}

/* ---------- LÄHDEMERKINNÄT – HIMMEÄMMÄT KUIN LEIPÄTEKSTI ---------- */
.lahde-merkinta {
    font-weight: 400;           /* ei lihavointia */
    color: #999;                /* huomattavasti himmeämpi harmaa */
    font-size: 0.88em;          /* hieman pienempi */
    letter-spacing: 0;
}