/* ═══════════════════════════════════════════════════
   MIDGRO — Design System
   Theme: Black · Red · Blue
   ═══════════════════════════════════════════════════ */

/* ── Variables ───────────────────────────────────── */
:root {
  --bg:          #060910;
  --bg-card:     #0b1020;
  --bg-card-h:   #0e1428;

  --red:         #c91c1c;
  --red-bright:  #e02424;
  --red-glow:    rgba(201, 28, 28, 0.22);

  --blue:        #1a48c8;
  --blue-soft:   #2a5ce0;
  --blue-glow:   rgba(26, 72, 200, 0.18);

  --text:        #edf2f8;
  --text-sub:    #8a9bb8;
  --text-muted:  #4a5a72;

  --border:      rgba(255, 255, 255, 0.06);
  --border-h:    rgba(42, 92, 224, 0.28);

  --nav-h:       72px;

  --r-sm:        6px;
  --r-md:        10px;
  --r-lg:        16px;

  --ease:        cubic-bezier(0.22, 1, 0.36, 1);
  --ease-fast:   cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; background: none; font: inherit; }
input, textarea { font: inherit; }
ul, ol { list-style: none; }

/* ── Background grid ─────────────────────────────── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(26, 72, 200, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(26, 72, 200, 0.045) 1px, transparent 1px);
  background-size: 64px 64px;
  pointer-events: none;
  z-index: 0;
}

/* ── Canvas ──────────────────────────────────────── */
#bg-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.85;
}

/* ── Layout helpers ──────────────────────────────── */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 clamp(20px, 5vw, 60px);
  position: relative;
  z-index: 2;
}

section {
  position: relative;
  z-index: 2;
}

/* ── Typography ──────────────────────────────────── */
h1, h2, h3 {
  line-height: 1.08;
  letter-spacing: -0.025em;
  font-weight: 700;
}

h1 { font-size: clamp(44px, 6.5vw, 88px); }
h2 { font-size: clamp(32px, 4.5vw, 58px); }
h3 { font-size: clamp(17px, 1.4vw, 20px); font-weight: 600; }

p { color: var(--text-sub); }

.section-label {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--red-bright);
  margin-bottom: 16px;
}

/* ── Buttons ─────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 32px;
  border-radius: var(--r-sm);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: all 0.22s var(--ease-fast);
  white-space: nowrap;
  position: relative;
}

.btn-primary {
  background: var(--red);
  color: #fff;
  box-shadow: 0 0 28px var(--red-glow);
}
.btn-primary:hover {
  background: var(--red-bright);
  box-shadow: 0 0 44px rgba(224, 36, 36, 0.38);
  transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0); }

.btn-outline {
  border: 1px solid var(--border-h);
  color: var(--text);
}
.btn-outline:hover {
  border-color: rgba(42, 92, 224, 0.5);
  background: rgba(26, 72, 200, 0.08);
  transform: translateY(-1px);
}

/* ── Navigation ──────────────────────────────────── */
#nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: var(--nav-h);
  transition: background 0.3s var(--ease), border-color 0.3s var(--ease), backdrop-filter 0.3s;
  border-bottom: 1px solid transparent;
}

#nav.nav--scrolled {
  background: rgba(6, 9, 16, 0.88);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom-color: var(--border);
}

.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 clamp(20px, 5vw, 60px);
  height: 100%;
  display: flex;
  align-items: center;
  gap: 40px;
}

/* Logo */
.nav-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  outline-offset: 4px;
}
.logo-word {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--text);
}

/* Nav links */
#nav-menu {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.nav-link {
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-sub);
  border-radius: var(--r-sm);
  transition: color 0.18s, background 0.18s;
}
.nav-link:hover { color: var(--text); background: rgba(255,255,255,0.05); }

/* Lang switch */
.nav-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

.lang-switch {
  display: flex;
  align-items: center;
  gap: 2px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 3px;
}

.lang-btn {
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}
.lang-btn:hover    { color: var(--text); background: rgba(255,255,255,0.07); }
.lang-btn.active   { color: #fff; background: var(--red); }

/* Hamburger */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 36px;
  height: 36px;
  padding: 6px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
}

.bar {
  display: block;
  height: 1.5px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.25s var(--ease), opacity 0.2s;
}

.nav-toggle.open .bar:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.nav-toggle.open .bar:nth-child(2) { opacity: 0; transform: scaleX(0); }
.nav-toggle.open .bar:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

/* ── Hero ────────────────────────────────────────── */
#hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: calc(var(--nav-h) + 60px) clamp(20px, 5vw, 60px) 80px;
  position: relative;
}

/* Radial glow behind hero content */
#hero::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -55%);
  width: min(700px, 90vw);
  height: min(700px, 90vh);
  background: radial-gradient(ellipse, rgba(201, 28, 28, 0.07) 0%, transparent 68%);
  pointer-events: none;
  z-index: 0;
}

#hero::after {
  content: '';
  position: absolute;
  bottom: -100px;
  left: 50%;
  transform: translateX(-50%);
  width: min(600px, 80vw);
  height: 200px;
  background: radial-gradient(ellipse, rgba(26, 72, 200, 0.07) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.hero-inner {
  position: relative;
  z-index: 2;
  max-width: 860px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

.hero-eyebrow {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--red-bright);
  margin-bottom: 24px;
}

.hero-title {
  color: var(--text);
  margin-bottom: 20px;
}

/* Rotating capability tag */
.hero-rotating-wrap {
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 28px;
  overflow: hidden;
}

#rotating-text {
  font-size: clamp(15px, 1.6vw, 18px);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--blue-soft);
  border: 1px solid rgba(42, 92, 224, 0.28);
  padding: 6px 20px;
  border-radius: 100px;
  background: rgba(26, 72, 200, 0.08);
  transition: opacity 0.35s var(--ease-fast);
  white-space: nowrap;
}

#rotating-text.fade-out { opacity: 0; }

.hero-desc {
  font-size: clamp(16px, 1.3vw, 18px);
  line-height: 1.7;
  color: var(--text-sub);
  max-width: 600px;
  margin-bottom: 40px;
}

.hero-actions {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
}

/* Scroll cue */
.hero-scroll {
  position: absolute;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
}

.scroll-line {
  width: 1px;
  height: 60px;
  background: linear-gradient(to bottom, transparent, var(--text-muted));
  margin: 0 auto;
  animation: scrollPulse 2s ease-in-out infinite;
}

@keyframes scrollPulse {
  0%, 100% { opacity: 0; transform: scaleY(0.5) translateY(-10px); }
  50%       { opacity: 1; transform: scaleY(1) translateY(0); }
}

/* ── Section common ──────────────────────────────── */
.section-pad {
  padding: clamp(80px, 10vw, 140px) 0;
}

.section-header {
  text-align: center;
  margin-bottom: clamp(48px, 6vw, 72px);
}

.section-header h2 { margin-top: 8px; }
.section-header p {
  margin-top: 16px;
  font-size: clamp(15px, 1.2vw, 17px);
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
}

/* ── Capabilities cards ──────────────────────────── */
#capabilities { background: transparent; }

.cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: clamp(24px, 3vw, 36px);
  transition: border-color 0.28s var(--ease), box-shadow 0.28s var(--ease), transform 0.28s var(--ease);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(26, 72, 200, 0.04) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.3s;
  border-radius: inherit;
}

.card:hover::before { opacity: 1; }

.card:hover {
  border-color: var(--border-h);
  box-shadow: 0 0 32px rgba(26, 72, 200, 0.09), 0 8px 32px rgba(0,0,0,0.3);
  transform: translateY(-3px);
}

.card-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(26, 72, 200, 0.1);
  border: 1px solid rgba(26, 72, 200, 0.2);
  border-radius: var(--r-md);
  margin-bottom: 20px;
  color: var(--blue-soft);
  flex-shrink: 0;
}

.card-title {
  color: var(--text);
  margin-bottom: 10px;
}

.card-desc {
  font-size: 14px;
  line-height: 1.65;
  color: var(--text-sub);
}

/* ── About ───────────────────────────────────────── */
#about { background: rgba(11, 16, 32, 0.5); }

.about-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(40px, 6vw, 100px);
  align-items: start;
}

.about-content h2 { margin-top: 8px; margin-bottom: 20px; }
.about-content p  { font-size: 16px; line-height: 1.75; }

.about-stats {
  display: flex;
  flex-direction: column;
  gap: 40px;
  padding-top: 8px;
}

.stat { border-left: 2px solid var(--red); padding-left: 24px; }

.stat-value {
  display: block;
  font-size: clamp(36px, 4vw, 52px);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text);
  line-height: 1;
  margin-bottom: 6px;
}

.stat-label {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* ── Contact ─────────────────────────────────────── */
#contact { background: transparent; }

.contact-form {
  max-width: 640px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-group { position: relative; }
.form-group-full { grid-column: 1 / -1; }

.form-group input,
.form-group textarea {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 14px 16px;
  color: var(--text);
  font-size: 15px;
  outline: none;
  resize: vertical;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group textarea:focus {
  border-color: rgba(42, 92, 224, 0.45);
  box-shadow: 0 0 0 3px rgba(26, 72, 200, 0.1);
}

.form-group input.error,
.form-group textarea.error {
  border-color: var(--red);
  box-shadow: 0 0 0 3px var(--red-glow);
}

.form-group input::placeholder,
.form-group textarea::placeholder { color: var(--text-muted); }

.contact-form .btn { grid-column: 1 / -1; justify-self: start; }

.form-success {
  text-align: center;
  padding: 40px;
  color: #6ee7b7;
  font-size: 16px;
  font-weight: 500;
}

.form-error {
  text-align: center;
  padding: 16px;
  color: #f87171;
  font-size: 14px;
  font-weight: 500;
  margin-top: 8px;
}

.hidden { display: none; }

/* ── Footer ──────────────────────────────────────── */
#footer {
  border-top: 1px solid var(--border);
  padding: 60px 0 40px;
  position: relative;
  z-index: 2;
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 clamp(20px, 5vw, 60px);
}

.footer-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 40px;
  padding-bottom: 40px;
  border-bottom: 1px solid var(--border);
}

.footer-tagline {
  font-size: 14px;
  color: var(--text-muted);
  font-style: italic;
}

.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.footer-copy { font-size: 13px; color: var(--text-muted); }

.footer-links {
  display: flex;
  gap: 24px;
}

.footer-links a {
  font-size: 13px;
  color: var(--text-muted);
  transition: color 0.18s;
}
.footer-links a:hover { color: var(--text); }

/* ── Reveal animation ────────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
}

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

/* Stagger delays for cards */
.cards-grid .card:nth-child(1) { transition-delay: 0ms; }
.cards-grid .card:nth-child(2) { transition-delay: 80ms; }
.cards-grid .card:nth-child(3) { transition-delay: 160ms; }
.cards-grid .card:nth-child(4) { transition-delay: 240ms; }
.cards-grid .card:nth-child(5) { transition-delay: 320ms; }
.cards-grid .card:nth-child(6) { transition-delay: 400ms; }

/* ── Focus styles ────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--blue-soft);
  outline-offset: 3px;
  border-radius: 3px;
}

/* ── Responsive ──────────────────────────────────── */
@media (max-width: 1024px) {
  .cards-grid { grid-template-columns: repeat(2, 1fr); }

  .about-layout {
    grid-template-columns: 1fr;
    gap: 48px;
  }

  .about-stats {
    flex-direction: row;
    gap: 32px;
  }
}

@media (max-width: 768px) {
  .cards-grid { grid-template-columns: 1fr; gap: 14px; }

  /* Mobile nav */
  .nav-toggle { display: flex; }

  #nav-menu {
    position: fixed;
    top: var(--nav-h);
    left: 0;
    right: 0;
    background: rgba(6, 9, 16, 0.97);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    align-items: flex-start;
    padding: 16px clamp(20px, 5vw, 40px) 24px;
    gap: 4px;
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.3s var(--ease), opacity 0.3s var(--ease);
    z-index: 99;
  }

  #nav-menu.open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }

  .nav-link { padding: 12px 14px; font-size: 16px; width: 100%; }

  .about-stats { flex-direction: column; gap: 28px; }

  .contact-form { grid-template-columns: 1fr; }

  .footer-top    { flex-direction: column; align-items: flex-start; }
  .footer-bottom { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 480px) {
  .hero-actions { flex-direction: column; width: 100%; }
  .hero-actions .btn { width: 100%; justify-content: center; }
  .btn { padding: 13px 24px; }
}

/* ── Print ───────────────────────────────────────── */
@media print {
  #bg-canvas, body::before, .hero-scroll { display: none; }
  body { background: #fff; color: #000; }
}

/* ── Reduced motion ──────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  .reveal { opacity: 1; transform: none; }
  .scroll-line { animation: none; }
}
