/* =========================================================
   Konzept: Ein Werkstattheft.
   Oben Papier & Tinte (Handwerk), unten der dunkle Rack-Teil (System).
   Serif = Handwerk, Mono = System. Ein Akzent: Hanko-Zinnoberrot.
   ========================================================= */
:root {
    --paper: #f2ede3;
    --paper-deep: #e8e1d3;
    --ink: #1d1b17;
    --ink-soft: #4d483f;
    --ink-faint: #8a8376;
    --rule: #cbc2b0;
    --red: #b5381b;

    --sys-bg: #141517;
    --sys-bg-2: #1b1d20;
    --sys-ink: #e9e5dc;
    --sys-soft: #a9a59b;
    --sys-faint: #6f6c66;
    --sys-rule: #2d3034;
    --sys-red: #e2593a;

    --serif: 'Newsreader', 'Iowan Old Style', Georgia, serif;
    --mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
    --wrap: 1180px;
    --gutter: clamp(20px, 4vw, 48px);
}
@media (prefers-color-scheme: dark) {
    :root {
        --paper: #16140f;
        --paper-deep: #1e1b15;
        --ink: #ece6d9;
        --ink-soft: #b4ad9f;
        --ink-faint: #7d776b;
        --rule: #3a352b;
        --red: #e2593a;
        --sys-bg: #0d0e0f;
        --sys-bg-2: #141517;
    }
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 24px; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
    font-family: var(--serif);
    font-size: 19px;
    line-height: 1.55;
    font-optical-sizing: auto;
    background: var(--paper);
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}
a { color: inherit; }
::selection { background: var(--red); color: var(--paper); }
:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }
.mono { font-family: var(--mono); }
.kicker {
    font-family: var(--mono); font-size: 12px; font-weight: 500;
    letter-spacing: 0.08em; text-transform: uppercase;
    color: var(--ink-faint);
}

/* ===== Kopfzeile ===== */
.masthead { border-bottom: 1px solid var(--ink); }
.masthead .wrap {
    display: flex; align-items: center; justify-content: space-between;
    gap: 24px; padding-top: 18px; padding-bottom: 18px;
}
.brand { display: flex; align-items: center; gap: 14px; text-decoration: none; }
.hanko {
    display: grid; place-items: center;
    width: 38px; height: 38px;
    border: 2px solid var(--red); border-radius: 4px;
    color: var(--red);
    font-family: var(--serif); font-weight: 700; font-size: 17px; letter-spacing: -0.02em;
    transform: rotate(-3deg);
}
.brand-name { display: block; font-size: 19px; font-weight: 600; line-height: 1.1; letter-spacing: -0.01em; }
.brand-sub { display: block; font-family: var(--mono); font-size: 11px; color: var(--ink-faint); margin-top: 3px; }
.masthead nav { display: flex; gap: 26px; }
.masthead nav a {
    font-family: var(--mono); font-size: 13px; text-decoration: none; color: var(--ink-soft);
    padding: 4px 0; border-bottom: 1px solid transparent;
    transition: color .15s, border-color .15s;
}
.masthead nav a:hover { color: var(--ink); border-bottom-color: var(--red); }
@media (max-width: 860px) { .masthead nav { display: none; } }

/* ===== Hero ===== */
.hero { padding: clamp(56px, 9vw, 112px) 0 clamp(48px, 7vw, 88px); }
.hero .kicker { margin-bottom: 28px; }
.hero h1 {
    font-weight: 400;
    font-size: clamp(46px, 8.4vw, 112px);
    line-height: 0.98;
    letter-spacing: -0.035em;
    max-width: 14ch;
}
.hero h1 .sys {
    display: block;
    font-family: var(--mono); font-weight: 400;
    font-size: 0.74em; letter-spacing: -0.04em;
    margin-top: 0.12em;
}
.hero h1 .sys .amp { color: var(--red); }
.hero h1 .cursor {
    display: inline-block; width: 0.5em; height: 0.08em;
    background: var(--red); vertical-align: baseline; margin-left: 0.08em;
    animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .hero h1 .cursor { animation: none; } }

.hero-grid {
    display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
    gap: clamp(32px, 6vw, 96px);
    margin-top: clamp(40px, 6vw, 72px);
    padding-top: 28px; border-top: 1px solid var(--rule);
}
@media (max-width: 820px) { .hero-grid { grid-template-columns: 1fr; } }
.hero-text { font-size: clamp(19px, 1.7vw, 22px); line-height: 1.5; color: var(--ink-soft); }
.hero-text strong { color: var(--ink); font-weight: 600; }
.hero-text + .hero-text { margin-top: 0.9em; }

.index-list { list-style: none; }
.index-list li { border-bottom: 1px solid var(--rule); }
.index-list li:first-child { border-top: 1px solid var(--rule); }
.index-list a {
    display: flex; justify-content: space-between; align-items: baseline; gap: 16px;
    padding: 12px 0; text-decoration: none; font-size: 19px;
    transition: padding-left .2s ease, color .2s;
}
.index-list .idx-main { display: block; font-weight: 500; line-height: 1.25; }
.index-list .idx-sub { display: block; font-family: var(--mono); font-size: 11.5px; color: var(--ink-faint); margin-top: 2px; }
.index-list .idx-num { font-family: var(--mono); font-size: 12px; color: var(--ink-faint); white-space: nowrap; }
.index-list a:hover { padding-left: 8px; color: var(--red); }
.index-list a:hover .idx-num, .index-list a:hover .idx-sub { color: var(--red); }

/* ===== Kapitel (gemeinsames Raster) ===== */
.chapter { padding: clamp(64px, 9vw, 120px) 0; border-top: 1px solid var(--ink); }
.chapter-grid {
    display: grid; grid-template-columns: 200px minmax(0, 1fr);
    gap: clamp(24px, 4vw, 64px);
}
@media (max-width: 900px) { .chapter-grid { grid-template-columns: 1fr; } }
.chapter-head { position: relative; }
.chapter-head .num {
    display: block; font-family: var(--mono); font-size: 13px; color: var(--red);
    margin-bottom: 8px;
}
.chapter-head .label { display: block; font-family: var(--mono); font-size: 13px; line-height: 1.45; color: var(--ink-faint); text-transform: uppercase; letter-spacing: 0.06em; }
@media (min-width: 901px) { .chapter-head > div { position: sticky; top: 28px; } }

.chapter h2 {
    font-weight: 400; font-size: clamp(34px, 4.8vw, 60px);
    line-height: 1.04; letter-spacing: -0.03em; max-width: 18ch;
}
.lede {
    margin-top: 20px; max-width: 40em;
    font-size: clamp(19px, 1.6vw, 21px); color: var(--ink-soft); font-style: italic;
}

/* ===== Spalten (Zeitungssatz statt Karten) ===== */
.columns {
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-top: clamp(40px, 5vw, 64px);
    border-top: 1px solid var(--ink);
}
.columns { column-gap: 56px; }
.columns > article { position: relative; padding: 24px 0 8px; display: flex; flex-direction: column; }
.columns > article + article::before {
    content: ''; position: absolute; top: 0; bottom: 0; left: -28px;
    border-left: 1px solid var(--rule);
}
@media (max-width: 900px) {
    .columns { grid-template-columns: 1fr; }
    .columns > article { padding: 24px 0; border-bottom: 1px solid var(--rule); }
    .columns > article + article::before { display: none; }
}
.columns .kicker { font-size: 11px; margin-bottom: 14px; }
.columns h3 { font-size: 27px; font-weight: 500; line-height: 1.15; letter-spacing: -0.015em; margin-bottom: 12px; }
.columns p:not(.kicker) { font-size: 17.5px; line-height: 1.58; color: var(--ink-soft); flex-grow: 1; }
.tags {
    margin-top: 20px; padding-top: 12px; border-top: 1px dashed var(--rule);
    font-family: var(--mono); font-size: 12px; line-height: 1.7; color: var(--ink-faint);
    list-style: none; display: flex; flex-wrap: wrap; gap: 0 4px;
}
.tags li:not(:last-child)::after { content: " ·"; }

/* ===== Klingen: technische Zeichnung + Spezifikationsblatt ===== */
.drawing { margin-top: clamp(40px, 5vw, 64px); color: var(--ink); }
.drawing svg { display: block; width: 100%; height: auto; overflow: visible; }
.drawing .stroke { fill: none; stroke: currentColor; stroke-width: 1.3; stroke-linejoin: round; }
.drawing .thin { fill: none; stroke: currentColor; stroke-width: 0.8; opacity: 0.55; }
.drawing .lead { fill: none; stroke: var(--red); stroke-width: 0.9; }
.drawing .dot { fill: var(--red); }
.drawing text { font-family: var(--mono); font-size: 11px; fill: var(--ink-faint); letter-spacing: 0.04em; }
.drawing figcaption { margin-top: 10px; font-family: var(--mono); font-size: 11px; color: var(--ink-faint); text-align: right; }
@media (max-width: 640px) { .drawing text { font-size: 19px; } }

.specs { margin-top: clamp(32px, 4vw, 48px); border-top: 1px solid var(--ink); }
.spec {
    display: grid; grid-template-columns: 170px minmax(0, 1fr) minmax(0, 1.15fr);
    gap: 12px 40px; padding: 28px 0; border-bottom: 1px solid var(--rule);
}
@media (max-width: 900px) { .spec { grid-template-columns: 1fr; } }
.spec .role { font-family: var(--mono); font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--red); padding-top: 8px; }
.spec h3 { font-size: 28px; font-weight: 500; line-height: 1.15; letter-spacing: -0.015em; }
.spec .steel { margin-top: 8px; font-family: var(--mono); font-size: 13px; line-height: 1.55; color: var(--ink-faint); }
.spec p:not(.kicker) { font-size: 17.5px; color: var(--ink-soft); padding-top: 4px; }

/* ===== Der System-Teil (dunkel) ===== */
.system { background: var(--sys-bg); color: var(--sys-ink); }
.system ::selection { background: var(--sys-red); color: var(--sys-bg); }
.system-intro {
    border-top: 0;
    padding: 22px 0;
    background: var(--sys-bg-2);
    border-bottom: 1px solid var(--sys-rule);
    font-family: var(--mono); font-size: 12px; color: var(--sys-faint);
}
.system-intro .wrap { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.system-intro b { color: var(--sys-red); font-weight: 500; }
.system .chapter { border-top-color: var(--sys-rule); }
.system .chapter:first-of-type { border-top: 0; }
.system .chapter-head .num { color: var(--sys-red); }
.system .chapter-head .label { color: var(--sys-faint); }
.system .chapter h2 { font-family: var(--mono); font-weight: 400; font-size: clamp(28px, 3.8vw, 48px); letter-spacing: -0.045em; line-height: 1.1; max-width: 22ch; }
.system .lede { color: var(--sys-soft); font-style: normal; }
.system .kicker { color: var(--sys-faint); }
.system .tags { border-top-color: var(--sys-rule); color: var(--sys-faint); }

/* Rack-Einschübe für das Homelab */
.rack { margin-top: clamp(40px, 5vw, 64px); border: 1px solid var(--sys-rule); border-radius: 3px; }
.unit {
    position: relative;
    display: grid; grid-template-columns: 56px minmax(0, 1fr) minmax(0, 1.6fr);
    gap: 12px 36px; padding: 28px 28px 28px 0;
    border-top: 1px solid var(--sys-rule);
}
.unit:first-child { border-top: 0; }
.unit .u {
    font-family: var(--mono); font-size: 11px; color: var(--sys-faint);
    text-align: center; border-right: 1px solid var(--sys-rule);
    display: flex; flex-direction: column; align-items: center; gap: 10px; padding-top: 6px;
}
.unit .led { width: 6px; height: 6px; border-radius: 50%; background: #5fbf6a; }
.unit .led.amber { background: #e0a43a; }
.unit h3 { font-size: 26px; font-weight: 500; line-height: 1.15; letter-spacing: -0.015em; margin-top: 8px; }
.unit p:not(.kicker) { font-size: 17.5px; color: var(--sys-soft); }
.unit .tags { margin-top: 16px; }
@media (max-width: 900px) {
    .unit { grid-template-columns: 44px minmax(0, 1fr); padding-right: 20px; }
    .unit > :nth-child(3) { grid-column: 2; }
}

.system .columns { border-top-color: var(--sys-ink); }
.system .columns > article::before { border-left-color: var(--sys-rule) !important; }
.system .columns p:not(.kicker) { color: var(--sys-soft); }
@media (max-width: 900px) { .system .columns > article { border-bottom-color: var(--sys-rule); } }

/* Aura */
.aura {
    margin-top: clamp(56px, 7vw, 88px);
    display: grid; grid-template-columns: 120px minmax(0, 1fr) auto;
    gap: 28px 40px; align-items: start;
    padding: 32px; border: 1px solid var(--sys-rule); background: var(--sys-bg-2);
}
@media (max-width: 900px) { .aura { grid-template-columns: 80px minmax(0, 1fr); padding: 24px; } .aura .aura-links { grid-column: 1 / -1; } }
.aura img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; border-radius: 24%; clip-path: inset(1px round 24%); }
.aura .kicker { margin-bottom: 10px; }
.aura h3 { font-size: clamp(24px, 2.4vw, 30px); font-weight: 500; line-height: 1.2; letter-spacing: -0.015em; margin-bottom: 12px; }
.aura h3 em { font-style: italic; font-weight: 400; color: var(--sys-soft); }
.aura p:not(.kicker) { font-size: 17.5px; color: var(--sys-soft); max-width: 46em; }
.aura p strong { color: var(--sys-ink); font-weight: 600; font-family: var(--mono); font-size: 0.88em; }
.aura-links { display: flex; flex-direction: column; gap: 10px; min-width: 230px; }
.btn {
    display: flex; justify-content: space-between; align-items: center; gap: 20px;
    padding: 13px 16px; text-decoration: none;
    font-family: var(--mono); font-size: 13px;
    border: 1px solid var(--sys-ink); color: var(--sys-ink);
    transition: background .15s, color .15s, border-color .15s;
}
.btn.primary { background: var(--sys-ink); color: var(--sys-bg); }
.btn:hover { background: var(--sys-red); border-color: var(--sys-red); color: #fff; }
.btn .arr { transition: transform .2s; }
.btn:hover .arr { transform: translateX(3px); }
@media (max-width: 900px) { .aura-links { flex-direction: row; flex-wrap: wrap; } .btn { flex: 1 1 220px; } }

/* ===== Kontakt (Uplink-Knoten / Matrix-CRT) ===== */
.contact { padding: clamp(56px, 8vw, 112px) 0; border-top: 0; }
.contact .lede { font-style: normal; }

.uplink-grid {
    display: grid;
    grid-template-columns: minmax(270px, 370px) minmax(0, 1fr);
    gap: clamp(28px, 4.5vw, 56px);
    align-items: start;
}
@media (max-width: 960px) {
    .uplink-grid { grid-template-columns: 1fr; max-width: 600px; }
}

/* Operator CRT Monitor Frame */
.crt-monitor {
    --phosphor: #39ff7a;
    --phosphor-dim: rgba(57, 255, 122, 0.24);
    border: 1px solid var(--sys-rule);
    background: #090c0a;
    border-radius: 3px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 22px 54px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(57, 255, 122, 0.08);
    transition: border-color .25s, box-shadow .25s;
}
.crt-monitor:hover {
    border-color: rgba(57, 255, 122, 0.45);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6), 0 0 28px rgba(57, 255, 122, 0.12);
}
.crt-bar {
    display: flex; justify-content: space-between; align-items: center; gap: 10px;
    padding: 9px 13px;
    background: #0f1310;
    border-bottom: 1px solid #1e2620;
    font-family: var(--mono); font-size: 11px; color: #849c89;
    letter-spacing: 0.04em;
}
.crt-status { display: inline-flex; align-items: center; gap: 7px; color: var(--phosphor); font-weight: 500; }
.crt-led {
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--phosphor);
    box-shadow: 0 0 8px var(--phosphor);
    animation: crtPulse 2.4s ease-in-out infinite;
}
@keyframes crtPulse { 50% { opacity: 0.35; } }

.crt-screen {
    position: relative;
    aspect-ratio: 9 / 14;
    overflow: hidden;
    background: #050806;
}
.crt-screen img {
    width: 100%; height: 100%;
    object-fit: cover; object-position: center 18%;
    display: block;
    filter: contrast(1.06) saturate(1.05);
    transition: transform .4s ease, filter .3s ease;
    animation: subtleSignalShift 8.5s infinite;
}
.crt-monitor:hover .crt-screen img {
    animation-play-state: paused;
    filter: contrast(1.08) saturate(1.1);
}
.crt-matrix {
    position: absolute; inset: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    mix-blend-mode: screen;
    opacity: 0.55;
    transition: opacity .25s;
}
/* CRT Scanlines + Vignette */
.crt-screen::before {
    content: "";
    position: absolute; inset: 0;
    pointer-events: none;
    background:
        repeating-linear-gradient(
            0deg,
            rgba(0, 0, 0, 0.34) 0px,
            rgba(0, 0, 0, 0.34) 1px,
            transparent 1px,
            transparent 3px
        ),
        radial-gradient(circle at 50% 42%, transparent 55%, rgba(2, 6, 3, 0.72) 100%);
    z-index: 2;
}
/* Subtile horizontale Interferenz-Zeile */
.crt-screen::after {
    content: "";
    position: absolute; left: 0; right: 0; height: 3px; top: -10%;
    background: linear-gradient(90deg, transparent, rgba(57, 255, 122, 0.55), rgba(226, 89, 58, 0.45), transparent);
    opacity: 0.65;
    pointer-events: none;
    z-index: 3;
    animation: crtScanSweep 7.2s linear infinite;
}
@keyframes crtScanSweep {
    0% { top: -8%; opacity: 0; }
    8% { opacity: 0.75; }
    55% { top: 108%; opacity: 0.5; }
    56%, 100% { top: 108%; opacity: 0; }
}
@keyframes subtleSignalShift {
    0%, 91%, 94%, 96%, 100% { transform: translate3d(0, 0, 0); filter: contrast(1.06) saturate(1.05); }
    92% { transform: translate3d(-3px, 0, 0) skewX(-0.6deg); filter: contrast(1.22) hue-rotate(-8deg); }
    93% { transform: translate3d(3px, 1px, 0); }
    95% { transform: translate3d(-2px, 0, 0); }
}

.crt-hud {
    position: absolute; left: 12px; right: 12px; bottom: 12px;
    z-index: 4;
    display: flex; justify-content: space-between; align-items: flex-end; gap: 8px;
    font-family: var(--mono); font-size: 10.5px; line-height: 1.4;
    color: rgba(215, 255, 226, 0.88);
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.95);
    pointer-events: none;
}
.crt-hud .tag-box {
    background: rgba(8, 13, 10, 0.76);
    border: 1px solid rgba(57, 255, 122, 0.3);
    padding: 4px 8px;
    backdrop-filter: blur(3px);
}
.crt-hud .tux-badge { color: var(--phosphor); }

.crt-controls {
    display: flex; justify-content: space-between; align-items: center; gap: 10px;
    padding: 10px 13px;
    background: #0f1310;
    border-top: 1px solid #1e2620;
    font-family: var(--mono); font-size: 11px; color: #849c89;
}
.glitch-toggle {
    appearance: none;
    background: #141c16;
    color: var(--phosphor);
    border: 1px solid rgba(57, 255, 122, 0.4);
    padding: 5px 10px;
    font-family: var(--mono); font-size: 11px;
    letter-spacing: 0.04em;
    cursor: pointer;
    transition: background .15s, color .15s, border-color .15s, box-shadow .15s;
}
.glitch-toggle:hover {
    background: rgba(57, 255, 122, 0.14);
    border-color: var(--phosphor);
    box-shadow: 0 0 12px rgba(57, 255, 122, 0.25);
}
.glitch-toggle[aria-pressed="true"] {
    background: var(--sys-red);
    color: #fff;
    border-color: var(--sys-red);
    box-shadow: 0 0 16px rgba(226, 89, 58, 0.5);
}

/* Overclock / Crash-Glitch-Modus ("abstürzender Computer") */
.uplink-stage.is-glitching .crt-screen img {
    animation: heavyCrashGlitch 0.36s steps(2) infinite !important;
}
.uplink-stage.is-glitching .crt-matrix {
    opacity: 0.92;
}
.uplink-stage.is-glitching .crt-led {
    background: var(--sys-red);
    box-shadow: 0 0 10px var(--sys-red);
    animation-duration: 0.18s;
}
.uplink-stage.is-glitching .uplink-terminal {
    animation: terminalJitter 0.42s steps(2) infinite;
    border-color: rgba(226, 89, 58, 0.65);
}
@keyframes heavyCrashGlitch {
    0% { transform: translate(0, 0) scale(1.01); filter: contrast(1.35) saturate(1.4); }
    20% { transform: translate(-7px, 2px) skewX(-2.5deg); filter: contrast(1.6) hue-rotate(25deg); }
    40% { transform: translate(6px, -3px) skewX(1.8deg); filter: invert(0.08) contrast(1.45); }
    60% { transform: translate(-4px, -1px); filter: contrast(1.5) saturate(1.8) hue-rotate(-20deg); }
    80% { transform: translate(5px, 2px) skewX(-1.2deg); }
    100% { transform: translate(0, 0); }
}
@keyframes terminalJitter {
    0%, 100% { transform: translate(0, 0); }
    25% { transform: translate(-1.5px, 0.5px); }
    75% { transform: translate(1.5px, -0.5px); }
}

/* Rechte Spalte: Uplink-Terminal & Kanäle */
.uplink-panel h2 {
    margin-bottom: 14px;
}
.uplink-terminal {
    margin-top: 26px;
    border: 1px solid var(--sys-rule);
    background: var(--sys-bg-2);
    border-radius: 3px;
    overflow: hidden;
    transition: border-color .2s;
}
.term-head {
    display: flex; justify-content: space-between; align-items: center; gap: 12px;
    padding: 9px 16px;
    background: #111315;
    border-bottom: 1px solid var(--sys-rule);
    font-family: var(--mono); font-size: 11.5px; color: var(--sys-faint);
}
.term-dots { display: inline-flex; gap: 6px; }
.term-dots i { width: 8px; height: 8px; border-radius: 50%; background: #2d3136; display: inline-block; }
.term-dots i:first-child { background: var(--sys-red); }
.term-dots i:nth-child(2) { background: #e0a43a; }
.term-dots i:nth-child(3) { background: #39ff7a; }

.term-log {
    padding: 16px 20px;
    font-family: var(--mono); font-size: 12.5px; line-height: 1.75;
    color: var(--sys-soft);
    border-bottom: 1px solid var(--sys-rule);
    background: rgba(10, 12, 11, 0.55);
}
.term-log div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.term-log .ok { color: #39ff7a; }
.term-log .warn { color: #e0a43a; }
.term-log .err { color: var(--sys-red); }
.term-log .cmd { color: var(--sys-ink); }

.uplink-channels {
    padding: 18px 20px 20px;
}
.uplink-channels .ch-title {
    font-family: var(--mono); font-size: 11px; text-transform: uppercase;
    letter-spacing: 0.08em; color: var(--sys-faint);
    margin-bottom: 12px;
}
.ch-grid {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}
@media (max-width: 620px) { .ch-grid { grid-template-columns: 1fr; } }
.ch-btn {
    display: flex; justify-content: space-between; align-items: center; gap: 10px;
    padding: 11px 13px;
    border: 1px solid var(--sys-rule);
    background: #141619;
    text-decoration: none;
    font-family: var(--mono); font-size: 12.5px; color: var(--sys-ink);
    transition: border-color .15s, background .15s, transform .15s;
}
.ch-btn .ch-id { color: #39ff7a; font-size: 11px; margin-right: 6px; }
.ch-btn .ch-arr { color: var(--sys-faint); transition: transform .15s, color .15s; }
.ch-btn:hover {
    border-color: #39ff7a;
    background: rgba(57, 255, 122, 0.06);
}
.ch-btn:hover .ch-arr { transform: translateX(3px); color: #39ff7a; }

.uplink-direct {
    margin-top: 24px;
    padding: 22px 24px;
    border: 1px solid var(--sys-rule);
    background: var(--sys-bg-2);
    display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 16px 24px;
}
.uplink-direct .dir-label {
    display: block;
    font-family: var(--mono); font-size: 11px; text-transform: uppercase;
    letter-spacing: 0.08em; color: var(--sys-faint); margin-bottom: 6px;
}
.mail {
    display: inline-block;
    font-family: var(--mono);
    font-size: clamp(18px, 2.5vw, 28px); font-weight: 500; letter-spacing: -0.02em; line-height: 1.2;
    text-decoration: none; word-break: break-all;
    color: var(--sys-ink);
    background-image: linear-gradient(var(--sys-red), var(--sys-red));
    background-size: 100% 2px; background-position: 0 100%; background-repeat: no-repeat;
    padding-bottom: 4px;
    transition: color .2s, background-size .3s;
}
.mail:hover { color: #39ff7a; background-image: linear-gradient(#39ff7a, #39ff7a); background-size: 100% 3px; }
.mail .arr { font-family: var(--mono); font-size: 0.75em; vertical-align: middle; margin-left: 0.35em; color: var(--sys-red); }
.mail:hover .arr { color: #39ff7a; }

.copy-btn {
    appearance: none;
    background: transparent;
    border: 1px solid var(--sys-ink);
    color: var(--sys-ink);
    font-family: var(--mono); font-size: 12px;
    padding: 10px 15px;
    cursor: pointer;
    transition: background .15s, color .15s, border-color .15s;
    white-space: nowrap;
}
.copy-btn:hover {
    background: var(--sys-red);
    border-color: var(--sys-red);
    color: #fff;
}
.copy-btn.is-copied {
    background: #39ff7a;
    border-color: #39ff7a;
    color: #08110b;
    font-weight: 500;
}

.uplink-specs {
    margin-top: 18px;
    display: flex; flex-wrap: wrap; gap: 8px 20px;
    font-family: var(--mono); font-size: 11.5px; color: var(--sys-faint);
}
.uplink-specs span b { color: var(--sys-soft); font-weight: 500; }

@media (prefers-reduced-motion: reduce) {
    .crt-screen img, .crt-screen::after, .crt-led { animation: none !important; }
}

/* ===== Fußzeile ===== */
footer { border-top: 1px solid var(--ink); }
footer .wrap {
    display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px 24px;
    padding-top: 22px; padding-bottom: 28px;
    font-family: var(--mono); font-size: 12px; color: var(--ink-faint);
}
footer .name { color: var(--ink); font-weight: 500; }
footer a {
    color: var(--ink-soft);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: color .15s, border-color .15s;
}
footer a:hover, footer a[aria-current="page"] {
    color: var(--red);
    border-bottom-color: var(--red);
}
.unit a.inline-link {
    color: var(--sys-ink);
    text-decoration: underline;
    text-decoration-color: var(--sys-red);
    text-underline-offset: 3px;
    transition: color .15s;
}
.unit a.inline-link:hover { color: var(--sys-red); }

/* ===== Mehrseitig (20.10.2026) ===== */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 0.22s; }
@media (prefers-reduced-motion: reduce) {
    @view-transition { navigation: none; }
}

body { min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1 0 auto; }
main > .chapter:first-child, .system > .chapter:first-child { border-top: 0; }
.masthead nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--red); }
@media (max-width: 860px) {
    .masthead .wrap { flex-direction: column; align-items: flex-start; gap: 14px; }
    .masthead nav { display: flex; flex-wrap: wrap; gap: 6px 20px; }
    .masthead nav a { white-space: nowrap; }
}

/* Dunkle System-Seiten: Kopf & Fuß gehen mit ins Rack */
body.is-system {
    --paper: var(--sys-bg); --paper-deep: var(--sys-bg-2);
    --ink: var(--sys-ink); --ink-soft: var(--sys-soft); --ink-faint: var(--sys-faint);
    --rule: var(--sys-rule); --red: var(--sys-red);
}
body.is-system .masthead, body.is-system footer { border-color: var(--sys-rule); }
body.is-system .drawing { color: var(--sys-ink); }
body.is-system .drawing .lead { stroke: var(--sys-red); }
body.is-system .drawing .dot { fill: var(--sys-red); }
body.is-system .drawing text, body.is-system .drawing figcaption { fill: var(--sys-faint); color: var(--sys-faint); }

/* Blättern zwischen den Kapiteln */
.pager { border-top: 1px solid var(--rule); }
.pager .wrap { display: grid; grid-template-columns: 1fr 1fr; }
.pager a {
    display: block; padding: 28px 0 32px; text-decoration: none;
    transition: color .15s;
}
.pager a + a, .pager .next { text-align: right; grid-column: 2; }
.pager .k { display: block; font-family: var(--mono); font-size: 12px; color: var(--ink-faint); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 6px; }
.pager .t { font-size: clamp(22px, 2.4vw, 30px); letter-spacing: -0.02em; }
.pager a:hover { color: var(--red); }
.pager a:hover .k { color: var(--red); }

/* =========================================================
   Interaktive Kapitel-Animationen & Werkstatt-Telemetrie
   ========================================================= */

/* Hanko-Stempel-Animation (Startseite & Kopfzeile) */
.hanko {
    position: relative;
    cursor: pointer;
    user-select: none;
    transition: transform .18s cubic-bezier(.2,1.4,.4,1), box-shadow .18s, background .18s, color .18s;
}
.hanko:hover {
    transform: rotate(-6deg) scale(1.06);
    box-shadow: 0 0 0 2px rgba(181, 56, 27, 0.18);
}
.hanko.is-stamped {
    animation: hankoStamp 0.48s cubic-bezier(.22, 1.35, .36, 1);
    background: var(--red);
    color: var(--paper);
}
@keyframes hankoStamp {
    0% { transform: scale(1.65) rotate(-14deg); opacity: 0.25; }
    55% { transform: scale(0.92) rotate(-2deg); opacity: 1; }
    80% { transform: scale(1.04) rotate(-4deg); }
    100% { transform: scale(1) rotate(-3deg); }
}

/* Gemeinsame Steuerleiste unter technischen Zeichnungen */
.drawing-bar {
    display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px 18px;
    margin-top: 12px; padding-top: 10px;
    border-top: 1px dashed var(--rule);
    font-family: var(--mono); font-size: 11px; color: var(--ink-faint);
}
body.is-system .drawing-bar { border-top-color: var(--sys-rule); color: var(--sys-faint); }
.drawing-bar .tele-readout {
    display: inline-flex; align-items: center; gap: 8px;
    color: var(--ink-soft);
}
body.is-system .drawing-bar .tele-readout { color: var(--sys-soft); }
.drawing-bar .tele-dot {
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--red);
    display: inline-block;
    animation: blink 1.4s ease-in-out infinite;
}
body.is-system .drawing-bar .tele-dot { background: #39ff7a; box-shadow: 0 0 6px #39ff7a; }
.drawing-btn {
    appearance: none;
    background: transparent;
    color: var(--ink);
    border: 1px solid var(--ink);
    padding: 5px 11px;
    font-family: var(--mono); font-size: 11px;
    letter-spacing: 0.04em;
    cursor: pointer;
    transition: background .15s, color .15s, border-color .15s, transform .15s;
}
.drawing-btn:hover {
    background: var(--red);
    border-color: var(--red);
    color: var(--paper);
}
.drawing-btn[aria-pressed="true"] {
    background: var(--red);
    border-color: var(--red);
    color: #fff;
}
body.is-system .drawing-btn {
    color: var(--sys-ink);
    border-color: var(--sys-rule);
    background: var(--sys-bg-2);
}
body.is-system .drawing-btn:hover {
    border-color: #39ff7a;
    color: #39ff7a;
}
body.is-system .drawing-btn[aria-pressed="true"] {
    background: var(--sys-red);
    border-color: var(--sys-red);
    color: #fff;
}

/* 00: Index-Telemetrie-Konsole (index.html) */
.sys-preview {
    margin-top: 26px;
    padding: 14px 16px;
    border: 1px solid var(--rule);
    background: var(--paper-deep);
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    font-family: var(--mono); font-size: 11.5px; color: var(--ink-soft);
}
.sys-preview .sp-left { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.sys-preview .sp-tag { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--red); }
.sys-preview .sp-status { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sys-preview svg { width: 150px; height: 34px; flex-shrink: 0; overflow: visible; }
.sys-preview svg path { fill: none; stroke: var(--red); stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }

/* 01: Genuss & Klang Animationen */
#genuss .pour-stream {
    stroke: var(--red);
    stroke-width: 1.3;
    stroke-dasharray: 4 4;
    animation: pourFlow 0.7s linear infinite;
}
#genuss.is-overdrive .pour-stream {
    stroke-width: 1.8;
    animation-duration: 0.35s;
}
@keyframes pourFlow {
    to { stroke-dashoffset: -16; }
}
#genuss .coffee-drop {
    fill: var(--red);
    animation: dropFall 1.35s cubic-bezier(.4, 0, .8, 1) infinite;
}
#genuss.is-overdrive .coffee-drop {
    animation-duration: 0.68s;
}
@keyframes dropFall {
    0% { transform: translateY(0); opacity: 0; }
    20% { opacity: 1; }
    85% { opacity: 1; }
    100% { transform: translateY(22px); opacity: 0; }
}
#genuss .coffee-steam {
    fill: none; stroke: currentColor; stroke-width: 0.8; opacity: 0.4;
    stroke-dasharray: 3 3;
    animation: steamRise 2.6s ease-in-out infinite;
}
@keyframes steamRise {
    0%, 100% { transform: translateY(0); opacity: 0.2; }
    50% { transform: translateY(-6px); opacity: 0.55; }
}

/* 02: Klingen – Hamaguri-Schimmer & Laser-Geometrie */
#klingen .blade-shimmer {
    fill: none;
    stroke: var(--red);
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-dasharray: 55 620;
    stroke-dashoffset: 675;
    animation: bladeGlint 5.2s ease-in-out infinite;
}
#klingen.is-inspect .blade-shimmer {
    stroke-width: 2.2;
    animation-duration: 2.1s;
}
@keyframes bladeGlint {
    0% { stroke-dashoffset: 675; opacity: 0; }
    15% { opacity: 0.95; }
    75% { opacity: 0.95; }
    100% { stroke-dashoffset: 0; opacity: 0; }
}
#klingen .laser-overlay {
    opacity: 0;
    transition: opacity .28s ease;
    pointer-events: none;
}
#klingen.is-inspect .laser-overlay {
    opacity: 1;
}
#klingen.is-inspect .damascus-wave {
    stroke: var(--red);
    opacity: 0.85;
}
.spec {
    transition: background .2s, padding-left .2s, border-color .2s;
}
.spec.is-highlighted {
    background: var(--paper-deep);
    padding-left: 14px;
    border-bottom-color: var(--red);
}

/* 03: Homelab – Paketfluss & Rack-Telemetrie */
#homelab .net-packet {
    fill: #39ff7a;
    filter: drop-shadow(0 0 4px rgba(57, 255, 122, 0.8));
}
#homelab.is-failover .net-packet {
    fill: var(--sys-red);
    filter: drop-shadow(0 0 5px rgba(226, 89, 58, 0.9));
}
#homelab .node-box {
    transition: stroke .25s, fill .25s;
}
#homelab.is-failover .node-box {
    stroke: var(--sys-red);
}
.unit .led {
    transition: background .2s, box-shadow .2s;
    box-shadow: 0 0 6px rgba(95, 191, 106, 0.65);
    animation: rackLedBlink 2.8s infinite;
}
.unit:nth-child(2) .led { animation-delay: 0.7s; animation-duration: 1.9s; }
.unit .led.amber {
    box-shadow: 0 0 6px rgba(224, 164, 58, 0.65);
    animation-duration: 3.4s;
}
#homelab.is-failover .unit .led {
    background: var(--sys-red);
    box-shadow: 0 0 10px var(--sys-red);
    animation-duration: 0.35s;
}
@keyframes rackLedBlink {
    0%, 100% { opacity: 1; }
    42% { opacity: 0.45; }
    48% { opacity: 0.95; }
    54% { opacity: 0.3; }
}

/* 04: Autonome KI – Neural & Agent Pipeline */
#ki .ai-pulse-ring {
    fill: none;
    stroke: var(--sys-red);
    stroke-width: 1;
    transform-origin: 450px 72px;
    animation: aiCorePulse 2.8s ease-out infinite;
}
#ki.is-dispatching .ai-pulse-ring {
    stroke: #39ff7a;
    animation-duration: 1.1s;
}
@keyframes aiCorePulse {
    0% { transform: scale(0.85); opacity: 0.85; }
    100% { transform: scale(1.55); opacity: 0; }
}
#ki .ai-link-flow {
    fill: none;
    stroke: #39ff7a;
    stroke-width: 1.4;
    stroke-dasharray: 6 12;
    animation: aiTokenStream 1.4s linear infinite;
    opacity: 0.65;
}
#ki.is-dispatching .ai-link-flow {
    stroke: var(--sys-red);
    stroke-width: 2;
    animation-duration: 0.45s;
    opacity: 1;
}
@keyframes aiTokenStream {
    to { stroke-dashoffset: -36; }
}
.aura img {
    transition: transform .3s ease, box-shadow .3s ease;
}
#ki.is-dispatching .aura img {
    box-shadow: 0 0 24px rgba(226, 89, 58, 0.45);
    transform: scale(1.03);
}

@media (prefers-reduced-motion: reduce) {
    #genuss .pour-stream, #genuss .coffee-drop, #genuss .coffee-steam,
    #klingen .blade-shimmer, .unit .led, #ki .ai-pulse-ring, #ki .ai-link-flow {
        animation: none !important;
    }
}
