/* ===== Base & Smooth Scroll ===== */
html {
  scroll-behavior: smooth;
}

/* Faster paint for below-the-fold sections */
section:not(#home) {
  content-visibility: auto;
  contain-intrinsic-size: auto 480px;
}

::selection {
  background: rgba(34, 211, 238, 0.25);
  color: #fff;
}

/* ===== Background ===== */
.hero-glow {
  position: absolute;
  top: -20%;
  right: 10%;
  width: min(600px, 80vw);
  height: min(600px, 80vw);
  background: radial-gradient(circle, rgba(34, 211, 238, 0.15) 0%, transparent 70%);
  filter: blur(60px);
  animation: glow-drift 12s ease-in-out infinite alternate;
}

.hero-glow::after {
  content: '';
  position: absolute;
  bottom: -40%;
  left: -30%;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.12) 0%, transparent 70%);
  filter: blur(50px);
}

@keyframes glow-drift {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(-40px, 30px) scale(1.1); }
}

.grid-overlay {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(30, 42, 69, 0.4) 1px, transparent 1px),
    linear-gradient(90deg, rgba(30, 42, 69, 0.4) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, black 20%, transparent 70%);
}

/* ===== Navbar ===== */
#navbar.scrolled {
  background: rgba(6, 8, 15, 0.85);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(30, 42, 69, 0.8);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
}

.logo-img {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 0.75rem;
  object-fit: cover;
  box-shadow: 0 0 24px rgba(34, 211, 238, 0.25);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.group:hover .logo-img {
  transform: scale(1.05);
  box-shadow: 0 0 32px rgba(34, 211, 238, 0.45);
}

/* ===== Hero logo (transparent + motion) ===== */
.hero-logo-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 7.5rem;
  height: 7.5rem;
  animation: hero-logo-float 4.5s ease-in-out infinite;
}

.hero-logo-inner {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: hero-logo-breathe 3s ease-in-out infinite;
  filter: drop-shadow(0 0 18px rgba(34, 211, 238, 0.55))
          drop-shadow(0 0 36px rgba(59, 130, 246, 0.25));
}

.hero-logo {
  width: 5.5rem;
  height: 5.5rem;
  object-fit: contain;
  background: transparent;
}

.hero-logo-pulse {
  position: absolute;
  inset: 8%;
  z-index: 1;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(34, 211, 238, 0.45) 0%, rgba(139, 92, 246, 0.15) 45%, transparent 70%);
  animation: hero-logo-glow-pulse 2.8s ease-in-out infinite;
  pointer-events: none;
}

.hero-logo-orbit {
  position: absolute;
  border-radius: 50%;
  border: 1px solid transparent;
  pointer-events: none;
}

.hero-logo-orbit--1 {
  inset: -4px;
  border-top-color: rgba(34, 211, 238, 0.55);
  border-right-color: rgba(34, 211, 238, 0.15);
  animation: hero-orbit-spin 10s linear infinite;
}

.hero-logo-orbit--2 {
  inset: -14px;
  border-bottom-color: rgba(139, 92, 246, 0.45);
  border-left-color: rgba(59, 130, 246, 0.2);
  animation: hero-orbit-spin 16s linear infinite reverse;
}

.hero-logo-orbit--1::after,
.hero-logo-orbit--2::after {
  content: '';
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22d3ee;
  box-shadow: 0 0 10px #22d3ee;
}

.hero-logo-orbit--1::after {
  top: -3px;
  left: 50%;
  transform: translateX(-50%);
}

.hero-logo-orbit--2::after {
  bottom: -3px;
  right: 12%;
  background: #8b5cf6;
  box-shadow: 0 0 10px #8b5cf6;
}

@keyframes hero-logo-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

@keyframes hero-logo-breathe {
  0%, 100% {
    transform: scale(1);
    filter: drop-shadow(0 0 18px rgba(34, 211, 238, 0.5)) drop-shadow(0 0 32px rgba(59, 130, 246, 0.2));
  }
  50% {
    transform: scale(1.08);
    filter: drop-shadow(0 0 28px rgba(34, 211, 238, 0.85)) drop-shadow(0 0 48px rgba(139, 92, 246, 0.4));
  }
}

@keyframes hero-logo-glow-pulse {
  0%, 100% { opacity: 0.5; transform: scale(0.92); }
  50% { opacity: 1; transform: scale(1.08); }
}

@keyframes hero-orbit-spin {
  to { transform: rotate(360deg); }
}

.logo-img,
.footer-logo,
.hero-logo {
  background: transparent;
}

.footer-logo {
  filter: drop-shadow(0 0 12px rgba(34, 211, 238, 0.2));
}

.nav-link {
  position: relative;
  transition: color 0.2s;
}

.nav-link:hover {
  color: #22d3ee;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: -4px;
  inset-inline-start: 0;
  width: 0;
  height: 2px;
  background: linear-gradient(90deg, #22d3ee, #8b5cf6);
  transition: width 0.3s ease;
}

.nav-link:hover::after {
  width: 100%;
}

/* ===== Language switcher ===== */
.lang-switcher {
  z-index: 60;
}

.lang-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: #d1d5db;
  background: rgba(18, 24, 42, 0.8);
  border: 1px solid rgba(30, 42, 69, 0.9);
  border-radius: 0.625rem;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}

.lang-toggle:hover {
  border-color: rgba(34, 211, 238, 0.4);
  color: #22d3ee;
}

.lang-menu {
  position: absolute;
  top: calc(100% + 0.5rem);
  inset-inline-end: 0;
  min-width: 10.5rem;
  padding: 0.35rem;
  background: rgba(13, 17, 23, 0.98);
  border: 1px solid rgba(30, 42, 69, 0.95);
  border-radius: 0.75rem;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(12px);
  list-style: none;
}

.lang-option {
  display: block;
  width: 100%;
  padding: 0.55rem 0.75rem;
  text-align: start;
  font-size: 0.875rem;
  color: #9ca3af;
  border-radius: 0.5rem;
  transition: background 0.15s, color 0.15s;
}

.lang-option:hover {
  background: rgba(34, 211, 238, 0.08);
  color: #e5e7eb;
}

.lang-option-active,
.lang-option.lang-option-active {
  color: #22d3ee;
  background: rgba(34, 211, 238, 0.1);
}

/* ===== RTL ===== */
html[dir="rtl"] body {
  font-family: 'Cairo', 'Inter', system-ui, sans-serif;
}

html[lang="zh"] body {
  font-family: 'Noto Sans SC', 'Inter', system-ui, sans-serif;
}

html[lang="hi"] body {
  font-family: 'Noto Sans Devanagari', 'Inter', system-ui, sans-serif;
}

html[dir="rtl"] .feature-pill:hover {
  transform: translateX(4px);
}

html[dir="ltr"] .feature-pill:hover {
  transform: translateX(-4px);
}

.contact-arrow {
  margin-inline-start: auto;
  transition: transform 0.3s ease;
}

html[dir="ltr"] .contact-channel:hover .contact-arrow {
  transform: translateX(4px);
}

html[dir="rtl"] .contact-channel:hover .contact-arrow {
  transform: translateX(-4px) scaleX(-1);
}

html[dir="rtl"] .contact-channel:hover {
  transform: translateX(4px);
}

html[dir="ltr"] .contact-channel:hover {
  transform: translateX(-4px);
}

.email-input {
  text-align: left;
}

html[dir="rtl"] .email-input {
  text-align: right;
}

html[dir="rtl"] .typing-cursor::after {
  margin-right: 0;
  margin-left: 2px;
}

.mobile-nav-link {
  color: #9ca3af;
  transition: background 0.2s, color 0.2s;
}

.mobile-nav-link:hover {
  background: rgba(18, 24, 42, 0.8);
  color: #22d3ee;
}

/* ===== Buttons ===== */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.875rem 1.75rem;
  font-weight: 700;
  border-radius: 0.75rem;
  background: linear-gradient(135deg, #06b6d4, #3b82f6);
  color: #06080f;
  box-shadow: 0 0 30px rgba(6, 182, 212, 0.35);
  transition: transform 0.2s, box-shadow 0.2s;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 40px rgba(6, 182, 212, 0.5);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.875rem 1.75rem;
  font-weight: 600;
  border-radius: 0.75rem;
  border: 1px solid rgba(34, 211, 238, 0.35);
  color: #e5e7eb;
  background: rgba(18, 24, 42, 0.5);
  transition: border-color 0.2s, background 0.2s, transform 0.2s;
}

.btn-secondary:hover {
  border-color: #22d3ee;
  background: rgba(34, 211, 238, 0.08);
  transform: translateY(-2px);
}

/* ===== Typography ===== */
.gradient-text {
  background: linear-gradient(135deg, #22d3ee 0%, #3b82f6 50%, #a78bfa 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.section-tag {
  display: inline-block;
  padding: 0.35rem 1rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: #22d3ee;
  border: 1px solid rgba(34, 211, 238, 0.25);
  border-radius: 9999px;
  background: rgba(34, 211, 238, 0.06);
}

/* ===== Typing effect ===== */
.typing-wrapper {
  display: inline-block;
  min-height: 1.2em;
}

.typing-cursor::after {
  content: '|';
  margin-right: 2px;
  color: #22d3ee;
  animation: blink 0.8s step-end infinite;
}

@keyframes blink {
  50% { opacity: 0; }
}

/* ===== Scroll hint ===== */
.scroll-hint {
  display: flex;
  flex-direction: column;
  align-items: center;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.scroll-hint:hover {
  opacity: 1;
}

.scroll-wheel {
  width: 24px;
  height: 38px;
  border: 2px solid rgba(34, 211, 238, 0.4);
  border-radius: 12px;
  position: relative;
}

.scroll-wheel::before {
  content: '';
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 8px;
  background: #22d3ee;
  border-radius: 2px;
  animation: scroll-dot 2s ease-in-out infinite;
}

@keyframes scroll-dot {
  0%, 100% { opacity: 1; transform: translateX(-50%) translateY(0); }
  50% { opacity: 0.3; transform: translateX(-50%) translateY(10px); }
}

/* ===== About ===== */
.about-visual {
  background: linear-gradient(145deg, rgba(18, 24, 42, 0.9), rgba(13, 17, 23, 0.95));
}

.about-visual::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, #22d3ee, transparent);
}

.code-window {
  position: relative;
  z-index: 1;
}

.feature-pill {
  display: flex;
  gap: 1rem;
  padding: 1.25rem;
  border-radius: 1rem;
  border: 1px solid rgba(30, 42, 69, 0.8);
  background: rgba(13, 17, 23, 0.6);
  transition: border-color 0.3s, transform 0.3s, box-shadow 0.3s;
}

.feature-pill:hover {
  border-color: rgba(34, 211, 238, 0.35);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
}

.feature-icon {
  flex-shrink: 0;
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: #22d3ee;
  background: rgba(34, 211, 238, 0.1);
  border-radius: 0.625rem;
}

/* ===== Service cards ===== */
.service-card {
  position: relative;
  padding: 2rem;
  border-radius: 1.25rem;
  border: 1px solid rgba(30, 42, 69, 0.9);
  background: linear-gradient(160deg, rgba(18, 24, 42, 0.85) 0%, rgba(13, 17, 23, 0.9) 100%);
  overflow: hidden;
  transition: transform 0.4s cubic-bezier(0.23, 1, 0.32, 1),
              border-color 0.4s,
              box-shadow 0.4s;
}

.service-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.08), rgba(139, 92, 246, 0.06));
  opacity: 0;
  transition: opacity 0.4s;
}

.service-card::after {
  content: '';
  position: absolute;
  top: -50%;
  right: -50%;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, rgba(34, 211, 238, 0.15) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.4s;
  pointer-events: none;
}

.service-card:hover {
  transform: translateY(-8px) scale(1.02);
  border-color: rgba(34, 211, 238, 0.45);
  box-shadow:
    0 20px 40px rgba(0, 0, 0, 0.35),
    0 0 40px rgba(34, 211, 238, 0.08);
}

.service-card:hover::before,
.service-card:hover::after {
  opacity: 1;
}

.service-card > * {
  position: relative;
  z-index: 1;
}

.service-icon {
  width: 3rem;
  height: 3rem;
  margin-bottom: 1.25rem;
  padding: 0.65rem;
  border-radius: 0.75rem;
  background: rgba(34, 211, 238, 0.12);
  color: #22d3ee;
  transition: transform 0.4s, background 0.4s;
}

.service-card:hover .service-icon {
  transform: scale(1.1) rotate(-5deg);
  background: rgba(34, 211, 238, 0.2);
}

.service-icon svg {
  width: 100%;
  height: 100%;
}

/* ===== Contact ===== */
.contact-channel {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  border-radius: 1rem;
  border: 1px solid rgba(30, 42, 69, 0.9);
  background: rgba(13, 17, 23, 0.7);
  transition: border-color 0.3s, background 0.3s, transform 0.3s;
}

.contact-channel:hover {
  border-color: rgba(34, 211, 238, 0.3);
  background: rgba(18, 24, 42, 0.9);
}

.contact-channel-icon {
  flex-shrink: 0;
  width: 3rem;
  height: 3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.75rem;
}

.contact-form {
  padding: 2rem;
  border-radius: 1.25rem;
  border: 1px solid rgba(30, 42, 69, 0.9);
  background: linear-gradient(160deg, rgba(18, 24, 42, 0.6), rgba(13, 17, 23, 0.85));
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: #d1d5db;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 0.875rem 1rem;
  border-radius: 0.625rem;
  border: 1px solid rgba(30, 42, 69, 1);
  background: rgba(6, 8, 15, 0.8);
  color: #f3f4f6;
  font-family: inherit;
  font-size: 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: rgba(34, 211, 238, 0.5);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.12);
}

.form-group textarea {
  resize: vertical;
  min-height: 120px;
}

/* ===== Scroll reveal ===== */
.reveal {
  opacity: 0;
  transform: translateY(32px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

.reveal-delay-1 { transition-delay: 0.1s; }
.reveal-delay-2 { transition-delay: 0.2s; }

@keyframes fade-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.animate-fade-in {
  animation: fade-in 0.8s ease forwards;
}

/* ===== Cursor follow & click effects ===== */
.cursor-fx {
  position: fixed;
  inset: 0;
  z-index: 9998;
  pointer-events: none;
  overflow: hidden;
}

.cursor-trail-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.cursor-glow,
.cursor-dot,
.cursor-ring {
  position: absolute;
  top: 0;
  left: 0;
  margin-top: 0;
  margin-left: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s ease;
  will-change: transform;
}

.cursor-fx--active .cursor-glow,
.cursor-fx--active .cursor-dot,
.cursor-fx--active .cursor-ring {
  opacity: 1;
}

.cursor-glow {
  width: 120px;
  height: 120px;
  margin: -60px 0 0 -60px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(34, 211, 238, 0.2) 0%, rgba(59, 130, 246, 0.08) 40%, transparent 70%);
}

.cursor-dot {
  width: 8px;
  height: 8px;
  margin: -4px 0 0 -4px;
  border-radius: 50%;
  background: #22d3ee;
  box-shadow: 0 0 12px #22d3ee, 0 0 24px rgba(59, 130, 246, 0.6);
}

.cursor-ring {
  width: 36px;
  height: 36px;
  margin: -18px 0 0 -18px;
  border-radius: 50%;
  border: 1px solid rgba(34, 211, 238, 0.55);
  transition: transform 0.08s ease, width 0.2s, height 0.2s, margin 0.2s, border-color 0.2s;
}

.cursor-ring--click {
  width: 52px;
  height: 52px;
  margin: -26px 0 0 -26px;
  border-color: rgba(139, 92, 246, 0.75);
}

.cursor-ripples {
  position: absolute;
  inset: 0;
}

.cursor-ripple {
  position: absolute;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border-radius: 50%;
  border: 2px solid rgba(34, 211, 238, 0.7);
  animation: cursor-ripple-expand 0.75s ease-out forwards;
}

.cursor-ripple--click {
  border-color: rgba(139, 92, 246, 0.65);
  animation-duration: 0.9s;
}

@keyframes cursor-ripple-expand {
  0% {
    transform: scale(0.3);
    opacity: 1;
  }
  100% {
    transform: scale(4);
    opacity: 0;
  }
}

/* Keep system cursor visible — custom cursor is additive only */

@media (pointer: coarse) {
  .cursor-dot,
  .cursor-ring,
  .cursor-glow {
    display: none;
  }
}

/* ===== Reduced motion ===== */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .service-card:hover { transform: none; }
  .hero-glow { animation: none; }
  .typing-cursor::after { animation: none; }
  .hero-logo-wrap,
  .hero-logo-inner,
  .hero-logo-pulse,
  .hero-logo-orbit { animation: none; }
  .hero-logo-wrap,
  .hero-logo-inner { transform: none; }
  .cursor-fx { display: none; }
}
