:root {
  --bg: #000000;
  --fg: #FFFFFF;
  --muted: #CCCCCC;
  --muted-fg: #666666;
  --card: #0F0F0F;
  --card-fg: #FFFFFF;
  --border: #1A1A1A;
  --grid-gap: #1A1A1A;
  --alt-bg: #0A0A0A;
  color-scheme: dark;
}

html.light {
  --bg: #FFFFFF;
  --fg: #000000;
  --muted: #666666;
  --muted-fg: #999999;
  --card: #F8F8F8;
  --card-fg: #000000;
  --border: #E0E0E0;
  --grid-gap: #E0E0E0;
  --alt-bg: #F0F0F0;
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background 0.3s, color 0.3s;
}

.container { max-width: 1280px; margin: 0 auto; padding: 0 32px; }

/* ========================================
   HEADER
   ======================================== */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  width: 100%;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.site-header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 64px;
}

.logo-link { display: block; line-height: 0; }
.logo-link img, .logo-link svg { height: 48px; width: auto; }

.logo-dark { display: block; }
.logo-light { display: none; }
html.light .logo-dark { display: none; }
html.light .logo-light { display: block; }

.nav { display: flex; align-items: center; gap: 4px; }

.nav a {
  color: var(--muted-fg);
  text-decoration: none;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  transition: color 0.2s;
}
.nav a:hover { color: var(--fg); }

.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  padding: 6px 12px;
  cursor: pointer;
  color: var(--fg);
  font-size: 12px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-left: 12px;
  transition: all 0.2s;
}
.theme-toggle:hover { border-color: var(--fg); }

/* ========================================
   HERO
   ======================================== */

.hero {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 70vh;
  text-align: center;
  padding: 0 24px;
  background: var(--bg);
  color: var(--fg);
}

.hero-logo-dark { display: block; max-width: 60%; height: auto; margin-bottom: 24px; }
.hero-logo-light { display: none; max-width: 60%; height: auto; margin-bottom: 24px; }
html.light .hero-logo-dark { display: none; }
html.light .hero-logo-light { display: block; }

.hero h1 {
  font-weight: 300;
  font-size: 56px;
  margin: 0 0 16px;
  letter-spacing: -1px;
  line-height: 1.15;
  max-width: 800px;
}

.hero p {
  max-width: 560px;
  font-size: 18px;
  line-height: 1.7;
  color: var(--muted);
  margin: 0;
}

/* ========================================
   SECTIONS
   ======================================== */

section { padding: 100px 0; }

section h2 {
  font-weight: 300;
  font-size: 48px;
  margin: 0 auto 56px;
  text-align: center;
  letter-spacing: -1px;
  position: relative;
  display: block;
  width: fit-content;
}

section h2::after {
  content: '';
  position: absolute;
  bottom: -16px;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 1px;
  background: var(--fg);
}

/* ========================================
   SPLIT LAYOUT — контраст половин
   ======================================== */

.section-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 0;
  min-height: 70vh;
}

.split-half {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 100px 60px;
  text-align: center;
}

.split-half.dark,
.split-half.light { background: var(--bg); color: var(--fg); }

.split-half h2 { font-size: 42px; font-weight: 300; margin: 0 0 16px; letter-spacing: -1px; }
.split-half h2::after { display: none; }
.split-half p { max-width: 440px; font-size: 17px; line-height: 1.8; margin: 0 auto; color: var(--muted-fg); }

/* ========================================
   PORTFOLIO
   ======================================== */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1px;
  padding-bottom: 40px;
  background: var(--grid-gap);
}

.card {
  background: var(--card);
  color: var(--card-fg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: opacity 0.4s;
}

.card.will-reveal { opacity: 0; }
.card.will-reveal.revealed { opacity: 1; }
.card:hover { opacity: 0.85; }

.card-image-wrapper {
  position: relative;
  overflow: hidden;
  width: 100%;
  aspect-ratio: 4 / 3;
}

.card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s ease;
}
.card:hover img { transform: scale(1.05); }

.card img[loading="lazy"]:not(.loaded) { filter: blur(10px); opacity: 0.6; }
.card img[loading="lazy"].loaded { filter: blur(0); opacity: 1; }

.image-count-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(0,0,0,0.7);
  color: #fff;
  padding: 4px 10px;
  font-size: 11px;
}

.card-body { padding: 20px; }

.card-body a {
  color: var(--fg);
  text-underline-offset: 2px;
}

.card h3 { font-weight: 400; font-size: 18px; margin: 0 0 8px; line-height: 1.3; }
.card p {
  margin: 0;
  color: var(--muted-fg);
  font-size: 14px;
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ========================================
   CLIENTS
   ======================================== */

.clients { padding: 100px 0; }

.clients-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  border: 1px solid var(--border);
  border-right: none;
  border-bottom: none;
}

.client-card {
  padding: 32px 20px;
  text-align: center;
  text-decoration: none;
  color: var(--fg);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100px;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s;
}
.client-card.revealed { opacity: 1; transform: translateY(0); }
.client-card:hover { background: var(--alt-bg); }

.client-check {
  width: 24px;
  height: 24px;
  background: var(--fg);
  color: var(--bg);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  margin-bottom: 8px;
}

.client-name { font-size: 13px; line-height: 1.3; }

/* ========================================
   ABOUT / CTA
   ======================================== */

.about-text { max-width: 720px; margin: 0 auto; text-align: center; line-height: 1.8; color: var(--muted-fg); }

.cta { text-align: center; padding: 100px 0; }
.cta p { color: var(--muted-fg); max-width: 560px; margin: 0 auto 40px; font-size: 18px; line-height: 1.7; }

/* ========================================
   BUTTONS
   ======================================== */

.btn {
  background: var(--fg);
  color: var(--bg);
  border: none;
  padding: 16px 40px;
  font-size: 14px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  cursor: pointer;
  transition: opacity 0.2s;
}
.btn:hover { opacity: 0.7; }

.load-more { display: flex; justify-content: center;

/* ========================================
   FORMS
   ======================================== */

.form-field {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--fg);
  font-family: inherit;
  font-size: 15px;
  transition: border-color 0.2s;
}
.form-field:focus { border-color: var(--fg); outline: none; }

/* ========================================
   FOOTER
   ======================================== */

.site-footer {
  border-top: 1px solid var(--border);
  padding: 40px 0;
  color: var(--muted-fg);
  text-align: center;
  font-size: 13px;
}

/* ========================================
   LOADING & ERRORS
   ======================================== */

.loading, .error, .no-results { text-align: center; padding: 60px 20px; color: var(--muted-fg); }

/* ========================================
   MODAL
   ======================================== */

.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0; top: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.9);
  opacity: 0;
  transition: opacity 0.3s;
}
.modal.show { display: flex; opacity: 1; align-items: center; justify-content: center;

.modal-content {
  background: var(--card);
  max-width: 900px;
  max-height: 90vh;
  width: 100%;
  overflow-y: auto;
  position: relative;
  transform: scale(0.95);
  transition: transform 0.3s;
}
.modal.show .modal-content { transform: scale(1); }

.modal-close {
  position: absolute;
  top: 16px;
  right: 20px;
  font-size: 24px;
  color: var(--muted-fg);
  cursor: pointer;
  z-index: 10;
  background: none;
  border: none;
  padding: 8px;
  line-height: 1;
}
.modal-close:hover { color: var(--fg); }

.modal-image { width: 100%; max-height: 500px; object-fit: cover; }
.modal-body { padding: 32px; }
.modal-body h2 { margin: 0 0 16px; font-size: 28px; font-weight: 400; text-align: left; }
.modal-body h2::after { display: none; }
.modal-text { color: var(--muted-fg); line-height: 1.8; font-size: 16px; }
.modal-text a { color: var(--fg); }

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 1024px) {
  .hero h1 { font-size: 42px; }
  .split-half { padding: 80px 40px; }
  .split-half h2 { font-size: 36px; }
}

@media (max-width: 768px) {
  .container { padding: 0 20px; }
  .site-header .container { height: 56px; }
  .logo-link img, .logo-link svg { height: 36px; }
  .nav { display: none; }
  .theme-toggle { display: none; }

  .hero { min-height: auto; padding: 60px 20px; }
  .hero-logo-dark, .hero-logo-light { max-width: 80%; margin-bottom: 24px; }
  .hero h1 { font-size: 32px; }

  section { padding: 60px 0; }
  section h2 { font-size: 36px; margin-bottom: 40px; }

  .section-split { grid-template-columns: 1fr; }
  .split-half { padding: 60px 24px; }
  .split-half h2 { font-size: 28px; }

  .grid { grid-template-columns: 1fr; }
  .modal-body { padding: 24px; }
}

@media (max-width: 480px) {
  .hero h1 { font-size: 26px; }
  section h2 { font-size: 28px; }
  .btn { padding: 14px 28px; font-size: 13px; }
}

/* ========================================
   ANIMATIONS
   ======================================== */

@media (prefers-reduced-motion: no-preference) {
  .card.will-reveal.revealed { animation: fadeIn 0.6s ease forwards; }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ========================================
   BURGER MENU
   ======================================== */

.burger-btn {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 28px;
  height: 28px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  z-index: 20;
}

.burger-btn span {
  display: block;
  width: 100%;
  height: 1px;
  background: var(--fg);
  transition: transform 0.25s, opacity 0.25s;
}

.burger-btn[aria-expanded="true"] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.burger-btn[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.burger-btn[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

@media (max-width: 768px) {
  .burger-btn { display: flex; }

  .nav.nav-open {
    display: flex !important;
    position: absolute;
    top: 56px;
    left: 0; right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    padding: 16px 24px;
    flex-direction: column;
    z-index: 15;
  }

  .nav.nav-open a {
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    text-transform: none;
    font-size: 15px;
  }
  .nav.nav-open a:last-child { border-bottom: none; }
  .site-header .container { position: relative; }
}

/* ========================================
   FOOTER — расширенный
   ======================================== */

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1.5fr;
  gap: 40px;
  padding-bottom: 40px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
  text-align: left;
}

.footer-col h5 {
  font-weight: 400;
  font-size: 18px;
  margin: 0 0 12px;
  letter-spacing: -0.3px;
}

.footer-col h6 {
  font-weight: 400;
  font-size: 14px;
  margin: 0 0 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted-fg);
}

.footer-col p {
  font-size: 14px;
  line-height: 1.6;
  margin: 0 0 8px;
  color: var(--muted-fg);
}

.footer-links {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-links li {
  margin-bottom: 6px;
}

.footer-links a {
  color: var(--muted-fg);
  text-decoration: none;
  font-size: 14px;
  transition: color 0.2s;
}

.footer-links a:hover {
  color: var(--fg);
}

.footer-social {
  display: flex;
  gap: 16px;
  margin-top: 16px;
}

.footer-social a {
  color: var(--muted-fg);
  text-decoration: none;
  font-size: 12px;
  letter-spacing: 0.5px;
  transition: color 0.2s;
}

.footer-social a:hover {
  color: var(--fg);
}

.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--muted-fg);
}

.footer-privacy {
  color: var(--muted-fg);
  text-decoration: none;
  font-size: 13px;
  transition: color 0.2s;
}

.footer-privacy:hover {
  color: var(--fg);
}

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

@media (max-width: 480px) {
  .footer-grid {
    grid-template-columns: 1fr;
  }
  .footer-bottom {
    flex-direction: column;
    gap: 8px;
    text-align: center;
  }
}
