/* ===== Design Tokens ===== */
/* Primärfarben: Kanton Zürich Designsystem (zh.ch) */
:root {
  --color-primary:       #00407C;
  --color-primary-light: #0070B4;
  --color-accent:        #c9a84c;
  --color-text:          #1e1e1e;
  --color-text-muted:    #5a5a5a;
  --color-bg:            #ffffff;
  --color-bg-muted:      #f7f9fb;
  --color-border:        #e0e8f0;
  --font:                system-ui, -apple-system, 'Segoe UI', Helvetica, Arial, sans-serif;
  --radius:              14px;
  --radius-pill:         9999px;
  --shadow-sm:           0 1px 2px rgba(0,0,0,.06);
  --shadow:              0 4px 12px rgba(0,0,0,.10);
  --shadow-lg:           0 8px 28px rgba(0,0,0,.14);
  --max-width:           1280px;
  --gap:                 1.5rem;
  --grad-blue:           linear-gradient(135deg, #001f4d 0%, #0070B4 100%);
  --grad-blue-soft:      linear-gradient(135deg, #00407C 0%, #0070B4 100%);
  --grad-gold:           linear-gradient(135deg, #b8943d 0%, #e8c86a 100%);
}

/* ===== Reset ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { font-family: var(--font); color: var(--color-text); background: var(--color-bg); line-height: 1.65; }
img, video { max-width: 100%; height: auto; display: block; }
a { color: inherit; }

/* ===== Layout ===== */
.container { max-width: var(--max-width); margin: 0 auto; padding: 0 var(--gap); }
.section { padding: 5rem 0; }
.section--muted { background: var(--color-bg-muted); }
.section--center { text-align: center; }
.section__title { font-size: clamp(1.4rem, 3vw, 2rem); font-weight: 600; margin-bottom: 2rem; }
.section__cta { text-align: center; margin-top: 3rem; }

/* ===== Header ===== */
.site-header {
  background: #fff;
  position: sticky; top: 0; z-index: 200;
  border-bottom: 1px solid var(--color-border);
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.nav {
  display: flex; align-items: center; justify-content: space-between;
  height: 80px;
}
.nav__logo {
  font-size: 1.2rem; font-weight: 800; color: var(--color-primary);
  text-decoration: none; letter-spacing: -.02em;
}
.nav__logo span { color: var(--color-accent); }
.nav__links {
  display: flex; align-items: center; gap: 2rem;
  list-style: none;
}
.nav__links a {
  color: var(--color-text-muted); text-decoration: none;
  font-size: .92rem; font-weight: 500; transition: color .15s;
}
.nav__links a:hover { color: var(--color-text); }
.nav__links a.active { color: var(--color-primary); font-weight: 600; }
.nav__lang {
  font-size: .82rem; color: var(--color-primary);
  text-decoration: none; border: 1.5px solid var(--color-border);
  padding: .3rem .875rem; border-radius: var(--radius-pill); transition: all .15s;
  font-weight: 600;
}
.nav__lang:hover { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }

/* Mobile nav */
.nav__toggle {
  display: none; background: none; border: none; cursor: pointer;
  color: var(--color-text); width: 32px; height: 32px; position: relative;
}
.nav__toggle-icon,
.nav__toggle-icon::before,
.nav__toggle-icon::after {
  display: block; width: 22px; height: 2px;
  background: currentColor; border-radius: 2px;
  transition: transform .2s;
}
.nav__toggle-icon { margin: auto; }
.nav__toggle-icon::before,
.nav__toggle-icon::after {
  content: ''; position: absolute; left: 5px;
}
.nav__toggle-icon::before { top: 10px; }
.nav__toggle-icon::after  { bottom: 10px; }
.nav__toggle[aria-expanded="true"] .nav__toggle-icon { background: transparent; }
.nav__toggle[aria-expanded="true"] .nav__toggle-icon::before { transform: rotate(45deg) translate(5px, 5px); }
.nav__toggle[aria-expanded="true"] .nav__toggle-icon::after  { transform: rotate(-45deg) translate(5px, -5px); }

/* ===== Hero ===== */
.hero {
  background:
    linear-gradient(
      160deg,
      rgba(0, 20, 60, 0.85) 0%,
      rgba(0, 80, 150, 0.60) 55%,
      rgba(0, 112, 180, 0.38) 100%
    ),
    url('/assets/images/hero-zurich.jpg') center 55% / cover no-repeat;
  color: #fff; padding: 9rem 0; text-align: center;
  position: relative; overflow: hidden;
}
.hero::after {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at 60% 40%, rgba(0,112,180,.18) 0%, transparent 70%);
  pointer-events: none;
}
.hero__title {
  font-size: clamp(2rem, 5vw, 3.75rem);
  font-weight: 900; line-height: 1.1; margin-bottom: 1.25rem;
  text-shadow: 0 2px 20px rgba(0,0,0,.4);
  animation: fadeSlideUp .8s cubic-bezier(.22,1,.36,1) .1s both;
}
.hero__subtitle {
  font-size: 1.18rem; opacity: .92;
  max-width: 560px; margin: 0 auto 2.75rem;
  text-shadow: 0 1px 8px rgba(0,0,0,.28);
  animation: fadeSlideUp .8s cubic-bezier(.22,1,.36,1) .25s both;
}
.hero .btn {
  animation: fadeSlideUp .8s cubic-bezier(.22,1,.36,1) .4s both;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: .5rem; padding: .8rem 1.75rem; border-radius: var(--radius-pill);
  font-size: .95rem; font-weight: 600; text-decoration: none;
  cursor: pointer; transition: transform .18s, box-shadow .18s, background-position .4s;
  border: 2px solid transparent; font-family: inherit;
}
.btn--primary {
  background: var(--grad-gold); background-size: 200% 100%;
  color: #111; border-color: transparent;
  box-shadow: 0 4px 14px rgba(201,168,76,.35);
}
.btn--primary:hover {
  background-position: 100% 0;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(201,168,76,.45);
}
.btn--outline { background: transparent; color: #fff; border-color: rgba(255,255,255,.6); }
.btn--outline:hover { background: rgba(255,255,255,.14); border-color: #fff; transform: translateY(-1px); }
.btn--outline-dark { background: transparent; color: var(--color-primary); border-color: var(--color-border); font-weight: 600; }
.btn--outline-dark:hover { border-color: var(--color-primary); background: #f0f6fb; }
.btn--ghost { background: transparent; color: var(--color-primary); border-color: transparent; }
.btn--ghost:hover { background: rgba(0,64,124,.08); }
.btn--full { width: 100%; }
.btn--sm { padding: .45rem 1rem; font-size: .83rem; }

/* ===== Stats bar ===== */
.stats { background: #fff; color: var(--color-text); padding: 2rem 0; border-bottom: 1px solid var(--color-border); }
.stats__grid { display: flex; justify-content: center; gap: 4rem; flex-wrap: wrap; }
.stat { text-align: center; }
.stat__value { font-size: 2rem; font-weight: 700; color: var(--color-primary); line-height: 1; }
.stat__label { font-size: .82rem; color: var(--color-text-muted); margin-top: .3rem; }

/* ===== Page header ===== */
.page-header {
  background: var(--grad-blue-soft); color: #fff;
  padding: 3rem 0;
}
.page-header--apt { padding: .75rem 0; }
.page-header__title { font-size: clamp(1.6rem, 4vw, 2.5rem); font-weight: 700; }
.page-header__subtitle { opacity: .8; margin-top: .4rem; }
.apt-back-link { color: rgba(255,255,255,.8); text-decoration: none; font-size: .9rem; }
.apt-back-link:hover { color: #fff; }
.apt-count { color: var(--color-text-muted); font-size: .9rem; margin-bottom: 1.5rem; }

/* ===== Apartment card grid ===== */
.apt-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.75rem;
}
.apt-card {
  background: #fff; border-radius: var(--radius);
  box-shadow: none; overflow: hidden;
  transition: transform .22s cubic-bezier(.22,1,.36,1), box-shadow .22s;
  border: 1px solid var(--color-border);
}
.apt-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: transparent;
}
.apt-card__link { text-decoration: none; color: inherit; display: flex; flex-direction: column; height: 100%; }
.apt-card__img { aspect-ratio: 3/2; overflow: hidden; background: var(--color-bg-muted); position: relative; }
.apt-card__img img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s cubic-bezier(.22,1,.36,1); }
.apt-card:hover .apt-card__img img { transform: scale(1.05); }
.apt-card__img-placeholder {
  width: 100%; height: 100%;
  background: linear-gradient(135deg, #e8eef5 0%, #d0dde9 100%);
}
.apt-card__body { padding: 1.1rem 1.25rem 1.25rem; flex: 1; display: flex; flex-direction: column; }
.apt-card__district {
  position: absolute; top: .75rem; left: .75rem;
  background: rgba(255,255,255,.95); backdrop-filter: blur(4px);
  border-radius: var(--radius-pill);
  padding: .22rem .75rem;
  font-size: .72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--color-text);
  box-shadow: 0 1px 4px rgba(0,0,0,.12);
}
.apt-card__title { font-size: 1rem; font-weight: 600; line-height: 1.35; margin-bottom: .6rem; color: var(--color-text); }
.apt-card__meta {
  display: flex; flex-wrap: wrap; gap: .4rem .875rem;
  font-size: .82rem; color: var(--color-text-muted); margin-bottom: .875rem;
}
.apt-card__footer {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: auto; padding-top: .875rem; border-top: 1px solid var(--color-border);
}
.apt-card__price { font-size: 1rem; font-weight: 700; color: var(--color-text); }
.apt-card__price strong { font-weight: 800; color: var(--color-primary); }
.apt-card__price-sub { font-size: .78rem; font-weight: 400; color: var(--color-text-muted); }

/* ===== Apartment detail ===== */
.apt-gallery {
  display: grid; grid-template-columns: 2fr 1fr;
  gap: .4rem; height: 400px; border-radius: var(--radius);
  overflow: hidden; margin-bottom: 2.5rem;
}
.apt-gallery__main,
.apt-gallery__thumb { overflow: hidden; }
.apt-gallery__main { grid-row: 1 / 3; }
.apt-gallery__thumbs { display: grid; grid-template-rows: 1fr 1fr; gap: .4rem; }
.apt-gallery__thumb--empty { background: var(--color-bg-muted); }
.apt-gallery img { width: 100%; height: 100%; object-fit: cover; }
.apt-gallery__placeholder {
  grid-column: 1 / -1; grid-row: 1 / -1;
  background: linear-gradient(135deg, #e8eef5 0%, #d0dde9 100%);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 1rem;
}
.apt-gallery__placeholder span { font-size: 4rem; }
.apt-gallery__placeholder p { color: var(--color-text-muted); font-size: 1.1rem; }

.apt-detail__layout {
  display: grid; grid-template-columns: 1fr 380px;
  gap: 3rem; align-items: start;
}
.apt-detail__district {
  font-size: .78rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .08em; color: var(--color-accent); margin-bottom: .4rem;
}
.apt-detail__title {
  font-size: clamp(1.5rem, 3vw, 2.1rem);
  font-weight: 900; margin-bottom: 1.5rem; line-height: 1.2;
}
.apt-detail__specs {
  display: flex; gap: 2rem; flex-wrap: wrap; margin-bottom: 2rem;
  padding-bottom: 2rem; border-bottom: 1px solid var(--color-border);
}
.apt-spec__value { font-size: 1.6rem; font-weight: 900; color: var(--color-primary); line-height: 1; }
.apt-spec__label { font-size: .78rem; color: var(--color-text-muted); margin-top: .2rem; }
.apt-detail__description {
  font-size: 1.02rem; line-height: 1.8;
  color: var(--color-text-muted); margin-bottom: 2rem;
}
.apt-detail__section-title {
  font-size: 1.05rem; font-weight: 800; margin-bottom: .9rem; margin-top: .5rem;
}
.apt-features { list-style: none; display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; margin-bottom: 2rem; }
.apt-features li { font-size: .9rem; padding-left: 1.25rem; position: relative; }
.apt-features li::before { content: "✓"; position: absolute; left: 0; color: var(--color-accent); font-weight: 700; }
.apt-amenities { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 2rem; }
.apt-amenity {
  background: var(--color-bg-muted); border-radius: 99px;
  padding: .35rem 1rem; font-size: .83rem;
}

/* ===== Booking card ===== */
.booking-card {
  background: #fff; border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: 1.75rem;
  position: sticky; top: 96px;
  border: 1px solid var(--color-border);
}
.booking-card__price {
  font-size: 1.75rem; font-weight: 700; color: var(--color-text);
  margin-bottom: 1.5rem;
}
.booking-card__price strong { color: var(--color-primary); font-weight: 800; }
.booking-card__price span { font-size: 1rem; font-weight: 400; color: var(--color-text-muted); }

/* ===== Form ===== */
.form-group { margin-bottom: 1.1rem; }
.form-group label {
  display: block; font-size: .87rem; font-weight: 700;
  margin-bottom: .35rem;
}
.form-control {
  width: 100%; padding: .6rem .875rem;
  border: 1.5px solid var(--color-border); border-radius: var(--radius);
  font-size: .92rem; font-family: inherit; background: #fff;
  transition: border-color .15s;
}
.form-control:focus { outline: none; border-color: var(--color-primary); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
textarea.form-control { resize: vertical; min-height: 90px; }
select.form-control { cursor: pointer; }
.form-success {
  background: #d4edda; color: #155724;
  border-radius: var(--radius); padding: .875rem 1rem;
  margin-top: 1rem; font-size: .9rem; display: none;
}
.form-success.visible { display: block; }

/* ===== Contact ===== */
.contact-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 4rem; align-items: start; }
.contact-intro { color: var(--color-text-muted); margin-bottom: 2.5rem; line-height: 1.75; }
.contact-info__item { display: flex; gap: 1rem; margin-bottom: 2rem; align-items: flex-start; }
.contact-info__icon { font-size: 1.4rem; flex-shrink: 0; line-height: 1; }
.contact-info__label { font-weight: 700; font-size: .9rem; margin-bottom: .2rem; }
.contact-info__value { color: var(--color-text-muted); font-size: .9rem; text-decoration: none; font-style: normal; }
.contact-info__value:is(a):hover { color: var(--color-primary); }
.contact-form-title { font-size: 1.3rem; font-weight: 800; margin-bottom: 1.5rem; }

/* ===== 404 ===== */
.error-code { font-size: 6rem; font-weight: 900; color: var(--color-primary); line-height: 1; }
.error-message { font-size: 1.2rem; color: var(--color-text-muted); margin: 1rem 0 2rem; }

/* ===== Footer ===== */
.site-footer { background: #111; color: rgba(255,255,255,.7); padding: 3.5rem 0 1.5rem; }
.footer__grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 3rem; margin-bottom: 3rem; }
.footer__logo { font-size: 1.2rem; font-weight: 800; color: #fff; margin-bottom: .6rem; }
.footer__logo span { color: var(--color-accent); }
.footer__tagline { font-size: .88rem; margin-bottom: .75rem; }
.footer__contact { font-size: .88rem; }
.footer__contact a { color: rgba(255,255,255,.7); text-decoration: none; }
.footer__contact a:hover { color: #fff; }
.footer__heading {
  font-size: .75rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: .08em; color: rgba(255,255,255,.45); margin-bottom: .875rem;
}
.footer__links { list-style: none; }
.footer__links li { margin-bottom: .5rem; }
.footer__links a { color: rgba(255,255,255,.7); text-decoration: none; font-size: .88rem; }
.footer__links a:hover { color: #fff; }
.footer__address { font-style: normal; font-size: .88rem; line-height: 1.7; }
.footer__bottom {
  border-top: 1px solid rgba(255,255,255,.1); padding-top: 1.5rem;
  display: flex; justify-content: space-between; align-items: center;
  font-size: .82rem; flex-wrap: wrap; gap: .75rem;
}
.footer__bottom nav { display: flex; gap: 1.25rem; }
.footer__bottom a { color: rgba(255,255,255,.6); text-decoration: none; }
.footer__bottom a:hover { color: #fff; }
.footer__photo-credit { color: rgba(255,255,255,.45); font-size: .78rem; }

/* ===== Map list layout ===== */
.apt-list-layout {
  display: grid;
  grid-template-columns: 1fr 630px;
  height: calc(100vh - 80px);
  overflow: hidden;
  transition: grid-template-columns .3s ease;
}
.apt-list-layout.map-hidden {
  grid-template-columns: 1fr 0;
}
.apt-list-layout.map-hidden .apt-map-panel {
  overflow: hidden;
  border-left: none;
}
#map-toggle { min-width: 110px; }
.apt-list-panel {
  overflow-y: auto;
  padding: 1.5rem;
  background: var(--color-bg-muted);
}
.apt-list-inner { max-width: 860px; }
.apt-list-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.25rem; flex-wrap: wrap; gap: .5rem;
}
.apt-list-count { font-size: .88rem; color: var(--color-text-muted); }
.apt-list-hint { text-align: center; color: var(--color-text-muted); padding: 2rem; }

/* Card grid inside the list panel – two narrower columns */
.apt-grid--list {
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
}

/* Card highlight on map-marker click */
.apt-card--highlighted { outline: 3px solid var(--color-primary-light); outline-offset: 2px; }

.apt-map-panel {
  position: sticky;
  top: 0;
  border-left: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
}
#apt-map { flex: 1; min-height: 0; }
.map-hint {
  padding: .4rem .75rem;
  font-size: .72rem;
  color: var(--color-text-muted);
  text-align: center;
  background: var(--color-bg-muted);
  border-top: 1px solid var(--color-border);
}

/* ===== Leaflet custom markers ===== */
.apt-marker { background: none !important; border: none !important; }
.apt-marker-pin {
  background: var(--color-primary);
  color: #fff;
  border: 2px solid #fff;
  border-radius: 20px;
  padding: 5px 10px;
  font-size: .8rem;
  font-weight: 800;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0,0,0,.3);
  cursor: pointer;
  transition: transform .15s, background .15s;
  font-family: var(--font);
}
.apt-marker-pin:hover,
.apt-marker--active .apt-marker-pin {
  background: var(--color-accent);
  color: #111;
  transform: scale(1.08);
}

/* ===== Leaflet popup ===== */
.apt-popup .leaflet-popup-content-wrapper {
  padding: 0;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.apt-popup .leaflet-popup-content { margin: 0; width: 210px !important; }
.map-popup__link { text-decoration: none; color: inherit; display: block; }
.map-popup__link:hover { color: inherit; }
.map-popup__img {
  width: 100%; height: 130px;
  object-fit: cover; display: block;
}
.map-popup__body { padding: .75rem; }
.map-popup__district {
  font-size: .72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--color-accent); margin-bottom: .2rem;
}
.map-popup__title { font-size: .88rem; font-weight: 700; line-height: 1.3; margin-bottom: .4rem; color: var(--color-text); }
.map-popup__price { font-size: .82rem; color: var(--color-primary); font-weight: 700; }

/* ===== Animations ===== */
@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(28px); }
  to   { opacity: 1; transform: none; }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Scroll-reveal: JS adds .in-view when element enters viewport */
.scroll-fade {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity .55s cubic-bezier(.22,1,.36,1), transform .55s cubic-bezier(.22,1,.36,1);
  transition-delay: var(--anim-delay, 0s);
}
.scroll-fade.in-view {
  opacity: 1;
  transform: none;
}

/* Section title accent line */
.section__title {
  position: relative; display: inline-block;
}
.section__title::after {
  content: '';
  display: block; height: 2px; width: 0; margin-top: .4rem;
  background: var(--grad-gold);
  border-radius: 2px;
  transition: width .45s cubic-bezier(.22,1,.36,1);
}
.section__title.in-view::after { width: 48px; }

/* ===== Legal pages (Impressum / Datenschutz) ===== */
.legal-content {
  max-width: 760px;
  line-height: 1.8;
}
.legal-content h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-primary);
  margin: 2.5rem 0 .6rem;
  padding-bottom: .3rem;
  border-bottom: 1px solid var(--color-border);
}
.legal-content h3 {
  font-size: 1rem;
  font-weight: 700;
  margin: 1.5rem 0 .3rem;
}
.legal-content p { margin-bottom: 1rem; }
.legal-content a { color: var(--color-primary-light); }

/* ===== Responsive ===== */
@media (max-width: 1100px) {
  .apt-list-layout { grid-template-columns: 1fr 510px; }
}
@media (max-width: 960px) {
  .apt-detail__layout { grid-template-columns: 1fr; }
  .booking-card { position: static; }
  .contact-layout { grid-template-columns: 1fr; gap: 2.5rem; }
  .footer__grid { grid-template-columns: 1fr 1fr; }
  .apt-gallery { height: 300px; }
  .apt-features { grid-template-columns: 1fr; }
  /* Map stacks vertically on tablet */
  .apt-list-layout {
    grid-template-columns: 1fr;
    height: auto;
    overflow: visible;
  }
  .apt-list-panel { overflow-y: visible; }
  .apt-map-panel {
    position: static;
    height: 380px;
    order: -1;           /* map appears above the list on mobile */
    border-left: none;
    border-bottom: 1px solid var(--color-border);
  }
}
@media (max-width: 640px) {
  :root { --gap: 1rem; }
  .nav__links {
    display: none; flex-direction: column;
    position: fixed; inset: 80px 0 auto 0;
    background: #fff; padding: 1.5rem;
    gap: 1.25rem; box-shadow: var(--shadow-lg);
    border-bottom: 1px solid var(--color-border);
  }
  .nav__links.open { display: flex; }
  .nav__toggle { display: flex; align-items: center; justify-content: center; }
  .stats__grid { gap: 2rem; }
  .apt-gallery { grid-template-columns: 1fr; height: 220px; }
  .apt-gallery__thumbs { display: none; }
  .form-row { grid-template-columns: 1fr; }
  .footer__grid { grid-template-columns: 1fr; gap: 2rem; }
  .footer__bottom { flex-direction: column; text-align: center; }
}
