/* ===== ADWELD — dodatki v14: przejścia między stronami, stygnące nagłówki, spoina kroków,
   iskry, powrót na górę, paleta wyszukiwania, kalkulator, wydruk. Wszystko jako stopniowe ulepszenie. ===== */

/* --- płynne przejścia między podstronami (View Transitions API) --- */
@view-transition { navigation: auto; }
header.site { view-transition-name: site-header; }
.bar { view-transition-name: mobile-bar; }
::view-transition-old(root) { animation: vt-out .26s cubic-bezier(.4, 0, 1, 1) both; }
::view-transition-new(root) { animation: vt-in .46s cubic-bezier(.16, 1, .3, 1) both; }
@keyframes vt-out { to { opacity: 0; transform: translateY(-10px) scale(.995); filter: blur(4px); } }
@keyframes vt-in { from { opacity: 0; transform: translateY(16px); filter: blur(6px); } }
@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
}

/* --- nagłówki stygnące jak świeża spoina (scroll-driven animations) --- */
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    main h2:not(.ix-nocool) {
      animation: xs-cool linear both; animation-timeline: view(); animation-range: entry 5% cover 38%;
    }
    @keyframes xs-cool {
      from { color: #FFE2B0; text-shadow: 0 0 .35em rgba(255, 150, 40, .9), 0 0 1.1em rgba(255, 90, 20, .55); }
      55% { color: #FFB86A; text-shadow: 0 0 .25em rgba(255, 110, 30, .45), 0 0 .8em rgba(200, 50, 10, .2); }
      to { color: var(--ink); text-shadow: 0 0 0 transparent; }
    }
    :root[data-theme="light"] main h2:not(.ix-nocool) { animation-name: xs-cool-l; }
    @keyframes xs-cool-l { from { color: #E0580F; text-shadow: 0 0 .3em rgba(255, 120, 30, .55); } to { color: var(--ink); text-shadow: 0 0 0 transparent; } }
  }
}

/* --- kroki „Jak pracujemy”: ścieg spajający numery, spawany przewijaniem --- */
.steps { position: relative; }
.steps::before { content: ""; position: absolute; left: 21.5px; top: 23px; bottom: 23px; width: 3px; border-radius: 2px;
  background: repeating-linear-gradient(180deg, #FFB547 0 5px, #FF7A1A 5px 7px); opacity: .85; transform-origin: 50% 0; }
.step::before { position: relative; z-index: 1; }
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .steps::before { animation: xs-seam linear both; animation-timeline: view(); animation-range: entry 30% cover 72%; }
    .steps::after { content: ""; position: absolute; left: 11px; width: 24px; height: 24px; border-radius: 50%; pointer-events: none; z-index: 2;
      background: radial-gradient(circle, #fff 0 18%, rgba(170, 215, 255, .9) 30%, rgba(255, 150, 40, .45) 55%, transparent 72%);
      animation: xs-arc linear both; animation-timeline: view(); animation-range: entry 30% cover 72%; }
    @keyframes xs-seam { from { transform: scaleY(0); } to { transform: scaleY(1); } }
    @keyframes xs-arc { from { top: 11px; opacity: 1; } 96% { opacity: 1; } to { top: calc(100% - 35px); opacity: 0; } }
  }
}

/* --- iskry po kliknięciu przycisku --- */
.xs-spark { position: fixed; left: 0; top: 0; width: 3px; height: 3px; border-radius: 2px; pointer-events: none; z-index: 500;
  background: #fff; box-shadow: 0 0 6px 2px rgba(255, 170, 60, .9), 0 0 12px 4px rgba(255, 90, 20, .5); }

/* --- powrót na górę z pierścieniem postępu --- */
.xs-top { position: fixed; right: 22px; bottom: 86px; z-index: 74; width: 48px; height: 48px; border-radius: 50%; border: 1px solid var(--line);
  background: color-mix(in srgb, var(--solid, #101218) 86%, transparent); color: var(--ink); display: grid; place-items: center; cursor: pointer;
  opacity: 0; transform: translateY(12px) scale(.9); pointer-events: none; transition: opacity .3s, transform .4s cubic-bezier(.16, 1, .3, 1); box-shadow: var(--shadow); }
.xs-top.on { opacity: 1; transform: none; pointer-events: auto; }
.xs-top svg { position: absolute; inset: -1px; width: 48px; height: 48px; transform: rotate(-90deg); }
.xs-top circle { fill: none; stroke: url(#xsGrad); stroke-width: 3; stroke-linecap: round; stroke-dasharray: 144.5; stroke-dashoffset: 144.5; }
.xs-top b { font: 700 1rem/1 Manrope, Inter, sans-serif; }
@media (max-width: 999px) { .xs-top { display: none; } }

/* --- paleta wyszukiwania (Ctrl/⌘ + K) --- */
.xs-sbtn { display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 14px 0 12px; border-radius: 999px; border: 0; cursor: pointer;
  background: var(--surface-2); color: var(--muted); font: 600 .8rem Manrope, Inter, sans-serif; }
.xs-sbtn:hover { color: var(--ink); }
.xs-sbtn svg { width: 17px; height: 17px; }
.xs-sbtn kbd { font: 600 .68rem ui-monospace, monospace; padding: 2px 6px; border-radius: 6px; border: 1px solid var(--line); color: var(--muted); }
@media (max-width: 1599px) { .xs-sbtn span, .xs-sbtn kbd { display: none; } .xs-sbtn { width: 44px; padding: 0; justify-content: center; } }
dialog.xs-pal { width: min(680px, calc(100% - 24px)); max-height: min(72vh, 640px); padding: 0; border: 1px solid var(--line); border-radius: 22px; overflow: hidden;
  background: var(--solid, #101218); color: var(--ink); box-shadow: 0 30px 90px rgba(0, 0, 0, .55); margin-top: 12vh; }
dialog.xs-pal::backdrop { background: rgba(4, 6, 10, .6); backdrop-filter: blur(6px); }
dialog.xs-pal[open] { animation: xs-pop .28s cubic-bezier(.16, 1, .3, 1); }
@keyframes xs-pop { from { opacity: 0; transform: translateY(-10px) scale(.98); } }
.xs-pal form { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.xs-pal form svg { width: 20px; height: 20px; flex: none; color: var(--arc-2); }
.xs-pal input { flex: 1; min-height: 44px !important; border: 0 !important; background: transparent !important; box-shadow: none !important; font-size: 1.05rem; padding: 0 !important; backdrop-filter: none !important; }
.xs-pal input:focus { outline: none; }
.xs-pal ul { list-style: none; margin: 0; padding: 8px; overflow-y: auto; max-height: calc(min(72vh, 640px) - 118px); }
.xs-pal li { margin: 0; }
.xs-pal a { display: grid; gap: 2px; padding: 10px 12px; border-radius: 12px; text-decoration: none; color: var(--ink); }
.xs-pal a small { color: var(--muted); font-size: .78rem; }
.xs-pal a span { color: var(--muted); font-size: .84rem; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.xs-pal a[aria-selected="true"], .xs-pal a:hover { background: var(--surface-2); box-shadow: inset 3px 0 0 var(--arc-1); }
.xs-pal mark { background: rgba(255, 154, 31, .28); color: inherit; border-radius: 3px; padding: 0 1px; }
.xs-pal .xs-hint { display: flex; gap: 14px; justify-content: flex-end; padding: 10px 16px; border-top: 1px solid var(--line); font-size: .74rem; color: var(--muted); }
.xs-pal .xs-hint kbd { font: 600 .68rem ui-monospace, monospace; padding: 1px 5px; border: 1px solid var(--line); border-radius: 5px; }
.xs-pal .xs-empty { padding: 22px 14px; color: var(--muted); text-align: center; }
.xs-pal .xs-grp { padding: 10px 12px 4px; font: 700 .68rem Manrope, Inter, sans-serif; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }

/* --- kalkulator energii liniowej i t8/5 --- */
.xc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 28px; align-items: start; }
@media (max-width: 1000px) { .xc-grid { grid-template-columns: 1fr; } }
.xc-form { padding: 24px; display: grid; gap: 14px; }
.xc-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 480px) { .xc-row { grid-template-columns: 1fr; } }
.xc-form label { margin-bottom: 4px; font-size: .86rem; }
.xc-form input, .xc-form select { min-height: 48px; }
.xc-out { padding: 24px; display: grid; gap: 14px; position: sticky; top: 100px; }
.xc-big { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.xc-big div { padding: 14px 16px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); }
.xc-big small { display: block; color: var(--muted); font-size: .76rem; }
.xc-big b { display: block; font: 700 clamp(1.4rem, 3vw, 2rem)/1.15 Unbounded, "Space Grotesk", sans-serif; letter-spacing: -.02em; }
.xc-big em { font-style: normal; font-size: .8rem; color: var(--muted); }
.xc-gauge { position: relative; height: 14px; border-radius: 7px; background: linear-gradient(90deg, #5aa0ff 0%, #57D98A 30%, #57D98A 60%, #FFB547 80%, #FF6B6B 100%); }
.xc-gauge i { position: absolute; top: -5px; width: 4px; height: 24px; border-radius: 2px; background: var(--ink); box-shadow: 0 0 0 2px var(--bg); transition: left .35s cubic-bezier(.16, 1, .3, 1); }
.xc-scale { display: flex; justify-content: space-between; font: 600 .7rem ui-monospace, monospace; color: var(--muted); }
.xc-note { font-size: .84rem; color: var(--muted); margin: 0; }
.xc-note b { color: var(--ink); }
.xc-formula { font: 600 .78rem/1.6 ui-monospace, monospace; color: var(--muted); background: var(--surface); border-radius: 12px; padding: 10px 12px; overflow-x: auto; }

/* --- wydruk: czysta treść bez efektów --- */
@media print {
  .topbar, header.site, .bar, .wa-float, .toast, .modal, .fx-aura, .fx-grain, .fx-glow, .fx-torch, .fx-hint, .fx-marq, .fx-word, .loader, #progress,
  .ix-visor, .xs-top, .skip-link, form, .map-box, .ix-3dbar, .hero-3d, [data-process-lab], footer.site .cols > div:not(:first-child) { display: none !important; }
  html, body { background: #fff !important; color: #111 !important; }
  body { font-size: 11pt; padding: 0 !important; }
  * { animation: none !important; transition: none !important; box-shadow: none !important; text-shadow: none !important; backdrop-filter: none !important; }
  .card, details.faq, .note, .tablewrap { background: #fff !important; border: 1px solid #bbb !important; break-inside: avoid; }
  .gradtext, .counter { color: #b3400b !important; background: none !important; -webkit-text-fill-color: currentColor; }
  .js .rv { opacity: 1 !important; transform: none !important; filter: none !important; }
  details.faq > *:not(summary) { display: block !important; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: .8em; color: #555; }
  section, .sec { padding: 12pt 0 !important; }
  h1, h2, h3 { color: #111 !important; break-after: avoid; }
}
/* nagłówek: bez przepełnienia na wąskich ekranach i tuż po pokazaniu menu (1240–1319 px) */
@media (max-width: 599px) { .head-act .xs-sbtn { display: none; } }
@media (max-width: 399px) { .ix-helmbtn { display: none !important; } }
@media (min-width: 1240px) and (max-width: 1319px) { header.site nav.main a { padding: 8px 5px !important; font-size: .84rem; } }
.drawer .xs-dsearch { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 48px; margin: 4px 0 6px; padding: 10px 16px; border-radius: 16px; border: 1px solid var(--line);
  background: var(--surface-2); color: var(--muted); font: 600 .95rem Manrope, Inter, sans-serif; cursor: pointer; text-align: left; }
.drawer .xs-dsearch svg { width: 18px; height: 18px; color: var(--arc-2); }
@media (min-width: 600px) { .drawer .xs-dsearch { display: none; } }
@media (pointer: coarse) { .xs-pal .xs-hint { display: none; } }
/* przycisk „Zapytaj o wycenę” w nagłówku mieści się w ramce paska */
header.site > .shell { padding-right: 8px !important; overflow: hidden; }
header.site .head-act { flex: none; }
header.site .head-act .btn-sm { min-height: 44px; padding: 0 18px !important; font-size: .86rem; white-space: nowrap; flex: none; }
@media (min-width: 1240px) and (max-width: 1439px) { header.site .head-act .btn-sm { padding: 0 14px !important; font-size: .8rem; } header.site nav.main a { padding: 8px 6px !important; } }
.xs-sbtn span, .xs-sbtn kbd { display: none !important; } .xs-sbtn { width: 44px; padding: 0 !important; justify-content: center; }
@media (min-width: 1440px) { header.site > .shell { width: min(1360px, 100%) !important; } header.site nav.main a { padding: 8px 8px !important; } }
