/* --- MANALAS DUNGEON — Seifs/Sinetti dokumentaatiosivu --- */
/* Sama latvialaisteema kuin manala.css:ssä, mutta eri muuttujanimin,
   koska tämä tiedosto on täysin erillinen eikä koskaan ladata
   samalle sivulle manala.css:n kanssa. */

:root {
    --bg: #f3f0e9;
    --card: #ffffff;
    --ink: #2a2626;
    --red: #8d2027;
    --red-dark: #6f181e;
    --muted: #7a7268;
    --border: #ddd6c9;
    --shadow: rgba(141, 32, 39, 0.10);
    --code-bg: #f7f3ea;
    --stripe: #faf7f0;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: Georgia, 'Times New Roman', serif;
    line-height: 1.65;
    padding-bottom: 60px;
}

/* --- prievīte-nauha, sama kuva kuin etusivulla --- */
.ribbon {
    height: 42px;
    background-image: url('images/banner_prievite.png');
    background-repeat: repeat-x;
    background-size: auto 100%;
}
.ribbon.top { border-bottom: 1px solid var(--border); }
.ribbon.bottom { border-top: 1px solid var(--border); margin-top: 48px; }

/* --- Yläpalkki --- */
.topbar {
    background: var(--card);
    border-bottom: 1px solid var(--border);
    padding: 18px 24px;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    position: sticky;
    top: 0;
    z-index: 20;
    box-shadow: 0 2px 10px var(--shadow);
}
.topbar h1 {
    margin: 0;
    font-size: 1.3em;
    font-weight: normal;
    letter-spacing: 0.5px;
    color: var(--red);
}
.topbar .version {
    font-family: 'Courier New', monospace;
    font-size: 0.75em;
    color: var(--muted);
    background: var(--stripe);
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 2px 8px;
    margin-left: 10px;
}
.topbar a.back {
    color: var(--red);
    text-decoration: none;
    border: 1.5px solid var(--red);
    border-radius: 4px;
    padding: 7px 14px;
    font-size: 0.85em;
    white-space: nowrap;
    transition: background-color .2s, color .2s;
}
.topbar a.back:hover { background: var(--red); color: #fff; }

/* --- Layout: sisällys + sisältö --- */
.layout {
    max-width: 1100px;
    margin: 32px auto 0;
    padding: 0 20px;
    display: grid;
    grid-template-columns: 230px minmax(0, 1fr);
    gap: 34px;
    align-items: start;
}

nav.toc {
    position: sticky;
    top: 84px;
    background: var(--card);
    border: 1px solid var(--border);
    border-top: 3px solid var(--red);
    border-radius: 4px;
    padding: 18px 20px;
    font-size: 0.86em;
    max-height: calc(100vh - 110px);
    overflow-y: auto;
}
nav.toc p.label {
    margin: 0 0 10px;
    color: var(--red);
    font-weight: bold;
    text-transform: uppercase;
    font-size: 0.78em;
    letter-spacing: 1.2px;
}
nav.toc a {
    display: block;
    color: var(--ink);
    text-decoration: none;
    padding: 4px 0;
    border-bottom: 1px dotted transparent;
}
nav.toc a:hover { color: var(--red); border-bottom-color: var(--border); }

main {
    background: var(--card);
    border: 1px solid var(--border);
    border-top: 3px solid var(--red);
    border-radius: 4px;
    box-shadow: 0 4px 18px var(--shadow);
    padding: 8px 42px 42px;
}

.lede {
    padding: 20px 0 8px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 8px;
}
.lede .meta { font-size: 0.92em; color: var(--muted); }
.lede .meta strong { color: var(--ink); }
.apk-download { margin: 14px 0; }
.btn-apk {
    display: inline-block;
    background: var(--red);
    color: #fff;
    text-decoration: none;
    font-family: Georgia, serif;
    font-size: 0.95em;
    letter-spacing: 0.2px;
    padding: 10px 18px;
    border-radius: 5px;
    transition: background-color .2s;
}
.btn-apk:hover { background: var(--red-dark); }
.apk-hint {
    font-size: 0.85em;
    color: var(--muted);
    margin: 6px 0 0;
}
.lede p.intro { font-size: 1.02em; }

.changelog {
    background: var(--stripe);
    border-left: 3px solid var(--red);
    border-radius: 0 4px 4px 0;
    padding: 12px 18px;
    margin: 18px 0;
    font-size: 0.92em;
}
.changelog p { margin: 4px 0; }
.changelog .ver { color: var(--red); font-weight: bold; }

h2 {
    color: var(--red);
    font-size: 1.35em;
    font-weight: normal;
    letter-spacing: 0.3px;
    margin: 44px 0 14px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--red);
    scroll-margin-top: 84px;
}
h2:first-of-type { margin-top: 28px; }
h3 {
    color: var(--red-dark);
    font-size: 1.05em;
    margin: 26px 0 10px;
    scroll-margin-top: 84px;
}

p { margin: 0 0 12px; }
ul, ol { margin: 0 0 14px; padding-left: 24px; }
li { margin-bottom: 6px; }
strong { color: var(--red-dark); }

code {
    font-family: 'Courier New', Consolas, monospace;
    background: var(--code-bg);
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 1px 5px;
    font-size: 0.88em;
    color: var(--red-dark);
}
pre {
    background: var(--code-bg);
    border: 1px solid var(--border);
    border-left: 3px solid var(--red);
    border-radius: 4px;
    padding: 14px 18px;
    overflow-x: auto;
    font-size: 0.82em;
    line-height: 1.5;
    margin: 0 0 16px;
}
pre code { background: none; border: none; padding: 0; color: var(--ink); }

blockquote {
    background: var(--stripe);
    border-left: 3px solid var(--red);
    border-radius: 0 4px 4px 0;
    margin: 0 0 16px;
    padding: 12px 18px;
    font-size: 0.94em;
    color: var(--ink);
}
blockquote p:last-child { margin-bottom: 0; }

table {
    width: 100%;
    border-collapse: collapse;
    margin: 0 0 18px;
    font-size: 0.9em;
}
th, td {
    text-align: left;
    padding: 8px 12px;
    border: 1px solid var(--border);
    vertical-align: top;
}
th {
    background: var(--red);
    color: #fff;
    font-weight: normal;
    letter-spacing: 0.3px;
}
tr:nth-child(even) td { background: var(--stripe); }

hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 32px 0;
}

.diagram {
    background: var(--code-bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 16px;
    overflow-x: auto;
    font-family: 'Courier New', Consolas, monospace;
    font-size: 0.78em;
    line-height: 1.35;
    color: var(--ink);
    white-space: pre;
    margin-bottom: 16px;
}

/* --- Mobiili --- */
@media (max-width: 860px) {
    .layout { grid-template-columns: 1fr; }
    nav.toc {
        position: static;
        max-height: none;
    }
    main { padding: 8px 22px 30px; }
    .topbar { padding: 14px 16px; }
    .ribbon { height: 38px; }
}
