:root {
  --bg: #ffffff;
  --surface: #f5f7fa;
  --surface-2: #eef1f6;
  --text: #0f172a;
  --text-secondary: #475569;
  --accent: #1e3a8a;
  --accent-2: #2563eb;
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --border: #e2e8f0;
  --radius: 12px;
  --max-width: 1100px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

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

/* Header */
header {
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,.85);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.logo {
  font-weight: 700;
  font-size: 18px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.logo-icon {
  width: 28px; height: 28px;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: grid; place-items: center;
  font-size: 14px; color: #fff;
}
nav { display: flex; gap: 28px; align-items: center; }
nav a { color: var(--text-secondary); font-size: 14px; font-weight: 500; transition: color .2s; }
nav a:hover, nav a.active { color: var(--text); text-decoration: none; }

.lang-toggle {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: background .2s;
}
.lang-toggle:hover { background: var(--border); }

/* Sections */
section { padding: 80px 0; }
section.alt { background: var(--surface); }

h1 {
  font-size: clamp(32px, 5vw, 52px);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: 20px;
}
h2 {
  font-size: clamp(24px, 3vw, 32px);
  font-weight: 700;
  margin-bottom: 16px;
}
h3 { font-size: 20px; font-weight: 600; margin-bottom: 8px; }
p { color: var(--text-secondary); margin-bottom: 16px; }

/* Hero */
.hero {
  padding: 120px 0 100px;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at top right, rgba(59,130,246,.15), transparent 60%),
              radial-gradient(ellipse at bottom left, rgba(6,182,212,.1), transparent 60%);
  pointer-events: none;
}
.hero h1 { max-width: 800px; }
.hero p { font-size: 18px; max-width: 640px; }
.cta-row { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 28px; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 14px;
  transition: transform .15s, box-shadow .2s;
  border: none;
  cursor: pointer;
}
.btn:hover { transform: translateY(-1px); text-decoration: none; }
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  box-shadow: 0 4px 20px rgba(59,130,246,.3);
}
.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
}

/* Cards */
.cards { display: grid; gap: 20px; margin-top: 40px; }
.cards.three { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.cards.two { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  transition: border-color .2s, transform .2s;
}
.card:hover { border-color: var(--accent); transform: translateY(-2px); }
.card p { font-size: 15px; }
.card-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: grid; place-items: center;
  font-size: 18px;
  margin-bottom: 16px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  filter: brightness(0) invert(1);
}

/* Project cards */
.project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  transition: border-color .2s;
}
.project-card:hover { border-color: var(--accent-2); }
.project-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}
.tag {
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

/* Benefits */
.benefits-list {
  list-style: none;
  display: grid;
  gap: 16px;
  margin-top: 24px;
}
.benefits-list li {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.benefits-list li::before {
  content: "✓";
  color: var(--success);
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 2px;
}

/* About */
.timeline {
  border-left: 2px solid var(--border);
  padding-left: 24px;
  margin: 32px 0;
}
.timeline-item { margin-bottom: 28px; position: relative; }
.timeline-item::before {
  content: "";
  position: absolute;
  left: -31px;
  top: 6px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(59,130,246,.2);
}
.timeline-year {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: .05em;
}
.timeline-title { font-weight: 600; margin: 4px 0; }
.timeline-desc { font-size: 14px; color: var(--text-secondary); }

/* Tech */
.tech-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}
.tech-pill {
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-secondary);
}

/* Deployment */
.deploy-grid {
  display: grid;
  gap: 20px;
  margin-top: 28px;
}
.deploy-grid.two { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.deploy-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}
.deploy-card h3 { margin-bottom: 12px; }

/* Contact */
.contact-grid {
  display: grid;
  gap: 40px;
  margin-top: 40px;
}
.contact-grid.two { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
form { display: grid; gap: 16px; }
label { font-size: 13px; font-weight: 600; color: var(--text-secondary); }
input, textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  outline: none;
  transition: border-color .2s;
}
input:focus, textarea:focus { border-color: var(--accent); }
textarea { min-height: 140px; resize: vertical; }

.contact-info { display: grid; gap: 16px; }
.contact-item {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
}
.contact-icon {
  width: 36px; height: 36px;
  border-radius: 8px;
  background: var(--surface-2);
  display: grid; place-items: center;
  font-size: 16px;
  flex-shrink: 0;
}

/* Footer */
footer {
  border-top: 1px solid var(--border);
  padding: 40px 0;
  text-align: center;
  color: var(--text-secondary);
  font-size: 13px;
}
.footer-links {
  display: flex;
  gap: 20px;
  justify-content: center;
  margin-bottom: 12px;
}
.footer-links a { color: var(--text-secondary); font-size: 13px; }
.footer-links a:hover { color: var(--text); }

/* Language selector */
.lang-select {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  transition: background .2s;
}
.lang-select:hover {
  background: var(--border);
}
.lang-select option {
  background: var(--surface);
  color: var(--text);
}

/* Lang switching */
body.lang-ru [data-en],
body.lang-ru [data-es],
body.lang-en [data-ru],
body.lang-en [data-es],
body.lang-es [data-en],
body.lang-es [data-ru] { display: none !important; }

/* Responsive */
@media (max-width: 640px) {
  nav { gap: 16px; }
  nav a { font-size: 13px; }
  .hero { padding: 80px 0 60px; }
  section { padding: 56px 0; }
}

/* What it brings */
.what-brings {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.55;
}
.what-brings strong {
  color: var(--accent-2);
  font-weight: 600;
}

/* Projects page */
.projects-grid {
  display: grid;
  gap: 48px;
  margin-top: 40px;
}
.project-detail {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}
.project-desc {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
}
.project-desc h3 {
  font-size: 22px;
  margin-bottom: 12px;
  color: var(--text);
}
.project-desc .project-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 16px;
}
.project-screenshots {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  justify-content: center;
  max-width: 1100px;
  margin: 0 auto;
}
.project-screenshots a {
  flex: 0 0 auto;
  display: block;
}
.project-screenshots a[href*="grafana-dashboard"] {
  max-width: 650px !important;
}
.project-screenshots a[href*="alert-1"] {
  max-width: 400px !important;
}
.project-screenshots a[href*="alert-2"] {
  max-width: 400px !important;
}
.project-screenshots a[href*="alert-3"] {
  max-width: 500px !important;
}
.project-screenshots img {
  width: 100%;
  height: auto;
  max-height: 600px;
  object-fit: contain;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  transition: transform .2s;
  display: block;
}
.project-screenshots img:hover {
  transform: scale(1.02);
}

@media (max-width: 768px) {
  .project-detail {
    grid-template-columns: 1fr;
  }
  .project-screenshots {
    order: -1;
  }
}

/* Lightbox */
#lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
#lightbox.active {
  display: flex;
}
.lightbox-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
}
.lightbox-container {
  position: relative;
  width: 80%;
  max-width: 1200px;
  height: 80vh;
  max-height: 800px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lightbox-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.lightbox-close,
.lightbox-prev,
.lightbox-next {
  position: absolute;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #fff;
  font-size: 28px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  z-index: 10;
}
.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover {
  background: rgba(255, 255, 255, 0.3);
}
.lightbox-close {
  top: -60px;
  right: 0;
  font-size: 32px;
}
.lightbox-prev {
  left: -70px;
}
.lightbox-next {
  right: -70px;
}
@media (max-width: 768px) {
  .lightbox-container {
    width: 95%;
    height: 70vh;
  }
  .lightbox-prev {
    left: 10px;
  }
  .lightbox-next {
    right: 10px;
  }
  .lightbox-close {
    top: -50px;
    right: 10px;
  }
}
