/**
 * ============================================================================
 *  STYLE.CSS – Basis, Design-Tokens, Layout & Komponenten
 * ============================================================================
 *  Inhaltsverzeichnis:
 *   1. Design-Tokens (CSS-Variablen)
 *   2. Reset & Grundlagen
 *   3. Typografie
 *   4. Hintergrund-Szene
 *   5. Karte / Layout
 *   6. Markenbereich (Logo, Name, Tagline)
 *   7. Link-Buttons
 *   8. Footer
 *   9. Seitenketten
 *   10. Utilities & Accessibility
 * ============================================================================
 */

/* -------------------------------------------------------------------------
 * 1. DESIGN-TOKENS
 *    Werden zusätzlich zur Laufzeit aus config.js überschrieben
 *    (siehe app.js -> applyTheme()). Hier stehen die Fallback-/Startwerte.
 * ---------------------------------------------------------------------- */
:root {
  /* Farben */
  --color-primary: #5c0a0a;      /* Blutrot */
  --color-secondary: #0a0a0b;    /* Tiefschwarz */
  --color-accent: #a11515;       /* Leuchtrot */
  --color-surface: #17171a;      /* Anthrazit */
  --color-silver: #c9c9d1;       /* Silber */
  --color-silver-dim: #8a8a92;   /* Silber gedämpft */
  --color-white: #f4f2f0;

  /* Abstufungen auf Basis der Tokens */
  --color-surface-raised: #1e1e22;
  --color-border: rgba(201, 201, 209, 0.14);
  --color-border-strong: rgba(201, 201, 209, 0.28);

  /* Typografie */
  --font-display: Georgia, "Iowan Old Style", "Palatino Linotype", "URW Palladio L", serif;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  /* Abstände (8px-Raster) */
  --space-1: 0.4rem;
  --space-2: 0.8rem;
  --space-3: 1.2rem;
  --space-4: 1.6rem;
  --space-5: 2.4rem;
  --space-6: 3.2rem;
  --space-7: 4.8rem;

  /* Layout */
  --card-max-width: 460px;
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-pill: 999px;

  /* Schatten & Glow */
  --shadow-card: 0 30px 80px -20px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(201, 201, 209, 0.06);
  --shadow-btn: 0 10px 24px -10px rgba(0, 0, 0, 0.55);
  --glow-accent: 0 0 24px rgba(161, 21, 21, 0.45);

  /* Übergänge */
  --ease-premium: cubic-bezier(0.22, 1, 0.36, 1);
  --duration-fast: 180ms;
  --duration-mid: 420ms;
  --duration-slow: 900ms;

  /* Wird per JS gesetzt (Hintergrundbild aus config.js) */
  --bg-image: none;
  --parallax-x: 0;
  --parallax-y: 0;
}

/* -------------------------------------------------------------------------
 * 2. RESET & GRUNDLAGEN
 * ---------------------------------------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  font-size: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background-color: var(--color-secondary);
  color: var(--color-white);
  font-family: var(--font-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;

  /* Erst nach dem Rendern der Buttons sichtbar -> vermeidet Flackern */
  opacity: 0;
  transition: opacity var(--duration-slow) var(--ease-premium);
}

body.is-ready {
  opacity: 1;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

button {
  font: inherit;
}

/* -------------------------------------------------------------------------
 * 3. TYPOGRAFIE
 * ---------------------------------------------------------------------- */
.brand__name {
  font-family: var(--font-display);
  font-size: clamp(1.9rem, 6vw, 2.4rem);
  font-weight: 400;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-white);
  margin: var(--space-3) 0 var(--space-1);
  text-shadow: 0 2px 20px rgba(161, 21, 21, 0.25);
}

.brand__tagline {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1rem;
  color: var(--color-silver);
  letter-spacing: 0.03em;
  margin: 0 0 var(--space-3);
}

.brand__description {
  font-size: 0.875rem;
  color: var(--color-silver-dim);
  max-width: 34ch;
  margin: 0 auto;
  line-height: 1.6;
}

/* -------------------------------------------------------------------------
 * 4. HINTERGRUND-SZENE
 * ---------------------------------------------------------------------- */
.scene {
  position: fixed;
  inset: 0;
  z-index: -3;
  overflow: hidden;
}

.bg-image {
  position: absolute;
  inset: -4%;
  background-image: var(--bg-image);
  background-size: cover;
  background-position: center;
  filter: saturate(0.85) brightness(0.6);
  transform: translate3d(calc(var(--parallax-x) * -6px), calc(var(--parallax-y) * -6px), 0) scale(1.05);
  transition: transform var(--duration-mid) linear;
}

.bg-gradient {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(92, 10, 10, 0.35), transparent 60%),
    radial-gradient(ellipse 60% 50% at 50% 100%, rgba(0, 0, 0, 0.6), transparent 70%),
    linear-gradient(180deg, rgba(5, 5, 6, 0.55) 0%, rgba(5, 5, 6, 0.88) 55%, #050506 100%);
}

.fog-layer,
.particle-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.fog {
  position: absolute;
  width: 140%;
  height: 40%;
  left: -20%;
  background: radial-gradient(ellipse at center, rgba(201, 201, 209, 0.06), transparent 70%);
  filter: blur(30px);
  opacity: 0.7;
}

.particle {
  position: absolute;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--color-silver);
  opacity: 0.25;
  left: calc(var(--i) * 12.5%);
  box-shadow: 0 0 6px rgba(201, 201, 209, 0.4);
}

/* -------------------------------------------------------------------------
 * 5. KARTE / LAYOUT
 * ---------------------------------------------------------------------- */
.card {
  width: min(100% - 2.4rem, var(--card-max-width));
  margin: var(--space-7) auto var(--space-5);
  padding: var(--space-6) var(--space-5) var(--space-5);
  background: linear-gradient(180deg, var(--color-surface-raised), var(--color-surface));
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  position: relative;
}

/* dezente Rahmenlinie mit Silber-Verlauf */
.card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(160deg, rgba(201, 201, 209, 0.25), transparent 40%, transparent 70%, rgba(161, 21, 21, 0.25));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

/* -------------------------------------------------------------------------
 * 6. MARKENBEREICH
 * ---------------------------------------------------------------------- */
.brand {
  text-align: center;
  margin-bottom: var(--space-5);
}

.logo-frame {
  width: 128px;
  height: 128px;
  margin: 0 auto;
  border-radius: 50%;
  padding: 4px;
  position: relative;
  background: conic-gradient(from 180deg, var(--color-silver-dim), var(--color-accent), var(--color-silver-dim));
}

.logo-frame__img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  background: var(--color-surface);
  border: 3px solid var(--color-secondary);
}

/* -------------------------------------------------------------------------
 * 7. LINK-BUTTONS
 * ---------------------------------------------------------------------- */
.link-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.link-item {
  opacity: 0;
}

body.is-ready .link-item {
  animation: linkReveal var(--duration-mid) var(--ease-premium) forwards;
}

.btn {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  padding: var(--space-3) var(--space-4);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-btn);
  cursor: pointer;
  transition:
    transform var(--duration-fast) var(--ease-premium),
    box-shadow var(--duration-fast) var(--ease-premium),
    border-color var(--duration-fast) var(--ease-premium),
    background var(--duration-fast) var(--ease-premium);
}

.btn:hover,
.btn:focus-visible {
  transform: translateY(-3px) scale(1.015);
  border-color: var(--color-border-strong);
  background: rgba(161, 21, 21, 0.08);
  box-shadow: var(--shadow-btn), var(--glow-accent);
}

.btn:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
}

.btn:active {
  transform: translateY(-1px) scale(0.995);
}

.btn--featured {
  background: linear-gradient(135deg, rgba(161, 21, 21, 0.22), rgba(92, 10, 10, 0.12));
  border-color: rgba(161, 21, 21, 0.45);
}

.btn__icon {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  color: var(--color-silver);
  transition: color var(--duration-fast) var(--ease-premium);
}

.btn:hover .btn__icon {
  color: var(--color-white);
}

/* Eigene Bild-Icons (PNG/JPG/WebP oder farbige SVGs)
   Die äußere Box schneidet zu (overflow: hidden), das <img> darin wird bei
   Bedarf per "iconZoom" in config.js über transform: scale() vergrößert,
   um eingebautes Padding im Icon wegzuschneiden. Bewusst kein
   background-image, da SVGs darüber teils unscharf gerendert werden. */
.btn__icon--custom {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 6px;
  transition: transform var(--duration-fast) var(--ease-premium);
}

.btn__icon--custom img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.btn:hover .btn__icon--custom {
  transform: scale(1.06);
}

.btn__text {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  text-align: left;
  min-width: 0;
}

.btn__title {
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--color-white);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn__subtitle {
  font-size: 0.75rem;
  color: var(--color-silver-dim);
}

.btn__arrow {
  flex: 0 0 auto;
  color: var(--color-silver-dim);
  transition: transform var(--duration-fast) var(--ease-premium), color var(--duration-fast) var(--ease-premium);
}

.btn:hover .btn__arrow {
  transform: translateX(3px);
  color: var(--color-accent);
}

/* -------------------------------------------------------------------------
 * 8. FOOTER
 * ---------------------------------------------------------------------- */
.site-footer {
  text-align: center;
  padding: 0 var(--space-4) var(--space-6);
  color: var(--color-silver-dim);
  font-size: 0.75rem;
}

.site-footer__copy {
  margin: 0 0 var(--space-2);
}

.site-footer__nav {
  display: flex;
  justify-content: center;
  gap: var(--space-3);
}

.footer__link {
  color: var(--color-silver-dim);
  border-bottom: 1px solid transparent;
  transition: color var(--duration-fast) var(--ease-premium), border-color var(--duration-fast) var(--ease-premium);
}

.footer__link:hover,
.footer__link:focus-visible {
  color: var(--color-silver);
  border-color: var(--color-silver-dim);
}

/* -------------------------------------------------------------------------
 * 9. SEITENKETTEN
 * ---------------------------------------------------------------------- */
.chain {
  position: fixed;
  top: -20px;
  width: 40px;
  height: var(--chain-length, 70vh);
  z-index: -2;
  pointer-events: none;
  opacity: 0.5;
  display: none; /* wird ab bestimmter Viewport-Breite in responsive.css aktiviert */
}

.chain--left { left: clamp(4px, 3vw, 48px); }
.chain--right { right: clamp(4px, 3vw, 48px); }

.chain__pivot {
  width: 100%;
  height: 100%;
  transform-origin: top center;
}

.chain__svg {
  width: 100%;
  height: 100%;
  display: block;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.5));
}

/* -------------------------------------------------------------------------
 * 10. UTILITIES & ACCESSIBILITY
 * ---------------------------------------------------------------------- */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--color-accent);
  color: var(--color-white);
  padding: var(--space-2) var(--space-3);
  z-index: 999;
  border-radius: 0 0 var(--radius-sm) 0;
}

.skip-link:focus {
  left: 0;
}

:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}