/*
 * Webbuy – polish.css
 * Finishing layer on top of base.css + site.css (public site only, loaded last by templates/layout.php).
 * Nothing here changes the layout or the look of a section at rest: it adds motion between pages and themes,
 * a reading-progress hairline, a glass header, the current section in the menu, hover/press feedback and a few
 * scroll-driven details. Every modern feature sits behind @supports / a media query, so an older browser simply
 * shows the site as before. Reduced motion: page/theme transitions are off, the rest is instant (base.css).
 */

/* ------------------------------------------------------------- page transitions */

/* Cross-document View Transitions (Chrome/Edge 126+, Safari 18.2+): a short cross-fade between pages of the
   site instead of a white flash. The browser keeps its own scroll handling – a new page still opens at its top
   or at its #section (site.js „landing position”). Other browsers navigate exactly as before. */
@media (prefers-reduced-motion: no-preference) {
  @view-transition {
    navigation: auto;
  }
}

::view-transition-old(root) {
  animation: zw-vt-out .18s cubic-bezier(.4, 0, 1, 1) both;
}

::view-transition-new(root) {
  animation: zw-vt-in .34s var(--ease-out) both;
}

/* the bar stays put while the page under it changes */
.site-header {
  view-transition-name: zw-header;
}

::view-transition-group(zw-header) {
  animation-duration: .3s;
}

/* theme switch (polish.js): the header takes part in the circle like the rest of the page */
html.vt-theme .site-header {
  view-transition-name: none;
}

html.vt-theme::view-transition-old(root),
html.vt-theme::view-transition-new(root) {
  animation: none;
  mix-blend-mode: normal;
}

html.vt-theme::view-transition-new(root) {
  animation: zw-vt-circle .55s cubic-bezier(.65, 0, .35, 1) both;
}

@keyframes zw-vt-out {
  to {
    opacity: 0;
  }
}

@keyframes zw-vt-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

@keyframes zw-vt-circle {
  from {
    clip-path: circle(0 at var(--vt-x, 50%) var(--vt-y, 0));
  }
  to {
    clip-path: circle(var(--vt-r, 150vmax) at var(--vt-x, 50%) var(--vt-y, 0));
  }
}

/* ------------------------------------------------------------------- header */

/* Glass bar once the page scrolls under it (the solid bar of site.css stays as the fallback). The menu panel
   is position: fixed inside the header and a backdrop-filter would make the header its containing block, so the
   glass is off while the menu is open. */
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .site-header.is-scrolled {
    background-color: color-mix(in srgb, var(--bg) 78%, transparent);
    -webkit-backdrop-filter: saturate(1.6) blur(16px);
    backdrop-filter: saturate(1.6) blur(16px);
  }
  .site-header.is-scrolled[data-tone="dark"] {
    background-color: color-mix(in srgb, var(--band-bg) 90%, transparent);
  }
  html.nav-open .site-header.is-scrolled {
    background-color: var(--bg);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
}

/* reading progress: a honey hairline on the lower edge of the bar, driven by the page scroll itself */
@supports (animation-timeline: scroll()) {
  .site-header::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: 2px;
    background: linear-gradient(90deg, var(--honey-500), var(--honey-300));
    transform-origin: 0 50%;
    transform: scaleX(0);
    opacity: 0;
    pointer-events: none;
    animation: zw-progress linear both;
    animation-timeline: scroll(root block);
  }
  .site-header.is-scrolled::after {
    opacity: 1;
    transition: opacity .3s ease;
  }
  html.nav-open .site-header::after {
    opacity: 0;
  }
}

@keyframes zw-progress {
  to {
    transform: scaleX(1);
  }
}

/* current section in the menu (polish.js marks it while the home page scrolls) */
.site-nav__link.is-active {
  color: var(--text);
}

.site-nav__link.is-active::after {
  height: 2px;
  background: var(--accent);
  transform: scaleX(1);
}

/* phone menu: a honey marker at the end of the current section's row */
.mobile-nav__link.is-active::after {
  content: "";
  flex: none;
  align-self: center;
  width: 8px;
  height: 8px;
  margin-left: auto;
  border-radius: 2px;
  background: var(--accent);
}

/* the language list opens with a short fade instead of popping in */
@supports (transition-behavior: allow-discrete) {
  ul.lang-menu__list {
    transition: opacity .18s ease, translate .22s var(--ease-out);
  }
  @starting-style {
    .lang-menu[open] ul.lang-menu__list {
      opacity: 0;
      translate: 0 -6px;
    }
  }
}

.theme-toggle .icon {
  transition: transform .5s var(--ease-out);
}

.theme-toggle:hover .icon {
  transform: rotate(-18deg);
}

.theme-toggle:active,
.lang-menu__toggle:active,
.nav-toggle:active {
  transform: scale(.96);
}

/* mobile menu: the links follow the panel in a short cascade */
@media (prefers-reduced-motion: no-preference) {
  .mobile-nav__list > li,
  .mobile-nav__cta,
  .mobile-nav__meta {
    animation: zw-menu-item .45s var(--ease-out) both;
  }
  .mobile-nav__list > li:nth-child(2) { animation-delay: 30ms; }
  .mobile-nav__list > li:nth-child(3) { animation-delay: 60ms; }
  .mobile-nav__list > li:nth-child(4) { animation-delay: 90ms; }
  .mobile-nav__list > li:nth-child(5) { animation-delay: 120ms; }
  .mobile-nav__list > li:nth-child(6) { animation-delay: 150ms; }
  .mobile-nav__list > li:nth-child(n + 7) { animation-delay: 180ms; }
  .mobile-nav__cta { animation-delay: 200ms; }
  .mobile-nav__meta { animation-delay: 240ms; }
}

@keyframes zw-menu-item {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

.mobile-nav__link {
  transition: color .2s ease, padding-left .3s var(--ease-out);
}

.mobile-nav__link:active {
  color: var(--accent-ink);
}

/* ------------------------------------------------------------------ buttons */

/* hover: the button lifts a little and the primary one gets a warm glow; press: it sinks back */
@media (hover: hover) and (pointer: fine) {
  .btn--primary:hover {
    box-shadow: 0 10px 24px -10px color-mix(in srgb, var(--honey-500) 75%, transparent),
      inset 0 1px 0 rgb(255 255 255 / .35);
    transform: translateY(-1px);
  }
  .btn--ink:hover {
    box-shadow: 0 10px 24px -12px color-mix(in srgb, var(--text) 60%, transparent);
    transform: translateY(-1px);
  }
  .btn--secondary:hover {
    transform: translateY(-1px);
  }
}

.btn:active,
.btn--primary:active,
.btn--ink:active,
.btn--secondary:active {
  transform: translateY(0) scale(.985);
  box-shadow: none;
  transition-duration: .08s;
}

/* a quiet shine across the big honey buttons (hero, contact band, order); once per hover */
@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  .btn--primary.btn--lg {
    overflow: hidden;
    isolation: isolate;
  }
  .btn--primary.btn--lg:not([aria-busy="true"])::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: linear-gradient(105deg, transparent 35%, rgb(255 255 255 / .38) 50%, transparent 65%);
    transform: translateX(-120%);
    pointer-events: none;
  }
  .btn--primary.btn--lg:hover::before {
    transform: translateX(120%);
    transition: transform .8s var(--ease-out);
  }
}

/* text links: a calmer underline everywhere */
a {
  text-underline-offset: .18em;
  text-decoration-thickness: from-font;
}

/* -------------------------------------------------------------------- hero */

/* a soft honey light behind the devices – the band itself keeps its navy */
.hero {
  position: relative;
  isolation: isolate;
}

.hero::before {
  content: "";
  position: absolute;
  top: -8%;
  right: -14%;
  z-index: -1;
  width: min(1200px, 78vw);
  aspect-ratio: 1;
  background:
    radial-gradient(closest-side circle at 50% 50%, color-mix(in srgb, var(--honey-400) 12%, transparent), transparent 75%),
    radial-gradient(closest-side circle at 50% 50%, color-mix(in srgb, var(--navy-600) 55%, transparent), transparent);
  pointer-events: none;
}

@media (max-width: 1023.98px) {
  .hero::before {
    top: auto;
    right: -40%;
    bottom: -10%;
    width: 150vw;
  }
}

/* -------------------------------------------------------- cards and rows */

@media (hover: hover) and (pointer: fine) and (min-width: 1024px) {
  .plan {
    transition: transform .45s var(--ease-out), box-shadow .45s var(--ease-out), border-color .3s ease;
  }
  .plan:hover {
    transform: translateY(-6px);
    border-color: var(--line-strong);
    box-shadow: var(--shadow-2);
  }
  .plan--featured:hover {
    border-color: transparent;
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--honey-400) 60%, transparent),
      0 50px 80px -40px rgb(7 15 30 / .7);
  }
}

/* features: the small UI fragment lifts towards the reader */
.feature__ui > * {
  transition: transform .45s var(--ease-out), box-shadow .45s var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .feature:hover .feature__ui > * {
    transform: translateY(-3px);
    box-shadow: var(--shadow-2);
  }
  .feature__n {
    transition: transform .35s var(--ease-out);
  }
  .feature:hover .feature__n {
    transform: translateX(3px);
  }
}

/* case studies: on hover the devices separate a little in depth (laptop, then phone, then panel) */
.spread__laptop,
.spread__phone,
.spread__panel {
  transition: transform .9s var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .spread__stage:hover .spread__laptop {
    transform: scale(1.012);
  }
  .spread__stage:hover .spread__phone {
    transform: translateY(-8px);
  }
  .spread__stage:hover .spread__panel {
    transform: translateY(-14px);
  }
}

/* audience: the honey bars fill in when their column scrolls in */
html.js.reveal-ready .audience__bar {
  transform-origin: 0 50%;
  transition: transform 1s var(--ease-out) .25s;
}

html.js.reveal-ready .audience__item:not(.is-visible) .audience__bar {
  transform: scaleX(0);
}

/* process: each step lights up in turn as it comes in */
html.js.reveal-ready .timeline__step .timeline__node {
  transition: background-color .4s ease, border-color .4s ease, transform .4s var(--ease-out);
  transition-delay: calc(var(--reveal-i, 0) * 140ms + 300ms);
}

html.js.reveal-ready .timeline__step.is-visible .timeline__node {
  background: var(--accent);
  border-color: var(--accent);
}

.timeline__n {
  transition: color .4s ease;
  transition-delay: calc(var(--reveal-i, 0) * 140ms + 300ms);
}

html.js.reveal-ready .timeline__step.is-visible .timeline__n {
  color: color-mix(in srgb, var(--line-strong) 70%, var(--accent));
}

/* …and a honey line runs along the timeline with the scroll */
@supports (animation-timeline: view()) {
  .timeline::after {
    content: "";
    position: absolute;
    top: 6px;
    bottom: 6px;
    left: 5px;
    width: 1px;
    background: var(--accent);
    transform-origin: 50% 0;
    animation: zw-line-y linear both;
    animation-timeline: view();
    animation-range: entry 30% cover 65%;
    pointer-events: none;
  }
  @media (min-width: 1024px) {
    .timeline::after {
      top: 5px;
      bottom: auto;
      left: 0;
      right: 0;
      width: auto;
      height: 1px;
      transform-origin: 0 50%;
      animation-name: zw-line-x;
    }
  }
}

@keyframes zw-line-y {
  from {
    transform: scaleY(0);
  }
}

@keyframes zw-line-x {
  from {
    transform: scaleX(0);
  }
}

/* FAQ: the answer fades in while the row opens (the height animation is in site.css) */
.qa__a {
  transition: opacity .35s ease .05s, translate .4s var(--ease-out);
}

.qa:not([open]) .qa__a {
  opacity: 0;
  translate: 0 -4px;
}

@media (hover: hover) and (pointer: fine) {
  .qa__q:hover .qa__icon {
    border-color: var(--line-strong);
  }
}

/* footer: links get the same drawn underline as the main menu */
@media (hover: hover) and (pointer: fine) {
  .site-footer__list a:not(.link-arrow),
  .site-footer__legal a {
    text-decoration: underline;
    text-decoration-color: transparent;
    text-decoration-thickness: 1px;
    text-underline-offset: .25em;
    transition: color .2s ease, text-decoration-color .25s ease;
  }
  .site-footer__list a:not(.link-arrow):hover,
  .site-footer__legal a:hover {
    text-decoration-color: currentColor;
  }
}

/* ------------------------------------------------------------------ details */

/* scrollbars in the colours of the page (thin thumb, light and dark) */
html {
  scrollbar-color: color-mix(in srgb, var(--text) 28%, transparent) var(--bg);
}

@media print {
  .site-header::after,
  .hero::before {
    display: none;
  }
}

@media (forced-colors: active) {
  .site-header::after,
  .hero::before,
  .timeline::after {
    display: none;
  }
}

/* ------------------------------------------------------------- back to top */

/* round button bottom-right on long pages (polish.js); above the cookie note while that is shown (--note-h) */
.to-top {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: calc(max(16px, env(safe-area-inset-bottom)) + var(--note-h, 0px));
  z-index: 45;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-2);
  color: var(--text);
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px) scale(.9);
  transition: opacity .3s ease, transform .4s var(--ease-out), visibility 0s linear .4s, border-color .2s ease;
  -webkit-tap-highlight-color: transparent;
}

@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .to-top {
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
  }
}

.to-top.is-shown {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition: opacity .3s ease, transform .4s var(--ease-out), visibility 0s, border-color .2s ease;
}

.to-top svg {
  grid-area: 1 / 1;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.to-top__arrow {
  width: 20px;
  height: 20px;
  stroke-width: 2;
  transition: transform .3s var(--ease-out);
}

.to-top__ring {
  width: 48px;
  height: 48px;
  margin: -1px;
  transform: rotate(-90deg);
  stroke: var(--accent);
  stroke-width: 2.5;
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  opacity: 0;
}

@supports (animation-timeline: scroll()) {
  .to-top__ring {
    opacity: 1;
    animation: zw-ring linear both;
    animation-timeline: scroll(root block);
  }
}

@keyframes zw-ring {
  to {
    stroke-dashoffset: 0;
  }
}

@media (hover: hover) and (pointer: fine) {
  .to-top:hover {
    border-color: var(--line-strong);
  }
  .to-top:hover .to-top__arrow {
    transform: translateY(-2px);
  }
}

.to-top:active {
  transform: scale(.94);
}

html.nav-open .to-top {
  display: none;
}

@media print {
  .to-top {
    display: none;
  }
}

/* ------------------------------------------------------- automation (#automation) */

/* The seven steps used to sit in seven narrow columns on wide screens: tiny cards, short broken lines.
   From 720 px they are rows of a vertical chain instead: number and title, a readable text, and the small UI
   fragment on the right at a comfortable size. From 1024 px the section head stays on the left (sticky) and the
   chain runs on the right. The phone layout (below 720 px) is unchanged. */
@media (min-width: 720px) {
  .flow {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: none;
    column-gap: 0;
    --node: 22px;
  }
  .flow::before,
  .flow::after {
    left: calc(var(--node) / 2 - .5px);
    right: auto;
    top: 12px;
    bottom: 12px;
    width: 1px;
    height: auto;
  }
  .flow::after {
    transform: scaleY(0);
    transform-origin: top;
  }
  .flow.is-drawn::after,
  html.no-js .flow::after {
    transform: none;
  }
  .flow__step {
    grid-row: auto;
    grid-template-columns: var(--node) minmax(0, 1fr) minmax(0, 236px);
    grid-template-rows: auto auto;
    column-gap: 24px;
    row-gap: 0;
    align-content: start;
    padding: 0 0 22px;
    margin-bottom: 22px;
    border-bottom: 1px solid var(--line);
  }
  .flow__step:last-child {
    margin-bottom: 0;
    border-bottom: 0;
  }
  .flow__node {
    grid-column: 1;
    grid-row: 1 / span 2;
    margin-top: 0;
  }
  .flow__n {
    position: static;
    display: none;
  }
  .flow__title {
    grid-column: 2;
    grid-row: 1;
    display: flex;
    align-items: baseline;
    gap: 14px;
    font-size: clamp(1.125rem, 1.05rem + .3vw, 1.3125rem);
    line-height: 1.3;
  }
  .flow__title::before {
    content: counter(zw-flow, decimal-leading-zero);
    content: counter(zw-flow, decimal-leading-zero) / "";
    flex: none;
    font-family: var(--font-body);
    font-size: .75rem;
    font-weight: 600;
    letter-spacing: .12em;
    color: var(--accent);
    font-variant-numeric: tabular-nums;
  }
  .flow {
    counter-reset: zw-flow;
  }
  .flow__step {
    counter-increment: zw-flow;
  }
  .flow__text {
    grid-column: 2;
    grid-row: 2;
    margin-top: 8px;
    max-width: 34em;
    font-size: .9844rem;
    line-height: 1.6;
  }
  .flow__ui {
    grid-column: 3;
    grid-row: 1 / span 2;
    align-self: center;
    justify-content: flex-start;
    height: auto;
    min-height: 0;
    margin: 0;
  }
  .flow .fui {
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 12px;
    font-size: .875rem;
    line-height: 1.3;
    white-space: normal;
    box-shadow: 0 10px 24px -14px rgb(0 0 0 / .6);
  }
  .flow .fui > span {
    overflow: visible;
  }
  .flow .fui--form {
    flex-direction: row;
    align-items: center;
    width: auto;
  }
  .flow .fui--mail,
  .flow .fui--push {
    flex-wrap: nowrap;
    align-items: flex-start;
  }
  .flow .fui--mail .icon,
  .flow .fui--push .icon {
    margin-top: 2px;
  }
  .flow .fui__ok,
  .flow .fui__no {
    padding: 5px 10px;
  }
  .flow__sample {
    margin-top: 32px;
  }
}

@media (min-width: 1024px) {
  .automation > .container {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    grid-template-rows: auto 1fr auto;
    column-gap: var(--grid-gap);
    align-items: start;
  }
  .automation__head {
    grid-column: 1 / span 5;
    grid-row: 1;
    margin-bottom: 0;
  }
  .flow {
    grid-column: 7 / span 6;
    grid-row: 1 / span 2;
  }
  .flow__sample {
    grid-column: 7 / span 6;
    grid-row: 3;
    justify-self: start;
  }
  /* „Co jeszcze dzieje się samo” fills the left column under the head instead of a third block below */
  .automation__more {
    grid-column: 1 / span 5;
    grid-row: 2;
    grid-template-columns: minmax(0, 1fr);
    gap: 18px;
    margin-top: clamp(40px, 5vw, 64px);
  }
  .automation__more-title {
    grid-column: 1;
    font-size: clamp(1.25rem, 1.1rem + .5vw, 1.5rem);
  }
  .automation__more-list {
    grid-column: 1;
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
    font-size: 1rem;
  }
}

/* ---------------------------------------------------------- pricing cards */

/* A package card shows its five key points; the rest of the list and a long module list fold into
   „Pełna lista (n)” / „Lista modułów (n)” (templates/partials/pricing.php). Everything is still in the HTML,
   so search engines and the comparison table below see the full scope. */
.plan__more {
  margin-top: 14px;
}

.plan__more-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  font-size: .875rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  list-style: none;
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, currentColor 35%, transparent);
  text-decoration-thickness: 1px;
  text-underline-offset: .25em;
  transition: text-decoration-color .2s ease;
}

.plan__more-toggle::-webkit-details-marker {
  display: none;
}

.plan__more-toggle:hover {
  text-decoration-color: currentColor;
}

.plan__more-toggle .icon {
  width: 16px;
  height: 16px;
  color: var(--accent-ink);
  transition: transform .3s var(--ease-out);
}

.plan--featured .plan__more-toggle .icon {
  color: var(--accent);
}

.plan__more[open] > .plan__more-toggle .icon {
  transform: rotate(180deg);
}

.plan__features--more {
  margin-top: 12px;
}

.plan__more--inc {
  margin-top: 0;
}

.plan__more--inc > .plan__inc-list {
  margin-top: 10px;
}

.plan__more::details-content {
  block-size: 0;
  overflow: clip;
  transition: block-size .35s var(--ease-out), content-visibility .35s allow-discrete;
}

.plan__more[open]::details-content {
  block-size: auto;
}
