/* ==========================================================================
   MUUTTUJAT JA TEEMAT (Dark/Light)
   ========================================================================== */
:root {
  --bg: #05070b;
  --bg-gradient: radial-gradient(circle at top, #111827 0, #05070b 42%, #050509 100%);
  --card: #11151d;
  --header-bg: rgba(22, 26, 35, 0.95);
  --text: #e4edf5;
  --muted: #9aa5b3;
  --brand: #0e6d5a;
  --brand-light: #22bfa1; 
  --brand-hover: #158c77;
  --border: #181e28;
  --border-light: #263042;
  --tag-bg: rgba(14, 109, 90, 0.18);
  --tag-border: rgba(14, 109, 90, 0.6);
  --tag-color: #e3f7f2;
  --shadow: 0 12px 32px rgba(0, 0, 0, .45);
  --max-width: 1100px;
}
 
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f7f9fc;
    --bg-gradient: radial-gradient(circle at top, #ffffff 0, #f7f9fc 100%);
    --card: #ffffff;
    --header-bg: rgba(255, 255, 255, 0.95);
    --text: #0d1321;
    --muted: #5b6570;
    --brand: #0f7d66;
    --brand-light: #0f7d66;
    --brand-hover: #15957d;
    --border: #e2e7f0;
    --border-light: #d4deec;
    --tag-bg: #e4f7f2;
    --tag-border: #c3e6da;
    --tag-color: #134337;
    --shadow: 0 8px 20px rgba(13, 19, 33, .08);
  }
}
 
/* ==========================================================================
   GLOBALIT
   ========================================================================== */
* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-gradient);
  color: var(--text);
  font: 15px/1.55 system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  scroll-behavior: smooth;
}

main.wrap {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 24px;
}

a {
  color: var(--brand-light);
  text-decoration: none;
  text-decoration-color: rgba(34, 191, 161, 0.3);
  transition: all 0.18s ease;
}

a:hover {
  color: var(--brand-hover);
  text-decoration-color: var(--brand-hover);
}

/* ==========================================================================
   OTSIKKOHIERARKIA
   ========================================================================== */
h1, h2, h3, h4, h5 {
  color: var(--text);
  font-weight: 700;
  line-height: 1.2; 
  margin-top: 1.8em;
  margin-bottom: 1em;
  letter-spacing: -0.01em;
}

h1 { font-size: clamp(1.8rem, 5vw, 2.6rem); font-weight: 800; margin-top: 0.5em; letter-spacing: -0.02em; }
h2 { font-size: clamp(1.4rem, 4vw, 1.8rem); margin-top: 2em; }
h3 { font-size: 1.4rem; font-weight: 800; }
h4 { font-size: 1.2rem; font-weight: 600; margin-top: 2.2em; }
h5 { font-size: 0.95rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }

.pretitle + h1 { margin-top: 0; }
.info-card h3 { margin-top: 0; }

.pretitle {
  text-transform: uppercase;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.12em;
  margin-top: 30px;
  margin-bottom: 4px;
  font-weight: 600;
}

.hero-lead {
  font-size: 16px;
  line-height: 1.65;
  padding: 6px 0 6px 16px;
  border-left: 3px solid var(--brand);
  color: var(--muted);
  max-width: 650px;
  margin-bottom: 32px;
}

/* ==========================================================================
   LISTAT (ul, ol)
   ========================================================================== */
main.wrap ul:not(.list), 
main.wrap ol {
  margin-top: 1rem;
  margin-bottom: 2rem;
  padding-left: 1.8rem;
}

main.wrap ul:not(.list) li, 
main.wrap ol li {
  margin-bottom: 0.75rem; 
  line-height: 1.6;
  color: var(--text);
}

main.wrap ul:not(.list) { list-style: none; }
main.wrap ul:not(.list) li::before {
  content: "•";
  color: var(--brand-light);
  font-weight: bold;
  display: inline-block;
  width: 1em;
  margin-left: -1em;
}

main.wrap ol { counter-reset: custom-counter; list-style: none; }
main.wrap ol li { counter-increment: custom-counter; margin-bottom: 1.5em; }
main.wrap ol li::before {
  content: counter(custom-counter) ".";
  color: var(--brand-light);
  font-weight: 700;
  margin-right: 0.5rem;
  font-variant-numeric: tabular-nums;
}

/* Listojen resetointi latauskortteja varten */
.list { list-style: none !important; margin: 0 !important; padding: 0 !important; }
.item::before { content: none !important; }
.item { margin-bottom: 0 !important; }

/* ==========================================================================
   YLÄVALIKKO (Työpöytä)
   ========================================================================== */
.main-header {
    background: var(--header-bg);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo { font-weight: 800; color: var(--text); text-decoration: none; font-size: 1.2rem; }

/* Päävalikko */
.main-nav ul { list-style: none; display: flex; gap: 24px; margin: 0; padding: 0; }
.main-nav ul li { position: relative; } /* Tarvitaan submenun asemointiin */

.main-nav a { color: var(--muted); text-decoration: none; font-size: 0.95rem; font-weight: 500; transition: all 0.2s; }
.main-nav a:hover, .main-nav a.active { color: var(--brand-light); }

/* --- SUB-MENU (Työpöytä) --- */
.has-submenu > a { display: flex; align-items: center; gap: 6px; }

/* Pieni nuoli-indikaattori */
.has-submenu > a::after {
    content: '▼';
    font-size: 0.6rem;
    opacity: 0.5;
    transition: transform 0.2s;
}

.has-submenu:hover > a::after { transform: rotate(180deg); color: var(--brand-light); }

.submenu {
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--header-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    min-width: 210px;
    padding: 8px 0 !important;
    display: flex;
    flex-direction: column;
    gap: 0 !important;
    box-shadow: var(--shadow);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.2s ease;
}

.has-submenu:hover .submenu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.submenu li { width: 100%; }

.submenu li a {
    padding: 10px 20px !important;
    display: block;
    font-size: 0.9rem !important;
    border-radius: 0;
}

.submenu li a:hover {
    background: rgba(34, 191, 161, 0.08);
    color: var(--brand-light) !important;
}

/* Mobiilinappi piilossa työpöydällä */
.menu-toggle { display: none; background: none; border: none; cursor: pointer; padding: 10px; z-index: 1100; }

/* --- Navigaation Osta-painike (Työpöytä) --- */
.nav-cta {
    background: var(--brand) !important;
    color: #fff !important; 
    padding: 6px 15px !important;
    border-radius: 8px;
    font-weight: 400 !important;
    transition: all 0.2s ease-in-out !important;
}

.nav-cta:hover {
    background: var(--brand-hover) !important; 
    color: #fff !important;
    transform: translateY(-1px);
    text-decoration: none !important;
}

/* ==========================================================================
   LATAUSKORTIT
   ========================================================================== */
.card { background: var(--card); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; transition: all 0.2s ease; }
.card:hover { border-color: var(--brand); }
.cornered { margin-bottom: 30px; border-left: 4px solid var(--brand-light); }
.warbber { margin-bottom: 60px; }
.hero { padding: 24px; border-bottom: 1px solid var(--border); background: radial-gradient(circle at top left, rgba(14, 109, 90, 0.15) 0, transparent 70%); }
.item { display: grid; gap: 8px; padding: 16px 20px; border-bottom: 1px solid var(--border); transition: background 0.2s ease; }
.item:hover { background: rgba(255, 255, 255, 0.02); }
.top { display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; }
.hero .top { margin-bottom: 10px; }
.ver { font-weight: 700;  }
.date, .size { color: var(--muted); font-size: 12px; margin-left: 10px; margin-right: 5px;  }
.notes { color: var(--muted); font-size: 14px; line-height: 1.4; }
#heroNotes { margin-bottom: 20px; } 

.buy-text { margin-top: 20px; font-size: 0.9rem; color: var(--muted); }
.buy-text a { text-decoration: none; }

/* ==========================================================================
   NAPIT JA LOMAKKEET
   ========================================================================== */
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }

.btn {
  appearance: none;
  border: 1px solid var(--border-light);
  background: rgba(10, 14, 20, 0.5);
  color: var(--text);
  padding: 8px 16px;
  border-radius: 10px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  font-weight: 500;
  transition: all 0.2s ease;
}

.btn:hover { background: transparent; border-color: var(--brand-light); color: #fff; }
.btn.primary { background: var(--brand); border-color: transparent; color: #fff; font-weight: 600; }
.btn.primary:hover { background: var(--brand-hover); box-shadow: 0 4px 12px rgba(0,0,0,0.3); }
.btn-disabled { opacity: 0.5; pointer-events: none; }

/* Salasanalomake */
.pw-unlock-form { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; background: rgba(255, 255, 255, 0.03); padding: 20px; border-radius: 14px; border: 1px solid var(--border); margin-top: 10px; }
.pw-unlock-form .input-group { position: relative; flex: 1; min-width: 280px; } 
.pw-unlock-form input[type="password"] { width: 100%; padding: 12px 16px 12px 42px; border-radius: 10px; border: 1px solid var(--border); background: rgba(0, 0, 0, 0.2); color: var(--text); font-size: 12px; outline: none; }
.pw-unlock-form input[type="password"]:focus { border-color: var(--brand-light); box-shadow: 0 0 0 3px rgba(34, 191, 161, 0.1); }
.pw-unlock-form .lock-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); opacity: 0.6; pointer-events: none; }
.pw-error-msg { color: #ff4d4d; font-size: 12px; width: 100%; margin-top: 8px; font-weight: 500; }

/* ==========================================================================
   TAGIT JA KOMPONENTIT
   ========================================================================== */
.tag {
  background: var(--tag-bg);
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--tag-border);
  color: var(--muted); 
  font-weight: 600;
  text-transform: uppercase;
  display: inline-block;
}
.tag.green { background: var(--brand); color: #fff; border-color: var(--brand); margin-bottom: 10px; }

.top {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}
 
.dl-count {
    font-size: 11px;
    color: var(--muted); 
    background: rgba(34, 191, 161, 0.1);
    padding: 2px 10px;
    border-radius: 999px;
    font-weight: 600;
    border: 1px solid rgba(34, 191, 161, 0.2);
    display: inline-block;
    vertical-align: middle;
    margin: 0 4px;
    white-space: nowrap;
} 

#heroDlCount {
    color: var(--muted);
    font-weight: 400;
	margin-right: 8px;
}

/* ==========================================================================
   VIDEO-GRID (Yleinen pino-asettelu)
   ========================================================================== */
/* --- 1. Pääsäiliö (.video-grid) --- */
.video-grid {
    display: flex;
    flex-direction: column;
    gap: 0; 
    margin-top: 40px;
    margin-bottom: 60px;
    width: 100%;
}

/* --- 2. Yksittäinen kortti (.video-card) --- */
.video-card {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
    background: transparent;
    border-radius: 0;
    overflow: visible;

    /* Viiva korttien väliin */
    padding-bottom: 80px;
    margin-bottom: 80px;
    border-bottom: 2px solid var(--border); /* Käytetään teemamuuttujaa */
}

/* Viimeiseltä kortilta viiva pois */
.video-card:last-child {
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 0; 
}

/* --- 3. Videon ja tekstin asetukset --- */
.video-thumb,
.video-info {
    width: 100%;
}

/* Videon responsiivinen upotus */
.video-embed {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 */
    height: 0;
    background: #000;
    /* Pyöristys ja varjo itse videolle */
    border-radius: 12px; 
    box-shadow: 0 8px 24px rgba(0,0,0,0.12); 
    overflow: hidden;
}

.video-embed iframe {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%; border: 0;
}

/* Tekstiosion tyylit */
.video-info {
    padding-top: 1.5rem;
}

/* Hienosäätöä otsikolle */
.video-info h2 {
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 2rem;
}

.video-info h3 {
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 1.6rem;
}

/* ==========================================================================
   ETUSIVUN VIDEO-GRID (Erityistyylit)
   ========================================================================== */
.video-grid.frontpage {
    margin-bottom: 100px;
    gap: 80px;
}

/* Koko kortti yhtenäiseksi palikaksi */
.video-grid.frontpage .video-card {
    gap: 0;
    border-radius: 16px;
    box-shadow: var(--shadow);
    overflow: hidden;
    /* Nollataan yleisen video-gridin viivat ja välit */
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 0;
}

/* Videon yläosa */
.video-grid.frontpage .video-embed {
    box-shadow: none;
    border-radius: 0;
}

/* Tekstialue (Tumman sininen laatikko) */
.video-grid.frontpage .video-info {
    background-color: #11151d; /* Tähän voisi käyttää myös var(--card) jos haluaa teeman mukaan */
    padding: 40px 30px;
    color: #ffffff; /* Pidetään valkoisena tummaa taustaa vasten */
}

/* Varmistetaan, että otsikko on myös valkoinen */
.video-grid.frontpage .video-info h2 {
    color: #ffffff;
    margin-top: 0;
}

/* ==========================================================================
   MUUT SIVUN OSAT (Info, FAQ, Footer)
   ========================================================================== */
/* Info Grid */
.info-grid {
  display: grid;
  gap: 24px;
  margin-top: 32px;
  grid-template-columns: 1fr; 
}
@media (min-width: 768px) {  
	.info-grid { 
		grid-template-columns: 1fr 1fr; 
	} 
	.info-card-wide {
		grid-column: span 2;
	} 
}
.info-card { padding: 24px; }

/* FAQ */
.faq { max-width: 100%; margin: 60px auto; } 
.faq-item { background: var(--card); border: 1px solid var(--border); border-radius: 12px; margin-bottom: 10px; overflow: hidden; }
.faq-question { width: 100%; display: flex; align-items: center; justify-content: space-between; padding: 1.2rem; background: transparent; border: none; color: var(--text); font-weight: 600; cursor: pointer; }
.faq-question span { font-size: 1.2em; }
.faq-answer { display: none; padding: 0 1.2rem 1.2rem; font-size: 0.95rem; }
.faq-item.is-open .faq-answer { display: block; }

/* Helper luokat */
.highlight { color: var(--brand-light); }
.warning-box { border-left: 3px solid #eab308; background: rgba(234, 179, 8, 0.08); padding: 12px 16px; margin-top: 16px; border-radius: 4px; }
.err { background: #c62828; color: #fff; padding: 12px; border-radius: 8px; margin: 20px 0; display: none; }

/* Footer */
.footer { margin: 80px 0 50px; text-align: center; color: var(--muted); font-size: 13px; }

/* Footerin tekoäly-ilmoituslaatikko */
.ai-notice-box {
    background-color: #050a10; 
    color: #e2e8f0; 
    padding: 18px 24px;
    border-radius: 10px;
    margin: 25px auto;
    max-width: 580px;
    font-size: 0.92rem;
    line-height: 1.5;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.ai-notice-box strong {
    color: #ffffff;
    display: inline-block;
    margin-bottom: 4px;
} 

/* Tyylejä lisenssisivulle */
.license-item h2 { font-size: 1.3rem; margin-bottom: 10px; }
.license-item ul { margin-bottom: 15px; padding-left: 20px; color: var(--muted); }
.license-item li { margin-bottom: 5px; }
.license-list hr { margin: 30px 0; border: 0; border-top: 1px solid var(--border); }
.disclaimer h3 { margin-top: 0px; }

/* ==========================================================================
   MOBIILINAVIGAATIO (900px ja alle) - Full Screen
   ========================================================================== */
@media (max-width: 900px) {
    .menu-toggle { display: block; }
    
    /* HUOM: Muutettu taustaväriksi var(--text), jotta näkyy light modessa */
    .hamburger, .hamburger::before, .hamburger::after {
        content: '';
        display: block;
        width: 28px;
        height: 3px;
        background: var(--text) !important;
        position: relative;
        transition: all 0.3s;
    }
    .hamburger::before { position: absolute; top: -8px; left: 0; }
    .hamburger::after { position: absolute; bottom: -8px; left: 0; }

    .main-nav {
        position: fixed;
        top: 0; left: 0; width: 100%; height: 100vh;
        background: var(--bg); /* Käytetään teeman taustaa */
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease-in-out;
        z-index: 1000;
    }

    .main-nav.is-open { opacity: 1; visibility: visible; }
    .main-nav ul { flex-direction: column; align-items: center; gap: 20px; }
    .main-nav ul li a { font-size: 1.5rem; font-weight: 600; color: var(--text); } /* Väri teeman mukaan */

    /* Submenu mobiilissa: näytetään aina listana päälinkin alla */
    .submenu {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        border: none;
        background: transparent;
        padding: 0 !important;
        margin-top: 10px;
        display: flex;
        align-items: center;
        gap: 15px !important;
    }

    .submenu li a {
        font-size: 1.2rem !important; /* Hieman pienempi kuin päälinkit */
        font-weight: 500;
        color: var(--muted) !important;
        padding: 5px 0 !important;
    }

    .has-submenu > a::after { display: none; } /* Poistetaan nuoli mobiilissa */

    /* Hampurilaisanimaatio kun auki */
    .menu-toggle.is-active .hamburger { background: transparent !important; }
    .menu-toggle.is-active .hamburger::before { transform: rotate(45deg); top: 0; }
    .menu-toggle.is-active .hamburger::after { transform: rotate(-45deg); bottom: 0; }

    body.menu-open { overflow: hidden; }

    /* Pieniä mobiilisäätöjä */
    .pw-unlock-form { flex-direction: column; align-items: stretch; }
    .pw-unlock-form .input-group { min-width: 100%; }
    .btn { width: 100%; justify-content: center; }
}