/* Home page only. All text, links and photographs have a static baseline. */
.project-gallery { scroll-margin-top: 6rem; }
.project-cards {
  display: grid;
  gap: clamp(1rem, 3vw, 2.25rem);
  isolation: isolate;
  margin-block-start: 1.75rem;
}
.project-card {
  --focus-y: 50%;
  display: grid;
  position: relative;
  isolation: isolate;
  grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr);
  min-height: clamp(22rem, 57svh, 36rem);
  overflow: hidden;
  border-radius: clamp(1rem, 2vw, 1.65rem);
  color: #fffaf0;
  background: #19392e;
  text-decoration: none;
  box-shadow: 0 1px 0 #102e2826, 0 15px 36px -28px #102e2870;
}
.project-card:nth-child(even) {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.7fr);
  background: #e8e9df;
  color: #17372d;
}
.project-photo { position: relative; overflow: hidden; min-height: 100%; }
.project-photo img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% var(--focus-y);
}
.project-detail {
  display: flex;
  flex-direction: column;
  justify-content: end;
  padding: clamp(1.4rem, 3.3vw, 3.3rem);
}
.project-detail h3 {
  color: inherit;
  margin: 0 0 .55rem;
  font: 400 clamp(1.65rem, 3.1vw, 3.15rem)/1.07 "Iowan Old Style", Georgia, serif;
  letter-spacing: -.035em;
  overflow-wrap: anywhere;
  hyphens: auto;
}
.project-detail p { margin: 0; font-size: 1rem; line-height: 1.48; color: inherit; max-width: 34ch; }
.project-card:nth-child(even) .project-photo { order: 2; }
.scene-pergola { --focus-y: 36%; }
.scene-sitzplatzueberdachung { --focus-y: 31%; }
.scene-gartenhaus { --focus-y: 39%; }
.scene-pool { --focus-y: 44%; }
.project-card:focus-visible { outline: 3px solid #a26b20; outline-offset: 3px; }
@media (hover:hover) {
  .project-card:hover h3 { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .16em; }
}
@media (max-width: 760px) {
  .project-card, .project-card:nth-child(even) {
    grid-template-columns: 100%;
    min-height: clamp(22rem, 60svh, 34rem);
    background: #24382f;
    color: white;
  }
  .project-card .project-photo, .project-card .project-detail { grid-area: 1/1; }
  .project-card:nth-child(even) .project-photo { order: 0; }
  .project-card .project-photo::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(0deg, #081811f2, #081811c2 17%, #08181110 65%, transparent);
  }
  .project-detail { z-index: 1; padding: clamp(1.15rem, 5vw, 2.2rem); }
  .project-detail h3 { font-size: clamp(1.8rem, 6.5vw, 2.6rem); }
}
@media (prefers-reduced-motion: no-preference) and (min-height: 620px) {
  .project-card { position: sticky; top: clamp(5rem, 11vh, 7rem); }
  /* Keyboard focus must never move to a card covered by its successor. */
  .project-cards:has(:focus-visible) .project-card { position: relative; top: auto; }
}

/* Individual tracks follow existing sections. The form itself stays still. */
[data-motion="left"] { --travel-x: calc(-1 * min(3vw, var(--gutter), 2rem)); }
[data-motion="right"] { --travel-x: min(3vw, var(--gutter), 2rem); }
[data-motion="rise"] { --travel-y: 1.35rem; }
.grid > [data-motion]:nth-child(3n + 2), .steps > [data-motion]:nth-child(3n + 2) { --finish: 78%; }
.grid > [data-motion]:nth-child(3n), .steps > [data-motion]:nth-child(3n) { --finish: 94%; }
.trustbar[data-motion] { position: relative; }
.trustbar[data-motion]::after {
  content: "";
  position: absolute;
  inset: auto var(--gutter) 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, #699077 20%, #b08d51 78%, transparent);
  transform-origin: left;
  pointer-events: none;
}
@keyframes bb-arrive {
  from { translate: var(--travel-x, 0) var(--travel-y, 0); opacity: .72; }
  to   { translate: 0 0; opacity: 1; }
}
@keyframes bb-open-photo {
  from { clip-path: inset(0 9% 0 0 round 1rem); }
  to   { clip-path: inset(0 0 0 0 round 1rem); }
}
@keyframes bb-draw { from { scale: .08 1; } to { scale: 1 1; } }
@keyframes bb-photo-settle {
  from { transform: scale(1.075) translateX(var(--pan, .8%)); }
  to   { transform: scale(1); }
}
@keyframes bb-hero-depth {
  from { transform: scale(1); }
  to   { transform: scale(1.055); }
}
@media (prefers-reduced-motion: no-preference) {
  @supports (animation-timeline: view()) and (animation-range: entry 0% entry 100%) {
    :is([data-motion="left"], [data-motion="right"], [data-motion="rise"]),
    [data-motion="crop"] {
      animation: bb-arrive auto linear both;
      animation-timeline: view();
      animation-range: entry 0% entry var(--finish, 65%);
    }
    [data-motion="crop"] { animation-name: bb-open-photo; }
    [data-motion="rule"] { view-timeline-name: --trust-row; }
    [data-motion="rule"]::after {
      animation: bb-draw auto linear both;
      animation-timeline: --trust-row;
      animation-range: entry 0% entry 95%;
    }
    .project-stage { view-timeline-name: --intro; overflow: clip; }
    .project-visual {
      animation: bb-hero-depth auto linear both;
      animation-timeline: --intro;
      animation-range: exit 0% exit 90%;
    }
    .project-card { view-timeline-name: --project; }
    .project-card:nth-child(even) { --pan: -.8%; }
    .project-photo img {
      animation: bb-photo-settle auto linear both;
      animation-timeline: --project;
      animation-range: entry 0% entry 90%;
    }
  }
  /* Older browsers trigger the same entry effects once on intersection. */
  [data-motion].motion-enter { animation: bb-arrive .55s ease-out backwards; }
  [data-motion="crop"].motion-enter { animation-name: bb-open-photo; }
  [data-motion="rule"].motion-enter { animation: none; }
  [data-motion="rule"].motion-enter::after { animation: bb-draw .6s ease-out backwards; }
  .project-card.motion-enter .project-photo img { animation: bb-photo-settle .7s ease-out backwards; }
  [data-motion]:focus-within { animation: none; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .steps.live .step::after { transition: none; }
}

.project-skip {
  display: inline-block;
  min-height: 44px;
  padding-block: .6rem;
  text-decoration: underline;
  text-underline-offset: .2em;
}
.project-controls { display: none; }
/* On touch screens the photograph carries the movement. Keep reading and
   input positions fixed, including when a visitor scrolls in reverse. */
@media (max-width: 760px), (pointer: coarse) and (max-width: 1024px) {
  main [data-motion]:is([data-motion="left"], [data-motion="right"], [data-motion="rise"]) {
    animation: none;
    translate: none;
    opacity: 1;
  }
  .project-gallery .wrap > h2 { margin-block-end: .25rem; }
  .project-gallery .project-cards { margin-block-start: .6rem; }
}
.project-track.is-pinned {
  --pin-top: calc(66px + .5rem);
  margin-top: .6rem;
  position: relative;
  --stage-height: clamp(15rem, calc(100svh - var(--pin-top) - 5.75rem), 42rem);
  height: calc(var(--stage-height) + var(--travel, 0px));
}
.project-track.is-pinned .project-cards {
  display: block;
  position: sticky;
  top: var(--pin-top);
  height: var(--stage-height);
  margin: 0;
  overflow: hidden;
  isolation: isolate;
  border-radius: 1.25rem;
  background: #213b30;
}
.project-track.is-pinned .project-card {
  display: block;
  position: absolute;
  inset: 0;
  min-height: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: white;
  box-shadow: none;
  visibility: hidden;
  pointer-events: none;
}
.project-track.is-pinned .project-card[data-layer] { visibility: visible; }
.project-track.is-pinned .project-card[data-layer="incoming"] { z-index: 2; }
.project-track.is-pinned .project-card[data-current] { pointer-events: auto; }
.project-track.is-pinned .project-photo {
  position: absolute;
  inset: 0;
  animation: none;
}
.project-track.is-pinned .project-photo::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, #071811fa, #071811b8 20%, transparent 56%);
}
.project-track.is-pinned .project-photo img { animation: none; transform: none; }
.project-track.is-pinned .project-card[data-layer="incoming"] .project-photo {
  clip-path: inset(var(--wipe,100%) 0 0);
}
.project-track.is-pinned .project-detail {
  position: absolute;
  inset: auto 0 0;
  display: block;
  padding: 1.4rem;
  visibility: hidden;
}
/* Both captions use a separate dark band throughout the wipe. The inactive
   photo never covers the active caption as the two scene layers overlap. */
.project-caption-overlay {
  display: grid;
  grid-template-columns: minmax(0,1fr);
  position: absolute;
  z-index: 4;
  inset: auto 0 0;
  padding: 3rem 1.35rem 1.4rem;
  pointer-events: none;
  color: #fff;
  background: linear-gradient(0deg, #081711f5, #081711c9 53%, transparent);
}
.project-caption-overlay > * { visibility: hidden; }
.project-caption-overlay > .is-current { visibility: visible; }
.project-caption-overlay h3 { grid-area: 1/1; align-self: end; margin: 0 0 .35rem; color: inherit; font: 400 clamp(1.6rem, 7vw, 2.55rem)/1.06 Georgia, serif; overflow-wrap: anywhere; hyphens: auto; }
.project-caption-overlay p { grid-area: 2/1; margin: 0; font-size: 1rem; line-height: 1.38; }
.project-controls {
  position: absolute;
  z-index: 5;
  left: .8rem;
  top: .8rem;
  align-items: center;
  color: white;
  background: #10281ff0;
  border: 1px solid #ffffff54;
  border-radius: 2rem;
  font-variant-numeric: tabular-nums;
}
.is-pinned .project-controls { display: flex; }
.project-controls button {
  appearance: none;
  height: 44px; width: 44px;
  color: inherit; background: none; border: none; border-radius: 50%;
  font: 1.45rem/1 system-ui; cursor: pointer;
}
.project-controls button[aria-disabled="true"] { opacity: .45; }
.project-controls span { min-width: 3.2rem; text-align: center; font: 600 .9rem/1 var(--font); }
.project-controls button:focus-visible { outline: 2px solid white; outline-offset: -4px; }
.project-track.is-pinned .project-card:focus-visible { outline: 3px solid #fff; outline-offset: -4px; z-index: 3; }
@media (max-width: 600px) {
  .steps { position: relative; padding-inline-start: .9rem; }
  .steps::before, .steps::after {
    content: "";
    position: absolute; inset: .65rem auto .65rem 0; width: 3px;
    border-radius: 3px; background: #d8ded8; pointer-events: none;
  }
  .steps::after { background: #34724f; transform-origin: top; }
  @supports (animation-timeline: view()) and (animation-range: entry 0% exit 100%) {
    @media (prefers-reduced-motion: no-preference) {
      .steps { view-timeline-name: --procedure; }
      .steps::after {
        animation: bb-procedure auto linear both;
        animation-timeline: --procedure;
        animation-range: entry 38% exit 62%;
      }
    }
  }
}
@keyframes bb-procedure { from { scale: 1 0; } to { scale: 1 1; } }

/* Clip sideways entrances at the section edge without capturing vertical swipes. */
.price-section { overflow-x: clip; scroll-margin-top: 5rem; }
.procedure { position: relative; scroll-margin-top: 6.5rem; }
@media (prefers-reduced-motion: no-preference) {
  .price-list.has-motion > .card {
    transform: translateX(var(--price-offset, 0px));
  }
  .price-list.has-motion > .card:focus-within { transform: none; }

  .procedure.has-motion .step {
    transition: transform .24s ease-out, border-color .24s, box-shadow .24s;
  }
  .procedure.has-motion .step.is-current {
    transform: translateY(-5px);
    border-color: #52866c;
    box-shadow: 0 8px 18px -11px #23583fd4;
  }
  .procedure.has-motion .step::after {
    transform: scaleX(0);
    transition: transform .35s ease-out;
  }
  .procedure.has-motion .step:is(.is-current, .is-past)::after { transform: scaleX(1); }
  .procedure.has-motion .step.is-current::before { color: #17613e; }
  @media (max-width: 600px) {
    .procedure.has-motion::after {
      animation: none;
      scale: 1 var(--procedure-fill, 0);
    }
  }
}
