/* #14 Spotlight */
.spotlight {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background: radial-gradient(
    600px circle at var(--mouse-x) var(--mouse-y),
    rgba(124, 92, 255, 0.08),
    transparent 40%
  );
  transition: opacity 0.3s;
}

[data-theme='light'] .spotlight {
  background: radial-gradient(
    600px circle at var(--mouse-x) var(--mouse-y),
    rgba(91, 63, 212, 0.06),
    transparent 40%
  );
}

/* #19 Custom cursor */
.cursor-ring,
.cursor-dot {
  position: fixed;
  pointer-events: none;
  z-index: 9999;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.2s, height 0.2s, border-color 0.2s, background 0.2s;
}

.cursor-ring {
  width: 40px;
  height: 40px;
  border: 1.5px solid var(--accent);
  opacity: 0.6;
}

.cursor-dot {
  width: 6px;
  height: 6px;
  background: var(--accent-2);
}

body.cursor-hover .cursor-ring {
  width: 56px;
  height: 56px;
  border-color: var(--accent-2);
  opacity: 0.9;
}

/* #6 Scroll progress */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 1001;
  background: transparent;
}

.scroll-progress__bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2), var(--accent-3));
  box-shadow: 0 0 12px var(--glow);
  transform-origin: left;
}

@supports (animation-timeline: scroll()) {
  .scroll-progress__bar {
    animation: scroll-progress linear forwards;
    animation-timeline: scroll();
  }

  @keyframes scroll-progress {
    from { width: 0%; }
    to { width: 100%; }
  }
}

/* #11 Glassmorphism */
.glass {
  background: var(--surface);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

/* #13 Neon glow text */
.neon-text {
  color: #ddd6ff;
  background: linear-gradient(135deg, #e9e0ff 0%, #5eead4 50%, #fbcfe8 100%);
  background-size: 200% 200%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: neon-shift 4s ease infinite;
  filter: drop-shadow(0 0 28px rgba(124, 92, 255, 0.65)) drop-shadow(0 0 8px rgba(94, 234, 212, 0.4));
}

[data-theme='light'] .neon-text {
  background: linear-gradient(135deg, #5b3fd4 0%, #00a884 50%, #e0457a 100%);
  filter: drop-shadow(0 0 16px rgba(91, 63, 212, 0.35));
}

@keyframes neon-shift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

/* #9 Text reveal */
.reveal-text {
  display: inline-block;
  opacity: 0;
  transform: translateY(24px);
  animation: reveal-up 0.8s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.reveal-text:nth-child(2) { animation-delay: 0.1s; }
.reveal-text:nth-child(3) { animation-delay: 0.2s; }

.hero__title .reveal-text:nth-child(1) { animation-delay: 0.15s; }
.hero__title .reveal-text:nth-child(2) { animation-delay: 0.35s; }

.hero__eyebrow.reveal-text { animation-delay: 0.05s; }
.hero__subtitle.reveal-text { animation-delay: 0.45s; }
.hero__actions.reveal-text { animation-delay: 0.6s; }

@keyframes reveal-up {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* #8 Blob morphing */
.hero__blob {
  position: absolute;
  border-radius: 40% 60% 70% 30% / 40% 50% 60% 50%;
  filter: blur(60px);
  opacity: 0.5;
  animation: blob-morph 12s ease-in-out infinite;
  pointer-events: none;
}

.hero__blob--1 {
  width: 420px;
  height: 420px;
  background: var(--accent);
  top: 10%;
  left: -5%;
  animation-delay: 0s;
}

.hero__blob--2 {
  width: 350px;
  height: 350px;
  background: var(--accent-2);
  bottom: 5%;
  right: 10%;
  animation-delay: -4s;
}

@keyframes blob-morph {
  0%, 100% {
    border-radius: 40% 60% 70% 30% / 40% 50% 60% 50%;
    transform: translate(0, 0) rotate(0deg);
  }
  33% {
    border-radius: 70% 30% 50% 50% / 30% 60% 40% 70%;
    transform: translate(30px, -20px) rotate(120deg);
  }
  66% {
    border-radius: 50% 60% 30% 70% / 60% 40% 70% 30%;
    transform: translate(-20px, 30px) rotate(240deg);
  }
}

/* #12 Gradient mesh */
.hero__mesh {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 20% 30%, rgba(124, 92, 255, 0.25), transparent),
    radial-gradient(ellipse 60% 50% at 80% 70%, rgba(0, 212, 170, 0.15), transparent),
    radial-gradient(ellipse 50% 40% at 50% 50%, rgba(255, 107, 157, 0.1), transparent);
  animation: mesh-drift 20s ease-in-out infinite alternate;
}

@keyframes mesh-drift {
  from { transform: scale(1) rotate(0deg); }
  to { transform: scale(1.1) rotate(3deg); }
}

.hero:not(.is-inview) .hero__blob,
.hero:not(.is-inview) .hero__mesh,
.hero:not(.is-inview) .neon-text {
  animation-play-state: paused;
}

[data-theme='light'] .hero__mesh {
  opacity: 0.7;
}

/* #10 Marquee */
.marquee-section {
  padding: 1.5rem 0;
  border-block: 1px solid var(--border);
  overflow: hidden;
  background: var(--bg-elevated);
}

.marquee {
  overflow: hidden;
  mask-image: linear-gradient(90deg, transparent, black 10%, black 90%, transparent);
}

.marquee__track {
  display: flex;
  gap: 3rem;
  width: max-content;
  animation: marquee 30s linear infinite;
}

.marquee__track span {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.marquee__track span:nth-child(odd) {
  color: var(--accent);
}

@keyframes marquee {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

.marquee-section:not(.is-inview) .marquee__track {
  animation-play-state: paused;
}

/* #15 Clip-path morph — zawsze 8 wierzchołków; sześciokąt = pary punktów w tym samym miejscu */
.clip-reveal {
  clip-path: polygon(
    50% 0%, 50% 0%,
    100% 25%, 100% 75%,
    50% 100%, 50% 100%,
    0% 75%, 0% 25%
  );
  transition: clip-path 350ms ease-in-out;
  will-change: clip-path;
}

.about__photo-wrap:hover .clip-reveal {
  clip-path: polygon(
    30% 0%, 70% 0%,
    100% 30%, 100% 70%,
    70% 100%, 30% 100%,
    0% 70%, 0% 30%
  );
}

.about__photo-ring {
  position: absolute;
  inset: -8px;
  border: 2px solid transparent;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)) border-box;
  -webkit-mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: ring-spin 8s linear infinite;
  clip-path: polygon(
    50% 0%, 50% 0%,
    100% 25%, 100% 75%,
    50% 100%, 50% 100%,
    0% 75%, 0% 25%
  );
  transition: clip-path 350ms ease-in-out;
  will-change: clip-path;
}

.about__photo-wrap:hover .about__photo-ring {
  clip-path: polygon(
    30% 0%, 70% 0%,
    100% 30%, 100% 70%,
    70% 100%, 30% 100%,
    0% 70%, 0% 30%
  );
}

@keyframes ring-spin {
  to { transform: rotate(360deg); }
}

.about:not(.is-inview) .about__photo-ring {
  animation-play-state: paused;
}

body.is-page-hidden .hero__blob,
body.is-page-hidden .hero__mesh,
body.is-page-hidden .neon-text,
body.is-page-hidden .marquee__track,
body.is-page-hidden .about__photo-ring {
  animation-play-state: paused;
}

/* #5 Flip card */
.flip-card {
  perspective: 1000px;
  height: 100%;
  min-height: 200px;
}

.flip-card__inner {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: inherit;
  transition: transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
  transform-style: preserve-3d;
}

.flip-card:hover .flip-card__inner,
.flip-card:focus-within .flip-card__inner,
.flip-card.is-flipped .flip-card__inner {
  transform: rotateY(180deg);
}

.flip-card__front,
.flip-card__back {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-radius: var(--radius-lg);
}

.flip-card__front {
  background: linear-gradient(160deg, rgba(124, 92, 255, 0.08), transparent 60%);
}

.flip-card__back {
  transform: rotateY(180deg);
  background: linear-gradient(135deg, rgba(124, 92, 255, 0.15), rgba(0, 212, 170, 0.1));
  gap: 0.75rem;
}

/* #3 Tilt 3D */
.project-card {
  transform-style: preserve-3d;
  transition: transform 0.15s ease-out, box-shadow 0.3s ease;
  will-change: transform;
}

.project-card.is-tilting {
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.3),
    0 0 40px var(--glow);
}

/* #7 Stagger list */
.stagger-list li,
.stagger-list .skill-tag {
  opacity: 0;
  transform: translateY(16px);
}

.stagger-list.is-visible li,
.stagger-list.is-visible .skill-tag {
  animation: stagger-in 0.5s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.stagger-list.is-visible li:nth-child(1),
.stagger-list.is-visible .skill-tag:nth-child(1) { animation-delay: 0.05s; }
.stagger-list.is-visible li:nth-child(2),
.stagger-list.is-visible .skill-tag:nth-child(2) { animation-delay: 0.1s; }
.stagger-list.is-visible li:nth-child(3),
.stagger-list.is-visible .skill-tag:nth-child(3) { animation-delay: 0.15s; }
.stagger-list.is-visible li:nth-child(4),
.stagger-list.is-visible .skill-tag:nth-child(4) { animation-delay: 0.2s; }
.stagger-list.is-visible li:nth-child(5),
.stagger-list.is-visible .skill-tag:nth-child(5) { animation-delay: 0.25s; }
.stagger-list.is-visible li:nth-child(6),
.stagger-list.is-visible .skill-tag:nth-child(6) { animation-delay: 0.3s; }
.stagger-list.is-visible li:nth-child(7),
.stagger-list.is-visible .skill-tag:nth-child(7) { animation-delay: 0.35s; }
.stagger-list.is-visible li:nth-child(8),
.stagger-list.is-visible .skill-tag:nth-child(8) { animation-delay: 0.4s; }
.stagger-list.is-visible li:nth-child(9),
.stagger-list.is-visible .skill-tag:nth-child(9) { animation-delay: 0.45s; }
.stagger-list.is-visible li:nth-child(10),
.stagger-list.is-visible .skill-tag:nth-child(10) { animation-delay: 0.5s; }
.stagger-list.is-visible li:nth-child(11),
.stagger-list.is-visible .skill-tag:nth-child(11) { animation-delay: 0.55s; }
.stagger-list.is-visible li:nth-child(12),
.stagger-list.is-visible .skill-tag:nth-child(12) { animation-delay: 0.6s; }

@keyframes stagger-in {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Scroll reveal */
.scroll-reveal {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

.scroll-reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* #2 Globe 3D — WebGL canvas (see js/globe.js) */
.globe-scene {
  perspective: none;
  width: 300px;
  height: 300px;
  margin: 0 auto;
  cursor: grab;
  touch-action: none;
}

.globe-scene canvas {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
}

.globe-scene.is-dragging {
  cursor: grabbing;
}

/* #20 Theme toggle */
.theme-toggle {
  background: none;
  border: none;
  cursor: none;
  padding: 4px;
}

@media (pointer: coarse) {
  .theme-toggle { cursor: pointer; }
}

.theme-toggle__track {
  display: block;
  width: 56px;
  height: 30px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  position: relative;
  transition: background 0.4s;
}

.theme-toggle__thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  background: linear-gradient(135deg, var(--accent), var(--accent-3));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 2px 8px var(--glow);
}

[data-theme='light'] .theme-toggle__thumb {
  transform: translateX(26px);
}

.theme-toggle__sun,
.theme-toggle__moon {
  position: absolute;
  transition: opacity 0.3s, transform 0.3s;
}

.theme-toggle__moon {
  opacity: 0;
  transform: rotate(-90deg);
}

[data-theme='light'] .theme-toggle__sun {
  opacity: 0;
  transform: rotate(90deg);
}

[data-theme='light'] .theme-toggle__moon {
  opacity: 1;
  transform: rotate(0);
}

@supports (view-transition-name: root) {
  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation-duration: 0.5s;
  }
}

/* Language switch */
.lang-switch {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
}

.lang-switch__btn {
  background: none;
  border: none;
  cursor: none;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  padding: 0.28rem 0.55rem;
  border-radius: 999px;
  transition: color 0.25s, background 0.25s;
}

.lang-switch__btn:hover {
  color: var(--text);
}

.lang-switch__btn.is-active {
  color: var(--text);
  background: linear-gradient(135deg, rgba(124, 92, 255, 0.35), rgba(0, 212, 170, 0.2));
}

@media (pointer: coarse) {
  .lang-switch__btn { cursor: pointer; }
}
