/**
 * PROCESS SECTION STYLES
 *
 * Contains:
 * - Process Section (work process section)
 * - Process Steps with neon animations
 * - Gradient and glitch effects
 * - Responsive design for process
 *
 * Dependencies: base.css, components.css
 */

/* ===== PROCESS SECTION ===== */
.process {
  padding: var(--space-2xl) var(--space-md);
  color: var(--fg);
  position: relative;
}

.process::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(circle at 20% 50%, oklch(from var(--brand) 0.18 calc(c/2) h / 0.4), transparent 50%),
    radial-gradient(circle at 80% 80%, oklch(from var(--brand) 0.15 calc(c/2) h / 0.3), transparent 50%),
    radial-gradient(circle at 50% 20%, oklch(from var(--brand) 0.12 calc(c/2) h / 0.25), transparent 60%);
  z-index: -1;
}

.process h2 {
  text-align: center;
  font-size: clamp(1.5rem, 4vw, 2.5rem);
  margin-bottom: var(--space-lg);
  color: var(--fg);
}

.process p {
  text-align: center;
  font-size: clamp(1rem, 2vw, 1.25rem);
  color: var(--muted);
  margin-bottom: var(--space-xl);
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}

/* ===== PROCESS HERO SECTION ===== */
.process-hero {
  padding: var(--space-2xl) var(--space-md);
  color: var(--fg);
  position: relative;
}

/* Animation for process section title and description */
.process-hero .section-title,
.process-hero>.container>p {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.process-hero .section-title.animate-in,
.process-hero>.container>p.animate-in {
  opacity: 1;
  transform: translateY(0);
}

/* Respect user's motion preferences */
@media (prefers-reduced-motion: reduce) {

  .process-hero .section-title,
  .process-hero>.container>p {
    opacity: 1;
    transform: translateY(0);
    transition: none;
  }
}

.process-hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(circle at 30% 20%, oklch(from var(--brand) 0.35 calc(c/2) h / 0.6), transparent 50%),
    radial-gradient(circle at 70% 30%, oklch(from var(--brand) 0.3 calc(c/2) h / 0.5), transparent 50%),
    radial-gradient(circle at 15% 70%, oklch(from var(--brand) 0.25 calc(c/2) h / 0.45), transparent 60%);
  z-index: -1;
}

.process-points {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--space-lg);
  max-width: 1200px;
  margin: 0 auto;
}

.process-item {
  background: oklch(from var(--brand) 0.05 calc(c/2) h / 0.05);
  padding: var(--space-lg);
  border-radius: var(--radius-lg);
  border: 1px solid oklch(from var(--brand) 0.3 calc(c/2) h / 0.2);
  text-align: center;
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
  position: relative;
  overflow: hidden;
  will-change: opacity, transform;
  /* Optimize for animations */
}

.process-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, oklch(from var(--brand) 0.3 calc(c/2) h / 0.2), transparent);
  transition: left 0.5s ease;
}

.process-item:hover::before {
  left: 100%;
}

.process-item.animate-in {
  opacity: 1;
  transform: translateY(0);
}

/* Sequential entrance animations for process items */
.process-item:nth-child(1).animate-in {
  transition-delay: 0s;
}

.process-item:nth-child(2).animate-in {
  transition-delay: 0.2s;
}

.process-item:nth-child(3).animate-in {
  transition-delay: 0.4s;
}

/* Sequential animations for process titles */
.process-item:nth-child(1).animate-in .process-title {
  animation: neon-entrance-text 1s ease-out, gradient-shift-1 4s ease-in-out infinite 1s;
}

.process-item:nth-child(2).animate-in .process-title {
  animation: neon-entrance-text 1s ease-out 0.2s, gradient-shift-2 4.5s ease-in-out infinite 1.2s both;
}

.process-item:nth-child(3).animate-in .process-title {
  animation: neon-entrance-text 1s ease-out 0.4s, gradient-shift-3 5s ease-in-out infinite 1.4s both;
}

/* Respect user's motion preferences */
@media (prefers-reduced-motion: reduce) {
  .process-item {
    opacity: 1;
    transform: translateY(0);
    transition: none;
  }

  .process-item::before {
    transition: none;
  }

  .process-title {
    animation: none;
    text-shadow: none;
    transition: none;
  }

  .process-title::before,
  .process-title::after {
    animation: none;
    transition: none;
  }

  .process-item:nth-child(1).animate-in .process-title,
  .process-item:nth-child(2).animate-in .process-title,
  .process-item:nth-child(3).animate-in .process-title {
    animation: none;
  }
}

.process-title {
  display: inline-block;
  margin: 0 auto var(--space-md);
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: var(--font-weight-black);
  line-height: 1.2;
  position: relative;
  color: var(--fg);
  transition: color 0.3s ease, text-shadow 0.3s ease;
}

.process-item p {
  font-size: 1rem;
  color: var(--muted);
  margin-bottom: 0;
  text-align: left;
}

/* ===== PROCESS STEPS ===== */
.process-steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--space-lg);
  margin-top: var(--space-xl);
}

.step {
  text-align: center;
  padding: var(--space-md);
  border-radius: var(--radius-lg);
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
  position: relative;
  will-change: opacity, transform;
  /* Optimize for animations */
}

.step.animate-in {
  opacity: 1;
  transform: translateY(0);
}

/* Respect user's motion preferences */
@media (prefers-reduced-motion: reduce) {
  .step {
    opacity: 1;
    transform: translateY(0);
    transition: none;
  }
}

.step-icon {
  display: inline-block;
  margin: 0 auto var(--space-md);
  font-size: clamp(3rem, 5vw, 4rem);
  font-weight: var(--font-weight-black);
  line-height: 1;
  position: relative;
  background: linear-gradient(135deg,
      var(--brand) 0%,
      oklch(from var(--brand) 0.8 calc(c/2) h) 25%,
      var(--fg) 50%,
      oklch(from var(--brand) 0.8 calc(c/2) h) 75%,
      var(--brand) 100%);
  background-size: 200% 200%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: gradient-shift 3s ease-in-out infinite;
  text-shadow:
    0 0 10px oklch(from var(--brand) 0.5 calc(c/2) h / 0.8),
    0 0 20px oklch(from var(--brand) 0.4 calc(c/2) h / 0.6),
    0 0 30px oklch(from var(--brand) 0.3 calc(c/2) h / 0.4),
    0 0 40px var(--brand);
  transition: transform 0.3s ease, text-shadow 0.3s ease;
}

.step-icon::before {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 3px;
  background: linear-gradient(90deg,
      transparent,
      var(--brand),
      oklch(from var(--brand) 0.8 calc(c/2) h),
      var(--brand),
      transparent);
  border-radius: 2px;
  animation: energy-line 2s ease-in-out infinite;
  transition: width 0.3s ease;
}

.step-icon::after {
  content: attr(data-number);
  position: absolute;
  top: 2px;
  left: 2px;
  font-size: inherit;
  font-weight: inherit;
  background: var(--brand);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  opacity: 0.3;
  z-index: -1;
  animation: glitch-offset 0.3s ease-in-out infinite alternate;
}

.step:hover .step-icon {
  transform: translateY(-2px);
  text-shadow:
    0 0 15px oklch(from var(--brand) 0.6 calc(c/2) h / 0.9),
    0 0 30px oklch(from var(--brand) 0.5 calc(c/2) h / 0.7),
    0 0 45px oklch(from var(--brand) 0.4 calc(c/2) h / 0.5),
    0 0 60px var(--brand);
}

.step:hover .step-icon::before {
  width: 100%;
}

@keyframes gradient-shift {

  0%,
  100% {
    background-position: 0% 50%;
  }

  50% {
    background-position: 100% 50%;
  }
}

@keyframes energy-line {

  0%,
  100% {
    width: 0;
    opacity: 0;
  }

  50% {
    width: 80%;
    opacity: 1;
  }
}

@keyframes glitch-offset {
  0% {
    transform: translate(0, 0);
  }

  100% {
    transform: translate(-2px, 2px);
  }
}

/* Animation for step icons during scroll animation */
.step.animate-in .step-icon {
  animation: neon-entrance 0.8s ease-out;
}

@keyframes neon-entrance {
  0% {
    opacity: 0;
    transform: scale(0.5) translateY(20px);
    filter: blur(10px);
  }

  50% {
    opacity: 0.8;
    transform: scale(1.1) translateY(-5px);
    filter: blur(2px);
  }

  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
    filter: blur(0);
  }
}

/* Unique gradient animations for process titles */
@keyframes gradient-shift-1 {

  0%,
  100% {
    background-position: 0% 50%;
  }

  25% {
    background-position: 100% 25%;
  }

  50% {
    background-position: 100% 50%;
  }

  75% {
    background-position: 0% 75%;
  }
}

@keyframes gradient-shift-2 {

  0%,
  100% {
    background-position: 100% 50%;
  }

  33% {
    background-position: 0% 100%;
  }

  66% {
    background-position: 100% 0%;
  }
}

@keyframes gradient-shift-3 {

  0%,
  100% {
    background-position: 50% 0%;
  }

  20% {
    background-position: 0% 50%;
  }

  40% {
    background-position: 50% 100%;
  }

  60% {
    background-position: 100% 50%;
  }

  80% {
    background-position: 50% 0%;
  }
}

@keyframes energy-line-text {

  0%,
  100% {
    width: 0;
    opacity: 0;
  }

  50% {
    width: 90%;
    opacity: 1;
  }
}

@keyframes glitch-offset-text {
  0% {
    transform: translate(0, 0);
  }

  100% {
    transform: translate(-1px, 1px);
  }
}

@keyframes neon-entrance-text {
  0% {
    opacity: 0;
    transform: scale(0.8) translateY(15px);
    filter: blur(8px);
  }

  50% {
    opacity: 0.7;
    transform: scale(1.05) translateY(-3px);
    filter: blur(1px);
  }

  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
    filter: blur(0);
  }
}

.step h3 {
  margin-bottom: var(--space-sm);
}

.step p {
  color: var(--muted);
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
  .process {
    padding: var(--space-xl) var(--space-md);
  }

  .process-points {
    grid-template-columns: 1fr;
    gap: var(--space-md);
  }

  .process-item {
    padding: var(--space-md);
  }

  .process-title {
    font-size: clamp(1.25rem, 3vw, 1.5rem);
  }

  .step-icon {
    font-size: clamp(2.5rem, 4vw, 3rem);
  }
}

/* Respect user's motion preferences */
@media (prefers-reduced-motion: reduce) {
  .step-icon {
    animation: none;
    text-shadow: none;
    background: var(--brand);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
  }

  .step-icon::before,
  .step-icon::after {
    animation: none;
  }

/* ===== PROGRESSIVE DEGRADATION - PROCESS TITLES ===== */

/* Zmniejsz text-shadow dla mobile */
@media (max-width: 768px) {
  .process-title {
    text-shadow:
      0 0 8px var(--brand),
      0 0 16px var(--brand);
    /* usuń 2 najdalsze cienie */
  }
}

/* Minimalne cienie dla słabych urządzeń */
.low-end-device .process-title,
.old-iphone .process-title {
  text-shadow: 0 0 10px var(--brand);
  /* tylko jeden cień */
}

/* Wyłącz infinite animations na słabych urządzeniach */
.low-end-device .process-item:nth-child(1).animate-in .process-title,
.low-end-device .process-item:nth-child(2).animate-in .process-title,
.low-end-device .process-item:nth-child(3).animate-in .process-title {
  animation: neon-entrance-text 1s ease-out; /* tylko entrance, bez gradient-shift */
}

.old-iphone .process-item:nth-child(1).animate-in .process-title,
.old-iphone .process-item:nth-child(2).animate-in .process-title,
.old-iphone .process-item:nth-child(3).animate-in .process-title {
  animation: none; /* całkowicie bez animacji */
}

/* Spowolnij animacje dla mid-range */
/* Wolniejsze animacje = mniej klatek do wygenerowania */
.mid-range-device .process-item:nth-child(1).animate-in .process-title {
  animation: neon-entrance-text 1s ease-out, gradient-shift-1 6s ease-in-out infinite 1s;
  /* było 4s, teraz 6s */
}

.mid-range-device .process-item:nth-child(2).animate-in .process-title {
  animation: neon-entrance-text 1s ease-out 0.2s, gradient-shift-2 6.5s ease-in-out infinite 1.2s both;
  /* było 4.5s, teraz 6.5s */
}

.mid-range-device .process-item:nth-child(3).animate-in .process-title {
  animation: neon-entrance-text 1s ease-out 0.4s, gradient-shift-3 7s ease-in-out infinite 1.4s both;
  /* było 5s, teraz 7s */
}

/* ===== PROGRESSIVE DEGRADATION - GLITCH EFFECT ===== */

/* Spowolnij glitch na mobile */
@media (max-width: 768px) {
  .process-title::before,
  .process-title::after {
    animation-duration: 0.5s; /* było 0.3s */
  }
}

/* Wyłącz dla słabych urządzeń */
.low-end-device .process-title::before,
.low-end-device .process-title::after,
.old-iphone .process-title::before,
.old-iphone .process-title::after {
  animation: none;
  display: none;
}

/* Zmniejsz intensywność dla mid-range */
.mid-range-device .process-title::before,
.mid-range-device .process-title::after {
  animation-duration: 0.6s;
  opacity: 0.5; /* mniej widoczny efekt */
}
}