:root {
  --bg: #0b0f14;
  --bg-card: #121820;
  --bg-card-hover: #171f2a;
  --border: #243041;
  --text: #e8edf4;
  --muted: #8b9bb0;
  --accent: #5b9cff;
  --accent-soft: rgba(91, 156, 255, 0.12);
  --green: #3ecf8e;
  --orange: #f5a623;
  --radius: 14px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  --max: 1080px;
  --bp-tablet: 768px;
  --bp-desktop: 1024px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Instrument Sans", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

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

a:hover {
  text-decoration: underline;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

.container {
  width: min(100% - 1.5rem, var(--max));
  margin-inline: auto;
}

@media (min-width: 768px) {
  .container {
    width: min(100% - 2rem, var(--max));
  }
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
  background: rgba(11, 15, 20, 0.85);
  border-bottom: 1px solid var(--border);
}

.site-header .inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 0;
  min-width: 0;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.lang-switch {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.lang-switch button {
  background: transparent;
  border: none;
  color: var(--muted);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.35rem 0.55rem;
  cursor: pointer;
}

.lang-switch button:hover {
  color: var(--text);
  background: var(--bg-card);
}

.lang-switch button.active {
  color: var(--text);
  background: var(--accent-soft);
}

.logo {
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  font-size: clamp(0.95rem, 2.8vw, 1rem);
  min-width: 0;
}

.logo span {
  color: var(--muted);
  font-weight: 400;
}

@media (max-width: 480px) {
  .logo span {
    display: none;
  }
}

.nav a {
  color: var(--muted);
  font-size: 0.95rem;
  text-decoration: none;
  padding: 0.35rem 0;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

/* Hero */
.hero {
  position: relative;
  padding: 2.5rem 0 2rem;
  isolation: isolate;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse 80% 60% at 50% -10%, rgba(91, 156, 255, 0.14), transparent 60%),
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: auto, 44px 44px, 44px 44px;
  mask-image: linear-gradient(to bottom, #000 40%, transparent 100%);
  pointer-events: none;
}

.hero-grid {
  display: grid;
  gap: 1.5rem;
  align-items: center;
}

.hero-grid > * {
  min-width: 0;
}

@media (min-width: 768px) {
  .hero {
    padding: 3.5rem 0 2.75rem;
  }
}

@media (min-width: 900px) {
  .hero-grid {
    gap: 2rem;
    grid-template-columns: 1.2fr 0.8fr;
  }
}

@media (min-width: 1024px) {
  .hero {
    padding: 4rem 0 3rem;
  }
}

.eyebrow {
  display: inline-block;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 0;
}

.eyebrow-laravel {
  border: 1px solid rgba(255, 45, 32, 0.25);
  background: rgba(255, 45, 32, 0.08);
  color: #ff9f8f;
}

h1 {
  font-size: clamp(1.75rem, 5vw, 2.75rem);
  line-height: 1.15;
  margin: 0.75rem 0 1rem;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}

.lead {
  font-size: clamp(1rem, 2.5vw, 1.1rem);
  color: var(--muted);
  max-width: 52ch;
  margin: 0 0 1.5rem;
}

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

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.7rem 1.15rem;
  border-radius: 10px;
  font-weight: 500;
  text-decoration: none;
  border: 1px solid transparent;
  transition: transform 0.15s, background 0.15s;
}

.btn:hover {
  text-decoration: none;
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--accent);
  color: #061018;
}

.btn-primary:hover {
  background: #7ab0ff;
}

.btn-secondary {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}

.btn-secondary:hover {
  background: var(--bg-card);
}

.hero-card {
  background: linear-gradient(145deg, #141c27, #0f141c);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}

.hero-card h3 {
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
  color: var(--muted);
  font-weight: 500;
}

.stack-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

.stack-list li {
  padding: 0.35rem 0.65rem;
  border-radius: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--text);
}

.stack-list li.stack-laravel {
  border-color: rgba(255, 45, 32, 0.35);
  color: #ff9f8f;
}

@media (min-width: 1024px) {
  .section-head h2 {
    font-size: 1.85rem;
  }
}

/* Sections */
section {
  padding: 2.25rem 0;
}

@media (min-width: 768px) {
  section {
    padding: 3rem 0;
  }
}

.section-head h2 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.35rem, 3.5vw, 1.65rem);
  letter-spacing: -0.02em;
}

.section-head {
  margin-bottom: 1.75rem;
}

.section-head p {
  margin: 0;
  color: var(--muted);
  max-width: 60ch;
}

.section-label {
  display: inline-block;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 0.5rem;
  font-weight: 600;
}

/* Project cards */
.projects-grid {
  display: grid;
  gap: 1.25rem;
}

.project-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-width: 0;
  transition: border-color 0.15s, background 0.15s, transform 0.15s, box-shadow 0.15s;
}

.project-card:hover {
  border-color: #355074;
  background: var(--bg-card-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.project-card-wide {
  grid-column: 1 / -1;
}

.project-card.featured {
  grid-column: 1 / -1;
}

@media (min-width: 768px) {
  .projects-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .project-card.featured,
  .project-card-wide {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }

  .project-card.featured .project-media,
  .project-card-wide .project-media {
    border-bottom: none;
    border-right: 1px solid var(--border);
  }
}

.project-media {
  aspect-ratio: 16 / 10;
  background: #0d1219;
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}

.project-media-gallery,
.project-media-preview,
.project-card-wide .project-media,
.project-card.featured .project-media {
  aspect-ratio: auto;
  height: auto;
}

.project-media-preview {
  padding: 0.75rem 0.75rem 0;
  background: #0d1219;
}

.project-media > img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
}

.project-media.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #101822 0%, #162033 50%, #0f1724 100%);
  color: var(--muted);
  font-size: 0.9rem;
  padding: 1rem;
  text-align: center;
}

.project-body {
  padding: 1.25rem 1.35rem 1.35rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.project-body h3 {
  margin: 0 0 0.35rem;
  font-size: clamp(1.05rem, 2.5vw, 1.15rem);
  overflow-wrap: anywhere;
}

.project-meta {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.75rem;
}

.project-body p {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 0.95rem;
  flex: 1;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.tag {
  font-size: 0.78rem;
  padding: 0.25rem 0.55rem;
  border-radius: 6px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--muted);
}

.tag.laravel {
  border-color: #ff2d2044;
  color: #ff8a7a;
}

.card-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: auto;
}

.card-links a {
  font-size: 0.9rem;
  font-weight: 500;
}

/* Plugin + Bitrix blocks */
.two-col {
  display: grid;
  gap: 1.25rem;
}

@media (min-width: 768px) {
  .two-col {
    grid-template-columns: 1fr 1fr;
  }
}

.info-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.35rem;
  min-width: 0;
}

.info-card h3 {
  margin: 0 0 0.5rem;
}

.info-card p {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.info-card ul {
  margin: 0 0 1rem;
  padding-left: 1.1rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.info-card li + li {
  margin-top: 0.35rem;
}

.plugin-card {
  margin-bottom: 1.25rem;
}

.plugin-preview {
  margin: 1rem 0;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.bitrix-services {
  margin-top: 0;
}

/* Contact */
.contact-box {
  background: linear-gradient(145deg, #141c27, #10161f);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 1.25rem;
  text-align: center;
}

@media (min-width: 768px) {
  .contact-box {
    padding: 2rem;
  }
}

.contact-box h2 {
  margin: 0 0 0.5rem;
}

.contact-box p {
  color: var(--muted);
  margin: 0 0 1.25rem;
}

.contact-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
}

.contact-links .btn {
  width: 100%;
  justify-content: center;
}

@media (min-width: 480px) {
  .contact-links .btn {
    width: auto;
  }
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem 0 2rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.site-footer .inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem;
}

.site-footer a {
  color: var(--muted);
}

.site-footer a:hover {
  color: var(--text);
}

/* Navigation: burger on mobile + tablet, inline on desktop */
.menu-toggle {
  display: block;
  background: none;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 0.45rem 0.65rem;
  cursor: pointer;
  line-height: 1;
}

.nav {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  flex-direction: column;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 1rem 1rem;
  gap: 0.5rem;
}

.nav.open {
  display: flex;
}

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

.site-header .inner {
  position: relative;
  flex-wrap: wrap;
}

@media (min-width: 1024px) {
  .menu-toggle {
    display: none;
  }

  .nav {
    display: flex;
    position: static;
    flex-direction: row;
    background: transparent;
    border: none;
    padding: 0;
    gap: 0.25rem 1.25rem;
  }

  .nav a {
    padding: 0;
  }

  .site-header .inner {
    flex-wrap: nowrap;
  }

  .header-actions {
    gap: 1rem;
  }
}

/* === Enhancements === */

.is-hidden {
  display: none !important;
}

body.lang-ru .cta-en {
  display: none;
}

body.lang-en .cta-ru {
  display: none;
}

.hero-profile {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 0.25rem;
}

.hero-profile-text {
  min-width: 0;
}

.hero-avatar,
.avatar-fallback {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  flex-shrink: 0;
}

.hero-avatar {
  object-fit: cover;
  border: 2px solid var(--border);
}

.avatar-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, #1a2433, #121820);
  border: 2px solid var(--accent);
  color: var(--text);
  font-weight: 700;
  font-size: 1.35rem;
  letter-spacing: 0.04em;
}

.about-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.35rem 1.5rem;
}

.about-card h2 {
  margin: 0 0 0.65rem;
  font-size: clamp(1.2rem, 3vw, 1.45rem);
}

.about-card p {
  margin: 0 0 1rem;
  color: var(--muted);
  max-width: 70ch;
}

.social-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.social-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.88rem;
  text-decoration: none;
}

.social-chip:hover {
  color: var(--text);
  border-color: #355074;
  text-decoration: none;
}

.social-chip svg {
  width: 16px;
  height: 16px;
}

.project-bullets {
  margin: 0 0 1rem;
  padding-left: 1.1rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.project-bullets li + li {
  margin-top: 0.35rem;
}

.case-details {
  margin-bottom: 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.15);
}

.case-details summary {
  cursor: pointer;
  padding: 0.55rem 0.75rem;
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 500;
  list-style: none;
}

.case-details summary::-webkit-details-marker {
  display: none;
}

.case-details p {
  margin: 0;
  padding: 0 0.75rem 0.75rem;
  color: var(--muted);
  font-size: 0.88rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.browser-frame {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: #0a0e13;
  box-shadow: var(--shadow);
}

.browser-frame-compact {
  margin: 0 0 1rem;
}

.browser-bar {
  display: flex;
  gap: 0.35rem;
  padding: 0.55rem 0.7rem;
  background: #151b24;
  border-bottom: 1px solid var(--border);
}

.browser-bar .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #2a3545;
}

.browser-bar .dot:nth-child(1) {
  background: #ff5f57;
}

.browser-bar .dot:nth-child(2) {
  background: #febc2e;
}

.browser-bar .dot:nth-child(3) {
  background: #28c840;
}

.browser-screen img {
  width: 100%;
  height: auto;
  display: block;
}

.browser-screen-thumb {
  max-height: 180px;
  overflow: hidden;
  background: #0a0e13;
}

.browser-screen-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
}

.browser-screen-preview {
  overflow: hidden;
  background: #0a0e13;
  line-height: 0;
}

.browser-screen-preview img {
  width: 100%;
  height: auto;
  display: block;
  vertical-align: top;
}

.browser-screen a {
  display: block;
  cursor: zoom-in;
  line-height: 0;
}

.browser-screen a:hover img {
  opacity: 0.92;
}

.gallery-hint {
  margin: 0.35rem 0 0;
  padding: 0 0.25rem 0.5rem;
  font-size: 0.75rem;
  color: var(--muted);
  text-align: center;
}

.gallery-extra {
  display: none;
}

.placeholder-brand {
  background: linear-gradient(135deg, #101822, #1a2840 55%, #0f1724);
  font-size: 1.35rem;
  font-weight: 600;
  color: #c8d4e6;
  letter-spacing: 0.02em;
}

.services-grid {
  display: grid;
  gap: 1rem;
}

@media (min-width: 768px) {
  .services-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.service-card h3 {
  font-size: 1rem;
}

.service-card p {
  margin-bottom: 0.5rem;
}

.header-social {
  display: none;
  gap: 0.35rem;
}

.icon-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid transparent;
  color: var(--muted);
  text-decoration: none;
}

.icon-link:hover {
  color: var(--text);
  border-color: var(--border);
  background: var(--bg-card);
  text-decoration: none;
}

.icon-link svg {
  width: 17px;
  height: 17px;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 1rem;
}

@media (min-width: 1024px) {
  .header-social {
    display: flex;
  }
}
