/*--------------------------------------------------------------
# FX layer: preloader, hero effects, skills marquee
--------------------------------------------------------------*/

/* Preloader */
#preloader {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

#preloader:before {
  display: none;
}

#preloader .pl-name {
  font-family: var(--heading-font);
  font-size: clamp(22px, 4vw, 34px);
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #f4f4f5;
}

#preloader .pl-count {
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: #a1a1aa;
}

#preloader .pl-count::after {
  content: "%";
}

#preloader .pl-bar {
  width: min(220px, 60vw);
  height: 2px;
  border-radius: 2px;
  background: #27272a;
  overflow: hidden;
  position: relative;
}

#preloader .pl-bar::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--accent-color);
  transform-origin: left;
  transform: scaleX(var(--pl-progress, 0));
  transition: transform 0.1s linear;
}

#preloader.is-done {
  opacity: 0;
  visibility: hidden;
}

/* Hero background canvas + mouse spotlight.
   Fixed to the full viewport (behind the sidebar too) so the home screen is one
   continuous surface; later sections have opaque backgrounds and cover it. */
#hero.hero {
  background: transparent;
}

#hero.hero:before {
  display: none;
}

#hero-canvas,
.hero-spotlight {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
}

.hero-spotlight {
  opacity: 0;
  transition: opacity 0.4s;
  background: radial-gradient(220px circle at var(--mx, 50%) var(--my, 40%), rgba(139, 92, 246, 0.08), transparent 70%);
}

.hero-spotlight.is-active {
  opacity: 1;
}

#hero-canvas {
  transition: opacity 0.4s;
}

#hero.fx-off #hero-canvas,
#hero.fx-off .hero-spotlight {
  opacity: 0;
}

/* "Open to roles" badge */
.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 500;
  color: #d4d4d8;
  background: rgba(24, 24, 27, 0.6);
  border: 1px solid rgba(63, 63, 70, 0.8);
  border-radius: 999px;
}

.hero-eyebrow .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.6);
  animation: fx-pulse 2s infinite;
}

@keyframes fx-pulse {
  70% { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

/* Scroll cue */
#hero-scroll {
  position: absolute;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #71717a;
  transition: color 0.3s;
}

#hero-scroll:hover {
  color: #a78bfa;
}

#hero-scroll .mouse {
  width: 20px;
  height: 32px;
  border: 2px solid currentColor;
  border-radius: 12px;
  position: relative;
}

#hero-scroll .mouse::after {
  content: "";
  position: absolute;
  top: 6px;
  left: 50%;
  width: 2px;
  height: 6px;
  margin-left: -1px;
  border-radius: 2px;
  background: currentColor;
  animation: fx-wheel 1.6s ease-in-out infinite;
}

@keyframes fx-wheel {
  0% { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(10px); }
}

/* Hide the cue once the chat is open, and on short screens */
#hero-chat-messages:not(.hidden) ~ #hero-scroll {
  display: none;
}

@media (max-height: 640px) {
  #hero-scroll {
    display: none;
  }
}

/* Skills marquee */
.fx-marquee {
  background: transparent;
  padding: 28px 0;
  overflow: hidden;
  border-top: 1px solid rgba(39, 39, 42, 0.8);
  border-bottom: 1px solid rgba(39, 39, 42, 0.8);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
}

.fx-marquee-row {
  display: flex;
  overflow: hidden;
}

.fx-marquee-row + .fx-marquee-row {
  margin-top: 10px;
}

.fx-marquee-track {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 16px;
  padding: 4px 16px 4px 0;
  white-space: nowrap;
  will-change: transform;
  animation: fx-marquee 40s linear infinite;
}

.fx-marquee-row:nth-child(2) .fx-marquee-track {
  animation-direction: reverse;
  animation-duration: 46s;
}

.fx-marquee-row:nth-child(3) .fx-marquee-track {
  animation-duration: 36s;
}

.fx-marquee:hover .fx-marquee-track {
  animation-play-state: paused;
}

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

.fx-tech {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  padding: 10px 18px 10px 12px;
  border: 1px solid rgba(63, 63, 70, 0.6);
  border-radius: 16px;
  background: rgba(24, 24, 27, 0.7);
  transition: border-color 0.3s, background 0.3s, transform 0.3s;
}

.fx-tech img {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  object-fit: contain;
  padding: 6px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
}

.fx-tech span {
  font-family: var(--heading-font);
  font-size: 15px;
  font-weight: 600;
  color: #d4d4d8;
}

.fx-tech:hover {
  border-color: rgba(139, 92, 246, 0.6);
  background: rgba(139, 92, 246, 0.08);
  transform: translateY(-3px);
}

body.light-theme .fx-tech {
  background: #ffffff;
  border-color: #e4e4e7;
}

body.light-theme .fx-tech img {
  background: #f4f4f5;
}

body.light-theme .fx-tech img[src$="github.svg"],
body.light-theme .fx-tech img[src$="nextjs.svg"] {
  filter: invert(0.85);
}

body.light-theme .fx-tech span {
  color: #27272a;
}

@media (max-width: 640px) {
  .fx-tech { padding: 8px 14px 8px 8px; gap: 10px; }
  .fx-tech img { width: 32px; height: 32px; padding: 5px; }
  .fx-tech span { font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  .fx-marquee-track,
  .hero-eyebrow .dot,
  #hero-scroll .mouse::after {
    animation: none;
  }
}
