/* ==========================================================================
   Grundlagen
   ========================================================================== */

:root {
  --bg: #07090a;
  --surface: #0e1314;
  --border: #1d2628;
  --text: #d7e2dc;
  --muted: #8a9a93;
  --phosphor: #7dffb4;
  --phosphor-dim: rgba(125, 255, 180, 0.15);

  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SFMono-Regular", "JetBrains Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --max-width: 64rem;
  --gutter: clamp(1rem, 4vw, 2.5rem);

  /* Gesamtdauer des CRT-Intros; Beam, Overlay und Seite laufen synchron. */
  --crt-duration: 2.6s;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--phosphor);
  text-decoration: none;
}

a:hover,
a:focus-visible {
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

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

h1,
h2,
h3 {
  font-family: var(--font-mono);
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* ==========================================================================
   Layout
   ========================================================================== */

.page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

main {
  flex: 1;
}

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--border);
}

.brand {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
}

.brand:hover {
  text-decoration: none;
}

.brand__accent {
  color: var(--phosphor);
}

.site-nav {
  display: flex;
  gap: 1.5rem;
  font-size: 0.95rem;
}

.site-nav a {
  color: var(--muted);
}

.site-nav a:hover,
.site-nav a:focus-visible,
.site-nav a[aria-current="page"] {
  color: var(--phosphor);
}

/* ==========================================================================
   Inhalt
   ========================================================================== */

.hero {
  padding: clamp(4rem, 14vh, 9rem) 0 clamp(3rem, 10vh, 6rem);
}

.hero__kicker {
  margin: 0 0 1rem;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--phosphor);
  text-shadow: 0 0 8px var(--phosphor-dim);
}

.hero h1 {
  margin: 0 0 1.5rem;
  font-size: clamp(2rem, 6vw, 3.5rem);
  max-width: 18ch;
}

.hero__lead {
  margin: 0 0 2rem;
  max-width: 38rem;
  color: var(--muted);
  font-size: 1.125rem;
}

.cursor {
  display: inline-block;
  width: 0.55em;
  height: 0.9em;
  margin-left: 0.15em;
  vertical-align: -0.05em;
  background: var(--phosphor);
  box-shadow: 0 0 10px var(--phosphor-dim);
  animation: cursor-blink 1.1s steps(1) infinite;
}

@keyframes cursor-blink {
  50% { opacity: 0; }
}

.button {
  display: inline-block;
  padding: 0.75rem 1.4rem;
  border: 1px solid var(--phosphor);
  border-radius: 0.375rem;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  color: var(--phosphor);
  transition: background-color 0.15s ease, color 0.15s ease;
}

.button:hover,
.button:focus-visible {
  background: var(--phosphor);
  color: var(--bg);
  text-decoration: none;
}

.section {
  padding: 3rem 0;
  border-top: 1px solid var(--border);
  scroll-margin-top: 1rem;
}

.section h2 {
  margin: 0 0 1.5rem;
  font-size: 1.5rem;
}

.section > p {
  max-width: 40rem;
  margin: 0;
  color: var(--muted);
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: 1rem;
}

.card {
  padding: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
}

.card h3 {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
  color: var(--phosphor);
}

.card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.975rem;
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.5rem 0 2rem;
  border-top: 1px solid var(--border);
  font-size: 0.875rem;
  color: var(--muted);
}

.site-footer nav {
  display: flex;
  gap: 1.25rem;
}

.site-footer a {
  color: var(--muted);
}

.site-footer a[aria-current="page"] {
  color: var(--phosphor);
}

/* ==========================================================================
   Unterseiten (Impressum, Datenschutz)
   ========================================================================== */

.subpage {
  padding: clamp(4rem, 14vh, 9rem) 0 clamp(3rem, 10vh, 6rem);
}

.subpage h1 {
  margin: 0 0 1.5rem;
  font-size: clamp(2rem, 6vw, 3.5rem);
}

.subpage__text {
  margin: 0 0 2.5rem;
  font-family: var(--font-mono);
  font-size: clamp(1.25rem, 3vw, 1.75rem);
  color: var(--text);
}

.subpage--compact {
  padding-top: clamp(3rem, 8vh, 5rem);
}

/* ==========================================================================
   Downloads
   ========================================================================== */

.button--small {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  white-space: nowrap;
}

.filter {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.filter[hidden] {
  display: none;
}

.filter__button {
  padding: 0.4rem 0.9rem;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 999px;
  font: inherit;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--muted);
  cursor: pointer;
}

.filter__button:hover {
  border-color: var(--phosphor);
  color: var(--text);
}

.filter__button[aria-pressed="true"] {
  background: var(--phosphor-dim);
  border-color: var(--phosphor);
  color: var(--phosphor);
}

.download-status {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  color: var(--muted);
}

.downloads {
  display: grid;
  gap: 1rem;
}

.download[hidden],
.download-file[hidden] {
  display: none;
}

.download__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.75rem;
}

.download__name {
  margin: 0;
  font-size: 1.25rem;
}

.version-badge {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--muted);
}

.download__description {
  margin: 0.5rem 0 0;
  max-width: 40rem;
  color: var(--muted);
}

.download__homepage {
  display: inline-block;
  margin-top: 0.5rem;
  font-size: 0.9rem;
}

.download__files {
  margin: 1.25rem 0 0;
  padding: 0;
  list-style: none;
}

.download-file {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
  padding: 0.9rem 0;
  border-top: 1px solid var(--border);
}

.download-file__info {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 0.75rem;
  min-width: 0;
  flex: 1 1 18rem;
}

.download-file__name {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  overflow-wrap: anywhere;
}

.download-file__meta {
  font-size: 0.85rem;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.download-file__hash {
  flex-basis: 100%;
  font-size: 0.8rem;
  color: var(--muted);
}

.download-file__hash summary {
  cursor: pointer;
  width: fit-content;
}

.download-file__hash code {
  display: block;
  margin-top: 0.35rem;
  font-family: var(--font-mono);
  overflow-wrap: anywhere;
  color: var(--text);
}

.platform-badge {
  padding: 0.1rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 0.25rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted);
  white-space: nowrap;
}

.platform-badge--windows,
.platform-badge--linux {
  border-color: rgba(125, 255, 180, 0.35);
  color: var(--phosphor);
}

/* ==========================================================================
   CRT-Einschalt-Intro
   Ablauf: Schwarz → Leuchtpunkt → horizontale Linie → Bild klappt
   vertikal auf → weißer Blitz blendet in die Seite über.
   Aktiv nur, solange <html> die Klasse .crt-boot trägt (siehe crt-intro.js).
   ========================================================================== */

.crt-intro {
  display: none;
}

.crt-boot,
.crt-boot body {
  overflow: hidden;
}

.crt-boot .crt-intro {
  display: block;
  position: fixed;
  inset: 0;
  z-index: 1000;
  overflow: hidden;
  background: #000;
  cursor: pointer;
  animation: crt-overlay var(--crt-duration) linear forwards;
}

.crt-intro__beam {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, #ffffff 0%, #effff6 55%, #c9f5dc 100%);
  border-radius: 50%;
  transform: scale(0, 0);
  opacity: 0;
  animation: crt-beam var(--crt-duration) forwards;
}

.crt-intro__glow {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 40vmin;
  height: 40vmin;
  margin: -20vmin 0 0 -20vmin;
  background: radial-gradient(circle, rgba(200, 255, 225, 0.55) 0%, rgba(125, 255, 180, 0.12) 35%, transparent 70%);
  opacity: 0;
  animation: crt-glow var(--crt-duration) forwards;
}

.crt-intro__scanlines {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0) 0,
    rgba(0, 0, 0, 0) 2px,
    rgba(0, 0, 0, 0.28) 3px,
    rgba(0, 0, 0, 0) 4px
  );
  pointer-events: none;
}

.crt-boot .page {
  animation: crt-warmup var(--crt-duration) forwards;
}

/* Overlay bleibt deckend, bis der Strahl den Schirm füllt, dann Ausblendung. */
@keyframes crt-overlay {
  0%, 58% { opacity: 1; }
  100% { opacity: 0; visibility: hidden; }
}

@keyframes crt-beam {
  0%, 8% {
    transform: scale(0, 0);
    opacity: 0;
    border-radius: 50%;
  }
  /* Punkt flammt auf */
  14% {
    transform: scale(0.006, 0.01);
    opacity: 1;
    border-radius: 50%;
    animation-timing-function: ease-in-out;
  }
  24% {
    transform: scale(0.01, 0.014);
    opacity: 1;
    border-radius: 50%;
    animation-timing-function: cubic-bezier(0.7, 0, 0.3, 1);
  }
  /* zur horizontalen Linie gezogen */
  38% {
    transform: scale(1, 0.004);
    opacity: 1;
    border-radius: 0;
    animation-timing-function: cubic-bezier(0.8, 0, 0.2, 1);
  }
  41% {
    transform: scale(1, 0.004);
    border-radius: 0;
    animation-timing-function: cubic-bezier(0.55, 0, 0.1, 1);
  }
  /* Bild klappt vertikal auf */
  56% {
    transform: scale(1, 1);
    opacity: 1;
    border-radius: 0;
  }
  100% {
    transform: scale(1, 1);
    opacity: 1;
    border-radius: 0;
  }
}

@keyframes crt-glow {
  0%, 8% {
    opacity: 0;
    transform: scale(0.2, 0.2);
  }
  16% {
    opacity: 1;
    transform: scale(0.5, 0.5);
  }
  24% {
    opacity: 0.85;
    transform: scale(0.45, 0.45);
  }
  38% {
    opacity: 1;
    transform: scale(4, 0.35);
  }
  52% {
    opacity: 0.6;
    transform: scale(4, 3);
  }
  60%, 100% {
    opacity: 0;
    transform: scale(4, 3);
  }
}

/* Die Seite "glüht" nach dem Blitz kurz über und flackert, bevor sie sich setzt. */
@keyframes crt-warmup {
  0%, 56% {
    filter: brightness(3) contrast(0.5) blur(3px);
    transform: scale(1.02);
    opacity: 1;
  }
  72% {
    filter: brightness(1.6) contrast(0.85) blur(1px);
    transform: scale(1.005);
  }
  78% { opacity: 0.75; }
  80% { opacity: 1; }
  84% { opacity: 0.88; }
  86% {
    opacity: 1;
    filter: brightness(1.15) blur(0.3px);
  }
  100% {
    filter: none;
    transform: none;
    opacity: 1;
  }
}

/* ==========================================================================
   Barrierefreiheit
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .cursor {
    animation: none;
  }

  .crt-boot .crt-intro {
    display: none;
  }

  .crt-boot .page {
    animation: none;
  }
}
