/* ==========================================================================
   KF BTP — homepage sections
   ========================================================================== */

/* ---------- Hero ---------- */
.hero {
  position: relative;
  /* fills the rounded container on first view */
  min-height: max(520px, calc(100dvh - var(--header-h) - var(--frame-gap) * 3));
  padding: 0;
  overflow: hidden;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.hero__media { position: absolute; inset: 0; z-index: -1; }
.hero__media picture { display: block; width: 100%; height: 100%; }
.hero__media img {
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: 50% 60%;
  transform: scale(1.08);
  animation: hero-zoom 2.4s var(--ease) forwards;
}
/* Darken toward a dusk mood like the reference, heavier at top (title) and bottom (copy) */
.hero__media::after {
  content: "";
  position: absolute; inset: 0;
  background:
    linear-gradient(180deg, rgba(14, 19, 22, 0.78) 0%, rgba(14, 19, 22, 0.25) 38%, rgba(14, 19, 22, 0.3) 60%, rgba(14, 19, 22, 0.86) 100%),
    linear-gradient(90deg, rgba(14, 19, 22, 0.45), transparent 60%);
}
@keyframes hero-zoom { to { transform: scale(1); } }

.hero__title-wrap {
  container-type: inline-size;
  padding: clamp(36px, 6vw, 84px) var(--edge) 0;
}
.hero__brand {
  display: block;
  font-size: 22cqw;
  line-height: 0.82;
  letter-spacing: -0.02em;
  text-align: center;
  white-space: nowrap;
  opacity: 0;
  transform: translateY(24px);
  animation: rise 1.1s 150ms var(--ease) forwards;
}
.hero__bottom {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 0 var(--edge) clamp(28px, 4vw, 56px);
  opacity: 0;
  animation: rise 1s 450ms var(--ease) forwards;
}
.hero__bottom > :first-child { flex: 1 1 auto; }
.hero__tagline { font-size: clamp(1.05rem, 0.8rem + 1vw, 1.6rem); line-height: 1.08; font-weight: 600; }
.hero__actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 22px; }
.hero__aside { flex: none; display: grid; gap: 10px; justify-items: end; text-align: right; }
@keyframes rise { to { opacity: 1; transform: none; } }

/* ---------- Services: full-photo cards, text revealed on hover ---------- */
.services__grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(12px, 1.4vw, 20px);
}
.svc { min-width: 0; }
.svc__card {
  position: relative;
  display: flex;
  aspect-ratio: 3 / 4.2;
  border-radius: var(--radius-sm);
  overflow: hidden;
  isolation: isolate;
  background: var(--card-raised);
  /* Clean clipping of the scaled photo at the rounded corners (no jagged edge while lifted) */
  clip-path: inset(0 round var(--radius-sm));
  transform: translateZ(0);
  backface-visibility: hidden;
  transition: transform 500ms var(--ease);
}
/* Border drawn ABOVE the photo, so photo edges never show through it */
.svc__card::before {
  content: "";
  position: absolute; inset: 0; z-index: 1;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px var(--line);
  pointer-events: none;
  transition: box-shadow 500ms var(--ease);
}
.svc__img {
  position: absolute; inset: 0; z-index: -2;
  width: 100%; height: 100%;
  object-fit: cover;
  filter: saturate(0.9) brightness(0.9);
  transition: transform 900ms var(--ease), filter 600ms var(--ease);
}
.svc__card::after {
  content: "";
  position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(180deg, rgba(12, 17, 20, 0.15) 0%, rgba(12, 17, 20, 0.25) 40%, rgba(12, 17, 20, 0.92) 100%);
  transition: opacity 500ms var(--ease);
}
.svc__num {
  position: absolute; top: 16px; left: 16px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(15, 20, 22, 0.55);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  box-shadow: inset 0 0 0 1px rgba(217, 196, 160, 0.35);
  color: var(--accent);
  font-size: 0.9rem;
  line-height: 1;
}
.svc__body { align-self: flex-end; display: grid; gap: 8px; padding: clamp(18px, 1.8vw, 24px); }
.svc__title { font-size: clamp(1rem, 0.9rem + 0.45vw, 1.25rem); font-weight: 700; letter-spacing: 0.01em; line-height: 1.05; }
.svc__text { color: rgba(238, 240, 238, 0.78); font-size: var(--text-sm); }
.svc__more {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--accent);
  max-height: 0;
  opacity: 0;
  transform: translateY(6px);
  transition: max-height 400ms var(--ease), opacity 400ms var(--ease), transform 400ms var(--ease);
}
.svc__more svg { width: 15px; height: 15px; }
.svc__card:hover, .svc__card:focus-visible { transform: translateY(-6px) translateZ(0); }
.svc__card:hover::before, .svc__card:focus-visible::before { box-shadow: inset 0 0 0 1px rgba(217, 196, 160, 0.55); }
.svc__card:hover .svc__img, .svc__card:focus-visible .svc__img { transform: scale(1.07) translateZ(0); filter: none; }
.svc__card:hover .svc__more, .svc__card:focus-visible .svc__more { max-height: 24px; opacity: 1; transform: none; }
/* Touch screens have no hover: always show the link */
@media (hover: none) { .svc__more { max-height: 24px; opacity: 1; transform: none; } }

/* ---------- Process (mirrors the "house plan" block) ---------- */
.process {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(28px, 5vw, 72px);
  align-items: stretch; /* the photo takes the full height of the text column */
}
.process__sub { margin-top: 14px; max-width: 44ch; color: var(--muted); font-size: clamp(1rem, 0.92rem + 0.35vw, 1.2rem); }

/* Step lists */
.steps { counter-reset: none; }
.steps__row {
  display: grid;
  grid-template-columns: 2.6rem minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 14px 4px;
  border-bottom: 1px solid var(--line);
  transition: background var(--fast), padding var(--fast) var(--ease);
}
.steps__row:last-child { border-bottom: 0; }
.steps__row:hover { padding-left: 10px; background: rgba(255, 255, 255, 0.025); }
.steps__num { color: var(--muted); font-size: var(--text-sm); font-variant-numeric: tabular-nums; }
.steps__name { font-weight: 500; }
.steps__tag { color: var(--muted); font-size: var(--text-sm); text-align: right; }

/* Free steps 1-3: highlighted block */
.steps-free {
  margin-top: clamp(24px, 3vw, 34px);
  padding: 6px 18px 4px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, rgba(217, 196, 160, 0.12), rgba(217, 196, 160, 0.04));
  box-shadow: inset 0 0 0 1px rgba(217, 196, 160, 0.28);
}
.steps-free__label {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 4px 10px;
  border-bottom: 1px solid rgba(217, 196, 160, 0.22);
  color: var(--accent);
}
.steps-free__label svg { width: 16px; height: 16px; }
.steps-free .steps__row { border-bottom-color: rgba(217, 196, 160, 0.14); }
.steps-free .steps__num { color: var(--accent); }
.steps-free .steps__tag {
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(217, 196, 160, 0.16);
  color: var(--accent);
  font-weight: 600;
}
.steps--work { margin-top: 8px; padding-inline: 18px; }

.process__note { margin-top: 26px; }

/* Photo with an overlaid "free steps" badge */
.process__media {
  position: relative;
  min-height: 420px;
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.process__media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.process__media::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(12, 17, 20, 0) 55%, rgba(12, 17, 20, 0.7) 100%);
  pointer-events: none;
}
.process__chip {
  position: absolute; top: 16px; right: 16px; z-index: 1;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(15, 20, 22, 0.6);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}
.process__badge {
  position: absolute; left: 16px; bottom: 16px; z-index: 1;
  display: flex; align-items: center; gap: 14px;
  padding: 14px 20px 14px 16px;
  border-radius: var(--radius-sm);
  background: rgba(15, 20, 22, 0.72);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  box-shadow: inset 0 0 0 1px rgba(217, 196, 160, 0.3);
}
.process__badge-num { font-size: clamp(2.4rem, 1.8rem + 2vw, 3.4rem); line-height: 1; color: var(--accent); }
.process__badge-text { display: grid; gap: 2px; }
.process__badge-text strong { font-weight: 600; }
.process__badge-text span { color: var(--muted); font-size: var(--text-sm); }

/* ---------- Materials: expanding panels (hover, focus or tap) ---------- */
.materials {
  display: flex;
  gap: clamp(8px, 1vw, 14px);
  height: clamp(380px, 38vw, 520px);
}
.material {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  border-radius: var(--radius-sm);
  overflow: hidden;
  isolation: isolate;
  cursor: pointer;
  background: var(--card-raised);
  clip-path: inset(0 round var(--radius-sm));
  transform: translateZ(0);
  transition: flex-grow 700ms var(--ease);
}
.material::before {
  content: "";
  position: absolute; inset: 0; z-index: 1;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px var(--line);
  pointer-events: none;
  transition: box-shadow 400ms var(--ease);
}
.material.is-active { flex-grow: 3.6; }
.material.is-active::before { box-shadow: inset 0 0 0 1px rgba(217, 196, 160, 0.45); }
.material img {
  position: absolute; inset: 0; z-index: -2;
  width: 100%; height: 100%;
  object-fit: cover;
  filter: saturate(0.75) brightness(0.75);
  transition: transform 900ms var(--ease), filter 600ms var(--ease);
}
.material.is-active img { filter: none; transform: scale(1.03); }
.material::after {
  content: "";
  position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(180deg, rgba(12, 17, 20, 0.1) 35%, rgba(12, 17, 20, 0.9) 100%);
}
.material__num {
  position: absolute; top: 14px; left: 14px;
  color: var(--accent);
  font-size: 0.95rem;
  line-height: 1;
}
.material__body { align-self: flex-end; width: 100%; padding: clamp(16px, 1.8vw, 24px); }
.material__body h3 { font-size: var(--text-h3); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.material__body p {
  max-width: 40ch;
  max-height: 0;
  margin-top: 0;
  opacity: 0;
  color: rgba(238, 240, 238, 0.82);
  font-size: var(--text-sm);
  transition: max-height 500ms var(--ease), opacity 400ms var(--ease), margin-top 400ms var(--ease);
}
.material.is-active .material__body p { max-height: 90px; margin-top: 8px; opacity: 1; transition-delay: 150ms; }
/* Collapsed panels: title written vertically */
.material:not(.is-active) .material__body h3 { writing-mode: vertical-rl; transform: rotate(180deg); white-space: nowrap; overflow: visible; }

/* ---------- FAQ with the visit checklist ---------- */
.faq {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(28px, 5vw, 72px);
  align-items: start;
}
.faq__sub { margin-top: 14px; max-width: 42ch; color: var(--muted); }
.prep {
  margin-top: clamp(24px, 3vw, 36px);
  padding: clamp(20px, 2.4vw, 28px);
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, rgba(217, 196, 160, 0.12), rgba(217, 196, 160, 0.04));
  box-shadow: inset 0 0 0 1px rgba(217, 196, 160, 0.28);
}
.prep__title { display: flex; align-items: center; gap: 8px; color: var(--accent); }
.prep__title svg { width: 18px; height: 18px; }
.prep__list { display: grid; gap: 10px; margin: 16px 0 20px; }
.prep__list li { display: flex; align-items: flex-start; gap: 10px; font-size: var(--text-sm); }
.prep__list svg { width: 16px; height: 16px; flex: none; margin-top: 3px; color: var(--accent); }

.faq__list { display: grid; gap: 10px; }
.faq__item {
  border-radius: var(--radius-sm);
  background: var(--card-raised);
  box-shadow: inset 0 0 0 1px var(--line);
  transition: box-shadow var(--fast);
}
.faq__item[open]:not(.is-closing) { box-shadow: inset 0 0 0 1px rgba(217, 196, 160, 0.4); }
.faq__item[open]:not(.is-closing) summary { color: var(--accent); }
/* Height/opacity are animated by main.js (initFaq); overflow hides the text while it grows */
.faq__answer { overflow: hidden; }
.faq__item summary {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 18px 20px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}
.faq__item summary::-webkit-details-marker { display: none; }
.faq__item summary:hover { color: var(--accent); }
.faq__item summary svg {
  width: 18px; height: 18px; flex: none;
  color: var(--accent);
  transition: transform 300ms var(--ease);
}
.faq__item[open]:not(.is-closing) summary svg { transform: rotate(45deg); }
.faq__item p { padding: 0 20px 18px; color: var(--muted); font-size: var(--text-sm); }
.faq__item p a { color: var(--text); text-decoration: underline; text-decoration-color: rgba(217, 196, 160, 0.6); text-underline-offset: 3px; }
.faq__item p a:hover { color: var(--accent); }

/* Numbered questions + highlighted open item */
.faq__num { flex: none; min-width: 2.2rem; color: var(--accent); font-size: 0.95rem; line-height: 1; }
.faq__q { flex: 1; }
.faq__item { position: relative; overflow: hidden; }
.faq__item::before {
  content: "";
  position: absolute; inset: 0 auto 0 0; width: 3px;
  background: var(--accent);
  transform: scaleY(0); transform-origin: top;
  transition: transform 400ms var(--ease);
}
.faq__item[open]:not(.is-closing)::before { transform: scaleY(1); }
.faq__item[open]:not(.is-closing) { background: linear-gradient(90deg, rgba(217, 196, 160, 0.08), var(--card-raised) 60%); }
.faq__item summary { justify-content: flex-start; }
.faq__item summary svg { margin-left: auto; }
.faq__item p { padding-left: calc(20px + 2.2rem + 16px); }

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .services__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .faq { grid-template-columns: minmax(0, 1fr); }
  .process { grid-template-columns: 1fr; }
  .process__media { order: -1; min-height: 0; aspect-ratio: 16 / 11; }
  .hero__bottom { flex-direction: column; align-items: flex-start; }
  .hero__aside { justify-items: start; text-align: left; }
  .hero__free { justify-content: flex-start; }
  /* Materials: stacked cards with text always visible */
  .materials { flex-direction: column; height: auto; }
  .material { flex: none; min-height: 200px; }
  .material.is-active { flex: none; }
  .material img { filter: none; }
  .material .material__body p { max-height: none; margin-top: 8px; opacity: 1; }
  .material:not(.is-active) .material__body h3 { writing-mode: horizontal-tb; transform: none; }
}
@media (max-width: 760px) {
  /* leave room for the fixed action bar (48px buttons + 12px padding + 6px gap) */
  .hero { min-height: max(480px, calc(100dvh - var(--header-h) - var(--frame-gap) * 3 - 66px)); }
}
@media (max-width: 640px) {
  .steps-free { padding-inline: 12px; }
  .steps--work { padding-inline: 12px; }
  .steps__row { grid-template-columns: 2.2rem minmax(0, 1fr) auto; }
  .process__badge { left: 12px; bottom: 12px; padding: 10px 14px 10px 12px; gap: 10px; }
  .process__chip { top: 12px; right: 12px; }
  .hero__media img { object-position: 50% 45%; } /* vertical crop: villa in the centre */
  .hero__aside { width: 100%; }
  .hero__aside > p { display: none; }
  .hero__actions .btn { flex: 1 1 100%; }
  .faq__item p { padding-left: 20px; }
  /* Services become a horizontal swipe strip */
  .services__grid {
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: 78%;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    margin-inline: calc(var(--card-pad) * -1);
    padding: 0 var(--card-pad) 6px;
    scroll-padding-inline: var(--card-pad);
    scrollbar-width: none;
  }
  .services__grid::-webkit-scrollbar { display: none; }
  .svc { scroll-snap-align: start; }
}
