/* ===========================================================
   Design tokens — dark premium, violet/cyan tech editorial
   =========================================================== */
:root {
  /* Backgrounds */
  --bg-base: #0A0E27;
  --bg-elevated: #131836;
  --bg-overlay: #1A1F45;

  /* Brand */
  --violet: #6B2BD9;
  --violet-glow: #8B5CF6;
  --cyan: #00D9FF;
  --cyan-glow: #67E8F9;
  --magenta: #D946EF;

  --gradient-primary: linear-gradient(135deg, #6B2BD9 0%, #00D9FF 100%);
  --gradient-accent: linear-gradient(135deg, #D946EF 0%, #6B2BD9 50%, #00D9FF 100%);

  /* Text */
  --text-primary: #F8FAFC;
  --text-secondary: #CBD5E1;
  --text-muted: #8593A8;
  --text-dim: #475569;

  /* Borders */
  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-default: rgba(255, 255, 255, 0.10);
  --border-strong: rgba(255, 255, 255, 0.16);
  --border-glow: rgba(0, 217, 255, 0.4);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: 'Inter', 'Geist', system-ui, -apple-system, sans-serif;
  font-feature-settings: 'cv11', 'ss01', 'ss03';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  line-height: 1.6;
  overflow-x: hidden;
}

body {
  /* Subtle noise grain to break the flat */
  background-image:
    radial-gradient(ellipse 80% 50% at 20% 0%, rgba(107, 43, 217, 0.10), transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% 100%, rgba(0, 217, 255, 0.06), transparent 60%);
  background-attachment: fixed;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.035;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 0.5 0'/></filter><rect width='200' height='200' filter='url(%23n)'/></svg>");
  mix-blend-mode: overlay;
}

/* Typography */
.font-display {
  font-family: 'Geist', 'Inter Tight', 'Inter', sans-serif;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.05;
}
.font-heading {
  font-family: 'Geist', 'Inter Tight', 'Inter', sans-serif;
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.1;
}
.font-mono {
  font-family: 'JetBrains Mono', 'Geist Mono', ui-monospace, 'SF Mono', monospace;
}
.caption {
  font-family: 'JetBrains Mono', 'Geist Mono', monospace;
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 500;
}

/* Selection */
::selection { background: rgba(0, 217, 255, 0.3); color: #fff; }

/* ===========================================================
   Animated gradient text
   =========================================================== */
.gradient-text {
  background: linear-gradient(120deg, #8B5CF6 0%, #00D9FF 35%, #D946EF 70%, #8B5CF6 100%);
  background-size: 300% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: gradient-shift 8s linear infinite;
}
@keyframes gradient-shift {
  0% { background-position: 0% 50%; }
  100% { background-position: 300% 50%; }
}

/* ===========================================================
   Buttons
   =========================================================== */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 22px;
  border-radius: 12px;
  font-weight: 500;
  font-size: 15px;
  letter-spacing: -0.01em;
  cursor: pointer;
  text-decoration: none;
  border: 0;
  transition: transform 200ms cubic-bezier(0.22, 1, 0.36, 1), box-shadow 200ms;
  will-change: transform;
  font-family: inherit;
}
.btn-primary {
  color: #050818;
  background: linear-gradient(135deg, #67E8F9 0%, #00D9FF 50%, #8B5CF6 100%);
  box-shadow: 0 0 0 1px rgba(255,255,255,0.12) inset,
              0 8px 32px -8px rgba(0, 217, 255, 0.5),
              0 2px 0 rgba(255,255,255,0.18) inset;
  font-weight: 600;
}
.btn-primary:hover {
  box-shadow: 0 0 0 1px rgba(255,255,255,0.2) inset,
              0 12px 40px -6px rgba(0, 217, 255, 0.75),
              0 0 0 4px rgba(0, 217, 255, 0.12),
              0 2px 0 rgba(255,255,255,0.18) inset;
}
.btn-secondary {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-default);
  backdrop-filter: blur(8px);
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border-strong);
  box-shadow: 0 0 24px -6px rgba(139, 92, 246, 0.4);
}

/* ===========================================================
   Cards
   =========================================================== */
.card {
  background: linear-gradient(180deg, rgba(26, 31, 69, 0.6) 0%, rgba(19, 24, 54, 0.4) 100%);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  transition: transform 300ms cubic-bezier(0.22, 1, 0.36, 1),
              border-color 300ms,
              box-shadow 300ms;
  will-change: transform;
}
.card:hover {
  transform: translateY(-4px);
  border-color: var(--border-glow);
  box-shadow:
    0 0 0 1px rgba(0, 217, 255, 0.15),
    0 24px 60px -20px rgba(107, 43, 217, 0.4),
    0 12px 40px -8px rgba(0, 217, 255, 0.25);
}

/* ===========================================================
   Scroll progress
   =========================================================== */
.scroll-progress {
  position: fixed;
  top: 0; left: 0;
  height: 1px;
  width: var(--p, 0%);
  background: rgba(248, 250, 252, 0.18);
  z-index: 9999;
  transition: width 80ms linear;
}

/* ===========================================================
   Reveal on scroll
   =========================================================== */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 800ms cubic-bezier(0.22, 1, 0.36, 1),
              transform 800ms cubic-bezier(0.22, 1, 0.36, 1);
  will-change: opacity, transform;
}
.reveal.in {
  opacity: 1;
  transform: translateY(0);
}
.reveal-stagger > * {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 700ms cubic-bezier(0.22, 1, 0.36, 1),
              transform 700ms cubic-bezier(0.22, 1, 0.36, 1);
}
.reveal-stagger.in > * { opacity: 1; transform: translateY(0); }
.reveal-stagger.in > *:nth-child(1) { transition-delay: 0ms; }
.reveal-stagger.in > *:nth-child(2) { transition-delay: 100ms; }
.reveal-stagger.in > *:nth-child(3) { transition-delay: 200ms; }
.reveal-stagger.in > *:nth-child(4) { transition-delay: 300ms; }
.reveal-stagger.in > *:nth-child(5) { transition-delay: 400ms; }
.reveal-stagger.in > *:nth-child(6) { transition-delay: 500ms; }

@media (prefers-reduced-motion: reduce) {
  .reveal, .reveal-stagger > * { opacity: 1; transform: none; transition: none; }
  .gradient-text { animation: none; }
}

/* ===========================================================
   Nav link underline
   =========================================================== */
.nav-link {
  position: relative;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  padding: 6px 2px;
  transition: color 200ms;
}
.nav-link::after {
  content: '';
  position: absolute;
  left: 0; right: 100%;
  bottom: 0;
  height: 1px;
  background: var(--cyan);
  transition: right 280ms cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: 0 0 8px var(--cyan);
}
.nav-link:hover { color: var(--text-primary); }
.nav-link:hover::after { right: 0; }

/* ===========================================================
   Ticker
   =========================================================== */
.ticker-track {
  display: flex;
  gap: 64px;
  animation: ticker 30s linear infinite;
  width: max-content;
}
@keyframes ticker {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}
.ticker-mask {
  mask-image: linear-gradient(90deg, transparent 0, #000 18%, #000 82%, transparent 100%);
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 18%, #000 82%, transparent 100%);
}

/* ===========================================================
   Skip link (a11y)
   =========================================================== */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 10001;
  padding: 12px 16px;
  background: var(--cyan);
  color: #050818;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  font-weight: 600;
  border-radius: 0 0 8px 0;
  text-decoration: none;
  transition: left 200ms;
}
.skip-link:focus {
  left: 0;
  outline: none;
}

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

/* ===========================================================
   Avatar glow pulse
   =========================================================== */
.avatar-glow {
  position: relative;
}
.avatar-glow::before {
  content: '';
  position: absolute;
  inset: -8%;
  border-radius: 50%;
  background: conic-gradient(from 0deg, #8B5CF6, #00D9FF, #D946EF, #8B5CF6);
  filter: blur(28px);
  opacity: 0.55;
  z-index: -1;
  animation: spin-slow 8s linear infinite;
}
.avatar-glow::after {
  content: '';
  position: absolute;
  inset: -2%;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(0, 217, 255, 0.4), transparent 60%);
  z-index: -1;
  animation: pulse-slow 3s ease-in-out infinite;
}
@keyframes spin-slow {
  to { transform: rotate(360deg); }
}
@keyframes pulse-slow {
  0%, 100% { opacity: 0.4; transform: scale(1); }
  50% { opacity: 0.8; transform: scale(1.05); }
}

/* ===========================================================
   Browser frame (project mockups)
   =========================================================== */
.browser-frame {
  border-radius: 14px;
  overflow: hidden;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  box-shadow:
    0 30px 80px -20px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(255, 255, 255, 0.04),
    0 0 60px -20px rgba(107, 43, 217, 0.3);
  transition: box-shadow 400ms, transform 400ms;
}
.browser-frame:hover {
  box-shadow:
    0 40px 100px -20px rgba(0, 0, 0, 0.7),
    0 0 0 1px rgba(0, 217, 255, 0.2),
    0 0 80px -10px rgba(0, 217, 255, 0.35);
}
.browser-chrome {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: rgba(10, 14, 39, 0.6);
  border-bottom: 1px solid var(--border-subtle);
}
.browser-dot { width: 10px; height: 10px; border-radius: 50%; }

/* ===========================================================
   Tech badge
   =========================================================== */
.tech-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-radius: 12px;
  background: rgba(26, 31, 69, 0.4);
  border: 1px solid var(--border-subtle);
  transition: all 250ms cubic-bezier(0.22, 1, 0.36, 1);
  font-size: 14px;
  color: var(--text-secondary);
}
.tech-badge:hover {
  border-color: var(--border-glow);
  transform: scale(1.04);
  background: rgba(26, 31, 69, 0.7);
  box-shadow: 0 0 24px -6px rgba(0, 217, 255, 0.4);
  color: var(--text-primary);
}

/* ===========================================================
   Inputs
   =========================================================== */
.input {
  width: 100%;
  background: rgba(10, 14, 39, 0.5);
  border: 1px solid var(--border-default);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 15px;
  padding: 14px 16px;
  border-radius: 12px;
  transition: border-color 200ms, box-shadow 200ms, background 200ms;
}
.input::placeholder { color: var(--text-muted); }
.input:focus {
  outline: none;
  border-color: rgba(0, 217, 255, 0.5);
  box-shadow: 0 0 0 4px rgba(0, 217, 255, 0.08);
  background: rgba(10, 14, 39, 0.7);
}

/* ===========================================================
   Focus ring
   =========================================================== */
*:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
  border-radius: 8px;
}

/* ===========================================================
   Section spacing helpers
   =========================================================== */
.section { padding: 120px 0; position: relative; z-index: 2; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 32px; }

@media (max-width: 768px) {
  .section { padding: 80px 0; }
  .container { padding: 0 20px; }
}

/* ===========================================================
   Terminal cursor (footer easter egg)
   =========================================================== */
.terminal-cursor {
  display: inline-block;
  width: 8px;
  height: 14px;
  background: var(--cyan);
  margin-left: 4px;
  vertical-align: middle;
  animation: blink 1.05s steps(2, start) infinite;
  box-shadow: 0 0 8px var(--cyan);
}
@keyframes blink { to { visibility: hidden; } }

/* ===========================================================
   Process step vertical line
   =========================================================== */
.process-step {
  position: relative;
  padding-left: 88px;
  min-height: 100px;
}
.process-step .num {
  position: absolute;
  left: 0;
  top: -6px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 56px;
  font-weight: 300;
  background: linear-gradient(180deg, var(--text-primary) 0%, var(--violet-glow) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.03em;
}
.process-step:not(:last-child)::before {
  content: '';
  position: absolute;
  left: 28px;
  top: 60px;
  bottom: -40px;
  width: 1px;
  background: linear-gradient(180deg, rgba(0, 217, 255, 0.4), transparent);
  transform-origin: top;
  transform: scaleY(0);
  transition: transform 800ms cubic-bezier(0.22, 1, 0.36, 1) 200ms;
}
.process-step.in:not(:last-child)::before { transform: scaleY(1); }

/* ===========================================================
   Hero scroll indicator
   =========================================================== */
.scroll-indicator {
  position: absolute;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  animation: bounce 2.4s ease-in-out infinite;
}
@keyframes bounce {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(8px); }
}

/* ===========================================================
   Lang switch
   =========================================================== */
.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  background: rgba(10, 14, 39, 0.5);
  border: 1px solid var(--border-default);
  border-radius: 999px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.06em;
}
.lang-switch button {
  background: transparent;
  border: 0;
  color: var(--text-muted);
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 200ms;
  font-family: inherit;
  font-size: inherit;
  letter-spacing: inherit;
}
.lang-switch button.active {
  background: rgba(0, 217, 255, 0.15);
  color: var(--cyan);
  box-shadow: 0 0 0 1px rgba(0, 217, 255, 0.3) inset;
}

/* ===========================================================
   Fade transition for language switch
   =========================================================== */
.lang-fade { transition: opacity 200ms ease; }
.lang-fading { opacity: 0; }

/* ===========================================================
   Particles canvas
   =========================================================== */
.particles {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

/* ===========================================================
   Mobile nav drawer
   =========================================================== */
.mobile-nav {
  position: fixed;
  inset: 0;
  background: rgba(10, 14, 39, 0.95);
  backdrop-filter: blur(20px);
  z-index: 9998;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 300ms;
}
.mobile-nav.open { opacity: 1; pointer-events: auto; }
.mobile-nav a { font-size: 24px; color: var(--text-primary); text-decoration: none; }

/* ===========================================================
   Project mockup placeholder content
   =========================================================== */
.mock-content {
  aspect-ratio: 16 / 10;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 20% 30%, rgba(107, 43, 217, 0.4), transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(0, 217, 255, 0.35), transparent 50%),
    linear-gradient(135deg, #0f1330 0%, #1a1f45 100%);
}

/* Reduced motion override for hero parallax / heavy stuff */
@media (prefers-reduced-motion: reduce) {
  .avatar-glow::before, .avatar-glow::after,
  .scroll-indicator, .terminal-cursor,
  .ticker-track {
    animation: none !important;
  }
}

/* ===========================================================
   Mobile responsive pass
   =========================================================== */

/* Tablets and below */
@media (max-width: 900px) {
  .section { padding: 88px 0; }
  .browser-chrome { padding: 8px 12px; gap: 6px; }
  .browser-frame { border-radius: 12px; }
  .scroll-indicator { display: none; }
  /* Mockups: lighter padding inside */
  .browser-frame .mock-content > div { padding: 16px !important; }
}

/* Project mockup hover suppression on touch */
@media (hover: none) {
  .browser-frame:hover .mock-content,
  .browser-frame:hover { box-shadow: none; }
}

/* Phones (≤ 640px) */
@media (max-width: 640px) {
  .section { padding: 64px 0; }
  .container { padding: 0 18px; }

  /* Hero shorter on mobile (per brief: ~80vh) */
  #top { min-height: 88vh; padding-top: 88px !important; }

  /* Process step: smaller number, tighter padding */
  .process-step { padding-left: 64px; min-height: 80px; }
  .process-step .num { font-size: 40px; top: -2px; }
  .process-step:not(:last-child)::before { left: 20px; top: 46px; bottom: -32px; }

  /* Browser frame URL bar: hide URL chip on tiny screens */
  .browser-chrome > div:last-child { display: none; }

  /* Project rows: less gap */
  .project-row { gap: 28px !important; }

  /* Mockup content: even tighter */
  .browser-frame .mock-content > div { padding: 14px !important; gap: 10px !important; }

  /* Service card hover scale: disable (touch-friendly) */
  .card:hover { transform: none; }
  .browser-frame:hover { box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.04), 0 0 60px -20px rgba(107, 43, 217, 0.3); }

  /* Lang switch: larger touch targets */
  .lang-switch button { padding: 8px 14px; font-size: 12px; }

  /* Buttons: easier tap targets */
  .btn { padding: 14px 22px; min-height: 48px; }

  /* Caption smaller on phones */
  .caption { font-size: 11px; letter-spacing: 0.14em; }

  /* Avatar glow: reduce halo size */
  .avatar-glow::before { filter: blur(20px); opacity: 0.45; }
}

/* Testimonials card padding (default 48px, smaller on mobile) */
.testimonial-card { padding: 48px; }
@media (max-width: 640px) {
  .testimonial-card { padding: 28px; }
}
@media (max-width: 400px) {
  .testimonial-card { padding: 22px; }
}

/* Very small phones (≤ 400px) */
@media (max-width: 400px) {
  .section { padding: 56px 0; }
  .container { padding: 0 16px; }
  .btn { padding: 12px 18px; font-size: 14px; }
  .process-step { padding-left: 56px; }
  .process-step .num { font-size: 34px; }
  .process-step:not(:last-child)::before { left: 16px; top: 40px; }
}

/* Disable card lift on touch devices entirely */
@media (hover: none) {
  .card:hover, .browser-frame:hover, .tech-badge:hover, .btn:hover {
    transform: none;
  }
}
