/* ============================================
   VYZOV 01 — DESIGN SYSTEM
   Современный минималистичный дизайн
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  /* Цвета */
  --neon: #ff5e00;
  --ink: #ffffff;
  --bg-dark: #0f0f0f;
  --bg-header: rgba(15, 15, 15, 0.95);
  --bg-card: rgba(255, 255, 255, 0.03);
  --border-light: rgba(255, 255, 255, 0.08);
  --text-light: #cccccc;
  --text-muted: #888888;
  
  /* Типографика */
  --font-heading: 'Space Grotesk', sans-serif;
  --font-body: 'Inter', sans-serif;
  
  /* Переходы */
  --transition: 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  
  --radius: 0;
}

/* ============================================
   RESET & BASE
   ============================================ */

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

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
  /* корректный вывод текста на iOS */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  background: var(--bg-dark);
  color: var(--ink);
  line-height: 1.6;
  font-size: 15px;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* убираем синюю вспышку при нажатии на iOS */
  -webkit-tap-highlight-color: transparent;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

h1 {
  font-size: clamp(2.5rem, 6vw, 5rem);
}

h2 {
  font-size: clamp(2rem, 4vw, 3.5rem);
}

h3 {
  font-size: clamp(1.5rem, 3vw, 2rem);
}

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

button {
  font-family: var(--font-body);
  cursor: pointer;
  border: none;
  background: none;
  /* убираем задержку 300ms на iOS */
  touch-action: manipulation;
}

a {
  touch-action: manipulation;
}

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

/* ============================================
   LAYOUT
   ============================================ */

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 clamp(1.25rem, 5vw, 5rem);
}

.section {
  padding: clamp(4rem, 10vw, 8rem) 0;
}

.section-header {
  margin-bottom: clamp(2.5rem, 5vw, 4rem);
  max-width: 800px;
}

.section-label {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.section-title {
  color: var(--ink);
  margin-bottom: 1rem;
}

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

.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: var(--bg-header);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-light);
  /* safe-area-inset-top: отступ под notch iPhone X+ */
  padding: calc(1.25rem + env(safe-area-inset-top, 0px)) clamp(1.25rem, 5vw, 5rem) 1.25rem;
}

.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.5rem;
  letter-spacing: -0.02em;
  color: var(--ink);
  transition: color var(--transition);
  position: relative;
}

.logo::after {
  content: '';
  display: inline-block;
  width: 5px;
  height: 5px;
  background: var(--neon);
  border-radius: 50%;
  margin-left: 3px;
  vertical-align: middle;
  margin-top: -4px;
  flex-shrink: 0;
}

.logo:hover {
  color: var(--neon);
}

.nav {
  display: flex;
  align-items: center;
  gap: clamp(1.5rem, 4vw, 3rem);
}

.nav-link {
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-light);
  position: relative;
  transition: color var(--transition);
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--neon);
  transition: width var(--transition);
}

.nav-link:hover,
.nav-link.active {
  color: var(--ink);
}

.nav-link:hover::after,
.nav-link.active::after {
  width: 100%;
}

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

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 1rem 2rem;
  border-radius: var(--radius);
  transition: all var(--transition);
}

.btn-primary {
  background: var(--neon);
  color: var(--bg-dark);
  box-shadow: 0 0 0 rgba(255, 94, 0, 0);
}

.btn-primary:hover {
  background: #ff7620;
  box-shadow: 0 0 30px rgba(255, 94, 0, 0.4);
  transform: translateY(-2px);
}

.btn-secondary {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--border-light);
}

.btn-secondary:hover {
  border-color: var(--neon);
  color: var(--neon);
}

/* ============================================
   CARDS
   ============================================ */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: clamp(1.5rem, 4vw, 2.5rem);
  transition: all var(--transition);
  position: relative;
}

.card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 94, 0, 0.03) 0%, transparent 50%);
  opacity: 0;
  transition: opacity var(--transition);
  border-radius: var(--radius);
}

.card:hover {
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-4px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

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

.card-header {
  position: relative;
  margin-bottom: 1rem;
}

.card-title {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
  position: relative;
}

.card-desc {
  font-size: 0.9375rem;
  color: var(--text-light);
  line-height: 1.65;
  position: relative;
}

/* ============================================
   GRID
   ============================================ */

.grid {
  display: grid;
  gap: clamp(1.5rem, 3vw, 2.5rem);
}

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

.grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

.grid-4 {
  grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 1024px) {
  .grid-3,
  .grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }
}

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

.form-group {
  margin-bottom: 1.5rem;
}

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-light);
  margin-bottom: 0.5rem;
  letter-spacing: 0.05em;
}

.form-control {
  width: 100%;
  font-family: var(--font-body);
  font-size: 0.9375rem;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 0.875rem 1rem;
  transition: all var(--transition);
}

.form-control:focus {
  outline: none;
  border-color: var(--neon);
  background: rgba(255, 255, 255, 0.08);
}

.form-control::placeholder {
  color: var(--text-muted);
}

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

.footer {
  padding: clamp(3rem, 6vw, 5rem) clamp(1.25rem, 5vw, 5rem) 2rem;
  border-top: 1px solid var(--border-light);
  position: relative;
}

.footer::before {
  content: '';
  position: absolute;
  top: 0;
  left: clamp(1.25rem, 5vw, 5rem);
  width: 48px;
  height: 2px;
  background: var(--neon);
}

.footer-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 2rem;
}

.footer-brand {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.footer-logo {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
  color: var(--ink);
  transition: color var(--transition);
}

.footer-logo:hover {
  color: var(--neon);
}

.footer-domain {
  font-size: 0.75rem;
  color: var(--neon);
  letter-spacing: 0.08em;
  font-weight: 500;
}

.footer-copy {
  font-size: 0.8125rem;
  color: var(--text-muted);
  letter-spacing: 0.02em;
  margin-top: 0.25rem;
}

.footer-links {
  display: flex;
  gap: 2rem;
}

.footer-link {
  font-size: 0.8125rem;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  transition: color var(--transition);
}

.footer-link:hover {
  color: var(--neon);
}

/* ============================================
   UTILITIES
   ============================================ */

.text-center {
  text-align: center;
}

.text-muted {
  color: var(--text-muted);
}

.text-neon {
  color: var(--neon);
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.glow {
  box-shadow: 0 0 30px rgba(255, 94, 0, 0.3);
}

/* ============================================
   IMAGE MODAL (Lightbox с водяным знаком)
   ============================================ */

.image-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.95);
  z-index: 9999;
  cursor: pointer;
}

.image-modal.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-modal-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  cursor: default;
}

.image-modal img {
  max-width: 100%;
  max-height: 90vh;
  object-fit: contain;
  display: block;
  border-radius: var(--radius);
}

.image-modal-close {
  position: absolute;
  top: 2rem;
  right: 2rem;
  font-size: 3rem;
  color: var(--ink);
  cursor: pointer;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius);
  transition: all var(--transition);
}

.image-modal-close:hover {
  background: var(--neon);
  color: var(--bg-dark);
}

.image-modal-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 3rem;
  color: var(--ink);
  cursor: pointer;
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius);
  transition: all var(--transition);
  user-select: none;
}

.image-modal-nav:hover {
  background: var(--neon);
  color: var(--bg-dark);
}

.image-modal-nav.prev {
  left: 2rem;
}

.image-modal-nav.next {
  right: 2rem;
}

/* ================================================
   MOBILE HEADER & BURGER MENU
   ================================================ */

/* Кнопка бургера — скрыта на десктопе */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  padding: 0.5rem;
  cursor: pointer;
  background: none;
  border: none;
  z-index: 1100;
  position: relative;
}

.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--ink);
  transition: all 0.3s ease;
  transform-origin: center;
}

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

/* Оверлей за меню */
.nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 999;
}
.nav-overlay.open { display: block; }

@media (max-width: 768px) {
  .nav-toggle {
    display: flex;
    /* 44px минимальный размер tap-target по Apple HIG */
    width: 44px;
    height: 44px;
    align-items: center;
    justify-content: center;
    padding: 0;
  }

  .nav {
    position: fixed;
    top: 0;
    right: -100%;
    width: min(300px, 85vw);
    height: 100%;
    height: 100dvh; /* dynamic viewport height — правильно на мобильных */
    background: #0d0d0d;
    border-left: 1px solid var(--border-light);
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    /* safe-area учитывает notch и home indicator iPhone */
    padding: calc(5.5rem + env(safe-area-inset-top, 0px)) 1.75rem
             calc(2rem + env(safe-area-inset-bottom, 0px));
    gap: 0;
    transition: right 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    z-index: 1000;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .nav.open {
    right: 0;
  }

  .nav-link {
    display: block;
    width: 100%;
    /* 48px — удобный tap target для пальца */
    padding: 0.9rem 0;
    min-height: 48px;
    display: flex;
    align-items: center;
    font-size: 1rem;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border-light);
  }

  .nav-link::after {
    display: none;
  }

  .nav .btn {
    margin-top: 1.5rem;
    width: 100%;
    justify-content: center;
    min-height: 48px;
  }
}

/* ── Остальные медиа ── */
@media (max-width: 768px) {
  .image-modal-close {
    top: 1rem;
    right: 1rem;
    width: 40px;
    height: 40px;
    font-size: 2rem;
  }
  
  .image-modal-nav {
    width: 50px;
    height: 50px;
    font-size: 2rem;
  }
  
  .image-modal-nav.prev {
    left: 1rem;
  }
  
  .image-modal-nav.next {
    right: 1rem;
  }
}

/* ================================================
   MOBILE GENERAL ≤480px
   ================================================ */
@media (max-width: 480px) {
  body {
    font-size: 14px;
  }

  .header {
    padding: calc(0.875rem + env(safe-area-inset-top, 0px)) 1rem 0.875rem;
  }

  .logo {
    font-size: 1.2rem;
  }

  .btn {
    padding: 0.875rem 1.5rem;
    font-size: 0.875rem;
    min-height: 48px;
  }

  .form-group {
    margin-bottom: 1.125rem;
  }

  .form-control,
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="tel"],
  input[type="number"],
  select,
  textarea {
    /* 16px обязательно — иначе iOS делает zoom при фокусе */
    font-size: 16px !important;
    padding: 0.75rem 0.875rem;
  }

  .footer {
    padding: 2rem 1rem calc(1.5rem + env(safe-area-inset-bottom, 0px)) 1rem;
  }

  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 1.5rem;
  }

  .footer-links {
    gap: 1rem;
    flex-wrap: wrap;
  }

  .section {
    padding: 2rem 0;
  }

  .container {
    padding: 0 1rem;
  }

  /* Модальные кнопки навигации — убрать за края, показывать мелкими */
  .image-modal-nav {
    width: 44px;
    height: 44px;
    font-size: 1.25rem;
    opacity: 0.85;
    top: auto;
    bottom: calc(1.5rem + env(safe-area-inset-bottom, 0px));
    transform: none;
  }
  .image-modal-nav.prev { left: 1rem; }
  .image-modal-nav.next { right: 1rem; }

  .image-modal-close {
    top: calc(0.75rem + env(safe-area-inset-top, 0px));
    right: 0.75rem;
    width: 44px;
    height: 44px;
  }
}

/* ================================================
   iPhone SE / маленькие андроиды ≤375px
   ================================================ */
@media (max-width: 375px) {
  .logo { font-size: 1.1rem; }
  .nav-toggle { width: 40px; height: 40px; }
  .container { padding: 0 0.875rem; }
}

/* ================================================
   iPhone safe-area: главный контент
   ================================================ */
main {
  /* учитываем высоту фиксированного хедера + safe-area-top */
  padding-top: calc(5rem + env(safe-area-inset-top, 0px));
}

/* Фикс: хедер при viewport-fit=cover уходит под notch на некоторых iOS */
@supports (padding-top: env(safe-area-inset-top)) {
  .header {
    padding-top: max(1.25rem, env(safe-area-inset-top));
  }
  @media (max-width: 480px) {
    .header {
      padding-top: max(0.875rem, env(safe-area-inset-top));
    }
  }
}
