/* Forever-Wiki - Grundgestaltung
 *
 * Dunkler Forever-Look als Standard (wie die Spiel-Oberfläche und das
 * Addon Bücherwurm), helles Pergament per Umschalter.
 * Nur Systemschriften, keine externen Dateien (DSGVO).
 */

/* ---- Farben ------------------------------------------------------------ */

:root,
:root[data-theme="dunkel"] {
    /* Forever-Look: wie die Fenster im Spiel (kombinierter Rucksack) und
       wie das Addon Bücherwurm (Stil.lua) - gleiche Werte. */
    --bg:         #09090b;
    --bg-2:       #0e0e11;
    --flaeche:    #121215;
    --flaeche-2:  #1b1917;
    --rand:       #785e33;
    --rand-hell:  #c79e54;
    --text:       #e9e3d6;
    --text-2:     #a9a294;
    --akzent:     #ffd100;
    --rubrik:     #e0b25c;
    --link:       #e6bb6f;
    --ok:         #8fd16a;
    --ok-bg:      #17240f;
    --warn:       #ffa040;
    --warn-bg:    #2e1f0c;
    --mark-bg:    #4a381c;
    --gitter:     #26231f;
    --schatten:   0 0 0 1px #00000099, 0 8px 24px #000000aa;
    color-scheme: dark;
}

:root[data-theme="hell"] {
    --bg:         #efe4cc;
    --bg-2:       #e7d8b9;
    --flaeche:    #faf4e6;
    --flaeche-2:  #f3e9d3;
    --rand:       #cfb98f;
    --rand-hell:  #b39867;
    --text:       #2a2017;
    --text-2:     #5d4c37;
    --akzent:     #8a5a1c;
    --rubrik:     #9b3b22;
    --link:       #8a3b22;
    --ok:         #3e6a2a;
    --ok-bg:      #e3ecd3;
    --warn:       #8f5200;
    --warn-bg:    #f6e2bd;
    --mark-bg:    #f3d98f;
    --gitter:     #e2d2b0;
    --schatten:   0 1px 0 #ffffff80, 0 6px 16px #5a3d1a1f;
    color-scheme: light;
}

:root {
    --serif:  "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua",
              "URW Palladio L", Georgia, serif;
    --sans:   system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans",
              "Helvetica Neue", Arial, sans-serif;
    --mono:   ui-monospace, "Cascadia Mono", "Segoe UI Mono", Consolas, monospace;
    --breite: 72rem;
    --rund:   6px;
}

/* ---- Grundlagen -------------------------------------------------------- */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust:         100%;
    scroll-padding-top:       5rem;
}

body {
    margin:           0;
    min-height:       100vh;
    display:          flex;
    flex-direction:   column;
    background-color: var(--bg);
    background-image: radial-gradient(ellipse at top, var(--bg-2), var(--bg) 70%);
    background-attachment: fixed;
    color:            var(--text);
    font-family:      var(--sans);
    font-size:        1.0625rem;
    line-height:      1.6;
    overflow-wrap:    anywhere;
}

h1,
h2,
h3,
h4 {
    font-family:  var(--serif);
    line-height:  1.25;
    color:        var(--text);
    margin:       1.6em 0 0.5em;
    overflow-wrap: break-word;
}

h1 {
    font-size:  clamp(1.8rem, 5vw, 2.6rem);
    margin-top: 0.4em;
    color:      var(--akzent);
    text-shadow: 0 1px 0 #000, 0 0 12px #00000080;
}

h2 {
    font-size:     1.6rem;
    color:         var(--rubrik);
    border-bottom: 1px solid var(--rand);
    padding-bottom: 0.2em;
}

h3 {
    font-size: 1.25rem;
}

p,
ul,
ol,
dl {
    margin: 0 0 1em;
}

a {
    color:                 var(--link);
    text-decoration-thickness: 1px;
    text-underline-offset: 0.18em;
}

a:hover {
    text-decoration-thickness: 2px;
}

:focus-visible {
    outline:        2px solid var(--akzent);
    outline-offset: 2px;
}

code,
kbd {
    font-family:   var(--mono);
    font-size:     0.92em;
    background:    var(--flaeche-2);
    border:        1px solid var(--rand);
    border-radius: 4px;
    padding:       0.05em 0.35em;
}

mark,
.platzhalter {
    background:    var(--mark-bg);
    color:         var(--text);
    border-radius: 3px;
    padding:       0 0.25em;
}

.sr-only {
    position:   absolute;
    width:      1px;
    height:     1px;
    overflow:   hidden;
    clip:       rect(0 0 0 0);
    white-space: nowrap;
}

.springmarke {
    position:   absolute;
    left:       -999px;
    top:        0;
    background: var(--akzent);
    color:      var(--bg);
    padding:    0.5rem 1rem;
    z-index:    50;
}

.springmarke:focus {
    left: 1rem;
}

/* ---- Kopfzeile --------------------------------------------------------- */

.kopf {
    position:      sticky;
    top:           0;
    z-index:       20;
    background:    color-mix(in srgb, var(--bg) 92%, transparent);
    border-bottom: 1px solid var(--rand);
    backdrop-filter: blur(6px);
}

.kopf-innen {
    max-width:   var(--breite);
    margin:      0 auto;
    padding:     0.6rem 16px;
    display:     flex;
    flex-wrap:   wrap;
    align-items: center;
    gap:         0.6rem 1rem;
}

.logo {
    display:         flex;
    align-items:     center;
    gap:             0.55rem;
    color:           var(--text);
    text-decoration: none;
    font-family:     var(--serif);
    font-size:       1.3rem;
    font-weight:     700;
    margin-right:    auto;
}

.logo svg {
    width:  2rem;
    height: 2rem;
    flex:   none;
}

.nav ul {
    list-style: none;
    margin:     0;
    padding:    0;
    display:    flex;
    flex-wrap:  wrap;
    gap:        0.2rem;
}

.nav a {
    display:         block;
    padding:         0.3rem 0.6rem;
    border-radius:   6px;
    color:           var(--text-2);
    text-decoration: none;
    font-size:       0.95rem;
}

.nav a:hover {
    color:      var(--text);
    background: var(--flaeche);
}

.nav a[aria-current="page"] {
    color:      var(--akzent);
    background: var(--flaeche);
}

.kopf-werkzeuge {
    display:     flex;
    align-items: center;
    gap:         0.5rem;
}

.knopf {
    font:          inherit;
    font-size:     0.95rem;
    color:         var(--text);
    background:    var(--flaeche);
    border:        1px solid var(--rand);
    border-radius: 6px;
    padding:       0.35rem 0.7rem;
    cursor:        pointer;
    line-height:   1.3;
}

.knopf:hover {
    border-color: var(--rand-hell);
    background:   var(--flaeche-2);
}

.knopf-klein {
    font-size: 0.85rem;
    padding:   0.2rem 0.55rem;
}

.menue-knopf {
    display: none;
}

@media (max-width: 52rem) {
    .menue-knopf {
        display: inline-block;
    }

    .nav {
        order:      5;
        flex-basis: 100%;
        display:    none;
    }

    .nav.offen {
        display: block;
    }

    .nav ul {
        flex-direction: column;
    }

    .nav a {
        padding: 0.55rem 0.6rem;
    }
}

/* ---- Suche ------------------------------------------------------------- */

.suche {
    position: relative;
}

.suche input {
    font:          inherit;
    font-size:     0.95rem;
    width:         13rem;
    max-width:     100%;
    color:         var(--text);
    background:    var(--flaeche);
    border:        1px solid var(--rand);
    border-radius: 6px;
    padding:       0.35rem 0.6rem;
}

.suche-gross input {
    width:     100%;
    font-size: 1.1rem;
    padding:   0.7rem 0.9rem;
}

.suche-treffer {
    position:      absolute;
    top:           calc(100% + 4px);
    right:         0;
    width:         min(26rem, calc(100vw - 32px));
    max-height:    70vh;
    overflow-y:    auto;
    margin:        0;
    padding:       0.3rem;
    list-style:    none;
    background:    var(--flaeche);
    border:        1px solid var(--rand-hell);
    border-radius: var(--rund);
    box-shadow:    var(--schatten);
    z-index:       30;
}

.suche-gross .suche-treffer {
    left:  0;
    right: auto;
    width: 100%;
}

.suche-treffer[hidden] {
    display: none;
}

.suche-treffer a {
    display:         block;
    padding:         0.45rem 0.6rem;
    border-radius:   6px;
    text-decoration: none;
    color:           var(--text);
}

.suche-treffer a:hover,
.suche-treffer a.aktiv {
    background: var(--flaeche-2);
}

.suche-treffer small {
    display: block;
    color:   var(--text-2);
}

.suche-leer {
    padding: 0.5rem 0.6rem;
    color:   var(--text-2);
}

@media (max-width: 30rem) {
    .kopf-werkzeuge {
        flex-basis: 100%;
    }

    .kopf-werkzeuge .suche {
        flex: 1;
    }

    .suche input {
        width: 100%;
    }
}

/* ---- Inhalt ------------------------------------------------------------ */

main {
    flex:      1;
    width:     100%;
    max-width: var(--breite);
    margin:    0 auto;
    padding:   1.2rem 16px 3rem;
}

.schmal {
    max-width: 46rem;
}

.einleitung {
    font-size: 1.15rem;
    color:     var(--text-2);
    max-width: 46rem;
}

/* Karten sehen aus wie Fenster im Spiel: dunkle Fläche, goldener Rand,
   innen eine feine schwarze Kante */
.karte {
    background:    color-mix(in srgb, var(--flaeche) 93%, transparent);
    border:        1px solid var(--rand-hell);
    border-radius: var(--rund);
    padding:       1rem 1.1rem;
    box-shadow:    inset 0 0 0 1px #000000b3, var(--schatten);
}

.karte > :first-child {
    margin-top: 0;
}

.karte > :last-child {
    margin-bottom: 0;
}

/* Dungeon-Karten untereinander statt im Raster: pro Karte steht zu viel Text */
.stapel {
    display:        grid;
    gap:            1rem;
    margin:         1rem 0 1.5rem;
}

.karte h3 small {
    color:          var(--text-2);
    font-weight:    normal;
    font-size:      0.85em;
}

.karte ul {
    padding-left:   1.2rem;
}

.quelle {
    color:          var(--text-2);
    font-size:      0.9em;
}

.raster {
    display:               grid;
    grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
    gap:                   1rem;
    margin:                1rem 0 1.5rem;
}

.kachel {
    display:         block;
    color:           var(--text);
    text-decoration: none;
}

.kachel:hover {
    border-color: var(--akzent);
}

.kachel h3 {
    margin: 0 0 0.3rem;
    color:  var(--akzent);
}

.kachel p {
    margin: 0;
    color:  var(--text-2);
}

.etikett {
    display:       inline-block;
    font-size:     0.78rem;
    font-weight:   600;
    letter-spacing: 0.02em;
    border-radius: 999px;
    padding:       0.05rem 0.55rem;
    border:        1px solid currentColor;
    white-space:   nowrap;
    vertical-align: middle;
}

.etikett-ok {
    color:      var(--ok);
    background: var(--ok-bg);
}

.etikett-warn {
    color:      var(--warn);
    background: var(--warn-bg);
}

.etikett-bau {
    color:      var(--rubrik);
}

.hinweis {
    border-left:   4px solid var(--akzent);
    background:    var(--flaeche);
    padding:       0.7rem 1rem;
    border-radius: 0 var(--rund) var(--rund) 0;
    margin:        1rem 0 1.5rem;
}

.hinweis > :last-child {
    margin-bottom: 0;
}

.hinweis-bau {
    border-left-color: var(--rubrik);
}

.tabelle-rahmen {
    overflow-x:    auto;
    margin:        0 0 1.5rem;
    border:        1px solid var(--rand);
    border-radius: var(--rund);
}

table {
    width:           100%;
    border-collapse: collapse;
    font-size:       0.97rem;
}

th,
td {
    text-align:    left;
    vertical-align: top;
    padding:       0.55rem 0.75rem;
    border-bottom: 1px solid var(--rand);
}

th {
    font-family: var(--serif);
    background:  var(--flaeche-2);
}

tbody tr:last-child td {
    border-bottom: 0;
}

td code {
    white-space: nowrap;
}

.geplant {
    list-style: none;
    padding:    0;
}

.geplant li {
    padding:       0.6rem 0.8rem;
    border:        1px dashed var(--rand-hell);
    border-radius: var(--rund);
    margin-bottom: 0.6rem;
    color:         var(--text-2);
}

.geplant strong {
    color: var(--text);
}

/* ---- Fußzeile ---------------------------------------------------------- */

.fuss {
    border-top: 1px solid var(--rand);
    background: var(--bg-2);
    color:      var(--text-2);
    font-size:  0.9rem;
}

.fuss-innen {
    max-width: var(--breite);
    margin:    0 auto;
    padding:   1.2rem 16px 1.6rem;
    display:   grid;
    gap:       0.6rem;
}

.fuss p {
    margin: 0;
}

.fuss ul {
    list-style: none;
    padding:    0;
    margin:     0;
    display:    flex;
    flex-wrap:  wrap;
    gap:        0.3rem 1rem;
}

.fuss a {
    color: var(--text-2);
}

.fuss a:hover {
    color: var(--link);
}

/* ---- Druck ------------------------------------------------------------- */

@media print {
    .kopf,
    .fuss,
    .filter,
    .knopf {
        display: none !important;
    }

    body {
        background: #fff;
        color:      #000;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
        animation:  none !important;
    }
}
