/* stellwrk Webseite – dunkles, technisches Erscheinungsbild.
   Leitmotiv: das Gleisband (Schienen und Schwellen) als Trenner; Farben wie die Software (Blockplan: frei grau, reserviert gelb, belegt rot). */

:root {
  --bg: #0d1620;
  --bg-raised: #131f2b;
  --bg-sunken: #0a121a;
  --line: #243649;
  --fg: #e6edf3;
  --fg-muted: #9bacbd;
  --accent: #4a90d9;
  --accent-hi: #7dc0ff;
  --accent-ink: #08121c;
  --free: #7d90a3;
  --reserved: #f4c542;
  --occupied: #ef5350;
  --ok: #66bb6a;
  --stop: #c62828;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, "Liberation Mono", monospace;
  --radius: 10px;
  --gutter: max(20px, env(safe-area-inset-left, 0px));
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 84px; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font: 400 1.0625rem/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
}
img, svg { max-width: 100%; }
img { height: auto; }
a { color: var(--accent-hi); text-underline-offset: 3px; }
a:hover { color: #b3dbff; }
:focus-visible { outline: 3px solid var(--accent-hi); outline-offset: 3px; border-radius: 4px; }
kbd {
  font: 600 .85em var(--mono); padding: .1em .45em; border: 1px solid var(--line); border-bottom-width: 2px;
  border-radius: 5px; background: var(--bg-raised); color: var(--fg);
}
h1, h2, h3 { line-height: 1.15; letter-spacing: -.015em; text-wrap: balance; margin: 0 0 .5em; }
h1 { font-size: clamp(2.1rem, 1.2rem + 3.6vw, 3.6rem); font-weight: 750; letter-spacing: -.03em; }
h2 { font-size: clamp(1.6rem, 1.2rem + 1.4vw, 2.3rem); font-weight: 700; }
h3, .h3 { font-size: 1.2rem; font-weight: 650; letter-spacing: -.01em; }
p { margin: 0 0 1em; }
.lead { font-size: 1.18rem; color: var(--fg-muted); max-width: 62ch; }
.muted { color: var(--fg-muted); }
.small { font-size: .92rem; }
.eyebrow { font: 600 .8rem/1.2 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--accent-hi); margin: 0 0 1.1em; }
.icon { fill: currentColor; flex: none; vertical-align: -0.2em; }

.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding-inline: var(--gutter); padding-right: max(20px, env(safe-area-inset-right, 0px)); }
.wrap.narrow { max-width: 760px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--accent); color: var(--accent-ink); padding: .6em 1em; border-radius: 6px; z-index: 100; }
.skip:focus { left: 8px; }

/* ---------- Kopf ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50; background: rgba(13, 22, 32, .92);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.bar { display: flex; align-items: center; gap: 1rem; min-height: 64px; flex-wrap: wrap; }
.brand { display: inline-flex; margin-right: auto; }
.brand img { display: block; height: 38px; width: auto; }
.site-nav { display: flex; align-items: center; gap: .25rem; }
.site-nav a {
  color: var(--fg-muted); text-decoration: none; padding: .5em .85em; border-radius: 8px; font-weight: 550; font-size: .98rem;
  display: inline-flex; align-items: center; gap: .4em;
}
.site-nav a:hover { color: var(--fg); background: var(--bg-raised); }
.site-nav a[aria-current="page"] { color: var(--fg); background: var(--bg-raised); box-shadow: inset 0 -2px 0 var(--accent); }
.site-nav .lang {
  margin-left: .5rem; font: 700 .8rem var(--mono); letter-spacing: .08em; border: 1px solid var(--line); color: var(--fg);
  padding: .4em .7em;
}
.nav-toggle {
  display: none; background: transparent; border: 1px solid var(--line); color: var(--fg); border-radius: 8px;
  padding: .45em; cursor: pointer;
}
@media (max-width: 760px) {
  .nav-toggle { display: inline-flex; }
  .site-nav { display: none; flex-basis: 100%; flex-direction: column; align-items: stretch; padding-bottom: .75rem; }
  .site-nav.open { display: flex; }
  .site-nav .lang { margin-left: 0; align-self: flex-start; }
}

/* ---------- Gleisband ---------- */
.track {
  height: 12px; margin-block: 0 2.2rem; --rail: #4b6078; --sleeper: #2c3d50;
  background:
    linear-gradient(var(--rail), var(--rail)) 0 2px / 100% 2px no-repeat,
    linear-gradient(var(--rail), var(--rail)) 0 8px / 100% 2px no-repeat,
    repeating-linear-gradient(90deg, var(--sleeper) 0 5px, transparent 5px 16px);
}

/* ---------- Schaltflächen ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em; font: 650 1rem/1 var(--font);
  padding: .95em 1.5em; border-radius: 9px; border: 1px solid var(--line); background: var(--bg-raised); color: var(--fg);
  text-decoration: none; cursor: pointer; transition: background .15s, border-color .15s, transform .1s;
}
.btn:hover { background: #1a2a3a; border-color: #35506b; color: var(--fg); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-hi); border-color: var(--accent-hi); color: var(--accent-ink); }
.btn.stop { background: var(--stop); border-color: var(--stop); color: #fff; letter-spacing: .04em; }
.btn.stop:hover { background: #e53935; border-color: #e53935; color: #fff; }
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; }
.textlink { font-weight: 650; text-decoration: none; display: inline-flex; align-items: center; gap: .35em; }
.textlink:hover { text-decoration: underline; }
.cta-row { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.6rem; }

/* ---------- Hero ---------- */
.hero { padding-block: clamp(2.5rem, 6vw, 5rem) clamp(2rem, 4vw, 3rem); }
.hero-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(1.5rem, 4vw, 3.5rem); align-items: center; }
.hero-text .lead { margin-bottom: 0; }
@media (max-width: 960px) { .hero-grid { grid-template-columns: 1fr; } }

/* Programmfenster-Rahmen */
.shot { margin: 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--bg-sunken); box-shadow: 0 24px 60px -24px rgba(0, 0, 0, .7), 0 0 0 1px rgba(255, 255, 255, .02); }
.shot img { display: block; width: 100%; height: auto; }
.shot figcaption { padding: .7rem 1rem; font-size: .88rem; color: var(--fg-muted); border-top: 1px solid var(--line); background: var(--bg-raised); }
.hero-img { transform: none; }

/* ---------- Zahlenband ---------- */
.stats { padding-block: .5rem 1rem; }
.stat-row { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); border-block: 1px solid var(--line); }
.stat-row li { padding: 1.4rem 1rem; display: flex; flex-direction: column; gap: .2rem; border-left: 1px solid var(--line); }
.stat-row li:first-child { border-left: 0; padding-left: 0; }
.stat-row .num { font: 700 clamp(1.9rem, 1.2rem + 2.2vw, 2.8rem)/1 var(--mono); color: var(--accent-hi); font-variant-numeric: tabular-nums; }
.stat-row .label { color: var(--fg-muted); font-size: .95rem; }
.stat-note { color: var(--fg-muted); font-size: .85rem; margin: .8rem 0 0; }
@media (max-width: 700px) {
  .stat-row { grid-template-columns: repeat(2, 1fr); }
  .stat-row li:nth-child(odd) { border-left: 0; padding-left: 0; }
  .stat-row li:nth-child(n+3) { border-top: 1px solid var(--line); }
}

/* ---------- Abschnitte ---------- */
.section { padding-block: clamp(2.5rem, 6vw, 4.5rem); }
.page-head { padding-block: clamp(2.5rem, 6vw, 4.5rem) .5rem; }
.page-head h1 { margin-bottom: .35em; }
.badge { display: inline-block; font: 600 .75rem var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--reserved); border: 1px solid #5c4d1a; padding: .35em .8em; border-radius: 99px; margin-bottom: 1.2rem; }

.feature-grid { list-style: none; margin: 2rem 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.25rem; }
.feature { background: var(--bg-raised); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem; }
.feature h3 { margin: 1rem 0 .4rem; }
.feature p { color: var(--fg-muted); margin: 0; }
.ficon { display: inline-grid; place-items: center; width: 46px; height: 46px; border-radius: 10px; background: #172c42; color: var(--accent-hi); }
.more { margin: 1.5rem 0 0; }
@media (max-width: 960px) { .feature-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 620px) { .feature-grid { grid-template-columns: 1fr; } }

.demo-teaser { background: var(--bg-raised); border-block: 1px solid var(--line); }
.teaser-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 2.5rem; align-items: center; }
.teaser-art { background: var(--bg-sunken); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem; }
.mini-plan { display: block; width: 100%; height: auto; }
.mini-plan .blk { fill: none; stroke-width: 8; stroke-linecap: round; }
.mini-plan .free { stroke: var(--free); }
.mini-plan .rsv { stroke: var(--reserved); }
.mini-plan .occ { stroke: var(--occupied); }
.mini-plan .off { stroke: var(--free); opacity: .4; }
.mini-plan .sw { fill: var(--bg-raised); stroke: var(--accent-hi); stroke-width: 2.5; }
.mini-plan .train { fill: var(--accent-hi); }
@media (max-width: 820px) { .teaser-grid { grid-template-columns: 1fr; } }

.wide-shot { max-width: 1100px; margin-inline: auto; }
.closing { background: linear-gradient(180deg, transparent, rgba(74, 144, 217, .08)); }
.closing-grid { display: flex; flex-wrap: wrap; gap: 1.5rem 3rem; align-items: center; justify-content: space-between; }
.closing-grid h2 { margin-bottom: .3em; }
.closing-grid .lead { margin: 0; }

/* ---------- Funktionsseite ---------- */
.toc { list-style: none; margin: 2rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: .5rem; }
.toc a { display: inline-block; padding: .45em .95em; border: 1px solid var(--line); border-radius: 99px; text-decoration: none; color: var(--fg-muted); font-size: .92rem; font-weight: 550; }
.toc a:hover { color: var(--fg); border-color: #35506b; background: var(--bg-raised); }
.feat { border-top: 1px solid var(--line); }
.feat-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(1.5rem, 4vw, 3.5rem); align-items: center; }
.feat.flip .feat-text { order: 2; }
.feat-wide .feat-grid { grid-template-columns: 1fr; }
.feat-wide .feat-shot { order: 3; }
.feat-text h2 { margin-top: 1rem; }
.points { margin: 1.2rem 0 0; padding: 0; list-style: none; display: grid; gap: .7rem; }
.points li { position: relative; padding-left: 1.6rem; color: var(--fg); }
.points li::before { content: ""; position: absolute; left: 0; top: .62em; width: .8rem; height: 2px; background: var(--accent); box-shadow: 0 5px 0 var(--accent); }
.feat-shot.tall .shot { max-width: 380px; margin-inline: auto; }
@media (max-width: 860px) { .feat-grid { grid-template-columns: 1fr; } .feat.flip .feat-text { order: 0; } }

/* ---------- Demo ---------- */
.demo { background: var(--bg-raised); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(.9rem, 2.5vw, 1.5rem); }
.demo-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1rem; margin-bottom: 1rem; }
.legend { list-style: none; display: flex; gap: 1rem; margin: 0 0 0 auto; padding: 0; font-size: .88rem; color: var(--fg-muted); flex-wrap: wrap; }
.legend li { display: inline-flex; align-items: center; gap: .4rem; }
.legend i { display: inline-block; width: 22px; height: 6px; border-radius: 3px; }
.sw-free { background: var(--free); } .sw-rsv { background: var(--reserved); } .sw-occ { background: var(--occupied); }
.demo-board { background: var(--bg-sunken); border: 1px solid var(--line); border-radius: 8px; padding: .5rem; overflow-x: auto; }
#demo-svg { display: block; width: 100%; min-width: 520px; height: auto; user-select: none; -webkit-user-select: none; }
.demo-status { margin: 1rem 0 .4rem; min-height: 1.6em; font-weight: 550; }
.explain-title { margin-top: 3rem; }
.explain { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.25rem; margin: 1rem 0 2rem; }
.explain dt { font-weight: 700; margin-bottom: .25rem; }
.explain dd { margin: 0; color: var(--fg-muted); }
@media (max-width: 820px) { .explain { grid-template-columns: 1fr; } }

/* SVG-Teile der Demo (Klassen werden von demo.js gesetzt) */
.d-blk { fill: none; stroke-width: 9; stroke-linecap: round; stroke-linejoin: round; transition: stroke .25s, opacity .25s; }
.d-edge { fill: none; stroke: #04080c; stroke-width: 15; stroke-linecap: round; }
.d-free { stroke: var(--free); } .d-rsv { stroke: var(--reserved); } .d-occ { stroke: var(--occupied); }
.d-off { opacity: .35; }
.d-label { font: 600 11px var(--mono); fill: var(--fg-muted); }
.d-station { font: 700 13px var(--font); fill: var(--fg); }
.d-turnout { cursor: pointer; }
.d-turnout circle.hit { fill: transparent; }
.d-turnout circle.ring { fill: var(--bg-raised); stroke: var(--accent-hi); stroke-width: 2.5; transition: stroke .2s; }
.d-turnout text { font: 700 11px var(--mono); fill: var(--fg); pointer-events: none; }
.d-turnout:hover circle.ring { fill: #1d3248; }
.d-turnout:focus-visible { outline: none; }
.d-turnout:focus-visible circle.ring { stroke: #fff; stroke-width: 4; }
.d-turnout.locked circle.ring { stroke: var(--occupied); }
.d-turnout.shake { animation: shake .35s; }
@keyframes shake { 20% { transform: translateX(-3px); } 40% { transform: translateX(3px); } 60% { transform: translateX(-2px); } 80% { transform: translateX(2px); } }
.d-train rect { fill: var(--accent-hi); stroke: #04080c; stroke-width: 1.5; }
.d-parked rect { fill: #8da0b4; }
.d-train text { font: 700 10px var(--mono); fill: var(--accent-ink); }
.d-signal-post { stroke: var(--fg-muted); stroke-width: 2; }
.d-signal-lamp { transition: fill .2s; }

/* ---------- Seiten mit Text ---------- */
.panel { background: var(--bg-raised); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem; margin-bottom: 1.5rem; }
.mail { font-size: 1.35rem; font-weight: 650; margin: 0; word-break: break-word; }
.login { display: grid; gap: .6rem; max-width: 420px; }
.login label { font-weight: 600; font-size: .92rem; }
.login input { font: inherit; padding: .75em .9em; border-radius: 8px; border: 1px solid var(--line); background: var(--bg-sunken); color: var(--fg); }
.login input:disabled { opacity: .55; }
.login .btn { margin-top: .6rem; }
.forum-art { display: grid; place-items: center; min-height: 140px; color: var(--accent-hi); }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: .9rem 2rem; margin: 0; }
.facts dt { font-weight: 650; color: var(--fg-muted); }
.facts dd { margin: 0; }
@media (max-width: 560px) { .facts { grid-template-columns: 1fr; gap: .1rem; } .facts dd { margin-bottom: 1rem; } }
.missing { color: var(--reserved); font-style: italic; }
.prose p { max-width: 68ch; }
.draft { border-left: 3px solid var(--reserved); padding-left: 1rem; margin-top: 2rem; }

/* ---------- Fuss ---------- */
.site-footer { margin-top: 3rem; padding-block: 2rem 2.5rem; background: var(--bg-sunken); }
.site-footer .track { margin-bottom: 2rem; }
.foot-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 2rem; }
.foot-brand img { height: 38px; width: auto; }
.foot-brand p { color: var(--fg-muted); margin-top: .8rem; max-width: 32ch; }
.foot-grid h2 { font: 600 .78rem var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--fg-muted); margin: 0 0 .8rem; }
.foot-grid ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .45rem; }
.foot-grid a { color: var(--fg); text-decoration: none; }
.foot-grid a:hover { text-decoration: underline; }
.soon { font: 600 .68rem var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--reserved); border: 1px solid #5c4d1a; border-radius: 99px; padding: .15em .55em; margin-left: .4em; }
.fineprint { color: var(--fg-muted); font-size: .85rem; margin: 2rem 0 0; }
@media (max-width: 760px) { .foot-grid { grid-template-columns: 1fr 1fr; } .foot-brand { grid-column: 1 / -1; } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

.demo-section { padding-block-start: 1rem; }
