/* ===== THEMES ===== */
:root {
  --nc-bg: #080808;
  --nc-bg-2: #0e0e0e;
  --nc-card-1: #101010;
  --nc-card-2: #181818;
  --nc-accent: #ffffff;
  --nc-accent-text: #000000;
  --nc-text-rgb: 255, 255, 255;
  --nc-text: #ffffff;
  --nc-card-gradient: linear-gradient(135deg, #101010 0%, #181818 100%);
  --nc-bubble-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
  --nc-bubble-glow: 0 0 0 2px rgba(255, 255, 255, 0.6), 0 0 60px rgba(255, 255, 255, 0.4);

  /* Высота хедера WordPress поверх страницы. */
  --wp-header-offset: 80px;
  /* Высота футера WordPress — чтобы CTA и пузыри не уходили под него. */
  --wp-footer-offset: 220px;
}

@media (max-width: 900px) {
  :root {
    --wp-header-offset: 60px;
    --wp-footer-offset: 260px;
  }
}

html[data-theme="light"] {
  --nc-bg: #f5f5f5;
  --nc-bg-2: #ececec;
  --nc-card-1: #ffffff;
  --nc-card-2: #e8e8e8;
  --nc-accent: #000000;
  --nc-accent-text: #ffffff;
  --nc-text-rgb: 0, 0, 0;
  --nc-text: #000000;
  --nc-card-gradient: linear-gradient(135deg, #ffffff 0%, #e8e8e8 100%);
  --nc-bubble-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  --nc-bubble-glow: 0 0 0 2px rgba(0, 0, 0, 0.6), 0 0 60px rgba(0, 0, 0, 0.25);
}

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

html {
  scroll-behavior: smooth;
}

body {
  background: var(--nc-bg);
  color: var(--nc-text);
  font-family: 'Manrope', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
  transition: background 0.3s ease, color 0.3s ease;
  min-height: 100vh;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
img { max-width: 100%; display: block; }

/* Кнопка возврата в каталог */
.nc-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 100px;
  border: 1px solid rgba(var(--nc-text-rgb), 0.15);
  font-size: 14px;
  font-weight: 600;
  background: transparent;
  color: var(--nc-text);
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 24px;
  text-decoration: none;
}

.nc-back:hover {
  background: rgba(var(--nc-text-rgb), 0.05);
  border-color: rgba(var(--nc-text-rgb), 0.3);
}

/* ===== COSMOS (страница каталога) ===== */
.cosmos-page {
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  padding-bottom: var(--wp-footer-offset);
}

#particles {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.cosmos-hero {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: calc(var(--wp-header-offset) + 136px) 32px 60px;
  pointer-events: none;
}

.cosmos-hero h1 {
  font-family: 'Manrope', sans-serif;
  font-size: clamp(36px, 6vw, 72px);
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.05;
  margin-bottom: 16px;
}

.cosmos-hero p {
  font-size: clamp(15px, 1.4vw, 18px);
  color: rgba(var(--nc-text-rgb), 0.65);
  max-width: 560px;
  margin: 0 auto 12px;
  line-height: 1.5;
}

.cosmos-hero .hint {
  font-size: 13px;
  color: rgba(var(--nc-text-rgb), 0.4);
  margin-top: 24px;
  letter-spacing: 0.02em;
}

#cosmos {
  position: relative;
  z-index: 2;
  width: 100%;
  flex: 1;
  min-height: 640px;
  overflow: hidden;
  pointer-events: none;
  max-width: 1440px;
  margin: 0 auto;
}

.bubble {
  position: absolute;
  border-radius: 50%;
  cursor: pointer;
  pointer-events: auto;
  background: var(--nc-card-gradient);
  border: 1px solid rgba(var(--nc-text-rgb), 0.12);
  box-shadow: var(--nc-bubble-shadow);
  overflow: hidden;
  transition: box-shadow 0.3s ease, border-color 0.3s ease;
  will-change: transform;
  user-select: none;
}

.bubble::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 25%, rgba(255, 255, 255, 0.25), transparent 55%);
  pointer-events: none;
}

.bubble-photo {
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  filter: saturate(1.05);
}

.bubble-overlay {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: linear-gradient(180deg, rgba(0,0,0,0) 35%, rgba(0,0,0,0.75) 100%);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0 12% 14%;
  text-align: center;
  pointer-events: none;
}

html[data-theme="light"] .bubble-overlay {
  background: linear-gradient(180deg, rgba(255,255,255,0) 35%, rgba(0,0,0,0.7) 100%);
}

.bubble-label {
  font-family: 'Space Grotesk', 'Manrope', sans-serif;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.6);
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.bubble-brand {
  display: block;
  font-size: 0.78em;
  opacity: 0.85;
  font-weight: 500;
  margin-bottom: 2px;
}

.bubble-model {
  display: block;
  font-size: 1em;
}

.bubble:hover {
  z-index: 5;
  border-color: rgba(var(--nc-text-rgb), 0.4);
  box-shadow: var(--nc-bubble-glow);
}

.bubble:hover .bubble-photo {
  filter: saturate(1.2) brightness(1.05);
}

.bubble.hidden-by-filter {
  opacity: 0.16;
  pointer-events: none;
}

.bubble.hidden-by-filter .bubble-photo {
  filter: saturate(0.65) brightness(0.78);
}

/* ===== CTA БЛОК ===== */
.wiki-cta {
  position: relative;
  z-index: 2;
  margin: 0 24px 40px;
  border-radius: 28px;
  overflow: hidden;
  background: var(--nc-card-gradient);
  border: 1px solid rgba(var(--nc-text-rgb), 0.1);
}

/* Анимированное свечение фона */
.wiki-cta-glow {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 80% 60% at 50% 110%, rgba(var(--nc-text-rgb), 0.07) 0%, transparent 70%);
  animation: cta-pulse 4s ease-in-out infinite;
  pointer-events: none;
}

@keyframes cta-pulse {
  0%, 100% { opacity: 0.6; transform: scale(1); }
  50%       { opacity: 1;   transform: scale(1.04); }
}

.wiki-cta-inner {
  position: relative;
  padding: 28px;
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.wiki-cta.visible .wiki-cta-inner {
  opacity: 1;
  transform: translateY(0);
}

.wiki-cta-shell {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(280px, 0.7fr);
  gap: 22px;
  align-items: stretch;
}

.wiki-cta-copy,
.wiki-cta-actions {
  position: relative;
  border-radius: 26px;
  padding: 28px;
  background: rgba(var(--nc-text-rgb), 0.03);
  border: 1px solid rgba(var(--nc-text-rgb), 0.08);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.06);
}

html[data-theme="light"] .wiki-cta-copy,
html[data-theme="light"] .wiki-cta-actions {
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.9);
}

.wiki-cta-copy {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 100%;
}

.wiki-cta-eyebrow {
  display: inline-flex;
  align-self: flex-start;
  margin-bottom: 16px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(var(--nc-text-rgb), 0.12);
  background: rgba(var(--nc-text-rgb), 0.04);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: rgba(var(--nc-text-rgb), 0.58);
  font-weight: 700;
}

.wiki-cta-title {
  font-family: 'Manrope', sans-serif;
  font-size: clamp(24px, 3vw, 34px);
  font-weight: 700;
  letter-spacing: 0;
  margin-bottom: 12px;
  line-height: 1.15;
}

.wiki-cta-sub {
  font-size: 16px;
  line-height: 1.55;
  color: rgba(var(--nc-text-rgb), 0.65);
  max-width: 58ch;
}

.wiki-cta-actions {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 18px;
  background:
    radial-gradient(circle at top right, rgba(var(--nc-text-rgb), 0.08), transparent 42%),
    rgba(var(--nc-text-rgb), 0.03);
}

.wiki-cta-btn {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 16px 18px 16px 22px;
  border-radius: 100px;
  background: var(--nc-accent);
  color: var(--nc-accent-text);
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
  letter-spacing: -0.01em;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.wiki-cta-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(var(--nc-text-rgb), 0.18);
}

.wiki-cta-btn-orb {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.08);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

html[data-theme="light"] .wiki-cta-btn-orb {
  background: rgba(255, 255, 255, 0.12);
}

.wiki-cta-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 54px;
  padding: 0 20px;
  border-radius: 999px;
  border: 1px solid rgba(var(--nc-text-rgb), 0.14);
  background: rgba(var(--nc-text-rgb), 0.02);
  color: var(--nc-text);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.wiki-cta-link:hover {
  background: rgba(var(--nc-text-rgb), 0.06);
  border-color: rgba(var(--nc-text-rgb), 0.26);
  transform: translateY(-2px);
}

@media (max-width: 700px) {
  .wiki-cta {
    margin: 0 12px 24px;
    border-radius: 20px;
  }

  .wiki-cta-inner {
    padding: 18px;
  }

  .wiki-cta-sub {
    font-size: 14px;
  }

  .wiki-cta-shell {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .wiki-cta-copy,
  .wiki-cta-actions {
    padding: 20px 18px;
  }
}

/* ===== CAR PAGE ===== */
.car-page {
  padding: calc(var(--wp-header-offset) + 40px) 32px 80px;
  max-width: 1200px;
  margin: 0 auto;
}

.car-hero {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  grid-template-areas:
    "media title"
    "media info";
  column-gap: 48px;
  row-gap: 18px;
  align-items: start;
  margin-bottom: 80px;
}

.car-hero:has(.car-hero-price) {
  grid-template-areas:
    "media title"
    "media price"
    "media info";
}

.car-media {
  grid-area: media;
}

.car-title-block {
  grid-area: title;
}

.car-info {
  grid-area: info;
}

@media (max-width: 900px) {
  .car-hero {
    grid-template-columns: 1fr;
    grid-template-areas:
      "title"
      "media"
      "info";
    gap: 24px;
  }

  .car-hero:has(.car-hero-price) {
    grid-template-areas:
      "title"
      "media"
      "price"
      "info";
  }

  .car-page { padding: calc(var(--wp-header-offset) + 30px) 20px 60px; }
}

.gallery-main {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 24px;
  overflow: hidden;
  background: var(--nc-card-1);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.gallery-main img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.3s ease;
}

.gallery-thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.gallery-thumb {
  aspect-ratio: 1 / 1;
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  padding: 0;
  border: 2px solid transparent;
  transition: border-color 0.2s ease, transform 0.2s ease;
  background: var(--nc-card-1);
}

.gallery-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery-thumb:hover { transform: translateY(-2px); }
.gallery-thumb.active { border-color: var(--nc-accent); }

.car-title-block .badge-pill {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 100px;
  background: rgba(var(--nc-text-rgb), 0.08);
  border: 1px solid rgba(var(--nc-text-rgb), 0.15);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 16px;
}

.car-title-block h1 {
  font-family: 'Manrope', sans-serif;
  font-size: clamp(32px, 4vw, 48px);
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.05;
  margin-bottom: 8px;
}

.car-title-block .car-year {
  font-size: 16px;
  color: rgba(var(--nc-text-rgb), 0.55);
}

.car-hero-price {
  grid-area: price;
  justify-self: start;
  display: inline-flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 18px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(var(--nc-text-rgb), 0.09) 0%, rgba(var(--nc-text-rgb), 0.04) 100%);
  border: 1px solid rgba(var(--nc-text-rgb), 0.13);
  box-shadow: inset 0 1px 0 rgba(var(--nc-text-rgb), 0.07);
}

.car-hero-price__label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: rgba(var(--nc-text-rgb), 0.55);
}

.car-hero-price__label svg {
  flex-shrink: 0;
  opacity: 0.7;
}

.car-hero-price__amount {
  font-family: 'Manrope', 'Manrope', sans-serif;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1;
  color: var(--nc-text);
}

.car-info .car-short {
  font-size: 16px;
  line-height: 1.55;
  color: rgba(var(--nc-text-rgb), 0.78);
  margin-bottom: 32px;
}

/* Сноска — ссылка на каталог */
.catalog-note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 16px 20px;
  border-radius: 14px;
  background: rgba(var(--nc-text-rgb), 0.04);
  border: 1px solid rgba(var(--nc-text-rgb), 0.1);
  font-size: 14px;
  line-height: 1.5;
  color: rgba(var(--nc-text-rgb), 0.75);
  margin-bottom: 20px;
}

.catalog-note-icon {
  font-size: 16px;
  flex-shrink: 0;
  margin-top: 1px;
}

.catalog-note-link {
  color: var(--nc-text);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: opacity 0.2s;
}

.catalog-note-link:hover { opacity: 0.7; }

/* Кнопки в блоке мотивации */
.motivation-links {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 28px;
}

.cta-secondary {
  display: inline-flex;
  align-items: center;
  padding: 18px 28px;
  border-radius: 100px;
  border: 1px solid rgba(var(--nc-text-rgb), 0.2);
  background: transparent;
  color: var(--nc-text);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  letter-spacing: -0.01em;
}

.cta-secondary:hover {
  background: rgba(var(--nc-text-rgb), 0.06);
  border-color: rgba(var(--nc-text-rgb), 0.35);
}

.cta-primary {
  width: 100%;
  padding: 18px 24px;
  border-radius: 100px;
  border: none;
  background: var(--nc-accent);
  color: var(--nc-accent-text);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  letter-spacing: -0.01em;
}

.cta-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(var(--nc-text-rgb), 0.18);
}

.cta-primary:active { transform: translateY(0); }

/* ===== SECTIONS ===== */
.section {
  margin-bottom: 80px;
}

.section h2 {
  font-family: 'Manrope', sans-serif;
  font-size: clamp(24px, 3vw, 34px);
  font-weight: 700;
  letter-spacing: 0;
  margin-bottom: 24px;
}

.specs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1px;
  background: rgba(var(--nc-text-rgb), 0.08);
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid rgba(var(--nc-text-rgb), 0.08);
}

.spec-cell {
  padding: 18px 20px;
  background: var(--nc-bg);
}

.spec-key {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(var(--nc-text-rgb), 0.5);
  margin-bottom: 6px;
}

.spec-value {
  font-size: 16px;
  font-weight: 600;
}

.advantages-list {
  list-style: none;
  display: grid;
  gap: 14px;
}

.advantages-list li {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 18px 22px;
  background: var(--nc-card-gradient);
  border: 1px solid rgba(var(--nc-text-rgb), 0.08);
  border-radius: 16px;
  font-size: 15px;
  line-height: 1.5;
}

.advantages-list li::before {
  content: '✓';
  flex: 0 0 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--nc-accent);
  color: var(--nc-accent-text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
  margin-top: 1px;
}

.compare-list {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.compare-list a {
  display: block;
  padding: 18px 22px;
  background: var(--nc-card-gradient);
  border: 1px solid rgba(var(--nc-text-rgb), 0.08);
  border-radius: 16px;
  color: var(--nc-text);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
  text-decoration: none;
  transition: border-color 0.2s ease;
}

.compare-list a:hover {
  border-color: rgba(var(--nc-text-rgb), 0.3);
}

.compare-list a::after {
  content: ' →';
  color: rgba(var(--nc-text-rgb), 0.5);
}

.long-desc p {
  font-size: 16px;
  line-height: 1.7;
  color: rgba(var(--nc-text-rgb), 0.82);
  margin-bottom: 16px;
}

.motivation {
  background: var(--nc-card-gradient);
  border: 1px solid rgba(var(--nc-text-rgb), 0.1);
  border-radius: 24px;
  padding: 48px;
  text-align: center;
}

.motivation h2 { margin-bottom: 12px; }

.motivation p {
  font-size: 17px;
  line-height: 1.55;
  color: rgba(var(--nc-text-rgb), 0.75);
  max-width: 580px;
  margin: 0 auto 28px;
}

.motivation .cta-primary {
  display: inline-flex;
  width: auto;
  padding: 18px 36px;
}

.motivation p {
  margin-bottom: 0;
}

.motivation-stats {
  display: flex;
  justify-content: center;
  gap: 48px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}

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

.motivation-stat .num {
  font-family: 'Manrope', sans-serif;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0;
  margin-bottom: 4px;
}

.motivation-stat .lbl {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(var(--nc-text-rgb), 0.55);
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 18px;
}

.related-card {
  background: var(--nc-card-gradient);
  border: 1px solid rgba(var(--nc-text-rgb), 0.08);
  border-radius: 16px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.related-card:hover {
  transform: translateY(-3px);
  border-color: rgba(var(--nc-text-rgb), 0.2);
}

.related-card-photo {
  aspect-ratio: 4 / 3;
  background-size: cover;
  background-position: center;
}

.related-card-body { padding: 16px; }
.related-card-brand {
  font-size: 12px;
  color: rgba(var(--nc-text-rgb), 0.55);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}
.related-card-model {
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.01em;
}

/* ===== MODAL ===== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-card {
  width: 100%;
  max-width: 500px;
  background: var(--nc-bg);
  border: 1px solid rgba(var(--nc-text-rgb), 0.1);
  border-radius: 24px;
  padding: 36px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
  animation: slideUp 0.25s ease;
}

@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 24px;
}

.modal-head h3 {
  font-family: 'Manrope', sans-serif;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0;
}

.modal-head .modal-car-name {
  font-size: 13px;
  color: rgba(var(--nc-text-rgb), 0.5);
  margin-top: 4px;
}

.modal-close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid rgba(var(--nc-text-rgb), 0.15);
  color: var(--nc-text);
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
}

.modal-close:hover { background: rgba(var(--nc-text-rgb), 0.06); }

.modal-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-form input,
.modal-form textarea {
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid rgba(var(--nc-text-rgb), 0.12);
  background: rgba(var(--nc-text-rgb), 0.03);
  color: var(--nc-text);
  font-family: inherit;
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.modal-form input:focus,
.modal-form textarea:focus {
  border-color: rgba(var(--nc-text-rgb), 0.4);
  background: rgba(var(--nc-text-rgb), 0.05);
}

.modal-form textarea {
  resize: vertical;
  min-height: 80px;
}

.modal-form button[type="submit"] {
  margin-top: 8px;
  padding: 16px 24px;
  border-radius: 100px;
  border: none;
  background: var(--nc-accent);
  color: var(--nc-accent-text);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.modal-form button[type="submit"]:hover { transform: translateY(-2px); }
.modal-form button[type="submit"]:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.modal-error {
  color: #ff6b6b;
  font-size: 14px;
  text-align: center;
  margin-top: 4px;
}

.modal-consent {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 12px;
  line-height: 1.5;
  color: rgba(var(--nc-text-rgb), 0.55);
  cursor: pointer;
}

.modal-form .modal-consent input {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  margin: 1px 0 0;
  padding: 0;
  border-radius: 4px;
  accent-color: var(--nc-accent);
  cursor: pointer;
}

.modal-consent a {
  color: inherit;
  text-decoration: underline;
}

/* Экран «Заявка отправлена» (общий для каталога, статей, «О компании» и страниц моделей), 2026-09-24 */
.modal-success {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 28px 8px 8px;
}

.modal-success-icon {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--nc-accent);
  color: transparent;
  font-size: 0;
  margin: 0 0 24px;
  box-shadow: 0 0 0 8px rgba(var(--nc-text-rgb), 0.07);
  animation: ncSuccessPop 0.32s cubic-bezier(0.2, 0.9, 0.3, 1.3) both;
}

/* галочка рисуется линиями — одинаково во всех шрифтах и темах */
.modal-success-icon::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 22px;
  height: 11px;
  border-left: 3px solid var(--nc-accent-text);
  border-bottom: 3px solid var(--nc-accent-text);
  transform: translate(-50%, -68%) rotate(-45deg);
}

@keyframes ncSuccessPop {
  from { transform: scale(0.6); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-success h4 {
  font-family: 'Manrope', sans-serif;
  font-size: 24px;
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1.2;
  margin: 0 0 10px;
}

.modal-success p {
  max-width: 40ch;
  text-wrap: balance;
  margin: 0 0 28px;
  color: rgba(var(--nc-text-rgb), 0.65);
  font-size: 15px;
  line-height: 1.55;
}

.modal-success .cta-secondary {
  justify-content: center;
  min-width: 200px;
  padding: 15px 28px;
}

@media (prefers-reduced-motion: reduce) {
  .modal-success-icon { animation: none; }
}

/* iframe — частицы отключены в JS, убираем лишний overflow.
   В WordPress над iframe фиксированный хедер, под iframe — футер; они визуально
   накрывают верх и низ iframe. --wp-header-offset / --wp-footer-offset поднимают
   контент в видимую зону. cosmos-page жёстко привязан к 100vh, чтобы внутренний
   контент не уезжал за нижнюю границу iframe (scrolling="no" иначе обрезает CTA). */
body.in-iframe {
  overflow: hidden;
  height: 100vh;
}

body.in-iframe .cosmos-page {
  min-height: 0;
  height: 100vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

body.in-iframe.in-iframe-catalog .cosmos-page {
  min-height: 100vh;
  height: auto;
  overflow: visible;
  padding-bottom: 8px;
}

body.in-iframe.in-iframe-catalog {
  overflow: visible;
  height: auto;
}

body.in-iframe.in-iframe-catalog .cosmos-hero {
  padding: 102px 20px 20px;
}

body.in-iframe.in-iframe-catalog .cosmos-hero h1 {
  font-size: clamp(28px, 4.4vw, 52px);
  margin-bottom: 10px;
}

body.in-iframe.in-iframe-catalog .cosmos-hero p {
  font-size: clamp(13px, 1.2vw, 16px);
  margin-bottom: 8px;
}

body.in-iframe.in-iframe-catalog .cosmos-hero .hint {
  margin-top: 12px;
}

body.in-iframe.in-iframe-catalog .controls-bar {
  padding: 0 16px 16px;
  gap: 6px;
}

body.in-iframe.in-iframe-catalog #cosmos {
  flex: 0 0 auto;
  min-height: clamp(520px, calc(100vh - var(--wp-header-offset) - var(--wp-footer-offset) - 40px), 820px);
}

@media (max-width: 700px) {
  body.in-iframe.in-iframe-catalog #cosmos {
    display: none !important;
  }

  body.in-iframe.in-iframe-catalog .cosmos-hero {
    padding: calc(var(--wp-header-offset) + 12px) 16px 16px;
  }
}

body.in-iframe.in-iframe-car .car-page {
  min-height: 0;
  height: auto;
  overflow: visible;
  padding-bottom: 40px;
}

body.in-iframe.in-iframe-car {
  overflow: visible;
  height: auto;
}

/* Inside iframe, position:fixed is relative to the full iframe height (not browser window).
   Lock backdrop to the top viewport slice and pin the card to the top so it stays visible
   after the parent scrolls the iframe into view (wiki:modal-open). */
body.in-iframe .modal-backdrop {
  top: 0;
  left: 0;
  right: 0;
  bottom: auto;
  height: 100vh;
  align-items: flex-start;
  padding-top: 80px;
}

.controls-bar {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 24px 32px;
}

.filter-btn {
  padding: 8px 20px;
  border-radius: 100px;
  border: 1px solid rgba(var(--nc-text-rgb), 0.15);
  background: rgba(var(--nc-text-rgb), 0.04);
  color: var(--nc-text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  letter-spacing: 0.01em;
  appearance: none;
  -webkit-appearance: none;
}

.controls-bar.has-active-filter .filter-btn {
  opacity: 0.34;
  transform: scale(0.97);
}

.filter-btn:hover {
  background: rgba(var(--nc-text-rgb), 0.1);
  border-color: rgba(var(--nc-text-rgb), 0.3);
  opacity: 0.72;
}

.filter-btn.active {
  background: var(--nc-accent);
  color: var(--nc-accent-text);
  border-color: var(--nc-accent);
  opacity: 1;
  transform: scale(1);
  box-shadow: 0 12px 30px rgba(var(--nc-text-rgb), 0.16);
}

.controls-bar.has-active-filter .filter-btn.active {
  opacity: 1;
}

html[data-theme="light"] .filter-btn.active {
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.14);
}

.controls-sep {
  width: 1px;
  height: 24px;
  background: rgba(var(--nc-text-rgb), 0.15);
  margin: 0 4px;
}

.view-toggle {
  display: flex;
  gap: 4px;
  background: rgba(var(--nc-text-rgb), 0.06);
  border: 1px solid rgba(var(--nc-text-rgb), 0.12);
  border-radius: 100px;
  padding: 4px;
}

.view-btn {
  width: 34px;
  height: 34px;
  border-radius: 100px;
  border: none;
  background: transparent;
  color: rgba(var(--nc-text-rgb), 0.45);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  appearance: none;
  -webkit-appearance: none;
}

.view-btn:hover {
  color: rgba(var(--nc-text-rgb), 0.8);
}

.view-btn.active {
  background: var(--nc-accent);
  color: var(--nc-accent-text);
}

#cards-grid {
  position: relative;
  z-index: 2;
  display: none;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
  padding: 0 32px 80px;
  max-width: 1280px;
  margin: 0 auto;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

#cards-grid.visible {
  display: grid;
}

#cards-grid.animated {
  opacity: 1;
  transform: translateY(0);
}

.wiki-card {
  background: var(--nc-card-gradient);
  border: 1px solid rgba(var(--nc-text-rgb), 0.08);
  border-radius: 20px;
  overflow: hidden;
  cursor: pointer;
  color: var(--nc-text);
  display: block;
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.wiki-card:hover {
  transform: translateY(-5px);
  border-color: rgba(var(--nc-text-rgb), 0.22);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.25);
}

.wiki-card-photo {
  width: 100%;
  aspect-ratio: 4 / 3;
  background:
    radial-gradient(circle at 50% 38%, rgba(var(--nc-text-rgb), 0.08), transparent 58%),
    linear-gradient(180deg, rgba(var(--nc-text-rgb), 0.02), rgba(var(--nc-text-rgb), 0.04));
  position: relative;
  overflow: hidden;
  padding: 18px;
}

.wiki-card-img {
  position: absolute;
  inset: 18px;
  width: calc(100% - 36px);
  height: calc(100% - 36px);
  object-fit: contain;
  object-position: center;
  display: block;
}

.wiki-card-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 4px 10px;
  border-radius: 100px;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.wiki-card-body {
  padding: 16px 18px 18px;
}

.wiki-card-brand {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: rgba(var(--nc-text-rgb), 0.5);
  margin-bottom: 4px;
}

.wiki-card-model {
  font-family: 'Manrope', sans-serif;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.2;
  margin-bottom: 10px;
}

.wiki-card-link {
  font-size: 12px;
  font-weight: 600;
  color: rgba(var(--nc-text-rgb), 0.5);
  display: flex;
  align-items: center;
  gap: 5px;
  transition: color 0.2s ease;
}

.wiki-card:hover .wiki-card-link {
  color: var(--nc-text);
}

.compare-section {
  max-width: 1140px;
  margin: 90px auto 0;
  padding: 0 32px;
}

.compare-section h2 {
  font-family: 'Manrope', sans-serif;
  font-size: clamp(22px, 3vw, 30px);
  font-weight: 700;
  letter-spacing: 0;
  margin-bottom: 10px;
}

.compare-section-sub {
  font-size: 15px;
  color: rgba(var(--nc-text-rgb), 0.55);
  margin-bottom: 24px;
  max-width: 600px;
}

.compare-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.compare-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: 100px;
  border: 1px solid rgba(var(--nc-text-rgb), 0.15);
  background: rgba(var(--nc-text-rgb), 0.04);
  color: var(--nc-text);
  font-size: 14px;
  font-weight: 600;
  transition: all 0.2s ease;
}

.compare-link:hover {
  background: rgba(var(--nc-text-rgb), 0.09);
  border-color: rgba(var(--nc-text-rgb), 0.3);
}

.compare-link--tool {
  background: var(--nc-accent);
  border-color: var(--nc-accent);
  color: var(--nc-accent-text);
}

.compare-link--tool:hover {
  background: var(--nc-accent);
  opacity: 0.85;
}

@media (max-width: 700px) {
  .compare-section {
    padding: 0 20px;
    margin-top: 60px;
  }

  .compare-link {
    font-size: 13px;
    padding: 10px 16px;
  }
}

#cosmos.hiding {
  opacity: 0;
  transform: scale(0.95);
  pointer-events: none;
}

.cosmos-bubbles-layer {
  position: relative;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.viewer-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 24px;
  overflow: hidden;
  background: var(--nc-card-1);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  user-select: none;
  touch-action: none;
}

.viewer-canvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
  will-change: transform;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.viewer-wrap:active .viewer-canvas {
  cursor: grabbing;
}

.viewer-hint {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 16px;
  border-radius: 100px;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(8px);
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  pointer-events: none;
  transition: opacity 0.4s ease;
  white-space: nowrap;
}

.viewer-hint.hidden {
  opacity: 0;
}

.viewer-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: var(--nc-card-1);
  border-radius: 24px;
  transition: opacity 0.3s ease;
}

.viewer-loading.done {
  opacity: 0;
  pointer-events: none;
}

.viewer-progress-bar {
  width: 160px;
  height: 3px;
  border-radius: 3px;
  background: rgba(var(--nc-text-rgb), 0.1);
  overflow: hidden;
}

.viewer-progress-fill {
  height: 100%;
  background: var(--nc-accent);
  border-radius: 3px;
  width: 0%;
  transition: width 0.1s linear;
}

.viewer-progress-text {
  font-size: 12px;
  color: rgba(var(--nc-text-rgb), 0.5);
}

.color-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.color-btn {
  padding: 6px 16px;
  border-radius: 100px;
  border: 1px solid rgba(var(--nc-text-rgb), 0.15);
  background: transparent;
  color: var(--nc-text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.color-btn:hover {
  background: rgba(var(--nc-text-rgb), 0.06);
  border-color: rgba(var(--nc-text-rgb), 0.3);
}

.color-btn.active {
  background: var(--nc-accent);
  color: var(--nc-accent-text);
  border-color: var(--nc-accent);
}

.panorama-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding: 10px 20px;
  border-radius: 100px;
  border: 1px solid rgba(var(--nc-text-rgb), 0.2);
  background: transparent;
  color: var(--nc-text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.panorama-btn:hover {
  background: rgba(var(--nc-text-rgb), 0.06);
  border-color: rgba(var(--nc-text-rgb), 0.35);
}

.pano-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: #000;
  display: flex;
  flex-direction: column;
}

.pano-modal.hidden {
  display: none;
}

.pano-close {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 10001;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.6);
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
}

.pano-close:hover {
  background: rgba(0, 0, 0, 0.9);
  border-color: #fff;
}

.pano-frame {
  width: 100%;
  height: 100%;
  border: none;
}

.car-not-found {
  text-align: center;
  padding: 80px 20px;
}

.car-not-found h1 {
  font-family: 'Manrope', sans-serif;
  font-size: 32px;
  margin-bottom: 16px;
}

.car-not-found p {
  color: rgba(var(--nc-text-rgb), 0.6);
  margin-bottom: 24px;
}

/* ===== MOBILE ===== */
@media (max-width: 700px) {
  /* Cosmos page */
  .cosmos-hero {
    padding: calc(var(--wp-header-offset) + 12px) 16px 20px;
  }

  .cosmos-hero h1 {
    font-size: 32px;
    line-height: 1.12;
    margin-bottom: 12px;
  }

  .cosmos-hero p {
    font-size: 14px;
    max-width: 340px;
  }

  .cosmos-hero .hint {
    display: none !important;
  }

  #cosmos {
    display: none !important;
  }

  .controls-bar {
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0 16px 18px;
  }

  .filter-btn {
    flex: 0 0 auto;
    padding: 8px 14px;
    font-size: 12px;
  }

  .controls-sep,
  .view-toggle {
    display: none !important;
  }

  .view-btn {
    width: 30px;
    height: 30px;
  }

  #cards-grid {
    grid-template-columns: 1fr;
    gap: 14px;
    width: 100%;
    padding: 0 16px 48px;
  }

  .wiki-card {
    border-radius: 16px;
  }

  .wiki-card-photo {
    aspect-ratio: 4 / 3;
  }

  .wiki-card-badge {
    top: 8px;
    left: 8px;
    max-width: calc(100% - 16px);
    font-size: 9px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .wiki-card-body {
    padding: 14px;
  }

  .wiki-card-brand {
    font-size: 10px;
    margin-bottom: 3px;
  }

  .wiki-card-model {
    font-size: 15px;
    line-height: 1.24;
    margin-bottom: 8px;
  }

  .wiki-card-link {
    font-size: 11px;
  }

  /* Car page */
  .car-page {
    padding: calc(var(--wp-header-offset) + 20px) 16px 48px;
  }

  .car-hero {
    gap: 20px;
    margin-bottom: 48px;
  }

  .car-title-block .badge-pill {
    font-size: 10px;
    margin-bottom: 12px;
  }

  .car-title-block h1 {
    font-size: 30px;
    line-height: 1.08;
    margin-bottom: 10px;
  }

  .car-title-block .car-year {
    font-size: 14px;
  }

  .car-hero-price {
    padding: 12px 16px;
  }

  .car-hero-price__amount {
    font-size: 24px;
  }

  .viewer-wrap,
  .gallery-main {
    border-radius: 18px;
    aspect-ratio: 4 / 3;
  }

  .car-info .car-short {
    font-size: 14px;
    margin-bottom: 18px;
  }

  .catalog-note {
    margin-bottom: 14px;
  }

  .catalog-note {
    font-size: 13px;
    padding: 12px 14px;
  }

  .cta-primary {
    width: 100%;
    font-size: 14px;
    padding: 15px 20px;
  }

  .cta-secondary {
    width: 100%;
    justify-content: center;
    font-size: 14px;
    padding: 14px 20px;
  }

  /* Секции */
  .section {
    margin-bottom: 48px;
  }

  .section h2 {
    font-size: 24px;
    margin-bottom: 16px;
  }

  .specs-grid {
    grid-template-columns: 1fr;
  }

  .spec-cell {
    padding: 14px 16px;
  }

  .spec-value {
    font-size: 14px;
  }

  .advantages-list li {
    padding: 14px 16px;
    font-size: 14px;
  }

  .long-desc p {
    font-size: 14px;
  }

  .motivation {
    padding: 28px 20px;
    border-radius: 16px;
  }

  .motivation h2 {
    font-size: 24px;
  }

  .motivation p {
    font-size: 14px;
  }

  .motivation-links {
    flex-direction: column;
    gap: 10px;
  }

  .motivation .cta-primary {
    width: 100%;
    justify-content: center;
  }

  .related-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .related-card-model {
    font-size: 14px;
  }

  /* 3D viewer */
  .color-picker {
    gap: 8px;
    margin-top: 10px;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .color-picker::-webkit-scrollbar {
    display: none;
  }

  .color-btn {
    flex: 0 0 auto;
    padding: 5px 12px;
    font-size: 12px;
  }

  .panorama-btn {
    width: 100%;
    justify-content: center;
    padding: 8px 16px;
    font-size: 13px;
  }

  /* Gallery thumbs */
  .gallery-thumbs {
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 6px;
    margin-top: 10px;
  }

  /* Modal */
  .modal-card {
    max-width: 100%;
    padding: 24px 20px;
    border-radius: 18px;
  }

  .modal-head h3 {
    font-size: 20px;
  }

  /* Back link */
  .nc-back {
    font-size: 13px;
    padding: 8px 14px;
    margin-bottom: 16px;
  }
}

@media (max-width: 380px) {
  #cards-grid {
    grid-template-columns: 1fr;
  }

  #cosmos {
    min-height: 520px;
  }

  .specs-grid {
    grid-template-columns: 1fr;
  }

  .related-grid {
    grid-template-columns: 1fr;
  }
}

/* ===== UTIL ===== */
.hidden { display: none !important; }
