/* Immobilien page (src/immobilien/immobilien.html). All classes are prefixed "im-". */

.im-section {
  --im-accent: var(--color-blue, #002af8);
  --im-accent-dark: #0020c4; /* hover */
  --im-accent-dark: color-mix(in srgb, var(--im-accent) 78%, #000);
  --im-ink: #212529;
  --im-muted: #6c738f;
  --im-line: #e7e9f2;
}

/* ---------------------------------------------------------------- filter */

.im-filter {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .5rem;
  margin-bottom: 2rem;
}

.im-chip {
  border: 1px solid #d9dcea;
  background: #fff;
  color: var(--im-ink);
  border-radius: 999px;
  padding: .45rem 1.1rem;
  font-size: .95rem;
  line-height: 1.2;
  cursor: pointer;
  transition: background-color .15s, border-color .15s, color .15s;
}

.im-chip span {
  margin-left: .35rem;
  font-size: .85em;
  opacity: .65;
}

.im-chip:hover {
  border-color: var(--im-accent);
}

/* !important: style.css has a global ".active { color: blue !important; text-decoration: underline }" */
.im-chip.active {
  background: var(--im-accent);
  border-color: var(--im-accent);
  color: #fff !important;
  text-decoration: none;
}

/* ------------------------------------------------------------------ card */

.im-card {
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--im-line);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(20, 24, 60, .04);
  transition: box-shadow .2s, transform .2s;
}

.im-card:hover {
  box-shadow: 0 14px 30px rgba(20, 24, 60, .12);
  transform: translateY(-2px);
}

.im-media {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  aspect-ratio: 4 / 3;
  background: #eef0f7;
  overflow: hidden;
  cursor: zoom-in;
}

.im-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .45s ease;
}

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

.im-media--empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  color: #9097b0;
  font-size: .9rem;
  cursor: default;
}

.im-media--empty .fa {
  font-size: 2.2rem;
}

.im-badge {
  position: absolute;
  top: .75rem;
  left: .75rem;
  max-width: calc(100% - 1.5rem);
  padding: .25rem .7rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, .95);
  color: #2b3050;
  font-size: .78rem;
  font-weight: 500;
  line-height: 1.3;
  box-shadow: 0 1px 4px rgba(20, 24, 60, .15);
}

/* "Reserviert" ribbon, set per listing in the admin */
.im-reserved {
  position: absolute;
  top: .75rem;
  right: .75rem;
  padding: .25rem .8rem;
  border-radius: 999px;
  background: var(--color-red, #df1529);
  color: #fff;
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  line-height: 1.3;
  box-shadow: 0 1px 4px rgba(20, 24, 60, .25);
}

.im-count {
  position: absolute;
  right: .75rem;
  bottom: .75rem;
  padding: .25rem .65rem;
  border-radius: 999px;
  background: rgba(15, 18, 40, .72);
  color: #fff;
  font-size: .8rem;
  line-height: 1.3;
}

.im-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 1.15rem 1.25rem 1.3rem;
}

.im-loc {
  margin-bottom: .4rem;
  color: var(--im-muted);
  font-size: .85rem;
}

.im-title {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin: 0 0 .9rem;
  font-size: 1.05rem;
  font-weight: 500;
  line-height: 1.35;
}

.im-title a {
  color: var(--im-ink);
  text-decoration: none;
}

.im-title a:hover {
  color: var(--im-accent);
}

.im-price-main {
  color: var(--im-accent);
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -.01em;
}

.im-price-note {
  margin-left: .4rem;
  color: var(--im-muted);
  font-size: .82rem;
}

.im-facts {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem 1.6rem;
  margin: 1rem 0;
  padding: .85rem 0;
  list-style: none;
  border-top: 1px solid var(--im-line);
  border-bottom: 1px solid var(--im-line);
}

.im-facts li {
  display: flex;
  flex-direction: column;
}

.im-facts strong {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.3;
}

.im-facts span {
  color: var(--im-muted);
  font-size: .78rem;
}

.im-tags {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  margin: 0 0 1.2rem;
  padding: 0;
  list-style: none;
}

.im-tags li {
  padding: .2rem .65rem;
  border-radius: 999px;
  background: #f2f4fa;
  color: #4a5070;
  font-size: .78rem;
}

.im-tags .im-tags-more {
  background: transparent;
  color: var(--im-muted);
}

.im-actions {
  margin-top: auto;
}

.im-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  width: 100%;
  padding: .65rem 1rem;
  border-radius: 10px;
  background: var(--im-accent);
  color: #fff;
  font-weight: 500;
  text-decoration: none;
  transition: background-color .15s;
}

.im-btn:hover {
  background: var(--im-accent-dark);
  color: #fff;
}

/* ------------------------------------------------ loading / empty / credit */

.im-skel .im-media {
  cursor: default;
}

.im-skel .im-media,
.im-skel-line {
  background: linear-gradient(90deg, #eef0f7 25%, #f7f8fc 50%, #eef0f7 75%);
  background-size: 200% 100%;
  animation: im-shimmer 1.4s infinite linear;
}

.im-skel-line {
  height: .9rem;
  margin-bottom: .8rem;
  border-radius: 6px;
}

.im-skel:hover {
  transform: none;
  box-shadow: 0 1px 2px rgba(20, 24, 60, .04);
}

@keyframes im-shimmer {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}

.im-empty {
  padding: 3rem 1rem;
  text-align: center;
  color: #555;
}

.im-empty .im-btn {
  width: auto;
  padding: .65rem 1.6rem;
}

.im-credit {
  margin: 2.5rem 0 0;
  text-align: center;
  color: var(--im-muted);
  font-size: .8rem;
}

.im-credit a {
  color: inherit;
  text-decoration: underline;
}

/* -------------------------------------------------------------- lightbox */

body.im-noscroll {
  overflow: hidden;
}

.im-lightbox {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(10, 12, 22, .93);
}

.im-lb-inner {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(1100px, 100%);
  max-height: 100%;
  color: #fff;
}

.im-lb-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 3rem .75rem 0;
  font-size: .95rem;
}

.im-lb-head strong {
  overflow: hidden;
  font-weight: 500;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.im-lb-head span {
  flex: none;
  opacity: .7;
  font-size: .85rem;
}

.im-lb-close {
  position: absolute;
  top: -.25rem;
  right: 0;
  width: 2.5rem;
  height: 2.5rem;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .12);
  color: #fff;
  font-size: 1.1rem;
  cursor: pointer;
}

.im-lb-close:hover,
.im-lb-nav:hover {
  background: rgba(255, 255, 255, .25);
}

/* fixed height: the caption and thumbnail strip stay put when portrait and landscape photos alternate */
.im-lb-stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: calc(100vh - 230px);
  max-height: 720px;
  min-height: 200px;
}

.im-lb-stage > img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  border-radius: 8px;
  object-fit: contain;
  background: #000;
}

.im-lb-nav {
  position: absolute;
  top: 50%;
  z-index: 1;
  width: 2.8rem;
  height: 2.8rem;
  margin-top: -1.4rem;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .15);
  color: #fff;
  cursor: pointer;
}

.im-lb-prev { left: .75rem; }
.im-lb-next { right: .75rem; }

.im-lb-caption {
  min-height: 1.6rem;
  padding-top: .6rem;
  text-align: center;
  font-size: .9rem;
  opacity: .85;
}

.im-lb-thumbs {
  display: flex;
  gap: .4rem;
  margin-top: .5rem;
  padding-bottom: .25rem;
  overflow-x: auto;
}

.im-lb-thumbs button {
  flex: none;
  width: 72px;
  height: 52px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 6px;
  background: #222;
  overflow: hidden;
  opacity: .55;
  cursor: pointer;
  transition: opacity .15s, border-color .15s;
}

.im-lb-thumbs button:hover {
  opacity: .9;
}

.im-lb-thumbs button.active {
  border-color: #fff;
  opacity: 1;
  text-decoration: none;
}

.im-lb-thumbs img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

@media (max-width: 575.98px) {
  .im-lightbox { padding: .5rem; }
  .im-lb-nav { width: 2.4rem; height: 2.4rem; margin-top: -1.2rem; }
  .im-lb-stage { height: calc(100vh - 200px); }
  .im-lb-thumbs button { width: 56px; height: 42px; }
}

@media (prefers-reduced-motion: reduce) {
  .im-card, .im-media img, .im-chip { transition: none; }
  .im-card:hover { transform: none; }
  .im-card:hover .im-media img { transform: none; }
  .im-skel .im-media, .im-skel-line { animation: none; }
}
