/* SEME - koncepcja C "Cinematic Tech", v0.33: Zespół - Human Presence.
   Kompozycja wariantu D: tekst po lewej (w siatce strony, max 1600 px), przestrzenna scena po prawej (na całą szerokość).
   Aktywna osoba to zdjęcie, pozostałe to cyfrowe postacie (obróbka Hybrid). --m (0..1) na figurze = materializacja.
   Wszystkie reguły zakresowane do .hp (sekcja) i .hf-* wewnątrz niej - bez wpływu na pozostałe sekcje. */

.hp {
  --hp-deep: #070A11;                 /* głębia sceny; krawędzie sekcji przechodzą w --ct-bg */
  position: relative;
  isolation: isolate;
  background: var(--ct-bg);
  scroll-margin-top: calc(var(--ct-header-h) - 1px);
}

/* ---------- Scena ---------- */
.hp__stage { position: relative; overflow: hidden; background: var(--hp-deep); touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.js .hp__stage { cursor: grab; }
.hp.is-dragging .hp__stage, .hp.is-dragging .hf-fig { cursor: grabbing; }
.hp__stage:focus-visible { outline: 2px solid var(--ct-focus); outline-offset: -4px; }
/* fon ładowany dopiero, gdy sekcja zbliża się do ekranu (klasa is-near z team.js) */
.hp__plate { position: absolute; inset: 0; background-repeat: no-repeat; background-size: var(--plate-w, 100%) var(--plate-h, auto); background-position: var(--plate-x, 50%) var(--plate-y, 0); }
.hp.is-near .hp__plate { background-image: url("assets/team/space-2400.webp"); }
/* krawędzie sceny przechodzą dokładnie w --ct-bg (gradient liniowy na wierzchu winiety), więc nie ma szwu z sąsiednimi sekcjami */
.hp__plate::after { content: ""; position: absolute; inset: 0; background:
  linear-gradient(to bottom, var(--ct-bg), rgb(13 17 26 / 0) 16%, rgb(13 17 26 / 0) 82%, var(--ct-bg)),
  radial-gradient(110% 85% at var(--hf-cx, 65%) 64%, transparent 40%, rgb(7 10 17 / 0.45) 78%, rgb(7 10 17 / 0.8) 100%); }
/* neutralne światło kluczowe tylko na pierwszym planie: tam stoi człowiek, nie hologram */
.hp__back { position: absolute; left: 0; top: 0; width: var(--back-w, 0); height: var(--back-h, 0); transform: translate(var(--back-x, 0), var(--back-y, 0)); border-radius: 50%; pointer-events: none;
  background: radial-gradient(closest-side, rgb(205 214 232 / calc(0.1 + var(--d-hover, 0) * 0.05)), rgb(120 150 210 / 0.05) 55%, transparent); }
.hp__figures { position: absolute; inset: 0; }
.hp__veil { position: absolute; inset: 0; pointer-events: none; z-index: 1200; background: linear-gradient(to right, rgb(9 12 19 / 0.9) 0, rgb(9 12 19 / 0.6) var(--veil, 30%), transparent calc(var(--veil, 30%) + 14%));
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 16%, #000 82%, transparent); mask-image: linear-gradient(to bottom, transparent, #000 16%, #000 82%, transparent); }
.hp__static { position: absolute; inset: 0; }
.hp__static img { width: 100%; height: 100%; object-fit: cover; object-position: 70% 100%; }

/* Figury (silnik team-engine.js) */
.hp .hf-fig { position: absolute; left: 0; top: 0; transform-origin: 50% 100%; will-change: transform, opacity; cursor: pointer; }
.hp .hf-fig.is-active { cursor: default; }
.hp .hf-fig__body { position: absolute; inset: 0; overflow: visible; will-change: filter; transition: opacity 0.6s var(--ct-ease-out); }
.hp .hf-fig.is-loading .hf-fig__body { opacity: 0; }
.hp .hf-fig__img { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; object-fit: contain; object-position: 50% 100%; pointer-events: none; -webkit-user-drag: none; }
.hp .hf-fig__fallback { position: absolute; inset: 6% 18% 0; border-radius: 40% 40% 8% 8% / 18% 18% 4% 4%; background: linear-gradient(var(--ct-surface-hl), var(--ct-surface)); display: grid; place-items: start center; padding-top: 30%; font: 800 2.5rem/1 var(--ct-font-display); color: var(--ct-text-3); }
.hp .hf-fig__tag { position: absolute; left: 50%; bottom: calc(100% + 0.6rem); transform: translate(-50%, calc((1 - var(--hover)) * 6px)) scale(calc(1 / var(--s, 1))); transform-origin: 50% 100%; white-space: nowrap; font: 600 0.8125rem/1 var(--ct-font-ui); color: #DCE8FF; padding: 0.4rem 0.6rem; border-radius: 4px; background: rgb(9 12 19 / 0.84); border: 1px solid rgb(110 158 247 / 0.45); opacity: calc(var(--hover) * (1 - var(--focus))); pointer-events: none; }
/* postać cyfrowa: ta sama geometria co zdjęcie, z marginesem na poświatę (22% po bokach, 2% u góry, 1,2% u dołu) */
.hp__holo { position: absolute; left: -22%; top: -2%; width: 144%; height: 103.2%; max-width: none; object-fit: fill; pointer-events: none; }

/* Materializacja: szeroka miękka granica idzie od stóp do głowy - poniżej człowiek, powyżej cząstki,
   które przy tym lekko się "zbierają" (skala 1,045 -> 1) i gasną */
.hp .hf-fig.is-mat .hf-fig__img {
  -webkit-mask-image: linear-gradient(to top, #000 calc(var(--m) * 140% - 40%), transparent calc(var(--m) * 140%));
          mask-image: linear-gradient(to top, #000 calc(var(--m) * 140% - 40%), transparent calc(var(--m) * 140%)); }
.hp .hf-fig.is-mat .hp__holo { transform-origin: 50% 96%; transform: scale(calc(1 + var(--m) * 0.045));
  -webkit-mask-image: linear-gradient(to top, transparent calc(var(--m) * 122% - 22%), #000 calc(var(--m) * 122% + 4%));
          mask-image: linear-gradient(to top, transparent calc(var(--m) * 122% - 22%), #000 calc(var(--m) * 122% + 4%)); }
.hp__scan { position: absolute; left: -8%; right: -8%; height: 14%; top: var(--scan-y, 100%); transform: translateY(-50%); opacity: var(--scan-o, 0); pointer-events: none;
  background: radial-gradient(60% 50% at 50% 50%, rgb(150 190 255 / 0.35), transparent 70%); }

/* Cień kontaktowy człowieka, chłodna poświata pod stopami postaci cyfrowej */
.hp .hf-fig__shadow { position: absolute; left: -22%; right: -22%; bottom: -2.2%; height: 6%; border-radius: 50%; pointer-events: none; opacity: var(--m, 1);
  background: radial-gradient(closest-side, rgb(0 0 0 / 0.72), rgb(0 0 0 / 0.3) 55%, transparent); }
.hp .hf-fig__shadow::after { content: ""; position: absolute; inset: -20% -10%; border-radius: 50%; opacity: calc((1 - var(--m, 1)) * 3);
  background: radial-gradient(closest-side, rgb(67 133 245 / 0.32), rgb(30 98 232 / 0.1) 60%, transparent); }

/* Tryb uproszczony (słabsze urządzenia, ?lite=1): bez masek i poświaty skanu, zwykłe przenikanie */
.hp.is-lite .hf-fig .hf-fig__img, .hp.is-lite .hf-fig .hp__holo { -webkit-mask-image: none !important; mask-image: none !important; transform: none !important; }
.hp.is-lite .hp__scan { display: none; }

/* Wejście sekcji: jednorazowe, grupa dojeżdża na miejsca */
.hp.is-intro .hp__figures { opacity: 0; }
.hp.is-intro.is-shown .hp__figures { opacity: 1; transition: opacity 1.1s ease; }

/* ---------- Kolumna tekstu ---------- */
.hp__eyebrow { display: inline-flex; align-items: center; gap: 0.625rem; margin: 0 0 0.625rem; font: 600 0.9375rem/1.2 var(--ct-font-ui); letter-spacing: 0.01em; color: var(--ct-accent-text); }
.hp__eyebrow::before { content: ""; width: 1.75rem; height: 2px; border-radius: 2px; background: currentColor; }
.hp__title { margin: 0; font-family: var(--ct-font-display); font-weight: 800; font-size: clamp(1.875rem, 2.9vw, 3.25rem); line-height: 1.08; letter-spacing: -0.018em; text-wrap: balance; }
.hp__title span { display: block; }

.hp__info { display: grid; }
.hp__panel { grid-area: 1 / 1; }
.js .hp__panel { visibility: hidden; }
.js .hp__panel.is-active { visibility: visible; }
html:not(.js) .hp__panel:not(:first-child) { display: none; }
.hp__panel.is-in > * { animation: hp-in 0.62s var(--ct-ease-out) both; }
.hp__panel.is-in > :nth-child(2), .hp__panel.is-in > :nth-child(3) { animation-delay: 0.05s; }
.hp__panel.is-in > :nth-child(n + 4) { animation-delay: 0.1s; }
@keyframes hp-in { from { opacity: 0; transform: translateX(calc(var(--hf-dir, 1) * 14px)); } to { opacity: 1; transform: none; } }

.hp__num { margin: 0 0 0.75rem; font: 800 clamp(2rem, 1.4vw + 1.3rem, 2.75rem)/1 var(--ct-font-display); letter-spacing: -0.03em; font-variant-numeric: tabular-nums; color: var(--ct-text); }
.hp__of { font-size: 0.36em; font-weight: 600; letter-spacing: 0.04em; color: var(--ct-text-3); vertical-align: 0.95em; }
.hp__name { margin: 0; font: 800 clamp(1.375rem, 0.7vw + 1.05rem, 1.875rem)/1.12 var(--ct-font-display); letter-spacing: -0.018em; }
.hp__role { margin: 0.375rem 0 0; font: 600 0.9375rem/1.35 var(--ct-font-ui); color: var(--ct-accent-text); }
.hp__about { margin-top: 1rem; max-width: 34em; font-size: 0.9375rem; line-height: 1.6; color: var(--ct-text-2); }
.hp__about p { margin: 0; }
.hp__about p + p { margin-top: 0.625rem; }
.hp__skills { margin: 1rem 0 0; padding-top: 0.75rem; max-width: 34em; border-top: 1px solid var(--ct-line); font-size: 0.875rem; line-height: 1.5; color: var(--ct-text); }
.hp__skills-h { display: block; margin-bottom: 0.25rem; font-size: var(--ct-small); font-weight: 600; letter-spacing: 0.01em; color: var(--ct-text-3); }

/* Sterowanie: przyciski .ct-nav jak w Realizacjach i Opiniach, skala osób jak segmenty opinii */
.hp__ctrl { display: flex; align-items: center; gap: 0.5rem; }
.hp__ctrl[hidden] { display: none; }
.hp__dots { display: flex; gap: 0.125rem; margin: 0 0.25rem; }
.hp .hf-dot { position: relative; display: inline-flex; align-items: baseline; gap: 0.5rem; min-height: 3rem; min-width: 2.75rem; padding: 1.125rem 0.375rem 0.5rem; border: 0; background: none; cursor: pointer; font: 500 0.8125rem/1 var(--ct-font-ui); letter-spacing: 0.04em; color: var(--ct-text-3); }
.hp .hf-dot::before { content: ""; position: absolute; left: 0.375rem; right: 0.375rem; top: 0.625rem; height: 3px; border-radius: 2px; background: #2E3A57; transition: background-color var(--ct-mid) var(--ct-ease-out); }
.hp .hf-dot__n { font-variant-numeric: tabular-nums; }
.hp .hf-dot__name { max-width: 0; overflow: hidden; opacity: 0; white-space: nowrap; letter-spacing: 0.01em; transition: max-width 0.5s var(--ct-ease-out), opacity 0.3s; }
.hp .hf-dot:hover { color: var(--ct-text-2); }
.hp .hf-dot:hover::before { background: var(--ct-text-3); }
.hp .hf-dot[aria-current="true"] { color: var(--ct-text); }
.hp .hf-dot[aria-current="true"]::before { background: var(--ct-accent-text); }
.hp .hf-dot[aria-current="true"] .hf-dot__name { max-width: 12ch; opacity: 1; }
.hp .hf-dot:focus-visible { outline: 2px solid var(--ct-focus); outline-offset: -2px; border-radius: 4px; }

/* ---------- Desktop: scena na całą sekcję, kolumna w siatce strony ---------- */
@media (min-width: 900px) {
  .hp { height: clamp(640px, calc(100svh - var(--ct-header-h)), 960px); overflow: hidden; }
  .hp__stage { position: absolute; inset: 0; }
  .hp__col { position: absolute; z-index: 1300; top: 0; bottom: 0; left: max(var(--ct-gutter), calc((100% - 1600px) / 2 + var(--ct-gutter))); width: min(30rem, 34vw);
    display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr auto; padding: clamp(2.75rem, 7svh, 4.5rem) 0 clamp(1.5rem, 4.5svh, 2.75rem); pointer-events: none; }
  .hp__col > * { pointer-events: auto; }
  /* nagłówek może być szerszy niż kolumna opisu (H2 w dwóch wierszach), nie poszerza jednak kolumny */
  .hp__head { width: max-content; max-width: min(40rem, 46vw); }
  /* opis osoby i sterowanie tworzą jeden blok przy dolnej krawędzi (na wysokości stóp), tytuł zostaje u góry */
  .hp__info { align-self: end; padding: 1.5rem 0 clamp(1.5rem, 3.5svh, 2.25rem); }
}
@media (min-width: 900px) and (max-height: 820px) {
  .hp__num { font-size: 2rem; margin-bottom: 0.5rem; }
  .hp__about { font-size: 0.875rem; line-height: 1.55; margin-top: 0.75rem; }
  .hp__skills { margin-top: 0.75rem; padding-top: 0.625rem; }
  .hp__info { padding: 0.75rem 0 1.25rem; }
}

/* ---------- Telefon i tablet pionowo: nagłówek, scena, opis, sterowanie ---------- */
@media (max-width: 899.98px) {
  .hp { display: flex; flex-direction: column; padding: clamp(3rem, 7svh, 4.5rem) 0 clamp(2.5rem, 6svh, 3.5rem); }
  .hp__col { display: contents; }
  .hp__head { order: -1; position: relative; z-index: 2; padding: 0 var(--ct-gutter); }
  .hp__stage { height: clamp(400px, 58svh, 640px); margin-top: 0.5rem; }
  .hp.is-near .hp__plate { background-image: url("assets/team/space-1280.webp"); }
  .hp__veil { display: none; }
  /* sterowanie tuż pod sceną (scena i przyciski w jednym kadrze), opis osoby pod nimi */
  .hp__ctrl { order: 1; padding: 0.75rem var(--ct-gutter) 0; justify-content: space-between; }
  .hp__info { order: 2; padding: 1.5rem var(--ct-gutter) 0; }
  .hp__num { font-size: 2rem; margin-bottom: 0.5rem; }
  .hp__about { max-width: 40em; }
  .hp__dots { flex: 1; justify-content: center; }
}
/* wąskie ekrany: bez imion przy skali, odcinki dzielą dostępną szerokość (3-5 osób mieści się od 320 px) */
@media (max-width: 420px) {
  .hp .hf-dot__name { display: none; }
  .hp__dots { min-width: 0; margin: 0; }
  .hp .hf-dot { flex: 1 1 0; min-width: 0; justify-content: center; padding-left: 0.125rem; padding-right: 0.125rem; }
  .hp .hf-dot::before { left: 0.25rem; right: 0.25rem; }
}

@media (prefers-reduced-motion: reduce) {
  .hp__panel.is-in > * { animation: none; }
  .hp .hf-fig__body, .hp .hf-dot::before, .hp .hf-dot__name { transition: none; }
}
