/* ============================================
   BASE STYLES — Reset + Global + Preloader
   ============================================ */

/* ── Modern Reset ── */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--header-height);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  font-size: 16px;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: var(--font-normal);
  line-height: var(--leading-normal);
  letter-spacing: var(--tracking-normal);
  color: var(--text-primary);
  background-color: var(--bg-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  min-height: 100vh;
  transition: background-color var(--transition-slow), color var(--transition-slow);
}

/* ── Typography ── */
h1, h2, h3, h4, h5, h6 {
  font-weight: var(--font-bold);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  color: var(--text-primary);
}

h1 { font-size: var(--text-6xl); }
h2 { font-size: var(--text-4xl); }
h3 { font-size: var(--text-2xl); }
h4 { font-size: var(--text-xl); }
h5 { font-size: var(--text-lg); }
h6 { font-size: var(--text-base); }

p {
  color: var(--text-secondary);
  line-height: var(--leading-relaxed);
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--accent-hover);
}

ul, ol {
  list-style: none;
}

img, video, svg {
  display: block;
  max-width: 100%;
  height: auto;
}

button, input, textarea, select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  border: none;
  outline: none;
  background: none;
}

button {
  cursor: pointer;
}

/* ── Selection ── */
::selection {
  background: var(--accent);
  color: white;
}

/* ── Scrollbar (Webkit) ── */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--accent), var(--accent-3));
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent-hover);
}

/* ── Focus Styles ── */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ── Utility Classes ── */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

.text-gradient {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.text-gradient-secondary {
  background: var(--gradient-secondary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ── Scroll Reveal Animations ── */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal.revealed {
  opacity: 1;
  transform: translateY(0);
}

.reveal-delay-1 { transition-delay: 0.1s; }
.reveal-delay-2 { transition-delay: 0.2s; }
.reveal-delay-3 { transition-delay: 0.3s; }
.reveal-delay-4 { transition-delay: 0.4s; }
.reveal-delay-5 { transition-delay: 0.5s; }

.reveal-scale {
  opacity: 0;
  transform: scale(0.95);
  transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal-scale.revealed {
  opacity: 1;
  transform: scale(1);
}

.reveal-left {
  opacity: 0;
  transform: translateX(-40px);
  transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal-left.revealed {
  opacity: 1;
  transform: translateX(0);
}

.reveal-right {
  opacity: 0;
  transform: translateX(40px);
  transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal-right.revealed {
  opacity: 1;
  transform: translateX(0);
}

/* ── Background Noise Texture ── */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9998;
  opacity: 0.018;
  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)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 256px 256px;
}

/* ══════════════════════════════════════
   PRELOADER
   ══════════════════════════════════════ */

.preloader {
  position: fixed;
  inset: 0;
  z-index: var(--z-preloader);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
  transition: opacity 0.6s var(--ease-out-expo), visibility 0.6s;
}

.preloader.hide {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.preloader-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
}

.preloader-logo {
  display: flex;
  align-items: center;
  gap: 2px;
  font-family: var(--font-mono);
  animation: preloaderPulse 1.5s ease-in-out infinite;
}

.preloader-bracket {
  font-size: 1.4rem;
  font-weight: var(--font-bold);
  background: var(--gradient-secondary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  opacity: 0.7;
}

.preloader-letter {
  font-size: 2.4rem;
  font-weight: var(--font-extrabold);
  font-family: var(--font-sans);
  background: var(--gradient-aurora);
  background-size: 300% 300%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradientShift 3s ease-in-out infinite;
}

.preloader-bar {
  width: 160px;
  height: 3px;
  background: var(--bg-elevated);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.preloader-bar-fill {
  width: 0%;
  height: 100%;
  background: var(--gradient-neon);
  background-size: 200% 100%;
  border-radius: inherit;
  animation: preloaderFill 1.8s var(--ease-out-expo) forwards,
             shimmerBar 1.5s linear infinite;
}

@keyframes preloaderPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.05); opacity: 0.8; }
}

@keyframes preloaderFill {
  0% { width: 0%; }
  50% { width: 70%; }
  100% { width: 100%; }
}

@keyframes shimmerBar {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

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

/* ══════════════════════════════════════
   SCROLL PROGRESS BAR
   ══════════════════════════════════════ */

.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: calc(var(--z-fixed) + 10);
  background: transparent;
  pointer-events: none;
}

.scroll-progress-fill {
  width: 0%;
  height: 100%;
  background: var(--gradient-neon);
  background-size: 200% 100%;
  animation: shimmerBar 2s linear infinite;
  border-radius: 0 2px 2px 0;
  transition: width 50ms linear;
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.5), 0 0 30px rgba(99, 102, 241, 0.2);
}

/* ══════════════════════════════════════
   SCROLL TO TOP BUTTON
   ══════════════════════════════════════ */

.scroll-to-top {
  position: fixed;
  bottom: 32px;
  right: 32px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  z-index: var(--z-fixed);
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.8);
  transition: all 0.4s var(--ease-spring);
  cursor: pointer;
  box-shadow: var(--shadow-lg);
}

.scroll-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.scroll-to-top:hover {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
  transform: translateY(-4px) scale(1.05);
  box-shadow: var(--shadow-neon);
}

.scroll-to-top svg {
  transition: transform 0.3s var(--ease-spring);
}

.scroll-to-top:hover svg {
  transform: translateY(-2px);
}

/* ══════════════════════════════════════
   CUSTOM CURSOR (Desktop only)
   ══════════════════════════════════════ */

@media (hover: hover) and (pointer: fine) {
  .cursor-dot {
    position: fixed;
    top: 0;
    left: 0;
    width: 6px;
    height: 6px;
    background: var(--accent);
    border-radius: 50%;
    pointer-events: none;
    z-index: 10000;
    transform: translate(-50%, -50%);
    transition: width 0.2s, height 0.2s, background 0.2s;
    mix-blend-mode: difference;
  }

  .cursor-ring {
    position: fixed;
    top: 0;
    left: 0;
    width: 36px;
    height: 36px;
    border: 1.5px solid rgba(99, 102, 241, 0.4);
    border-radius: 50%;
    pointer-events: none;
    z-index: 10000;
    transform: translate(-50%, -50%);
    transition: width 0.3s var(--ease-spring), 
                height 0.3s var(--ease-spring),
                border-color 0.3s,
                background 0.3s;
  }

  .cursor-dot.hovering {
    width: 10px;
    height: 10px;
    background: var(--accent-hover);
  }

  .cursor-ring.hovering {
    width: 50px;
    height: 50px;
    border-color: rgba(99, 102, 241, 0.6);
    background: rgba(99, 102, 241, 0.04);
  }
}

@media (hover: none), (pointer: coarse) {
  .cursor-dot, .cursor-ring {
    display: none !important;
  }
}

/* ── Responsive Typography ── */
@media (max-width: 1024px) {
  h1 { font-size: var(--text-5xl); }
  h2 { font-size: var(--text-3xl); }
}

@media (max-width: 768px) {
  html { font-size: 15px; }
  h1 { font-size: var(--text-4xl); }
  h2 { font-size: var(--text-2xl); }
  h3 { font-size: var(--text-xl); }

  .scroll-to-top {
    bottom: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
  }
}

@media (max-width: 480px) {
  html { font-size: 14px; }
  h1 { font-size: var(--text-3xl); }
}

/* ══════════════════════════════════════
   SKIP TO CONTENT — Accessibility
   ══════════════════════════════════════ */
.skip-to-content {
  position: fixed;
  top: -100%;
  left: 50%;
  transform: translateX(-50%);
  padding: var(--space-3) var(--space-6);
  background: var(--accent);
  color: white;
  font-weight: var(--font-semibold);
  font-size: var(--text-sm);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  z-index: 10000;
  text-decoration: none;
  transition: top 0.3s ease;
}

.skip-to-content:focus {
  top: 0;
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ══════════════════════════════════════
   IMAGE FALLBACK
   ══════════════════════════════════════ */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

img[src=""],
img:not([src]) {
  background: var(--bg-tertiary);
  min-height: 100px;
}
