/* ══════════════════════════════════════════════════════════════════
   STRONA STARTOWA — TRZY TELEFONY Z PRAWDZIWYMI ZAPROSZENIAMI (v386)
   W każdym telefonie działa prawdziwe zaproszenie demonstracyjne
   (pages/zaproszenie.html?demo=<motyw>&telefon=1) w ramce 390 px,
   przeskalowanej do ekranu telefonu. Środkowy telefon jest aktywny:
   gość dotyka koperty i przewija całe zaproszenie palcem lub kółkiem.
   Kliknięcie bocznego telefonu przenosi go na środek.
   ══════════════════════════════════════════════════════════════════ */
.hero-visual--tel { min-height: 700px; flex-direction: column; overflow: visible; }
/* boczne telefony wystają poza kolumnę — nie mogą dać przewijania w bok */
.hero:has(.hero-visual--tel) { overflow-x: clip; }

.tel-stack {
  --tel-w: 296px;                 /* szerokość obudowy środkowego telefonu */
  --tel-h: calc(var(--tel-w) * 2.06);
  --tel-off: 172px;               /* przesunięcie bocznych telefonów */
  position: relative;
  width: 100%;
  max-width: 640px;
  height: calc(var(--tel-h) + 30px);
  margin: 0 auto;
  perspective: 1600px;
}
/* miękka poświata pod telefonami — perłowa, ciepła */
.tel-stack::before {
  content: "";
  position: absolute;
  left: 50%; top: 52%;
  width: 118%; height: 72%;
  translate: -50% -50%;
  background:
    radial-gradient(closest-side, rgba(255, 248, 238, .95), rgba(246, 232, 220, .55) 55%, rgba(246, 232, 220, 0) 100%);
  filter: blur(6px);
  pointer-events: none;
  z-index: 0;
}

/* ── jeden telefon ── */
.tel {
  position: absolute;
  left: 50%; top: 8px;
  width: var(--tel-w);
  height: var(--tel-h);
  margin-left: calc(var(--tel-w) / -2);
  border-radius: calc(var(--tel-w) * .165);
  padding: calc(var(--tel-w) * .034);
  box-sizing: border-box;
  /* tytanowa obudowa: ciemny korpus, jasna krawędź, odblask */
  background:
    linear-gradient(145deg, rgba(255, 255, 255, .22) 0%, rgba(255, 255, 255, 0) 22%, rgba(255, 255, 255, 0) 70%, rgba(255, 255, 255, .12) 100%),
    linear-gradient(160deg, #3A3431 0%, #1C1816 48%, #2A2522 100%);
  box-shadow:
    inset 0 0 0 1.5px #6E655E,
    inset 0 0 0 3px #141110,
    inset 0 0 0 4px rgba(255, 255, 255, .08),
    0 2px 2px rgba(30, 22, 16, .18),
    0 34px 60px -18px rgba(40, 28, 20, .55),
    0 70px 90px -40px rgba(40, 28, 20, .35);
  transition: transform .9s cubic-bezier(.22, 1, .36, 1), filter .9s ease, opacity .9s ease, box-shadow .9s ease;
  cursor: pointer;
  outline: none;
  z-index: 1;
  will-change: transform;
}
/* przyciski boczne (głośność, zasilanie) */
.tel::before, .tel::after {
  content: "";
  position: absolute;
  width: 3px;
  border-radius: 2px;
  background: linear-gradient(90deg, #4A433E, #2A2522);
}
.tel::before { left: -3px; top: 22%; height: 8%; box-shadow: 0 calc(var(--tel-h) * .11) 0 #3A3431; }
.tel::after  { right: -3px; top: 27%; height: 12%; }

.tel-ekran {
  position: relative;
  width: 100%; height: 100%;
  border-radius: calc(var(--tel-w) * .135);
  overflow: hidden;
  background: #F4EEE6;
  isolation: isolate;
  transform: translateZ(0);
}
/* miniatura motywu — widoczna, zanim zaproszenie się wczyta */
.tel-plakat { position: absolute; inset: 0; transition: opacity .6s ease; }
.tel-plakat svg, .tel-plakat img { display: block; width: 100%; height: 100%; object-fit: cover; }
.tel-plakat img.tel-zaslona { object-position: top center; }   /* v449: zasłona jak w telefonie – od góry */
.tel.is-gotowy .tel-plakat { opacity: 0; pointer-events: none; }
.tel-ramka {
  position: absolute;
  left: 0; top: 0;
  width: 390px;
  max-width: none;   /* globalne iframe { max-width: 100% } ścinało ramkę do szerokości ekranu */
  border: 0;
  transform-origin: 0 0;
  transform: scale(var(--tel-k, .7));
  opacity: 0;
  transition: opacity .6s ease;
  background: #F4EEE6;
}
.tel.is-gotowy .tel-ramka { opacity: 1; }
/* Dynamic Island */
.tel-wyspa {
  position: absolute;
  left: 50%; top: calc(var(--tel-w) * .03);
  width: 31%; height: calc(var(--tel-w) * .088);
  translate: -50% 0;
  border-radius: 999px;
  background: #0B0A09;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .05);
  z-index: 3;
  pointer-events: none;
}
.tel-wyspa::after {
  content: ""; position: absolute; right: 16%; top: 50%; width: 9%; aspect-ratio: 1; translate: 0 -50%;
  border-radius: 50%; background: radial-gradient(circle at 35% 35%, #2E3A52, #0B0A09 70%);
}
/* szklany odblask na ekranie */
.tel-szklo {
  position: absolute; inset: 0; z-index: 2; pointer-events: none; border-radius: inherit;
  background: linear-gradient(118deg, rgba(255, 255, 255, .16) 0%, rgba(255, 255, 255, .04) 26%, rgba(255, 255, 255, 0) 40%);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .35);
}
/* boczne telefony: klik przenosi na środek, zaproszenie w nich nie reaguje */
.tel-klik { position: absolute; inset: 0; z-index: 4; border-radius: inherit; }
.tel--c .tel-klik { display: none; }

/* ── pozycje ── */
.tel--c { transform: translateZ(0) rotateY(0) scale(1); z-index: 3; cursor: default; }
.tel--l { transform: translateX(calc(var(--tel-off) * -1)) translateY(26px) rotate(-6deg) scale(.84); filter: saturate(.92) brightness(.97); }
.tel--r { transform: translateX(var(--tel-off)) translateY(26px) rotate(6deg) scale(.84); filter: saturate(.92) brightness(.97); }
.tel--l:hover { transform: translateX(calc(var(--tel-off) * -1.08)) translateY(18px) rotate(-7.5deg) scale(.86); }
.tel--r:hover { transform: translateX(calc(var(--tel-off) * 1.08)) translateY(18px) rotate(7.5deg) scale(.86); }
.tel:focus-visible { box-shadow: 0 0 0 3px #C9A554, 0 34px 60px -18px rgba(40, 28, 20, .55); }

/* ── podpis pod telefonami ── */
.tel-podpis {
  position: relative; z-index: 4;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  margin-top: 18px;
  text-align: center;
}
.tel-nazwa { font-family: var(--serif-display, 'Cormorant Garamond', serif); font-style: italic; font-size: 26px; line-height: 1.1; color: var(--ink, #2A2018); transition: opacity .35s ease; }
.tel-tag { font-family: var(--sans, 'Inter', sans-serif); font-size: 10.5px; letter-spacing: .32em; text-transform: uppercase; color: var(--muted, #8A7C6E); }
.tel-akcje { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 4px; }
.tel-akcje .btn { padding: 11px 20px; font-size: 11px; }
.tel-kropki { display: flex; gap: 8px; margin-top: 2px; }
.tel-kropki button {
  width: 8px; height: 8px; padding: 0; border: 0; border-radius: 50%;
  background: rgba(60, 45, 30, .22); cursor: pointer; transition: background .3s, transform .3s;
}
.tel-kropki button[aria-current="true"] { background: var(--ink, #2A2018); transform: scale(1.25); }
.tel-kropki button:focus-visible { outline: 2px solid #C9A554; outline-offset: 2px; }

/* podpowiedź „dotknij i przewiń” — przy środkowym telefonie */
.tel-podp {
  position: absolute; z-index: 5;
  left: 50%; top: calc(var(--tel-h) - 34px);
  translate: -50% 0;
  display: flex; align-items: center; gap: 8px;
  padding: 8px 15px 8px 12px;
  border-radius: 999px;
  background: rgba(255, 252, 247, .86);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  box-shadow: 0 8px 22px rgba(40, 28, 20, .18), inset 0 0 0 1px rgba(255, 255, 255, .8);
  font-family: var(--sans, 'Inter', sans-serif); font-size: 10.5px; letter-spacing: .18em; text-transform: uppercase;
  color: #3D2D1F; white-space: nowrap;
  pointer-events: none;
  transition: opacity .5s ease, translate .5s ease;
}
.tel-podp.is-ukryta { opacity: 0; translate: -50% 8px; }
.tel-podp svg { width: 14px; height: 18px; flex: none; }
.tel-podp .kolko { animation: tel-kolko 1.8s ease-in-out infinite; }
@keyframes tel-kolko { 0%, 100% { transform: translateY(0); opacity: 1; } 60% { transform: translateY(5px); opacity: .2; } }

/* ── telefon / tablet: telefony mniejsze, boczne wystają zza środkowego ── */
@media (min-width: 969px) and (max-height: 980px) {
  .tel-stack { --tel-w: 262px; --tel-off: 158px; }
  .hero-visual--tel { min-height: 0; }
}
@media (max-width: 968px) {
  .hero-visual--tel { min-height: 0; }
  .tel-stack { --tel-w: 272px; --tel-off: 150px; max-width: 520px; }
}
@media (max-width: 560px) {
  .tel-stack { --tel-w: min(66vw, 262px); --tel-off: min(30vw, 128px); }
  .tel--l { transform: translateX(calc(var(--tel-off) * -1)) translateY(22px) rotate(-5deg) scale(.8); }
  .tel--r { transform: translateX(var(--tel-off)) translateY(22px) rotate(5deg) scale(.8); }
  .tel--l:hover, .tel--r:hover { filter: saturate(.92) brightness(.97); }
  .tel--l:hover { transform: translateX(calc(var(--tel-off) * -1)) translateY(22px) rotate(-5deg) scale(.8); }
  .tel--r:hover { transform: translateX(var(--tel-off)) translateY(22px) rotate(5deg) scale(.8); }
  .tel-nazwa { font-size: 23px; }
}
@media (prefers-reduced-motion: reduce) {
  .tel, .tel-plakat, .tel-ramka, .tel-podp { transition: none; }
  .tel-podp .kolko { animation: none; }
}

/* ══════════════════════════════════════════════════════════════════
   GALERIA MOTYWÓW — KAŻDY MOTYW W TELEFONIE (v388)
   Poziomy pas telefonów (przewijany palcem, kółkiem z Shiftem albo
   strzałkami). W każdym telefonie działa prawdziwe zaproszenie.
   ══════════════════════════════════════════════════════════════════ */
/* v470: galeria to <section> w sekcji szablonów, więc dziedziczyła ogólne
   „section { padding: 120px 0 }” – 120 px pustki nad i pod telefonami. */
.tel-galeria { position: relative; margin: 8px -24px 0; padding: 0; }
.tel-gal-tor {
  --tel-w: 250px;
  --tel-h: calc(var(--tel-w) * 2.06);
  display: flex;
  gap: 28px;
  overflow-x: auto;
  overflow-y: visible;
  scroll-snap-type: x mandatory;
  scroll-padding: 0 48px;
  padding: 26px 48px 34px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}
.tel-gal-tor::-webkit-scrollbar { display: none; }
/* miękkie wygaszenie krawędzi pasa (maska — działa na każdym tle) */
.tel-gal-tor {
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 44px, #000 calc(100% - 44px), transparent 100%);
          mask-image: linear-gradient(90deg, transparent 0, #000 44px, #000 calc(100% - 44px), transparent 100%);
}
.tel-gal-el {
  flex: 0 0 auto;
  width: var(--tel-w);
  scroll-snap-align: center;
  display: flex; flex-direction: column; align-items: center;
}
.tel.tel--gal {
  position: relative; left: auto; top: auto; margin: 0;
  transform: none; filter: none; cursor: default;
  transition: transform .6s cubic-bezier(.22, 1, .36, 1), box-shadow .6s ease;
}
.tel.tel--gal:hover { transform: translateY(-6px); }
.tel-gal-opis { display: flex; flex-direction: column; align-items: center; gap: 6px; margin-top: 20px; text-align: center; }
.tel-gal-nowy { font-family: var(--sans, 'Inter', sans-serif); font-size: 10px; letter-spacing: .24em; text-transform: uppercase; color: #9C7A50; }
.tel-gal-nazwa { margin: 0; font-family: var(--serif-display, 'Cormorant Garamond', serif); font-style: italic; font-weight: 400; font-size: 25px; line-height: 1.1; color: var(--ink, #2A2018); }
.tel-gal-tag { font-family: var(--sans, 'Inter', sans-serif); font-size: 10.5px; letter-spacing: .3em; text-transform: uppercase; color: var(--muted, #8A7C6E); }
.tel-gal-akcje { display: flex; gap: 8px; margin-top: 8px; }
.tel-gal-akcje .btn { padding: 10px 18px; font-size: 10.5px; }

.tel-gal-strz {
  position: absolute; z-index: 3; top: calc(26px + var(--tel-h, 515px) / 2);
  translate: 0 -50%;
  width: 48px; height: 48px; border-radius: 50%; border: 1px solid rgba(60, 45, 30, .18);
  background: rgba(255, 252, 247, .92); color: var(--ink, #2A2018);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  box-shadow: 0 8px 22px rgba(40, 28, 20, .16);
  display: grid; place-items: center; cursor: pointer; transition: opacity .3s, transform .3s;
}
.tel-gal-strz svg { width: 20px; height: 20px; }
.tel-gal-strz:hover { transform: scale(1.06); }
.tel-gal-strz:disabled { opacity: 0; pointer-events: none; }
.tel-gal-strz--l { left: 6px; }
.tel-gal-strz--p { right: 6px; }
.tel-galeria { --tel-h: calc(250px * 2.06); }

@media (max-width: 640px) {
  .tel-galeria { margin: 0 -20px; --tel-h: calc(min(68vw, 262px) * 2.06); }
  .tel-gal-tor { --tel-w: min(68vw, 262px); gap: 18px; padding: 20px calc((100vw - var(--tel-w)) / 2) 28px; scroll-padding: 0; }
  .tel-gal-strz { display: none; }
  .tel-gal-tor { -webkit-mask-image: none; mask-image: none; }
}
@media (prefers-reduced-motion: reduce) { .tel.tel--gal, .tel-gal-strz { transition: none; } }

.tel-gal-podp { margin: -24px auto 4px; text-align: center; font-family: var(--serif-body, 'Cormorant Garamond', serif); font-style: italic; font-size: 17px; color: var(--ink-soft, #5C4A3C); }

/* ══ v403: SZABLONY — zaproszenie na żywo w telefonie nad kafelkiem ══
   Komputer: najechanie na kafelek; telefon: przycisk „Na żywo”.
   Szerokość telefonu (--tel-w) liczy js/strony/szablony.js z wymiarów kafelka. */
.szab-na-zywo {
  position: absolute; left: 14px; bottom: 14px; z-index: 3;
  display: none; align-items: center; gap: 6px;
  padding: 8px 14px; border: 0; border-radius: 999px;
  background: rgba(255, 252, 247, .92); color: var(--ink, #2A2018);
  font-family: var(--sans, 'Inter', sans-serif); font-size: 11px; letter-spacing: .14em; text-transform: uppercase;
  box-shadow: 0 6px 16px -6px rgba(40, 28, 20, .35); cursor: pointer;
}
.szab-na-zywo span { font-size: 9px; }
@media (hover: none) { .szab-na-zywo { display: inline-flex; } }
.template-card.is-zywy .szab-na-zywo,
.template-card.is-zywy .template-overlay { opacity: 0; pointer-events: none; }
.template-card.is-zywy .template-thumb { transform: none; }
.szab-zywy {
  position: absolute; inset: 0; z-index: 4;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  background: rgba(250, 245, 238, .6);
  -webkit-backdrop-filter: blur(8px) saturate(1.05); backdrop-filter: blur(8px) saturate(1.05);
  opacity: 0; transition: opacity .3s ease;
  cursor: default;
}
.szab-zywy.is-widoczny { opacity: 1; }
.tel.tel--szab {
  --tel-w: 220px; --tel-h: calc(var(--tel-w) * 2.06);
  position: relative; left: auto; top: auto; margin: 0; flex: none;
  cursor: default; transform: translateY(8px) scale(.97); transition: transform .45s cubic-bezier(.22, 1, .36, 1);
}
.szab-zywy.is-widoczny .tel--szab { transform: none; }
.szab-zywy-akcje { display: flex; gap: 8px; align-items: center; }
.szab-zywy-akcje button {
  border: 0; border-radius: 999px; cursor: pointer;
  font-family: var(--sans, 'Inter', sans-serif); font-size: 11px; letter-spacing: .14em; text-transform: uppercase;
}
.szab-pelny { padding: 9px 16px; background: var(--ink, #2A2018); color: #FBF7EF; }
.szab-zamknij { width: 34px; height: 34px; padding: 0; background: rgba(255, 252, 247, .95); color: var(--ink, #2A2018); font-size: 20px; line-height: 1; letter-spacing: 0; }
@media (prefers-reduced-motion: reduce) { .szab-zywy, .tel.tel--szab { transition: none; } }
/* telefon: na środku ekranu nad przygaszoną stroną; strona pod spodem nie przewija się */
.szab-zywy--modal { position: fixed; inset: 0; z-index: 9600;   /* nad banerem cookies (9500) */ background: rgba(250, 245, 238, .86); padding: 16px; }
html.szab-modal-otwarty, html.szab-modal-otwarty body { overflow: hidden; }
/* komputer: telefon wyskakuje nad kafelek (fixed, pozycję liczy JS) */
.szab-zywy--plywa {
  position: fixed; inset: auto; z-index: 60;
  background: none; -webkit-backdrop-filter: none; backdrop-filter: none;
  filter: drop-shadow(0 30px 40px rgba(40, 28, 20, .28));
}
.template-card.is-zywy .template-thumb > :not(.szab-zywy) { filter: saturate(.85) brightness(1.03); opacity: .55; transition: opacity .3s ease; }

/* v434: mniej warstw kompozytora na ekranach dotykowych. Każdy telefon
   z `will-change` i `translateZ(0)` dostawał własną warstwę (18 na stronie
   startowej), a przy powiększaniu dwoma palcami Safari na iPhonie rysuje je
   od nowa w większej skali — to zjadało pamięć karty (przeładowanie strony,
   „powrót” na górę). Warstwa zostaje tylko tam, gdzie gra zaproszenie. */
.tel.tel--gal { will-change: auto; }
.tel-gal-el .tel-ekran { transform: none; }
.tel-gal-el .tel-ekran:has(> .tel-ramka) { transform: translateZ(0); }
@media (hover: none) {
  .tel { will-change: auto; }
  .tel-stack .tel-ekran { transform: none; }
  .tel-stack .tel-ekran:has(> .tel-ramka) { transform: translateZ(0); }
}
/* v434: dopóki zaproszenie się wczytuje, dotyk trafia w telefon (miniaturę),
   nie w pustą ramkę — inaczej szybkie drugie przesunięcie palcem przepadało */
.tel:not(.is-gotowy) .tel-ramka { pointer-events: none; }
