/* ============================================================
   MOTION, PROCESS SECTION, CONSENT BANNER, LEGAL PAGE
   Loaded after the theme. Scroll effects are declared in the markup with
   data-* attributes and driven by js/animations.js; the hidden starting
   states apply only under html.motion-ready, which the inline script in
   <head> sets unless the visitor prefers reduced motion, so the page is
   complete without JavaScript.
   ============================================================ */

:root {
  --ease-out: cubic-bezier(0.2, 0.7, 0.2, 1);
  --reveal-distance: 24px;
  --stagger-step: 60ms;
}

/* ---- Reveal: fade and rise, or slide in from a side ---- */
.motion-ready [data-reveal] {
  opacity: 0;
  transform: translate3d(0, var(--reveal-distance), 0);
  transition:
    opacity 0.7s var(--ease-out),
    transform 0.7s var(--ease-out);
  transition-delay: calc(var(--i, 0) * var(--stagger-step));
}

.motion-ready [data-reveal="left"] {
  transform: translate3d(calc(var(--reveal-distance) * -1.5), 0, 0);
}

.motion-ready [data-reveal="right"] {
  transform: translate3d(calc(var(--reveal-distance) * 1.5), 0, 0);
}

.motion-ready [data-reveal].in {
  opacity: 1;
  transform: none;
}

/* ---- Curtain: a photo uncovered from the bottom up ----
   The clip goes on the <picture> inside, never on the observed element:
   Chrome counts an element's own clip-path, so a fully clipped element
   never intersects and would stay covered. */
.motion-ready [data-curtain] > picture {
  clip-path: inset(100% 0 0 0);
  transition: clip-path 0.9s var(--ease-out);
  transition-delay: calc(var(--i, 0) * var(--stagger-step));
}

.motion-ready [data-curtain] img {
  transform: scale(1.12);
  transition: transform 1.4s var(--ease-out);
  transition-delay: calc(var(--i, 0) * var(--stagger-step));
}

.motion-ready [data-curtain].in > picture {
  clip-path: inset(0 0 0 0);
}

.motion-ready [data-curtain].in img {
  transform: scale(1);
}

/* The gallery's own hover zoom takes over once the curtain is up. */
.motion-ready .gallery-item[data-curtain].in:hover img {
  transform: scale(1.05);
}

/* ---- Hero: photo drifts slower than the page, text eases away ---- */
@supports (animation-timeline: scroll()) {
  @media (prefers-reduced-motion: no-preference) {
    .theme-kg .hero-image img {
      animation: hero-drift linear both;
      animation-timeline: scroll(root);
      animation-range: 0 100vh;
    }

    .theme-kg .hero-content {
      animation: hero-recede linear both;
      animation-timeline: scroll(root);
      animation-range: 0 80vh;
    }
  }
}

/* Scaled up 12 %, the photo's top edge sits 6 % above the frame, so a 6 %
   downward drift never opens a gap. */
@keyframes hero-drift {
  from { transform: scale(1.12); }
  to { transform: translate3d(0, 6%, 0) scale(1.12); }
}

@keyframes hero-recede {
  to { opacity: 0.25; transform: translate3d(0, -48px, 0); }
}

/* ============================================================
   PROCESS — "Jak pracujemy"
   A line runs down the left of the steps and draws with scroll
   (--draw, 0 to 1, set by js/animations.js); each step lights up as the
   line reaches it.
   ============================================================ */
.process {
  background: var(--kg-footer-bg, #1A1A1A);
  color: #FFFFFF;
  padding: 100px 0;
}

.process .section-tag,
.process .section-title {
  color: #FFFFFF;
}

.process .section-desc {
  color: rgba(255, 255, 255, 0.65);
}

.theme-kg .process .section-tag::after {
  background: rgba(255, 255, 255, 0.5);
}

.process-steps {
  --draw: 0;
  position: relative;
  max-width: 760px;
  margin: 0 auto;
  padding-left: 56px;
  list-style: none;
}

.process-steps::before,
.process-line {
  content: '';
  position: absolute;
  left: 15px;
  top: 8px;
  bottom: 8px;
  width: 1px;
}

.process-steps::before {
  background: rgba(255, 255, 255, 0.15);
}

.process-line {
  background: #FFFFFF;
  transform-origin: top;
  transform: scaleY(var(--draw));
}

.process-step {
  position: relative;
  padding-bottom: 56px;
}

.process-step:last-child {
  padding-bottom: 0;
}

.process-step::before {
  content: attr(data-number);
  position: absolute;
  left: -56px;
  top: 0;
  width: 31px;
  height: 31px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--kg-footer-bg, #1A1A1A);
  border: 1px solid rgba(255, 255, 255, 0.35);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.7);
  transition: background 0.4s var(--ease-out), color 0.4s var(--ease-out), border-color 0.4s var(--ease-out);
}

.process-step h3 {
  font-size: 1rem;
  margin-bottom: 10px;
  color: #FFFFFF;
}

.process-step p {
  color: rgba(255, 255, 255, 0.65);
  line-height: 1.7;
  max-width: 560px;
}

.motion-ready .process-step {
  opacity: 0;
  transform: translate3d(-12px, 0, 0);
  transition: opacity 0.6s var(--ease-out), transform 0.6s var(--ease-out);
}

.motion-ready .process-step.in {
  opacity: 1;
  transform: none;
}

/* Theme greys that fall short of 4.5:1 on small text. */
.theme-kg .stats .stat-label {
  color: var(--text-secondary);
}

.footer-legal {
  text-align: center;
  padding: 8px 0 0;
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.6);
}

.process-step.in::before,
html:not(.motion-ready) .process-step::before {
  background: #FFFFFF;
  border-color: #FFFFFF;
  color: #121212;
}

html:not(.motion-ready) .process-steps {
  --draw: 1;
}

@media (max-width: 640px) {
  .process {
    padding: 72px 0;
  }

  .process-steps {
    padding-left: 48px;
  }

  .process-step::before {
    left: -48px;
  }
}

/* ============================================================
   CONSENT BANNER
   ============================================================ */
.consent {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 1000;
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 20px 24px;
  background: #121212;
  color: rgba(255, 255, 255, 0.85);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
  opacity: 0;
  transform: translate3d(0, 16px, 0);
  transition: opacity 0.3s var(--ease-out), transform 0.3s var(--ease-out);
}

.consent.open {
  opacity: 1;
  transform: none;
}

.consent-text {
  font-size: 0.875rem;
  line-height: 1.6;
  flex: 1;
}

.consent-text a {
  color: #FFFFFF;
  text-decoration: underline;
}

.consent-actions {
  display: flex;
  gap: 12px;
  flex-shrink: 0;
}

.theme-kg .consent .btn-secondary {
  color: #FFFFFF;
  border-color: rgba(255, 255, 255, 0.35);
  padding: 10px 18px;
}

.theme-kg .consent .btn-secondary:hover {
  border-color: #FFFFFF;
  color: #FFFFFF;
}

.theme-kg .consent .btn-primary {
  color: #121212;
  background: #FFFFFF;
  border: 1px solid #FFFFFF;
  padding: 10px 18px;
}

.theme-kg .consent .btn-primary:hover {
  background: rgba(255, 255, 255, 0.85);
  color: #121212;
}

@media (max-width: 640px) {
  .consent {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
  }

  .consent-actions .btn {
    flex: 1;
    justify-content: center;
  }
}

/* ---- Footer links (privacy, cookie settings) ---- */
.footer-links {
  display: flex;
  justify-content: center;
  gap: 20px;
  padding-top: 12px;
  font-size: 0.75rem;
}

.footer-links a,
.footer-link {
  color: rgba(255, 255, 255, 0.55);
  text-decoration: none;
  font-size: 0.85rem;
}

.footer-links a:hover,
.footer-link:hover {
  color: #FFFFFF;
}

/* ============================================================
   LEGAL PAGE
   ============================================================ */
.legal {
  padding: calc(var(--nav-height, 72px) + 64px) 0 96px;
}

.legal-inner {
  max-width: 760px;
}

.legal h1 {
  margin-bottom: 8px;
}

.legal-updated {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-bottom: 48px;
}

.legal h2 {
  font-size: 0.95rem;
  margin: 40px 0 14px;
}

.legal p,
.legal li {
  color: var(--text-secondary);
  line-height: 1.75;
}

.legal ul {
  padding-left: 20px;
  margin: 12px 0;
}

.legal li + li {
  margin-top: 8px;
}

.legal a:not(.btn) {
  color: var(--kg-black, #121212);
  text-decoration: underline;
}

/* ---- Reduced motion: everything in place, nothing moves ---- */
@media (prefers-reduced-motion: reduce) {
  .consent {
    transition: none;
  }
}
