/* etwas kleines – Gestaltung. Tokens oben, dann Grundlagen, Bausteine, Abschnitte, Dialog.
   Das 3D-Canvas von showcase.js liegt fixiert auf z-index 1 unter dem Inhalt (main, Fuß: z-index 2).
   Deshalb haben Flächen im Inhalt keinen deckenden Hintergrund: Ein .ding ist transparent,
   und alles um ein .ding herum ebenso; der Seitenhintergrund sitzt auf body.
   Der Kopf klebt oben (sticky, z-index 3) mit halbdurchsichtigem Hintergrund über allem; das Logo darin
   zeichnet showcase.js in ein eigenes Canvas im Logo-Link .logo (über dem Kopf-Hintergrund).
   Der Anfrage-Dialog liegt als Modal im Top-Layer über allem. */

:root {
  color-scheme: light dark;
  --bg: #f6f3ee;
  --surface: #ffffff;
  --text: #1b1b1b;
  --text-leise: #5b5751;
  --border: #e6e1d9;
  --platzhalter: #ebe6de;
  --accent: #e2001a;
  --accent-tief: #c00016;
  --auf-accent: #ffffff;
  --backdrop: rgb(20 19 17 / 0.55);

  --gutter: 16px;
  --logo: 122px;           /* Kopf-Logo der Startseite (.ding--logo), bestimmt die Kopfhöhe */
  --max: 1100px;
  --radius: 20px;
  --schrift: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (min-width: 720px) {
  :root { --gutter: 32px; --logo: 150px; }
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141311;
    --surface: #1f1d1a;
    --text: #f1ede6;
    --text-leise: #aaa49a;
    --border: #34312c;
    --platzhalter: #26241f;
    --backdrop: rgb(0 0 0 / 0.65);
  }
}

/* ---------- Grundlagen ---------- */

*, *::before, *::after { box-sizing: border-box; }

/* hidden gewinnt auch gegen display-Regeln (Dialog-Zustände). */
[hidden] { display: none !important; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--schrift);
  font-size: 1.0625rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p { margin: 0; }

h1, h2 {
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.02em;
  overflow-wrap: break-word;
}

h1 { font-size: clamp(2.2rem, 6vw, 4.5rem); }
h2 { font-size: clamp(2rem, 5vw, 3.5rem); }
h3 { font-size: 1.25rem; line-height: 1.2; letter-spacing: -0.01em; }

img, svg { max-width: 100%; }

a {
  color: inherit;
  text-decoration-line: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.18em;
}
a:hover { color: var(--accent); }

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

.akzent { display: block; color: var(--accent); }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Wortmarke (Logo N2 aus /dev/logo.html, Welle 4): „etwas kleınes“ ohne Schlusspunkt, über dem punktlosen ı eine
   rote Glühbirne (Kolben + Sockel mit zwei Strichen) als Inline-SVG; Lage und Größe wie N2 in Header-Größe (.klein). */
.marke {
  font-weight: 800;
  letter-spacing: -0.02em;
  white-space: nowrap;
  color: var(--text);
}
/* line-height 1 wie in logo.html, sonst sitzt die Birne bei hoher Zeilenhöhe zu weit oben. */
.marke .i { position: relative; display: inline-block; line-height: 1; }
.marke .i svg {
  position: absolute;
  left: 50%;
  top: -0.06em;
  width: 0.4em;
  height: 0.5em;
  max-width: none;         /* sonst begrenzt img, svg { max-width: 100% } die Birne auf die Breite des ı */
  transform: translateX(-50%);
  overflow: visible;
  fill: var(--accent);
}

/* Inhalt über dem fixierten 3D-Canvas (z-index 1). */
main, .fuss { position: relative; z-index: 2; }

.rahmen {
  width: min(100% - 2 * var(--gutter), var(--max));
  margin-inline: auto;
}

/* ---------- Bausteine ---------- */

.knopf {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 44px;
  padding: 0 1.375rem;
  border: 2px solid var(--accent);
  border-radius: 999px;
  background: var(--accent);
  color: var(--auf-accent);
  font: inherit;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.knopf:hover { background: var(--accent-tief); border-color: var(--accent-tief); color: var(--auf-accent); }
.knopf:focus-visible { border-radius: 999px; }
.knopf:disabled { opacity: 0.6; cursor: progress; }

.knopf--leise {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}
.knopf--leise:hover { background: transparent; border-color: var(--text); color: var(--text); }

.chevron { flex: none; }

/* Button, der wie ein Textlink im Satz aussieht. */
.textlink {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-decoration-line: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.18em;
  cursor: pointer;
}
.textlink:hover { color: var(--accent); }

.fliesstext {
  max-width: 34em;
  font-size: clamp(1.125rem, 1.6vw, 1.375rem);
  line-height: 1.5;
}

/* 3D-Objekt (showcase.js zeichnet ins Element-Rechteck). Transparent lassen. */
.ding {
  position: relative;
  aspect-ratio: 1;
}
/* Dezenter Kreis, bis das Modell geladen ist. */
.ding::before {
  content: "";
  position: absolute;
  inset: 20%;
  border-radius: 50%;
  background: var(--platzhalter);
}
.ding.is-ready::before { content: none; }

@media (prefers-reduced-motion: no-preference) {
  .ding:not(.is-ready):not(.is-failed)::before { animation: puls 1.6s ease-in-out infinite; }
}
@keyframes puls {
  50% { opacity: 0.45; }
}

/* Ohne WebGL oder wenn ein Modell nicht lädt (is-failed): Standbild /img/fallback-<Modell>.png. */
html.no-webgl .ding::before,
.ding.is-failed::before { content: none; }
html.no-webgl .ding,
.ding.is-failed {
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
}
html.no-webgl .ding[data-model="kronkorken"],
.ding.is-failed[data-model="kronkorken"] { background-image: url("/img/fallback-kronkorken.png?v=2"); }
html.no-webgl .ding[data-model="kronkorken-fidget"],
.ding.is-failed[data-model="kronkorken-fidget"] { background-image: url("/img/fallback-kronkorken-fidget.png?v=2"); }
html.no-webgl .ding[data-model="rheinbruecke"],
.ding.is-failed[data-model="rheinbruecke"] { background-image: url("/img/fallback-rheinbruecke.png?v=2"); }
html.no-webgl .ding[data-model="lecker-burger"],
.ding.is-failed[data-model="lecker-burger"] { background-image: url("/img/fallback-lecker-burger.png?v=2"); }
html.no-webgl .ding[data-model="koelsch"],
.ding.is-failed[data-model="koelsch"] { background-image: url("/img/fallback-koelsch.png?v=2"); }
html.no-webgl .ding[data-model="dom-magnet"],
.ding.is-failed[data-model="dom-magnet"] { background-image: url("/img/fallback-dom-magnet.png"); }
html.no-webgl .ding[data-model="bic-huelle"],
.ding.is-failed[data-model="bic-huelle"] { background-image: url("/img/fallback-bic-huelle.png"); }
html.no-webgl .ding[data-model="bierdeckelhalter"],
.ding.is-failed[data-model="bierdeckelhalter"] { background-image: url("/img/fallback-bierdeckelhalter.png"); }

/* ---------- Kopf ---------- */

/* Klebt oben, damit das Logo beim ersten Scrollen sichtbar schwenkt. Die Trennlinie kommt erst nach dem
   Scrollen (html.gescrollt, app.js). */
.kopf {
  position: sticky;
  top: 0;
  z-index: 3;
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease;
}
html.gescrollt .kopf { border-bottom-color: var(--border); }

/* Eigene Ebene über dem Kopf-Hintergrund; das Kopf-Canvas liegt in .logo (z-index 0). */
.kopf__innen {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 64px;
  padding-block: 6px;
}
/* Startseite: Der Kopf ist so hoch wie das Logo; dessen Rand (der Kronkorken füllt ~83 % des Elements) ist Luft genug. */
.kopf__innen:has(.ding--logo) { padding-block: 0; }

/* Logo: der „etwas kleines“-Kronkorken in 3D (Startseite) bzw. als Standbild (Rechtsseiten). */
.logo {
  position: relative;      /* Wirt des Kopf-Canvas (showcase.js), so groß wie das Logo */
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex: none;
  min-height: 44px;
  text-decoration: none;
}
.logo:hover { color: inherit; }
/* Groß genug, dass „etwas kleines“ auf dem Kronkorken lesbar ist (so breit wie früher die Text-Wortmarke):
   Element 150 px, Kronkorken ~125 px; Mobil 122 / ~101 px. */
.ding--logo { width: var(--logo); }
.ding--logo::before { inset: 9%; }
html.no-webgl .ding--logo,
.ding--logo.is-failed { background-image: url("/img/logo.png?v=2"); }
.logo__bild { display: block; width: 48px; height: 48px; }
/* Rechtsseiten unter 360 px: nur das Standbild, sonst passen Logo, Textmarke und „Sagt es uns“ nicht neben-
   einander (bei 320 px 355 px breit). Der Link behält sein aria-label, die Textmarke ist aria-hidden. */
@media (max-width: 359.98px) {
  .logo--bild > span { display: none; }
}

.wortmarke {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  text-decoration: none;
}
.wortmarke:hover { color: inherit; }

/* ---------- Hero ---------- */

.hero {
  display: grid;
  gap: clamp(1.5rem, 4vw, 3rem);
  align-items: center;
  padding-block: clamp(1.5rem, 5vw, 4rem) clamp(3rem, 8vw, 6rem);
}

.hero__unter {
  margin-top: 1.25rem;
  font-size: clamp(1.125rem, 2vw, 1.5rem);
  color: var(--text-leise);
}

.hero__aktionen {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 2rem;
}

.ding--hero {
  width: min(70vw, 420px, 100%);
  justify-self: center;
}

@media (min-width: 860px) {
  .hero { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); }
}

/* ---------- Abschnitte ---------- */

.abschnitt {
  padding-block: clamp(4rem, 10vw, 7.5rem);
  border-top: 1px solid var(--border);
  scroll-margin-top: calc(var(--logo) + 8px);   /* unter dem klebenden Kopf */
}

.abschnitt h2 + .fliesstext { margin-top: 1.25rem; }

/* Kronkorken-Reihe: passt sie nicht in die Breite, scrollt sie waagerecht. Sie reicht dann bis
   an die Fensterkanten (negativer Rand = Seitenrand), weil das 3D-Canvas am Fenster clippt;
   der Innenabstand hält das erste Ding bündig mit dem Text. */
.reihe {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  margin: clamp(2.5rem, 6vw, 4rem) calc(-1 * var(--gutter)) 0;
  padding: 0 var(--gutter);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: var(--gutter);
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.reihe .ding {
  flex: 1 0 220px;
  max-width: 260px;
  scroll-snap-align: start;
}
/* Ab 720 px teilen sich die vier die Breite (mind. 180 px); ab ≈ 900 px passt die Reihe ohne Scrollen. */
@media (min-width: 720px) {
  .reihe .ding {
    flex: 1 1 calc((100% - 3 * 24px) / 4);
    min-width: 180px;
  }
}

.karten {
  display: grid;
  gap: 12px;
  margin: clamp(2.5rem, 6vw, 4rem) 0 0;
  padding: 0;
  list-style: none;
}
/* Zwei Spalten schon auf dem Handy: Text-Karten und 3D-Karten stehen jeweils paarweise. */
@media (min-width: 360px) {
  .karten { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 960px) {
  .karten { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
}

/* Karten ohne Fläche: Ein deckender Hintergrund läge über dem 3D-Canvas. */
.karte {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 14px 14px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.karte p { color: var(--text-leise); }
.karte .karte__zahl { color: var(--text); }
.karte h3 { margin-top: 0.5rem; }

.ding--karte { width: min(100%, 180px); }

.karte__zahl {
  display: flex;
  align-items: center;
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
  white-space: nowrap;
}
@media (min-width: 720px) {
  .karte { padding: 20px 22px 24px; }
  .karte__zahl { font-size: 3rem; }
}
/* Vierspaltig: 3D-Dinger 140 px, die Zahl-Karten gleich hoch. */
@media (min-width: 960px) {
  .ding--karte { width: 140px; }
  .karte__zahl { height: 140px; }
}

/* 3D-Ding und Text nebeneinander (Magnete, BiC, Ständer). Auf Mobil steht der Text oben. */
.paar {
  display: grid;
  gap: clamp(2rem, 5vw, 4rem);
  align-items: center;
}
.paar__text { order: -1; }

.ding--bic {
  width: min(80vw, 400px, 100%);
  justify-self: center;
}

/* Dom-Magnet: hochkant (30 × 61,5 mm); showcase.js passt ihn per fit 'turn' in die Höhe ein. */
.ding--magnet {
  width: min(60vw, 300px, 100%);
  aspect-ratio: 3 / 5;
  justify-self: center;
}
/* Platzhalter-Kreis im hochkanten Element rund halten. */
.ding--magnet::before { inset: 32% 20%; }

.ding--halter {
  width: min(88vw, 480px, 100%);
  justify-self: center;
}

@media (min-width: 860px) {
  .paar { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .paar__text { order: 0; }
  .paar--umgekehrt .paar__text { order: -1; }
}

.mehr { text-align: center; }
.mehr .fliesstext { margin-inline: auto; }
.mehr .hinweis {
  margin-top: 1.5rem;
  color: var(--text-leise);
  overflow-wrap: anywhere;
}

/* ---------- Fuß ---------- */

.fuss { border-top: 1px solid var(--border); }

.fuss__innen {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  padding-block: 20px 28px;
  color: var(--text-leise);
}

.fuss nav { display: flex; flex-wrap: wrap; margin-inline: -10px; }
.fuss nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding-inline: 10px;
  text-decoration: none;
}
.fuss nav a:hover { color: var(--text); text-decoration: underline; text-decoration-color: var(--accent); }

/* ---------- Rechtstexte ---------- */

.recht { padding-block: clamp(2rem, 6vw, 5rem) clamp(4rem, 10vw, 7rem); }
.recht h1 { font-size: clamp(2.2rem, 6vw, 3.5rem); margin-bottom: 2rem; }
.recht h2 {
  font-size: 1.25rem;
  line-height: 1.25;
  letter-spacing: -0.01em;
  margin: 2.25rem 0 0.5rem;
}
.recht p, .recht ul { max-width: 40em; }
.recht p + p { margin-top: 0.75rem; }
.recht ul { margin: 0.5rem 0 0; padding-left: 1.25rem; }

/* ---------- Dialog ---------- */

.anfrage {
  width: min(100% - 2 * var(--gutter), 480px);
  max-width: none;
  max-height: calc(100dvh - 2 * var(--gutter));
  padding: 0;
  border: 0;
  border-radius: 24px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 24px 64px rgb(0 0 0 / 0.28);
}
.anfrage::backdrop { background: var(--backdrop); }

.anfrage__innen { padding: 28px 24px 24px; }

.anfrage h2 {
  font-size: clamp(1.5rem, 5vw, 1.875rem);
  margin-bottom: 1.25rem;
}

.anfrage__form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.feld {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-weight: 600;
}

.feld input,
.feld textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 1rem;
  font-weight: 400;
}
.feld textarea { resize: vertical; min-height: 7.5rem; }
.feld input:focus-visible,
.feld textarea:focus-visible { border-color: var(--accent); outline-offset: 1px; }
.feld input:user-invalid,
.feld textarea:user-invalid { border-color: var(--accent); }
.feld textarea::placeholder { color: var(--text-leise); opacity: 1; }

/* Honeypot: für Menschen unsichtbar, für Bots ein normales Feld. */
.honig {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.anfrage__info { font-size: 0.9375rem; color: var(--text-leise); }

.anfrage__meldung {
  padding: 12px 14px;
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  overflow-wrap: anywhere;
}

.anfrage__knoepfe {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.25rem;
}

.anfrage__danke-text {
  font-size: 1.375rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
}
.anfrage__danke-text:focus { outline: none; }

/* ---------- Weniger Bewegung ---------- */

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