/**
 * Краски — Design System v0.2
 * Палитра: логотип russcvet.ru (синий / красный / белый)
 * UX-референс: coffee-tech.com/catalog
 */

:root {
  /* Бренд — логотип «Русский цвет» / «Краски» */
  --color-brand-blue: #2b4593;
  --color-brand-blue-dark: #1e3268;
  --color-brand-blue-hover: #243a7a;
  --color-brand-blue-muted: rgba(43, 69, 147, 0.1);
  --color-brand-red: #e84e2d;
  --color-brand-red-hover: #cf3f21;
  --color-brand-red-muted: rgba(232, 78, 45, 0.12);
  --color-brand-yellow: #fbae17;
  --color-brand-yellow-muted: rgba(251, 174, 23, 0.18);

  /* Фоны */
  --color-bg-dark: var(--color-brand-blue-dark);
  --color-bg-elevated: #243a7a;
  --color-bg-light: #f5f7fb;
  --color-bg-white: #ffffff;
  --color-surface: #ffffff;

  /* Текст */
  --color-text: #1d1d1b;
  --color-text-muted: #707070;
  --color-text-soft: #9a9a9a;
  --color-text-inverse: #ffffff;

  /* Семантика */
  --color-accent: var(--color-brand-red);
  --color-accent-hover: var(--color-brand-red-hover);
  --color-accent-muted: var(--color-brand-red-muted);
  --color-brand: var(--color-brand-blue);
  --color-brand-hover: var(--color-brand-blue-hover);

  --color-border: #e4e8f0;
  --color-border-dark: #c5cee0;

  --color-success: #2d7a4a;
  --color-error: #d63b3b;

  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;

  --text-display: clamp(2.5rem, 6vw, 4.5rem);
  --text-h1: clamp(2rem, 4vw, 3rem);
  --text-h2: clamp(1.5rem, 3vw, 2rem);
  --text-h3: clamp(1.125rem, 2vw, 1.375rem);
  --text-lead: clamp(1.0625rem, 2vw, 1.25rem);
  --text-body: 1rem;
  --text-sm: 0.875rem;
  --text-xs: 0.75rem;

  --container-max: 1440px;
  --gutter: 1.25rem;
  --gutter-md: 2rem;
  --gutter-lg: 4rem;

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;
  --space-section: clamp(4rem, 10vw, 7.5rem);
  --space-section-head-gap: clamp(2.5rem, 5vh, 4rem);
  --space-section-title-gap: clamp(1.25rem, 3vw, 2rem);
  --space-section-hero-tail: clamp(1rem, 2.5vh, 1.5rem);
  --space-section-filters-gap: clamp(2rem, 4vh, 3rem);
  --space-section-content-gap: clamp(2.5rem, 5vh, 3.5rem);

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-pill: 999px;

  --shadow-card: 0 2px 16px rgba(43, 69, 147, 0.07);
  --shadow-card-hover: 0 12px 40px rgba(43, 69, 147, 0.14);
  --shadow-header: 0 1px 0 var(--color-border);

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --duration-fast: 0.2s;
  --duration-base: 0.35s;
  --duration-slow: 0.6s;
}

@media (min-width: 640px) {
  :root { --gutter: var(--gutter-md); }
}

@media (max-width: 767px) {
  :root {
    --text-h1: clamp(1.75rem, 7vw, 2.25rem);
    --text-h2: clamp(1.375rem, 5.5vw, 1.75rem);
    --text-h3: clamp(1.0625rem, 4vw, 1.25rem);
    --text-lead: 1rem;
  }
}

@media (min-width: 1280px) {
  :root { --gutter: var(--gutter-lg); }
}

*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--text-body);
  line-height: 1.55;
  color: var(--color-text);
  background: var(--color-bg-white);
  -webkit-font-smoothing: antialiased;
}

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

.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* ——— Typography ——— */
.display {
  margin: 0;
  font-size: var(--text-display);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.02em;
}

.h1 {
  margin: 0;
  font-size: var(--text-h1);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.h2 {
  margin: 0;
  font-size: var(--text-h2);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.015em;
}

.h3 {
  margin: 0;
  font-size: var(--text-h3);
  font-weight: 600;
  line-height: 1.25;
}

.lead {
  margin: 0;
  font-size: var(--text-lead);
  font-weight: 500;
  line-height: 1.45;
  color: var(--color-text-muted);
}

.body-text {
  margin: 0;
  font-size: var(--text-body);
  line-height: 1.55;
  color: var(--color-text-muted);
}

.label {
  font-size: var(--text-xs);
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-soft);
}

.kicker {
  display: inline-block;
  margin-bottom: var(--space-3);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-brand);
}

/* ——— Buttons ——— */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 48px;
  padding: 0 var(--space-6);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-size: var(--text-body);
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition:
    background var(--duration-fast),
    color var(--duration-fast),
    border-color var(--duration-fast),
    transform var(--duration-fast);
}

.btn:focus-visible {
  outline: 2px solid var(--color-brand);
  outline-offset: 2px;
}

.btn--primary {
  background: var(--color-brand-red);
  color: #fff;
}

.btn--primary:hover {
  background: var(--color-brand-red-hover);
}

.btn--blue {
  background: var(--color-brand-blue);
  color: #fff;
}

.btn--blue:hover {
  background: var(--color-brand-blue-hover);
}

.btn--secondary {
  background: transparent;
  border-color: var(--color-border);
  color: var(--color-text);
}

.btn--secondary:hover {
  border-color: var(--color-brand-blue);
  color: var(--color-brand-blue);
}

.btn--ghost {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--color-text-inverse);
}

.btn--ghost:hover {
  background: rgba(255, 255, 255, 0.14);
}

.btn--sm {
  min-height: 40px;
  padding: 0 var(--space-4);
  font-size: var(--text-sm);
}

/* ——— Chips ——— */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.chip {
  padding: var(--space-2) var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  background: var(--color-surface);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-muted);
  cursor: pointer;
  transition:
    background var(--duration-fast),
    border-color var(--duration-fast),
    color var(--duration-fast);
}

.chip:hover {
  border-color: var(--color-text-soft);
  color: var(--color-text);
}

.chip.is-active {
  border-color: var(--color-brand-blue);
  background: var(--color-brand-blue-muted);
  color: var(--color-brand-blue);
}

/* ——— Product card ——— */
.product-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  overflow: hidden;
  transition:
    transform var(--duration-base) var(--ease-out),
    box-shadow var(--duration-base) var(--ease-out);
}

.product-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-card-hover);
}

.product-card__media {
  position: relative;
  aspect-ratio: 4 / 3;
  background: #eef1f7;
  overflow: hidden;
}

.product-preview {
  position: absolute;
  inset: 0;
  --swatch-color: #f0ece4;
  background: #eef1f7;
}

.product-preview__base {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.product-preview__swatch-dot {
  position: absolute;
  z-index: 1;
  left: 50%;
  top: 52%;
  width: 29%;
  aspect-ratio: 1;
  border: none;
  border-radius: 50%;
  background-color: var(--swatch-color);
  transform: translate(-50%, -50%);
  box-shadow: none;
  filter: none;
  pointer-events: none;
}

.product-preview__base,
.product-card__media .product-preview__base,
.product-modal__media .product-preview__base,
.product-card__media img,
.product-modal__media img {
  object-fit: cover;
  object-position: center;
}

.product-card__media img {
  display: block;
  width: 100%;
  height: 100%;
}

.product-card__body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5) var(--space-5);
}

.product-card__title {
  margin: 0;
  font-size: var(--text-body);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.product-card__meta {
  margin: 0;
  font-size: var(--text-xs);
  line-height: 1.4;
  color: var(--color-text-muted);
}

.product-card__prices {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-2);
  margin-top: auto;
  padding-top: var(--space-2);
  border-top: 1px solid var(--color-border);
}

.product-card__price {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.product-card__price-label {
  line-height: 1.2;
}

.product-card__price strong {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--color-text);
  line-height: 1.2;
}

.product-card__min {
  margin: 0;
  font-size: var(--text-xs);
  color: var(--color-text-soft);
}

.product-card__volume {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.product-card__volume-label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-muted);
}

.qty-stepper {
  display: flex;
  align-items: stretch;
  width: 100%;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--color-surface);
}

.qty-stepper--card {
  width: 100%;
}

.qty-stepper__btn {
  flex-shrink: 0;
  width: 2.5rem;
  min-height: 2.5rem;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 0;
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 1.125rem;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  transition:
    background var(--duration-fast),
    color var(--duration-fast);
}

.qty-stepper__btn:first-child {
  border-right: 1px solid var(--color-border);
}

.qty-stepper__btn:last-child {
  border-left: 1px solid var(--color-border);
}

.qty-stepper__btn:hover {
  background: var(--color-brand-blue-muted);
  color: var(--color-brand-blue);
}

.qty-stepper__btn:focus-visible {
  outline: 2px solid var(--color-brand-blue);
  outline-offset: -2px;
  z-index: 1;
}

.qty-stepper__input {
  flex: 1;
  width: 100%;
  min-width: 0;
  height: auto;
  min-height: 2.5rem;
  padding: 0 0.25rem;
  border: none;
  border-radius: 0;
  background: transparent;
  font-size: var(--text-sm);
  font-weight: 600;
  text-align: center;
  color: var(--color-text);
  -moz-appearance: textfield;
}

.qty-stepper__input::-webkit-outer-spin-button,
.qty-stepper__input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.qty-stepper__input:focus {
  outline: none;
  background: var(--color-brand-blue-muted);
  box-shadow: inset 0 0 0 2px var(--color-brand-blue);
}

.qty-stepper__unit {
  display: none;
}

.product-card__actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-2);
}

.product-card__actions .btn--sm {
  min-height: 36px;
  padding-inline: var(--space-3);
  font-size: var(--text-xs);
}

/* ——— Color swatches ——— */
.color-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.color-swatch {
  width: 22px;
  height: 22px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 50%;
  cursor: pointer;
  transition: box-shadow var(--duration-fast), transform var(--duration-fast);
}

.color-swatch:hover { transform: scale(1.08); }

.color-swatch.is-active {
  box-shadow: 0 0 0 2px var(--color-surface), 0 0 0 4px var(--color-brand-blue);
}

/* ——— Advantage card ——— */
.advantage-card {
  padding: var(--space-8);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
}

.advantage-card__icon {
  display: flex;
  width: 48px;
  height: 48px;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-5);
  border-radius: var(--radius-md);
  background: var(--color-brand-blue-muted);
  color: var(--color-brand-blue);
}

/* ——— Process step ——— */
.process-step {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.process-step__num {
  display: flex;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--color-brand-blue);
  font-size: var(--text-sm);
  font-weight: 700;
  color: #fff;
}

/* ——— Form ——— */
.form-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.form-field label {
  font-size: var(--text-sm);
  font-weight: 500;
}

.form-field input,
.form-field textarea {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
  transition: border-color var(--duration-fast);
}

.form-field input:focus,
.form-field textarea:focus {
  outline: none;
  border-color: var(--color-brand-blue);
}

.form-success {
  padding: var(--space-4);
  border-radius: var(--radius-md);
  background: rgba(61, 122, 82, 0.1);
  color: var(--color-success);
  font-weight: 500;
}

/* ——— Reveal animation ——— */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition:
    opacity var(--duration-slow) var(--ease-out),
    transform var(--duration-slow) var(--ease-out);
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 767px) {
  .product-card:hover {
    transform: none;
    box-shadow: var(--shadow-card);
  }

  .catalog-section .product-card:hover {
    transform: none;
    box-shadow: var(--shadow-card);
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
  .product-card:hover { transform: none; }
}

/* ——— Lang switch ——— */
.lang-switch {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  background: var(--color-bg-light);
}

.lang-switch button {
  padding: var(--space-1) var(--space-3);
  border: none;
  border-radius: var(--radius-pill);
  background: transparent;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-muted);
  cursor: pointer;
}

.lang-switch button.is-active {
  background: var(--color-brand-red);
  color: #fff;
}

/* ——— Cart badge ——— */
.cart-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-brand-blue);
  cursor: pointer;
}

.cart-btn__count {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: var(--radius-pill);
  background: var(--color-brand-red);
  font-size: 10px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  color: #fff;
}
