/* ==============================================
   NSALAB — Infrastructure Engineering Services
   Professional + 8-bit aesthetic
   ============================================== */

/* --- Design Tokens --- */
:root {
  --bg: #FFFFFF;
  --bg-alt: #F7F7F8;
  --text: #1B1B2F;
  --text-muted: #6B7280;
  --accent: #3B82F6;
  --accent-hover: #2563EB;
  --pixel-green: #10B981;
  --pixel-green-bg: #ECFDF5;
  --border: #E5E7EB;
  --card-bg: #FFFFFF;

  --font-pixel: 'Press Start 2P', monospace;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  --container: 1100px;
  --section-pad: 100px;
  --gap: 24px;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
}

body {
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--accent-hover); }

/* ================================================
   LANGUAGE TOGGLE (pure CSS, no JS)
   ================================================ */
#lang-en, #lang-ru { display: none; }

/* Default: show English, hide Russian */
.lang-ru { display: none; }

/* When Russian is selected: hide English */
#lang-ru:checked ~ header .lang-en,
#lang-ru:checked ~ main .lang-en,
#lang-ru:checked ~ footer .lang-en { display: none; }

/* When Russian is selected: show Russian (inline elements) */
#lang-ru:checked ~ header span.lang-ru,
#lang-ru:checked ~ main span.lang-ru,
#lang-ru:checked ~ footer span.lang-ru { display: inline; }

/* When Russian is selected: show Russian (block elements) */
#lang-ru:checked ~ header p.lang-ru,
#lang-ru:checked ~ main p.lang-ru,
#lang-ru:checked ~ footer p.lang-ru,
#lang-ru:checked ~ header div.lang-ru,
#lang-ru:checked ~ main div.lang-ru,
#lang-ru:checked ~ footer div.lang-ru { display: block; }

/* Language switcher in header */
.lang-switch {
  display: flex;
  align-items: center;
  gap: 2px;
  font-family: var(--font-pixel);
  font-size: 9px;
  user-select: none;
}

.lang-switch label {
  cursor: pointer;
  padding: 5px 8px;
  color: var(--text-muted);
  transition: color 0.2s;
  border: 2px solid transparent;
}

.lang-switch label:hover {
  color: var(--text);
}

.lang-sep {
  color: var(--border);
  font-size: 12px;
}

/* Active language indicator */
#lang-en:checked ~ .site-header .lang-switch label[for="lang-en"],
#lang-ru:checked ~ .site-header .lang-switch label[for="lang-ru"] {
  color: var(--accent);
  border: 2px solid var(--accent);
}

/* --- Subtle Pixel Grid Overlay --- */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  background-image:
    linear-gradient(rgba(27, 27, 47, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(27, 27, 47, 0.025) 1px, transparent 1px);
  background-size: 20px 20px;
}

/* --- Layout --- */
.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
}

/* --- Typography --- */
h1, h2, h3 {
  line-height: 1.3;
  font-weight: 700;
}

h1 {
  font-family: var(--font-pixel);
  font-size: clamp(24px, 4.5vw, 40px);
  letter-spacing: 2px;
  margin-bottom: 24px;
}

h2 {
  font-family: var(--font-pixel);
  font-size: clamp(13px, 2vw, 18px);
  letter-spacing: 1px;
  margin-bottom: 16px;
}

h3 {
  font-family: var(--font-body);
  font-size: 19px;
  font-weight: 600;
  margin-bottom: 12px;
}

.section-subtitle {
  color: var(--text-muted);
  font-size: 18px;
  margin-bottom: 48px;
}

.pixel-text {
  font-family: var(--font-pixel);
}

/* --- Pixel Design Elements --- */
.pixel-border {
  border: 3px solid var(--text);
  box-shadow: 4px 4px 0 0 var(--text);
}

.pixel-btn {
  display: inline-block;
  font-family: var(--font-pixel);
  font-size: 10px;
  padding: 16px 28px;
  border: 3px solid var(--text);
  box-shadow: 4px 4px 0 0 var(--text);
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  transition: all 0.1s ease;
  text-transform: uppercase;
  letter-spacing: 1px;
  line-height: 1;
}

.pixel-btn:hover {
  color: #fff;
  box-shadow: 2px 2px 0 0 var(--text);
  transform: translate(2px, 2px);
}

.pixel-btn:active {
  box-shadow: 0 0 0 0 var(--text);
  transform: translate(4px, 4px);
}

.pixel-btn-outline {
  background: transparent;
  color: var(--text);
}

.pixel-btn-outline:hover {
  background: var(--bg-alt);
  color: var(--text);
}

/* --- Animations --- */
@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

@keyframes pulse-green {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

/* ================================================
   HEADER / NAV
   ================================================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 2px solid var(--border);
  padding: 16px 0;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-family: var(--font-pixel);
  font-size: 14px;
  color: var(--text);
  letter-spacing: 3px;
  text-decoration: none;
}
.logo:hover { color: var(--accent); }

/* Checkbox nav toggle (pure CSS, no JS) */
#nav-toggle { display: none; }

.nav-toggle-label {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: 4px;
  z-index: 10;
}

.nav-toggle-label span {
  display: block;
  width: 24px;
  height: 3px;
  background: var(--text);
  transition: all 0.2s ease;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 32px;
  list-style: none;
}

.nav-links a {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  letter-spacing: 0.5px;
}

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

.nav-cta {
  font-family: var(--font-pixel) !important;
  font-size: 9px !important;
  padding: 8px 16px;
  border: 2px solid var(--text);
  box-shadow: 3px 3px 0 0 var(--text);
  transition: all 0.1s ease !important;
}

.nav-cta:hover {
  box-shadow: 1px 1px 0 0 var(--text) !important;
  transform: translate(2px, 2px);
  color: var(--accent) !important;
}

/* ================================================
   HERO
   ================================================ */
.hero {
  padding: 120px 0 100px;
  text-align: center;
}

.hero-prefix {
  font-family: var(--font-pixel);
  font-size: clamp(10px, 1.5vw, 13px);
  color: var(--pixel-green);
  margin-bottom: 28px;
  letter-spacing: 2px;
}

/* Blinking cursor after "> hello world" */
.hero-prefix::after {
  content: '_';
  display: inline;
  animation: blink 0.8s step-end infinite;
}

.hero h1 {
  max-width: 700px;
  margin-left: auto;
  margin-right: auto;
}

.hero-subtitle {
  font-size: 18px;
  color: var(--text-muted);
  max-width: 580px;
  margin: 0 auto 44px;
  line-height: 1.75;
}

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

/* ================================================
   ABOUT — 50/50 split with XP card
   ================================================ */
.about {
  padding: var(--section-pad) 0;
  background: var(--bg-alt);
}

.split {
  display: flex;
  align-items: center;
  gap: 64px;
}

.split-text {
  flex: 1;
}

.split-text p {
  margin-bottom: 16px;
  color: var(--text-muted);
}

.split-text .highlight {
  font-family: var(--font-pixel);
  font-size: 11px;
  color: var(--text);
  letter-spacing: 1px;
  margin-top: 24px;
  padding: 0;
}

.split-visual {
  flex: 1;
  display: flex;
  justify-content: center;
}

/* RPG-style XP / stats card */
.xp-card {
  background: var(--card-bg);
  padding: 28px 24px;
  width: 100%;
  max-width: 360px;
}

.xp-header {
  font-family: var(--font-pixel);
  font-size: 10px;
  letter-spacing: 2px;
  margin-bottom: 24px;
  text-align: center;
  color: var(--text-muted);
}

.xp-stat {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.xp-label {
  font-family: var(--font-pixel);
  font-size: 7px;
  width: 32px;
  color: var(--accent);
  letter-spacing: 1px;
  flex-shrink: 0;
}

.xp-bar {
  flex: 1;
  height: 14px;
  background: var(--bg-alt);
  border: 2px solid var(--text);
  overflow: hidden;
}

.xp-fill {
  height: 100%;
  background: var(--pixel-green);
  image-rendering: pixelated;
}

.xp-value {
  font-family: var(--font-pixel);
  font-size: 6px;
  width: 64px;
  text-align: right;
  color: var(--text);
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

/* ================================================
   SERVICES — 3-column card grid
   ================================================ */
.services {
  padding: var(--section-pad) 0;
  text-align: center;
}

.services-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--gap);
  text-align: left;
}

.service-card {
  background: var(--card-bg);
  padding: 32px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.service-card:hover {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 0 var(--text);
}

.service-icon {
  font-family: var(--font-pixel);
  font-size: 16px;
  color: var(--accent);
  margin-bottom: 20px;
  letter-spacing: 2px;
}

.service-card h3 {
  font-size: 17px;
  margin-bottom: 12px;
}

.service-card p {
  font-size: 15px;
  color: var(--text-muted);
  margin-bottom: 20px;
  line-height: 1.65;
}

.tech-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tech-tags span {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  padding: 3px 8px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  color: var(--text-muted);
  letter-spacing: 0.3px;
}

/* ================================================
   APPROACH — alternating 50/50 rows
   ================================================ */
.approach {
  padding: var(--section-pad) 0;
  background: var(--bg-alt);
  text-align: center;
}

.approach h2 {
  margin-bottom: 64px;
}

.approach-steps {
  display: flex;
  flex-direction: column;
  gap: 64px;
}

.approach .split {
  text-align: left;
}

.split-reverse {
  flex-direction: row-reverse;
}

.approach-badge {
  width: 100px;
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--card-bg);
}

.approach-number {
  font-family: var(--font-pixel);
  font-size: 24px;
  color: var(--accent);
}

.approach .split-text h3 {
  font-family: var(--font-pixel);
  font-size: 13px;
  letter-spacing: 1px;
  margin-bottom: 16px;
}

.approach .split-text p {
  color: var(--text-muted);
  max-width: 480px;
}

/* ================================================
   NUMBERS / STATS
   ================================================ */
.numbers {
  padding: var(--section-pad) 0;
  text-align: center;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--gap);
  margin-top: 48px;
}

.stat-card {
  padding: 32px 16px;
}

.stat-number {
  display: block;
  font-family: var(--font-pixel);
  font-size: clamp(20px, 3vw, 32px);
  color: var(--accent);
  margin-bottom: 12px;
  letter-spacing: 2px;
}

.stat-label {
  font-size: 14px;
  color: var(--text-muted);
  letter-spacing: 0.3px;
}

/* ================================================
   FAQ — native <details> accordion
   ================================================ */
.faq {
  padding: var(--section-pad) 0;
  background: var(--bg-alt);
}

.faq h2 {
  text-align: center;
  margin-bottom: 48px;
}

.faq-list {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.faq-item {
  background: var(--card-bg);
  overflow: hidden;
}

.faq-item summary {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 15px;
  padding: 20px 24px;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  transition: background 0.2s;
}

.faq-item summary:hover {
  background: var(--bg-alt);
}

/* Custom +/- toggle indicator */
.faq-item summary::after {
  content: '+';
  font-family: var(--font-pixel);
  font-size: 12px;
  color: var(--accent);
  flex-shrink: 0;
  width: 20px;
  text-align: center;
}

.faq-item[open] summary::after {
  content: '-';
}

/* Remove default browser marker */
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::marker { display: none; content: ''; }

.faq-item p {
  padding: 0 24px 20px;
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1.7;
}

/* ================================================
   CONTACT CTA
   ================================================ */
.contact {
  padding: 120px 0;
  text-align: center;
}

.contact h2 {
  margin-bottom: 20px;
}

.contact-body {
  color: var(--text-muted);
  font-size: 18px;
  max-width: 480px;
  margin: 0 auto 40px;
}

.contact-actions {
  margin-bottom: 36px;
}

.contact-hint {
  font-size: 9px;
  color: var(--text-muted);
  letter-spacing: 3px;
  animation: blink 1.5s step-end infinite;
}

/* ================================================
   FOOTER
   ================================================ */
.site-footer {
  padding: 24px 0;
  border-top: 2px solid var(--border);
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.footer-logo {
  font-size: 10px;
}

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

/* ================================================
   RESPONSIVE — Tablet
   ================================================ */
@media (max-width: 1024px) {
  .services-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }

  .split {
    gap: 40px;
  }
}

/* ================================================
   RESPONSIVE — Mobile
   ================================================ */
@media (max-width: 768px) {
  :root {
    --section-pad: 64px;
  }

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

  .site-header nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg);
    border-bottom: 2px solid var(--border);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
  }

  #nav-toggle:checked ~ nav {
    max-height: 300px;
  }

  /* Animate hamburger to X */
  #nav-toggle:checked ~ .nav-toggle-label span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 6px);
  }
  #nav-toggle:checked ~ .nav-toggle-label span:nth-child(2) {
    opacity: 0;
  }
  #nav-toggle:checked ~ .nav-toggle-label span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -6px);
  }

  .nav-links {
    flex-direction: column;
    padding: 24px;
    gap: 20px;
  }

  /* Stacked splits */
  .split,
  .split-reverse {
    flex-direction: column;
    gap: 32px;
  }

  .approach .split-text p {
    max-width: 100%;
  }

  /* Single-column services */
  .services-grid {
    grid-template-columns: 1fr;
  }

  /* 2-col stats on mobile */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Smaller hero */
  .hero {
    padding: 80px 0 64px;
  }

  .hero-actions {
    flex-direction: column;
    align-items: center;
  }

  .hero-actions .pixel-btn {
    width: 100%;
    max-width: 280px;
    text-align: center;
  }

  /* Stack footer */
  .footer-inner {
    flex-direction: column;
    gap: 12px;
    text-align: center;
  }

  /* XP card full width */
  .xp-card {
    max-width: 100%;
  }
}

/* ================================================
   ACCESSIBILITY — Reduced motion
   ================================================ */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero-prefix::after,
  .contact-hint { animation: none; opacity: 1; }
  .service-card { transition: none; }
  .site-header nav { transition: none; }
}

/* ================================================
   FOCUS STYLES
   ================================================ */
:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.pixel-btn:focus-visible {
  outline-offset: 4px;
}
