html {
    scrollbar-gutter: stable; /* Varaa vierityspalkille aina kiinteän tilan, estää siirtymisen */
}

:root {
    /* DEFAULT: TUMMA TILA */
    --bg-color: #0b111e;
    --card-bg: #131b2e;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --accent-gold: #d4af37;
    --header-bg: rgba(11, 17, 30, 0.85);
    --border-color: rgba(255, 255, 255, 0.05);
    --input-bg: #1e293b;
    --cookie-bg: rgba(19, 27, 46, 0.95);
    --font-stack: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --hero-gradient: radial-gradient(circle at center, #1e293b 0%, #0b111e 70%);
}

[data-theme="light"] {
    /* VAALEA TILA */
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-main: #0f172a;
    --text-muted: #475569;
    --accent-gold: #b58900;
    --header-bg: rgba(248, 250, 252, 0.85);
    --border-color: rgba(15, 23, 42, 0.08);
    --input-bg: #f1f5f9;
    --cookie-bg: rgba(255, 255, 255, 0.95);
    --hero-gradient: radial-gradient(circle at center, #e2e8f0 0%, #f8fafc 70%);
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: var(--font-stack);
    line-height: 1.6;
    overflow-x: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}

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

header {
    position: fixed;
    top: 0;
    width: 100%;
    background: var(--header-bg);
    backdrop-filter: blur(12px);
    z-index: 1000;
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.nav-container {
    position: relative;
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
}

/* LOGOJEN KLASSINEN INTEGRAATIO */
.logo-wrapper {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.logo-option.active {
    display: flex;
}

.logo-svg {
    width: 32px;
    height: 32px;
}

/* Logo 1: Geometriset säännöt */
.logo-text-owl {
    font-size: 1.4rem;
    font-weight: 300;
    letter-spacing: 4px;
    text-transform: uppercase;
}

/* Logo 2: Klassiset Serif-säännöt */
.logo-text-aegis {
    font-family: "Cinzel", "Playfair Display", serif;
    font-size: 1.5rem;
    font-weight: 400;
    letter-spacing: 1px;
}

/* SVG-viivojen värit muuttujien mukaan */
.stroke-main { stroke: var(--text-main); transition: stroke 0.3s; }
.stroke-gold { stroke: var(--accent-gold); transition: stroke 0.3s; }
.fill-gold { fill: var(--accent-gold); transition: fill 0.3s; }

/* Wraps .nav-links + .right-controls as one flex group (both scroll under the same #navLinks id -
   see site_nav()) so .nav-container's justify-content: space-between only ever sees 2 real
   children - the logo and this group - both on desktop (where it's just a normal row) and on
   mobile, where the whole group becomes one dropdown panel carrying the links AND the theme/
   language controls together, matching the other MakerShop-*-PHP sites' site_nav(). */
.nav-group {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.nav-links {
    display: flex;
    gap: 2rem;
    list-style: none;
}

.nav-links a:hover {
    color: var(--accent-gold);
    transition: color 0.3s ease;
}

.mobile-menu-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 4px;
    background: none;
    color: var(--text-main);
    cursor: pointer;
}

.right-controls {
    display: flex;
    align-items: center;
    gap: 1.2rem;
}

/* display:flex, not just relying on <a> being inline by default - without this, the two links
   wrap onto separate lines the moment they don't fit the remaining inline width. */
.lang-switcher {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-shrink: 0;
}

.lang-switcher a {
    padding: 0.3rem 0.6rem;
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 4px;
    font-size: 0.85rem;
    white-space: nowrap;
}

.lang-switcher a.active {
    background: var(--accent-gold);
    color: #fff;
    border-color: var(--accent-gold);
}

[data-theme="light"] .lang-switcher a.active {
    color: #000;
}

.theme-toggle {
    background: none;
    border: 1px solid rgba(148, 163, 184, 0.3);
    color: var(--text-main);
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.theme-toggle:hover {
    border-color: var(--accent-gold);
}

.control-btn {
    background: none;
    border: 1px solid rgba(148, 163, 184, 0.3);
    color: var(--text-main);
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.control-btn:hover {
    border-color: var(--accent-gold);
}

.hero {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 6rem 2rem 2rem 2rem;
    background: var(--hero-gradient);
    transition: background 0.3s ease;
}

.hero h1 {
    font-size: 3.5rem;
    font-weight: 300;
    letter-spacing: -1px;
    margin-bottom: 1.5rem;
    max-width: 800px;
}

.hero p {
    font-size: 1.2rem;
    color: var(--text-muted);
    max-width: 650px;
    margin-bottom: 2.5rem;
    font-weight: 300;
}

.btn {
    display: inline-block;
    background-color: transparent;
    color: var(--text-main);
    border: 1px solid var(--accent-gold);
    padding: 0.8rem 2rem;
    font-size: 1rem;
    letter-spacing: 1px;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.4s ease;
}

.btn:hover {
    background-color: var(--accent-gold);
    color: #fff;
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.2);
}

[data-theme="light"] .btn:hover {
    color: #000;
}

section {
    padding: 6rem 2rem;
    max-width: 1200px;
    margin: 0 auto;
    scroll-margin-top: 5rem;
}

.section-title {
    text-align: center;
    font-size: 2.2rem;
    font-weight: 400;
    margin-bottom: 3rem;
    letter-spacing: 1px;
}

.story-card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--accent-gold); /* Tyylikäs kultainen brändiraita sivussa */
    padding: 3.5rem 3rem;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    max-width: 900px;
    margin: 0 auto;
    text-align: left; /* Muutetaan teksti luettavammaksi vasemman reunan tasauksella */
    transition: transform 0.3s ease, border-color 0.3s ease;
}

.story-card:hover {
    transform: translateY(-3px);
    border-color: rgba(212, 175, 55, 0.3);
}

.story-card .section-title {
    text-align: left; /* Otsikko linjaan tekstin kanssa */
    margin-bottom: 2rem;
    font-size: 2rem;
}

.story-card p {
    font-size: 1.1rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    font-weight: 300;
    line-height: 1.7;
}

.story-card p:last-child {
    margin-bottom: 0; /* Poistetaan viimeisen kappaleen turha alamarginaali */
}

.story-box {
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
}

.story-box p {
    font-size: 1.15rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.card {
    background-color: var(--card-bg);
    padding: 2.5rem 2rem;
    border: 1px solid var(--border-color);
    border-radius: 15px;
    transition: all 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    border-color: var(--accent-gold);
}

.card h3 {
    font-size: 1.3rem;
    font-weight: 500;
    margin-bottom: 1rem;
}

.card p {
    color: var(--text-muted);
}

.timeline {
    position: relative;
    max-width: 800px;
    margin: 0 auto;
    padding-left: 2rem;
    border-left: 2px solid rgba(212, 175, 55, 0.3);
}

.timeline-item {
    position: relative;
    margin-bottom: 3rem;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: calc(-2rem - 7px);
    top: 6px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: var(--accent-gold);
    box-shadow: 0 0 10px var(--accent-gold);
}

.timeline-item h4 {
    font-size: 1.25rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.timeline-item p {
    color: var(--text-muted);
}

.privacy-box {
    background: var(--card-bg);
    padding: 4rem 3rem;
    text-align: left;
    max-width: 800px;
    margin: 0 auto;
    border: 1px solid var(--border-color);
    border-radius: 15px;
    transition: background-color 0.3s ease;
}

.privacy-box p {
    color: var(--text-muted);
    font-size: 1.05rem;
    margin-bottom: 1.5rem;
}

footer {
    background-color: #070c16;
    text-align: center;
    padding: 50px 20px;
    border-top: 1px solid var(--border-color);
}

[data-theme="light"] footer {
    background-color: #f1f5f9;
}

footer h2 {
    font-size: 2rem;
    font-weight: 300;
    margin-bottom: 2rem;
}

.contact-container {
    max-width: 500px;
    margin: 2rem auto 0 auto;
    text-align: left;
    display: none;
}

.contact-container.visible {
    display: block;
}

.form-group {
    margin-bottom: 1.2rem;
}

.form-group label {
    display: block;
    font-size: 0.9rem;
    margin-bottom: 0.4rem;
    color: var(--text-main);
}

.form-control {
    width: 100%;
    padding: 0.8rem;
    background-color: var(--input-bg);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    font-family: var(--font-stack);
    font-size: 1rem;
    border-radius: 15px;
    transition: border-color 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-gold);
}

textarea.form-control {
    resize: vertical;
    min-height: 120px;
}

.alert {
    padding: 1rem;
    margin-bottom: 1.5rem;
    border-radius: 15px;
    font-size: 0.95rem;
    text-align: center;
}

.alert-success {
    background-color: rgba(16, 185, 129, 0.15);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.alert-error {
    background-color: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.cookie-banner {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(150%);
    width: calc(100% - 4rem);
    max-width: 600px;
    background: var(--cookie-bg);
    border: 1px solid var(--border-color);
    border-radius: 15px;
    padding: 1.5rem;
    z-index: 2000;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.cookie-banner.show {
    transform: translateX(-50%) translateY(0);
}

.cookie-text {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.cookie-buttons {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

.cookie-btn {
    padding: 0.5rem 1.2rem;
    font-size: 0.85rem;
    cursor: pointer;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 15px;
    color: var(--text-main);
    transition: all 0.2s ease;
}

.cookie-btn.accept {
    border-color: var(--accent-gold);
    background: var(--accent-gold);
    color: #000;
}

.cookie-btn.accept:hover {
    background: transparent;
    color: var(--text-main);
    border-color: var(--accent-gold);
}

.cookie-btn.decline:hover {
    border-color: var(--text-main);
}

@media (max-width: 768px) {
    .hero h1 { font-size: 2.5rem; }

    .mobile-menu-toggle { display: inline-flex; }
    /* .nav-group (the nav links AND the theme/language controls together - see site_nav()'s
       markup) collapses into one dropdown panel instead of just hiding the links with nothing
       replacing them - anchored by .nav-container's position: relative above. Toggled by
       #mobileMenuToggle - see partials.php's own inline script. */
    .nav-group {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 4px;
        padding: 0.5rem 2rem 1.2rem;
        background: var(--header-bg);
        backdrop-filter: blur(12px);
        border-bottom: 1px solid var(--border-color);
        box-shadow: 0 12px 24px rgba(0, 0, 0, 0.35);
    }
    .nav-group.open { display: flex; }

    .nav-links { flex-direction: column; gap: 0; }
    .nav-links li { width: 100%; }
    .nav-links a { display: block; padding: 0.7rem 0; }

    /* Same treatment as the nav links above it, just its own row underneath - matches how the
       other MakerShop-*-PHP sites' dark/light toggle sits inside their mobile nav dropdown. */
    .right-controls {
        margin-top: 8px;
        padding-top: 12px;
        border-top: 1px solid rgba(148, 163, 184, 0.2);
    }

    .section-title { font-size: 1.8rem; }
    .cookie-banner { bottom: 1rem; width: calc(100% - 2rem); padding: 1.2rem; }
    .cookie-buttons { flex-direction: column; }
}

@media (max-width: 480px) {
    .nav-container { padding: 1rem; }
}


@media (max-width: 768px) {
    .story-card {
        padding: 2rem 1.5rem;
    }
    .story-card .section-title {
        font-size: 1.6rem;
    }
}



/* DOKUMENTAATION KAKSIPALSTAINEN ASETTELU */
.docs-layout {
    display: flex;
    gap: 3rem;
    max-width: 1200px;
    margin: 6rem auto 2rem auto; /* Jätetään tilaa fixed-yläpalkille */
    padding: 0 2rem;
}

/* Vasen palsta: Sisällysluettelo */
.docs-sidebar {
    width: 250px;
    flex-shrink: 0;
    position: sticky;
    top: 6rem; /* Pysyy näytöllä rullatessa */
    height: calc(100vh - 8rem);
    overflow-y: auto;
    padding-right: 1rem;
    border-right: 1px solid var(--border-color);
}

.docs-sidebar h3 {
    font-size: 1.1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 1rem;
    color: var(--accent-gold);
}

.docs-menu {
    list-style: none;
}

.docs-menu li {
    margin-bottom: 0.75rem;
}

.docs-menu a {
    color: var(--text-muted);
    font-size: 0.95rem;
    transition: color 0.2s ease;
}

.docs-menu a:hover, .docs-menu a.active {
    color: var(--text-main);
    font-weight: 500;
}

/* Oikea palsta: Sisältöalue */
.docs-content {
    flex-grow: 1;
    max-width: 800px;
}

.docs-article {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 15px; /* Noudattaa 15px pyöristystä */
    padding: 3rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.docs-article h1 {
    font-size: 2.5rem;
    font-weight: 300;
    margin-bottom: 1.5rem;
    letter-spacing: -0.5px;
}

.docs-article h2 {
    font-size: 1.6rem;
    font-weight: 400;
    margin: 2rem 0 1rem 0;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.docs-article p {
    color: var(--text-muted);
    font-size: 1.05rem;
    line-height: 1.7;
    margin-bottom: 1.2rem;
}

/* Koodiblokkien tyylitys ohjeisiin */
.docs-article pre {
    background-color: var(--input-bg);
    padding: 1rem;
    border-radius: 10px;
    overflow-x: auto;
    font-family: monospace;
    font-size: 0.9rem;
    margin: 1.5rem 0;
    border: 1px solid var(--border-color);
}

.docs-article h3 {
    font-size: 1.2rem;
    font-weight: 500;
    margin: 1.5rem 0 0.75rem 0;
}

.docs-article ul,
.docs-article ol {
    color: var(--text-muted);
    font-size: 1.05rem;
    line-height: 1.7;
    margin: 0 0 1.2rem 1.4rem;
}

.docs-article li {
    margin-bottom: 0.4rem;
}

.docs-article strong {
    color: var(--text-main);
    font-weight: 600;
}

.docs-article em {
    font-style: italic;
}

.docs-article a {
    color: var(--accent-gold);
    text-decoration: none;
}

.docs-article a:hover {
    text-decoration: underline;
}

.docs-article code {
    background-color: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 1px 6px;
    font-family: monospace;
    font-size: 0.9em;
    /* A long inline code snippet with no spaces (a JSON example, a URL) has nowhere for the
       browser's own default word-break to happen, so it overflowed its own card and the page's own
       width instead of wrapping - confirmed live on the Plugins page's wire-protocol example. */
    overflow-wrap: anywhere;
}

.docs-article pre code {
    background: none;
    border: none;
    padding: 0;
}

.docs-article pre .comment {
    color: var(--text-muted);
}

.docs-article pre .accent {
    color: var(--accent-gold);
}

/* Huomiolaatikko ohjeteksteissä - vihreä/kultainen reunaviiva vasemmalla, "warn"-muunnos
   todella peruuttamattomille toimenpiteille */
.docs-note {
    border: 1px solid var(--border-color);
    border-left: 3px solid var(--accent-gold);
    background-color: var(--input-bg);
    border-radius: 10px;
    padding: 1rem 1.2rem;
    margin: 0 0 1.2rem 0;
    font-size: 0.95rem;
    color: var(--text-muted);
}

.docs-note p:last-child {
    margin-bottom: 0;
}

.docs-note-warn {
    border-left-color: #c15b3a;
}

.docs-muted {
    color: var(--text-muted);
    margin: -0.5rem 0 1rem 0;
}

/* Edellinen/seuraava-navigointi sivun alaosassa */
.docs-pager {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 1.2rem;
}

.docs-pager a {
    flex: 1;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0.9rem 1rem;
    text-decoration: none;
    color: var(--text-main);
    font-size: 0.9rem;
    transition: border-color 0.2s ease;
}

.docs-pager a:hover {
    border-color: var(--accent-gold);
}

.docs-pager-label {
    display: block;
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.25rem;
}

.docs-pager-next {
    text-align: right;
}

/* Dokumentaation yleiskatsauksen korttiruudukko (docs.php:n oma index-näkymä) - samaa
   .card-tyyliä mukaillen mutta linkkinä toimivana korttina */
.docs-index-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin: 1rem 0 2.5rem;
}

a.feature-card {
    display: block;
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 15px;
    padding: 1.4rem 1.5rem;
    transition: transform 0.15s ease, border-color 0.15s ease;
}

a.feature-card:hover {
    transform: translateY(-2px);
    border-color: var(--accent-gold);
}

a.feature-card h3 {
    font-size: 1.05rem;
    font-weight: 500;
    margin-bottom: 0.4rem;
    color: var(--text-main);
}

a.feature-card p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 0;
}

.feature-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(212, 175, 55, 0.12);
    color: var(--accent-gold);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.9rem;
}

/* Integraatioiden logot yleiskatsauksessa - vaihtuu vaalean/tumman teeman mukaan. Tumma teema on
   oletus (ks. tämän tiedoston omat :root-muuttujat), joten tumma logo näkyy oletuksena ja vaalea
   teema kääntää sen - sama data-theme-kaava kuin sivun oma teemanvaihtopainike käyttää. */
.doc-card-icon {
    width: 36px;
    height: 36px;
    margin-bottom: 0.9rem;
    display: block;
}

.doc-card-icon-light {
    display: none;
}

[data-theme="light"] .doc-card-icon-light {
    display: block;
}

[data-theme="light"] .doc-card-icon-dark {
    display: none;
}

/* MOBIILILEKAUTUS: Palstat päällekkäin älypuhelimilla */
@media (max-width: 768px) {
    .docs-layout {
        flex-direction: column;
        gap: 2rem;
    }
    .docs-sidebar {
        width: 100%;
        height: auto;
        position: relative;
        top: 0;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        padding-bottom: 1.5rem;
    }
    .docs-article {
        padding: 2rem 1.5rem;
    }
    .docs-index-grid {
        grid-template-columns: 1fr;
    }
    .docs-pager {
        flex-direction: column;
    }
    .docs-pager-next {
        text-align: left;
    }
}
