/* ==========================================================================
   Autohandel Köpenick
   Ein Stylesheet, keine Abhängigkeiten, keine Webfonts.
   Farbwelt: Kiefernwald Müggelheim. Akzent: das Rot aus dem Logo (#e31f25).
   ========================================================================== */

:root {
  /* Farbe */
  --bg:        #0e1613;
  --bg-2:      #1a2b23;
  --surface:   #22362d;
  --surface-2: #2a4136;
  --line:      #32493d;
  --line-soft: #24382f;
  --primary:   #2b443b;
  --accent:      #e31f25;   /* Logo-Rot, gemessen aus dem Logo — für Flächen */
  --accent-hover:#f5352c;
  /* Reines Logo-Rot erreicht auf --bg nur 3,93:1 und trägt keinen kleinen
     Text. Diese aufgehellte Variante desselben Rots kommt auf 5,02:1. */
  --accent-text: #ef4a45;
  --text:      #edf2ef;
  --muted:     #8fa199;
  --white:     #ffffff;

  /* Schrift */
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  /* Maß */
  --wrap: 1180px;
  --gut: clamp(1.25rem, 4vw, 2.5rem);
  --radius: 2px;

  /* Rhythmus */
  --sp-section: clamp(4.5rem, 9vw, 8rem);
}

/* --- Reset ---------------------------------------------------------------- */

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img, svg { max-width: 100%; display: block; }
a { color: inherit; }

h1, h2, h3, h4 {
  margin: 0;
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

p { margin: 0; text-wrap: pretty; }

:where(button, input, select, textarea) { font: inherit; color: inherit; }

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

::selection { background: var(--accent); color: #fff; }

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  background: var(--accent);
  color: #fff;
  padding: 0.75rem 1.25rem;
  font-weight: 700;
}
.skip-link:focus { left: 0; }

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

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

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--gut);
}

/* Mono-Utility: Augenbrauen, Labels, Datenwerte. Ein Fahrzeuginserat ist ein
   Datenblatt — die Schrift darf das zeigen. */
.eyebrow {
  margin: 0 0 1.25rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-text);
}
.eyebrow--muted { color: var(--muted); }

.section { padding-block: var(--sp-section); }
.section--tight { padding-block: clamp(3rem, 6vw, 5rem); }
.section--edge { border-top: 1px solid var(--line-soft); }
.section--raised { background: var(--bg-2); }

.section-head { max-width: 46rem; margin-bottom: clamp(2.5rem, 5vw, 3.5rem); }
.section-title { font-size: clamp(1.9rem, 4.4vw, 2.9rem); }
.section-lede { margin-top: 1.15rem; color: var(--muted); font-size: 1.05rem; }

.lede { color: var(--muted); font-size: clamp(1.05rem, 1.9vw, 1.2rem); }

/* --- Buttons -------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.9rem 1.6rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: -0.01em;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.18s ease, transform 0.18s ease, border-color 0.18s ease;
}
.btn:hover { background: var(--accent-hover); transform: translateY(-2px); }
.btn:active { transform: translateY(0); }

.btn--ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--text);
}
.btn--ghost:hover { background: var(--surface); border-color: var(--muted); transform: translateY(-2px); }

.btn--block { width: 100%; justify-content: center; }

.btn-row { display: flex; flex-wrap: wrap; gap: 0.85rem; margin-top: 2rem; }

/* Textlink mit Unterstrich, der beim Hover wächst */
.link {
  color: var(--text);
  text-decoration: none;
  background-image: linear-gradient(var(--accent), var(--accent));
  background-repeat: no-repeat;
  background-position: 0 100%;
  background-size: 100% 1px;
  padding-bottom: 2px;
  transition: background-size 0.2s ease, color 0.2s ease;
}
.link:hover { background-size: 100% 2px; color: var(--accent-text); }

/* --- Kopfzeile ------------------------------------------------------------ */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line-soft);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  min-height: 68px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  flex-shrink: 0;
}
.brand img { width: 38px; height: 38px; border-radius: var(--radius); }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-weight: 800; font-size: 0.98rem; letter-spacing: -0.02em; }
.brand-sub {
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.nav { display: flex; align-items: center; gap: 0.35rem; }

.nav a {
  padding: 0.5rem 0.85rem;
  font-size: 0.92rem;
  text-decoration: none;
  color: var(--muted);
  border-radius: var(--radius);
  transition: color 0.16s ease, background 0.16s ease;
}
.nav a:hover { color: var(--text); background: var(--surface); }
.nav a[aria-current="page"] { color: var(--text); font-weight: 600; }

/* Der Telefon-Button steht in der Navigation und wird deshalb von `.nav a`
   (0,1,1) und `.nav a:hover` (0,2,1) geschlagen — beide sind spezifischer als
   `.btn` (0,1,0) bzw. `.btn:hover` (0,2,0) und stehen später im Stylesheet.
   Ohne diese Regeln bekäme der Button graugrüne Schrift auf Rot und beim
   Überfahren den Nav-Hintergrund. */
.nav a.header-cta {
  margin-left: 0.5rem;
  padding: 0.62rem 1.15rem;
  font-size: 0.88rem;
  color: #fff;
}
.nav a.header-cta:hover {
  color: #fff;
  background: var(--accent-hover);
}

.nav-toggle {
  display: none;
  width: 42px; height: 42px;
  padding: 0;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
}
.nav-toggle span {
  display: block;
  width: 18px; height: 1.5px;
  margin: 3.5px auto;
  background: var(--text);
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(5px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-5px) rotate(-45deg); }

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

.hero {
  position: relative;
  padding-top: clamp(3.5rem, 8vw, 6.5rem);
  padding-bottom: 0;
  overflow: hidden;
}

.hero-inner { position: relative; z-index: 2; padding-bottom: clamp(7rem, 14vw, 11rem); }

.hero-title {
  font-size: clamp(2.6rem, 7.2vw, 5.1rem);
  max-width: 15ch;
}
.hero-title em {
  font-style: normal;
  color: var(--accent-text);
}

.hero-lede {
  margin-top: 1.75rem;
  max-width: 44ch;
  color: var(--muted);
  font-size: clamp(1.05rem, 2vw, 1.22rem);
}

/* Live-Bestandszahl aus der Carposé-API, im Fließtext statt als Kachel */
.stock {
  font-family: var(--mono);
  font-weight: 600;
  color: var(--accent-text);
  font-variant-numeric: tabular-nums;
}

/* Signature: die Kiefern-Horizontlinie. Der Hof grenzt direkt an den
   Berliner Stadtforst — die Linie ist der Ort, nicht Dekoration. */
.treeline {
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: clamp(90px, 15vw, 170px);
  background-color: var(--bg-2);
  pointer-events: none;
  z-index: 1;
  -webkit-mask: url("../img/treeline.svg") no-repeat bottom / 100% 100%;
          mask: url("../img/treeline.svg") no-repeat bottom / 100% 100%;
}

@media (prefers-reduced-motion: no-preference) {
  .treeline {
    opacity: 0;
    transform: translateY(14px);
    transition: opacity 1.1s ease 0.55s, transform 1.1s cubic-bezier(0.22, 1, 0.36, 1) 0.55s;
  }
  .treeline.is-in { opacity: 1; transform: none; }
}

.hero-search { position: relative; z-index: 2; background: var(--bg-2); }
/* Oben und unten gleich viel Luft — sonst klebt die Augenbraue am Waldboden. */
.hero-search .wrap {
  padding-top: clamp(3rem, 6vw, 4.5rem);
  padding-bottom: clamp(3rem, 6vw, 4.5rem);
}
.hero-search .eyebrow { margin-bottom: 1.35rem; }

/* --- Karten / Raster ------------------------------------------------------ */

.grid { display: grid; gap: 1.25rem; }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr)); }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr)); }

/* Eine Abfolge darf nicht 3 + 1 umbrechen — feste Stufen statt auto-fit. */
.grid--steps { grid-template-columns: 1fr; }
@media (min-width: 640px)  { .grid--steps { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1020px) { .grid--steps { grid-template-columns: repeat(4, 1fr); } }

.card {
  padding: clamp(1.6rem, 3vw, 2.1rem);
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
}
.card-index {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  color: var(--accent-text);
  margin-bottom: 1.1rem;
}
.card h3 { font-size: 1.22rem; margin-bottom: 0.7rem; letter-spacing: -0.02em; }
.card p { color: var(--muted); font-size: 0.96rem; }

/* --- Vertrauen / Portale -------------------------------------------------- */

.trust-grid { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 19rem), 1fr)); }

.portal {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
  padding: 1.6rem;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  text-decoration: none;
  transition: border-color 0.18s ease, transform 0.18s ease;
}
.portal:hover { border-color: var(--accent); transform: translateY(-3px); }

/* Beide Marken tragen dunkle Anteile (#350051 bzw. #333), die auf dem dunklen
   Grund verschwinden. Umfärben verbietet sich bei fremden Logos — also eine
   helle Trägerfläche. Die feste Höhe gibt beiden Logos trotz
   unterschiedlicher Seitenverhältnisse (4,74:1 und 4,21:1) gleiches Gewicht. */
.portal-plate {
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: flex-start;   /* Fläche umschließt das Logo, statt sich zu strecken */
  height: 64px;
  padding-inline: 1.5rem;
  background: #fff;
  border-radius: var(--radius);
}
.portal-plate img {
  height: 30px;
  width: auto;
  max-width: 100%;
}

.portal-label { font-weight: 700; letter-spacing: -0.02em; }
.portal-note { font-size: 0.9rem; color: var(--muted); }

/* --- Standort / Kontakt --------------------------------------------------- */

.split { display: grid; gap: clamp(2rem, 5vw, 4rem); grid-template-columns: 1fr; }
@media (min-width: 900px) { .split { grid-template-columns: 1fr 1fr; align-items: start; } }

.contact-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 1.5rem; }
.contact-list dt,
.contact-label {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.4rem;
}
.contact-value { font-size: 1.08rem; font-weight: 600; letter-spacing: -0.01em; }
.contact-value a { text-decoration: none; }
.contact-value a:hover { color: var(--accent-text); }

/* Karte wird erst auf Klick geladen — vorher geht kein Request nach außen. */
.map {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
}
/* Leicht gedämpft, damit die Karte nicht in die dunkle Seite sticht —
   nicht invertiert, das macht Karten unlesbar. */
.map iframe {
  width: 100%; height: 100%;
  border: 0; display: block;
  filter: saturate(0.72) brightness(0.84) contrast(1.04);
}

.map-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 2rem;
  text-align: center;
  background:
    repeating-linear-gradient(45deg, transparent 0 14px, rgba(255,255,255,0.014) 14px 28px),
    var(--surface);
}
.map-placeholder p { color: var(--muted); font-size: 0.9rem; max-width: 30ch; }

.photo-frame {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.photo-frame img { width: 100%; height: auto; }
.photo-caption {
  padding: 0.85rem 1.1rem;
  background: var(--surface);
  border-top: 1px solid var(--line-soft);
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

/* --- Formular ------------------------------------------------------------- */

.form { display: grid; gap: 1.15rem; }
.form-row { display: grid; gap: 1.15rem; grid-template-columns: 1fr; }
@media (min-width: 640px) { .form-row { grid-template-columns: 1fr 1fr; } }

.field { display: flex; flex-direction: column; gap: 0.45rem; }
.field > label {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.field input,
.field select,
.field textarea {
  padding: 0.8rem 0.95rem;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  transition: border-color 0.16s ease;
}
.field input:hover,
.field select:hover,
.field textarea:hover { border-color: var(--muted); }
.field input:focus,
.field select:focus,
.field textarea:focus { border-color: var(--accent); outline: none; }
.field textarea { resize: vertical; min-height: 8rem; }

.field--check { flex-direction: row; align-items: flex-start; gap: 0.7rem; }
.field--check input { width: 1.1rem; height: 1.1rem; margin-top: 0.25rem; accent-color: var(--accent); flex-shrink: 0; }
.field--check label { font-family: var(--sans); font-size: 0.9rem; letter-spacing: 0; text-transform: none; color: var(--muted); line-height: 1.5; }

/* Honeypot — für Menschen unsichtbar, für Bots verlockend */
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.form-note { font-size: 0.85rem; color: var(--muted); }

.form-status {
  padding: 0.9rem 1.1rem;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 0.94rem;
}
.form-status[hidden] { display: none; }
.form-status--error { border-left-color: #e0524a; }

/* --- Fließtext (Recht, Über uns) ------------------------------------------ */

.prose { max-width: 44rem; }
.prose h2 { font-size: clamp(1.35rem, 2.8vw, 1.7rem); margin-top: 3rem; margin-bottom: 0.9rem; }
.prose h3 { font-size: 1.08rem; margin-top: 2rem; margin-bottom: 0.6rem; }
.prose p, .prose li { color: var(--muted); }
.prose p + p { margin-top: 1rem; }
.prose ul { margin: 1rem 0; padding-left: 1.15rem; }
.prose li { margin-bottom: 0.45rem; }
.prose a { color: var(--text); text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 3px; }
.prose a:hover { color: var(--accent-text); }
.prose > h2:first-child { margin-top: 0; }

.page-head { padding-top: clamp(3rem, 7vw, 5rem); padding-bottom: clamp(2rem, 4vw, 3rem); }
.page-title { font-size: clamp(2.2rem, 5.5vw, 3.5rem); }
.page-lede { margin-top: 1.25rem; max-width: 46ch; color: var(--muted); font-size: 1.1rem; }

/* --- CTA-Band ------------------------------------------------------------- */

.cta-band { background: var(--primary); border-top: 1px solid var(--line); }
.cta-band .wrap {
  padding-block: clamp(3.5rem, 7vw, 5rem);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
}
.cta-band h2 { font-size: clamp(1.7rem, 3.6vw, 2.4rem); max-width: 20ch; }
.cta-band p { margin-top: 0.85rem; color: #c3d3cb; max-width: 38ch; }

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

.site-footer {
  position: relative;
  background: var(--bg);
  border-top: 1px solid var(--line-soft);
  padding-top: clamp(3.5rem, 7vw, 5rem);
  padding-bottom: 2.5rem;
}

.footer-grid {
  display: grid;
  gap: 2.5rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr));
  padding-bottom: 2.5rem;
  border-bottom: 1px solid var(--line-soft);
}

.footer-col h4 {
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 1.1rem;
}
.footer-col ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.6rem; }
.footer-col a { font-size: 0.95rem; text-decoration: none; color: var(--text); transition: color 0.16s ease; }
.footer-col a:hover { color: var(--accent-text); }
.footer-col address { font-style: normal; font-size: 0.95rem; color: var(--muted); line-height: 1.75; }

.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: space-between;
  align-items: center;
  padding-top: 1.75rem;
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

/* --- Carposé-Einbettung --------------------------------------------------- */

/* Das Widget rendert in einem Shadow DOM und erbt nur die Schriftfamilie.
   Hier bekommt es Raum und eine Grundlinie, nicht mehr. */
.carpose-mount { min-height: 6rem; font-family: var(--sans); }
.carpose-mount--search { min-height: 30rem; }

.search-page { padding-top: clamp(2rem, 4vw, 3rem); padding-bottom: var(--sp-section); }

/* Die Floating-Buttons von Carposé kleben am rechten Viewport-Rand. Solange
   der Seitenrand schmaler ist als die Buttons, decken sie die rechte
   Filterspalte ab — dann bekommt die Suche einen eigenen Rand. */
@media (min-width: 861px) and (max-width: 1360px) {
  .search-page { padding-right: calc(var(--gut) + 4.5rem); }
}

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

.reveal { opacity: 0; transform: translateY(18px); }

@media (prefers-reduced-motion: no-preference) {
  .reveal {
    transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1),
                transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
  }
  .reveal.is-in { opacity: 1; transform: none; }

  /* Ladesequenz des Heros: Augenbraue, Titel, Text, Suche — dann der Wald */
  .hero .reveal { transition-delay: var(--d, 0ms); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* Ohne JS bleibt nichts unsichtbar */
.no-js .reveal { opacity: 1; transform: none; }

/* --- Mobil ---------------------------------------------------------------- */

@media (max-width: 860px) {
  .nav-toggle { display: block; }

  .nav {
    position: fixed;
    inset: 68px 0 auto 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 1rem var(--gut) 1.75rem;
    background: var(--bg-2);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
    max-height: calc(100dvh - 68px);
    overflow-y: auto;

    /* Das Panel rollt unter der Kopfzeile hervor, statt über sie hinwegzufliegen.
       `clip-path` beschneidet es auf die eigene Oberkante — es kann also nie
       über dem Logo liegen. `visibility` nimmt die Links im geschlossenen
       Zustand aus der Tab-Reihenfolge. */
    visibility: hidden;
    opacity: 0;
    clip-path: inset(0 0 100% 0);
    transform: translateY(-6px);
    transition:
      clip-path 0.30s cubic-bezier(0.22, 1, 0.36, 1),
      transform 0.30s cubic-bezier(0.22, 1, 0.36, 1),
      opacity 0.18s ease,
      visibility 0s linear 0.30s;
  }

  .nav[data-open="true"] {
    visibility: visible;
    opacity: 1;
    clip-path: inset(0 0 0 0);
    transform: translateY(0);
    transition:
      clip-path 0.34s cubic-bezier(0.22, 1, 0.36, 1),
      transform 0.34s cubic-bezier(0.22, 1, 0.36, 1),
      opacity 0.16s ease,
      visibility 0s;
  }

  .nav a {
    padding: 0.9rem 0.25rem;
    font-size: 1.05rem;
    border-bottom: 1px solid var(--line-soft);
    border-radius: 0;
  }
  .nav a:hover { background: transparent; }

  /* Muss `.nav a.header-cta` heißen, sonst gewinnt die Desktop-Regel weiter
     oben — sie ist spezifischer und würde Größe und linken Rand durchdrücken. */
  .nav a.header-cta {
    margin: 1.25rem 0 0;
    justify-content: center;
    padding: 0.85rem 1.15rem;
    font-size: 0.95rem;
    border-bottom: 0;
  }

  .cta-band .wrap { flex-direction: column; align-items: flex-start; }
}
