/* ==========================================================================
   MCVote Design V6 — foundation layer.

   Stand: 2026-10-09. Gilt für alle UI-Arbeiten ab Phase G (Design V6).
   Spec: docs/design/v6/SPEC.md. Mockups: docs/design/v6/mockups/.

   This file is the V6 design-system foundation: design tokens (light +
   dark), self-hosted fonts (Space Grotesk / IBM Plex Sans / JetBrains
   Mono), the restyled sticky header, the simplified footer, and the
   light/dark theme machinery. It is intentionally additive on top of the
   V5 component styles: it redefines the :root tokens and the shell
   (header/footer) so the whole page re-themes, while the existing
   component classes (server-row, content-card, button, …) inherit the
   new tokens through the CSS custom properties they already reference.

   Theme model (SPEC §2, Update 2026-10-08):
   - Default follows prefers-color-scheme.
   - The user's choice is stored in localStorage("mcvote-theme") and
     applied to <html data-theme="light|dark"> by an inline script in the
     <head> BEFORE first paint (no flash of wrong theme).
   - The header toggle flips data-theme + localStorage.
   ========================================================================== */

/* ---- Fonts (self-hosted, display: swap) ---- */
@font-face {
  font-family: "Space Grotesk";
  font-weight: 500;
  font-style: normal;
  font-display: swap;
  src: url("/static/fonts/space-grotesk-500.woff2") format("woff2");
}
@font-face {
  font-family: "Space Grotesk";
  font-weight: 600;
  font-style: normal;
  font-display: swap;
  src: url("/static/fonts/space-grotesk-600.woff2") format("woff2");
}
@font-face {
  font-family: "Space Grotesk";
  font-weight: 700;
  font-style: normal;
  font-display: swap;
  src: url("/static/fonts/space-grotesk-700.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Sans";
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  src: url("/static/fonts/ibm-plex-sans-400.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Sans";
  font-weight: 500;
  font-style: normal;
  font-display: swap;
  src: url("/static/fonts/ibm-plex-sans-500.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Sans";
  font-weight: 600;
  font-style: normal;
  font-display: swap;
  src: url("/static/fonts/ibm-plex-sans-600.woff2") format("woff2");
}
@font-face {
  font-family: "JetBrains Mono";
  font-weight: 500;
  font-style: normal;
  font-display: swap;
  src: url("/static/fonts/jetbrains-mono-500.woff2") format("woff2");
}

/* ---- Design tokens (SPEC §2) ----
   Dark is the default. Light overrides the same custom properties under
   [data-theme="light"]. Every component that references var(--bg),
   var(--surface), var(--text), var(--accent), … re-themes automatically.
   The V5 names are kept as aliases so existing component CSS keeps
   working; the V6 names are the canonical set. */
:root {
  /* V6 canonical tokens — dark (default) */
  --bg: #0a0d10;
  --bg2: #0f1318;
  --sf: #141920;
  --sf2: #1b222b;
  --ln: #25303b;
  --tx: #eaf0ec;
  --mu: #a3afa8;
  --ac: #4ade80;
  --ink: #052e14;
  --link: #4ade80;
  --halo: rgba(74, 222, 128, 0.18);
  --glass: rgba(16, 20, 26, 0.72);
  --grid: rgba(255, 255, 255, 0.04);
  --sh: 0 24px 60px rgba(0, 0, 0, 0.5);

  /* V6 type + geometry */
  --font: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --disp: "Space Grotesk", var(--font);
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", "Cascadia Code", Consolas, monospace;
  --px: "Silkscreen", var(--mono);
  --shell: 1200px;
  --gutter: 24px;
  --r-btn: 8px;
  --r-card: 12px;
  --r-lg: 16px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  /* V5 alias map — keeps existing component CSS working under V6 tokens */
  --bg-deep: var(--bg);
  --surface: var(--sf);
  --surface-solid: var(--sf);
  --surface-2: var(--sf2);
  --surface-3: var(--sf2);
  --surface-hover: color-mix(in srgb, var(--sf2) 80%, var(--tx) 6%);
  --border: var(--ln);
  --border-strong: color-mix(in srgb, var(--ln) 70%, var(--tx) 12%);
  --border-glow: var(--halo);
  --text: var(--tx);
  --text-2: var(--mu);
  --text-3: color-mix(in srgb, var(--mu) 70%, transparent);
  --accent: var(--ac);
  --accent-strong: var(--ac);
  --accent-soft: var(--halo);
  --accent-2: var(--ac);
  --accent-3: color-mix(in srgb, var(--ac) 60%, #ffffff);
  --on-accent: var(--ink);
  --danger: #ff5c72;
  --danger-bg: rgba(255, 92, 114, 0.1);
  --gold: #f5c451;
  --gold-bg: rgba(245, 196, 81, 0.12);
  --grad-accent: linear-gradient(135deg, color-mix(in srgb, var(--ac) 80%, #ffffff) 0%, var(--ac) 100%);
  --grad-text: linear-gradient(180deg, var(--tx) 0%, color-mix(in srgb, var(--tx) 70%, var(--ac)) 100%);
  --glow-accent: 0 0 0 1px var(--halo), 0 8px 30px -6px var(--halo);
  --glow-soft: 0 20px 60px -25px var(--halo);
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.4), 0 12px 40px -20px rgba(0, 0, 0, 0.9);
}

/* Light theme overrides the same custom properties. */
[data-theme="light"] {
  --bg: #f5f7f1;
  --bg2: #ecf0e6;
  --sf: #ffffff;
  --sf2: #f0f3ec;
  --ln: #dce2d4;
  --tx: #121811;
  --mu: #556052;
  --ac: #22c55e;
  --ink: #04230f;
  --link: #15803d;
  --halo: rgba(34, 197, 94, 0.16);
  --glass: rgba(255, 255, 255, 0.82);
  --grid: rgba(18, 24, 17, 0.06);
  --sh: 0 20px 50px rgba(40, 60, 30, 0.14);
  --danger-bg: rgba(255, 92, 114, 0.08);
  --shadow-card: 0 1px 2px rgba(40, 60, 30, 0.1), 0 12px 40px -20px rgba(40, 60, 30, 0.25);
}

/* ---- Base canvas ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  background: var(--bg);
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  position: relative;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--tx);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  transition: background-color 0.2s var(--ease), color 0.2s var(--ease);
}

/* Ambient light — fixed, never scrolls, never intercepts clicks. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background:
    radial-gradient(760px 460px at 12% -6%, var(--halo), transparent 62%),
    radial-gradient(700px 420px at 88% 4%, var(--halo), transparent 60%);
}

/* Fine pixel grid, dissolving downward (V6 32px grid). */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 32px 32px;
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, transparent 70%);
  mask-image: linear-gradient(to bottom, #000 0%, transparent 70%);
}

::selection { background: var(--ac); color: var(--ink); }

button { cursor: pointer; background: none; border: none; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

main {
  position: relative;
  width: min(var(--shell), calc(100% - 40px));
  margin: 0 auto;
  padding-bottom: 96px;
}

.skip-link {
  position: absolute;
  top: -60px;
  left: 16px;
  z-index: 200;
  padding: 11px 18px;
  border-radius: 0 0 10px 10px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink);
  background: var(--ac);
  transition: top 0.2s var(--ease);
}
.skip-link:focus { top: 0; }

/* ==========================================================================
   Header (V6: Logo, Servers, Tools, Widgets, Wiki, Sprache, Log in, primär
   "Add your server". Sponsor-Navpunkt raus. Theme-Toggle. Mobile-Menü.)
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 68px;
  padding: 0 max(20px, calc((100vw - var(--shell)) / 2 + 20px));
  background: var(--glass);
  backdrop-filter: blur(14px) saturate(150%);
  -webkit-backdrop-filter: blur(14px) saturate(150%);
  border-bottom: 1px solid var(--ln);
  transition: background-color 0.2s var(--ease), border-color 0.2s var(--ease);
}

/* Hairline of accent light under the header. */
.site-header::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--halo), transparent);
  opacity: 0.7;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--disp);
  font-weight: 700;
  font-size: 21px;
  letter-spacing: -0.02em;
  color: var(--tx);
  flex-shrink: 0;
}
.brand:hover { text-decoration: none; }

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  color: var(--ink);
  background: var(--grad-accent);
  box-shadow: 0 6px 20px -8px var(--halo);
  transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease);
}
.brand-mark svg { width: 19px; height: 19px; stroke-width: 2.4; }
.brand:hover .brand-mark {
  transform: translateY(-1px) rotate(-6deg);
  box-shadow: 0 10px 26px -8px var(--halo);
}
.brand-accent {
  background: var(--grad-text);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  flex: 1 1 auto;
  font-weight: 500;
}
.nav a, .footer-links a {
  color: var(--mu);
  padding: 10px 12px;
  border-radius: var(--r-btn);
  transition: color 0.2s, background 0.2s;
}
.nav a:hover, .footer-links a:hover {
  color: var(--tx);
  background: rgba(255, 255, 255, 0.045);
  text-decoration: none;
}
[data-theme="light"] .nav a:hover, [data-theme="light"] .footer-links a:hover {
  background: rgba(18, 24, 17, 0.05);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* Theme toggle (sun/moon, 44px touch target). */
.theme-toggle {
  width: 44px;
  height: 44px;
  border-radius: var(--r-btn);
  border: 1px solid var(--ln);
  background: var(--sf);
  color: var(--tx);
  display: grid;
  place-items: center;
  transition: border-color 0.2s, background 0.2s;
}
.theme-toggle:hover { border-color: var(--ac); }
.theme-toggle svg { width: 18px; height: 18px; }
/* Show sun in dark (click -> light), moon in light (click -> dark). */
[data-theme="dark"] .icon-moon, [data-theme="light"] .icon-sun,
:root:not([data-theme]) .icon-moon { display: none; }
:root:not([data-theme]) .icon-sun { display: none; }

.locale-link {
  color: var(--mu);
  padding: 10px 4px;
  font-weight: 500;
}
.locale-link:hover { color: var(--tx); }

/* Primary CTA "Add your server". */
.nav-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--ac);
  color: var(--ink) !important;
  font-weight: 600;
  border-radius: 10px;
  padding: 10px 16px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08) inset, 0 8px 24px var(--halo);
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.nav-cta:hover { transform: translateY(-1px); text-decoration: none; }

.nav-toggle {
  width: 44px;
  height: 44px;
  border-radius: var(--r-btn);
  border: 1px solid var(--ln);
  background: var(--sf);
  color: var(--tx);
  display: none;
  place-items: center;
}
.nav-toggle svg { width: 20px; height: 20px; }
.nav-toggle .icon-close { display: none; }
.nav-toggle[aria-expanded="true"] .icon-close { display: block; }
.nav-toggle[aria-expanded="true"] .icon-open { display: none; }

/* ==========================================================================
   Footer (V6: schlicht — About, Contact, Impressum, Datenschutz)
   ========================================================================== */
.site-footer {
  width: min(var(--shell), calc(100% - 40px));
  margin: 0 auto;
  padding: 40px 0 56px;
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  justify-content: space-between;
  align-items: flex-start;
  border-top: 1px solid var(--ln);
}
.site-footer strong {
  font-family: var(--disp);
  font-size: 1.1rem;
  color: var(--tx);
}
.site-footer p { max-width: 46ch; color: var(--mu); font-size: 0.92rem; margin-top: 8px; }
.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  font-size: 0.92rem;
}

/* ==========================================================================
   Buttons + inputs (V6: 8px radius, 44px touch, single accent)
   ========================================================================== */
.button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 0.95rem;
  border-radius: var(--r-btn);
  padding: 12px 18px;
  min-height: 44px;
  border: 1px solid var(--ln);
  background: var(--sf);
  color: var(--tx);
  transition: background 0.2s, border-color 0.2s, transform 0.2s var(--ease), box-shadow 0.25s;
}
.button:hover { border-color: var(--ac); transform: translateY(-1px); }
.button:active { transform: translateY(0); }
.button--primary {
  background: var(--ac);
  color: var(--ink);
  border-color: transparent;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08) inset, 0 8px 24px var(--halo);
}
.button--primary:hover { border-color: transparent; }
.button[disabled] { opacity: 0.6; cursor: not-allowed; transform: none; }

input, select, textarea {
  font: inherit;
  color: var(--tx);
  background: var(--sf);
  border: 1px solid var(--ln);
  border-radius: var(--r-btn);
  padding: 10px 12px;
  min-height: 44px;
}
input::placeholder, textarea::placeholder { color: var(--mu); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--ac);
  box-shadow: 0 0 0 3px var(--halo);
}

/* ==========================================================================
   Scroll reveal — additive (content never hidden by default).
   ========================================================================== */
@media (prefers-reduced-motion: no-preference) {
  .server-row.is-visible,
  .stat-box.is-visible,
  .content-card.is-visible {
    animation: rise 0.5s var(--ease) both;
  }
}
@keyframes rise {
  from { opacity: 0.55; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 860px) {
  .site-header { min-height: 62px; }
  .nav-toggle { display: grid; }
  .nav {
    display: none;
    position: absolute;
    top: 62px;
    left: 0;
    right: 0;
    flex-direction: column;
    background: var(--glass);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--ln);
    padding: 8px 16px 16px;
  }
  .nav.is-open { display: flex; }
  .nav a { padding: 12px; }
  .nav-cta { display: none; }
  main, .site-footer { width: calc(100% - 28px); }
}
