/* ================================================================
   shared/style-base.css — tk-comp.de
   Self-hosted Fonts (Geist Sans/Mono via @fontsource),
   Base-Layer, Custom Utilities, Form & Button Components.
   Erst NACH /shared/tailwind.css einbinden.
   ================================================================ */

/* ── Self-hosted Geist via @fontsource → /shared/fonts/ ───── */
@font-face {
  font-family: "Geist Sans";
  font-style: normal;
  font-display: swap;
  font-weight: 400;
  src: url("/shared/fonts/geist-sans-latin-400-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Geist Sans";
  font-style: normal;
  font-display: swap;
  font-weight: 500;
  src: url("/shared/fonts/geist-sans-latin-500-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Geist Sans";
  font-style: normal;
  font-display: swap;
  font-weight: 600;
  src: url("/shared/fonts/geist-sans-latin-600-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Geist Sans";
  font-style: normal;
  font-display: swap;
  font-weight: 700;
  src: url("/shared/fonts/geist-sans-latin-700-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Geist Mono";
  font-style: normal;
  font-display: swap;
  font-weight: 400;
  src: url("/shared/fonts/geist-mono-latin-400-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Geist Mono";
  font-style: normal;
  font-display: swap;
  font-weight: 500;
  src: url("/shared/fonts/geist-mono-latin-500-normal.woff2") format("woff2");
}

/* ── Base ──────────────────────────────────────────────────── */
* {
  border-color: hsl(var(--border));
}
html {
  scroll-behavior: smooth;
}
body {
  background-color: hsl(var(--background));
  color: hsl(var(--foreground));
  font-family: "Geist Sans", ui-sans-serif, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "rlig" 1, "calt" 1;
}
section[id] {
  scroll-margin-top: 80px;
}

/* ── Custom Utilities ─────────────────────────────────────── */
.container-narrow {
  margin-inline: auto;
  width: 100%;
  max-width: 72rem;
  padding-inline: 1rem;
}
@media (min-width: 640px) {
  .container-narrow { padding-inline: 1.5rem; }
}
@media (min-width: 1024px) {
  .container-narrow { padding-inline: 2rem; }
}

.text-balance {
  text-wrap: balance;
}

.hero-gradient {
  /* Pure-Monochrom-Schimmer: dezent, ohne Farb-Pop */
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%, hsl(217 32% 15% / 0.06), transparent 60%),
    radial-gradient(ellipse 60% 80% at 100% 100%, hsl(218 21% 37% / 0.04), transparent 60%),
    hsl(var(--background));
}
@media (prefers-color-scheme: dark) {
  .hero-gradient {
    /* Helle Slate-Schimmer auf dunklem Grund */
    background:
      radial-gradient(ellipse 80% 60% at 50% 0%, hsl(217 22% 78% / 0.10), transparent 60%),
      radial-gradient(ellipse 60% 80% at 100% 100%, hsl(217 22% 62% / 0.08), transparent 60%),
      hsl(var(--background));
  }
}

.grid-pattern {
  background-image:
    linear-gradient(to right, hsl(var(--border) / 0.5) 1px, transparent 1px),
    linear-gradient(to bottom, hsl(var(--border) / 0.5) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: radial-gradient(ellipse 80% 50% at 50% 0%, black 40%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse 80% 50% at 50% 0%, black 40%, transparent 70%);
}

/* ── Reveal animation (framer-motion-Ersatz) ─────────────── */
@keyframes fade-up {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.reveal {
  animation: fade-up 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@media (prefers-reduced-motion: reduce) {
  .reveal { animation: none; }
}

/* ── Form components ───────────────────────────────────────── */
.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.375rem;
  color: hsl(var(--foreground));
}
.form-required { color: hsl(var(--destructive)); }

.form-input,
.form-textarea {
  display: block;
  width: 100%;
  padding: 0.625rem 0.875rem;
  border-radius: 0.625rem;
  border: 1px solid hsl(var(--border));
  background-color: hsl(var(--background));
  color: hsl(var(--foreground));
  font-size: 0.875rem;
  line-height: 1.5;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  min-height: 44px;
}
.form-textarea {
  min-height: 144px;
  resize: vertical;
  font-family: inherit;
}
.form-input::placeholder,
.form-textarea::placeholder {
  color: hsl(var(--muted-foreground));
}
.form-input:focus,
.form-textarea:focus {
  border-color: hsl(var(--ring));
  box-shadow: 0 0 0 3px hsl(var(--ring) / 0.18);
}
.form-input[aria-invalid="true"],
.form-textarea[aria-invalid="true"] {
  border-color: hsl(var(--destructive));
}

.form-error {
  margin-top: 0.375rem;
  font-size: 0.75rem;
  color: hsl(var(--destructive));
}

.form-error-box {
  padding: 0.875rem 1rem;
  border-radius: 0.625rem;
  font-size: 0.875rem;
  border: 1px solid hsl(var(--destructive) / 0.3);
  background: hsl(var(--destructive) / 0.05);
  color: hsl(var(--destructive));
}

.form-checkbox {
  appearance: none;
  -webkit-appearance: none;
  width: 1.125rem;
  height: 1.125rem;
  margin-top: 0.125rem;
  border-radius: 0.25rem;
  border: 1.5px solid hsl(var(--border));
  background-color: hsl(var(--background));
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
  transition: background-color 0.15s, border-color 0.15s;
}
.form-checkbox:focus-visible {
  outline: 2px solid hsl(var(--ring));
  outline-offset: 2px;
}
.form-checkbox:checked {
  background-color: hsl(var(--primary));
  border-color: hsl(var(--primary));
}
.form-checkbox:checked::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='20 6 9 17 4 12'/></svg>");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 75%;
}

/* ── Button base ───────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6875rem 1.25rem;
  border-radius: 0.625rem;
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition:
    filter 0.15s,
    transform 0.15s,
    box-shadow 0.15s,
    background-color 0.15s,
    border-color 0.15s,
    color 0.15s;
  min-height: 44px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.btn-lg {
  padding: 0.875rem 1.5rem;
  font-size: 0.9375rem;
}
.btn-primary {
  background-color: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
}
.btn-primary:hover:not(:disabled) {
  filter: brightness(1.08);
  box-shadow: 0 8px 24px -8px hsl(var(--primary) / 0.45);
}
.btn-primary:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}
.btn-outline {
  background: transparent;
  color: hsl(var(--foreground));
  border-color: hsl(var(--border));
}
.btn-outline:hover {
  background: hsl(var(--muted));
}
.btn-secondary {
  background-color: white;
  /* Fix-Stelle D: Auf dem custom-dev-gradient (immer hell-bunt) bleibt
     dunkles Sapphire fest verankert — sonst wird der Text im Dark-Mode
     zu hell (primary wird im Dark zu hellem Blau) und der Kontrast bricht. */
  color: hsl(217 32% 15%);
  border-color: white;
}
.btn-secondary:hover {
  background-color: hsl(0 0% 96%);
  box-shadow: 0 8px 24px -8px rgb(15 23 42 / 0.18);
}

/* ── Sector + Highlight badges (ReferenceCard) ─────────────── */
.ref-sector {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.625rem;
  border-radius: 9999px;
  font-size: 0.6875rem;
  font-family: "Geist Mono", ui-monospace, monospace;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: rgb(255 255 255 / 0.92);
  backdrop-filter: blur(4px);
  /* Fix-Stelle B: Badge sitzt auf der hellen Card-Bildfläche, die in beiden
     Modi hell bleibt. Daher Textfarbe fix verankert — sonst wird im Dark
     der Primary heller und das Badge unlesbar. */
  color: hsl(217 32% 15%);
  box-shadow: 0 2px 6px -2px rgb(0 0 0 / 0.05), 0 4px 12px -4px rgb(0 0 0 / 0.06);
}

.ref-highlight {
  display: inline-flex;
  align-items: baseline;
  gap: 0.375rem;
  border-radius: 0.75rem;
  background: rgb(255 255 255 / 0.95);
  backdrop-filter: blur(4px);
  padding: 0.5rem 0.875rem;
  box-shadow: 0 8px 24px -8px rgb(15 23 42 / 0.10), 0 16px 48px -16px rgb(15 23 42 / 0.15);
}
.ref-highlight-value {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  /* Fix-Stelle C: Wert+Label sitzen im hellen Highlight-Block — Farben
     fix verankert, damit Dark-Mode-Vars sie nicht aufhellen. */
  color: hsl(217 32% 15%);
  line-height: 1;
}
.ref-highlight-label {
  font-size: 0.625rem;
  font-family: "Geist Mono", ui-monospace, monospace;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: hsl(215 16% 47%);
}

/* ── Custom-Dev gradient background ──────────────────────── */
.custom-dev-gradient {
  /* Bewusst HART KODIERT statt var(): Die CustomDev-Sektion soll in beiden
     Modi den gleichen tiefblauen Charakter behalten, sonst würde sie im
     Dark-Mode hell-cyan werden (Primary wird im Dark heller). */
  background: linear-gradient(
    135deg,
    hsl(217 32% 15%) 0%,
    hsl(217 32% 15%) 50%,
    hsl(218 21% 37%) 100%
  );
}
.custom-dev-overlay {
  background-image:
    radial-gradient(circle at 20% 0%, rgb(255 255 255 / 0.15), transparent 40%),
    radial-gradient(circle at 80% 100%, rgb(255 255 255 / 0.10), transparent 40%);
}

/* ── Header glass effect when scrolled ───────────────────── */
.header-scrolled {
  background-color: hsl(var(--background) / 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid hsl(var(--border) / 0.6);
  box-shadow: 0 2px 6px -2px rgb(0 0 0 / 0.05), 0 4px 12px -4px rgb(0 0 0 / 0.06);
}

/* ── Touch targets (WCAG 2.5.5) ───────────────────────────── */
@media (hover: none) and (pointer: coarse) {
  .btn { min-height: 48px; }
  .form-input { min-height: 48px; }
  nav a, footer nav a {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }
}

/* ── Form Input iOS Safari (verhindert Zoom-In bei Focus) ── */
@media (max-width: 640px) {
  .form-input, .form-textarea { font-size: 16px; }
}
