/* Theme and language controls. Loaded after the preserved original styles. */
:root {
  color-scheme: light;
  --text-black: #181824;
  --preference-surface: rgba(255, 255, 255, .88);
  --preference-border: rgba(206, 200, 224, .8);
  --preference-hover: #ece6f8;
  --preference-shadow: 0 6px 24px rgba(50, 28, 91, .07);
}

html[data-theme="dark"] {
  color-scheme: dark;
  --text-black: #f4f0ff;
  --text-black-main: #f4f0ff;
  --text-black-alt: #f4f0ff;
  --text-secondary: #bdb5d2;
  --text-tertiary: #a29ab8;
  --text-placeholder: #a29ab8;
  --text-red: #ff8587;
  --block: #201c2e;
  --background: #12101b;
  --btn-primary: #8550df;
  --btn-primary-hover: #9664ec;
  --block-var-1: #37304466;
  --block-var-2: #393148;
  --stroke-input: #494055;
  --preference-surface: rgba(34, 29, 48, .94);
  --preference-border: rgba(118, 98, 149, .4);
  --preference-hover: #383047;
  --preference-shadow: 0 6px 28px rgba(0, 0, 0, .2);
}

body { color: var(--text-black-main); }
html[lang="ru"] body { font-family: Aspekta, "Segoe UI", Arial, sans-serif; }

html[data-theme="dark"] body::before,
html[data-theme="dark"] .mobile-menu-circle,
html[data-theme="dark"] .mobile-menu {
  background:
    radial-gradient(ellipse 72% 68% at 47% 5%, rgba(116, 72, 193, .19), transparent 75%),
    radial-gradient(ellipse 70% 58% at 90% 68%, rgba(91, 69, 152, .1), transparent 72%),
    linear-gradient(140deg, #15121e 0%, #171321 48%, #100e17 100%);
}

html[data-theme="dark"] header .logo,
html[data-theme="dark"] .mobile-menu-logo img,
html[data-theme="dark"] .loader-logo img {
  filter: invert(1);
}

html[data-theme="dark"] .navigation-bar,
html[data-theme="dark"] .close-btn-morphed {
  box-shadow: 0 8px 30px rgba(0, 0, 0, .14);
}

html[data-theme="dark"] .menu-toggle,
html[data-theme="dark"] .close-btn-morphed,
html[data-theme="dark"] .nav-button,
html[data-theme="dark"] .back-btn,
html[data-theme="dark"] .form-copy {
  color: var(--text-secondary);
}

html[data-theme="dark"] :is(.menu-toggle, .close-btn-morphed, .nav-button, .back-btn, .form-copy) svg [fill]:not([fill="none"]) {
  fill: currentColor;
}

html[data-theme="dark"] :is(.menu-toggle, .close-btn-morphed, .nav-button, .back-btn, .form-copy) svg [stroke]:not([stroke="none"]) {
  stroke: currentColor;
}

html[data-theme="dark"] .contact-page { border-color: #332c43; }
html[data-theme="dark"] :is(input, textarea) { background-color: rgba(12, 9, 20, .2); }
html[data-theme="dark"] .card {
  background: var(--block);
  box-shadow: 0 8px 28px rgba(0, 0, 0, .25);
}

.site-preferences {
  position: fixed;
  z-index: 110;
  top: max(26px, env(safe-area-inset-top));
  right: max(30px, env(safe-area-inset-right));
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px;
  border: 1px solid var(--preference-border);
  border-radius: 15px;
  background: var(--preference-surface);
  color: var(--text-black-main);
  box-shadow: var(--preference-shadow);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  isolation: isolate;
}

.preference-button,
.preference-language {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 36px;
  border: 0;
  border-radius: 10px;
  padding: 0 10px;
  background: transparent;
  color: inherit;
  font-family: Aspekta, sans-serif;
  font-weight: 500;
  font-size: 12px;
  line-height: 16px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: background-color .18s ease, color .18s ease;
}

.preference-button { gap: 7px; white-space: nowrap; }
.preference-button > svg { width: 18px; height: 18px; }
.preference-languages { display: inline-flex; align-items: center; gap: 2px; }
.preference-language { min-width: 34px; padding: 0 7px; }
.preference-button:hover,
.preference-language:hover { background: var(--preference-hover); }
.preference-language[aria-pressed="true"] {
  background: var(--btn-primary);
  color: #fff;
}
.preference-language[aria-pressed="true"]:hover { background: var(--btn-primary-hover); }
.preference-divider { width: 1px; height: 20px; background: var(--preference-border); }
.site-preferences button:focus-visible {
  outline: 2px solid var(--btn-primary-hover);
  outline-offset: 3px;
}

.preference-status {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 600px) {
  .site-preferences {
    top: max(26px, env(safe-area-inset-top));
    right: max(14px, env(safe-area-inset-right));
    gap: 3px;
    border-radius: 13px;
    padding: 4px;
  }
  .preference-theme-label { display: none; }
  .preference-button { min-width: 34px; padding: 0 7px; }
  .preference-language { min-width: 31px; padding: 0 6px; }
  .preference-button, .preference-language { min-height: 34px; border-radius: 8px; }
}

/* Compact controls stay in the header without covering content on narrow phones. */
@media (max-width: 380px) {
  .site-preferences { top: max(26px, env(safe-area-inset-top)); gap: 2px; }
  .preference-language { min-width: 28px; padding: 0 5px; }
  .preference-button { min-width: 31px; padding: 0 6px; }
}

@media (max-width: 600px) {
  html[lang="ru"] .content-btn { flex-wrap: wrap; gap: 12px; }
  html[lang="ru"] .content-btn .btn { max-width: 100%; }
  html[lang="ru"] .content-btn .btn:not(.btn-tg) { font-size: 16px; padding-inline: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  .preference-button, .preference-language { transition: none; }
}

/* Leave room for the translated, two-line project heading above the bottom nav. */
@media (min-width: 811px) and (max-height: 800px) {
  html[lang="ru"] .card-stack-wrapper {
    max-width: min(586px, calc((100dvh - 320px) * 1.333333));
  }
}

/* Replace the domain baked into the showcase browser frame. */
.main-video::after {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  transform: translate(-50%, -100%);
  width: 962px;
  aspect-ratio: 2886 / 114;
  background: url(/assets/browser-domain-wide.svg) center / contain no-repeat;
  z-index: 2;
  pointer-events: none;
}

@media (max-width: 990px) {
  .main-video::after {
    width: calc(100% - 40px);
    max-width: 910px;
    aspect-ratio: 2730 / 108;
    background-image: url(/assets/browser-domain-medium.svg);
  }
}

@media (max-width: 768px) {
  .main-video::after { width: calc(100% - 30px); max-width: 100%; }
}

@media (max-width: 390px) {
  .main-video::after {
    width: calc(100% - 20px);
    aspect-ratio: 1050 / 42;
    background-image: url(/assets/browser-domain-small.svg);
  }
}



/* AVANGARD_HEADER_LOGO_THEME */
header .logo,
.mobile-menu-logo img {
    object-fit: contain;
    filter: none !important;
}

html[data-theme="dark"] header .logo,
html[data-theme="dark"] .mobile-menu-logo img {
    filter: invert(1) !important;
}
