/* House renovation scroll section – all selectors are scoped to .hr */
.hr {
  --hr-scroll: 620vh;                 /* scroll distance of the whole sequence */
  --hr-bg: #101214;
  --hr-fg: #f4f2ee;
  --hr-muted: rgba(244, 242, 238, 0.68);
  --hr-accent: #e8b25a;
  --hr-panel: rgba(16, 18, 20, 0.58);
  --hr-font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  position: relative;
  height: var(--hr-scroll);
  background: var(--hr-bg);
  color: var(--hr-fg);
  font-family: var(--hr-font);
  isolation: isolate;
}
.hr *, .hr *::before, .hr *::after { box-sizing: border-box; }

.hr__sticky {
  position: sticky;
  top: var(--hr-offset, 0px);           /* set --hr-offset to the height of a fixed site header */
  height: calc(100vh - var(--hr-offset, 0px));
  height: calc(100svh - var(--hr-offset, 0px));
  overflow: hidden;
  display: grid;
  grid-template-rows: 1fr;
}

.hr__media {
  position: relative;
  grid-area: 1 / 1;
  min-height: 0;
  background: var(--hr-bg);
  overflow: hidden;
}
.hr__canvas, .hr__poster {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
.hr__poster {
  object-fit: cover;
  object-position: 47% 50%;
  transition: opacity .4s ease;
  pointer-events: none;
}
.hr[data-hr-set="portrait"] .hr__poster { object-fit: contain; }

.hr__loader {
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 2px;
  background: rgba(255, 255, 255, .08);
  transition: opacity .6s ease .4s;
  z-index: 3;
}
.hr__loader span {
  display: block;
  height: 100%;
  background: var(--hr-accent);
  transform-origin: 0 50%;
  transform: scaleX(0);
  transition: transform .2s linear;
}
.hr--loaded .hr__loader { opacity: 0; }

/* ------------------------------------------------------------ overlay UI (desktop) */
.hr__ui {
  grid-area: 1 / 1;
  position: relative;
  z-index: 2;
  pointer-events: none;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto 1fr auto;
  padding: clamp(18px, 3vw, 44px);
  background:
    linear-gradient(180deg, rgba(8, 10, 12, .55) 0%, rgba(8, 10, 12, 0) 22%),
    linear-gradient(0deg, rgba(8, 10, 12, .62) 0%, rgba(8, 10, 12, 0) 34%);
}
.hr__head { max-width: 34rem; text-shadow: 0 1px 12px rgba(0, 0, 0, .35); }
.hr__eyebrow {
  margin: 0 0 .4rem;
  font-size: .78rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--hr-accent);
  font-weight: 600;
}
.hr__title {
  margin: 0;
  font-size: clamp(1.5rem, 2.6vw, 2.5rem);
  line-height: 1.12;
  font-weight: 650;
  letter-spacing: -.01em;
}

.hr__bottom {
  grid-row: 3;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "caption counter" "steps steps";
  align-items: end;
  gap: 14px 24px;
}
.hr__caption {
  grid-area: caption;
  justify-self: start;
  max-width: 30rem;
  padding: 14px 18px;
  border-radius: 14px;
  background: var(--hr-panel);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, .08);
  font-size: .9rem;
  line-height: 1.45;
  color: var(--hr-muted);
}
.hr__caption:empty { display: none; }
.hr__caption strong { display: block; color: var(--hr-fg); font-size: 1.05rem; font-weight: 600; margin-bottom: .2rem; }
.hr__counter {
  grid-area: counter;
  font-variant-numeric: tabular-nums;
  font-size: .78rem;
  color: var(--hr-muted);
  letter-spacing: .06em;
  text-shadow: 0 1px 8px rgba(0, 0, 0, .5);
}
/* segmented timeline: one segment per step, width ~ step length, fill = progress inside step */
.hr__steps {
  grid-area: steps;
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 6px;
}
.hr__step {
  position: relative;
  flex: var(--grow, 1) 1 0;
  min-width: 4.8rem;
  padding-top: 12px;
  color: var(--hr-muted);
  font-size: .82rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color .3s ease;
  text-shadow: 0 1px 8px rgba(0, 0, 0, .45);
}
.hr__step::before, .hr__step::after {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 3px;
  border-radius: 3px;
  background: rgba(255, 255, 255, .24);
}
.hr__step::after {
  background: var(--hr-accent);
  transform-origin: 0 50%;
  transform: scaleX(var(--fill, 0));
}
.hr__step-num { font-variant-numeric: tabular-nums; opacity: .75; margin-right: .35rem; }
.hr__step-label { font-weight: 550; }
.hr__step-text { display: none; }
.hr__step.is-done { color: rgba(244, 242, 238, .85); }
.hr__step.is-active { color: var(--hr-fg); }
.hr__step.is-active .hr__step-num { color: var(--hr-accent); opacity: 1; }
.hr__track { display: none; }
.hr__labels {
  display: flex;
  justify-content: space-between;
  font-size: .72rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--hr-muted);
  margin-bottom: .45rem;
}
.hr__progress {
  height: 3px;
  border-radius: 3px;
  background: rgba(255, 255, 255, .18);
  overflow: hidden;
}
.hr__bar {
  display: block;
  height: 100%;
  background: var(--hr-accent);
  transform-origin: 0 50%;
  transform: scaleX(0);
}

.hr--error .hr__media::after {
  content: "Animation konnte nicht geladen werden.";
  position: absolute; inset: auto 0 45% 0; text-align: center; color: var(--hr-muted);
}

/* ------------------------------------------------------------ portrait / phone layout */
@media (max-aspect-ratio: 1/1), (max-width: 760px) {
  .hr { --hr-scroll: 560vh; }
  .hr__sticky { grid-template-rows: auto minmax(0, 1fr) auto; }
  .hr__media { grid-area: 2 / 1; }
  .hr__ui { display: contents; }
  .hr__head {
    grid-row: 1;
    padding: max(14px, env(safe-area-inset-top)) 18px 10px;
    max-width: none;
    text-shadow: none;
  }
  .hr__title { font-size: clamp(1.25rem, 5.6vw, 1.7rem); }
  .hr__bottom {
    grid-row: 3;
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "steps" "caption" "track";
    gap: .6rem;
    padding: 12px 0 max(14px, env(safe-area-inset-bottom));
    pointer-events: auto;
  }
  .hr__steps {
    gap: .4rem;
    overflow-x: auto;
    scrollbar-width: none;
    padding: 0 18px;
    scroll-snap-type: x proximity;
  }
  .hr__steps::-webkit-scrollbar { display: none; }
  .hr__step {
    flex: 0 0 auto;
    min-width: 0;
    padding: .38rem .75rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, .14);
    scroll-snap-align: center;
    text-shadow: none;
    transition: color .25s ease, background-color .25s ease, border-color .25s ease;
  }
  .hr__step::before, .hr__step::after { display: none; }
  .hr__step.is-active { background: var(--hr-fg); color: #14161a; border-color: transparent; }
  .hr__step.is-active .hr__step-num { color: #9a6a16; }
  .hr__caption {
    justify-self: stretch;
    max-width: none;
    min-height: 5.2em;
    margin: 0 18px;
    padding: 0;
    background: none;
    border: 0;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
  .hr__caption:empty { display: block; }
  .hr__track { grid-area: track; display: block; padding: 0 18px; }
  .hr__counter { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .hr__bar, .hr__loader span, .hr__poster { transition: none; }
}
