*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #050508;
  --bg-card: rgba(12, 14, 22, 0.72);
  --cyan: #00e8ff;
  --blue: #3b82f6;
  --purple: #a855f7;
  --magenta: #d946ef;
  --text: #e8eaef;
  --text-muted: #8b92a8;
  --border: rgba(0, 232, 255, 0.12);
  --glow-cyan: rgba(0, 232, 255, 0.35);
  --glow-purple: rgba(168, 85, 247, 0.35);
  --radius: 16px;
  --font: 'Inter', system-ui, -apple-system, sans-serif;
}

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
  max-width: 100%;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  max-width: 100%;
  overscroll-behavior-x: none;
  -webkit-font-smoothing: antialiased;
}

/* ── Background effects (GPU-friendly) ── */

.bg-mesh {
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(ellipse 60% 50% at 15% 20%, rgba(0, 232, 255, 0.08), transparent),
    radial-gradient(ellipse 50% 40% at 85% 75%, rgba(168, 85, 247, 0.07), transparent),
    radial-gradient(ellipse 40% 30% at 50% 50%, rgba(59, 130, 246, 0.04), transparent);
  animation: mesh-drift 20s ease-in-out infinite alternate;
}

.bg-grid {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, black, transparent);
}

@keyframes mesh-drift {
  0%   { transform: translateY(0); }
  100% { transform: translateY(1.5%); }
}

/* ── Header ── */

.header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  backdrop-filter: blur(12px);
  background: rgba(5, 5, 8, 0.75);
  border-bottom: 1px solid var(--border);
}

.logo-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--text);
}

.logo {
  width: 48px;
  height: 48px;
  object-fit: contain;
}

.logo-text {
  font-weight: 600;
  font-size: 1.125rem;
  letter-spacing: -0.02em;
}

.logo-text .accent {
  background: linear-gradient(135deg, var(--cyan), var(--purple));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ── Buttons ── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 12px;
  font-family: var(--font);
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  text-decoration: none;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: linear-gradient(135deg, var(--cyan), var(--blue), var(--purple));
  color: #fff;
  box-shadow: 0 4px 24px var(--glow-cyan);
}

.btn-primary:hover {
  box-shadow: 0 6px 32px var(--glow-purple);
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-outline:hover {
  border-color: var(--cyan);
  background: rgba(0, 232, 255, 0.05);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 0.5rem 1.25rem;
}

.btn-ghost:hover {
  background: rgba(0, 232, 255, 0.08);
  border-color: rgba(0, 232, 255, 0.3);
}

.card .btn-primary {
  width: 100%;
  margin-top: auto;
}

.btn-full {
  width: 100%;
}

/* ── Hero ── */

.hero {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: 3rem;
  max-width: 1200px;
  margin: 0 auto;
  padding: 5rem 2rem 4rem;
  min-height: calc(100vh - 80px);
}

.hero-glow {
  position: absolute;
  top: 20%;
  left: 30%;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--glow-cyan), transparent 70%);
  filter: blur(80px);
  opacity: 0.4;
  animation: glow-pulse 6s ease-in-out infinite alternate;
  pointer-events: none;
}

@keyframes glow-pulse {
  0%   { opacity: 0.3; scale: 1; }
  100% { opacity: 0.5; scale: 1.1; }
}

.hero-title {
  font-size: clamp(2.5rem, 5vw, 3.75rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin-bottom: 1.25rem;
}

.gradient-text {
  background: linear-gradient(135deg, var(--cyan) 0%, var(--blue) 40%, var(--purple) 80%, var(--magenta) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-desc {
  font-size: 1.125rem;
  color: var(--text-muted);
  max-width: 480px;
  margin-bottom: 2rem;
}

.hero-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.hero-visual {
  display: flex;
  justify-content: center;
  align-items: center;
}

.hero-logo {
  width: min(320px, 80%);
  height: auto;
  animation: logo-float 8s ease-in-out infinite;
  filter: drop-shadow(0 0 40px var(--glow-cyan)) drop-shadow(0 0 60px var(--glow-purple));
}

@keyframes logo-float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-12px); }
}

/* ── Services ── */

.services {
  max-width: 1200px;
  margin: 0 auto;
  padding: 4rem 2rem 6rem;
}

.section-head {
  text-align: center;
  margin-bottom: 3rem;
}

.section-head h2 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}

.section-head p {
  color: var(--text-muted);
  font-size: 1.0625rem;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
}

.card {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 2rem;
  border-radius: var(--radius);
  background: transparent;
  border: none;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.07),
    inset 0 -2px 4px rgba(0, 0, 0, 0.25),
    0 4px 8px rgba(0, 0, 0, 0.2),
    0 12px 24px rgba(0, 0, 0, 0.18);
  transition: transform 0.35s ease, box-shadow 0.35s ease;
}

.card::before {
  content: '';
  position: absolute;
  z-index: 0;
  top: 50%;
  left: 50%;
  width: 220%;
  height: 220%;
  transform: translate(-50%, -50%);
  background: conic-gradient(
    from 0deg,
    transparent 0deg 250deg,
    rgba(176, 180, 192, 0.2) 268deg,
    #a8acb8 288deg,
    #e8eaef 306deg,
    #ffffff 312deg,
    #d0d4dc 322deg,
    #a0a4b0 334deg,
    rgba(176, 180, 192, 0.15) 348deg,
    transparent 360deg
  );
  opacity: 0;
  transition: opacity 0.35s ease;
  animation: card-snake 2.6s linear infinite;
  animation-play-state: paused;
  pointer-events: none;
}

.card::after {
  content: '';
  position: absolute;
  inset: 1.5px;
  border-radius: calc(var(--radius) - 1.5px);
  background: linear-gradient(
    160deg,
    rgba(22, 24, 34, 0.96) 0%,
    rgba(12, 14, 22, 0.98) 45%,
    rgba(6, 8, 14, 1) 100%
  );
  backdrop-filter: blur(10px);
  z-index: 1;
  pointer-events: none;
  transition: inset 0.3s ease;
}

.card > * {
  position: relative;
  z-index: 2;
}

.card:hover {
  transform: translateY(-6px) perspective(800px) rotateX(2deg);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    inset 0 -2px 4px rgba(0, 0, 0, 0.2),
    0 10px 20px rgba(0, 0, 0, 0.3),
    0 24px 48px rgba(0, 0, 0, 0.25),
    0 0 24px rgba(200, 205, 220, 0.06);
}

.card:hover::before {
  opacity: 1;
  animation-play-state: running;
}

@keyframes card-snake {
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

.card h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.card p {
  color: var(--text-muted);
  font-size: 0.9375rem;
  flex: 1;
  margin-bottom: 1.5rem;
}

/* ── Reveal animation ── */

.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

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

.reveal[data-delay="1"] { transition-delay: 0.1s; }
.reveal[data-delay="2"] { transition-delay: 0.2s; }
.reveal[data-delay="3"] { transition-delay: 0.3s; }

/* ── Contacts ── */

.contacts {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 2rem 5rem;
}

.contacts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.contact-card {
  display: grid;
  gap: 0.4rem;
  padding: 1.25rem 1.5rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: rgba(14, 16, 26, 0.72);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease;
}

.contact-card:hover {
  border-color: rgba(0, 232, 255, 0.35);
  transform: translateY(-3px);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.22);
}

.contact-label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
}

.contact-value {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  word-break: break-word;
}

.contact-card[hidden] {
  display: none;
}

/* ── Footer ── */

.footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 2rem;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.875rem;
}

.footer-logo {
  width: 32px;
  height: 32px;
  object-fit: contain;
  opacity: 0.7;
}

/* ── Modal ── */

.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal.open {
  opacity: 1;
  visibility: visible;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}

.modal-dialog {
  position: relative;
  width: 100%;
  max-width: 440px;
  padding: 2rem;
  border-radius: var(--radius);
  background: rgba(14, 16, 26, 0.95);
  border: 1px solid var(--border);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5), 0 0 40px var(--glow-cyan);
  transform: translateY(16px) scale(0.97);
  transition: transform 0.3s ease;
}

.modal.open .modal-dialog {
  transform: translateY(0) scale(1);
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

.modal-close svg {
  width: 18px;
  height: 18px;
}

.modal-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.375rem;
}

.modal-subtitle {
  color: var(--text-muted);
  font-size: 0.9375rem;
  margin-bottom: 1.5rem;
}

.modal-form .field {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  margin-bottom: 1rem;
}

.modal-form .field span {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
}

.modal-form input,
.modal-form textarea {
  padding: 0.75rem 1rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.3);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.9375rem;
  transition: border-color 0.2s;
  resize: vertical;
}

.modal-form input:focus,
.modal-form textarea:focus {
  outline: none;
  border-color: rgba(0, 232, 255, 0.4);
  box-shadow: 0 0 0 3px rgba(0, 232, 255, 0.08);
}

.modal-form input::placeholder,
.modal-form textarea::placeholder {
  color: rgba(139, 146, 168, 0.6);
}

.form-error {
  margin-bottom: 0.75rem;
  font-size: 0.875rem;
  color: #f87171;
  text-align: center;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.modal-success {
  text-align: center;
  padding: 1rem 0;
}

.modal-success .success-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--cyan), var(--purple));
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
}

.modal-success h3 {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
}

.modal-success p {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

/* ── Responsive ── */

@media (max-width: 768px) {
  html,
  body {
    position: relative;
    width: 100%;
    overflow-x: hidden;
    touch-action: pan-y;
  }

  .header {
    display: none;
  }

  .logo-text {
    display: none;
  }

  .hero {
    grid-template-columns: 1fr;
    text-align: center;
    padding: 3rem 1.25rem 2rem;
    min-height: auto;
    overflow-x: hidden;
  }

  .hero-desc {
    margin-left: auto;
    margin-right: auto;
  }

  .hero-actions {
    justify-content: center;
  }

  .hero-visual {
    order: -1;
  }

  .hero-logo {
    width: 200px;
  }

  .hero-glow {
    left: 50%;
    translate: -50% 0;
    width: 280px;
    height: 280px;
    animation: none;
    scale: 1;
    opacity: 0.4;
  }

  .bg-mesh,
  .bg-grid {
    animation: none;
    transform: none;
  }

  .card::before {
    animation: none;
    opacity: 0;
  }

  .card:hover {
    transform: translateY(-4px);
  }

  main,
  .services,
  .footer {
    overflow-x: hidden;
    max-width: 100%;
  }

  .services {
    padding: 3rem 1.25rem 4rem;
  }

  .contacts {
    padding: 2rem 1.25rem 3.5rem;
  }

  .modal {
    align-items: flex-end;
    padding: 0;
  }

  .modal-dialog {
    max-height: 92dvh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    padding: 1.25rem 1.25rem calc(1.25rem + env(safe-area-inset-bottom));
  }

}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .card:hover::before {
    animation-play-state: paused;
    opacity: 0.6;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }
}