:root {
    /* Väripaletti */
    --bg-gradient-top: #c2e9fb; 
    --bg-gradient-bottom: #a1c4fd;
    --primary-green: #00bf63; 
    --primary-green-dark: #009e52;
    --text-dark: #2c3e50;
    --text-body: #4a5568;
    --card-bg: #ffffff;
    
    /* Fontit */
    --font-heading: 'Fredoka', sans-serif;
    --font-body: 'Roboto', sans-serif;
    
    /* Muotoilu */
    --radius: 20px;
    --shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
}

body {
    font-family: var(--font-body);
    background: linear-gradient(to bottom, var(--bg-gradient-top) 0%, var(--bg-gradient-bottom) 100%);
    background-attachment: fixed;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    color: var(--text-body);
    line-height: 1.6;
    overflow-x: hidden;
}

/* --- PILVIANIMAATIO --- */
.cloud-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    pointer-events: none;
    z-index: -1;
    overflow: hidden;
}

.cloud {
    position: absolute;
    opacity: 0.8;
}

#cloud1 {
    top: clamp(40px, 10vh, 110px);
    left: -350px;
    width: 300px;
}

#cloud2 {
    top: clamp(230px, 36vh, 360px);
    left: -250px;
    width: 200px;
}

.main-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px 60px;
}

/* --- YLÄOSA: HEADER + VIDEO --- */
.top-header-area {
    display: flex;
    justify-content: space-between;
    align-items: flex-end; /* Voit kokeilla myös 'center', jos haluat otsikon ylemmäs suhteessa aurinkoon */
    margin-bottom: -10px;  /* <--- NEGATIIVINEN MARGINAALI: Vetää alempaa laatikkoa ylöspäin */
    flex-wrap: nowrap;
    padding-top: 0;
}

/* HEADER VASEN */
.site-header {
    text-shadow: 0 2px 5px rgba(255,255,255,0.5);
    flex: 1;
    padding-bottom: 30px; /* Hienosäätö pystysuunnassa */
}

.main-title {
    font-family: var(--font-heading);
    color: #1a3b5c;       /* Tekstin väri (tummansininen) */
    font-size: 3.5rem;
    margin: 0;
    padding: 0;
    letter-spacing: 2px;
    line-height: 0.8;     /* Aiemmin säädetty tiivistys */
    padding-left: 10px;

    /* 1. Valkoinen ääriviiva (3px paksu) */
    -webkit-text-stroke: 7px white;
    
    /* 2. Piirtää ääriviivan tekstin alle, jotta kirjain ei ohene */
    paint-order: stroke fill;
}

/* VIDEO OIKEALLA YLHÄÄLLÄ */
.header-video-container {
    width: 300px; 
    flex-shrink: 0;
    display: flex;
    justify-content: flex-end;
    align-items: flex-end;
    
    margin-top: -20px;    /* Nostaa aurinkoa kohti kattoa */
    margin-bottom: -5px; /* Vetää alapuolista sisältöä lähemmäs aurinkoa */    
}

.header-video-container video {
    width: 100%;
    height: auto;
    display: block;
}


/* --- MATALA INFO-PALKKI --- */
.intro-bar {
    display: flex;
    align-items: center; 
    justify-content: space-between;
    gap: 30px;
    padding: 20px 30px; 
    margin-bottom: 30px;
    border-left: 6px solid var(--primary-green);
}

.intro-content {
    flex: 1; 
}

.intro-content p {
    margin: 0;
    font-size: 1.1rem;
    color: #2d3748;
    line-height: 1.5;
}

.intro-action {
    flex-shrink: 0; 
}

/* --- AURINKOTARINAN PAINIKE --- */
.btn-story {
    background: linear-gradient(135deg, #ff9966 0%, #ff5e62 100%);
    color: white;
    font-size: 1rem;
    font-weight: 600;
    padding: 12px 20px;
    box-shadow: 0 4px 15px rgba(255, 94, 98, 0.3);
    border: 2px solid white;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.2s;
    
    /* KIINTEÄ LEVEYS JA KESKITYS */
    width: 420px; 
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    white-space: nowrap;
}

.btn-story:hover {
    background: linear-gradient(135deg, #ffb38a 0%, #ff787c 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 94, 98, 0.4);
}


/* --- YLEINEN KORTTITYYLI --- */
.card {
    background-color: var(--card-bg);
    border-radius: var(--radius);
    padding: 30px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(255,255,255,0.6);
}

.card h3 {
    font-family: var(--font-heading);
    font-size: 1.6rem;
    color: var(--text-dark);
    /* Oletusmarginaalit, jotka ylikirjoitetaan title-row:ssa */
    margin-top: 10px;
    margin-bottom: 15px;
}

/* --- KOLME SARAKETTA --- */
.three-columns {
    display: flex;
    gap: 25px;
    align-items: stretch;
}

.col-box {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.card-icon {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

/* --- UUSI: Otsikon ja ikonin asettelu vierekkäin --- */
.title-row {
    display: flex;
    align-items: center;
    gap: 15px; /* Väli ikonin ja tekstin välillä */
    margin-bottom: 0px; /* Väli alapuoliseen tekstikappaleeseen */
}

.title-row .card-icon {
    margin-bottom: 0; /* Poistetaan alaväli, jotta asettuu tasan */
    line-height: 1;   /* Tiivistää ikonin pystysuunnassa */
}

.title-row h3 {
    margin-top: 0;
    margin-bottom: 0;
}


/* --- MATERIAALILISTA --- */
.mat-item {
    display: block;
    background-color: #f7fafc;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 12px;
    border-left: 4px solid #cbd5e0;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s;
}

.mat-item:hover {
    border-left-color: var(--primary-green);
    background-color: #f0fff4;
    transform: translateX(3px);
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

.mat-item strong {
    display: block;
    color: var(--text-dark);
    font-family: var(--font-heading);
    font-size: 1.05rem;
    margin-bottom: 3px;
}

.mat-item span {
    font-size: 0.9rem;
    color: #4a5568;
}

/* --- PAINIKKEET YLEISET --- */
.action-area {
    margin-top: -5px;   /* Nappi tulee kiinteän matkan päähän tekstistä */
    padding-top: 0;
	padding-bottom: 5px;
}

.btn {
    border: none;
    padding: 12px 28px;
    border-radius: 50px;
    font-family: var(--font-heading);
    font-weight: 500;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s;
}

.btn-primary {
    background-color: var(--primary-green);
    color: white;
    box-shadow: 0 4px 12px rgba(0, 191, 99, 0.3);
}
.btn-primary:hover {
    background-color: var(--primary-green-dark);
    transform: scale(1.02);
}

.btn-secondary {
    background-color: #e2e8f0;
    color: var(--text-dark);
}
.btn-secondary:hover {
    background-color: #cbd5e0;
}

.clean-list {
    padding-left: 20px;
    margin-bottom: 20px;
}
.note {
    font-size: 0.9rem;
    background: #f0fff4;
    color: #22543d;
    padding: 10px;
    border-radius: 8px;
}

/* --- TUTKIMUSKONEET NAPIT --- */
.machine-links {
    display: flex;
    flex-direction: column;
    gap: 15px;
}
.machine-btn {
    display: block;
    text-decoration: none;
    background-color: #ebf8ff;
    padding: 15px;
    border-radius: 12px;
    border: 2px solid transparent;
    transition: all 0.2s;
}
.machine-btn:hover {
    border-color: #4299e1;
    background-color: white;
    box-shadow: 0 4px 10px rgba(66, 153, 225, 0.15);
}
.machine-btn .m-title {
    display: block;
    font-weight: bold;
    color: #2b6cb0;
    font-family: var(--font-heading);
}
.machine-btn .m-desc {
    font-size: 0.9rem;
    color: #4a5568;
}

/* --- TUTKIMUSOSIO --- */
.research-showcase {
    margin-top: 2px;
    padding-top: 15px;
}

.research-showcase-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 20px;
    margin-bottom: 6px;
    padding: 0 4px;
}

.research-showcase-title {
    margin: 0;
    font-family: var(--font-heading);
    font-size: 1.8rem;
    color: #102d4d;
}

#research-count {
    font-size: 1.05rem;
    color: #284a72;
}

.research-status {
    margin: 0;
    font-weight: 500;
    color: #385a80;
    text-align: right;
}

.research-carousel-shell {
    position: relative;
    padding: 14px 52px 10px;
    background: rgba(255, 255, 255, 0.94);
    overflow: hidden;
}

.research-viewport {
    position: relative;
    z-index: 1;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    scroll-snap-type: x proximity;
    scrollbar-width: thin;
    scrollbar-color: rgba(40, 74, 114, 0.35) transparent;
    outline: none;
}

.research-track {
    display: flex;
    align-items: flex-start;
    gap: 30px;
    min-height: 176px;
    padding: 4px 4px 0;
}

.research-card {
    flex: 0 0 140px;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    scroll-snap-align: start;
}

.research-card:hover .research-card-visual,
.research-card:focus-visible .research-card-visual {
    transform: translateY(-4px);
    box-shadow: 0 16px 30px rgba(44, 62, 80, 0.18);
}

.research-card:focus-visible {
    outline: none;
}

.research-card-visual {
    width: 86px;
    height: 122px;
    overflow: visible;
    box-shadow: none;
    background: transparent;
    transition: transform 0.2s ease;
}

.research-card-visual img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
    filter: drop-shadow(0 10px 14px rgba(44, 62, 80, 0.24));
}

.research-card-meta {
    text-align: center;
    line-height: 1.35;
    min-height: 40px;
}

.research-card-place {
    display: block;
    color: var(--text-dark);
    font-weight: 700;
    font-size: 0.95rem;
}

.research-card-date {
    display: block;
    font-size: 0.95rem;
    color: #5c7088;
}

.carousel-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border-radius: 999px;
    border: none;
    background: #1478c9;
    color: white;
    font-size: 1.45rem;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    box-shadow: 0 10px 18px rgba(20, 120, 201, 0.22);
    transition: background-color 0.2s ease, opacity 0.2s ease, transform 0.2s ease;
}

.carousel-arrow:hover {
    background: #0f65aa;
}

.carousel-arrow:disabled {
    cursor: default;
    opacity: 0.35;
}

.carousel-arrow-left {
    left: 8px;
}

.carousel-arrow-right {
    right: 8px;
}

.research-empty {
    width: 100%;
    padding: 28px 12px;
    text-align: center;
    color: #536b83;
    font-weight: 500;
}

/* --- RESPONSIIVISUUS --- */
@media (max-width: 900px) {
    .three-columns {
        flex-direction: column;
    }
    
    .top-header-area {
        flex-direction: column;
        align-items: center; /* Keskittää mobiilissa */
        text-align: center;
    }
    
    .site-header {
        margin-bottom: 10px;
        padding-bottom: 0;
        width: 100%;
        text-align: center;
    }
    .main-title {
        padding-left: 0;
    }
    
    .header-video-container {
        width: 100%;
        max-width: 300px;
        justify-content: center;
        margin-bottom: 10px;
    }

    .intro-bar {
        flex-direction: column;
        text-align: center;
    }
    
    .intro-action {
        width: 100%;
        display: flex;
        justify-content: center;
    }
    
    /* Mobiilissa napin leveys joustavammaksi */
    .btn-story {
        width: 100%;
        max-width: 420px;
        white-space: normal;
    }

    .research-showcase-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .research-status {
        text-align: left;
    }
}

@media (max-width: 680px) {
    .research-carousel-shell {
        padding: 18px 44px;
    }

    .research-track {
        gap: 20px;
    }

    .research-card {
        flex-basis: 126px;
    }

    .research-card-visual {
        width: 100px;
        height: 132px;
    }
}

/* --- MODAALI --- */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    display: flex; justify-content: center; align-items: center;
    z-index: 2000;
    opacity: 1; transition: opacity 0.3s;
}
.hidden { opacity: 0; pointer-events: none; }

.modal-content {
    background: white;
    width: 90%; max-width: 500px;
    border-radius: 20px;
    padding: 0;
    box-shadow: 0 20px 50px rgba(0,0,0,0.2);
    overflow: hidden;
    animation: slideUp 0.3s ease-out;
}
@keyframes slideUp {
    from { transform: translateY(50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
.modal-header {
    padding: 20px 30px;
    background-color: #f7fafc;
    display: flex; justify-content: space-between; align-items: center;
    border-bottom: 1px solid #edf2f7;
}
.modal-header h2 { margin: 0; font-family: var(--font-heading); font-size: 1.5rem; }
.close-icon { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: #a0aec0; }
.close-icon:hover { color: #e53e3e; }
.modal-body { padding: 30px; text-align: center; font-size: 1.1rem; }
.contact-info { background: #f0fff4; padding: 15px; border-radius: 10px; margin-top: 15px; font-weight: bold; font-size: 1.1rem; color: var(--primary-green-dark); }
.modal-footer { padding: 15px 30px; background-color: #f7fafc; text-align: right; }
