/* pitch-what.css — екран 01 «Що це»: шість вікон → один рядок. Префікс pw-. */

#p-what {
  --pt-glow-x: 68%;
  --pt-glow-y: 62%;
}
/* високий екран — блок; Chrome уже центрує й блоки за align-content: липке нутро має стояти згори */
#p-what[style*='--pt-len'] {
  align-content: normal;
}

/* ── Сцена: проєктний розмір, масштаб ставить JS ─────────────────────────── */
.pw-visual {
  perspective: 1500px;
  perspective-origin: 50% 40%;
}
.pw-stage {
  position: absolute;
  left: 0;
  top: 0;
  transform-origin: 0 0;
  transform-style: preserve-3d;
}
.pw-tilt {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transition: transform 900ms var(--ease-out);
}

/* ── Вікно старого світу ─────────────────────────────────────────────────── */
.pw-win {
  position: absolute;
  left: 0;
  top: 0;
  width: 212px;
  height: 146px;
  transform-style: preserve-3d;
  will-change: transform;
}
.pw-win-fill {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-rows: auto 1fr;
  border-radius: var(--r-card);
  background: linear-gradient(180deg, var(--raised), var(--surface) 46%);
  box-shadow:
    var(--sh-sheet),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  overflow: hidden;
  will-change: opacity;
}
.pw-win-bar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 13px 9px;
  background: var(--frame);
  box-shadow: inset 0 -1px 0 var(--line);
  white-space: nowrap;
}
.pw-win-bar b {
  position: relative;
  padding-left: 13px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink-1);
}
.pw-win-bar b::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  width: 6px;
  height: 6px;
  margin-top: -3px;
  border-radius: 50%;
  background: var(--tone);
  box-shadow: 0 0 10px var(--tone);
}
.pw-win-bar span {
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 11px;
  color: var(--ink-3);
}
.pw-win-body {
  position: relative;
  min-height: 0;
  padding: 11px 13px 12px;
}

/* контур, що лишається, коли вікно віддало суть */
.pw-win-edge {
  position: absolute;
  inset: 0;
  border-radius: var(--r-card);
  border: 1.5px solid color-mix(in srgb, var(--tone) 38%, var(--line-2));
  background: linear-gradient(180deg, color-mix(in srgb, var(--tone) 7%, var(--canvas)), var(--void) 80%);
  opacity: 0;
  will-change: opacity;
}
.pw-win-edge span {
  position: absolute;
  left: 13px;
  top: 10px;
  font-size: 15px;
  font-family: var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--tone-ink) 55%, var(--ink-4));
}

/* мініатюри */
.pw-mail {
  display: grid;
  gap: 7px;
}
.pw-mail-row {
  display: grid;
  grid-template-columns: 8px 1fr;
  grid-template-rows: auto auto;
  gap: 4px 8px;
  align-items: center;
}
.pw-mail-row b {
  grid-row: span 2;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--fill-3);
}
.pw-mail-row s {
  height: 5px;
  width: 78%;
  border-radius: 3px;
  background: var(--fill-2);
}
.pw-mail-row.is-hot b {
  background: var(--crimson);
}
.pw-mail-row.is-hot s {
  background: var(--fill-3);
}
.pw-mail-row em {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  justify-self: start;
  padding: 2px 7px 2px 5px;
  border-radius: var(--r-xs);
  background: color-mix(in srgb, var(--crimson) 16%, transparent);
  color: var(--crimson-ink);
  font-size: 11px;
  font-style: normal;
  line-height: 1.3;
}
.pw-mail-row em u {
  width: 6px;
  height: 11px;
  border: 1.5px solid currentColor;
  border-radius: 4px;
  transform: rotate(35deg);
}

.pw-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr 1fr 0.8fr;
  grid-auto-rows: 1fr;
  height: 100%;
  border-radius: 4px;
  background: var(--line);
  gap: 1px;
  overflow: hidden;
}
.pw-grid i {
  background: var(--surface);
  position: relative;
}
.pw-grid i::after {
  content: '';
  position: absolute;
  left: 5px;
  right: 30%;
  top: 50%;
  height: 4px;
  margin-top: -2px;
  border-radius: 2px;
  background: var(--fill-2);
}
.pw-grid i.is-hot {
  background: color-mix(in srgb, var(--cobalt) 16%, var(--surface));
}
.pw-grid i.is-hot::after {
  background: color-mix(in srgb, var(--cobalt) 60%, var(--fill-3));
}

.pw-inv {
  display: grid;
  place-items: center;
  height: 100%;
}
.pw-inv-sheet {
  display: grid;
  gap: 5px;
  width: 112px;
  padding: 9px 11px;
  border-radius: 4px;
  background: var(--paper);
  box-shadow: var(--sh-pop);
  transform: rotate(-2deg);
}
.pw-inv-sheet i {
  height: 4px;
  border-radius: 2px;
  background: var(--paper-line);
}
.pw-inv-sheet .pw-inv-h {
  width: 46%;
  height: 5px;
  background: var(--raspberry);
}
.pw-inv-sheet .is-short {
  width: 64%;
}
.pw-inv-sheet b {
  justify-self: end;
  font-size: 12px;
  font-weight: 650;
  color: var(--paper-ink);
}

.pw-form {
  display: grid;
  gap: 5px;
}
.pw-form-l {
  width: 34%;
  height: 4px;
  border-radius: 2px;
  background: var(--fill-3);
}
.pw-form-in {
  height: 13px;
  border-radius: 4px;
  box-shadow: inset 0 0 0 1px var(--line-2);
  background: var(--sunken);
}
.pw-form-btn {
  justify-self: end;
  width: 56px;
  height: 13px;
  border-radius: 4px;
  background: color-mix(in srgb, var(--petrol) 62%, var(--surface));
}

.pw-bank {
  display: grid;
  gap: 6px;
}
.pw-bank-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 6px;
  box-shadow: inset 0 -1px 0 var(--line);
}
.pw-bank-row b {
  width: 52%;
  height: 5px;
  border-radius: 3px;
  background: var(--fill-2);
}
.pw-bank-row s {
  width: 20%;
  height: 5px;
  border-radius: 3px;
  background: var(--fill-3);
}
.pw-bank-row.is-hot s {
  background: color-mix(in srgb, var(--emerald) 70%, var(--fill-3));
}

.pw-chat {
  display: grid;
  gap: 8px;
  align-content: center;
  height: 100%;
}
.pw-bubble {
  justify-self: start;
  max-width: 86%;
  padding: 7px 11px;
  border-radius: 13px 13px 13px 4px;
  background: var(--fill-2);
  color: var(--ink-1);
  font-size: 13px;
  line-height: 1.25;
}
.pw-bubble.is-me {
  justify-self: end;
  display: inline-flex;
  gap: 4px;
  padding: 9px 11px;
  border-radius: 13px 13px 4px 13px;
  background: color-mix(in srgb, var(--slate) 34%, var(--fill-1));
}
.pw-bubble.is-me i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--ink-3);
}

/* ── Суть, що летить у рядок ─────────────────────────────────────────────── */
.pw-chip {
  position: absolute;
  left: 0;
  top: 0;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--tone);
  box-shadow:
    0 0 0 3px color-mix(in srgb, var(--tone) 26%, transparent),
    0 0 22px 4px color-mix(in srgb, var(--tone) 70%, transparent);
  opacity: 0;
  pointer-events: none;
  will-change: transform, opacity;
}

/* ── Рядок ───────────────────────────────────────────────────────────────── */
.pw-rowwrap {
  position: absolute;
  left: 0;
  right: 0;
  top: 404px;
  transform: translateZ(40px);
}
.pw-rowlabel {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 12px 2px;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-4);
  transition: color 700ms var(--ease-out);
}
.pw-rowlabel i {
  width: 22px;
  height: 1px;
  background: currentColor;
}
.pw-done .pw-rowlabel {
  color: var(--accent-ink);
}
.pw-row {
  position: relative;
  display: grid;
  grid-template-columns: 4px 1fr;
  grid-template-rows: auto auto;
  border-radius: var(--r-card);
  background: var(--surface);
  box-shadow: var(--sh-window);
  overflow: hidden;
}
.pw-row::before {
  /* обрис-«пусте місце», доки рядок не зібрався */
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px var(--line-2);
  pointer-events: none;
}
.pw-row-glow {
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  box-shadow:
    inset 0 0 0 1px color-mix(in srgb, var(--accent) 60%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
  background: radial-gradient(70% 140% at 30% 0%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 70%);
  opacity: 0;
  transition: opacity 900ms var(--ease-out);
  pointer-events: none;
}
.pw-done .pw-row-glow {
  opacity: 1;
}
.pw-row-bar {
  grid-row: span 2;
  background: var(--fill-2);
  transition: background 700ms var(--ease-out);
}
.pw-done .pw-row-bar {
  background: linear-gradient(180deg, var(--accent), var(--accent-deep));
}
/* сяйво навколо готового рядка — окремий шар, дихає лише в кадрі */
.pw-rowwrap::after {
  content: '';
  position: absolute;
  left: 4%;
  right: 4%;
  bottom: -14px;
  height: 70px;
  border-radius: 50%;
  background: var(--accent-glow);
  filter: blur(28px);
  opacity: 0;
  z-index: -1;
  transition: opacity 1200ms var(--ease-out);
}
.pw-done .pw-rowwrap::after {
  opacity: 0.9;
}
.pw-done.pw-live .pw-rowwrap::after {
  animation: pw-breathe 5.5s var(--ease-io) 1.2s infinite alternate;
}
@keyframes pw-breathe {
  from {
    opacity: 0.9;
  }
  to {
    opacity: 0.45;
  }
}

.pw-row-main {
  display: grid;
  grid-template-columns: 1.15fr 1.45fr 1.25fr 1.2fr;
  align-items: center;
  gap: 18px;
  padding: 17px 22px 15px 20px;
}
.pw-f {
  position: relative;
  min-width: 0;
  white-space: nowrap;
  font-size: 16px;
  color: var(--ink-2);
}
.pw-f::before {
  /* заглушка поля, доки його не принесли */
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  width: 72%;
  height: 7px;
  margin-top: -3px;
  border-radius: 4px;
  background: var(--fill-2);
  transition: opacity 400ms var(--ease-out);
}
.pw-f > span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0;
  transform: translate3d(0, 8px, 0);
  transition:
    opacity 600ms var(--ease-out),
    transform 700ms var(--ease-out);
}
.pw-f.is-in::before {
  opacity: 0;
}
.pw-f.is-in > span {
  opacity: 1;
  transform: none;
}
.pw-f-client {
  font-weight: 600;
  color: var(--ink-1);
}
.pw-f-order {
  font-size: 14px;
  color: var(--ink-2);
}
.pw-f-amt {
  justify-self: end;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink-1);
}
.pw-f-amt::before {
  left: auto;
  right: 0;
}

.pw-stages {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 6px;
  padding: 0 20px 16px;
}
.pw-st {
  position: relative;
  display: flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  padding: 0 10px;
  border-radius: var(--r-md);
  background: var(--sunken);
  color: var(--ink-4);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
}
.pw-st::before {
  content: '';
  position: absolute;
  inset: 0;
  background: color-mix(in srgb, var(--tone) 17%, transparent);
  opacity: 0;
  transition: opacity 600ms var(--ease-out);
}
.pw-st i {
  position: relative;
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1.5px var(--fill-3);
}
.pw-st i::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--tone);
  box-shadow: 0 0 10px var(--tone);
  opacity: 0;
  transform: scale(0.2);
  transition:
    opacity 500ms var(--ease-out),
    transform 700ms var(--ease-back);
}
.pw-st > span {
  position: relative;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 600ms var(--ease-out);
}
.pw-st.is-lit::before {
  opacity: 1;
}
.pw-st.is-lit i::after {
  opacity: 1;
  transform: none;
}
.pw-st.is-lit > span {
  color: var(--tone-ink);
}

/* ── Опори — наприкінці ──────────────────────────────────────────────────── */
.pw:not(.pw-done) .pw-points [data-rise] {
  opacity: 0;
  transform: translate3d(0, 14px, 0);
  transition-duration: 300ms;
  transition-delay: 0ms;
}
.pw-points .pt-points {
  margin-top: clamp(18px, 3.4vh, 36px);
}
.pw-points .pt-points > li {
  padding: 11px 0;
}

/* ── Широкий, але невисокий екран ────────────────────────────────────────── */
@media (max-height: 800px) {
  html[data-layout='wide'] #p-what .pt-stick {
    padding-top: calc(var(--nav-h) + 22px);
    padding-bottom: 22px;
  }
  html[data-layout='wide'] #p-what .pt-lead {
    font-size: 1rem;
    margin-top: 14px;
  }
  html[data-layout='wide'] #p-what .pw-points .pt-points > li {
    padding: 8px 0;
  }
  html[data-layout='wide'] #p-what .pw-points .pt-points span {
    font-size: 0.875rem;
  }
}

/* ── Вузький екран: рядок стає карткою ───────────────────────────────────── */
html[data-layout='compact'] .pw-win {
  width: 168px;
  height: 112px;
}
html[data-layout='compact'] .pw-win-bar {
  padding: 8px 10px 7px;
}
html[data-layout='compact'] .pw-win-bar span {
  display: none;
}
html[data-layout='compact'] .pw-win-body {
  padding: 8px 10px 9px;
}
html[data-layout='compact'] .pw-mail {
  gap: 5px;
}
html[data-layout='compact'] .pw-inv-sheet {
  width: 96px;
  padding: 6px 9px;
  gap: 4px;
}
html[data-layout='compact'] .pw-bank-row:nth-child(4) {
  display: none;
}
html[data-layout='compact'] .pw-form-l:nth-child(3),
html[data-layout='compact'] .pw-form-in:nth-child(4) {
  display: none;
}
html[data-layout='compact'] .pw-rowwrap {
  top: 318px;
}
html[data-layout='compact'] .pw-row-main {
  grid-template-columns: 1fr auto;
  gap: 6px 12px;
  padding: 14px 16px 12px 14px;
}
html[data-layout='compact'] .pw-f {
  font-size: 15px;
}
html[data-layout='compact'] .pw-f-order,
html[data-layout='compact'] .pw-f-route {
  font-size: 13px;
}
html[data-layout='compact'] .pw-f-route {
  justify-self: end;
}
html[data-layout='compact'] .pw-f-route::before {
  left: auto;
  right: 0;
}
html[data-layout='compact'] .pw-f-order {
  grid-row: 2;
  grid-column: 1;
}
html[data-layout='compact'] .pw-f-amt {
  grid-row: 1;
  grid-column: 2;
}
html[data-layout='compact'] .pw-stages {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
  padding: 0 12px 12px 10px;
}
html[data-layout='compact'] .pw-st {
  height: 26px;
  padding: 0 8px;
  font-size: 11px;
}
html[data-layout='compact'] #p-what .pt-wrap {
  gap: 24px;
}
html[data-layout='compact'] .pw-win-edge span {
  font-size: 17px;
}
/* рядок у кінці піднімається на ~100 px (камера йде за ним) — опори підтягуються під нього */
html[data-layout='compact'] .pw-visual {
  margin-bottom: -88px;
}
