/* Aplikacja Kolorowej Miski na LP (aplikacja.html, aplikacja.js): ładowane tylko przy włączonym przełączniku APP_URL.
   Wzór: sekcja aplikacji Pierwszych Łyżeczek (landing.module.css „8.8b” i arkusz AppPopup, telefon.module.css),
   przełożona na system Kolorowej Miski (DESIGN.md): biała sekcja między pasem buraka (przepis) a ofertą na ground-soft,
   telefony na plamie ground-soft z kropkami (jak hero), pieczęć jak okrągła odznaka hero, punkty jak karty, kafelki
   jak „Co warto wiedzieć” w karcie oferty, przycisk zakupu. Okno z dołu: góra w buraku, dół biały. Tokeny ze styl.css. */

/* Ramka telefonu: obudowa w kolorze atramentu, ekran biały jak aplikacja. Proporcje w jednostkach kontenera (cqw),
   więc ramka wygląda tak samo w każdej wielkości. Zrzut 390 × 844 pkt (cały ekran), pasek statusu rysuje ramka. */
.tel { container-type: inline-size; position: relative; margin: 0; }
.tel__body {
  position: relative; padding: 3.4cqw; border-radius: 15.6cqw;
  background: linear-gradient(150deg, #4a3a4e 0%, #2b1e2f 38%, #1f1522 100%);
  box-shadow: inset 0 0 0 .45cqw rgba(255, 255, 255, .16), inset 0 0 0 1.3cqw #180f1a, 0 1px 2px rgba(43, 30, 47, .24), 0 9cqw 16cqw -7cqw rgba(43, 30, 47, .5);
}
.tel__body::before, .tel__body::after { content: ""; position: absolute; width: 1cqw; border-radius: 1cqw; background: #2b1e2f; }
.tel__body::before { left: -.7cqw; top: 23%; height: 9%; box-shadow: 0 13cqw 0 #2b1e2f; }
.tel__body::after { right: -.7cqw; top: 28%; height: 14%; }
.tel__screen { position: relative; overflow: hidden; border-radius: 12.4cqw; background: #ffffff; isolation: isolate; }
.tel__status {
  position: relative; display: flex; align-items: center; justify-content: space-between; aspect-ratio: 390 / 40;
  padding: 1.2cqw 6.6cqw 0 9.4cqw; color: var(--ink); font-family: var(--font-sans); font-size: 3.85cqw; font-weight: 700; line-height: 1;
  letter-spacing: -.01em; font-variant-numeric: tabular-nums;
}
.tel__status svg { width: 16.4cqw; height: auto; }
.tel__island { position: absolute; left: 50%; top: 2.2cqw; width: 29cqw; height: 8cqw; border-radius: 99px; background: #0d0a0e; transform: translateX(-50%); }
.tel__screen img { display: block; width: 100%; height: auto; aspect-ratio: 540 / 1169; background: #ffffff; }

/* Sekcja */
.app { overflow-x: clip; }
.app__grid { display: grid; gap: 32px; }
.app__head .sec__lead { max-width: 36ch; }

/* Wachlarz (aplikacja.js): wszystkie telefony szerokości --wc w jednej komórce siatki, pozycja z data-pos. Boczne (±1)
   w skali --s, przesunięte o 0,6 swojej szerokości i obrócone o 7°, najwyżej do krawędzi ekranu; dalsze (±2) chowają
   się za środkowym. W trakcie ciągnięcia ([data-drag]) pozycje ustawia skrypt co klatkę, po puszczeniu dojazd z CSS. */
.app__fan { position: relative; display: grid; justify-items: center; gap: 22px; isolation: isolate; }
/* plama ground-soft z kropkami za telefonami (jak tło hero), z jednym dużym rogiem */
.app__fan::before {
  content: ""; position: absolute; z-index: -1; left: 50%; top: 12%; width: min(92vw, 420px); height: 70%;
  transform: translateX(-50%); border-radius: 40px 40px 40px 140px; background: var(--ground-soft); background-image: var(--dots);
}
.app__phones {
  --wc: min(56vw, 236px); --s: .72;
  position: relative; display: grid; justify-items: center; align-items: start; width: 100%;
  touch-action: pan-y; user-select: none; -webkit-user-select: none; cursor: grab; outline-offset: 8px; border-radius: 24px;
}
.app__phones[data-drag] { cursor: grabbing; }
.app__phones > * { grid-area: 1 / 1; }
.app__item {
  width: var(--wc); -webkit-tap-highlight-color: transparent; transform: var(--t);
  transition: transform .7s cubic-bezier(.22, 1, .36, 1), opacity .45s ease;
}
.app__item img { pointer-events: none; -webkit-user-drag: none; }
.app__phones[data-drag] .app__item { transition: none; }
.app__item[data-pos="0"] { --t: rotate(0deg); z-index: 3; }
.app__item[data-pos="-1"] { --t: translate(calc(var(--wc) * var(--s) * -.6), calc(var(--wc) * .13)) rotate(-7deg) scale(var(--s)); z-index: 2; cursor: pointer; }
.app__item[data-pos="1"] { --t: translate(calc(var(--wc) * var(--s) * .6), calc(var(--wc) * .13)) rotate(7deg) scale(var(--s)); z-index: 2; cursor: pointer; }
.app__item[data-pos="-2"] { --t: translate(calc(var(--wc) * -.18), calc(var(--wc) * .2)) rotate(-3deg) scale(.6); z-index: 1; opacity: 0; }
.app__item[data-pos="2"] { --t: translate(calc(var(--wc) * .18), calc(var(--wc) * .2)) rotate(3deg) scale(.6); z-index: 1; opacity: 0; }

/* pieczęć jak okrągła odznaka hero: burak, biała obwódka, słowo w Literacie */
.app__seal {
  position: absolute; z-index: 20; top: 2%; left: calc(50% + var(--wc) / 2 - 46px); pointer-events: none;
  display: grid; place-content: center; width: 96px; height: 96px; border-radius: 50%; text-align: center;
  background: var(--burak); color: #ffffff; border: 4px solid #ffffff; box-shadow: 0 8px 20px rgba(43, 30, 47, .22);
  font-size: 15px; font-weight: 700; line-height: 1.1; transform: rotate(-8deg);
  transition: opacity .35s ease, transform .45s cubic-bezier(.22, 1, .36, 1);
}
.app__seal b { font-family: var(--font-display); font-weight: 600; font-size: 22px; line-height: 1; letter-spacing: -.01em; }
.app__phones[data-drag] .app__seal { opacity: 0; transform: rotate(-8deg) scale(.85); }

/* kropki pod wachlarzem: aktywna wydłużona (cel dotyku 24 px wysokości mimo cienkiej kropki) */
.app__dots { display: flex; gap: 4px; }
.app__dots button { appearance: none; position: relative; width: 20px; height: 24px; padding: 0; border: 0; background: none; cursor: pointer; transition: width .4s cubic-bezier(.22, 1, .36, 1); }
.app__dots button::before { content: ""; position: absolute; left: 6px; right: 6px; top: 8px; height: 8px; border-radius: 99px; background: var(--line-strong); opacity: .55; transition: background-color .3s, opacity .3s; }
.app__dots button[aria-current] { width: 36px; }
.app__dots button[aria-current]::before { background: var(--burak); opacity: 1; }

/* treść: punkty jak karty, notka, kafelki faktów (klasa .trust ze styl.css), logowanie, przycisk */
.app__body { width: 100%; max-width: 560px; margin-inline: auto; display: grid; gap: 16px; }
.app__points { display: grid; gap: 10px; }
.app__points li { display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 14px; align-items: start; padding: 16px 16px 17px; border: 1px solid var(--line); border-radius: var(--r-m); background: var(--ground); box-shadow: var(--shadow-card); }
.app__points svg { width: 26px; height: 26px; color: var(--burak); margin-top: 1px; }
.app__points p { display: grid; gap: 2px; }
.app__points b { font-size: 20px; line-height: 1.3; }
.app__points span { font-size: 18px; line-height: 1.45; color: var(--ink-muted); }
.app__note { padding: 2px 4px 0; text-align: center; font-size: 18px; line-height: 1.45; color: var(--ink-muted); text-wrap: pretty; }
.app__facts { margin-top: 0; }
.app__login { text-align: center; font-size: 16px; line-height: 1.45; color: var(--ink-muted); text-wrap: balance; }
.app__cta { width: 100%; margin-top: 4px; }

@media (min-width: 760px) {
  .app__phones { --wc: 260px; --s: .8; }
  .app__fan::before { width: 560px; }
  .app__head .sec__lead { max-width: 46ch; }
  .app__note { padding-inline: 24px; }
}
@media (min-width: 1040px) {
  .app__grid { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); grid-template-areas: "phones head" "phones body"; column-gap: 64px; row-gap: 26px; align-items: center; max-width: 1120px; }
  .app__head { grid-area: head; align-self: end; }
  .app__head .sec__title, .app__head .sec__lead { text-align: left; margin-inline: 0; }
  .app__fan { grid-area: phones; }
  .app__fan::before { width: 500px; height: 78%; top: 8%; }
  .app__phones { --wc: 280px; --s: .84; }
  .app__body { grid-area: body; align-self: start; margin: 0; max-width: 520px; }
  .app__note, .app__login { text-align: left; padding-inline: 0; }
  .app__cta { justify-self: start; width: auto; min-width: 360px; }
}
@media (prefers-reduced-motion: no-preference) {
  /* telefony rozkładają się zza środkowego przy wjeździe sekcji (data-anim ustawia aplikacja.js), potem pieczęć;
     tylko pierwszy układ (przed pierwszym przesunięciem) */
  .app[data-anim] .app__phones:not([data-moved]) .app__item[data-pos="0"] { animation: app-rise .7s cubic-bezier(.16, 1, .3, 1) both; }
  .app[data-anim] .app__phones:not([data-moved]) .app__item[data-pos="-1"] { animation: app-fan-l 1s .2s cubic-bezier(.16, 1, .3, 1) both; }
  .app[data-anim] .app__phones:not([data-moved]) .app__item[data-pos="1"] { animation: app-fan-r 1s .2s cubic-bezier(.16, 1, .3, 1) both; }
  .app[data-anim] .app__seal { animation: app-seal .6s .85s cubic-bezier(.2, .9, .3, 1) backwards; }
  @keyframes app-rise { from { opacity: 0; transform: translateY(12px); } }
  @keyframes app-fan-l { from { transform: translate(calc(var(--wc) * -.1), calc(var(--wc) * .08)) rotate(-1deg) scale(var(--s)); } }
  @keyframes app-fan-r { from { transform: translate(calc(var(--wc) * .1), calc(var(--wc) * .08)) rotate(1deg) scale(var(--s)); } }
  @keyframes app-seal { from { opacity: 0; transform: scale(1.5) rotate(-26deg); } }
}
@media (prefers-reduced-motion: reduce) {
  .app__item, .app__dots button, .app__dots button::before { transition: none; }
}

/* Okno z dołu (jak AppPopup.tsx): na telefonie arkusz na pół ekranu, od 760 px okno na środku. Góra to pas buraka
   z wachlarzem telefonów uciętym u dołu, dół to biała kartka z tekstem i przyciskiem. Tło przyciemnione (stuknięcie
   zamyka), strona pod spodem się nie przewija (html[data-arkusz]). */
html[data-arkusz] { overflow: hidden; }
.sheet { position: fixed; inset: 0; z-index: 35; display: grid; align-items: end; visibility: hidden; pointer-events: none; transition: visibility .6s; }
.sheet[data-on] { visibility: visible; pointer-events: auto; }
.sheet__scrim { position: absolute; inset: 0; background: rgba(43, 30, 47, .48); opacity: 0; transition: opacity .4s ease; }
.sheet[data-on] .sheet__scrim { opacity: 1; }
.sheet__box {
  position: relative; width: 100%; max-height: min(88dvh, 640px); overflow: hidden;
  border-radius: var(--r-l) var(--r-l) 0 0; background: var(--ground); color: var(--ink);
  box-shadow: 0 -18px 50px -20px rgba(43, 30, 47, .5);
  transform: translateY(105%); transition: transform .6s cubic-bezier(.22, 1, .36, 1);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.sheet[data-on] .sheet__box { transform: none; }
.sheet__top { position: relative; height: clamp(190px, 30dvh, 250px); overflow: hidden; background: var(--burak); touch-action: none; }
.sheet__grab { position: absolute; z-index: 5; top: 8px; left: 50%; width: 40px; height: 5px; border-radius: 99px; background: rgba(255, 255, 255, .55); transform: translateX(-50%); }
.sheet__phones { --w: min(40vw, 168px); position: absolute; left: 0; right: 0; top: 30px; display: grid; justify-items: center; }
.sheet__phones > * { grid-area: 1 / 1; }
.sheet__phones .sheet__c { width: var(--w); position: relative; z-index: 2; }
.sheet__phones .sheet__l, .sheet__phones .sheet__r { width: calc(var(--w) * .84); margin-top: calc(var(--w) * .16); }
.sheet__l { transform: translateX(-62%) rotate(-8deg); }
.sheet__r { transform: translateX(62%) rotate(8deg); }
.sheet__phones .tel__body { box-shadow: inset 0 0 0 .45cqw rgba(255, 255, 255, .16), inset 0 0 0 1.3cqw #180f1a, 0 9cqw 16cqw -7cqw rgba(0, 0, 0, .45); }
/* dół pasa: telefony znikają w buraku zamiast ostrego cięcia */
.sheet__top::after { content: ""; position: absolute; inset: auto 0 0; z-index: 3; height: 42px; background: linear-gradient(to bottom, rgba(163, 33, 79, 0), var(--burak)); }
.sheet__close {
  appearance: none; position: absolute; z-index: 6; top: 10px; right: 10px; width: 44px; height: 44px; display: grid; place-items: center;
  border: 0; border-radius: 999px; background: rgba(255, 255, 255, .18); color: #ffffff; cursor: pointer;
}
.sheet__close svg { width: 20px; height: 20px; }
.sheet__close:hover { background: rgba(255, 255, 255, .3); }
.sheet__close:focus-visible { outline-color: #ffffff; outline-offset: 1px; border-radius: 999px; }
.sheet__body { display: grid; justify-items: center; gap: 8px; padding: 20px max(20px, env(safe-area-inset-left, 0px)) 16px; text-align: center; }
.sheet__tag { margin: 0; }
.sheet__title { margin-top: 2px; font-family: var(--font-display); font-weight: 600; font-size: clamp(26px, 7vw, 32px); line-height: 1.15; letter-spacing: -.005em; text-wrap: balance; }
.sheet__text { max-width: 30em; font-size: 18px; line-height: 1.45; color: var(--ink-muted); text-wrap: pretty; }
.sheet__cta { width: min(100%, 420px); margin-top: 10px; }
.sheet__later { appearance: none; min-height: 48px; padding: 0 18px; border: 0; background: transparent; color: var(--burak); font: inherit; font-size: 18px; font-weight: 700; cursor: pointer; }
.sheet__later:hover { text-decoration: underline; text-underline-offset: 3px; }
@media (min-width: 760px) {
  .sheet { align-items: center; justify-items: center; padding: 24px; }
  .sheet__box { width: 520px; border-radius: var(--r-l); transform: translateY(24px) scale(.97); opacity: 0; transition: transform .5s cubic-bezier(.22, 1, .36, 1), opacity .3s ease; }
  .sheet[data-on] .sheet__box { opacity: 1; }
  .sheet__top { height: 250px; }
  .sheet__phones { --w: 168px; }
  .sheet__grab { display: none; }
}
@media (prefers-reduced-motion: no-preference) {
  /* wachlarz rozkłada się, gdy arkusz już stoi */
  .sheet[data-on] .sheet__l { animation: sheet-fan-l .8s .25s cubic-bezier(.22, 1, .36, 1) both; }
  .sheet[data-on] .sheet__r { animation: sheet-fan-r .8s .25s cubic-bezier(.22, 1, .36, 1) both; }
  .sheet[data-on] .sheet__c { animation: app-rise .7s .15s cubic-bezier(.22, 1, .36, 1) both; }
  @keyframes sheet-fan-l { from { transform: translateX(-12%) rotate(-2deg); } }
  @keyframes sheet-fan-r { from { transform: translateX(12%) rotate(2deg); } }
}
@media (prefers-reduced-motion: reduce) {
  .sheet, .sheet__scrim, .sheet__box { transition: none; }
}
