/* ==========================================================================
   Loncin XWolf — UI/UX Polish & Accessibility Layer (Phase 1)
   Applies WCAG 2.2 AA, html-tailwind.csv & ui-ux-pro-max rules uniformly.
   ========================================================================== */

/* 1. Balanced typography, centered & viewport-safe dialogs, touch hygiene */
html, body {
  overflow-x: clip;
}

dialog {
  margin: auto;
  max-width: calc(100vw - 24px);
  max-height: calc(100dvh - 24px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

a, button, select, input, textarea, summary, [role="button"] {
  touch-action: manipulation;
}

h1, h2, h3, h4 {
  text-wrap: balance;
}

.tabular-nums {
  font-variant-numeric: tabular-nums;
}

.min-h-dvh {
  min-height: 100vh;
  min-height: 100dvh;
}

/* 2. Keyboard Skip-Link for Screen Readers & Keyboard Users */
.skip-link {
  position: fixed;
  top: -64px;
  left: 16px;
  z-index: 999;
  background: #E94F25;
  color: #FFFFFF;
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 0 0 10px 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  transition: top 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  text-decoration: none;
}

.skip-link:focus {
  top: 0;
  color: #FFFFFF;
  outline: 2px solid #FFFFFF;
  outline-offset: -3px;
}

/* 3. Accessible Focus Indicator (WCAG 2.2 / html-tailwind #26, #41) */
a:focus-visible,
button:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid #E94F25;
  outline-offset: 2px;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
  border-color: #E94F25 !important;
  box-shadow: 0 0 0 3px rgba(233, 79, 37, 0.22) !important;
}

/* 4. Prevent iOS Safari Auto-Zoom (< 16px) & Mobile Tap-Target / Header Safeguards */
@media (max-width: 767px) {
  input:not([type="checkbox"]):not([type="radio"]),
  select,
  textarea {
    font-size: 16px !important;
  }
  dialog input:not([type="checkbox"]):not([type="radio"]),
  dialog select,
  dialog button[type="submit"],
  dialog button[aria-label="Закрыть"],
  .modal__close,
  .site-header .mobile-burger-btn,
  #mobile-menu a,
  #mobile-menu button,
  .model-tab,
  .filter-btn {
    min-height: 44px;
  }
  dialog button[aria-label="Закрыть"],
  .modal__close,
  .site-header .mobile-burger-btn {
    min-width: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  .model-tab,
  .filter-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
}

@media (max-width: 479px) {
  .site-header .brand-logo-svg {
    height: 20px !important;
    max-height: 20px !important;
    width: auto !important;
  }
  .site-header .btn-testdrive {
    padding: 8px 12px !important;
    font-size: 11px !important;
    min-height: 40px;
  }
  .site-header .nav-actions {
    gap: 8px !important;
  }
}

.site-header .btn-testdrive {
  background-color: #BF3918;
  color: #fff;
}
.site-header .btn-testdrive:hover { background-color: #A83216; }

[class~="bg-[#E94F25]"][class~="text-white"] { background-color: #BF3918; }
:is(a, button)[class~="bg-[#E94F25]"][class~="text-white"]:hover { background-color: #A83216; }
[class~="bg-[#FFF0EB]"][class~="text-[#E94F25]"] { color: #A83216; }
.product-card [class~="text-[#757475]"] { color: #59595B; }
.product-card [class~="bg-[#F8F9FA]"] span[class~="text-[#E94F25]"] { color: #A83216; }

/* 5. Magic UI Micro-Interactions (transform/opacity only, motion-reduce safe) */
.btn-shimmer {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

.btn-shimmer::after {
  content: "";
  position: absolute;
  inset: 0;
  width: 45%;
  background: linear-gradient(
    105deg,
    transparent 0%,
    rgba(255, 255, 255, 0.28) 50%,
    transparent 100%
  );
  transform: translateX(-160%) skewX(-18deg);
  pointer-events: none;
}

.btn-shimmer:is(:hover, :focus-visible)::after {
  animation: loncin-sheen 750ms ease-out;
}

@keyframes loncin-sheen {
  from {
    transform: translateX(-160%) skewX(-18deg);
  }
  to {
    transform: translateX(320%) skewX(-18deg);
  }
}

.blur-fade-in {
  animation: loncin-blur-fade 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
  animation-delay: var(--delay, 0ms);
}

@keyframes loncin-blur-fade {
  from {
    opacity: 0;
    transform: translateY(10px);
    filter: blur(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}

/* 7. Phase 4 Visual Craft: Hero Scrims, Bento Stats, Card Depth & Interactive Tech Tabs */
.hero-readability {
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.55);
}

.bento-stat-card {
  background: #F6F7F9;
  border: 1px solid #E5E7EB;
  border-radius: 16px;
  padding: 20px 22px;
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1),
              border-color 0.22s cubic-bezier(0.16, 1, 0.3, 1),
              background-color 0.22s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.bento-stat-card:hover {
  background: #FFFFFF;
  border-color: rgba(233, 79, 37, 0.38);
  transform: translateY(-2px);
  box-shadow: 0 12px 28px -12px rgba(17, 24, 39, 0.14);
}

.product-card {
  transition: transform 0.24s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.24s cubic-bezier(0.16, 1, 0.3, 1),
              border-color 0.24s cubic-bezier(0.16, 1, 0.3, 1);
}

.product-card:hover {
  transform: translateY(-4px);
  border-color: rgba(233, 79, 37, 0.35);
  box-shadow: 0 20px 42px -16px rgba(17, 24, 39, 0.14);
}

.scrollbar-none {
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.scrollbar-none::-webkit-scrollbar {
  display: none;
}

.tech-step-btn {
  position: relative;
  text-align: left;
  width: 100%;
  border: 1px solid transparent;
  border-radius: 16px;
  padding: 16px 18px;
  background: transparent;
  cursor: pointer;
  transition: background-color 0.2s cubic-bezier(0.16, 1, 0.3, 1),
              border-color 0.2s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.tech-step-btn:hover {
  background: #F6F7F9;
  border-color: #E5E7EB;
}

.tech-step-btn.is-active {
  background: #FFF7F4;
  border-color: rgba(233, 79, 37, 0.42);
  box-shadow: 0 8px 24px -14px rgba(233, 79, 37, 0.35);
}

.tech-step-btn .tech-step-num {
  background: #F3F4F6;
  color: #4B5563;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.tech-step-btn.is-active .tech-step-num {
  background: #E94F25;
  color: #FFFFFF;
}

/* 6. Respect Reduced Motion Preferences (html-tailwind #2, #42) */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto !important;
  }
  .btn-shimmer::after,
  .btn-shimmer:is(:hover, :focus-visible)::after {
    animation: none !important;
    display: none !important;
  }
  .blur-fade-in {
    animation: none !important;
    filter: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
  .animate-wheel,
  .animate-pulse,
  .animate-bounce,
  .animate-ping,
  .animate-spin {
    animation: none !important;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
