/* ============================================================
   MEGAPOLIS — redesign-2026 (reversible override layer)
   Loaded LAST. Remove the <link> in config/assets.php to revert.
   Design: impeccable (product register) + emil (motion) + taste (anti-slop)
   ============================================================ */

:root {
  /* Neutrals — cool, refined, high-contrast */
  --mp-ink:        #16181d;   /* headings */
  --mp-body:       #33363d;   /* body ~10:1 */
  --mp-muted:      #6b7078;   /* meta text ~4.6:1 on white */
  --mp-line:       #ecedf0;   /* hairline */
  --mp-line-2:     #dfe1e6;
  --mp-bg:         #ffffff;
  --mp-surface:    #f6f7f9;   /* subtle surface */
  --mp-surface-2:  #eff1f4;

  /* Brand — MEGAPOLIS green */
  --mp-brand:      #00c853;   /* vivid fills (paired with dark ink) */
  --mp-brand-600:  #00b84a;   /* hover */
  --mp-brand-700:  #0a7d3a;   /* green text/links on white ~4.6:1 */
  --mp-brand-tint: #e7f8ee;   /* light wash */
  --mp-on-brand:   #06280f;   /* ink text on brand fills ~8:1 */

  /* Elevation — soft, layered */
  --mp-shadow-sm:  0 1px 2px rgba(16,24,40,.05);
  --mp-shadow:     0 2px 4px rgba(16,24,40,.04), 0 10px 24px rgba(16,24,40,.07);
  --mp-shadow-brand: 0 8px 22px rgba(0,176,80,.30);

  /* Radius */
  --mp-r-sm: 10px;
  --mp-r:    12px;
  --mp-r-lg: 16px;

  /* Motion — ease-out quint (emil/impeccable) */
  --mp-ease: cubic-bezier(.22, 1, .36, 1);
  --mp-dur:  170ms;

  /* Legacy token remap (existing CSS reads these) */
  --avito-primary:      #0a7d3a;
  --avito-success:      #00c853;
  --avito-text-primary: #16181d;
  --avito-border:       #ecedf0;
  --avito-bg-gray:      #f6f7f9;
}

/* ---------- Typography: one family, many weights (CONTENT ONLY, header untouched) ---------- */
body,
.home-widget-sections, .home-widget-sections input, .home-widget-sections button,
.container-item-grid, .home-categories {
  font-family: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
.home-widget-sections { color: var(--mp-body); }
/* NOTE: do NOT force font-family on .header-wow * — it breaks the tabler icon
   font (ti-search / ti-category show as tofu boxes). Header keeps its own fonts. */

/* Bigger logo (user request) */
.h-logo svg { height: 50px !important; width: auto !important; }
h1, h2, h3, .bold-title-and-link, .widget-title {
  color: var(--mp-ink) !important;
  letter-spacing: -0.02em;
  text-wrap: balance;
}
h1, h2 { font-weight: 800 !important; }
h3, .bold-title-and-link { font-weight: 700 !important; }

/* ---------- Header / search / header-buttons: kept as original theme.
   Only fix: force "Каталог" back to the light-gray look (user prefers photo 1) ---------- */
.header-button-menu-catalog.button-color-scheme1,
.header-button-menu-catalog {
  background: #2563eb !important;
  color: #ffffff !important;
  border: 0 !important;
  box-shadow: none !important;
  transition: background .18s ease !important;
}
.header-button-menu-catalog i { color: #ffffff !important; }
.header-button-menu-catalog:hover,
.header-button-menu-catalog.button-color-scheme1:hover { background: #1d4ed8 !important; }

/* ---------- Category tiles ---------- */
.home-categories { gap: 16px !important; }
.home-categories a.home-widget-categories-item {
  background: var(--mp-surface) !important;
  border: 1px solid transparent !important;
  border-radius: var(--mp-r-lg) !important;
  transition: transform var(--mp-dur) var(--mp-ease),
              box-shadow var(--mp-dur) var(--mp-ease),
              background var(--mp-dur) var(--mp-ease),
              border-color var(--mp-dur) var(--mp-ease) !important;
}
.home-categories a.home-widget-categories-item:hover {
  background: var(--mp-bg) !important;
  border-color: var(--mp-line) !important;
  box-shadow: var(--mp-shadow) !important;
  transform: translateY(-3px);
}
.home-categories a.home-widget-categories-item div {
  color: var(--mp-ink) !important;
  font-weight: 700 !important;
  letter-spacing: -0.01em;
}
.home-categories a.home-widget-categories-item img {
  transition: transform var(--mp-dur) var(--mp-ease) !important;
}
.home-categories a.home-widget-categories-item:hover img { transform: scale(1.06); }

/* ---------- Listing cards ----------
   NOTE: no transform/scale on card or img — the theme has a native hover
   image-carousel (avito-ux) that uses absolutely-positioned thumbnails;
   any transform on the card creates a containing block and throws the
   preview into the corner. Keep it to border + soft shadow only. */
.container-item-grid {
  border: 1px solid var(--mp-line) !important;
  border-radius: var(--mp-r-lg) !important;
  background: var(--mp-bg) !important;
  transition: box-shadow var(--mp-dur) var(--mp-ease),
              border-color var(--mp-dur) var(--mp-ease) !important;
}
.container-item-grid:hover {
  box-shadow: var(--mp-shadow) !important;
  border-color: var(--mp-line) !important;
}

.container-item-grid-content { padding: 12px !important; gap: 6px !important; }
.container-item-grid-content-prices,
.container-item-grid-content-price {
  color: var(--mp-ink) !important;
  font-weight: 800 !important;
  font-size: 17px !important;
  letter-spacing: -0.02em;
}
.container-item-grid-content-title {
  color: var(--mp-body) !important;
  font-weight: 500 !important;
}
.container-item-grid-content-additionally,
.container-item-grid-content-user { color: var(--mp-muted) !important; font-size: 12.5px !important; }

/* ---------- Links & accents ---------- */
a.link, .bold-title-and-link a, .text-link { color: var(--mp-brand-700) !important; }
.badge-vip, .label-vip { background: var(--mp-brand) !important; color: var(--mp-on-brand) !important; }

/* ---------- Focus visibility (a11y) ---------- */
a:focus-visible, button:focus-visible, input:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--mp-brand) !important;
  outline-offset: 2px;
  border-radius: 6px;
}

/* ---------- Section rhythm ---------- */
.home-widget-sections > section { margin-bottom: 40px; }
.bold-title-and-link { margin-bottom: 16px !important; }

/* ============================================================
   HERO (redesign-2026) — functional marketplace hero
   ============================================================ */
.mp-hero {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(120% 140% at 50% -20%, var(--mp-brand-tint) 0%, rgba(231,248,238,0) 55%),
    linear-gradient(180deg, #ffffff 0%, var(--mp-surface) 100%);
  border-bottom: 1px solid var(--mp-line);
  padding: clamp(40px, 7vw, 84px) 0 clamp(32px, 5vw, 56px);
}
.mp-hero__glow {
  position: absolute; inset: -40% 0 auto 0; height: 420px;
  background: radial-gradient(50% 60% at 50% 0%, rgba(0,200,83,.16) 0%, rgba(0,200,83,0) 70%);
  pointer-events: none;
}
.mp-hero__inner {
  position: relative; max-width: 780px; margin: 0 auto; text-align: center;
}
.mp-hero__title {
  font-family: 'Manrope', sans-serif !important;
  font-weight: 800 !important;
  font-size: clamp(2rem, 1.2rem + 3.4vw, 3.4rem) !important;
  line-height: 1.06 !important;
  letter-spacing: -0.035em;
  color: var(--mp-ink) !important;
  margin: 0 0 14px;
  text-wrap: balance;
  animation: mpFadeUp .6s var(--mp-ease) both;
}
.mp-hero__sub {
  font-size: clamp(1rem, .95rem + .3vw, 1.15rem) !important;
  line-height: 1.55; color: var(--mp-muted) !important;
  max-width: 58ch; margin: 0 auto 28px; text-wrap: pretty;
  animation: mpFadeUp .6s var(--mp-ease) .06s both;
}
.mp-hero__search {
  display: flex; align-items: center; gap: 8px;
  background: var(--mp-bg);
  border: 1.5px solid var(--mp-line-2);
  border-radius: 999px;
  padding: 7px 7px 7px 18px;
  max-width: 660px; margin: 0 auto;
  box-shadow: var(--mp-shadow);
  transition: border-color var(--mp-dur) var(--mp-ease), box-shadow var(--mp-dur) var(--mp-ease);
  animation: mpFadeUp .6s var(--mp-ease) .12s both;
}
.mp-hero__search:focus-within {
  border-color: var(--mp-brand);
  box-shadow: 0 0 0 4px var(--mp-brand-tint), var(--mp-shadow);
}
.mp-hero__search-icon { display: flex; color: var(--mp-muted); flex: none; }
.mp-hero__search input {
  flex: 1; min-width: 0; border: 0 !important; outline: 0 !important; background: transparent !important;
  font-size: 16px !important; color: var(--mp-ink) !important; height: 46px;
  font-family: 'Manrope', sans-serif !important;
}
.mp-hero__search input::placeholder { color: var(--mp-muted) !important; }
.mp-hero__search button {
  flex: none; border: 0; cursor: pointer;
  background: var(--mp-brand); color: var(--mp-on-brand);
  font-family: 'Manrope', sans-serif; font-weight: 800; font-size: 15px;
  padding: 0 26px; height: 46px; border-radius: 999px;
  box-shadow: var(--mp-shadow-brand);
  transition: background var(--mp-dur) var(--mp-ease), transform var(--mp-dur) var(--mp-ease);
}
.mp-hero__search button:hover { background: var(--mp-brand-600); }
.mp-hero__search button:active { transform: scale(.96); }
.mp-hero__chips {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
  gap: 8px; margin-top: 20px;
  animation: mpFadeUp .6s var(--mp-ease) .18s both;
}
.mp-hero__chips-label { color: var(--mp-muted); font-size: 14px; font-weight: 600; margin-right: 2px; }
.mp-hero__chips a {
  text-decoration: none;
  background: var(--mp-bg); border: 1px solid var(--mp-line-2);
  color: var(--mp-body); font-size: 14px; font-weight: 600;
  padding: 8px 15px; border-radius: 999px;
  transition: background var(--mp-dur) var(--mp-ease), border-color var(--mp-dur) var(--mp-ease),
              color var(--mp-dur) var(--mp-ease), transform var(--mp-dur) var(--mp-ease);
}
.mp-hero__chips a:hover {
  background: var(--mp-brand-tint); border-color: transparent;
  color: var(--mp-brand-700); transform: translateY(-1px);
}
@media (max-width: 560px) {
  .mp-hero__title br { display: none; }
  .mp-hero__search { border-radius: 16px; }
  .mp-hero__search button { padding: 0 18px; }
}

@keyframes mpFadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* Section titles — a touch more presence */
.bold-title-and-link > span { font-size: clamp(1.15rem, 1rem + .5vw, 1.4rem) !important; }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
  .container-item-grid:hover,
  .home-categories a.home-widget-categories-item:hover,
  .header-wow-sticky-add:hover { transform: none !important; }
}
