:root {
  --bg: #0a0a0a;
  --fg: #f5f5f5;
  --muted: #888888;
  --border: #1f1f1f;
  --accent: #FF4D00;
  --card: #111111;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  background-color: var(--bg);
  color: var(--fg);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--accent); color: #fff; }
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 2px; }

.text-gradient {
  background: linear-gradient(135deg, #fff 0%, #888 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.accent-gradient {
  background: linear-gradient(135deg, #FF4D00 0%, #FF8C42 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.border-glow {
  border: 1px solid #1f1f1f;
  box-shadow: 0 0 30px rgba(255, 77, 0, 0.05);
  transition: all 0.3s ease;
}
.border-glow:hover {
  border-color: rgba(255, 77, 0, 0.3);
  box-shadow: 0 0 40px rgba(255, 77, 0, 0.1);
}

.noise-overlay::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 9999;
  opacity: 0.4;
}

.writing-vertical { writing-mode: vertical-rl; text-orientation: mixed; }

.text-outline {
  color: transparent;
  -webkit-text-stroke: 2px #FF4D00;
}

@keyframes neonFlicker {
  0%   { -webkit-text-stroke-color: #FF4D00; filter: drop-shadow(0 0 8px #FF4D00) drop-shadow(0 0 20px #FF4D00aa); opacity: 1; }
  4%   { -webkit-text-stroke-color: transparent; filter: none; opacity: 0.1; }
  6%   { -webkit-text-stroke-color: #FF4D00; filter: drop-shadow(0 0 8px #FF4D00) drop-shadow(0 0 20px #FF4D00aa); opacity: 1; }
  10%  { -webkit-text-stroke-color: #FF4D00; filter: drop-shadow(0 0 4px #FF4D00); opacity: 0.8; }
  12%  { -webkit-text-stroke-color: transparent; filter: none; opacity: 0.05; }
  14%  { -webkit-text-stroke-color: #FF4D00; filter: drop-shadow(0 0 12px #FF4D00) drop-shadow(0 0 30px #FF4D00); opacity: 1; }
  50%  { -webkit-text-stroke-color: #FF4D00; filter: drop-shadow(0 0 6px #FF4D00aa); opacity: 0.95; }
  70%  { -webkit-text-stroke-color: #FF4D00; filter: drop-shadow(0 0 10px #FF4D00) drop-shadow(0 0 25px #FF4D00aa); opacity: 1; }
  74%  { -webkit-text-stroke-color: transparent; filter: none; opacity: 0.08; }
  76%  { -webkit-text-stroke-color: #FF4D00; filter: drop-shadow(0 0 8px #FF4D00); opacity: 1; }
  100% { -webkit-text-stroke-color: #FF4D00; filter: drop-shadow(0 0 8px #FF4D00) drop-shadow(0 0 20px #FF4D00aa); opacity: 1; }
}
.text-flicker { animation: neonFlicker 4s infinite; }

@keyframes marquee {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}
.animate-marquee { animation: marquee 30s linear infinite; }

@keyframes scrollBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(8px); }
}
.animate-scroll-bounce { animation: scrollBounce 1.5s ease-in-out infinite; }

@keyframes pulseSoft {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}
.animate-pulse-soft { animation: pulseSoft 2s cubic-bezier(0.4,0,0.6,1) infinite; }

/* Reveal / fade-up on scroll */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.7s cubic-bezier(0.22,1,0.36,1), transform 0.7s cubic-bezier(0.22,1,0.36,1);
  transition-delay: var(--reveal-delay, 0s);
}
.reveal.in { opacity: 1; transform: translateY(0); }

.reveal-left {
  opacity: 0;
  transform: translateX(-30px);
  transition: opacity 0.7s ease, transform 0.7s ease;
  transition-delay: var(--reveal-delay, 0s);
}
.reveal-left.in { opacity: 1; transform: translateX(0); }

.reveal-right {
  opacity: 0;
  transform: translateX(30px);
  transition: opacity 0.7s ease, transform 0.7s ease;
  transition-delay: var(--reveal-delay, 0s);
}
.reveal-right.in { opacity: 1; transform: translateX(0); }

/* Initial hero fade-up (fires on load) */
.hero-fade {
  opacity: 0;
  transform: translateY(40px);
  animation: heroFadeUp 0.8s cubic-bezier(0.22,1,0.36,1) forwards;
  animation-delay: var(--hero-delay, 0s);
}
@keyframes heroFadeUp {
  to { opacity: 1; transform: translateY(0); }
}

/* Header slide-down */
.header-slide {
  transform: translateY(-80px);
  opacity: 0;
  animation: headerSlide 0.6s cubic-bezier(0.22,1,0.36,1) 0.1s forwards;
}
@keyframes headerSlide { to { transform: translateY(0); opacity: 1; } }

.navbar-scrolled {
  background-color: rgba(10,10,10,0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid #1f1f1f;
}

/* Preloader */
#preloader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #0a0a0a;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: transform 0.9s cubic-bezier(0.76,0,0.24,1);
}
#preloader.done { transform: translateY(-100%); }
#preloader-bar { transition: width 0.1s linear; }

/* Custom cursor */
#cursor-dot, #cursor-ring {
  position: fixed;
  top: 0; left: 0;
  pointer-events: none;
  z-index: 9997;
  opacity: 0;
  transition: opacity 0.2s ease;
}
#cursor-dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: #FF4D00;
  z-index: 9998;
}
#cursor-ring {
  width: 40px; height: 40px;
  border: 1px solid rgba(255,77,0,0.4);
  border-radius: 50%;
  transition: width 0.2s ease, height 0.2s ease, border-color 0.2s ease, background-color 0.2s ease, opacity 0.2s ease;
}
#cursor-ring.hovered {
  width: 56px; height: 56px;
  border-color: #FF4D00;
  background: rgba(255,77,0,0.08);
}
@media (max-width: 1023px) {
  #cursor-dot, #cursor-ring { display: none; }
}
.cursors-visible #cursor-dot,
.cursors-visible #cursor-ring { opacity: 1; }

/* Scroll progress */
#scroll-progress {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 2px;
  z-index: 60;
  pointer-events: none;
}
#scroll-progress-bar {
  height: 100%;
  background: #FF4D00;
  transform-origin: left;
  transform: scaleX(0);
  transition: transform 0.15s ease-out;
}

/* Hero orb */
#hero-orb {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  background: rgba(255,77,0,0.06);
  filter: blur(120px);
  pointer-events: none;
  transform: translate(-50%, -50%);
  transition: transform 0.6s cubic-bezier(0.22,1,0.36,1);
  will-change: transform;
}

/* Project card tilt */
.project-card {
  transition: transform 0.25s cubic-bezier(0.22,1,0.36,1), border-color 0.3s ease, box-shadow 0.3s ease;
  transform-style: preserve-3d;
  will-change: transform;
}
.project-card-wrapper { perspective: 1000px; }

/* Tabular nums for preloader counter */
.tabular-nums { font-variant-numeric: tabular-nums; }

/* Hide scrollbar when preloader active */
body.preloading { overflow: hidden; }
