:root {
  --bg: #f6f7fb;
  --panel: rgba(255, 255, 255, 0.92);
  --panelSolid: #ffffff;
  --fg: #0f172a;
  --fg1: rgba(15, 23, 42, 0.72);
  --fg2: rgba(15, 23, 42, 0.56);
  --line: rgba(15, 23, 42, 0.10);
  --line2: rgba(15, 23, 42, 0.14);
  --shadow: 0 18px 60px rgba(2, 6, 23, 0.10);
  --shadow2: 0 10px 26px rgba(2, 6, 23, 0.08);
  --r: 18px;
  --r2: 22px;
  --accent: #0f172a;
  --accent2: #2563eb;
  --font: "Manrope", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  --fontH: "Literata", ui-serif, Georgia, serif;
}

* { box-sizing: border-box; }
html { height: 100%; }
body.catalog {
  min-height: 100%;
  margin: 0;
  color: var(--fg);
  font-family: var(--font);
  background: #ffffff;
}

a { color: inherit; }
code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 0.95em;
  color: rgba(15, 23, 42, 0.86);
  background: rgba(15, 23, 42, 0.04);
  border: 1px solid rgba(15, 23, 42, 0.10);
  padding: 0.12rem 0.36rem;
  border-radius: 10px;
}

.wrap {
  width: min(1160px, calc(100% - 32px));
  margin: 0 auto;
}

.bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  display: none;
}
.bg__grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, rgba(15, 23, 42, 0.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(15, 23, 42, 0.05) 1px, transparent 1px);
  background-size: 44px 44px;
  opacity: 0.22;
  mask-image: radial-gradient(900px 600px at 50% 20%, rgba(0, 0, 0, 1) 35%, transparent 70%);
}
.bg__blob {
  position: absolute;
  width: 680px;
  height: 680px;
  filter: blur(35px);
  opacity: 0.35;
  border-radius: 999px;
  transform: translate3d(0, 0, 0);
}
.bg__blob--a {
  left: -220px;
  top: 80px;
  background:
    radial-gradient(circle at 30% 30%, rgba(37, 99, 235, 0.22), transparent 55%),
    radial-gradient(circle at 70% 70%, rgba(15, 23, 42, 0.10), transparent 60%);
  animation: driftA 18s ease-in-out infinite;
}
.bg__blob--b {
  right: -260px;
  top: 340px;
  background:
    radial-gradient(circle at 30% 30%, rgba(15, 23, 42, 0.10), transparent 55%),
    radial-gradient(circle at 70% 70%, rgba(37, 99, 235, 0.18), transparent 60%);
  animation: driftB 22s ease-in-out infinite;
}

@keyframes driftA {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(60px, -40px) scale(1.05); }
}
@keyframes driftB {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-70px, 40px) scale(0.98); }
}

@media (prefers-reduced-motion: reduce) {
  .bg__blob--a, .bg__blob--b { animation: none; }
}

.top {
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(12px);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(255, 255, 255, 0.60));
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}
.top .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}
.brand__logo {
  height: 18px;
  width: auto;
  display: block;
}
.brand__text {
  font-weight: 800;
  letter-spacing: 0.01em;
  font-size: 23px;
  line-height: 23px;
}
.top__actions { display: flex; gap: 10px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.92);
  background: rgba(15, 23, 42, 0.96);
  color: #ffffff;
  text-decoration: none;
  padding: 10px 14px;
  font-weight: 800;
  letter-spacing: 0.01em;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.08) inset;
  transition: transform 120ms ease, background 140ms ease, border-color 140ms ease, color 140ms ease;
}
.btn:hover {
  transform: translateY(-1px);
  background: #ffffff;
  border-color: rgba(15, 23, 42, 0.92);
  color: rgba(15, 23, 42, 0.96);
}
.btn:active { transform: translateY(0px); }
.btn:focus-visible { outline: 2px solid rgba(37, 99, 235, 0.45); outline-offset: 3px; }

.btn--primary {
  background: rgba(15, 23, 42, 0.96);
  border-color: rgba(15, 23, 42, 0.92);
  color: #ffffff;
}
.btn--ghost { background: rgba(15, 23, 42, 0.96); }
.btn--small { padding: 8px 10px; font-size: 13px; font-weight: 800; }

.pill {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.10);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow2);
}
.pill__k { color: var(--fg2); font-weight: 800; font-size: 12px; letter-spacing: 0.02em; text-transform: uppercase; }
.pill__v { font-weight: 900; }

.controls {
  margin-top: 10px;
  padding: 14px;
  border-radius: var(--r2);
  border: 1px solid rgba(15, 23, 42, 0.10);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow2);
}
.controls__row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
}
.controls__row + .controls__row {
  margin-top: 12px;
}
.controls__stats {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.search {
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: rgba(255, 255, 255, 0.92);
  padding: 10px 12px;
}
.search__icon {
  width: 18px;
  height: 18px;
  opacity: 0.65;
  background-color: rgba(15, 23, 42, 0.72);
  /* crisp magnifier icon */
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%20viewBox%3D%270%200%2024%2024%27%3E%3Cpath%20fill%3D%27black%27%20d%3D%27M10%2018a8%208%200%201%201%205.293-14.293A8%208%200%200%201%2010%2018Zm0-2a6%206%200%201%200%200-12%206%206%200%200%200%200%2012Zm11.707%205.293-4.11-4.11a1%201%200%200%200-1.414%201.414l4.11%204.11a1%201%200%200%200%201.414-1.414Z%27/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%20viewBox%3D%270%200%2024%2024%27%3E%3Cpath%20fill%3D%27black%27%20d%3D%27M10%2018a8%208%200%201%201%205.293-14.293A8%208%200%200%201%2010%2018Zm0-2a6%206%200%201%200%200-12%206%206%200%200%200%200%2012Zm11.707%205.293-4.11-4.11a1%201%200%200%200-1.414%201.414l4.11%204.11a1%201%200%200%200%201.414-1.414Z%27/%3E%3C/svg%3E");
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: 18px 18px;
  mask-size: 18px 18px;
  transform: translateY(-0.5px);
}
.search input {
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  color: var(--fg);
  font: inherit;
  font-weight: 800;
  letter-spacing: 0.01em;
}
.search input::placeholder { color: rgba(15, 23, 42, 0.45); font-weight: 800; }
.controls__right { display: flex; align-items: center; gap: 10px; }
.select { display: flex; gap: 10px; align-items: center; }
.select__label { font-size: 12px; color: var(--fg2); font-weight: 900; letter-spacing: 0.02em; text-transform: uppercase; }
.select select {
  appearance: none;
  -webkit-appearance: none;
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: rgba(255, 255, 255, 0.92);
  color: var(--fg);
  padding: 10px 36px 10px 12px;
  font: inherit;
  font-weight: 800;
  letter-spacing: 0.01em;
  background-image:
    linear-gradient(45deg, transparent 50%, rgba(15, 23, 42, 0.62) 50%),
    linear-gradient(135deg, rgba(15, 23, 42, 0.62) 50%, transparent 50%);
  background-position: calc(100% - 16px) 55%, calc(100% - 11px) 55%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
.select select:focus-visible { outline: 2px solid rgba(37, 99, 235, 0.45); outline-offset: 3px; }

.chips { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.chip {
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.10);
  background: rgba(255, 255, 255, 0.82);
  color: rgba(15, 23, 42, 0.78);
  padding: 10px 12px;
  cursor: pointer;
  font: inherit;
  font-weight: 900;
  letter-spacing: 0.01em;
  transition: transform 120ms ease, background 140ms ease, border-color 140ms ease;
}
.chip:hover { transform: translateY(-1px); border-color: rgba(15, 23, 42, 0.16); }
.chip.is-active {
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.96), rgba(15, 23, 42, 0.90));
  border-color: rgba(15, 23, 42, 0.90);
  color: rgba(255, 255, 255, 0.95);
}
.chip:focus-visible { outline: 2px solid rgba(37, 99, 235, 0.45); outline-offset: 3px; }

.grid { padding: 20px 0 24px; }
.grid__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  margin: 16px 0 12px;
}
.grid__title { font-weight: 900; font-size: 18px; letter-spacing: 0.01em; }
.grid__hint { color: var(--fg2); font-size: 13px; font-weight: 800; }

/* Single-column list cards (preview left, details right) */
.cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.card {
  width: 100%;
  border-radius: var(--r2);
  border: 1px solid rgba(15, 23, 42, 0.10);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow2);
  overflow: hidden;
  display: grid;
  grid-template-columns: 220px 1fr;
  align-items: stretch;
  min-height: 220px;
}
.card__thumb {
  position: relative;
  display: block;
  aspect-ratio: 1 / 1;
  width: 220px;
  max-width: 220px;
  overflow: hidden;
  text-decoration: none;
  border-right: 1px solid rgba(15, 23, 42, 0.08);
  padding: 12px;
  background: #ffffff;
}
.card__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.01);
  transition: transform 250ms ease;
  border-radius: 16px;
}
.card__shade { display: none; }
.card__body {
  padding: 18px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
}
.card__titleRow { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.card__title {
  text-decoration: none;
  font-weight: 900;
  letter-spacing: 0.01em;
  line-height: 1.2;
  font-size: 18px;
}
.card__title:hover { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }
.card__descr {
  color: rgba(15, 23, 42, 0.72);
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-line;
}
.card__descr:empty { display: none; }
.card__actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  align-items: center;
  height: 43.33px;
  margin-top: auto; /* pin actions to the bottom of the card body */
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE/Edge Legacy */
}
.card__actions::-webkit-scrollbar { display: none; }

.card__actions .btn {
  background: #ffffff;
  border-color: rgba(15, 23, 42, 0.92);
  color: rgba(15, 23, 42, 0.96);
  box-shadow: none;
}
.card__actions .btn:hover {
  background: rgba(15, 23, 42, 0.96);
  border-color: rgba(15, 23, 42, 0.92);
  color: #ffffff;
}
.card__actions .btn:active { transform: translateY(0px); }

.btn.is-disabled,
.btn[aria-disabled="true"] {
  opacity: 0.45;
  pointer-events: none;
  filter: grayscale(0.2);
}
.card:hover .card__thumb img { transform: scale(1.06); }

.foot {
  padding: 24px 0 34px;
  border-top: 1px solid rgba(15, 23, 42, 0.08);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}
.foot__title { font-weight: 900; }
.foot__sub { margin-top: 6px; color: var(--fg2); font-weight: 800; font-size: 13px; }
.foot__right { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.link { color: rgba(15, 23, 42, 0.86); text-decoration: none; font-weight: 900; }
.link:hover { text-decoration: underline; text-underline-offset: 3px; }
.link:focus-visible { outline: 2px solid rgba(37, 99, 235, 0.45); outline-offset: 3px; border-radius: 8px; }

@media (max-width: 980px) {
  .controls__row { grid-template-columns: 1fr; }

  .card { grid-template-columns: 180px 1fr; min-height: 180px; }
  .card__thumb { width: 180px; max-width: 180px; }
}

@media (max-width: 640px) {
  .top .wrap {
    padding: 12px 0;
    flex-wrap: wrap;
    gap: 10px;
  }
  .brand {
    width: 100%;
    gap: 8px;
  }
  .brand__logo { height: 16px; }
  .brand__text {
    font-size: 16px;
    line-height: 16px;
    white-space: nowrap;
  }
  .top__actions {
    width: 100%;
    justify-content: flex-start;
    margin-top: 6px;
  }
  .top__actions .btn {
    padding: 8px 10px;
    font-size: 13px;
    font-weight: 800;
    background: #ffffff;
    border-color: rgba(15, 23, 42, 0.92);
    color: rgba(15, 23, 42, 0.96);
    box-shadow: none;
  }
  .top__actions .btn:hover {
    background: rgba(15, 23, 42, 0.96);
    border-color: rgba(15, 23, 42, 0.92);
    color: #ffffff;
  }
  .btn { padding: 10px 12px; }
  .btn--small { padding: 8px 10px; }

  /* Mobile cards: preview on top (square), details below, actions block at the bottom */
  .card {
    grid-template-columns: 1fr;
    min-height: 0;
  }
  .card__thumb {
    width: 100%;
    max-width: none;
    border-right: none;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
    padding: 12px;
    aspect-ratio: 1 / 1;
  }
  .card__body { padding: 14px 14px 14px; gap: 10px; }
  .card__title { font-size: 16px; }
  .card__descr { font-size: 13px; }
  .card__actions {
    flex-wrap: wrap;
    overflow-x: visible;
    height: auto;
  }
  .card__actions .btn { white-space: nowrap; }
}
