/* ============================================================
   MABO IMMOBILIEN – Startseite (Privatkunden)
   Layered hero, introduction, services, reference band,
   "Warum Mabo" sequence and contact.
   Scroll depth is driven by --p (0…1), written by main.js.
   ============================================================ */

/* ── Hero ── */
.hero {
  --p: 0;
  position: relative;
  isolation: isolate;
  overflow: clip;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100svh;
  padding-top: calc(var(--header-h) + env(safe-area-inset-top) + clamp(1.75rem, 0.75rem + 3.5vw, 3.75rem));
  padding-bottom: clamp(1.5rem, 1rem + 2vw, 2.5rem);
  background: var(--bg);
}
.hero__backdrop {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}
.hero__glow {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 55% 50% at 74% 40%, rgb(205 176 122 / 0.11), transparent 70%),
    linear-gradient(180deg, var(--ink-950) 0%, #12110f 62%, var(--ink-950) 100%);
}
.hero__drawing {
  position: absolute;
  top: 10%;
  right: max(0rem, (100vw - 86rem) / 2);
  width: min(56rem, 66vw);
  height: auto;
  color: rgb(205 176 122 / 0.22);
  transform: translate3d(calc(var(--px, 0) * -14px), calc(var(--p) * 7rem + var(--py, 0) * -10px), 0);
}
/* Light tracing the building outline and terrace frames */
.hero__drawing .tracer {
  stroke: var(--gold-300);
  stroke-width: 1.6;
  stroke-dasharray: 0.07 0.93;
  opacity: 0.85;
  animation: tracer 9s linear 2.8s infinite both;
}
.hero__drawing .tracer--frames {
  stroke-dasharray: 0.12 0.88;
  animation-duration: 7s;
  animation-delay: 3.6s;
}
@keyframes tracer {
  from { stroke-dashoffset: 1; }
  to { stroke-dashoffset: 0; }
}
.hero__drawing .faint { opacity: 0.45; }
.hero__drawing text {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  fill: currentColor;
  stroke: none;
}

.hero__grid {
  display: grid;
  flex: 1;
  align-items: center;
  gap: clamp(3rem, 2rem + 4vw, 4.5rem);
}
.hero__copy {
  display: grid;
  justify-items: start;
  gap: var(--space-5);
  transform: translate3d(calc(var(--px, 0) * -6px), calc(var(--p) * 4.5rem), 0);
}
.hero__copy .eyebrow { margin-bottom: 0; }
.hero__title {
  font-size: var(--fs-hero);
  line-height: 0.98;
  letter-spacing: -0.025em;
}
.hero__title .line { display: block; }
.hero__lead {
  max-width: 34rem;
  font-size: var(--fs-lead);
  line-height: 1.75;
  color: var(--text-muted);
}
.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: var(--space-2);
}

/* Photo planes: two real project photographs at different depths */
.hero__visual {
  position: relative;
  perspective: 1600px;
  perspective-origin: 20% 40%;
}
.hero__stage {
  position: relative;
  aspect-ratio: 1 / 0.95;
  transform-style: preserve-3d;
}
.hero-plane {
  position: absolute;
  margin: 0;
  transform-style: preserve-3d;
}
.hero-plane::before {
  /* extruded frame sitting behind each photograph */
  content: "";
  position: absolute;
  inset: -0.8rem;
  border: 1px solid var(--line);
  transform: translateZ(-40px);
  pointer-events: none;
}
.hero-plane__frame {
  position: relative;
  height: 100%;
  overflow: hidden;
  background: var(--ink-850);
  box-shadow: var(--shadow-3);
}
.hero-plane__frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.hero-plane__light {
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 30%, rgb(255 244 222 / 0.16) 48%, transparent 64%);
  transform: translate3d(calc(-60% + var(--p) * 120% + var(--px, 0) * 22%), 0, 0);
  pointer-events: none;
}
.hero-plane--back {
  top: 0;
  right: 0;
  width: 56%;
  aspect-ratio: 3 / 4;
  transform:
    translate3d(calc(var(--px, 0) * -10px), calc(var(--p) * -1.5rem + var(--py, 0) * -6px), -120px)
    rotateY(calc(-14deg + var(--p) * 10deg + var(--px, 0) * 6deg))
    rotateX(calc(var(--py, 0) * -4deg));
}
.hero-plane--back .hero-plane__frame { filter: saturate(0.92); }
.hero-plane--front {
  left: 0;
  bottom: 6%;
  width: 74%;
  aspect-ratio: 4 / 3;
  transform:
    translate3d(calc(var(--px, 0) * 14px), calc(var(--p) * -6rem + var(--py, 0) * 8px), 50px)
    rotateY(calc(-6deg + var(--p) * 6deg + var(--px, 0) * 8deg))
    rotateX(calc(var(--p) * 3deg + var(--py, 0) * -5deg));
}

/* Annotation callout */
.hero-note {
  position: absolute;
  right: -0.5rem;
  bottom: -2.25rem;
  z-index: 2;
  display: grid;
  gap: 0.3rem;
  min-width: 15rem;
  max-width: 19rem;
  padding: 1rem 1.25rem 0.85rem;
  background: rgb(20 20 19 / 0.94);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-2);
  transform: translateZ(60px);
}
.hero-note::before {
  content: "";
  position: absolute;
  top: -1.75rem;
  left: 1.25rem;
  width: 1px;
  height: 1.75rem;
  background: var(--accent);
}
.hero-note__label {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent-text);
}
.hero-note__title {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  line-height: 1.25;
  color: var(--text-strong);
}
.hero-note__meta {
  font-size: var(--fs-sm);
  color: var(--text-muted);
}
.hero-note .text-link { justify-self: start; margin-top: 0.25rem; }

/* Hero base: title block of key figures + scroll cue */
.hero__base {
  display: grid;
  gap: var(--space-5);
  align-items: end;
  margin-top: clamp(3.5rem, 2rem + 3vw, 4.5rem);
}
.hero__scroll {
  display: none;
  align-items: center;
  gap: 1rem;
  justify-self: end;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.hero__scroll-line {
  position: relative;
  width: 1px;
  height: 3.5rem;
  overflow: hidden;
  background: var(--line);
}
.hero__scroll-line::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--accent);
  transform: translateY(-100%);
  animation: scroll-cue 2.6s var(--ease-in-out) 2s infinite;
}

@media (min-width: 64em) {
  .hero__grid { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }
  .hero__visual { margin-right: calc(var(--gutter) * -0.25); }
  .hero__base { grid-template-columns: minmax(0, 8fr) minmax(0, 4fr); }
  .hero__scroll { display: flex; }
}
@media (max-width: 63.99em) {
  .hero__copy,
  .hero__drawing,
  .hero-plane--back,
  .hero-plane--front,
  .hero-plane__light { transform: none; }
  .hero__drawing { top: auto; bottom: 14%; right: -34%; width: 150%; opacity: 0.6; }
  .hero__visual { max-width: 36rem; width: 100%; }
  /* Front plane flows normally so its caption can never overlap the copy */
  .hero__stage { aspect-ratio: auto; padding-top: 16%; }
  .hero-plane--back { width: 46%; transform: translateZ(-60px) rotateY(-8deg); }
  .hero-plane--front { position: relative; left: auto; bottom: auto; width: 86%; transform: rotateY(-3deg); }
  .hero-plane::before { inset: -0.5rem; }
  .hero-note {
    position: relative;
    right: auto;
    bottom: auto;
    min-width: 0;
    max-width: none;
    margin-top: var(--space-4);
    transform: none;
  }
  .hero-note::before { display: none; }
}
@media (max-width: 30em) {
  .hero__actions { display: grid; width: 100%; }
}

/* Hero entrance (CSS only, ends in the resting state) */
.hero__copy > *,
.hero__title .line {
  animation: rise 1s var(--ease-out) both;
}
.hero__copy > .eyebrow { animation-delay: 0.1s; }
.hero__title .line:nth-child(1) { animation-delay: 0.18s; }
.hero__title .line:nth-child(2) { animation-delay: 0.28s; }
.hero__title .line:nth-child(3) { animation-delay: 0.38s; }
.hero__title { animation: none; }
.hero__copy > .hero__lead { animation-delay: 0.5s; }
.hero__copy > .hero__actions { animation-delay: 0.6s; }
.hero-plane { animation: plane-in 1.5s var(--ease-out) both; }
.hero-plane--back { animation-delay: 0.35s; }
.hero-plane--front { animation-delay: 0.55s; }
.hero-note { animation: rise 1s var(--ease-out) 1.1s both; }
.hero__base { animation: rise 1s var(--ease-out) 0.9s both; }
/* Drawing sequence: outline → slabs → terrace frames → windows → level markers */
.hero__drawing .draw-in {
  stroke-dasharray: 1;
  animation: draw 2.4s var(--ease-in-out) 0.1s both;
}
.hero__drawing > g:nth-of-type(3) .draw-in { animation-delay: 0.35s; }
.hero__drawing > g:nth-of-type(4) .draw-in { animation-delay: 0.6s; }
.hero__drawing > g:nth-of-type(5) .draw-in { animation-delay: 0.85s; }
.hero__drawing > g:nth-of-type(6) .draw-in { animation-delay: 1.1s; }
.hero__drawing > g.faint { animation: fade-in 1.6s ease 0.2s both; }
.hero__drawing text { animation: fade-in 1.2s ease 1.6s both; }

@keyframes plane-in {
  from { opacity: 0; translate: 0 2.5rem; }
}
@keyframes scroll-cue {
  0% { transform: translateY(-100%); }
  55%, 100% { transform: translateY(100%); }
}

/* ── Introduction ── */
.about {
  padding-bottom: 0;
}
.about__grid {
  position: relative;
  display: grid;
  gap: var(--space-6);
}
.statement {
  max-width: 34ch;
  font-family: var(--font-serif);
  font-size: var(--fs-statement);
  line-height: 1.34;
  letter-spacing: -0.01em;
  color: var(--text-strong);
}
.statement strong {
  font-weight: 400;
  font-style: italic;
  color: var(--accent-text);
}
@media (min-width: 64em) {
  .about__grid { grid-template-columns: minmax(0, 2fr) minmax(0, 10fr); }
  .about__grid > * { grid-column: 2; }
}

/* ── Services ── */
.services { padding-top: clamp(3rem, 2rem + 3vw, 5rem); }
.services .section-head { margin-bottom: clamp(2.5rem, 1.5rem + 3vw, 4rem); }
.service-grid {
  display: grid;
  gap: var(--space-4);
  list-style: none;
}
.service-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  height: 100%;
  padding: clamp(1.75rem, 1.2rem + 2vw, 3rem);
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  scroll-margin-top: calc(var(--header-h) + 1.5rem);
}
.service-card::before {
  content: "";
  position: absolute;
  top: -1px;
  left: -1px;
  right: -1px;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--dur-4) var(--ease-out);
}
.service-card__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
}
.service-card__icon-frame {
  position: relative;
  display: grid;
  place-items: center;
  width: 4.5rem;
  height: 4.5rem;
  border: 1px solid var(--line-strong);
}
.service-card__icon-frame::before,
.service-card__icon-frame::after {
  /* plan-style corner ticks */
  content: "";
  position: absolute;
  width: 0.6rem;
  height: 0.6rem;
  border: 0 solid var(--accent);
}
.service-card__icon-frame::before { top: -4px; left: -4px; border-width: 1px 0 0 1px; }
.service-card__icon-frame::after { right: -4px; bottom: -4px; border-width: 0 1px 1px 0; }
.service-card__icon {
  width: 3rem;
  height: 3rem;
  color: var(--accent);
  stroke-width: 1.3;
}
.service-card__index {
  font-size: var(--fs-label);
  font-weight: 600;
  letter-spacing: 0.16em;
  color: var(--text-muted);
}
.service-card__title { font-size: var(--fs-h3); }
.service-card__text {
  flex: 1;
  color: var(--text-muted);
}
.service-card__link { align-self: flex-start; }
.service-card__link::after {
  content: "";
  position: absolute;
  inset: 0;
}
.service-card__link:focus-visible { outline: none; }
.service-card:has(.service-card__link:focus-visible) {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}
.service-card:hover::before,
.service-card:focus-within::before { transform: scaleX(1); }
@media (hover: hover) {
  .service-card:hover {
    --lift: -6px;
    border-color: var(--line-strong);
    box-shadow: var(--shadow-2);
  }
  .service-card:hover .service-card__link { background-size: 100% 1px; }
  .service-card:hover .service-card__link .icon { transform: translateX(4px); }
}
@media (min-width: 48em) {
  .service-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .service-grid > :last-child:nth-child(odd) { grid-column: 1 / -1; }
}
@media (min-width: 64em) {
  .service-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-5); }
  .service-grid > :last-child:nth-child(odd) { grid-column: auto; }
}

/* ── Reference band ── */
.band {
  --p: 0.5;
  position: relative;
  isolation: isolate;
  overflow: clip;
  display: grid;
  align-items: end;
  min-height: clamp(28rem, 22rem + 30vw, 46rem);
  background: var(--bg);
}
.band__media {
  position: absolute;
  inset: -12% 0;
  z-index: -2;
  margin: 0;
  transform: translate3d(0, calc((var(--p) - 0.5) * -14%), 0);
}
.band__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 45%;
}
.band::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(to top, rgb(12 12 11 / 0.94) 0%, rgb(12 12 11 / 0.72) 42%, rgb(12 12 11 / 0) 78%),
    linear-gradient(to right, rgb(12 12 11 / 0.62), rgb(12 12 11 / 0) 62%);
}
.band__caption {
  display: grid;
  justify-items: start;
  gap: var(--space-4);
  padding-block: clamp(2.5rem, 1.5rem + 4vw, 5rem);
}
.band__caption .eyebrow { margin-bottom: 0; }
.band__title { font-size: var(--fs-h2); }
.band__meta {
  max-width: 40ch;
  font-size: var(--fs-lead);
  color: var(--text);
}
.band__caption .btn { margin-top: var(--space-3); }
/* Small screens: photograph above the caption instead of behind it */
@media (max-width: 47.99em) {
  .band { display: block; min-height: 0; }
  .band__media {
    position: relative;
    inset: auto;
    aspect-ratio: 4 / 3;
    transform: none;
  }
  .band::after { display: none; }
  .band__caption { padding-block: var(--space-6) var(--space-8); }
}

/* ── Warum Mabo: sequence along a section line ── */
.why {
  isolation: isolate;
  overflow: clip;
}
.why__grid {
  display: grid;
  gap: var(--space-8);
}
.why__intro {
  display: grid;
  justify-items: start;
  gap: var(--space-5);
}
.why__intro .eyebrow { margin-bottom: 0; }
.why__intro .lead { color: var(--text-muted); }

/* A building that gains one storey for every reason (floors placed by main.js) */
.why__model {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: var(--space-4);
  width: 100%;
}
.axo--why {
  --axo-gap: 6.5cqw;
  --axo-y: 20%;
  --float: 1cqw;
  flex: none;
  width: min(68vw, 18rem);
}
.axo--why .axo__plate { transform: translateZ(calc(var(--i) * var(--gap) + var(--lift-z, 0cqw))); }
.axo--why .axo__floor { transition: transform 1s cubic-bezier(0.34, 1.4, 0.64, 1), opacity 0.6s var(--ease-out); }
.axo--why.is-building .axo__floor:not(.is-placed) { --lift-z: 18cqw; opacity: 0; }
.why__counter {
  display: none;
  align-items: baseline;
  gap: 0.75rem;
  padding-bottom: 12%;
  font-family: var(--font-serif);
  color: var(--text-muted);
}
.why__counter-current {
  font-size: clamp(3.5rem, 2rem + 3vw, 5.5rem);
  line-height: 0.9;
  color: transparent;
  -webkit-text-stroke: 1px var(--accent);
}
.why__counter-total { font-size: 1.25rem; }
@media (min-width: 64em) {
  .why__grid {
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    gap: clamp(3rem, 6vw, 7rem);
  }
  .why__intro {
    position: sticky;
    top: calc(var(--header-h) + 2rem);
    align-self: start;
  }
  .why__model { justify-content: flex-start; margin-top: var(--space-3); }
  .axo--why { width: min(17rem, 33vh); }
  .why__counter { display: flex; }
}

/* ── Contact ── */
.contact .section-head { margin-bottom: clamp(2.5rem, 1.5rem + 3vw, 4rem); }
