/* ==========================================================================
   base.css — reset, document base, type scale, layout helpers, and the shared
   site chrome (top accent rail, utility bar, header + nav + mega-menu,
   buttons, theme toggle, footer). Rebuilt from the Claude Design prototype.

   All colors come from tokens.css. No raw color literals belong in this file.
   ========================================================================== */

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

html {
  scroll-behavior: smooth;
  /* keep in-page anchor targets (#catalog, #lead) clear of the sticky 74px header */
  scroll-padding-top: 84px;
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
  min-height: 100vh;
  transition: background .5s var(--ease), color .5s var(--ease);
}

img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
}

input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: none;
}

ul,
ol {
  list-style: none;
}

table {
  border-collapse: collapse;
  width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color .25s var(--ease);
}

::selection {
  background: var(--accent);
  color: var(--accent-ink);
}

input::placeholder,
textarea::placeholder {
  color: var(--text-3);
}

/* logo inverts in dark theme (real PNG is dark-on-transparent) */
[data-logo] {
  display: block;
  height: 40px;
  width: auto;
}

:root[data-theme="dark"] [data-logo] {
  filter: brightness(0) invert(1);
}

/* --- focus ring ---------------------------------------------------------- */
:focus-visible {
  outline: 2px solid var(--accent-hot);
  outline-offset: 3px;
  border-radius: var(--r-xs);
}

/* --- type scale (mixed-case, NEVER uppercase the display) ---------------- */
h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: -.02em;
  line-height: 1.06;
  color: var(--text);
  text-transform: none;
}

h1 {
  font-size: clamp(32px, 4.6vw, 60px);
  line-height: 1.03;
}

h2 {
  font-size: clamp(28px, 3.6vw, 46px);
}

h3 {
  font-size: clamp(20px, 2.2vw, 26px);
}

h4 {
  font-size: clamp(17px, 1.6vw, 20px);
}

p {
  line-height: 1.6;
}

strong,
b {
  font-weight: 600;
}

.mono,
code,
kbd,
samp {
  font-family: var(--font-mono);
}

/* --- layout container ---------------------------------------------------- */
.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 clamp(18px, 4vw, 40px);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* --- keyframes ----------------------------------------------------------- */
@keyframes emberPulse {
  0%, 100% { opacity: .55; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.06); }
}

/* --- motion guard -------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  *,
  *::before,
  *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ==========================================================================
   TOP ACCENT RAIL
   ========================================================================== */
.topbar {
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 200;
  background: var(--accent);
}

/* ==========================================================================
   TOP UTILITY BAR
   ========================================================================== */
.util {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.util .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding-top: 9px;
  padding-bottom: 9px;
}

.util__left {
  display: flex;
  align-items: center;
  gap: 18px;
  font-size: 13.5px;
  color: var(--text-2);
  flex-wrap: wrap;
}

.util__hours {
  display: flex;
  align-items: center;
  gap: 8px;
}

.util__pulse {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  flex: none;
}

.util__right {
  display: flex;
  align-items: center;
  gap: clamp(14px, 2vw, 26px);
  margin-left: auto;
  flex-wrap: wrap;
}

.util__phones {
  display: flex;
  align-items: stretch;
  gap: clamp(14px, 1.8vw, 24px);
}

.util__phone {
  text-align: right;
  line-height: 1.12;
}

.util__phone a {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(15px, 1.5vw, 20px);
  letter-spacing: -.01em;
  color: var(--text);
}

.util__phone a:hover {
  color: var(--accent);
}

.util__phone-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-top: 3px;
}

.util__div {
  width: 1px;
  background: var(--line-2);
  align-self: stretch;
}

.util__call {
  flex: none;
  padding: 10px 16px;
  border: 1px solid var(--line-2);
  border-radius: 13px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  transition: border-color .2s, color .2s;
}

.util__call:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ==========================================================================
   HEADER / NAV
   ========================================================================== */
.header {
  position: sticky;
  top: 0;
  z-index: 120;
  backdrop-filter: blur(14px);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  border-bottom: 1px solid var(--line);
  transition: box-shadow .3s var(--ease);
}

.header.is-scrolled {
  box-shadow: var(--shadow-sm);
}

.header__inner {
  height: 74px;
  display: flex;
  align-items: center;
  gap: clamp(12px, 2vw, 26px);
}

.header__logo {
  display: flex;
  align-items: center;
  flex: none;
}

.header__logo img {
  height: 40px;
  width: auto;
}

.mainnav {
  display: flex;
  align-items: center;
  gap: 0;
  margin-left: 2px;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 12px;
  border-radius: var(--r-sm);
  color: var(--text-2);
  font-size: 15px;
  white-space: nowrap;
  position: relative;
  transition: color .2s;
}

.nav-link::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 7px;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .3s var(--ease);
}

.nav-link:hover {
  color: var(--text);
}

.nav-link:hover::after {
  transform: scaleX(1);
}

.nav-caret {
  font-size: 10px;
  color: var(--text-3);
  display: inline-block;
  transition: transform .26s var(--ease), color .26s;
}

.nav-group {
  position: relative;
}

.nav-group > .nav-link::after {
  right: 26px;
}

.nav-group:hover > .nav-link::after,
.nav-group:focus-within > .nav-link::after {
  transform: scaleX(1);
}

.nav-group:hover > .nav-link,
.nav-group:focus-within > .nav-link {
  color: var(--text);
}

.nav-group:hover > .nav-link .nav-caret,
.nav-group:focus-within > .nav-link .nav-caret {
  transform: rotate(180deg);
  color: var(--accent);
}

/* mega-menu / submenu — wide horizontal grid (categories flow into columns,
   wrapping to as many rows as needed instead of one tall vertical list) */
.submenu {
  position: absolute;
  top: 100%;
  left: -6px;
  width: min(720px, calc(100vw - 28px));
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(206px, 1fr));
  gap: 3px;
  margin-top: 10px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity .26s var(--ease), transform .26s var(--ease), visibility .26s;
  pointer-events: none;
  z-index: 40;
}

/* last catalog dropdown opens flush to its right edge so it never overflows */
.submenu--end {
  left: auto;
  right: -6px;
}

/* compact static-section dropdown (Сервис / О компании / Партнёрам / …) —
   a single narrow column instead of the wide catalog grid */
.submenu--compact {
  width: 290px;
  grid-template-columns: 1fr;
  gap: 2px;
}

.submenu::before {
  /* hover bridge so the gap between trigger and panel doesn't drop the hover */
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -16px;
  height: 18px;
}

.nav-group:hover .submenu,
.nav-group:focus-within .submenu {
  opacity: 1;
  visibility: visible;
  transform: none;
  pointer-events: auto;
}

.submenu-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 11px;
  border-radius: var(--r-md);
  text-align: left;
  width: 100%;
  transition: background .18s var(--ease);
}

.submenu-item:hover {
  background: var(--surface-2);
}

.sm-ic {
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--line-2);
  background: var(--surface-2);
  display: grid;
  place-items: center;
  overflow: hidden;
  color: var(--accent);
  transition: background .18s, color .18s, border-color .18s;
}

.sm-ic svg {
  width: 20px;
  height: 20px;
}

/* shared original-site category icons (mega-menu + catalog cards) --------- */
/* the icons are natural grayscale product renders / preview photos — shown
   as-is (matching the original site). The tile holding an original icon stays
   light in BOTH themes so the renders read naturally (no harsh recolouring). */
.sm-ic:has(.cat-ico-img),
.cat-card__icon:has(.cat-ico-img) {
  background: #eef1f2;
  border-color: rgba(0, 0, 0, .08);
}

.cat-ico-img--mono {
  width: 84%;
  height: 84%;
  object-fit: contain;
}

/* preview photo (Оборудование): fills the tile as a product thumbnail */
.cat-ico-img--photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* on hover the tile border/title pick up the accent; the render is untouched */
.submenu-item:hover .sm-ic {
  border-color: var(--accent);
}

.sm-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.sm-title {
  font-weight: 600;
  font-size: 13.5px;
  line-height: 1.25;
  color: var(--text);
  transition: color .18s;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.submenu-item:hover .sm-title {
  color: var(--accent);
}

.header__actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* theme toggle */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--line-2);
  border-radius: 11px;
  background: var(--surface);
  color: var(--text);
  transition: border-color .2s, background .2s, color .2s, transform .2s;
}

.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
}

.theme-toggle__icon {
  font-size: 20px;
  line-height: 1;
}

.header__cta {
  white-space: nowrap;
}

/* hamburger — hidden on desktop */
.nav-burger {
  display: none;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 4px;
  background: var(--surface);
  color: var(--text);
}

.nav-burger span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
}

/* mobile nav panel */
.nav-panel {
  display: none;
  border-top: 1px solid var(--line);
  padding: 12px clamp(18px, 4vw, 40px);
  flex-direction: column;
  gap: 4px;
  background: var(--bg-2);
}

.nav-panel.is-open {
  display: flex;
}

.nav-panel__link {
  text-align: left;
  padding: 12px 8px;
  color: var(--text);
  font-size: 16px;
  border-radius: var(--r-sm);
}

.nav-panel__link:hover {
  color: var(--accent);
}

.nav-panel__phones {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.nav-panel__phones a {
  padding: 8px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 17px;
  color: var(--text);
}

.nav-panel__phones a span {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-3);
}

/* ==========================================================================
   BUTTONS  (NO gradients — flat color only)
   ========================================================================== */
.btn {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  border: none;
  border-radius: 13px;
  padding: 11px 20px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  transition: background .2s, color .2s, border-color .2s, transform .25s var(--ease);
}

.btn--solid {
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 8px 24px -10px var(--glow);
}

.btn--solid:hover {
  background: var(--accent-hot);
  color: var(--accent-ink);
  transform: translateY(-2px);
}

.btn--ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line-2);
  font-weight: 500;
}

.btn--ghost:hover {
  border-color: var(--accent);
  color: var(--text);
  background: var(--surface);
}

.btn .arr {
  font-family: var(--font-mono);
  transition: transform .25s var(--ease);
}

.btn:hover .arr {
  transform: translateX(4px);
}

/* ==========================================================================
   FOOTER (steel chrome)
   ========================================================================== */
.footer {
  background: var(--bg);
  border-top: 1px solid var(--line);
}

.footer .wrap {
  padding-top: clamp(40px, 5vw, 72px);
  padding-bottom: 36px;
}

.footer__top {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(32px, 4vw, 56px);
  padding-bottom: 42px;
  border-bottom: 1px solid var(--line);
}

.footer__brand {
  flex: 2 1 300px;
  min-width: 260px;
}

.footer__brand img {
  height: 42px;
  width: auto;
  margin-bottom: 18px;
}

.footer__about {
  color: var(--text-2);
  max-width: 38ch;
  font-size: 15.5px;
}

.footer__col {
  flex: 1 1 150px;
  min-width: 150px;
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.footer__col--contacts {
  flex: 1.4 1 240px;
  min-width: 230px;
}

.footer__col-title {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 5px;
}

.footer__col a {
  text-align: left;
  color: var(--text-2);
  font-size: 15px;
}

.footer__col a:hover {
  color: var(--accent);
}

.footer__phone a {
  color: var(--text);
  font-size: 18px;
  font-family: var(--font-mono);
}

.footer__phone a:hover {
  color: var(--accent);
}

.footer__phone-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-top: 3px;
}

.footer__email {
  color: var(--text-2);
  font-size: 15px;
}

.footer__email:hover {
  color: var(--accent);
}

.footer__addr {
  color: var(--text-3);
  font-size: 14px;
}

.footer__socials {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-top: 4px;
}

.footer__social {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-2);
  font-size: 14px;
}

.footer__social:hover {
  color: var(--accent);
}

/* coloured brand mark for messengers / socials */
.social-ico {
  flex: none;
  width: 20px;
  height: 20px;
  border-radius: 5px;
  object-fit: contain;
}

.footer__legal {
  padding-top: 24px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  color: var(--text-3);
  font-size: 13px;
  font-family: var(--font-mono);
}

/* ==========================================================================
   RESPONSIVE CHROME
   ========================================================================== */
@media (max-width: 880px) {
  .mainnav { display: none; }
  .nav-burger { display: inline-flex; }
}

@media (max-width: 640px) {
  .util__left { display: none; }
}

@media (max-width: 520px) {
  .header__cta { padding: 11px 16px; }
}
