/* imoti · Mobile-first Immobilien-Mini-CMS
   Reihenfolge: Base → Komponenten (Mobile-Default) → Breakpoints 480/640/900.
   Palette: Off-White, sattes Navy, sanftes Grün-Akzent (Natur/Garten). */

:root {
  --f-text:   #1b2330;
  --f-muted:  #6b7280;
  --f-brand:  #1a3d5c;         /* Navy */
  --f-accent: #4a7a4f;         /* Garten-Grün */
  --f-fix:    #b84a2a;         /* Preis-fest-Hinweis */
  --f-bg:     #fafaf7;
  --f-card:   #ffffff;
  --f-line:   #e6e5de;
  --f-hover:  #f3f2ec;
  --radius:   8px;
  --w:        min(960px, 100%);
  --pad:      14px;            /* Mobile-Seitenabstand */
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; padding: 0; background: var(--f-bg); color: var(--f-text);
  font: 16px/1.55 "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  padding-bottom: env(safe-area-inset-bottom, 0); }

img { max-width: 100%; display: block; height: auto; }
a { color: var(--f-brand); }
kbd { font-family: "SF Mono", "Consolas", monospace; }

/* ---------- Kopfzeile ---------- */
.kopf { background: #fff; border-bottom: 1px solid var(--f-line);
  position: sticky; top: 0; z-index: 20;
  padding-top: env(safe-area-inset-top, 0); }
.kopf-innen { width: var(--w); margin: 0 auto; padding: 10px var(--pad);
  display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.marke { font-weight: 700; font-size: 1.05rem; color: var(--f-brand);
  text-decoration: none; white-space: nowrap; }
.marke-sub { color: var(--f-muted); font-weight: 400; }

/* Sprachumschalter — Touch-Targets min 40×40 */
.sprachen { display: flex; gap: 4px; }
.sprache { display: inline-flex; align-items: center; justify-content: center;
  min-width: 40px; height: 40px; padding: 0 10px;
  font-size: 0.85rem; font-weight: 600; text-decoration: none;
  color: var(--f-muted); border-radius: 6px; }
.sprache:active { background: var(--f-hover); }
.sprache.aktiv { background: var(--f-brand); color: #fff; }

/* ---------- Hauptbereich ---------- */
main.detail { width: var(--w); margin: 0 auto; padding: var(--pad); }

/* ---------- Hero ---------- */
.hero { margin: 0 0 16px; background: var(--f-card);
  border: 1px solid var(--f-line); border-radius: var(--radius); overflow: hidden; }
.hero-bild img { width: 100%; height: auto;
  max-height: 55vh;             /* auf Hoch-Handy bleibt genug Platz für Titel/Preis ohne Scroll */
  object-fit: cover; }
.hero-text { padding: 18px 16px; }
.hero-text .ort { margin: 0 0 6px; color: var(--f-muted); font-size: 0.78rem;
  text-transform: uppercase; letter-spacing: 0.08em; line-height: 1.4; }
.angebot-nr { font-weight: 600; color: var(--f-brand); white-space: nowrap; }
.hero-text h1 { margin: 0 0 12px; font-size: 1.5rem; color: var(--f-brand);
  line-height: 1.2; text-wrap: balance; }
.preis { font-size: 2rem; font-weight: 700; color: var(--f-brand);
  margin: 0 0 10px; font-variant-numeric: tabular-nums; line-height: 1.1; }
.preis-fix { display: inline-block; font-size: 0.85rem; font-weight: 500;
  color: var(--f-fix); margin-left: 4px; white-space: nowrap; }
.badge-privat { display: inline-block; background: #eef5e8; color: var(--f-accent);
  padding: 5px 11px; font-size: 0.8rem; font-weight: 600;
  border-radius: 4px; margin: 0; }

/* ---------- Eckdaten-Grid ---------- */
/* Mobile: 2 Spalten, bei winzigen Screens (<340px) auf 1 Spalte */
.fakten { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px;
  background: var(--f-line); border: 1px solid var(--f-line);
  border-radius: var(--radius); overflow: hidden; margin: 0 0 20px; }
.fakt { background: var(--f-card); padding: 12px 14px; }
.fakt dt { font-size: 0.72rem; color: var(--f-muted); text-transform: uppercase;
  letter-spacing: 0.06em; margin: 0 0 4px; line-height: 1.3; }
.fakt dd { margin: 0; font-size: 1.05rem; font-weight: 600;
  color: var(--f-text); line-height: 1.3; }
.fakt-hinweis { display: block; font-size: 0.72rem; font-weight: 400;
  color: var(--f-muted); font-style: italic; margin-top: 2px; }

/* ---------- Textabschnitte ---------- */
section.beschreibung, section.warum, section.highlights,
section.wissen, section.kontakt {
  background: var(--f-card); border: 1px solid var(--f-line);
  border-radius: var(--radius); padding: 18px 16px; margin: 0 0 16px;
}
section h2 { margin: 0 0 12px; font-size: 1.1rem; color: var(--f-brand);
  line-height: 1.3; }
section p { margin: 0 0 10px; }
section p:last-child { margin-bottom: 0; }
section ul { margin: 0; padding-left: 22px; }
section li { margin: 6px 0; }

.warum { border-left: 3px solid var(--f-fix); }
.deadline-hinweis { font-weight: 600; color: var(--f-fix); margin-top: 8px; }

/* ---------- Grundrisse (SVGs) ---------- */
.grundriss { background: var(--f-card); border: 1px solid var(--f-line);
  border-radius: var(--radius); padding: 18px 16px; margin: 0 0 16px; }
.grundriss h2 { margin: 0 0 6px; font-size: 1.1rem; color: var(--f-brand); }
.grundriss-hinweis { margin: 0 0 14px; font-size: 0.82rem; color: var(--f-muted);
  font-style: italic; }
.grundriss-liste { display: grid; gap: 14px; grid-template-columns: 1fr; }
.grundriss-kachel { background: var(--f-bg); border: 1px solid var(--f-line);
  border-radius: 6px; padding: 10px; }
.grundriss-kachel img { width: 100%; height: auto; display: block; }

@media (min-width: 720px) {
  .grundriss-liste { grid-template-columns: 1fr 1fr; }
}

/* ---------- Galerie ---------- */
/* Mobile <480px: 1 große Spalte — Fotos kommen besser zur Geltung */
.galerie { margin: 20px 0; }
.galerie-headline { margin: 18px 0 10px; font-size: 0.85rem;
  color: var(--f-brand); font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.1em;
  padding-bottom: 6px; border-bottom: 1px solid var(--f-line); }
.galerie-headline:first-of-type { margin-top: 0; }
.galerie-grid { display: grid; grid-template-columns: 1fr; gap: 8px; }
.galerie-kachel { display: block; border-radius: 6px; overflow: hidden;
  aspect-ratio: 4 / 3; background: var(--f-line);
  -webkit-tap-highlight-color: transparent; }
.galerie-kachel img { width: 100%; height: 100%; object-fit: cover;
  transition: transform 0.3s ease; }
.galerie-kachel:active img { transform: scale(0.98); }

/* ---------- Hero-CTAs (Telefon + Nachricht) ---------- */
.hero-ctas { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.hero-cta { display: inline-flex; align-items: center; justify-content: center;
  gap: 8px;
  padding: 12px 18px; min-height: 48px;
  background: var(--f-brand); color: #fff;
  border: 0; border-radius: 6px;
  font: inherit; font-weight: 600; font-size: 0.95rem;
  text-decoration: none; cursor: pointer;
  transition: background 0.15s ease, opacity 0.15s ease;
  -webkit-tap-highlight-color: transparent; }
.hero-cta:hover { background: #244f73; }
.hero-cta:active { opacity: 0.85; }
.hero-cta-icon { font-size: 1.1em; line-height: 1; }
/* Zweiter Button etwas zurückgenommen */
.hero-cta-write { background: #fff; color: var(--f-brand);
  border: 1px solid var(--f-brand); }
.hero-cta-write:hover { background: var(--f-hover); }

/* Enthüllte Telefonnummer: wie primärer CTA, zusätzlich tabular-nums */
.tel-revealed { font-variant-numeric: tabular-nums; }

/* ---------- Kontakt-Modal ---------- */
.modal { padding: 0; border: 0; border-radius: 10px;
  width: min(560px, 94vw); max-height: 92vh;
  background: var(--f-card); color: var(--f-text); overflow: hidden; }
.modal::backdrop { background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); }
.modal-inhalt { padding: 24px 20px;
  max-height: 92vh; overflow-y: auto;
  -webkit-overflow-scrolling: touch; }
.modal-close { position: absolute; top: 12px; right: 12px; z-index: 2;
  width: 36px; height: 36px; border: 0; border-radius: 50%;
  background: var(--f-hover); color: var(--f-text);
  font-size: 1.2rem; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  -webkit-tap-highlight-color: transparent; }
.modal-close:hover { background: var(--f-line); }
.modal-headline { margin: 0 0 4px; font-size: 1.25rem; color: var(--f-brand);
  padding-right: 40px; }
.modal-subline { margin: 0 0 20px; font-size: 0.88rem; color: var(--f-muted); }

@media (max-width: 480px) {
  .modal { width: 100vw; max-width: 100vw;
    height: 100vh; max-height: 100vh;
    border-radius: 0; }
  .modal-inhalt { padding-top: env(safe-area-inset-top, 16px); }
}

/* ---------- Kontaktformular ---------- */
.contact-form { display: grid; gap: 14px; }
.contact-noscript { background: #fef3c7; color: #78350f;
  padding: 10px 14px; border-radius: 6px; margin: 0 0 10px; font-size: 0.9rem; }
.contact-row { display: flex; flex-direction: column; gap: 5px; }
.contact-row label { font-size: 0.85rem; color: var(--f-muted);
  font-weight: 600; }
.contact-form input[type="text"],
.contact-form input[type="email"],
.contact-form input[type="tel"],
.contact-form textarea {
  width: 100%; padding: 10px 12px;
  background: #fff; border: 1px solid var(--f-line); border-radius: 6px;
  font: inherit; color: var(--f-text);
  min-height: 44px;
  transition: border-color 0.15s ease; }
.contact-form textarea { resize: vertical; min-height: 110px;
  font-family: inherit; line-height: 1.5; }
.contact-form input:focus, .contact-form textarea:focus {
  outline: none; border-color: var(--f-brand); }
.contact-form input[readonly] { background: var(--f-hover);
  color: var(--f-muted); font-weight: 600; cursor: not-allowed; }

.contact-radio-group { display: flex; flex-direction: column; gap: 4px;
  padding: 4px 0; }
.contact-radio { display: flex; align-items: center; gap: 8px;
  padding: 6px 0; font-weight: 400; color: var(--f-text);
  cursor: pointer; font-size: 0.95rem; }
.contact-radio input[type="radio"] { width: 18px; height: 18px;
  accent-color: var(--f-brand); cursor: pointer; }

/* Honeypot unsichtbar aber nicht display:none (manche Bots checken darauf) */
.contact-honey { position: absolute; left: -9999px;
  width: 1px; height: 1px; overflow: hidden; }

.contact-actions { display: flex; flex-direction: column; gap: 10px;
  margin-top: 6px; }
.contact-submit { padding: 12px 20px;
  background: var(--f-brand); color: #fff;
  border: 0; border-radius: 6px;
  font: inherit; font-weight: 600; font-size: 1rem;
  cursor: pointer; min-height: 48px;
  transition: background 0.15s ease, opacity 0.15s ease;
  -webkit-tap-highlight-color: transparent; }
.contact-submit:hover { background: #244f73; }
.contact-submit:active { opacity: 0.85; }
.contact-submit:disabled { background: var(--f-muted); cursor: default; }

.contact-feedback { padding: 10px 14px; border-radius: 6px; font-size: 0.9rem; }
.contact-feedback--success { background: #e6f5e9; color: #1e5a2a; border: 1px solid #a7d7b0; }
.contact-feedback--error   { background: #fde8e4; color: #8a2b14; border: 1px solid #f0b1a0; }

@media (min-width: 640px) {
  .contact-actions { flex-direction: row; align-items: center;
    justify-content: space-between; }
  .contact-feedback { flex: 1; margin-right: 10px; }
  .contact-submit { flex: 0 0 auto; }
}

/* ---------- Fuß ---------- */
.fuss { background: #fff; border-top: 1px solid var(--f-line);
  margin-top: 24px;
  padding-bottom: env(safe-area-inset-bottom, 0); }
.fuss-innen { width: var(--w); margin: 0 auto; padding: 16px var(--pad);
  display: flex; flex-direction: column; gap: 6px;
  font-size: 0.82rem; color: var(--f-muted); text-align: center; }
.privat-hinweis, .copy { margin: 0; }

/* ---------- Übersichts-Liste (Kacheln pro Immobilie) ---------- */
.liste { display: grid; gap: 14px; margin: 0 0 24px; }
.imot-kachel { display: flex; flex-direction: column;
  background: var(--f-card); border: 1px solid var(--f-line);
  border-radius: var(--radius); overflow: hidden;
  text-decoration: none; color: inherit;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
  -webkit-tap-highlight-color: transparent; }
.imot-kachel:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.08);
  transform: translateY(-1px); }
.imot-kachel:active { background: var(--f-hover); }
.imot-bild { position: relative; aspect-ratio: 4/3;
  background: var(--f-line); overflow: hidden; }
.imot-bild img { width: 100%; height: 100%; object-fit: cover; }
.imot-nr { position: absolute; top: 10px; left: 10px;
  background: rgba(26, 61, 92, 0.92); color: #fff;
  padding: 4px 9px; font-size: 0.78rem; font-weight: 600;
  border-radius: 4px; letter-spacing: 0.04em; }
.imot-text { padding: 14px 16px 16px; }
.imot-ort { margin: 0 0 4px; color: var(--f-muted); font-size: 0.75rem;
  text-transform: uppercase; letter-spacing: 0.08em; }
.imot-titel { margin: 0 0 10px; font-size: 1.1rem; color: var(--f-brand);
  line-height: 1.25; text-wrap: balance; }
.imot-preis { margin: 0 0 10px; font-size: 1.5rem; font-weight: 700;
  color: var(--f-brand); line-height: 1.1;
  font-variant-numeric: tabular-nums; }
.imot-fix { font-size: 0.82rem; font-weight: 500;
  color: var(--f-fix); margin-left: 4px; }
.imot-specs { margin: 0 0 4px; font-size: 0.88rem;
  color: var(--f-text); font-weight: 500; }
.imot-typ { margin: 0 0 10px; font-size: 0.82rem;
  color: var(--f-muted); font-style: italic; }
.imot-kurz { margin: 10px 0; font-size: 0.9rem;
  color: var(--f-text); line-height: 1.5;
  padding-top: 10px; border-top: 1px solid var(--f-line); }
.imot-privat { margin: 0; font-size: 0.78rem;
  color: var(--f-accent); font-weight: 600; }

/* ==========================================================
   Breakpoint 480 — kleine Tablets / Landscape-Phones
   ========================================================== */
@media (min-width: 480px) {
  .galerie-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
}

/* ==========================================================
   Breakpoint 640 — Tablets / Desktop-Start
   ========================================================== */
@media (min-width: 640px) {
  :root { --pad: 20px; }
  .fakten { grid-template-columns: repeat(3, 1fr); }
  .galerie-grid { grid-template-columns: repeat(3, 1fr); }
  .hero-text { padding: 24px; }
  .hero-text h1 { font-size: 2rem; }
  .preis { font-size: 2.4rem; }
  .fuss-innen { flex-direction: row; justify-content: space-between;
    text-align: left; }
  /* Übersichts-Kacheln: Bild links, Text rechts */
  .imot-kachel { flex-direction: row; }
  .imot-bild { flex: 0 0 42%; aspect-ratio: auto; }
  .imot-text { flex: 1; padding: 18px 20px; }
  section.beschreibung, section.warum, section.highlights,
  section.wissen, section.kontakt { padding: 22px; }
  section h2 { font-size: 1.2rem; }
}

/* ==========================================================
   Breakpoint 900 — Desktop
   ========================================================== */
@media (min-width: 900px) {
  .galerie-grid { grid-template-columns: repeat(4, 1fr); }
}

/* ==========================================================
   Breakpoint < 340px — winzige Screens (SE1, Galaxy Fold)
   ========================================================== */
@media (max-width: 339px) {
  .fakten { grid-template-columns: 1fr; }
  .preis { font-size: 1.7rem; }
  .hero-text h1 { font-size: 1.3rem; }
  .imot-preis { font-size: 1.3rem; }
}

/* ==========================================================
   Lightbox-Overlay (aus Bootsverein-CMS)
   Natives <dialog>, Event-Delegation in /_js/lightbox.js
   ========================================================== */
.lightbox {
  width: 100vw; height: 100vh;
  max-width: 100vw; max-height: 100vh;
  padding: 0; margin: 0; border: 0;
  background: transparent; color: #fff; overflow: hidden;
}
.lightbox::backdrop {
  background: rgba(0, 0, 0, 0.92);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.lightbox-image {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  max-width: 92vw; max-height: 86vh;
  width: auto; height: auto;
  object-fit: contain; cursor: zoom-in;
  transition: transform 0.25s ease, max-width 0.25s ease, max-height 0.25s ease;
  user-select: none; -webkit-user-drag: none;
}
.lightbox-image.zoomed {
  cursor: zoom-out;
  max-width: none; max-height: none;
  transform: translate(-50%, -50%) scale(2);
}
.lightbox-close, .lightbox-prev, .lightbox-next {
  position: absolute;
  width: 48px; height: 48px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 50%;
  cursor: pointer; font-size: 1.6rem; line-height: 1;
  z-index: 10;
  transition: background 0.15s ease, opacity 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.lightbox-close:hover, .lightbox-prev:hover, .lightbox-next:hover {
  background: rgba(0, 0, 0, 0.8);
}
.lightbox-prev:disabled, .lightbox-next:disabled {
  opacity: 0.25; cursor: default;
}
.lightbox-close { top: calc(16px + env(safe-area-inset-top, 0)); right: 16px; }
.lightbox-prev  { top: 50%;   left: 16px;  transform: translateY(-50%); }
.lightbox-next  { top: 50%;   right: 16px; transform: translateY(-50%); }
.lightbox-counter {
  position: absolute;
  bottom: calc(20px + env(safe-area-inset-bottom, 0)); left: 50%;
  transform: translateX(-50%);
  padding: 6px 14px;
  background: rgba(0, 0, 0, 0.55);
  border-radius: 999px;
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.05em;
}
@media (max-width: 640px) {
  .lightbox-close, .lightbox-prev, .lightbox-next {
    width: 44px; height: 44px; font-size: 1.4rem;
  }
  .lightbox-close { top: calc(12px + env(safe-area-inset-top, 0)); right: 12px; }
  .lightbox-prev  { left: 12px; }
  .lightbox-next  { right: 12px; }
}
