/* Mechabyte — custom effects layer (Tailwind handles layout/utility classes) */

::selection {
  background: #00FFFF;
  color: #050510;
}

html {
  scrollbar-color: #242438 #050510;
}
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: #050510; }
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #00FFFF, #7B61FF);
  border-radius: 999px;
}

/* ---------- Scroll progress bar ---------- */
#scroll-progress {
  position: fixed;
  top: 0; left: 0;
  height: 3px;
  width: 0%;
  background: linear-gradient(90deg, #00FFFF, #7B61FF, #FF2ED1);
  z-index: 100;
  box-shadow: 0 0 10px #00FFFF, 0 0 20px #FF2ED1;
  transition: width 80ms linear;
}

/* ---------- Background canvas ---------- */
#bg-canvas {
  width: 100%;
  height: 100%;
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(123,97,255,0.25), transparent),
    radial-gradient(ellipse 60% 40% at 90% 90%, rgba(255,46,209,0.12), transparent),
    #050510;
}

/* ---------- Cursor glow (desktop only) ---------- */
.cursor-glow {
  position: fixed;
  top: 0; left: 0;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 1;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(0,255,255,0.08) 0%, rgba(123,97,255,0.05) 40%, transparent 70%);
  transition: opacity 300ms ease;
  will-change: transform;
}

/* ---------- Fluid hero title (guaranteed to never overflow narrow screens) ---------- */
.hero-title {
  font-size: clamp(2.5rem, 12vw, 7.5rem);
}

/* ---------- Brand icon images (Simple Icons via CDN) ---------- */
.brand-icon {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* ---------- Glow text ---------- */
.text-glow-cyan {
  text-shadow: 0 0 8px rgba(0,255,255,0.55), 0 0 24px rgba(0,255,255,0.25);
}
.text-glow-magenta {
  text-shadow: 0 0 8px rgba(255,46,209,0.55), 0 0 24px rgba(255,46,209,0.25);
}

@keyframes pulse-glow {
  0%, 100% { text-shadow: 0 0 8px rgba(0,255,255,0.5), 0 0 28px rgba(123,97,255,0.35); }
  50% { text-shadow: 0 0 18px rgba(0,255,255,0.85), 0 0 44px rgba(123,97,255,0.55); }
}
.animate-pulse-glow {
  animation: pulse-glow 3.2s ease-in-out infinite;
}

/* ---------- Glitch logo ---------- */
.glitch {
  position: relative;
  display: inline-block;
}
.glitch::before,
.glitch::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  background: transparent;
  overflow: hidden;
  opacity: 0;
}
.glitch:hover::before,
.glitch:hover::after {
  opacity: 0.85;
  animation: glitch-anim 420ms steps(2, end) infinite;
}
.glitch::before {
  color: #00FFFF;
  clip-path: inset(0 0 55% 0);
  transform: translate(-2px, -1px);
}
.glitch::after {
  color: #FF2ED1;
  clip-path: inset(45% 0 0 0);
  transform: translate(2px, 1px);
}
@keyframes glitch-anim {
  0% { transform: translate(-2px, -1px); }
  50% { transform: translate(2px, 1px); }
  100% { transform: translate(-1px, 2px); }
}

/* ---------- Grid backdrop ---------- */
.bg-grid {
  background-image:
    linear-gradient(rgba(0,255,255,0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,255,255,0.06) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse 70% 70% at 50% 40%, black 40%, transparent 90%);
}

/* ---------- Reveal on scroll ---------- */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 700ms cubic-bezier(.22,1,.36,1), transform 700ms cubic-bezier(.22,1,.36,1);
}
.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}
.reveal-delay-1 { transition-delay: 90ms; }
.reveal-delay-2 { transition-delay: 180ms; }
.reveal-delay-3 { transition-delay: 270ms; }
.reveal-delay-4 { transition-delay: 360ms; }
.reveal-delay-5 { transition-delay: 450ms; }

/* ---------- Tilt cards ---------- */
.tilt-card {
  transform-style: preserve-3d;
  transition: transform 250ms cubic-bezier(.22,1,.36,1), box-shadow 250ms ease, border-color 250ms ease;
  will-change: transform;
}
.tilt-card:hover {
  box-shadow: 0 0 0 1px rgba(0,255,255,0.35), 0 20px 60px -20px rgba(0,255,255,0.25);
}
.tilt-card-inner {
  transform: translateZ(30px);
}

/* ---------- Typewriter caret ---------- */
.type-caret {
  display: inline-block;
  width: 3px;
  margin-left: 2px;
  background: #00FFFF;
  box-shadow: 0 0 8px #00FFFF;
  animation: caret-blink 900ms steps(1) infinite;
}
@keyframes caret-blink {
  50% { opacity: 0; }
}

/* ---------- Marquee ---------- */
@keyframes marquee {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}
.marquee-track {
  animation: marquee 26s linear infinite;
}
.marquee-wrap:hover .marquee-track {
  animation-play-state: paused;
}

/* ---------- Nav link underline ---------- */
.nav-link {
  position: relative;
}
.nav-link::after {
  content: '';
  position: absolute;
  left: 0; bottom: -4px;
  width: 0%;
  height: 1px;
  background: linear-gradient(90deg, #00FFFF, #FF2ED1);
  transition: width 250ms ease;
}
.nav-link:hover::after,
.nav-link.active::after {
  width: 100%;
}
.nav-link.active {
  color: #00FFFF;
}

/* ---------- Buttons ---------- */
.btn-glow {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}
.btn-glow::before {
  content: '';
  position: absolute;
  inset: -2px;
  background: conic-gradient(from 0deg, #00FFFF, #7B61FF, #FF2ED1, #00FFFF);
  z-index: -2;
  opacity: 0;
  transition: opacity 300ms ease;
  animation: spin 4s linear infinite;
}
.btn-glow:hover::before {
  opacity: 1;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ---------- Mobile menu ---------- */
#mobile-menu {
  transform: translateX(100%);
  transition: transform 350ms cubic-bezier(.22,1,.36,1);
}
#mobile-menu.open {
  transform: translateX(0);
}

/* ---------- Skip link ---------- */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 200;
  background: #00FFFF;
  color: #050510;
  padding: 0.5rem 1rem;
  font-weight: 600;
}
.skip-link:focus {
  left: 1rem;
  top: 1rem;
}

/* ---------- Language switcher ---------- */
.lang-select {
  appearance: none;
  -webkit-appearance: none;
  background-color: transparent;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2300FFFF' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.6rem center;
  background-size: 0.85em;
  color: #00FFFF;
  cursor: pointer;
}
.lang-select option {
  background-color: #0B0B18;
  color: #E7E7FF;
}

/* ---------- Focus visibility ---------- */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid #00FFFF;
  outline-offset: 3px;
  border-radius: 4px;
}

/* ==================================================================
 * Scroll story — WebGL (Three.js) scene: AI -> Website -> 3D Printer -> Social bubbles
 * ================================================================== */
#story-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: pan-y;
}

.story-dot {
  display: block;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #242438;
  border: 1px solid #333344;
  transition: background 300ms ease, box-shadow 300ms ease, transform 300ms ease;
}
.story-dot.is-active {
  background: #00FFFF;
  box-shadow: 0 0 10px #00FFFF;
  transform: scale(1.3);
}

/* ==================================================================
 * Parallax blobs (ambient depth in content sections)
 * ================================================================== */
.parallax-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  pointer-events: none;
  will-change: transform;
  z-index: 0;
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .cursor-glow { display: none !important; }
}
