/* ===== TOKENS =====
   The catalogue is industrial: hundreds of near-identical parts a buyer scans
   by number. So the design stays quiet — one accent, tabular figures, thin
   lines — and spends its contrast on the things that differ between rows. */
:root {
  /* Ink and surfaces */
  --ink: #14161a;
  --ink-soft: #454b54;
  --ink-muted: #6b7280;
  --surface: #ffffff;
  --surface-sunken: #f6f7f8;
  --surface-raised: #ffffff;
  --line: #e4e6e9;
  --line-strong: #cdd1d6;

  /* One accent, plus the two signals a catalogue needs */
  --accent: #0d5ef4;
  --accent-ink: #0a49bf;
  --accent-wash: rgba(13, 94, 244, 0.08);
  --in-stock: #11a75c;
  --on-order: #96601a;
  --danger: #d92d20;

  /* Legacy names kept so the admin panel keeps rendering */
  --color-primary: var(--ink);
  --color-secondary: var(--surface);
  --color-accent: var(--accent);
  --color-gray: var(--surface-sunken);
  --color-gray-dark: var(--ink-muted);
  --color-gray-light: var(--line);
  --color-border: var(--line);
  --color-danger: var(--danger);
  --color-success: var(--in-stock);

  --space-3xs: 2px;
  --space-2xs: 4px;
  --space-xs: 8px;
  --space-sm: 12px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --space-3xl: 72px;

  --spacing-xs: var(--space-2xs);
  --spacing-sm: var(--space-xs);
  --spacing-md: var(--space-md);
  --spacing-lg: var(--space-lg);
  --spacing-xl: var(--space-xl);
  --spacing-2xl: var(--space-2xl);

  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  /* Article numbers and prices line up only in a monospaced face */
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --font-family: var(--font-sans);

  --text-2xs: 11px;
  --text-xs: 12px;
  --text-sm: 13px;
  --text-base: 15px;
  --text-md: 17px;
  --text-lg: 20px;
  --text-xl: 26px;
  --text-2xl: clamp(28px, 3.4vw, 40px);

  --font-size-xs: var(--text-xs);
  --font-size-sm: var(--text-sm);
  --font-size-md: var(--text-base);
  --font-size-lg: var(--text-lg);
  --font-size-xl: var(--text-xl);
  --font-size-2xl: var(--text-2xl);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-pill: 999px;

  --shadow-sm: 0 1px 2px rgba(20, 22, 26, 0.05);
  --shadow-md: 0 6px 16px -6px rgba(20, 22, 26, 0.16), 0 2px 5px rgba(20, 22, 26, 0.05);
  --shadow-lg: 0 18px 40px -16px rgba(20, 22, 26, 0.26);
  --shadow: var(--shadow-sm);

  /* The built-in curves are too weak to read as intentional */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --press: 120ms;
  --quick: 160ms;
  --settle: 220ms;
  /* Long enough that a section unfolding reads as one movement */
  --unfold: 340ms;

  --transition: color var(--quick) ease, background-color var(--quick) ease,
    border-color var(--quick) ease;

  --page: 1280px;
  --gutter: var(--space-lg);
}

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

html {
  /* No font inflation in landscape, and no grey flash over whatever is tapped —
     the press feedback below replaces it */
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.55;
  color: var(--ink);
  background: var(--surface);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img {
  max-width: 100%;
  display: block;
}

/* An author rule that sets display beats the browser's own [hidden] rule,
   so anything hidden by the attribute would stay on screen. Every place
   that toggles `hidden` in JavaScript depends on this line. */
[hidden] {
  display: none !important;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--quick) ease;
}

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

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

/* ===== TOUCH BASELINE =====
   A phone is not a narrow desktop: it has no hover, a double-tap gesture the
   browser waits for, a long-press that selects text, and a keyboard that
   zooms the page into small inputs. Each line below removes one of those. */

/* Never waits to see whether a second tap is coming, so the tap fires at once */
button,
a,
[role="button"],
label,
summary,
.card,
.nav-item,
.filter-option {
  touch-action: manipulation;
}

/* A control's label is not text to copy — a long press must not select it.
   Never on body copy: article numbers and errors are there to be copied. */
button,
[role="button"],
.nav-item,
.pagination button,
.eyebrow {
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

/* One visible ring for keyboard users, never for the mouse */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}

::selection {
  background: var(--accent-wash);
}

/* ===== TYPOGRAPHY ===== */
h1,
h2,
h3,
h4 {
  line-height: 1.2;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

h1 {
  font-size: var(--text-2xl);
  font-weight: 760;
  letter-spacing: -0.03em;
}

h2 {
  font-size: var(--text-xl);
  font-weight: 700;
  letter-spacing: -0.02em;
}

h3 {
  font-size: var(--text-lg);
  font-weight: 680;
}

h4 {
  font-size: var(--text-md);
  font-weight: 650;
}

/* Small uppercase labels: the only place capitals earn their keep */
.eyebrow {
  font-size: var(--text-2xs);
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.text-muted {
  color: var(--ink-muted);
  font-size: var(--text-sm);
}

.text-accent {
  color: var(--accent);
}

.num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

/* ===== LAYOUT ===== */
.container {
  width: 100%;
  max-width: var(--page);
  margin: 0 auto;
  /* The gutter, or the notch in landscape, whichever is larger */
  padding-left: max(var(--gutter), env(safe-area-inset-left));
  padding-right: max(var(--gutter), env(safe-area-inset-right));
}

.flex {
  display: flex;
}

.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.flex-center {
  display: flex;
  justify-content: center;
  align-items: center;
}

.grid {
  display: grid;
  gap: var(--space-md);
}

/* Product grids size themselves to the space instead of a fixed column count */
.grid-2 {
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.grid-3,
.grid-4 {
  grid-template-columns: repeat(auto-fill, minmax(222px, 1fr));
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-md);
  flex-wrap: wrap;
  margin-bottom: var(--space-lg);
}

/* ===== HEADER ===== */
header {
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-top {
  background: var(--ink);
  color: rgba(255, 255, 255, 0.72);
  padding: calc(var(--space-xs) + env(safe-area-inset-top)) 0 var(--space-xs);
  font-size: var(--text-xs);
  letter-spacing: 0.01em;
}

/* Nothing on the strip but the numbers, so they sit at the end of it */
.header-top-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-md);
  flex-wrap: wrap;
}

.header-top a {
  color: #fff;
}

/* The padding belongs to this row, not to the header, or the search box ends up
   flush against the strip above it while empty space sits over that strip */
.header-main {
  padding: var(--space-sm) 0;
  gap: var(--space-lg);
  flex-wrap: wrap;
}

.logo {
  /* The arm takes the top of the mark, so the letters are about half of this */
  --logo-height: 52px;
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  line-height: 1;
  color: var(--ink);
  font-size: clamp(24px, 3vw, 32px);
  font-weight: 800;
  letter-spacing: -0.045em;
  white-space: nowrap;
  flex: none;
}

.logo img {
  height: var(--logo-height);
  width: auto;
  /* Drawn as one mark; nothing is added beside it */
  display: block;
}

.logo span {
  cursor: pointer;
}

/* The mark is black line art, so a dark ground needs it the other way round */
.logo-inverted img {
  filter: brightness(0) invert(1);
}

.header-nav {
  display: flex;
  gap: var(--space-lg);
  font-size: var(--text-sm);
  font-weight: 600;
}

.header-nav > div {
  cursor: pointer;
  padding: var(--space-xs) 0;
  border-bottom: 2px solid transparent;
  transition: border-color var(--quick) ease, color var(--quick) ease;
}

/* ===== SEARCH ===== */
.search-bar {
  --search-button-width: 92px;
  flex: 1;
  min-width: 220px;
  max-width: 520px;
  position: relative;
  display: flex;
  align-items: stretch;
  height: 42px;
  border-radius: var(--radius-sm);
  transition: box-shadow var(--quick) ease;
}

.search-bar input {
  flex: 1;
  min-width: 0;
  /* Right padding clears the clear button, left padding clears the icon */
  padding: 0 34px 0 38px;
  border: 1px solid var(--line-strong);
  border-right: 0;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  background: var(--surface)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 18 18' fill='none' stroke='%236b7280' stroke-width='1.7' stroke-linecap='round'%3E%3Ccircle cx='8' cy='8' r='5'/%3E%3Cpath d='M11.8 11.8 15.5 15.5'/%3E%3C/svg%3E")
    no-repeat 12px center;
  font-size: var(--text-sm);
  outline: none;
  transition: border-color var(--quick) ease;
}

.search-bar input::placeholder {
  color: var(--ink-muted);
}

.search-bar:focus-within input {
  border-color: var(--accent);
}

.search-bar:focus-within {
  box-shadow: 0 0 0 3px var(--accent-wash);
}

.search-clear {
  position: absolute;
  right: calc(var(--search-button-width) + 6px);
  top: 50%;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  color: var(--ink-muted);
  font-size: 16px;
  line-height: 1;
  display: none;
  transition: background-color var(--quick) ease, color var(--quick) ease;
}

.search-bar.has-text .search-clear {
  display: block;
}

.search-submit {
  flex: 0 0 var(--search-button-width);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--ink);
  color: #fff;
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.06em;
  transition: background-color var(--quick) ease, transform var(--press) var(--ease-out);
}

.search-submit:active {
  transform: scale(0.97);
}

/* ===== BUTTONS ===== */
.btn {
  padding: 9px var(--space-md);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  font-weight: 620;
  font-size: var(--text-sm);
  color: var(--ink);
  background: var(--surface);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  white-space: nowrap;
  transition: background-color var(--quick) ease, border-color var(--quick) ease,
    color var(--quick) ease, transform var(--press) var(--ease-out);
}

/* Every pressable thing answers the press */
.btn:active {
  transform: scale(0.97);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

.btn-accent {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.btn-secondary {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line-strong);
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--ink-soft);
}

.btn-sm {
  padding: 5px var(--space-xs);
  font-size: var(--text-xs);
}

.btn-lg {
  padding: 13px var(--space-lg);
  font-size: var(--text-base);
}

/* ===== PRODUCT CARD =====
   The whole card is the link. A separate button inside it only repeats what a
   click anywhere already does, and it put a black slab under every photo. */
.card {
  display: flex;
  flex-direction: column;
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
  color: inherit;
  transition: border-color var(--settle) ease, box-shadow var(--settle) var(--ease-out),
    transform var(--settle) var(--ease-out);
}

.card:active {
  transform: scale(0.994);
}

.card-image {
  width: 100%;
  aspect-ratio: 4 / 3;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  padding: var(--space-sm);
}

/* Catalogue photos are shot on white — cropping them cuts the part in half */
.card-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  mix-blend-mode: multiply;
  transition: transform var(--settle) var(--ease-out);
}

.card-badge {
  position: absolute;
  top: var(--space-xs);
  left: var(--space-xs);
  background: var(--danger);
  color: #fff;
  padding: 2px var(--space-xs);
  border-radius: var(--radius-pill);
  font-size: var(--text-2xs);
  font-weight: 700;
}

.card-content {
  padding: var(--space-sm) var(--space-md) var(--space-md);
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: var(--space-2xs);
}

.card-sku {
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  color: var(--ink-muted);
  letter-spacing: 0.02em;
}

.card-title {
  font-size: var(--text-sm);
  font-weight: 620;
  line-height: 1.35;
  letter-spacing: -0.005em;
  min-height: 2.7em;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* The parameters that actually tell two near-identical parts apart */
.card-specs {
  font-size: var(--text-xs);
  color: var(--ink-muted);
  line-height: 1.4;
  min-height: 2.8em;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.card-foot {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-xs);
  margin-top: auto;
  padding-top: var(--space-xs);
}

.card-price {
  display: flex;
  align-items: baseline;
  gap: var(--space-xs);
}

.card-price-current {
  font-variant-numeric: tabular-nums;
  font-size: var(--text-md);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.card-price-old {
  font-variant-numeric: tabular-nums;
  font-size: var(--text-xs);
  color: var(--ink-muted);
  text-decoration: line-through;
}

/* ===== STOCK ===== */
.stock {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: var(--text-xs);
  font-weight: 600;
  white-space: nowrap;
}

.stock::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.stock.in-stock {
  color: var(--in-stock);
}

/* Nothing is broken about a part that is ordered in — it must not read as an error */
.stock.out-of-stock {
  color: var(--on-order);
}

.card-stock {
  font-size: var(--text-xs);
}

/* ===== HERO ===== */
.hero {
  background:
    radial-gradient(90% 120% at 12% 0%, rgba(13, 94, 244, 0.07), transparent 60%),
    var(--surface-sunken);
  border-bottom: 1px solid var(--line);
  padding: var(--space-2xl) 0;
}

.hero-content {
  max-width: 640px;
}

.hero h1 {
  margin-bottom: var(--space-sm);
}

.hero p {
  font-size: var(--text-md);
  color: var(--ink-soft);
  margin-bottom: var(--space-lg);
  max-width: 54ch;
}

.hero-actions {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

/* Real numbers from the catalogue say more than a slogan does */
.hero-stats {
  display: flex;
  gap: var(--space-xl);
  margin-top: var(--space-xl);
  flex-wrap: wrap;
}

.hero-stat-value {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: var(--text-xl);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.hero-stat-label {
  font-size: var(--text-xs);
  color: var(--ink-muted);
}

/* ===== CATEGORY SECTIONS ===== */
.category-section {
  margin-bottom: var(--space-2xl);
}

/* Eight per category, so the home page wants a column count that divides it:
   a wider minimum lands on four columns where the catalogue lands on five,
   and the row below it fills instead of trailing off half-empty */
.category-section .grid {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
}

.category-section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-md);
  flex-wrap: wrap;
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-xs);
  border-bottom: 1px solid var(--line);
}

.category-section-link {
  font-size: var(--text-sm);
  font-weight: 620;
  white-space: nowrap;
}

/* ===== SECTIONS AND TILES =====
   A section is a bar that folds. It stands open, showing what is under it as
   names and photographs, so the first screen of the catalogue is a list of
   places to go rather than a wall of three hundred parts. */
.section-block {
  margin-bottom: var(--space-sm);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--settle) var(--ease-out);
}

/* ===== SLIDER =====
   News, an offer, a new product. It stands where the opening block was, so
   it gets that block's room — a little less of it, since a picture reads
   faster than a paragraph. */
.slider-wrap {
  padding-top: var(--space-lg);
}

.slider {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: var(--surface-sunken);
  box-shadow: var(--shadow-sm);
}

/* The slides sit in one row and the track is as tall as the tallest of
   them, so switching slides never makes the page jump */
.slides {
  display: flex;
  align-items: center;
  transition: transform 520ms var(--ease-out);
}

.slide {
  position: relative;
  flex: 0 0 100%;
  display: block;
  color: inherit;
  text-decoration: none;
}

/* The picture keeps its own proportions and the band takes the height that
   follows. A fixed band cropped whatever did not fit it: a wide, short
   banner — the usual shape for one — lost its top and bottom to a strip
   340 pixels tall. The cap is only there so a portrait image cannot take
   over the screen. */
.slide img {
  width: 100%;
  height: auto;
  max-height: 60vh;
  object-fit: contain;
  display: block;
}

/* Only drawn when there is something to write; a lettered banner carries
   its own words and gets no second layer over them */
.slide-caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: var(--space-xl) var(--space-lg) var(--space-md);
  background: linear-gradient(transparent, rgba(12, 14, 17, 0.82));
  color: #fff;
}

.slide-title {
  font-size: var(--text-lg);
  font-weight: 700;
  letter-spacing: -0.015em;
}

.slide-subtitle {
  font-size: var(--text-sm);
  color: rgba(255, 255, 255, 0.82);
}

.slider-arrow {
  position: absolute;
  top: 50%;
  width: 38px;
  height: 38px;
  margin-top: -19px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow-md);
  transition: background-color var(--quick) ease, transform var(--press) var(--ease-out);
}

.slider-arrow::before {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 9px;
  height: 9px;
  border-right: 2px solid var(--ink);
  border-bottom: 2px solid var(--ink);
}

.slider-prev {
  left: var(--space-sm);
}

.slider-prev::before {
  transform: translateX(2px) rotate(135deg);
}

.slider-next {
  right: var(--space-sm);
}

.slider-next::before {
  transform: translateX(-2px) rotate(-45deg);
}

.slider-arrow:active {
  transform: scale(0.94);
}

.slider-dots {
  position: absolute;
  left: 0;
  right: 0;
  bottom: var(--space-sm);
  display: flex;
  justify-content: center;
  gap: 6px;
}

.slider-dot {
  width: 8px;
  height: 8px;
  padding: 0;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.5);
  box-shadow: 0 0 0 1px rgba(12, 14, 17, 0.2);
  transition: width var(--settle) var(--ease-out), background-color var(--quick) ease;
}

.slider-dot.active {
  width: 22px;
  background: #fff;
}

/* One slide is a picture, not a carousel */
.slider-single .slider-arrow,
.slider-single .slider-dots {
  display: none;
}

/* ===== SECTION MARK =====
   A supplier's logo beside the subcategories of its section, the way a
   catalogue prints a brand at the head of its range. */
/* One row per brand. A hairline between them, so the ranges read as
   separate without needing a heading each. */
.section-row {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
}

.section-row + .section-row {
  margin-top: var(--space-sm);
  padding-top: var(--space-sm);
  border-top: 1px solid var(--line);
}

/* Either a picture or the name — a brand with no logo is set as a wordmark
   rather than left blank, and stands in the same place a logo would */
.section-mark-text {
  font-size: var(--text-md);
  font-weight: 750;
  letter-spacing: 0.04em;
  line-height: 1.2;
  text-transform: uppercase;
  color: var(--ink-soft);
  text-align: center;
  overflow-wrap: anywhere;
}

.section-row .tile-grid {
  flex: 1;
  min-width: 0;
}

/* Level with the first row of tiles, not floating in the middle of however
   many rows the section happens to have */
.section-mark {
  flex: 0 0 auto;
  width: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-sm);
  height: 150px;
}

.section-mark img {
  max-width: 100%;
  max-height: 96px;
  width: auto;
  object-fit: contain;
  mix-blend-mode: multiply;
}

/* The row above the sections: what they are, and the one button that opens
   or shuts all eleven of them at once */
.sections-toolbar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-md);
  flex-wrap: wrap;
  margin-bottom: var(--space-md);
}

.sections-heading {
  font-size: var(--text-lg);
}

/* A section is a bigger thing than a card, so it arrives from further down
   and settles from slightly under size */
.section-block.reveal {
  transform: translateY(22px) scale(0.985);
  transition-duration: 520ms;
}

.section-head-plain {
  display: flex;
  align-items: baseline;
  gap: var(--space-sm);
  padding: 14px var(--space-md);
  background: var(--ink);
  color: #fff;
}

.section-title {
  flex: none;
  margin: 0;
  font-size: var(--text-md);
  font-weight: 650;
  letter-spacing: -0.01em;
}

.section-title a {
  color: inherit;
}

@media (hover: hover) and (pointer: fine) {
  .section-title a:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
  }
}

/* Названия подкатегорий одной строкой: читается на бегу, а когда места
   не хватает — уступает его первым */
.section-hint {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--text-xs);
  font-weight: 500;
  color: rgba(255, 255, 255, 0.55);
}

.section-count {
  flex: none;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.14);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: var(--text-2xs);
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
}

.section-body {
  background: var(--surface-sunken);
}

.section-pad {
  padding: var(--space-md);
}

.section-all {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: var(--space-md);
  font-size: var(--text-sm);
  font-weight: 620;
}

.section-all-arrow {
  transition: transform var(--settle) var(--ease-out);
}

/* Tiles keep their size instead of stretching to fill the row. A brand with
   two subcategories would otherwise show two enormous tiles beside a brand
   showing six small ones, and the rows would not read as one table. */
.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 186px));
  justify-content: start;
  gap: var(--space-sm);
}

.tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-sm);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--ink);
  text-align: center;
  transition:
    opacity 340ms var(--ease-out),
    transform 340ms var(--ease-out),
    border-color var(--quick) ease,
    box-shadow var(--settle) var(--ease-out);
}

/* Inside a folding section the tiles rise in one after another as it opens,
   and go at once when it shuts. The stagger is a delay calculated off --i,
   so it costs nothing to run and nothing to reverse. */
.section-body .tile {
  opacity: 0;
  transform: translateY(12px);
  /* --reveal-delay is set on the block while it is coming into view, so the
     tiles start once their section has arrived rather than under it */
  transition-delay: calc(var(--reveal-delay, 0ms) + var(--i, 0) * 28ms);
}

.section-block.is-revealed .section-body .tile {
  opacity: 1;
  transform: translateY(0);
}

/* The same entrance on the catalogue page, where the tiles are drawn once
   and never folded away */
.tile-enter {
  animation: tile-in 340ms var(--ease-out) both;
  animation-delay: calc(var(--i, 0) * 28ms);
}

@keyframes tile-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ===== BRAND MARKS =====
   Small and out of the way. On a catalogue card the part is what is being
   chosen; the brand only says whose it is. */
.card-brand {
  position: absolute;
  top: var(--space-xs);
  left: var(--space-xs);
  max-width: 56px;
  max-height: 20px;
  width: auto;
  object-fit: contain;
  mix-blend-mode: multiply;
  opacity: 0.85;
  pointer-events: none;
}

/* Clicking a brand shows everything it makes */
.brand-link {
  display: inline-flex;
  align-items: center;
  color: inherit;
  text-decoration: none;
}

.section-mark-link {
  text-decoration: none;
  color: inherit;
  transition: opacity var(--quick) ease;
}

.brand-mark {
  display: inline-block;
  max-width: 72px;
  max-height: 22px;
  width: auto;
  vertical-align: middle;
  margin-right: 6px;
  object-fit: contain;
  mix-blend-mode: multiply;
}

.tile:active {
  transform: scale(0.98);
  transition-delay: 0s;
}

.tile-image {
  width: 100%;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-xs);
  border-radius: var(--radius-sm);
  background: var(--surface-sunken);
  overflow: hidden;
}

.tile-image img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  mix-blend-mode: multiply;
  transition: transform var(--settle) var(--ease-out);
}

/* Takes the slack, so a name that wraps onto two lines does not push its
   own count out of line with the counts beside it */
.tile-name {
  flex: 1;
  font-size: var(--text-sm);
  font-weight: 620;
  line-height: 1.35;
}

.tile-count {
  font-size: var(--text-2xs);
  color: var(--ink-muted);
}

/* ===== CATALOGUE LAYOUT ===== */
.catalog-layout {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  gap: var(--space-xl);
  align-items: start;
}

.catalog-aside {
  position: sticky;
  top: 96px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.catalog-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  flex-wrap: wrap;
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--line);
}

/* Переключатель вида: две кнопки, выбранная залита */
.view-switch {
  display: flex;
  margin-left: auto;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.view-switch-btn {
  padding: 7px 14px;
  border: 0;
  background: var(--surface);
  color: var(--ink-muted);
  font-family: inherit;
  font-size: var(--text-xs);
  font-weight: 650;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background-color var(--quick) ease, color var(--quick) ease;
}

.view-switch-btn + .view-switch-btn {
  border-left: 1px solid var(--line-strong);
}

.view-switch-btn.active {
  background: var(--ink);
  color: #fff;
}

@media (hover: hover) and (pointer: fine) {
  .view-switch-btn:not(.active):hover {
    background: var(--surface-sunken);
    color: var(--ink);
  }
}

/* ---------- список товаров таблицей ---------- */

.ptable {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.ptable th {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line-strong);
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
  text-align: left;
  white-space: nowrap;
}

.ptable td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.ptable tbody tr {
  transition: background-color var(--quick) ease;
}

@media (hover: hover) and (pointer: fine) {
  .ptable tbody tr:hover {
    background: var(--surface-sunken);
  }
}

.ptable-name a {
  font-weight: 620;
  color: var(--ink);
  line-height: 1.4;
}

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

/* Артикул под названием: искать по нему приходят чаще, чем по имени */
.ptable-sku {
  display: block;
  margin-top: 3px;
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  letter-spacing: 0.04em;
  color: var(--ink-muted);
}

.ptable th.ptable-stock,
.ptable th.ptable-price,
td.ptable-stock,
td.ptable-price {
  text-align: right;
  white-space: nowrap;
}

td.ptable-price {
  font-weight: 700;
}

/* Названия у пневматики длинные — в три столбца на телефоне они сжимают
   числа в ничто. Поэтому строка разворачивается: название сверху, остаток
   и цена под ним. Шапка не нужна — «шт.» и «₽» говорят сами за себя. */
@media (max-width: 640px) {
  .ptable thead {
    display: none;
  }

  .ptable,
  .ptable tbody,
  .ptable tr {
    display: block;
  }

  .ptable tr {
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
  }

  .ptable td {
    display: inline-block;
    padding: 0;
    border: 0;
  }

  .ptable-name {
    display: block;
    margin-bottom: 6px;
  }

  td.ptable-stock,
  td.ptable-price {
    text-align: left;
  }

  td.ptable-price {
    margin-left: 14px;
  }
}

/* On a phone the filters fold away instead of squeezing the grid off screen */
.filters-toggle {
  display: none;
  width: 100%;
  justify-content: space-between;
}

/* ===== CATALOGUE BREADCRUMBS =====
   The trail back up the tree. The product page has its own .breadcrumb,
   which is a container rather than a step, so these keep their own names. */
.breadcrumbs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-3xs) var(--space-xs);
  margin-bottom: var(--space-sm);
  font-size: var(--text-xs);
  color: var(--ink-muted);
}

.crumb {
  color: var(--ink-muted);
  text-decoration: none;
}

.crumb-current {
  color: var(--ink-soft);
  font-weight: 600;
}

.crumb-sep {
  color: var(--line-strong);
}

.catalog-lead {
  max-width: 68ch;
  margin-top: calc(var(--space-md) * -1 + 2px);
  margin-bottom: var(--space-lg);
  font-size: var(--text-sm);
  line-height: 1.6;
  /* Описание набирают в админке абзацами — переносы должны дожить до страницы */
  white-space: pre-line;
}

.subcat-heading {
  margin-bottom: var(--space-sm);
  font-size: var(--text-md);
}

#subcategories {
  margin-bottom: var(--space-xl);
}

/* ===== CATALOGUE TREE =====
   Sections fold open in place, so a buyer can walk down to a subcategory
   without losing sight of where the rest of the catalogue is. */
.cat-tree {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.cat-tree-all {
  padding: 6px var(--space-xs);
  margin: 0 calc(var(--space-xs) * -1);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--ink-soft);
  text-decoration: none;
}

.cat-tree-all.active {
  background: var(--ink);
  color: var(--surface);
}

.cat-row {
  display: flex;
  align-items: center;
  gap: var(--space-3xs);
  padding: 4px var(--space-xs) 4px 0;
  margin: 0 calc(var(--space-xs) * -1) 0 0;
  border-radius: var(--radius-sm);
}

.cat-row.active {
  background: var(--accent-wash);
}

.cat-row.active .cat-link {
  color: var(--accent);
  font-weight: 650;
}

/* The chevron is the only thing that folds; the name always navigates */
.cat-toggle {
  flex: none;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  position: relative;
  border-radius: var(--radius-sm);
}

.cat-toggle::before {
  content: '';
  position: absolute;
  inset: 0;
  margin: auto;
  width: 6px;
  height: 6px;
  border-right: 1.5px solid var(--ink-muted);
  border-bottom: 1.5px solid var(--ink-muted);
  transform: translateX(-1px) rotate(-45deg);
  transition: transform var(--quick) ease;
}

.cat-toggle[aria-expanded="true"]::before {
  transform: translateY(-2px) rotate(45deg);
}

.cat-toggle-empty {
  cursor: default;
}

.cat-toggle-empty::before {
  display: none;
}

.cat-link {
  flex: 1;
  min-width: 0;
  font-size: var(--text-sm);
  line-height: 1.35;
  color: var(--ink-soft);
  text-decoration: none;
}

.cat-count {
  flex: none;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: var(--text-2xs);
  color: var(--ink-muted);
}

/* Subcategories sit under a hairline, so the nesting reads at a glance */
.cat-children {
  margin-left: 10px;
  padding-left: var(--space-xs);
  border-left: 1px solid var(--line);
}

/* ===== FILTERS ===== */
.filters {
  background: var(--surface);
  padding: var(--space-md);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.filter-group {
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--line);
}

.filter-group:last-of-type {
  border-bottom: 0;
}

.filter-group h4 {
  margin-bottom: var(--space-xs);
  font-size: var(--text-2xs);
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.filter-options {
  display: flex;
  flex-direction: column;
  gap: var(--space-3xs);
}

.filter-option {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  cursor: pointer;
  padding: 5px var(--space-xs);
  margin: 0 calc(var(--space-xs) * -1);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  transition: background-color var(--quick) ease;
}

.filter-option input {
  cursor: pointer;
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
  flex: none;
}

.filter-option label {
  cursor: pointer;
  flex: 1;
  margin: 0;
  font-weight: 500;
  line-height: 1.35;
}

.filter-count {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: var(--text-2xs);
  color: var(--ink-muted);
}

.filter-select {
  width: 100%;
  padding: 8px var(--space-xs);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: var(--text-sm);
  outline: none;
  transition: border-color var(--quick) ease, box-shadow var(--quick) ease;
}

.filter-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-wash);
}

/* ===== FORMS ===== */
.form-group {
  display: flex;
  flex-direction: column;
  margin-bottom: var(--space-md);
}

.form-group label {
  font-weight: 620;
  margin-bottom: var(--space-2xs);
  font-size: var(--text-sm);
}

.form-group input,
.form-group textarea,
.form-group select {
  padding: 9px var(--space-sm);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  outline: none;
  transition: border-color var(--quick) ease, box-shadow var(--quick) ease;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-wash);
}

/* ===== PAGINATION ===== */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--space-2xs);
  margin: var(--space-2xl) 0;
  flex-wrap: wrap;
}

.pagination button {
  min-width: 38px;
  height: 38px;
  padding: 0 var(--space-sm);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--ink-soft);
  transition: background-color var(--quick) ease, border-color var(--quick) ease,
    color var(--quick) ease, transform var(--press) var(--ease-out);
}

.pagination button:active {
  transform: scale(0.96);
}

.pagination button.active {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

.pagination button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ===== BREADCRUMB ===== */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-md) 0;
  font-size: var(--text-xs);
  color: var(--ink-muted);
}

.breadcrumb a {
  color: var(--ink-muted);
}

.breadcrumb-current {
  color: var(--ink-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 46ch;
}

/* ===== PRODUCT PAGE ===== */
.product-details {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--space-2xl);
  margin-bottom: var(--space-2xl);
  align-items: start;
}

.product-gallery {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  position: sticky;
  top: 96px;
}

.product-main-image {
  width: 100%;
  aspect-ratio: 1;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
}

.product-main-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  mix-blend-mode: multiply;
}

.product-thumbnails {
  display: flex;
  gap: var(--space-xs);
  flex-wrap: wrap;
}

.product-thumbnail {
  width: 72px;
  height: 72px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: pointer;
  padding: 5px;
  transition: border-color var(--quick) ease, transform var(--press) var(--ease-out);
}

.product-thumbnail:active {
  transform: scale(0.96);
}

.product-thumbnail.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-wash);
}

.product-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  mix-blend-mode: multiply;
}

.product-info h1 {
  font-size: var(--text-xl);
  margin-bottom: var(--space-xs);
}

/* The supplier's full name is a paragraph of parameters — it belongs under the
   title as reference text, not as the heading itself */
.product-fullname {
  font-size: var(--text-sm);
  color: var(--ink-muted);
  line-height: 1.5;
  margin-bottom: var(--space-md);
}

.product-meta {
  display: flex;
  gap: var(--space-lg);
  flex-wrap: wrap;
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--line);
}

.product-meta-label {
  font-size: var(--text-2xs);
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 1px;
}

.product-meta-value {
  font-size: var(--text-sm);
  font-weight: 620;
}

.product-meta-value.num {
  font-family: var(--font-mono);
}

/* ===== VARIANTS =====
   The same part in its other sizes. Each one is its own product, so these
   are links; the price rides along, because the size is usually chosen
   against it. */
.variants {
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--line);
}

.variants-label {
  margin-bottom: var(--space-xs);
  font-size: var(--text-2xs);
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.variants-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2xs);
}

.variant {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 7px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: var(--text-sm);
  line-height: 1.25;
  color: var(--ink-soft);
  text-decoration: none;
  transition: border-color var(--quick) ease, background-color var(--quick) ease;
}

.variant-current {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--surface);
}

.variant-name {
  font-weight: 600;
}

.variant-price {
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  color: var(--ink-muted);
}

.variant-current .variant-price {
  color: rgba(255, 255, 255, 0.72);
}

.variants-hint {
  margin-top: var(--space-2xs);
  font-size: var(--text-2xs);
}

.product-buy {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  flex-wrap: wrap;
  margin-bottom: var(--space-md);
}

.product-price {
  display: flex;
  align-items: baseline;
  gap: var(--space-sm);
  font-variant-numeric: tabular-nums;
  font-size: var(--text-2xl);
  font-weight: 700;
  letter-spacing: -0.03em;
}

.product-price-old {
  font-size: var(--text-lg);
  color: var(--ink-muted);
  text-decoration: line-through;
}

.product-actions {
  display: flex;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
}

.product-actions .btn {
  flex: 1;
}

.product-description {
  font-size: var(--text-sm);
  color: var(--ink-soft);
  line-height: 1.6;
  max-width: 62ch;
}

/* ===== SPECIFICATIONS ===== */
.specifications {
  margin-bottom: var(--space-2xl);
}

.specifications h3,
#product-videos-section h3 {
  font-size: var(--text-md);
  margin-bottom: var(--space-sm);
  padding-bottom: var(--space-xs);
  border-bottom: 1px solid var(--line);
}

.spec-table {
  width: 100%;
  max-width: 720px;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.spec-table tr {
  border-bottom: 1px solid var(--line);
}

.spec-table tr:last-child {
  border-bottom: none;
}

.spec-table td {
  padding: 9px var(--space-xs);
  vertical-align: top;
}

/* A tinted label column turns the table into stripes; muted type is enough */
.spec-table td:first-child {
  color: var(--ink-muted);
  width: 42%;
  font-weight: 500;
}

.spec-table td:last-child {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* Значение, у которого 1С не дала названия параметра, занимает всю строку:
   пустая ячейка слева читалась бы как потерянные данные */
.spec-table td.spec-bare {
  width: auto;
  color: var(--ink);
  font-weight: 500;
}

/* ===== VIDEO ===== */
#product-videos-section:not(:empty) {
  margin-bottom: var(--space-2xl);
}

.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--space-md);
}

.video-frame {
  position: relative;
  padding-top: 56.25%;
  background: var(--ink);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.video-frame iframe,
.video-frame video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.video-title {
  margin-top: var(--space-xs);
  font-size: var(--text-sm);
  font-weight: 600;
}

/* ===== FOOTER ===== */
footer {
  background: var(--surface-sunken);
  border-top: 1px solid var(--line);
  padding: var(--space-2xl) 0 calc(var(--space-lg) + env(safe-area-inset-bottom));
  margin-top: var(--space-2xl);
}

.footer-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: var(--space-lg);
  margin-bottom: var(--space-lg);
}

.footer-section .logo {
  --logo-height: 46px;
  margin-bottom: var(--space-xs);
}

.footer-section h4 {
  font-size: var(--text-2xs);
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: var(--space-xs);
}

.footer-section ul {
  list-style: none;
}

.footer-section ul li {
  margin-bottom: var(--space-2xs);
  font-size: var(--text-sm);
  color: var(--ink-soft);
}

.footer-section ul li a {
  color: var(--ink-soft);
}

.footer-bottom {
  padding-top: var(--space-md);
  border-top: 1px solid var(--line);
  color: var(--ink-muted);
  font-size: var(--text-xs);
}

/* ===== STATES ===== */
.loading {
  text-align: center;
  padding: var(--space-2xl);
  color: var(--ink-muted);
  font-size: var(--text-sm);
}

.empty-state {
  text-align: center;
  padding: var(--space-2xl) var(--space-md);
}

.empty-state h2 {
  margin-bottom: var(--space-xs);
}

.empty-state p {
  color: var(--ink-muted);
  margin-bottom: var(--space-md);
}

/* Cards arrive after a request, so they fade in rather than snapping into place */
.grid > .card {
  animation: card-in var(--settle) var(--ease-out) both;
}

@keyframes card-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

/* Skeletons keep the page from jumping while the request is in flight */
.skeleton-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--surface);
}

.skeleton-line,
.skeleton-image {
  background: linear-gradient(90deg, #eef0f2 25%, #f7f8f9 50%, #eef0f2 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s linear infinite;
}

.skeleton-image {
  aspect-ratio: 4 / 3;
}

.skeleton-body {
  padding: var(--space-sm) var(--space-md) var(--space-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.skeleton-line {
  height: 10px;
  border-radius: var(--radius-pill);
}

@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}

/* ===== MOTION (ported from React Bits) ===== */

/* SpotlightCard: a soft light under the cursor, painted behind the text */
.card {
  --mouse-x: 50%;
  --mouse-y: 50%;
}

.card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(240px circle at var(--mouse-x) var(--mouse-y),
    rgba(13, 94, 244, 0.1), transparent 70%);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--settle) ease;
  z-index: 0;
}

.card-image,
.card-content {
  position: relative;
  z-index: 1;
}

/* AnimatedContent: a block rises into place the first time it is scrolled to */
.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 420ms var(--ease-out), transform 420ms var(--ease-out);
}

.reveal.is-revealed {
  opacity: 1;
  transform: none;
}

/* ClickSpark draws on one canvas over everything, and catches nothing */
.spark-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9998;
}

/* ===== STORAGE NOTICE ===== */
.consent {
  position: fixed;
  left: max(var(--space-md), env(safe-area-inset-left));
  right: max(var(--space-md), env(safe-area-inset-right));
  bottom: calc(var(--space-md) + env(safe-area-inset-bottom));
  z-index: 9990;
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  max-width: 900px;
  margin: 0 auto;
  padding: var(--space-md) var(--space-lg);
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  /* Comes up from the edge it sits on rather than out of nothing */
  opacity: 0;
  transform: translateY(12px) scale(0.99);
  transition: opacity var(--settle) var(--ease-out), transform var(--settle) var(--ease-out);
}

.consent.is-shown {
  opacity: 1;
  transform: none;
}

.consent-text {
  font-size: var(--text-sm);
  line-height: 1.5;
  color: var(--ink-soft);
}

.consent-text strong {
  color: var(--ink);
}

.consent-actions {
  display: flex;
  gap: var(--space-xs);
  flex: none;
}

@media (max-width: 720px) {
  .consent {
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
  }

  .consent-actions .btn {
    flex: 1;
    justify-content: center;
    min-height: 44px;
  }
}

/* ===== LEGAL PAGES ===== */
.legal {
  max-width: 68ch;
  padding-block: var(--space-xl) var(--space-2xl);
}

.legal h1 {
  font-size: var(--text-xl);
  margin-bottom: var(--space-xs);
}

.legal .legal-updated {
  font-size: var(--text-xs);
  color: var(--ink-muted);
  margin-bottom: var(--space-xl);
}

.legal h2 {
  font-size: var(--text-md);
  margin: var(--space-xl) 0 var(--space-xs);
}

.legal p,
.legal li {
  font-size: var(--text-sm);
  line-height: 1.65;
  color: var(--ink-soft);
  margin-bottom: var(--space-xs);
}

.legal ul,
.legal ol {
  padding-left: 1.3em;
  margin-bottom: var(--space-md);
}

.legal strong {
  color: var(--ink);
}

/* What the owner has to fill in before this goes live */
.legal mark {
  background: #fff3cd;
  color: #6b4d00;
  padding: 0 4px;
  border-radius: 3px;
  font-weight: 600;
}

.legal-note {
  margin-bottom: var(--space-xl);
  padding: var(--space-sm) var(--space-md);
  border-left: 3px solid var(--accent);
  background: var(--surface-sunken);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* ===== TOASTS ===== */
#notification-stack {
  position: fixed;
  top: calc(var(--space-md) + env(safe-area-inset-top));
  right: max(var(--space-md), env(safe-area-inset-right));
  left: max(var(--space-md), env(safe-area-inset-left));
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--space-xs);
  pointer-events: none;
  z-index: 9999;
}

.toast {
  max-width: min(420px, 100%);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  color: #fff;
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1.4;
  box-shadow: var(--shadow-lg);
  /* Enters from the edge it can be swiped back to, never from nothing */
  opacity: 0;
  transform: translateX(16px) scale(0.98);
  transition: opacity var(--settle) var(--ease-out), transform var(--settle) var(--ease-out);
}

.toast-shown {
  opacity: 1;
  transform: translateX(0) scale(1);
}

.toast-success {
  background: #0f7a45;
}

.toast-error {
  background: var(--danger);
}

/* ===== HOVER =====
   Behind the media query: on a touch screen :hover sticks after a tap */
@media (hover: hover) and (pointer: fine) {
  a:hover {
    color: var(--accent-ink);
  }

  .card:hover {
    border-color: var(--line-strong);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
  }



  .section-mark-link:hover {
    opacity: 0.6;
  }

  .brand-link:hover {
    color: var(--accent-ink);
  }


  .section-all:hover .section-all-arrow {
    transform: translateX(3px);
  }

  /* The tile is already white on a sunken panel, so hover draws its edge
     instead of repainting the face */
  .tile:hover {
    border-color: var(--line-strong);
    box-shadow: var(--shadow-md);
  }

  .cat-row:hover {
    background: var(--surface-sunken);
  }

  .cat-row:hover .cat-link {
    color: var(--accent-ink);
  }

  .cat-toggle:hover::before {
    border-color: var(--ink);
  }

  .variant:not(.variant-current):hover {
    border-color: var(--ink);
    background: var(--surface-sunken);
  }

  .tile:hover .tile-image img {
    transform: scale(1.05);
  }

  .card:hover::before,
  .card:focus-within::before {
    opacity: 1;
  }

  .card:hover .card-image img {
    transform: scale(1.03);
  }

  .header-nav > div:hover {
    border-bottom-color: var(--accent);
  }

  .search-bar input:hover {
    border-color: var(--ink-muted);
  }

  .search-clear:hover {
    background: var(--surface-sunken);
    color: var(--ink);
  }

  .search-submit:hover {
    background: var(--accent);
  }

  .btn-primary:hover {
    background: #2a2e35;
    border-color: #2a2e35;
  }

  .btn-accent:hover {
    background: var(--accent-ink);
    border-color: var(--accent-ink);
  }

  .btn-secondary:hover {
    background: var(--surface-sunken);
    border-color: var(--ink-muted);
  }

  .btn-ghost:hover {
    background: var(--surface-sunken);
    color: var(--ink);
  }

  .filter-option:hover {
    background: var(--surface-sunken);
  }

  .pagination button:hover:not(:disabled):not(.active) {
    border-color: var(--line-strong);
    color: var(--ink);
  }

  .product-thumbnail:hover {
    border-color: var(--line-strong);
  }

  .category-section-link:hover {
    text-decoration: underline;
  }
}

/* ===== TOUCH TARGETS =====
   A finger is about 9 mm wide. These grow only where the pointer is coarse,
   so the desktop layout keeps its density. */
@media (pointer: coarse) {
  /* Under 16px Android and iOS zoom the page in on focus and never zoom back */
  input,
  textarea,
  select,
  .search-bar input,
  .filter-select,
  .form-group input,
  .form-group textarea,
  .form-group select {
    font-size: 16px;
  }

  .search-bar {
    height: 46px;
  }

  /* The chevron and the category name sit side by side, so both need
     room enough that a thumb hits the one it aimed at */
  .cat-toggle {
    width: 34px;
    height: 34px;
  }

  .cat-link {
    padding: 6px 0;
  }

  /* The strip's phone number is the one thing on it worth tapping */
  .header-top a {
    display: inline-block;
    padding: 6px 0;
  }

  .category-section-link {
    display: inline-block;
    padding: 10px 0;
  }

  .pagination button {
    min-width: 44px;
    height: 44px;
  }


  .filter-option {
    min-height: 40px;
  }

  .filter-option input {
    width: 18px;
    height: 18px;
  }

  .search-clear {
    width: 32px;
    height: 32px;
  }

  .footer-section ul li {
    margin-bottom: var(--space-2xs);
  }

  .footer-section ul li a {
    display: inline-block;
    padding: 10px 0;
  }

  .breadcrumb a {
    display: inline-block;
    padding: 8px 0;
  }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
  .catalog-layout {
    grid-template-columns: 220px minmax(0, 1fr);
    gap: var(--space-lg);
  }
}

@media (max-width: 860px) {
  :root {
    --gutter: var(--space-md);
  }

  .catalog-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .catalog-aside {
    position: static;
    max-height: none;
    overflow: visible;
  }

  .filters-toggle {
    display: inline-flex;
    margin-bottom: var(--space-sm);
  }

  .catalog-aside .filters {
    display: none;
  }

  .catalog-aside.open .filters {
    display: block;
  }

  .product-details {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-lg);
  }

  .product-gallery {
    position: static;
  }

  .header-nav {
    display: none;
  }

  .hero {
    padding: var(--space-xl) 0;
  }

  .hero-stats {
    gap: var(--space-lg);
    margin-top: var(--space-lg);
  }
}

@media (max-width: 560px) {
  :root {
    --text-2xl: clamp(24px, 7vw, 30px);
  }

  .grid-3,
  .grid-4,
  /* The home page's wider minimum would leave one card per row on a phone */
  .category-section .grid {
    grid-template-columns: repeat(auto-fill, minmax(156px, 1fr));
    gap: var(--space-xs);
  }

  /* A logo beside the tiles would leave the tiles a sliver of the screen,
     so on a phone it stands above them */
  .section-row {
    flex-direction: column;
  }

  .section-mark {
    width: 100%;
    height: auto;
    padding: 0 0 var(--space-sm);
  }

  .section-mark img {
    max-height: 56px;
  }

  .slide-caption {
    padding: var(--space-lg) var(--space-md) var(--space-sm);
  }

  .slide-title {
    font-size: var(--text-base);
  }

  /* A phone bar holds the name and the count and nothing else */
  .section-hint {
    display: none;
  }

  .section-title {
    flex: 1;
    min-width: 0;
  }

  /* Two subcategories to a row. At the desktop minimum only one fits, and a
     phone screen filled by a single photograph tells a buyer nothing. */
  /* On a phone two to a row is the whole width, so they do stretch */
  .tile-grid {
    grid-template-columns: repeat(auto-fill, minmax(138px, 1fr));
    gap: var(--space-xs);
  }

  .section-pad {
    padding: var(--space-sm);
  }

  .section-head-plain {
    padding: 12px var(--space-sm);
  }

  /* На узком экране подзаголовок с перечислением подкатегорий только мешает */
  .section-hint {
    display: none;
  }

  .header-main {
    padding: var(--space-xs) 0;
    gap: var(--space-xs);
  }

  .logo {
    --logo-height: 40px;
  }

  /* On a phone the strip has room for the phone number and nothing else */
  .header-top span {
    display: none;
  }

  .header-top .container {
    justify-content: flex-end;
  }

  .search-bar {
    order: 3;
    flex-basis: 100%;
    max-width: none;
    height: 40px;
  }

  .card-content {
    padding: var(--space-xs) var(--space-sm) var(--space-sm);
  }

  .card-specs {
    display: none;
  }

  .card-foot {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }

  .product-actions {
    flex-direction: column;
  }

  .spec-table td:first-child {
    width: 50%;
  }
}

/* ===== REDUCED MOTION =====
   Movement goes; the fades that explain what changed stay */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0s !important;
  }

  .card:hover,
  .card:active,
  .btn:active {
    transform: none;
  }

  /* Без анимации плитки не должны остаться невидимыми */
  .section-body .tile {
    opacity: 1;
    transform: none;
  }
}
