/* /css/global.css — komplett, überarbeitet
   - Footer-Komponentenstyles entfernt (Footer lebt in /css/footer.css)
   - :focus-visible nutzt Tokens (konsistent mit Modals)
   - Container-System tokenbasiert (breiter, desktop-sinnvoll)
*/

/* =========================================================================
  1) DESIGN TOKENS (:root) – Farben, Radii, Shadows, Typografie, Layout
  ========================================================================= */
:root {
  /* --- Core Backgrounds & Text --- */
  --bg: #020617;
  --bg-soft: #020617;
  --text: #e5e7eb;
  --text-muted: #9ca3af;
  --ink: var(--text);

  /* --- Lines & Borders --- */
  --line: #1f2937;
  --border: var(--line);
  --border-strong: #374151;

  --accent: #5cc8ff;
  --accent-ink: #081c25;

  --brand: #0ea5e9;
  --brand-blue: #0ea5e9;
  --brand-green: #5cc8ff;
  --brand-gold: #5cc8ff;
  --brand-ink: #020617;

  /* --- Surfaces (Soft Glass) --- */
  --surface: #020617;
  --surface-alt: #0b1120;
  --surface-2: #0b1120;

  --shadow: 0 18px 60px rgba(0, 0, 0, 0.7);
  --shadow-soft: 0 6px 18px rgba(0, 0, 0, 0.35);

  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 22px;

  --font: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto,
          Helvetica Neue, Arial, "Noto Sans", "Apple Color Emoji",
          "Segoe UI Emoji", "Segoe UI Symbol";

  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
          "Liberation Mono", "Courier New", monospace;

  --h1: clamp(2rem, 2.2rem + 1vw, 3rem);
  --h2: clamp(1.5rem, 1.6rem + 0.5vw, 2rem);
  --h3: clamp(1.125rem, 1.1rem + 0.3vw, 1.25rem);
  --lead: 1.05rem;
  --ink-muted: rgba(229, 237, 247, 0.72);

  /* --- Compatibility Aliases (Fixes) --- */
  --muted: var(--text-muted);
  --h1-size: var(--h1);
  --lead-size: var(--lead);

  --space-0: 4px;
  --space-1: 8px;
  --space-2: 12px;
  --space-3: 16px;
  --space-4: 24px;
  --space-5: 32px;
  --space-6: 48px;

  --gap: 24px;

  /* IMPORTANT: Gutter skaliert leicht auf großen Screens (weniger "eingeklemmt") */
  --gutter: clamp(16px, 3.5vw, 28px);

  /* --- Global Layout Widths --- */
  --container-maxw: 1240px;
  --container-narrow: 980px;
  --maxw: 1200px;

  --header-h: 64px;
  --header-logo-h: calc(var(--header-h) - 8px);
  --row-h: 54px;
  --control-h: 48px;

  /* --- Status Colors --- */
  --ok: #22c55e;
  --success: #22c55e;
  --warn: #f59e0b;
  --danger: #ef4444;

  /* --- Hero Tokens --- */
  --hero-bg: #0b0d12;
  --hero-ink: #eaf2f7;
  --hero-muted: rgba(234,242,247,0.76);
  --hero-accent: #5cc8ff;
  --hero-accent-ink: #08171f;
  --hero-surface: rgba(255,255,255,0.06);
  --hero-border: rgba(255,255,255,0.14);
  --hero-surface-soft: rgba(255,255,255,0.04);
  --hero-radius: 20px;
  --hero-pad: clamp(22px, 4vw, 40px);

  --hero-maxw: 1200px;

  --hero-text-maxch: 70ch;
  --hero-meta-maxw: 1120px;

  /* --- Section Surface Layer --- */
  --sec-bg: #0b0d12;
  --sec-bg-soft: #0f1318;
  --sec-surface: rgba(255,255,255,0.06);
  --sec-surface-soft: rgba(255,255,255,0.04);
  --sec-border: rgba(255,255,255,0.14);
  --sec-border-strong: rgba(255,255,255,0.22);
  --sec-ink: #eaf2f7;
  --sec-muted: rgba(234,242,247,0.70);
  --sec-accent: #5cc8ff;
  --sec-accent-ink: #08202c;
  --sec-radius: 14px;
  --sec-radius-lg: 20px;
  --sec-shadow: 0 8px 26px rgba(0,0,0,0.40);

  /* --- Footer Layer --- */
  --ft-bg: #0b0d12;
  --ft-surface: rgba(255,255,255,0.05);
  --ft-border: rgba(255,255,255,0.12);
  --ft-text: #eaf2f7;
  --ft-muted: rgba(234,242,247,0.75);
  --ft-accent: #5cc8ff;
  --ft-accent-ink: #08202c;
  --ft-radius: 14px;
  --ft-radius-sm: 10px;
  --ft-font: var(--font);
  --ft-lh: 1.55;
  --ft-gap: 18px;
  --ft-gap-lg: clamp(24px, 3vw, 40px);
  --ft-pad: clamp(20px, 3vw, 36px);
  --ft-maxw: 1200px;

  /* --- Modals Tokens (Styles in /css/modals.css) --- */
  --md-ink: #eaf2f7;
  --md-muted: rgba(234,242,247,0.78);
  --md-bg: #0b0d12;
  --md-surface: rgba(255,255,255,0.08);
  --md-surface-2: rgba(255,255,255,0.06);
  --md-border: rgba(255,255,255,0.16);
  --md-accent: #5cc8ff;
  --md-accent-ink: #08202c;
  --md-radius: 14px;
  --md-radius-lg: 20px;
  --md-shadow: 0 20px 70px rgba(0,0,0,0.55),
                0 2px 0 rgba(255,255,255,0.08) inset;
  --md-pad: clamp(20px, 3.5vw, 32px);
  --md-gutter: clamp(14px, 2.5vw, 22px);
  --md-maxw: min(680px, calc(100vw - 32px));

  --focus-ring: 2px solid var(--md-accent);
  --focus-offset: 3px;

  --backdrop-color: rgba(5,10,16,0.65);
  --backdrop-blur: 8px;
}

/* =========================================================================
  2) GLOBAL RESET & BASE ELEMENTS
  ========================================================================= */
* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: auto; }

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

/* =========================================================================
  3) ACCESSIBILITY: Skip Link + Visually Hidden
  ========================================================================= */
.skip-link {
  position: absolute;
  left: -999px;
  top: -999px;
}
.skip-link:focus {
  left: 16px;
  top: 16px;
  background: var(--surface-alt);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* =========================================================================
  4) LAYOUT UTILITIES
  ========================================================================= */
.container {
  width: min(var(--container-maxw), calc(100vw - (var(--gutter) * 2)));
  margin: 0 auto;
}

/* Optional: für text-lastige Sections/Pages */
.container.narrow {
  width: min(var(--container-narrow), calc(100vw - (var(--gutter) * 2)));
}

.section { padding: 72px 0; }
.section.alt { background: var(--surface); }

/* =========================================================================
  5) TYPOGRAPHY UTILITIES
  ========================================================================= */
.lead { font-size: 1.125rem; color: var(--muted); }

.small { font-size: 0.9rem; }
.tiny  { font-size: 0.8rem; }
.muted { color: var(--muted); }

/* global .note bleibt Textnote */
.note {
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 10px;
}

/* =========================================================================
  6) FOCUS & REDUCED MOTION
  ========================================================================= */
:focus-visible {
  outline: var(--focus-ring);
  outline-offset: var(--focus-offset);
}

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

/* =========================================================================
  7) HEADER / NAVIGATION (GLOBAL)
  ========================================================================= */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
}

.two-col {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 32px;
  align-items: start;
}

/* =========================================================================
  8) COMPONENTS — Buttons, Cards, Forms
  ========================================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.65rem 1rem;
  border-radius: var(--radius);
  font-weight: 600;
  text-decoration: none;
  border: 1px solid transparent;
  transition: background-color 0.16s ease,
              border-color 0.16s ease,
              transform 0.12s ease,
              box-shadow 0.16s ease,
              filter 0.16s ease;
  cursor: pointer;
}
.btn:hover { filter: brightness(1.05); transform: translateY(-1px); }
.btn:active { transform: translateY(1px); }
.btn.small { padding: 8px 12px; font-size: 0.9rem; }

.btn-primary {
  background: linear-gradient(90deg, var(--brand-blue), var(--brand-green));
  color: var(--brand-ink);
}
.btn-secondary {
  background: transparent;
  color: var(--brand-blue);
  border: 1px solid var(--brand-blue);
}
.btn-ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
}
.btn[aria-disabled="true"],
.btn[disabled] { opacity: .6; cursor: not-allowed; }

.link-btn {
  background: none;
  border: none;
  color: var(--brand-blue);
  text-decoration: underline;
  cursor: pointer;
  font: inherit;
  padding: 0;
}
.link-btn:hover { color: var(--brand-green); }

.card {
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  box-shadow: var(--shadow-soft);
}
.card-header { margin-bottom: 0.4rem; }
.card-title { font-size: var(--h3); margin: 0; }
.card-body { display: grid; gap: 0.6rem; }
.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.8rem;
}

.form label {
  display: block;
  font-weight: 600;
  margin: 10px 0 6px;
}
.form input,
.form textarea {
  width: 100%;
  padding: 12px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
}
.form input:focus,
.form textarea:focus {
  outline: 3px solid rgba(14,165,233,0.35);
  border-color: var(--brand-blue);
}

/* input-error (für forms.js) */
.input-error {
  border-color: var(--danger) !important;
  outline: 3px solid rgba(239, 68, 68, 0.25);
}

[hidden] { display: none !important; }

/* =========================================================================
  9) UTILITIES
  ========================================================================= */
.plain { list-style: none; padding-left: 0; }
.compact { list-style: decimal; padding-left: 18px; }
.compact li { margin: 4px 0; }

.sr-only[aria-hidden="true"] { visibility: hidden; }

.mt-5 { margin-top: 1.25rem; }

.surface {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
}
.surface-soft {
  background: var(--surface-alt);
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
}

/* Toast container */
#gfc-hints { pointer-events: none; }
#gfc-hints .gfc-hint { pointer-events: auto; }

/* =========================================================================
  10) CARD RESPONSIVE (existing)
  ========================================================================= */
@media (max-width: 640px) {
  .card { padding: 1rem; }
  .card-actions {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* =========================================================================
  11) HEADER LOGO RESPONSIVE (existing)
  ========================================================================= */
.gfc-header-logo {
  display: flex;
  align-items: center;
  margin-right: 24px;
}
.gfc-header-logo img {
  height: 90px;
  width: auto;
  object-fit: contain;
}

@media (max-width: 1024px) { .gfc-header-logo img { height: 70px; } }
@media (max-width: 640px)  { .gfc-header-logo img { height: 50px; } }

@media (max-width: 900px) {
  .header-inner { position: relative; gap: 0.75rem; }
  .gfc-header-logo {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    margin-right: 0;
    z-index: 1;
  }
  .site-nav { flex: 0 0 auto; }
  .header-actions { margin-left: auto; }
}

/* =========================================================================
  12) MOBILE: Prevent horizontal scrolling + force safe text wrapping (existing)
  ========================================================================= */
@media (max-width: 900px) {
  html, body {
    width: 100%;
    overflow-x: hidden;
  }

  body {
    overflow-wrap: anywhere;
    word-break: normal;
  }

  img, video, svg, canvas {
    max-width: 100%;
    height: auto;
  }

  pre {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  code {
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .container, .two-col, .card, .surface, .surface-soft {
    min-width: 0;
  }
}

/* =========================================================================
  13) HEADER FLEX SAFETY + MENU OVERFLOW (deduped, existing behavior)
  ========================================================================= */
@media (max-width: 900px) {
  .site-nav,
  .header-actions {
    min-width: 0;
  }

  .site-nav {
    flex: 1 1 auto;
    max-width: 100%;
    overflow: visible; /* offene Menüs nicht clippen */
  }

  .header-actions {
    flex: 0 1 auto;
    justify-content: flex-end;
    gap: 8px;
  }

  .lang-switch,
  .lang-switch a,
  .lang-switch button,
  .language-switch,
  .language-switch a,
  .language-switch button {
    max-width: 100%;
    white-space: nowrap;
  }

  .header-actions .btn {
    padding: 8px 10px;
    font-size: 0.9rem;
  }

  .site-header,
  .header-inner {
    overflow: visible;
  }

  .site-nav ul,
  .site-nav .nav-list,
  .site-nav .menu,
  .site-nav .nav-menu {
    max-height: calc(100vh - var(--header-h));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* =========================================================================
  14) EXTRA-SMALL PHONES (NEW) — does NOT affect iPhone 14 Pro Max (430px)
  ========================================================================= */
@media (max-width: 390px) {
  /* noch etwas kompaktere Header-Actions, um Overflow auf 360–390px zu verhindern */
  .header-actions { gap: 6px; }
  .header-actions .btn {
    padding: 7px 9px;
    font-size: 0.875rem;
  }

  /* Logo minimal reduzieren nur auf sehr kleinen Geräten */
  .gfc-header-logo img { height: 46px; }
}
