@font-face { font-family: "Noto Sans"; src: url("fonts/NotoSans.ttf") format("truetype"); font-weight: 100 900; font-display: swap; }
/*
 * MineralZone Wiki - the in-game wiki window, rebuilt for the browser.
 *
 * Every value here has a counterpart in scripts/ui/WikiWindow.cs and scripts/ui/SciFiHudStyle.cs:
 * the panel colours, the 22px / 14px corner cut, the 360px sidebar, the 980px article column and
 * the corner accent ticks. When the game's look changes, this file is the place that has to
 * follow - see docs/wiki-backend-plan.md, section 6.
 */

@font-face {
    font-family: 'Oxanium';
    src: url('/assets/fonts/oxanium-regular.ttf') format('truetype');
    font-weight: 400;
    font-display: optional;
}

@font-face {
    font-family: 'Oxanium';
    src: url('/assets/fonts/oxanium-semibold.ttf') format('truetype');
    font-weight: 600;
    font-display: optional;
}

:root {
    /* Sonst zeichnet der Browser die Flaeche zwischen zwei Seitenaufrufen hell, was auf einer
       dunklen Seite bei jedem Wechsel als Blitz zu sehen ist. */
    color-scheme: dark;

    --bg: #04070c;
    --window-fill: rgba(0, 2, 3, 0.972);
    --window-line: rgba(10, 133, 230, 0.44);
    --window-glow: rgba(5, 117, 255, 0.09);
    --surface-fill: rgba(3, 8, 12, 0.94);
    --surface-line: rgba(33, 148, 240, 0.66);
    --surface-glow: rgba(10, 128, 255, 0.18);
    --tick: rgba(33, 148, 240, 0.34);

    --text: #e6faff;
    --muted: #8cb8d6;
    --accent: #14ebff;
    --accent-warm: #ff8c1f;
    --row-label: #7fb7d7;
    --mark-bg: #304724;
    --mark-fg: #f7ff9c;

    --sidebar: 360px;
    --gap: 14px;
    --edge: 18px;
    --article-max: 980px;
}

* {
    box-sizing: border-box;
}

/* The UA rule for [hidden] is display:none, but any author rule with a display beats it - and
   .hud-button, .entry and .lang-block all set one. Without this, hiding an element does nothing. */
[hidden] {
    display: none !important;
}

html,
body {
    height: 100%;
}

body {
    margin: 0;
    background: var(--bg);
    /* Nur der mittige Schein hinter dem Kopf. Ein zweiter, aussermittiger Verlauf unten links
       lief als schraege Kante quer durch den Hintergrund. */
    background-image:
        radial-gradient(1200px 560px at 50% -12%, rgba(20, 235, 255, 0.07), transparent 70%);
    background-attachment: fixed;
    color: var(--text);
    font-family: 'Oxanium', "Noto Sans", 'Segoe UI', system-ui, sans-serif;
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ---- the cut-corner panel ------------------------------------------- */

.panel {
    position: relative;
    --cut: 14px;
    --fill: var(--surface-fill);
    --line: var(--surface-line);
    --glow: var(--surface-glow);
}

.panel > * {
    position: relative;
    z-index: 1;
}

.panel::before,
.panel::after {
    content: '';
    position: absolute;
    clip-path: polygon(
        var(--cut) 0,
        calc(100% - var(--cut)) 0,
        100% var(--cut),
        100% calc(100% - var(--cut)),
        calc(100% - var(--cut)) 100%,
        var(--cut) 100%,
        0 calc(100% - var(--cut)),
        0 var(--cut)
    );
    pointer-events: none;
}

.panel::before {
    inset: 0;
    background: var(--line);
    filter: drop-shadow(0 0 22px var(--glow));
}

/* The fill sits 1px inside the border layer; the eight gradient bars are the corner accent
   ticks the game draws in DrawCornerDetails(). */
.panel::after {
    inset: 1px;
    background-color: var(--fill);
    background-repeat: no-repeat;
    background-image:
        linear-gradient(var(--tick), var(--tick)), linear-gradient(var(--tick), var(--tick)),
        linear-gradient(var(--tick), var(--tick)), linear-gradient(var(--tick), var(--tick)),
        linear-gradient(var(--tick), var(--tick)), linear-gradient(var(--tick), var(--tick)),
        linear-gradient(var(--tick), var(--tick)), linear-gradient(var(--tick), var(--tick));
    background-size:
        28px 1px, 1px 28px,
        28px 1px, 1px 28px,
        28px 1px, 1px 28px,
        28px 1px, 1px 28px;
    background-position:
        calc(var(--cut) + 5px) 5px, 5px calc(var(--cut) + 5px),
        calc(100% - var(--cut) - 5px) 5px, calc(100% - 5px) calc(var(--cut) + 5px),
        calc(var(--cut) + 5px) calc(100% - 5px), 5px calc(100% - var(--cut) - 5px),
        calc(100% - var(--cut) - 5px) calc(100% - 5px), calc(100% - 5px) calc(100% - var(--cut) - 5px);
}

/* ---- window --------------------------------------------------------- */

.window {
    --cut: 22px;
    --fill: var(--window-fill);
    --line: var(--window-line);
    --glow: var(--window-glow);
    min-height: 100vh;
    padding: 16px var(--edge) var(--edge);
    display: flex;
    flex-direction: column;
}

.window-head {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 86px;
    padding: 6px 4px 0;
}

.window-head .titles {
    flex: 1 1 auto;
    min-width: 0;
}

.window-head h1 {
    margin: 0;
    font-size: clamp(30px, 4.6vw, 52px);
    font-weight: 600;
    line-height: 1;
    letter-spacing: 0.02em;
    color: #dbf5ff;
    text-shadow: 0 0 3px rgba(0, 5, 10, 0.96), 0 0 26px rgba(20, 160, 255, 0.25);
}

.window-head h1 a.plain {
    color: inherit;
    text-decoration: none;
}

.window-head .sub {
    margin: 4px 0 0;
    font-size: 14px;
    color: var(--muted);
}

.head-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
}

.hud-button {
    --cut: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 16px;
    color: var(--text);
    font: inherit;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    font-size: 12px;
    background: none;
    border: 0;
    cursor: pointer;
}

.hud-button:hover {
    color: var(--accent);
    text-decoration: none;
}

.hud-button.is-active {
    color: var(--accent);
}

.lang-switch {
    display: flex;
    align-items: center;
    gap: 6px;
}

.lang-switch select {
    min-height: 34px;
    padding: 4px 8px;
    color: var(--text);
    font: inherit;
    font-size: 13px;
    background: rgba(4, 12, 20, 0.92);
    border: 1px solid rgba(33, 148, 240, 0.42);
    border-radius: 0;
    outline: none;
}

.lang-switch select:focus {
    border-color: var(--accent);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

.window-body {
    display: grid;
    grid-template-columns: var(--sidebar) minmax(0, 1fr);
    gap: var(--gap);
    align-items: start;
    margin-top: 20px;
    flex: 1 1 auto;
}

/* Pages without a sidebar (admin, error). A style attribute cannot do this: the CSP has no
   'unsafe-inline', so inline styles are dropped. */
.window-body.single {
    grid-template-columns: minmax(0, 1fr);
}

/* ---- sidebar -------------------------------------------------------- */

.sidebar {
    padding: 16px 18px;
    position: sticky;
    top: 16px;
    max-height: calc(100vh - 32px);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.search-form {
    display: flex;
    gap: 8px;
}

.search-form input[type='search'],
.field input[type='text'],
.field input[type='password'],
.field input[type='number'],
.field select,
.field textarea {
    width: 100%;
    min-height: 38px;
    padding: 6px 10px;
    color: var(--text);
    font: inherit;
    background: rgba(4, 12, 20, 0.92);
    border: 1px solid rgba(33, 148, 240, 0.42);
    border-radius: 0;
    outline: none;
}

.search-form input[type='search']:focus,
.field input:focus,
.field select:focus,
.field textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px rgba(20, 235, 255, 0.25);
}

.entry-list {
    overflow-y: auto;
    margin: 0 -6px;
    padding: 0 6px;
    flex: 1 1 auto;
}

.entry-list::-webkit-scrollbar {
    width: 8px;
}

.entry-list::-webkit-scrollbar-thumb {
    background: rgba(33, 148, 240, 0.35);
}

.category {
    margin-bottom: 8px;
}

.category > summary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 4px;
    list-style: none;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--cat, var(--accent));
    border-bottom: 1px solid rgba(33, 148, 240, 0.18);
}

.category > summary::-webkit-details-marker {
    display: none;
}

/* Accent bar plus the collapse arrow: right when closed, down when open. */
.category > summary::before {
    content: '';
    width: 3px;
    height: 14px;
    background: var(--cat, var(--accent));
    flex: 0 0 auto;
}

.category > summary .caret {
    flex: 0 0 auto;
    width: 0;
    height: 0;
    margin-right: 2px;
    border-top: 4px solid transparent;
    border-bottom: 4px solid transparent;
    border-left: 5px solid var(--cat, var(--accent));
    transition: transform 0.12s ease-out;
}

.category[open] > summary .caret {
    transform: rotate(90deg) translateX(1px);
}

.entry-empty {
    margin: 14px 4px;
    color: var(--muted);
    font-size: 13px;
}

.entry[hidden],
.category[hidden] {
    display: none;
}

.category > summary .count {
    margin-left: auto;
    color: var(--muted);
    font-weight: 400;
    letter-spacing: 0;
}

.entry {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 8px 5px 16px;
    color: var(--text);
    font-size: 14px;
    border-left: 2px solid transparent;
}

.entry:hover {
    background: rgba(20, 160, 255, 0.08);
    border-left-color: var(--cat, var(--accent));
    text-decoration: none;
}

.entry.is-current {
    background: rgba(20, 160, 255, 0.14);
    border-left-color: var(--cat, var(--accent));
    color: #ffffff;
}

.entry img,
.entry .icon-slot {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
    object-fit: contain;
    opacity: 0.9;
}

/* ---- article -------------------------------------------------------- */

.article {
    padding: 18px 22px 28px;
    min-height: 60vh;
}

.article-head {
    display: flex;
    align-items: center;
    gap: 14px;
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(33, 148, 240, 0.2);
}

.article-head img {
    width: 54px;
    height: 54px;
    object-fit: contain;
    flex: 0 0 auto;
}

.article-head h2 {
    margin: 0;
    font-size: 30px;
    font-weight: 600;
    line-height: 1.15;
}

.article-head .cat {
    display: inline-block;
    margin-top: 2px;
    font-size: 12px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--cat, var(--accent));
}

.article-content {
    max-width: var(--article-max);
    margin-top: 18px;
}

.article-content p {
    margin: 0 0 14px;
}

.article-content ul,
.article-content ol {
    margin: 0 0 14px;
    padding-left: 22px;
}

.article-content li {
    margin-bottom: 4px;
}

.article-content blockquote {
    margin: 0 0 14px;
    padding-left: 14px;
    border-left: 2px solid rgba(33, 148, 240, 0.4);
    color: var(--muted);
}

.article-content code {
    padding: 1px 5px;
    background: rgba(20, 160, 255, 0.12);
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 0.92em;
}

.article-content .bb-img {
    max-width: 100%;
    height: auto;
}

.article-content .bb-center {
    text-align: center;
}

.article-content .bb-right {
    text-align: right;
}

.article-content .bb-mark {
    padding: 0 2px;
}

.bb-table-scroll {
    overflow-x: auto;
    margin-bottom: 14px;
}

kbd {
    display: inline-block;
    min-width: 22px;
    padding: 1px 6px;
    font-family: inherit;
    font-size: 0.88em;
    text-align: center;
    color: var(--accent);
    background: rgba(4, 14, 24, 0.9);
    border: 1px solid rgba(33, 148, 240, 0.5);
}

/* ---- generated value tables ----------------------------------------- */

.stats {
    max-width: var(--article-max);
    margin-top: 26px;
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
}

.stats-block h3 {
    margin: 0 0 8px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
}

.stats-block table {
    width: 100%;
    border-collapse: collapse;
}

.stats-block td {
    padding: 4px 8px 4px 0;
    vertical-align: top;
    border-bottom: 1px solid rgba(33, 148, 240, 0.12);
}

.stats-block td.label {
    color: var(--row-label);
    white-space: nowrap;
    width: 1%;
}

.stats-block td.value {
    font-weight: 600;
}

.stats-block ul {
    margin: 0;
    padding-left: 18px;
}

.stats-note {
    max-width: var(--article-max);
    margin-top: 18px;
    font-size: 12px;
    color: var(--muted);
}

/* ---- tier picker (value table of upgradeable entries) ---------------- */

.tier-picker {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 10px;
}

.tier-picker input[type='range'] {
    flex: 1 1 auto;
    min-width: 0;
    accent-color: var(--accent);
    cursor: pointer;
}

.tier-step {
    flex: 0 0 auto;
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 1px solid rgba(10, 133, 230, 0.45);
    background: rgba(6, 16, 24, 0.82);
    color: #cfe6f5;
    font: inherit;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
}

.tier-step:hover:not(:disabled) {
    border-color: rgba(140, 228, 255, 0.8);
    color: #fff;
}

.tier-step:disabled {
    opacity: 0.35;
    cursor: default;
}

.tier-value {
    flex: 0 0 auto;
    min-width: 5.5em;
    text-align: right;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--accent);
}

.scale-picker {
    display: grid;
    gap: 8px;
    margin: 0 0 10px;
}

.scale-night {
    display: flex;
    align-items: center;
    gap: 8px;
}

.scale-night input[type='range'] {
    flex: 1 1 auto;
    min-width: 0;
    accent-color: var(--accent);
    cursor: pointer;
}

.scale-value {
    min-width: 9em;
}

.scale-difficulty {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.scale-diff {
    padding: 5px 12px;
    border: 1px solid rgba(10, 133, 230, 0.45);
    background: rgba(6, 16, 24, 0.82);
    color: #cfe6f5;
    font: inherit;
    font-size: 13px;
    cursor: pointer;
}

.scale-diff:hover {
    border-color: rgba(140, 228, 255, 0.8);
    color: #fff;
}

.scale-diff.is-active {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(20, 235, 255, 0.1);
}

/* ---- speed tier switch (transport pieces) ---------------------------- */

.variant-picker {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.variant-picker .scale-diff {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.variant-picker img {
    width: 18px;
    height: 18px;
}

/* ---- overview, search, misc ----------------------------------------- */

.lede {
    max-width: var(--article-max);
    color: var(--muted);
    margin: 0 0 22px;
}

.card-grid {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
}

.card {
    display: block;
    padding: 12px 14px;
    color: var(--text);
    background: rgba(8, 18, 28, 0.55);
    border: 1px solid rgba(33, 148, 240, 0.22);
    border-left-width: 3px;
    border-left-color: var(--cat, var(--accent));
}

.card:hover {
    background: rgba(20, 160, 255, 0.1);
    text-decoration: none;
}

.card h3 {
    margin: 0 0 4px;
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card h3 img {
    width: 22px;
    height: 22px;
    object-fit: contain;
}

.card p {
    margin: 0;
    font-size: 13px;
    color: var(--muted);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.category-section {
    margin-bottom: 26px;
}

.category-section > h2 {
    margin: 0 0 10px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--cat, var(--accent));
    display: flex;
    align-items: center;
    gap: 8px;
}

.category-section > h2::before {
    content: '';
    width: 3px;
    height: 15px;
    background: var(--cat, var(--accent));
}

mark {
    background: var(--mark-bg);
    color: var(--mark-fg);
    padding: 0 2px;
}

.notice {
    padding: 10px 14px;
    border-left: 3px solid var(--accent-warm);
    background: rgba(255, 140, 31, 0.08);
    color: var(--text);
    margin-bottom: 16px;
}

.notice.bad {
    border-left-color: #ff3830;
    background: rgba(255, 56, 48, 0.08);
}

.notice.good {
    border-left-color: #3deb9e;
    background: rgba(61, 235, 158, 0.08);
}

.foot {
    max-width: var(--article-max);
    margin-top: 30px;
    padding-top: 12px;
    border-top: 1px solid rgba(33, 148, 240, 0.16);
    font-size: 12px;
    color: var(--muted);
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
}

/* ---- narrow windows -------------------------------------------------- */
/* The game never has this case; a browser does. The sidebar becomes a drawer above the article. */

@media (max-width: 900px) {
    :root {
        --edge: 10px;
    }

    .window-body {
        grid-template-columns: minmax(0, 1fr);
    }

    .sidebar {
        position: static;
        max-height: none;
    }

    .entry-list {
        max-height: 46vh;
    }
}

/* --- Bauschaubilder ------------------------------------------------------ */
/* Das Standbild traegt das Diagramm, bis three.js das Modell hat. Faellt WebGL
   oder der Ladevorgang aus, bleibt es stehen, statt ein leeres Feld zu zeigen. */
/* Reihenfolge im Quelltext ist die schmale Reihenfolge: Text, Schaubild, Werte.
   Ab genug Breite wandert das Schaubild in die Flaeche, die der Text frei laesst. */
.article-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 1280px) {
    .article-body.has-figures {
        grid-template-columns: minmax(0, 1fr) clamp(300px, 30vw, 440px);
        column-gap: 26px;
        align-items: start;
    }

    .article-body.has-figures > .article-content {
        grid-column: 1;
        grid-row: 1;
    }

    .article-body.has-figures > .article-figures {
        grid-column: 2;
        grid-row: 1 / span 3;
        align-self: start;
        position: sticky;
        top: 14px;
    }

    .article-body.has-figures > .article-figures .wiki-schematic,
    .article-body.has-figures > .article-figures .wiki-building-view {
        max-width: none;
        margin: 4px 0 18px;
    }

    .article-body.has-figures > .stats {
        grid-column: 1;
        grid-row: 2;
    }

    .article-body.has-figures > .stats-note {
        grid-column: 1;
        grid-row: 3;
    }
}

/* Auf sehr breiten Monitoren waechst das Schaubild mit: der Text braucht die
   zusaetzliche Breite nicht, das Diagramm schon. */
@media (min-width: 1700px) {
    .article-body.has-figures {
        grid-template-columns: minmax(0, 1fr) clamp(440px, 34vw, 700px);
        column-gap: 32px;
    }
}

/* Einzelansicht eines Gebaeudes: dasselbe Bild, das im Spiel im Artikel steht. */
.wiki-building-view {
    position: relative;
    margin: 2px 0 18px;
    max-width: 620px;
    /* Platz vorab reservieren: das Bild laedt verzoegert, und ohne feste Form
       springt die Spalte, wenn es ankommt. */
    aspect-ratio: 640 / 420;
    border: 1px solid rgba(10, 133, 230, .34);
    background: #43464a;
    overflow: hidden;
    clip-path: polygon(14px 0, 100% 0, 100% calc(100% - 14px), calc(100% - 14px) 100%, 0 100%, 0 14px);
}

.wiki-building-view img {
    display: block;
    width: 100%;
    height: auto;
}

.wiki-schematic {
    position: relative;
    margin: 2px 0 20px;
    max-width: 620px;
    aspect-ratio: 960 / 620;
    border: 1px solid rgba(10, 133, 230, .34);
    background: #1c2128;
    overflow: hidden;
    clip-path: polygon(14px 0, 100% 0, 100% calc(100% - 14px), calc(100% - 14px) 100%, 0 100%, 0 14px);
}

.wiki-schematic img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: opacity .3s ease;
}

.wiki-schematic.is-ready img {
    opacity: 0;
}

.wiki-schematic canvas {
    position: relative;
    display: block;
    width: 100%;
    height: auto;
}

/* Ziehen verschiebt den Ausschnitt. pan-y laesst die Seite senkrecht weiterscrollen,
   damit das Schaubild auf dem Handy keine Sperre wird. */
.wiki-schematic.is-interactive {
    cursor: grab;
    touch-action: pan-y;
}

.wiki-schematic.is-dragging {
    cursor: grabbing;
}

.wiki-schematic-controls {
    position: absolute;
    right: 8px;
    bottom: 8px;
    z-index: 3;
    display: flex;
    gap: 4px;
}

.wiki-schematic-controls button {
    width: 26px;
    height: 26px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 1px solid rgba(10, 133, 230, .45);
    background: rgba(6, 16, 24, .82);
    color: #cfe6f5;
    font: inherit;
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
}

.wiki-schematic-controls button:hover:not(:disabled) {
    border-color: rgba(140, 228, 255, .8);
    color: #fff;
}

.wiki-schematic-controls button:disabled {
    opacity: .35;
    cursor: default;
}

/* Beschriftung beim Zeigen auf ein Gebaeude im Schaubild. */
.wiki-schematic-label {
    position: absolute;
    z-index: 2;
    transform: translate(14px, -50%);
    padding: 3px 9px;
    border: 1px solid rgba(140, 228, 255, .45);
    background: rgba(6, 16, 24, .94);
    color: #cfe6f5;
    font-size: 13px;
    line-height: 1.3;
    white-space: nowrap;
    pointer-events: none;
}

.wiki-schematic-label.is-left {
    transform: translate(calc(-100% - 14px), -50%);
}
