/* PERUSASETUKSET & MUUTTUJAT */
:root {
    /* Vaalean teeman värit (oletus) */
    --bg-color: #f9f9f9;
    --text-color: #333;
    --card-bg: #ffffff;
    --border-color: #ddd;
    --footer-bg: #36454f;
    --footer-text: #ccc;
    --navbar-bg: #005EB8;
    --bottom-section-bg: #e9eff5; /* UUSI: Pehmeä tausta vaaleaan teemaan */
}

@media (prefers-color-scheme: dark) {
    :root {
        /* Tumman teeman värit */
        --bg-color: #121212;
        --text-color: #e0e0e0;
        --card-bg: #1e1e1e;
        --border-color: #333;
        --navbar-bg: #005EB8;
        --bottom-section-bg: #141b26; /* UUSI: Pehmeä tausta tummaan teemaan */
    }
}

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

html {
    overflow-y: scroll;
}

body { 
    font-family: 'Fira Sans', sans-serif !important;
    background-color: var(--bg-color); 
    display: flex; 
    flex-direction: column; 
    min-height: 100vh;
    color: var(--text-color);
    transition: background-color 0.3s ease, color 0.3s ease;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Fira Sans', sans-serif !important;
}

a { 
    text-decoration: none; 
    color: inherit; 
}

.container { 
    max-width: 1200px; 
    margin: 0 auto; 
    padding: 0 20px; 
    width: 100%;
}

.content-wrapper { 
    flex: 1; 
    padding-top: 30px; 
    padding-bottom: 50px; 
}

/* YLÄPALKKI (NAVBAR) */
.navbar { 
    background-color: var(--navbar-bg); 
    height: 75px; 
    position: sticky; 
    top: 0; 
    z-index: 1000;
    transition: background-color 0.3s ease;
}

.nav-container { 
    max-width: 1200px; 
    margin: 0 auto; 
    height: 100%; 
    display: flex; 
    align-items: center; 
    padding: 0 20px;
    position: relative;
}

.nav-logo { 
    max-height: 55px; 
    width: auto; 
    display: block; 
}

.nav-center-right { 
    display: flex; 
    align-items: center; 
    margin-left: auto; 
    width: 60%;
    justify-content: flex-end;
}

.nav-links { 
    display: flex; 
    gap: 40px; 
    margin-right: 40px;
    align-items: center;
}

.nav-links a { 
    color: white; 
    font-weight: 400; 
    font-size: 1rem; 
}

/* FACEBOOK LOGO */
.facebook-nav-icon {
    width: 45px;
    height: 45px;
    object-fit: contain;
    display: block;
}

/* Desktop-facebook näkyviin */
.facebook-desktop-link {
    display: flex;
    align-items: center;
}

/* Mobiililogo piilossa desktopissa */
.facebook-mobile-link {
    display: none;
}

#search-input { 
    padding: 8px 15px; 
    border-radius: 20px; 
    border: none; 
    outline: none;
    width: 180px;
    background-color: rgba(255, 255, 255, 0.9);
}

/* ETUSIVU LAYOUT */
#front-page-layout { 
    display: grid; 
    grid-template-columns: 2fr 1fr; 
    gap: 30px; 
    margin-top: 20px;
}

/* Kuvasäiliö */
.img-container-32 { 
    width: 100%; 
    aspect-ratio: 4/3; 
    overflow: hidden; 
}

.img-container-32 img { 
    width: 100%; 
    height: 100%; 
    object-fit: cover; 
}

/* ITSE KORTTI / KEHYS */
.main-article-card {
    background-color: var(--card-bg);
    border-radius: 6px; 
    overflow: hidden; 
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04); 
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.main-article-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}

.main-article-content {
    padding: 25px; 
}

.main-article-card h2 { 
    margin-bottom: 12px; 
    line-height: 1.2; 
    cursor: pointer; 
    font-size: 1.8rem; 
    color: var(--text-color);
    transition: color 0.2s ease;
}

.main-article-date {
    display: block;
    font-size: 0.85rem;
    opacity: 0.6;
    margin-bottom: 8px;
    font-style: italic;
}

.main-article-card:hover h2, .side-card:hover h4, .archive-item:hover .archive-text h2 {
    color: var(--navbar-bg);
}

.main-article-card p { 
    line-height: 1.5; 
    opacity: 0.85; 
    font-size: 1.05rem;
}

/* Sivupalkin ruudukko */
.side-grid {
    display: grid;
    grid-template-columns: 1fr; 
    gap: 20px; 
    align-content: start;
}

.side-card {
    display: flex;
    flex-direction: column;
    background-color: var(--card-bg);
    border-radius: 6px; 
    overflow: hidden; 
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03); 
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.side-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.07);
}

.side-card img {
    width: 100%;
    aspect-ratio: 3/2;
    object-fit: cover;
    margin-bottom: 0; 
}

.side-card-content {
    padding: 12px; 
    display: flex;
    flex-direction: column;
    flex: 1;
}

.side-card h4 {
    font-size: 1.2rem;
    font-weight: 700;
    line-height: 1.3;
    color: var(--text-color);
    transition: color 0.2s ease;
}

.side-card-date {
    display: block;
    font-size: 0.75rem;
    opacity: 0.6;
    margin-bottom: 4px;
    font-style: italic;
}

/* UUSI ARKITOLISTAUS */
.page-title {
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 5px;
}

.page-subtitle {
    font-size: 1rem;
    opacity: 0.7;
    margin-bottom: 40px;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 15px;
}

.archive-list {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.archive-item {
    background-color: var(--card-bg);
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.archive-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.archive-link {
    display: flex;
    gap: 20px;
}

.archive-img-wrapper {
    width: 200px;
    min-width: 200px;
    aspect-ratio: 3/2;
    overflow: hidden;
}

.archive-img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.archive-text {
    padding: 15px 20px 15px 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.archive-date {
    font-size: 0.8rem;
    font-style: italic;
    opacity: 0.7;
    margin-bottom: 5px;
}

.archive-text h2 {
    font-size: 1.3rem;
    margin-bottom: 8px;
    line-height: 1.3;
    color: var(--text-color);
    transition: color 0.2s ease;
}

.archive-text p {
    font-size: 0.95rem;
    line-height: 1.4;
    opacity: 0.85;
}

/* AVATTU UUTINEN */
.article-page-layout { 
    display: grid; 
    grid-template-columns: 3fr 1fr; 
    gap: 40px; 
    margin-top: 20px;
}

.article-hero-img { 
    width: 100%; 
    max-width: 100%; 
    height: auto; 
    margin-bottom: 25px; 
    display: block; 
}

.full-article h1 { 
    font-size: 1.8rem; 
    margin-bottom: 20px; 
    line-height: 1.3; 
}

.article-ingress { 
    font-weight: 700; 
    margin-bottom: 1.5rem; 
    line-height: 1.4; 
}

/* UUTISEN META */
.article-meta {
    font-size: 0.75rem;
    font-weight: 300;
    color: #a0b0b0;
    margin-top: 12px;
    line-height: 1.7;
    margin-bottom: 15px;
}

.article-meta div {
    display: block;
}

.article-meta-divider {
    width: 60px;
    height: 1px;
    background-color: #005EB8;
    margin-top: 12px;
}

.article-body-spacing {
    height: 28px;
}

.article-body p { 
    margin-bottom: 1.2rem; 
    line-height: 1.4; 
}

.article-author { 
    font-style: italic; 
    font-weight: bold; 
    font-size: 0.85rem; 
    margin-top: 20px; 
}

.share-box { 
    margin-top: 1.5rem; 
}

.share-box p { 
    font-size: 0.9rem; 
    font-weight: bold; 
    margin-bottom: 8px; 
}

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

.share-links img { 
    width: 45px; 
    height: 45px; 
    cursor: pointer; 
    filter: grayscale(0.2);
}

.divider { 
    border-bottom: 1px solid #005EB8;
    width: 60px; 
    margin-top: 15px; 
}

.share-box .divider {
    margin-bottom: 15px;
}

.main-article-ingress { 
    font-size: 1.15rem;     
    font-weight: 500;       
    line-height: 1.5;       
    opacity: 0.9;           
    color: var(--text-color);
}

/* SIVUPALKKI ARTIKKELISIVULLA */
.sidebar-main-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 15px;
    text-transform: uppercase;
}

.sidebar-item { 
    padding: 12px 0; 
    border-bottom: 1px solid var(--border-color); 
    cursor: pointer; 
}

.sidebar-item p { 
    font-size: 0.9rem; 
    font-weight: 400; 
    line-height: 1.4; 
}

/* ALAPALKKI */
.footer { 
    background-color: var(--footer-bg); 
    color: var(--footer-text); 
    padding: 40px 0; 
    margin-top: auto; 
}

.footer-container { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    max-width: 1200px; 
    margin: 0 auto; 
    padding: 0 20px; 
}

.footer-logo { 
    height: 50px; 
}

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

.footer-main-text { 
    font-size: 1.1rem; 
    font-weight: 600; 
    color: #fff; 
    margin-bottom: 1px; 
}

.footer-sub-text { 
    font-size: 0.75rem; 
    opacity: 0.7; 
}

.footer-contact {
    text-align: right;
    line-height: 1.2;
}

/* Ylempi otsikkorivi */
.footer-contact .email-title {
    font-weight: 500;
    font-size: 1.0rem;
    color: #fff;
    margin: 0;
}

/* Sähköpostirivi kaikille laitteille */
.footer-contact .email-text {
    margin: 0;
    padding: 0;
    display: block;
}

/* 💡 TÄMÄ MUUTETTIIN: Sähköposti siirtyy vasemmalle VAIN tietokoneen ruudulla */
@media (min-width: 769px) {
    .footer-contact .email-text {
        position: relative;
        right: 4px; 
    }
}

/* Sähköpostilinkin ulkoasu */
.footer-contact .email-text a {
    color: var(--footer-text);
    text-decoration: none;
    font-size: 0.85rem;
}

/* MOBIILINÄKYMÄ */
.hamburger { 
    display: none; 
    background: none; 
    border: none; 
    flex-direction: column; 
    gap: 5px; 
    cursor: pointer; 
}

.hamburger span { 
    width: 25px; 
    height: 3px; 
    background-color: white; 
}

/* ==========================================================================
   UUSITTU TEEMAOSIO & ETUSIVUN ALAPUOLEN YHTEINEN POHJAVÄRI-ALUE
   ========================================================================== */

/* Koko ruudun levyinen pehmeä taustalaatikko alaosioille */
.front-page-bottom-section {
    background-color: var(--bottom-section-bg);
    border-top: 1px solid var(--border-color);
    padding-top: 50px;
    padding-bottom: 60px;
    margin-top: 40px;
    width: 100%;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

/* Yksittäiset osiot laatikon sisällä */
.theme-section {
    margin-top: 0;
    margin-bottom: 50px;
    border-top: none; 
    padding-top: 0;
}

/* Poistetaan marginaali viimeiseltä osiolta, jotta alapalkki asettuu kauniisti */
.theme-section:last-of-type {
    margin-bottom: 0;
}

.theme-section-title {
    font-size: 1.5rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 25px;
    color: var(--text-color);
}

/* 3 sarakkeen ruudukko työpöydällä */
.theme-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr); 
    gap: 25px;
}

/* 💡 TÄMÄ MUUTETTIIN: Teemakorteilta poistettu ohut kehys ja lisätty ilmavuutta */
.theme-card {
    background-color: var(--card-bg);
    /* border poistettu kokonaan */
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.03); /* Hieman pehmeämpi ja syvempi varjo ilman kehystä */
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
}

.theme-card:hover {
    transform: translateY(-4px); 
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.theme-card:hover h4 {
    color: var(--navbar-bg);
}

.theme-img-wrapper {
    width: 100%;
    aspect-ratio: 16/9; 
    overflow: hidden;
}

.theme-img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.theme-card-content {
    padding: 18px; 
    display: flex;
    flex-direction: column;
    flex: 1;
}

.theme-card-date {
    font-size: 0.75rem;
    opacity: 0.6;
    margin-bottom: 6px;
    font-style: italic;
}

.theme-card h4 {
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.3;
    color: var(--text-color);
    transition: color 0.2s ease;
}

.no-news {
    grid-column: 1 / -1;
    color: #777;
    font-style: italic;
}

/* Hienosäätö Toimituksen valinnat -osiolle */
.choices-section {
    margin-bottom: 50px; 
}

/* ==========================================================================
   RESPONSIVISUUS (MOBIILI)
   ========================================================================== */
@media (max-width: 768px) {
    .hamburger { 
        display: flex; 
        position: absolute; 
        left: 20px; 
    }
    
    .nav-center-right { 
        display: none; 
        position: absolute; 
        top: 75px; 
        left: 0; 
        width: 100%; 
        background: var(--navbar-bg); 
        flex-direction: column; 
        padding: 30px 0;
        align-items: center;
        justify-content: center;
        text-align: center;
    }
    
    .nav-center-right.active { 
        display: flex; 
    }
    
    .nav-links { 
        flex-direction: column; 
        gap: 25px; 
        margin-right: 0; 
        margin-bottom: 30px; 
        width: 100%;
    }

    .nav-links a {
        font-size: 1.2rem;
        display: block;
        width: 100%;
    }

    .search-container {
        width: 100%;
        display: flex;
        justify-content: center;
        padding: 0 20px;
    }

    #search-input { 
        width: 80%; 
        max-width: 300px;
    }
    
    .nav-logo {
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
        top: 15px; 
        height: 40px; 
    }

    .facebook-desktop-link {
        display: none !important;
    }

    .facebook-mobile-link {
        display: block;
        position: absolute;
        right: 20px;
        top: 13px;
        z-index: 1001;
    }

    .facebook-nav-icon {
        width: 50px;
        height: 50px;
    }
    
    #front-page-layout,
    .article-page-layout,
    .archive-link { 
        grid-template-columns: 1fr;
        flex-direction: column;
        gap: 15px;
    }

    .archive-img-wrapper {
        width: 100%;
        min-width: 100%;
    }

    .archive-text {
        padding: 0 15px 15px 15px;
    }

    .side-grid { 
        grid-template-columns: 1fr; 
    }
    
    .footer-container { 
        flex-direction: column; 
        gap: 25px; 
        text-align: center; 
    }

    /* 💡 TÄMÄ MUUTETTIIN: Varmistetaan !important-komennolla täydellinen keskitys mobiilissa */
    .footer-contact { 
        text-align: center !important; 
    }

    /* Alaosioiden taustalaatikon pehmusteet mobiilissa */
    .front-page-bottom-section {
        padding-top: 40px;
        padding-bottom: 40px;
        margin-top: 30px;
    }

    .theme-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
}