:root {
  --bg: #f8f9fa;
  --text: #212529;
  --text-muted: #6c757d;
  --card-bg: #ffffff;
  --accent: #7c3aed;
  --accent-hover: #6d28d9;
  --border: #e5e7eb;
  --header-bg: #ffffff;
  --footer-bg: #f3f4f6;
  --shadow: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-hover: 0 4px 12px rgba(0,0,0,0.1);
  --tag-bg: rgba(124, 58, 237, 0.08);
  --tag-text: #7c3aed;
  --notice-bg: rgba(245, 158, 11, 0.08);
  --notice-border: #f59e0b;
  --radius: 0.75rem;
  --radius-sm: 0.375rem;
  color-scheme: light dark;
}

.card--full {
  grid-column: 1 / -1;
}

/* Impressum Card */
.card-impressum {
  background: linear-gradient(135deg, #f5f3ff, #ede9fe);
  border-color: #8b5cf6;
  text-align: center;
  justify-content: center;
  align-items: center;
  padding: 2rem;
  margin-top: 2rem;
}

.card-impressum h2 {
  color: #6d28d9;
}

.card-impressum p {
  color: #4b5563;
  max-width: 60ch;
  margin-left: auto;
  margin-right: auto;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0b0b;
    --text: #e5e7eb;
    --text-muted: #9ca3af;
    --card-bg: #171717;
    --accent: #8b5cf6;
    --accent-hover: #7c3aed;
    --border: #262626;
    --header-bg: #171717;
    --footer-bg: #0f0f0f;
    --shadow: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-hover: 0 4px 12px rgba(0,0,0,0.4);
    --tag-bg: rgba(139, 92, 246, 0.12);
    --tag-text: #a78bfa;
    --notice-bg: rgba(245, 158, 11, 0.12);
    --notice-border: #fbbf24;
  }

  .card-impressum {
    background: linear-gradient(135deg, #2e1065, #1e1b4b);
    border-color: var(--accent);
  }

  .card-impressum h2 {
    color: #c4b5fd;
  }

  .card-impressum p {
    color: #c4b5fd;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .card, .btn {
    transition: none;
  }
  .card:hover {
    transform: none;
  }
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  -webkit-tap-highlight-color: transparent;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  -webkit-text-size-adjust: 100%;
  touch-action: manipulation;
}

/* Skip Link */
.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  background: var(--accent);
  color: #fff;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  z-index: 100;
  text-decoration: none;
  font-weight: 600;
}

.skip-link:focus {
  top: 1rem;
}

.container {
  width: 100%;
  max-width: 860px;
  margin: 0 auto;
  padding-left: max(1.25rem, env(safe-area-inset-left));
  padding-right: max(1.25rem, env(safe-area-inset-right));
  padding-bottom: max(1.5rem, env(safe-area-inset-bottom));
}

/* Header */
.site-header {
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 10;
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 0;
}

.logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
  letter-spacing: -0.02em;
}

.logo:hover,
.logo:focus-visible {
  color: var(--accent-hover);
}

.nav-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  margin-left: 1.5rem;
  transition: color 0.15s;
}

.nav-links a:hover,
.nav-links a:focus-visible {
  color: var(--accent);
}

/* Focus styles */
a:focus-visible,
.btn:focus-visible,
.card:focus-visible,
.logo:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Main Content */
main {
  flex: 1;
  padding-top: 2rem;
}

h1 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  letter-spacing: -0.02em;
}

h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  color: var(--accent);
}

h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}

p {
  margin-bottom: 1rem;
  max-width: 70ch;
}

.lead {
  font-size: 1.1rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
}

/* Notice Banner */
.notice-banner {
  background: var(--notice-bg);
  border: 1px solid var(--notice-border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 2rem;
  font-size: 0.9rem;
  color: var(--text);
}

.notice-banner strong {
  color: var(--notice-border);
}

/* Generator Notice (Datenschutz-Generator.de) */
.generator-notice {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  text-align: center;
}

.generator-notice a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.generator-notice a:hover {
  color: var(--accent-hover);
}

/* Cards */
.card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin-top: 1.5rem;
}

@media (min-width: 640px) {
  .card-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
  transition: transform 0.15s, box-shadow 0.15s;
  min-height: 44px;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

.card h2 {
  font-size: 1.15rem;
  margin-top: 0;
  margin-bottom: 0.25rem;
  color: var(--text);
}

.card .domain {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: "SF Mono", "Menlo", "Consolas", monospace;
  margin-bottom: 0.75rem;
}

.card p {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.card .services {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: auto;
}

.tag {
  display: inline-flex;
  align-items: center;
  background: var(--tag-bg);
  color: var(--tag-text);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  min-height: 26px;
}

/* Legal Text Styling */
.legal-text h2 {
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
}

.legal-text ul, .legal-text ol {
  margin-left: 1.25rem;
  margin-bottom: 1rem;
}

.legal-text li {
  margin-bottom: 0.5rem;
}

.legal-text strong {
  font-weight: 600;
  color: var(--text);
}

/* Placeholder Highlight */
.placeholder {
  background: rgba(124, 58, 237, 0.1);
  border: 1px dashed var(--accent);
  border-radius: 0.25rem;
  padding: 0.1rem 0.4rem;
  font-weight: 600;
  color: var(--accent);
  font-size: 0.9em;
}

.todo-banner {
  background: rgba(124, 58, 237, 0.08);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 2rem;
  font-size: 0.9rem;
}

.todo-banner strong {
  color: var(--accent);
}

/* Card Actions (Buttons inside non-link cards) */
.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background: var(--accent);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: background 0.15s;
  min-height: 44px;
}

.btn:hover,
.btn:focus-visible {
  background: var(--accent-hover);
  color: #fff;
}

.btn--small {
  font-size: 0.8rem;
  padding: 0.4rem 0.6rem;
}

/* Footer */
.site-footer {
  background: var(--footer-bg);
  border-top: 1px solid var(--border);
  padding: 1.5rem 0;
  margin-top: auto;
}

.site-footer p {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 0;
}

/* Links */
a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

a:hover,
a:focus-visible {
  color: var(--accent-hover);
}

/* Small viewport */
@media (max-width: 360px) {
  html { font-size: 15px; }
  .container {
    padding-left: max(0.875rem, env(safe-area-inset-left));
    padding-right: max(0.875rem, env(safe-area-inset-right));
  }
}

/* Print Styles */
@media print {
  .site-header,
  .site-footer,
  .notice-banner,
  .skip-link {
    display: none;
  }

  body {
    background: #fff !important;
    color: #000 !important;
    font-size: 12pt;
    line-height: 1.5;
  }

  a[href]::after {
    content: " (" attr(href) ")";
    font-size: 0.85em;
    color: #444;
    word-break: break-all;
  }

  a[href^="/"]::after,
  a[href^="#"]::after {
    content: "";
  }

  .card {
    box-shadow: none !important;
    border: 1px solid #ccc !important;
    break-inside: avoid;
  }

  h1, h2, h3 {
    break-after: avoid;
    color: #000 !important;
  }

  .card-impressum {
    background: #f5f5f5 !important;
    border-color: #999 !important;
  }

  .tag {
    border: 1px solid #999 !important;
  }
}
