/* ==========================================================================
   Blok „Przed i po (przełącznik)” (.lift.ba.os-ba), wersja zwarta.
   Góra w jednej linii: ikona + tytuł (+ wstęp) i przełącznik .seg (assets/css/primitives.css).
   Tematy w siatce 3 / 2 / 1 kolumn; tekst „przed” i „po” leży w tym samym polu siatki
   (bez skoku wysokości). W widoku „po” pomarańczowa nić biegnie kolejno po górnych
   krawędziach pól (opóźnienie --d z indeksu --i) i zapala kropki. Wszystko w CSS (:has).
   ========================================================================== */

.os-ba { padding-bottom: clamp(2.5rem, 5vw, 4rem); }
.os-ba .lift__sheet {
  border-radius: var(--radius-xl);
  background: radial-gradient(40% 70% at 100% 0%, rgba(248, 120, 49, .06), rgba(248, 120, 49, 0) 70%), #fff;
  box-shadow: inset 0 0 0 1px var(--line), var(--shadow-md);
  padding: clamp(1.25rem, 2.4vw, 2rem) clamp(1.25rem, 3vw, 2.5rem);
}

/* Top line: mark + title/lead on the left, the switch on the right */
.os-ba .lift__top { flex-wrap: nowrap; align-items: center; gap: 1rem 1.5rem; padding-bottom: .9rem; border-bottom: 0; }
.os-ba__head { display: flex; align-items: center; gap: .9rem; min-width: 0; }
.os-ba__mark {
  flex: none; width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center;
  background: var(--navy-50); color: var(--navy);
  transition: background-color .45s var(--ease), color .45s var(--ease);
}
.os-ba__mark .icon { width: 1.25rem; height: 1.25rem; }
.os-ba__titles { min-width: 0; }
.os-ba .lift__title { font-size: clamp(1.375rem, 1rem + .55vw, 1.5rem); line-height: 1.15; letter-spacing: -.02em; text-wrap: balance; }
.os-ba .lift__title .hl { white-space: nowrap; }
.os-ba .lift__lead { margin: .2rem 0 0; font-size: .875rem; line-height: 1.4; max-width: none; text-wrap: pretty; }
.os-ba .seg { flex: none; padding: 4px; gap: 3px; background: var(--paper-2); box-shadow: inset 0 0 0 1px var(--line); }
.os-ba .seg span { min-height: 2.5rem; padding: .55rem 1rem; }
.os-ba .seg label:hover input:not(:checked) + span { background: #fff; }
.ba:has(input[value="po"]:checked) .os-ba__mark { background: var(--navy-900); color: var(--orange-400); }

/* The topics: short cells, icon on the left, label over the sentence */
.ba__rows {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: clamp(1.25rem, 2.6vw, 2.25rem);
}
.ba__row {
  --d: calc(var(--i, 0) * .12s);
  position: relative; display: grid; grid-template-columns: 2.25rem minmax(0, 1fr); grid-template-rows: auto 1fr;
  column-gap: .8rem; row-gap: .15rem; align-content: start;
  padding: .8rem 0 .85rem; border-top: 1px solid var(--line);
}
/* the thread: an orange rule drawn along the cell's top edge, one cell after another */
.ba__row::before {
  content: ""; position: absolute; left: 0; right: 0; top: -1px; height: 2px; border-radius: 2px;
  background: var(--orange); transform: scaleX(0); transform-origin: 0 50%;
  transition: transform .3s var(--ease);
}
.ba__dot {
  position: absolute; z-index: 1; left: 0; top: -5px; width: 9px; height: 9px; border-radius: 50%;
  background: #fff; box-shadow: inset 0 0 0 2px var(--line-strong);
  transition: background-color .3s, box-shadow .3s;
}
.ba__icon {
  grid-row: 1 / 3; width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center;
  background: var(--navy-50); color: var(--navy);
  transition: background-color .45s var(--ease) var(--d), color .45s var(--ease) var(--d);
}
.ba__icon .icon { width: 1.1rem; height: 1.1rem; }
.ba__topic { grid-column: 2; align-self: center; font-size: .9375rem; font-weight: 600; line-height: 1.3; letter-spacing: -.01em; color: var(--navy-900); }
.ba__cell { grid-column: 2; display: grid; }
.ba__run { display: none; font-weight: 600; color: var(--navy-900); }
.ba__txt { grid-area: 1 / 1; font-size: .9rem; line-height: 1.42; }
.ba__txt--przed { color: var(--text); transition: opacity .4s var(--ease) var(--d), transform .5s var(--ease) var(--d), visibility 0s linear 0s; }
.ba__txt--po {
  color: var(--navy-900); opacity: 0; visibility: hidden; transform: translateY(8px);
  transition: opacity .3s var(--ease), transform .4s var(--ease), visibility 0s linear .4s;
}

/* "Po": texts swap, tiles turn navy, the thread runs through every cell */
.ba:has(input[value="po"]:checked) .ba__txt--przed {
  opacity: 0; visibility: hidden; transform: translateY(-8px);
  transition: opacity .3s var(--ease), transform .4s var(--ease), visibility 0s linear .4s;
}
.ba:has(input[value="po"]:checked) .ba__txt--po {
  opacity: 1; visibility: visible; transform: none;
  transition: opacity .45s var(--ease) calc(var(--d) + .12s), transform .6s var(--ease) calc(var(--d) + .12s), visibility 0s linear 0s;
}
.ba:has(input[value="po"]:checked) .ba__icon { background: var(--navy-900); color: var(--orange-400); }
.ba:has(input[value="po"]:checked) .ba__row::before { transform: scaleX(1); transition: transform .5s cubic-bezier(.55, 0, .25, 1) var(--d); }
.ba:has(input[value="po"]:checked) .ba__dot {
  background: var(--orange); box-shadow: inset 0 0 0 2px var(--orange), 0 0 0 4px var(--orange-50);
  transition-delay: var(--d);
}

/* The gain: one slim line */
.os-ba .ba__gain {
  display: flex; align-items: center; gap: .75rem; width: fit-content; max-width: 100%;
  margin: .2rem 0 0; padding: .3rem 1.25rem .3rem .3rem; border-radius: var(--radius-pill);
  background: var(--orange-50); box-shadow: inset 0 0 0 1px var(--orange-100);
  font-size: .9375rem; line-height: 1.4; color: var(--navy-900);
}
.ba__gain b { font-weight: 600; color: var(--navy-900); }
.os-ba .os-callout__ico {
  flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: var(--orange); color: #fff; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .4), 0 6px 14px -8px rgba(236, 110, 40, .9);
}
.os-ba .os-callout__ico .icon { width: 1rem; height: 1rem; stroke-width: 2.25; }

/* Tablet: two columns */
@media (max-width: 1023px) {
  .ba__rows { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .os-ba .lift__top { flex-wrap: wrap; }
}

/* Phone: one line per topic, the label runs into its sentence */
@media (max-width: 640px) {
  .os-ba .lift__top { flex-direction: column; align-items: stretch; gap: .8rem; padding-bottom: .9rem; }
  .os-ba__mark { display: none; }
  .os-ba .lift__lead { font-size: .8125rem; }
  .os-ba .seg span { padding: .5rem .4rem; font-size: .8125rem; }
  .ba__rows { grid-template-columns: minmax(0, 1fr); }
  .ba__row { --d: calc(var(--i, 0) * .09s); grid-template-columns: 2rem minmax(0, 1fr); grid-template-rows: auto; column-gap: .75rem; padding: .6rem 0 .65rem; }
  .ba__icon { grid-row: 1; width: 32px; height: 32px; border-radius: 10px; }
  .ba__icon .icon { width: 1rem; height: 1rem; }
  .ba__topic { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .ba__cell { grid-row: 1; }
  .ba__run { display: inline; }
  .ba__txt { font-size: .875rem; line-height: 1.4; }
  .os-ba .ba__gain { width: auto; align-items: flex-start; margin-top: .15rem; padding: .5rem .85rem .5rem .5rem; border-radius: 16px; font-size: .875rem; }
  .os-ba .os-callout__ico { width: 28px; height: 28px; }
}
