:root {
  --ink: #0b1522;
  --body: #101a26;
  --muted: #5b6a7d;
  --dim: #8593a5;
  --faint: #a3aebe;
  --line: #e6ebf2;
  --line-soft: #eef2f7;
  --accent: #1d6fe0;
  --accent-dark: #14539f;
  --max: 1360px;
}

* { box-sizing: border-box; }

/* Правила с классами перебивают браузерное [hidden]{display:none}.
   Без этой строки .overlay с display:flex остаётся видимым. */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: #fff;
  color: var(--body);
  font-family: "Golos Text", "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-dark); }
::selection { background: #d7e6fb; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 28px; }

/* ---------- шапка ---------- */

.head {
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #f5f9fe, #fff);
  padding: 48px 0 0;
}
.head-row {
  display: flex; flex-wrap: wrap; align-items: flex-end;
  justify-content: space-between; gap: 20px;
}
.head h1 {
  margin: 0;
  font-size: clamp(34px, 5vw, 52px);
  line-height: 1; font-weight: 600; letter-spacing: -.03em; color: var(--ink);
}
.head p.lead {
  margin: 10px 0 0; max-width: 620px;
  font-size: 15.5px; line-height: 1.6; color: var(--muted);
}
.count { display: flex; align-items: baseline; gap: 10px; padding-bottom: 4px; }
.count b {
  font-size: 44px; font-weight: 600; letter-spacing: -.03em;
  line-height: 1; color: var(--accent);
}
.count span { font-size: 13px; color: var(--dim); }

/* Рамка — градиент: рисуем его на подложке, а поле лежит сверху.
   border-image не даёт скруглений, поэтому подложка через ::before. */
.searchbar {
  position: relative; display: flex; align-items: center; gap: 14px;
  margin-top: 34px; padding: 6px 18px; border-radius: 10px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(16, 26, 38, .04), 0 8px 24px -12px rgba(29, 111, 224, .18);
  transition: box-shadow .22s ease, transform .22s ease;
}
/* Градиент шире рамки и медленно едет — строка выглядит живой,
   не мигая и не отвлекая от набора текста. */
.searchbar::before {
  content: ""; position: absolute; inset: -1.5px; border-radius: inherit;
  background: linear-gradient(105deg, #1d6fe0, #46b7e8, #7b5cf0, #46b7e8, #1d6fe0);
  background-size: 300% 100%;
  opacity: .38; z-index: -1;
  animation: drift 14s linear infinite;
  transition: opacity .25s ease;
}
.searchbar:hover::before { opacity: .6; }
.searchbar:focus-within::before { opacity: 1; }

@keyframes drift {
  to { background-position: 300% 0; }
}

/* Подпись «по смыслу» — сразу видно, что поиск не по подстроке */
.ai-tag {
  flex: none; padding: 4px 9px; border-radius: 20px;
  font-size: 11px; font-weight: 600; letter-spacing: .02em; color: #fff;
  background: linear-gradient(100deg, var(--accent), #7b5cf0);
  box-shadow: 0 2px 8px -2px rgba(123, 92, 240, .5);
}
.searchbar .spark {
  fill: currentColor; opacity: 0;
  transform-origin: 15.5px 5.8px;
  transition: opacity .25s ease;
}
.searchbar:focus-within .spark { opacity: 1; animation: twinkle 2.4s ease-in-out infinite; }

@keyframes twinkle {
  0%, 100% { opacity: .45; transform: scale(.85); }
  50%      { opacity: 1;   transform: scale(1.15); }
}
.searchbar:focus-within {
  box-shadow: 0 1px 2px rgba(16, 26, 38, .05), 0 14px 34px -14px rgba(29, 111, 224, .38);
}
.searchbar .mag {
  width: 20px; height: 20px; flex: none; color: var(--faint);
  transition: color .2s ease;
}
.searchbar:focus-within .mag { color: var(--accent); }
.searchbar label { font-size: 13px; color: var(--dim); flex: none; }
.searchbar input {
  flex: 1; min-width: 0; border: 0; outline: none; background: transparent;
  padding: 14px 0; font-family: inherit; font-size: 19px;
  font-weight: 500; letter-spacing: -.01em; color: var(--ink);
}
.searchbar input::placeholder { color: var(--faint); font-weight: 400; }
.searchbar .status { font-size: 12.5px; color: var(--faint); flex: none; }
.linkbtn {
  border: 0; background: transparent; color: var(--dim); font-family: inherit;
  font-size: 12.5px; font-weight: 600; cursor: pointer; padding: 6px 0;
}
.linkbtn:hover { color: var(--accent); }

/* ---------- раскладка ---------- */

.main {
  display: flex; align-items: flex-start; gap: 44px; flex-wrap: wrap;
  padding-top: 34px; padding-bottom: 80px;
}
aside {
  flex: 0 0 200px; min-width: 180px; position: sticky; top: 24px;
  display: flex; flex-direction: column; gap: 26px;
}
aside h2 {
  margin: 0 0 12px; font-size: 13px; font-weight: 600; color: var(--dim);
}
.facet { display: flex; flex-direction: column; gap: 2px; }
.facet button {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%; border: 0; background: transparent;
  border-left: 2px solid var(--line-soft);
  padding: 8px 0 8px 12px; font-family: inherit; font-size: 14px;
  text-align: left; cursor: pointer; color: var(--muted);
  transition: color .18s ease, border-color .18s ease;
}
.facet button:hover { color: var(--ink); }
.facet button[aria-pressed="true"] {
  color: var(--ink); font-weight: 600; border-left-color: var(--accent);
}
.facet .n { font-size: 11.5px; color: var(--faint); }
/* ---------- образцы палитры ---------- */

.swatch-btn {
  position: relative; aspect-ratio: 1; border: 0; padding: 0; cursor: pointer;
  border-radius: 7px; background: var(--c);
  box-shadow: inset 0 0 0 1px rgba(16, 26, 38, .14);
  transition: transform .16s ease, box-shadow .16s ease;
}
.swatch-btn:hover { transform: translateY(-2px); }
.swatch-btn[aria-pressed="true"] {
  box-shadow: inset 0 0 0 1px rgba(16, 26, 38, .14),
              0 0 0 2px #fff, 0 0 0 4px var(--accent);
}
/* Галочка поверх выбранного образца: на светлых цветах тёмная,
   на тёмных светлая — одного цвета не хватит на всю палитру. */
.swatch-btn[aria-pressed="true"]::after {
  content: ""; position: absolute; inset: 0;
  background: no-repeat center / 12px 12px
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M2.5 8.5l3.5 3.5 7.5-8' fill='none' stroke='%23fff' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  filter: drop-shadow(0 0 1.5px rgba(0, 0, 0, .55));
}

.chip-dot {
  width: 9px; height: 9px; border-radius: 50%; display: inline-block;
  border: 1px solid rgba(16, 26, 38, .18); flex: none;
}

.palette-hint {
  margin: 10px 0 0; padding-left: 2px;
  font-size: 11.5px; line-height: 1.5; color: var(--faint);
}

.facet .swatch {
  width: 10px; height: 10px; border-radius: 50%;
  border: 1px solid #dbe3ee; display: inline-block; margin-right: 8px;
  vertical-align: -1px;
}
aside .note {
  padding-left: 14px; border-left: 1px solid var(--line-soft);
  font-size: 12.5px; line-height: 1.65; color: var(--dim);
}

.results { flex: 1; min-width: 0; }
.grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 28px 20px;
}

/* ---------- карточка ---------- */

.card {
  display: flex; flex-direction: column; gap: 12px;
  cursor: pointer; border: 0; background: transparent; padding: 0;
  font-family: inherit; text-align: left;
}
.thumb {
  position: relative; aspect-ratio: 3/4; overflow: hidden; border-radius: 3px;
  background: #eef3fa; border: 1px solid var(--line);
  transition: border-color .2s ease;
}
.thumb img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: top;
  transition: transform .6s cubic-bezier(.16, 1, .3, 1);
}
.card:hover .thumb, .card:focus-visible .thumb { border-color: var(--accent); }
.card:hover .thumb img { transform: scale(1.05); }
.open-hint {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; background: var(--accent); color: #fff;
  font-size: 11.5px; font-weight: 600;
  transform: translateY(100%); opacity: 0;
  transition: opacity .22s ease, transform .28s cubic-bezier(.16, 1, .3, 1);
}
.card:hover .open-hint, .card:focus-visible .open-hint {
  transform: none; opacity: 1;
}
.card h3 {
  margin: 0; font-size: 14px; font-weight: 500; line-height: 1.3;
  letter-spacing: -.01em; color: var(--body); transition: color .18s ease;
}
.card:hover h3 { color: var(--accent); }
.card .cat { margin: 5px 0 0; font-size: 11px; color: var(--faint); }

.empty { padding: 72px 0; border-top: 1px solid var(--line); }
.empty h2 { margin: 0 0 8px; font-size: 18px; font-weight: 600; color: var(--ink); }
.empty p { margin: 0; font-size: 14px; color: var(--dim); }

/* ---------- окно стиля ---------- */

.overlay {
  position: fixed; inset: 0; z-index: 50; display: flex;
  align-items: center; justify-content: center; padding: 24px;
  background: rgba(11, 21, 34, .58);
}
.modal {
  display: flex; flex-wrap: wrap; width: 100%; max-width: 880px;
  max-height: 88vh; overflow: auto; background: #fff; border-radius: 4px;
}
.modal .pic { flex: 1 1 320px; min-width: 260px; background: #eef3fa; }
.modal .pic img {
  display: block; width: 100%; height: 100%; min-height: 340px;
  object-fit: cover; object-position: top;
}
.modal .info {
  flex: 1 1 340px; min-width: 290px; display: flex; flex-direction: column;
  gap: 20px; padding: 32px 34px 34px;
}
.modal .cat { margin: 0; font-size: 12px; font-weight: 600; color: var(--accent); }
.modal h2 {
  margin: 8px 0 0; font-size: 30px; line-height: 1.12; font-weight: 600;
  letter-spacing: -.025em; color: var(--ink);
}
.modal .close {
  flex: none; border: 1px solid var(--line); border-radius: 2px;
  width: 32px; height: 32px; background: #fff; color: var(--muted);
  font-size: 16px; line-height: 1; cursor: pointer;
}
.modal .close:hover { border-color: var(--accent); color: var(--accent); }
.rows { border-top: 1px solid var(--line-soft); }
.rows div {
  display: flex; justify-content: space-between; gap: 12px; padding: 11px 0;
  border-bottom: 1px solid var(--line-soft);
}
.rows span:first-child { font-size: 12.5px; color: var(--dim); }
.rows span:last-child { font-size: 13px; font-weight: 600; color: var(--ink); }
.modal .desc { margin: 0; font-size: 14.5px; line-height: 1.65; color: #42536a; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tags span {
  padding: 5px 10px; border: 1px solid var(--line); border-radius: 2px;
  font-size: 12px; color: var(--muted);
}
.dots { display: flex; gap: 6px; }
.dots i {
  width: 20px; height: 20px; border-radius: 3px; border: 1px solid #dbe3ee;
}

@media (max-width: 720px) {
  .wrap { padding: 0 16px; }
  aside { position: static; flex: 1 1 100%; }
  .main { gap: 28px; }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  /* градиент остаётся, но перестаёт ехать */
  .searchbar::before { animation: none !important; }
  .searchbar:focus-within .spark { animation: none !important; opacity: 1; }
}

/* ---------- крупный поиск ---------- */


.searchbar .mag { width: 20px; height: 20px; color: var(--faint); flex: none; }
/* Подсказка листается: показываем, что искать можно свободным текстом */
.searchbar input::placeholder { transition: opacity .25s ease; }
.searchbar input.fading::placeholder { opacity: 0; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; padding-bottom: 4px; }
.chips button {
  border: 1px solid var(--line); background: #fff; border-radius: 20px;
  padding: 6px 12px; font-family: inherit; font-size: 12.5px; color: var(--muted);
  cursor: pointer; transition: all .16s ease;
}
.chips button:hover { border-color: var(--accent); color: var(--accent); }
.chips button.on {
  background: var(--accent); border-color: var(--accent); color: #fff;
}
.chips button .x { margin-left: 6px; opacity: .7; }

/* ---------- палитра ---------- */

.palette {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(30px, 1fr));
  gap: 8px; padding-left: 2px;
}
.palette button {
  position: relative; width: 100%; aspect-ratio: 1; border-radius: 50%;
  border: 1px solid #dbe3ee; cursor: pointer; padding: 0;
  transition: transform .16s ease, box-shadow .16s ease;
}
.palette button:hover { transform: scale(1.12); }
.palette button[aria-pressed="true"] {
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--accent);
}
.palette button.all {
  background: conic-gradient(#d0453c, #e08a3c, #e8c84a, #4f9d5c,
                             #3fb3ad, #3a5fc0, #8b5cc0, #dd7ab0, #d0453c);
}

/* ---------- метки ---------- */

.marks { position: absolute; top: 8px; left: 8px; display: flex; gap: 5px; z-index: 1; }
.marks span {
  padding: 3px 7px; border-radius: 2px; font-size: 10px; font-weight: 600;
  letter-spacing: .02em; color: #fff; background: var(--accent);
}
.marks .new { background: #2f7d43; }
.marks .hot { background: #e0713c; }
