/* =========================================================
   Restflow / Dreamcore — Underwater Premium Theme
   Core Web Vitals optimiert: CLS=0, LCP, INP
   ========================================================= */

/* ---------- 1) TOKENS ---------- */
:root {
  /* Deep ocean palette */
  --bg-0: #041225;
  --bg-1: #061a33;
  --bg-2: #0a2a4a;
  --bg-3: #581CC8;

  /* Accents */
  --accent:   #2aa9ff;
  --accent-2: #00d4ff;
  --accent-3: #6ae7ff;

  /* Text */
  --ink:    rgba(244, 249, 255, 0.96);
  --muted:  rgba(244, 249, 255, 0.76);
  --muted2: rgba(244, 249, 255, 0.55);

  /* Lines / borders */
  --line:        rgba(244, 249, 255, 0.10);
  --line-strong: rgba(244, 249, 255, 0.16);

  /* Glass surfaces */
  --glass:        rgba(8, 30, 55, 0.55);
  --glass-2:      rgba(10, 36, 64, 0.62);
  --glass-border: rgba(244, 249, 255, 0.14);

  /* Shadows */
  --shadow:      0 22px 70px rgba(0, 0, 0, 0.55);
  --shadow-soft: 0 14px 40px rgba(0, 0, 0, 0.35);

  /* Radii / layout */
  --r:   18px;
  --r2:  22px;
  --max: 1120px;

  /* Fonts — system stack, kein externer Request nötig */
  --serif: ui-serif, Georgia, "Times New Roman", serif;
  --sans:  ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto,
           Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
}

/* ---------- 2) BASE ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  /* Verhindert horizontalen Overflow → kein CLS durch Scrollbar-Shift */
  overflow-x: hidden;
}

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  line-height: 1.65;
  min-height: 100vh;
  overflow-x: hidden;

  /* Hintergrund als CSS — kein Bild-Request, kein LCP-Impact */
  background:
    radial-gradient(900px 700px at 70% 18%, rgba(42,169,255,.16), transparent 60%),
    radial-gradient(820px 620px at 20% 30%, rgba(0,212,255,.10), transparent 62%),
    radial-gradient(700px 520px at 50% 85%, rgba(106,231,255,.07), transparent 60%),
    linear-gradient(180deg, var(--bg-3) 0%, var(--bg-2) 20%, var(--bg-1) 55%, var(--bg-0) 100%);
}

/* Fokus-Ring für Tastaturnavigation (Barrierefreiheit + Google Accessibility Score) */
:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 3px;
  border-radius: 4px;
}

a {
  color: var(--accent-3);
  text-underline-offset: 3px;
  /* Verhindert FOUC bei Hover-Transition */
  transition: color 0.15s ease;
}
a:hover { color: #ffffff; }

/* Bilder: immer block + explizite Dimensionen im HTML verhindern CLS */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

.container {
  width: min(var(--max), 100% - 48px);
  margin: 0 auto;
}

/* Particles overlay — rein dekorativ, kein LCP-Impact */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(2px 2px at 20% 30%, rgba(255,255,255,.08), transparent 60%),
    radial-gradient(2px 2px at 55% 20%, rgba(255,255,255,.06), transparent 60%),
    radial-gradient(2px 2px at 75% 55%, rgba(255,255,255,.05), transparent 60%),
    radial-gradient(1px 1px at 30% 80%, rgba(255,255,255,.05), transparent 60%),
    radial-gradient(1px 1px at 85% 85%, rgba(255,255,255,.04), transparent 60%);
  opacity: .6;
  mix-blend-mode: screen;
}

/* ---------- 3) TOPBAR / NAV ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(5, 22, 40, 0.55);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  /* contain verhindert Layout-Recalculations durch sticky */
  contain: layout style;
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  gap: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.brand-badge {
  /* Explizite Größe → kein CLS */
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(42,169,255,.95), rgba(0,212,255,.65));
  box-shadow: 0 14px 50px rgba(42,169,255,.22);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255,255,255,.16);
  overflow: hidden;
}
.brand-badge svg { width: 20px; height: 20px; fill: #fff; opacity: .95; }
.brand-badge img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand-title {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}
.brand-title strong {
  font-family: var(--serif);
  font-size: 18px;
  letter-spacing: .2px;
  color: #fff;
}
.brand-title span {
  font-size: 12px;
  color: var(--muted2);
}

.navlinks {
  display: flex;
  gap: 18px;
  align-items: center;
  flex-wrap: wrap;
}
.navlinks a {
  text-decoration: none;
  color: var(--muted);
  font-size: 14px;
  padding: 8px 10px;
  border-radius: 12px;
  /* border immer vorhanden → kein Layout-Shift bei hover */
  border: 1px solid transparent;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.navlinks a:hover,
.navlinks a[aria-current="page"] {
  background: rgba(255,255,255,.06);
  color: #fff;
  border-color: rgba(255,255,255,.08);
}

/* ---------- 4) BUTTONS ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-radius: 14px;
  padding: 10px 14px;
  text-decoration: none;
  font-size: 14px;
  color: #fff;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(8, 30, 55, 0.55);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow-soft);
  /* Transition statt abruptem Sprung → bessere INP-Wahrnehmung */
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease, filter 0.15s ease;
  /* Verhindert Text-Wrapping → kein CLS */
  white-space: nowrap;
}
.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 55px rgba(0,0,0,.45);
  border-color: rgba(255,255,255,.20);
}

.btn-primary {
  border: 1px solid rgba(255,255,255,.16);
  background: linear-gradient(135deg, rgba(42,169,255,.95), rgba(0,212,255,.65));
  box-shadow: 0 22px 70px rgba(42,169,255,.22);
}
.btn-primary:hover {
  filter: brightness(1.04) saturate(1.05);
}

/* ---------- 5) HERO ---------- */
.hero { padding: 54px 0 18px; }

.hero-grid {
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  gap: 42px;
  align-items: center;
}

.kicker {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(8, 30, 55, 0.45);
  color: var(--muted);
  font-size: 13px;
}
.kicker b { color: var(--accent-2); }

h1 {
  margin: 14px 0 10px;
  font-family: var(--serif);
  font-weight: 650;
  letter-spacing: .2px;
  font-size: clamp(30px, 3.2vw, 46px);
  line-height: 1.15;
  color: #fff;
  text-shadow: 0 10px 40px rgba(0,0,0,.55);
}

.lead {
  color: var(--muted);
  font-size: 16px;
  max-width: 62ch;
  margin-bottom: 18px;
}

.hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin: 18px 0 14px;
}

.hero-meta {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  color: var(--muted2);
  font-size: 13px;
}

/* Hero-Bild-Container: explizites aspect-ratio → CLS = 0 */
.hero-card {
  border-radius: var(--r2);
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(8, 30, 55, 0.45);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
  /* Verhindert Layout-Shift während Bild lädt */
  aspect-ratio: 10 / 7;
}
.hero-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.hero-card .cap {
  padding: 14px 14px 16px;
  color: var(--muted2);
  font-size: 13px;
  border-top: 1px solid rgba(255,255,255,.10);
}

/* ---------- 6) SECTIONS ---------- */
.section {
  padding: 54px 0;
  /* content-visibility: auto spart Render-Zeit für Off-Screen-Sektionen */
  content-visibility: auto;
  /* contain-intrinsic-size als Platzhalter während lazy render */
  contain-intrinsic-size: 0 400px;
}

/* Hero-Section nicht lazy rendern */
.hero { content-visibility: visible; contain-intrinsic-size: none; }

.section h2 {
  font-family: var(--serif);
  font-size: clamp(24px, 2.2vw, 34px);
  margin: 0 0 10px;
  letter-spacing: .2px;
  color: #fff;
  text-shadow: 0 10px 34px rgba(0,0,0,.45);
}

.section p {
  margin: 0;
  color: var(--muted);
  max-width: 78ch;
}

hr.sep {
  border: none;
  border-top: 1px solid var(--line);
  margin: 26px 0;
}

/* ---------- 7) GRID / CARDS ---------- */
.grid3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-top: 22px;
}

.card {
  border-radius: var(--r);
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(8, 30, 55, 0.50);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 18px 60px rgba(0,0,0,.45);
  padding: 18px;
}

.card::before {
  content: "";
  display: block;
  height: 2px;
  width: 54px;
  border-radius: 999px;
  margin-bottom: 12px;
  background: linear-gradient(90deg, rgba(0,212,255,0), rgba(0,212,255,.85), rgba(0,212,255,0));
  opacity: .9;
}

.card h2,
.card h3 {
  margin: 0 0 6px;
  font-size: 16px;
  color: #fff;
}
.card p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

/* ---------- 8) SPLIT + MEDIA ---------- */
.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  align-items: center;
  margin-top: 22px;
}

/* Medien-Container: aspect-ratio verhindert CLS beim Bild-Laden */
.media {
  border-radius: var(--r2);
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(8, 30, 55, 0.45);
  box-shadow: var(--shadow);
  aspect-ratio: 16 / 11;
}
.media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

blockquote {
  margin: 18px 0 0;
  padding: 16px 18px;
  border-radius: 14px;
  color: var(--muted);
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(8, 30, 55, 0.45);
  border-left: 3px solid rgba(0,212,255,.55);
}

/* ---------- 9) BREADCRUMBS ---------- */
.breadcrumbs {
  padding: 18px 0 0;
  color: var(--muted2);
  font-size: 13px;
}
/* Semantische ol/li ohne Marker */
.breadcrumbs ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}
.breadcrumbs li + li::before {
  content: "›";
  margin-right: 4px;
  color: var(--muted2);
}
.breadcrumbs a {
  color: var(--muted2);
  text-decoration: none;
}
.breadcrumbs a:hover { text-decoration: underline; color: #fff; }

.small {
  font-size: 13px;
  color: var(--muted2);
  max-width: 80ch;
}

/* ---------- 10) TABLE ---------- */
.table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 18px;
  overflow: hidden;
  border-radius: var(--r);
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(8, 30, 55, 0.50);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow-soft);
}

.table th, .table td {
  padding: 12px;
  border-bottom: 1px solid rgba(255,255,255,.10);
  text-align: left;
  font-size: 14px;
}

.table th {
  color: rgba(244,249,255,.82);
  font-weight: 600;
  background: rgba(255,255,255,.03);
}

.table tr:last-child td { border-bottom: none; }

/* ---------- 11) FORMS ---------- */
.form {
  margin-top: 18px;
  display: grid;
  gap: 12px;
  max-width: 720px;
}

.field {
  display: grid;
  gap: 6px;
}

label {
  font-size: 13px;
  color: var(--muted2);
}

input, textarea, select {
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.14);
  padding: 12px;
  font-size: 14px;
  outline: none;
  color: var(--ink);
  background: rgba(8, 30, 55, 0.55);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  /* font-size min 16px auf Mobile verhindert iOS Auto-Zoom → kein CLS */
  font-size: max(14px, 16px);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input::placeholder, textarea::placeholder {
  color: rgba(244,249,255,.40);
}

input:focus, textarea:focus, select:focus {
  border-color: rgba(0,212,255,.55);
  box-shadow: 0 0 0 4px rgba(0,212,255,.14);
}

textarea {
  min-height: 140px;
  resize: vertical;
  font-family: var(--sans);
}

/* ---------- 12) FOOTER ---------- */
.footer {
  padding: 34px 0;
  border-top: 1px solid rgba(255,255,255,.10);
  margin-top: 40px;
  color: var(--muted2);
  font-size: 13px;
  background: linear-gradient(180deg, rgba(6,26,51,.20), rgba(4,18,37,.55));
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.footer-grid {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}

.footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}

.footer a {
  color: var(--muted2);
  text-decoration: none;
  padding: 6px 8px;
  border-radius: 10px;
  transition: background 0.15s ease, color 0.15s ease;
}
.footer a:hover {
  background: rgba(255,255,255,.06);
  color: #fff;
}

/* ---------- 13) RESPONSIVE ---------- */
@media (max-width: 940px) {
  .hero-grid { grid-template-columns: 1fr; }
  .split      { grid-template-columns: 1fr; }
  .grid3      { grid-template-columns: 1fr; }
  .navlinks   { display: none; }

  /* Auf Mobile: aspect-ratio etwas anpassen */
  .hero-card { aspect-ratio: 4 / 3; }
  .media     { aspect-ratio: 4 / 3; }
}

@media (max-width: 480px) {
  .hero-actions { flex-direction: column; }
  .btn { width: 100%; justify-content: center; }
  h1 { font-size: clamp(26px, 7vw, 36px); }
}

/* ---------- 14) PRINT ---------- */
@media print {
  .topbar, .hero-actions, .footer nav, .btn { display: none; }
  body {
    background: white;
    color: black;
  }
  a { color: black; text-decoration: underline; }
  .card { border: 1px solid #ccc; box-shadow: none; }
}

/* ---------- 15) REDUCED MOTION (Barrierefreiheit) ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
