/* =============================================================
   Startseite: Premium Property Grid
   Wird nur von index.html geladen.
   ============================================================= */

/* === Animated Backgrounds === */
.ib-bg-animation,
.ib-bg-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}
.ib-bg-canvas { display: none; }

@keyframes ibGradientShift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
body.bg-gradient .ib-bg-animation {
  background: linear-gradient(135deg, #ffffff 0%, #e8f0f8 25%, #f0f4ff 50%, #edf7f0 75%, #ffffff 100%);
  background-size: 400% 400%;
  animation: ibGradientShift 15s ease infinite;
}
body.bg-particles .ib-bg-canvas { display: block; }

@keyframes ibBlobFloat1 { 0%,100%{transform:translate(0,0) scale(1)} 33%{transform:translate(80px,-60px) scale(1.1)} 66%{transform:translate(-40px,40px) scale(.95)} }
@keyframes ibBlobFloat2 { 0%,100%{transform:translate(0,0) scale(1)} 33%{transform:translate(-60px,80px) scale(1.05)} 66%{transform:translate(50px,-30px) scale(.9)} }
@keyframes ibBlobFloat3 { 0%,100%{transform:translate(0,0) scale(1)} 33%{transform:translate(40px,50px) scale(1.08)} 66%{transform:translate(-70px,-40px) scale(.92)} }

body.bg-blobs .ib-bg-animation { overflow: hidden; }
body.bg-blobs .ib-blob { position: absolute; border-radius: 50%; filter: blur(80px); opacity: 0.35; }
body.bg-blobs .ib-blob-1 { width:500px;height:500px;background:#dbeafe;top:-10%;left:-5%;animation:ibBlobFloat1 18s ease-in-out infinite }
body.bg-blobs .ib-blob-2 { width:400px;height:400px;background:#dcfce7;top:40%;right:-5%;animation:ibBlobFloat2 22s ease-in-out infinite }
body.bg-blobs .ib-blob-3 { width:450px;height:450px;background:#e0e7ff;bottom:-10%;left:30%;animation:ibBlobFloat3 20s ease-in-out infinite }

/* Content above background */
.c3d-hero,
.ib-properties-section,
.ib-footer,
.navbar {
  position: relative;
  z-index: 1;
}

/* === Page Transition === */
@keyframes ibPageOut {
  from { opacity: 1; transform: scale(1); }
  to { opacity: 0; transform: scale(1.015); filter: blur(4px); }
}

body.ib-page-leaving {
  animation: ibPageOut 0.35s cubic-bezier(0.4, 0, 1, 1) forwards;
  pointer-events: none;
}

/* === Navbar Override: Hell auf Startseite === */
body:has(.c3d-hero) .navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid rgba(5, 26, 36, 0.06);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: all 0.4s ease;
  z-index: 200;
}

body:has(.c3d-hero) .navbar.scrolled {
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 1px 12px rgba(5, 26, 36, 0.06);
}

/* === Hero Section === */
.c3d-hero {
  background: transparent;
  text-align: center;
  padding: 82px 24px 20px;
}

@keyframes ibHeroFade {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.ib-hero-subtitle {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 12px;
  animation: ibHeroFade 0.9s cubic-bezier(0.22,1,0.36,1) 0.1s both;
}

.ib-hero-title {
  font-family: var(--font-body);
  font-size: 2.4rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.035em;
  line-height: 1.1;
  margin: 0;
  animation: ibHeroFade 0.9s cubic-bezier(0.22,1,0.36,1) 0.2s both;
}

/* === Properties Section === */
.ib-properties-section {
  background: transparent;
  padding: 8px 0 12px;
}

/* === Grid === */
.ib-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  max-width: 1560px;
  margin: 0 auto;
  padding: 0 32px;
}

/* ========================================
   PREMIUM PROPERTY CARD
   ======================================== */
.ib-card {
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border-radius: 20px;
  border: 1px solid var(--gray-300);
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(5,26,36,0.08), 0 12px 40px rgba(5,26,36,0.10);
  transition: transform 0.35s ease-out, box-shadow 0.35s ease-out;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  will-change: transform, box-shadow;
  contain: layout style;
}

.ib-card:hover {
  transform: translateY(-8px) scale(1.012) !important;
  box-shadow: 0 20px 50px rgba(5,26,36,0.15), 0 8px 20px rgba(5,26,36,0.08) !important;
}

.ib-card:active {
  transform: translateY(-3px) scale(1.005) !important;
  transition-duration: 0.12s;
}

/* Focus-State für Keyboard-Navigation */
.ib-card:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 3px;
  transform: translateY(-4px);
  box-shadow: 0 16px 44px rgba(5,26,36,0.14), 0 6px 18px rgba(5,26,36,0.08);
}

/* Nachbar-Cards leicht entsättigen wenn eine Card gehovered wird */

/* Card Image — cinematic crop */
.ib-card-img {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: var(--gray-100);
}

/* Gradient overlay entfernt für Performance */

.ib-card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.5s ease-out;
}

.ib-card:hover .ib-card-img img {
  transform: scale(1.04);
}

.ib-card-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  font-weight: 700;
  background: var(--primary-light);
  color: var(--text-muted);
}

/* Badge — frosted glass */
.ib-badge {
  position: absolute;
  top: 14px;
  left: 14px;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--text-primary);
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid rgba(255,255,255,0.5);
}

/* Discount Badge */
.ib-card-discount {
  position: absolute;
  top: 14px;
  right: 14px;
  background: var(--success);
  color: white;
  padding: 4px 12px;
  border-radius: 16px;
  font-size: 0.72rem;
  font-weight: 600;
}

/* Card Body — refined spacing */
.ib-card-body {
  padding: 16px 18px 18px;
  display: flex;
  flex-direction: column;
  flex: 1;
  transition: transform 0.3s ease-out;
}

.ib-card:hover .ib-card-body {
  transform: translateY(-2px);
}

/* Rating */
.ib-card-rating {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  color: #92400e;
  background: #fef3c7;
  padding: 3px 10px;
  border-radius: 10px;
  min-height: 22px;
  margin-bottom: 10px;
  width: fit-content;
}

.ib-card-rating-placeholder {
  min-height: 22px;
  margin-bottom: 10px;
}

/* Title */
.ib-card-title {
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.015em;
  line-height: 1.35;
  margin: 0 0 4px;
}

/* Location */
.ib-card-location {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 0 0 12px;
  line-height: 1.4;
}

/* Meta */
.ib-card-meta {
  display: flex;
  gap: 12px;
  font-size: 0.76rem;
  color: var(--text-secondary);
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.ib-card-meta span {
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 3px;
}

/* Separator dot between meta items */
.ib-card-meta span + span::before {
  content: '·';
  margin-right: 3px;
  color: var(--gray-300);
}

/* Footer */
.ib-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 14px;
  border-top: 1px solid var(--gray-200);
  margin-top: auto;
}

.ib-card-pricing {
  display: flex;
  align-items: baseline;
  gap: 5px;
}

.ib-card-price {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  transition: color 0.3s ease;
}

.ib-card:hover .ib-card-price {
  color: var(--primary);
}

.ib-card-price-old {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-decoration: line-through;
}

.ib-card-unit {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.ib-card-link {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: color 0.35s ease, transform 0.35s cubic-bezier(0.22,1,0.36,1), letter-spacing 0.35s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.ib-card:hover .ib-card-link {
  color: var(--primary);
  transform: translateX(4px);
  letter-spacing: 0.02em;
}

/* ========================================
   ENTRANCE ANIMATION
   ======================================== */
.ib-card.vx-animate {
  opacity: 0;
  transform: translateY(32px) scale(0.98);
  transition: opacity 0.85s cubic-bezier(0.22, 1, 0.36, 1), transform 0.85s cubic-bezier(0.22, 1, 0.36, 1);
}

.ib-card.vx-animate:nth-child(1) { transition-delay: 0.08s; }
.ib-card.vx-animate:nth-child(2) { transition-delay: 0.18s; }
.ib-card.vx-animate:nth-child(3) { transition-delay: 0.28s; }
.ib-card.vx-animate:nth-child(4) { transition-delay: 0.38s; }
.ib-card.vx-animate:nth-child(n+5) { transition-delay: 0.48s; }

.ib-card.vx-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  transition-delay: 0s !important;
}

/* === Footer === */
.ib-footer {
  text-align: center;
  padding: 10px 24px 14px;
  color: var(--gray-300);
  font-size: 0.68rem;
  background: transparent;
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 768px) {
  .c3d-hero {
    padding: 78px 20px 16px;
  }

  .ib-hero-title {
    font-size: 1.8rem;
  }

  .ib-grid {
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 0 16px;
  }

  .ib-card-img {
    aspect-ratio: 16 / 10;
  }

  .ib-card-title {
    font-size: 1rem;
  }

  .ib-card:hover .ib-card-body {
    transform: none;
  }
}

@media (max-width: 480px) {
  .c3d-hero {
    padding: 74px 16px 12px;
  }

  .ib-hero-title {
    font-size: 1.5rem;
  }

  .ib-properties-section {
    padding: 4px 0 8px;
  }

  .ib-card-body {
    padding: 14px 14px 16px;
  }

  .ib-card-meta {
    gap: 8px;
    font-size: 0.72rem;
  }
}

/* === Reduced Motion === */
@media (prefers-reduced-motion: reduce) {
  .ib-card, .ib-card.vx-animate, .ib-card-img img, .ib-hero-subtitle, .ib-hero-title {
    transition-duration: 0.01s !important;
    animation-duration: 0.01s !important;
  }
  body.ib-page-leaving { animation: none; }
}
