/* =========================================================================
   Tischlerei Berger – Basis-Styles (gemeinsam, mobile first)
   Variantenspezifische Tokens & Layouts liegen in variants.css.
   ========================================================================= */

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

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

body {
  font-family: var(--font-body, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif);
  color: var(--fg, #1f2933);
  background: var(--bg, #f7f3ec);
  line-height: 1.6;
  font-size: 1rem;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100svh;
}

h1, h2, h3 {
  font-family: var(--font-head, var(--font-body, system-ui, sans-serif));
  line-height: 1.12;
  letter-spacing: var(--head-tracking, -0.01em);
  text-wrap: balance;
}

img, svg, picture { display: block; max-width: 100%; height: auto; }

a { color: inherit; }

button { font: inherit; color: inherit; cursor: pointer; }

ul[role="list"] { list-style: none; padding: 0; }

/* --- Layout-Primitive --- */
.container {
  width: 100%;
  max-width: var(--maxw, 1120px);
  margin-inline: auto;
  padding-inline: var(--pad, 1.25rem);
}

.section { padding-block: clamp(2.75rem, 7vw, 5.5rem); }

#app:empty::before {
  /* dezenter Platzhalter, falls JS extrem spät ist – verhindert Sprung */
  content: "";
  display: block;
  min-height: 100svh;
}

/* --- Buttons (Basis; jede Variante stylt darüber) --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  padding: 0.85em 1.4em;
  border: 2px solid transparent;
  border-radius: var(--radius, 6px);
  font-weight: 700;
  text-decoration: none;
  line-height: 1.1;
  transition: transform .15s ease, background-color .15s ease, color .15s ease, border-color .15s ease;
}
.btn--primary { background: var(--accent, #c9772f); color: var(--accent-contrast, #fff); }
.btn--ghost { background: transparent; border-color: currentColor; color: var(--fg, #1f2933); }
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }

/* --- Accessibility --- */
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0);
  white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute;
  left: 0.75rem; top: -3.5rem;
  z-index: 999;
  background: var(--fg, #1f2933);
  color: var(--bg, #fff);
  padding: 0.7rem 1rem;
  border-radius: 6px;
  text-decoration: none;
  transition: top .15s ease;
}
.skip-link:focus { top: 0.75rem; }

:where(a, button, input, textarea, select, [tabindex]):focus-visible {
  outline: 3px solid var(--focus, #2563eb);
  outline-offset: 3px;
  border-radius: 3px;
}

/* --- Dev-/Demo-Widget: Varianten-Umschalter ----------------------------
   Bewusst KEINE Varianten-Tokens: eigene dunkle "Werkzeug"-Optik, die sich in
   A/B/C identisch von der Website abhebt. Fixiert, druckt nicht, safe-area. */
.devbar {
  /* Steuer-Variablen: die B-Mobil-Regel ueberschreibt NUR --devbar-bottom,
     niemals die transform-Deklaration -> translateX(-50%) bleibt immer erhalten. */
  --devbar-bottom: max(0.9rem, env(safe-area-inset-bottom));
  --devbar-lift: 0px;
  position: fixed;
  left: 50%;
  bottom: var(--devbar-bottom);
  transform: translateX(-50%) translateY(calc(var(--devbar-lift) * -1));
  z-index: 2147483000;
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.4rem 0.55rem;
  border-radius: 999px;
  background: rgba(17, 20, 26, 0.82);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.38);
  color: #e9edf2;
  font: 600 13px/1 ui-sans-serif, system-ui, -apple-system, sans-serif;
  transition: box-shadow .15s ease, transform .15s ease;
}
/* dezenter Hebe-Effekt ueber Variable -> translateX(-50%) bleibt Teil derselben Kette */
.devbar:hover { --devbar-lift: 2px; box-shadow: 0 12px 34px rgba(0, 0, 0, 0.46); }
.devbar__label { font-size: 11px; letter-spacing: 0.05em; text-transform: uppercase; opacity: 0.7; padding-left: 0.35rem; }
.devbar__btns { display: inline-flex; gap: 0.25rem; }
.devbar__btn {
  width: 30px; height: 30px; border-radius: 999px;
  display: grid; place-items: center;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid transparent;
  color: #e9edf2; font-weight: 700;
  transition: background-color .15s ease, color .15s ease, transform .1s ease;
}
.devbar__btn:hover { background: rgba(255, 255, 255, 0.18); }
.devbar__btn:active { transform: scale(0.94); }   /* bare transform am Button ungefaehrlich (kein translateX) */
.devbar__btn[aria-pressed="true"] { background: #fff; color: #11141a; border-color: #fff; }

/* --- Vollbild-Hero: Scroll-Hinweis (gemeinsam; Farbe/Offset je Variante) --- */
.hero-scroll {
  position: absolute;
  left: 50%;
  bottom: clamp(0.9rem, 3svh, 2rem);
  transform: translateX(-50%);
  z-index: 5;
  display: grid; place-items: center;
  width: 48px; height: 48px;          /* >= 44px Touch-/Klickziel */
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.16);    /* dezenter Backdrop -> Kontrast auch ueber Bild */
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
  color: inherit; text-decoration: none;
  opacity: 0.9;
}
.hero-scroll:hover { opacity: 1; }
.hero-scroll__chevron {
  width: 14px; height: 14px;
  border-right: 2.5px solid currentColor;
  border-bottom: 2.5px solid currentColor;
  transform: rotate(45deg);
  margin-top: -4px;
}
@media (prefers-reduced-motion: no-preference) {
  .hero-scroll__chevron { animation: hero-bounce 1.8s ease-in-out infinite; }
}
@keyframes hero-bounce {
  0%, 100% { transform: rotate(45deg) translate(0, 0); }
  50%      { transform: rotate(45deg) translate(3px, 3px); }
}

/* --- Generische Bild-Utilities (variantenneutral) --- */
.media { position: relative; overflow: hidden; }
.media > img, .media > picture, .media > picture > img {
  display: block; width: 100%; height: 100%; object-fit: cover;
}
.media--3-2 { aspect-ratio: 3 / 2; }
.media--4-3 { aspect-ratio: 4 / 3; }
.media--1-1 { aspect-ratio: 1 / 1; }
/* Platzhalter dezent markieren (vom Betrieb ignorierbar, verschwindet beim echten Foto-Tausch) */
img[data-placeholder], picture[data-placeholder] > img { outline: 2px dashed rgba(201, 119, 47, .55); outline-offset: -2px; }

/* --- Cal.com Inline-Buchung (eigener Abschnitt; uebernimmt Varianten-Tokens) --- */
.cal-section__head { max-width: 60ch; margin-bottom: 1.5rem; }
.cal-section__head h2 { font-size: clamp(1.6rem, 4.5vw, 2.4rem); font-weight: 800; margin-top: .4rem; }
#cal-booking {
  position: relative;
  min-height: 560px;                  /* reserviert Hoehe -> kein Layout-Shift beim Lazy-Load */
  border: 1px solid var(--border);
  border-radius: clamp(8px, var(--radius), 24px);
  background: var(--surface);
  overflow: hidden;
}
#cal-booking iframe { width: 100% !important; border: 0; display: block; }
#cal-booking.is-loading::after {
  content: "Kalender wird geladen …";
  position: absolute; inset: 0; display: grid; place-items: center;
  color: var(--muted); background: var(--surface);
}
.cal-placeholder { padding: 2.5rem 1.5rem; text-align: center; color: var(--muted); display: grid; place-content: center; gap: .4rem; min-height: inherit; }
.cal-placeholder__contacts { display: flex; flex-wrap: wrap; gap: 0.6rem; justify-content: center; margin-top: 1rem; }

@media print { .devbar, #cal-booking-section { display: none !important; } }

/* --- Bewegung reduzieren --- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .btn:hover { transform: none; }
  .hero-scroll__chevron { animation: none; }
}
