:root {
  --bg: #fafaf9;
  --raised: #ffffff;
  --surface: #f2f2f0;
  --surface-2: #eaeae7;
  --text: #0b0b0c;
  --text-2: #3c3c40;
  --muted: #86868b;
  --line: rgba(11, 11, 12, .08);
  --line-2: rgba(11, 11, 12, .14);
  --icon: brightness(0);
  --panel: #ffffff;
  --hit: #e1e1dd;
  --focus: rgba(11, 11, 12, .28);
  --shadow: 0 1px 2px rgba(11, 11, 12, .04), 0 12px 32px -16px rgba(11, 11, 12, .18);

  --sans: "Nunito", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a0a0b;
    --raised: #0f0f11;
    --surface: #0e0e10;
    --surface-2: #161619;
    --text: #f5f5f4;
    --text-2: #c7c7cc;
    --muted: #8a8a90;
    --line: rgba(255, 255, 255, .07);
    --line-2: rgba(255, 255, 255, .13);
    --icon: brightness(0) invert(.94);
    --panel: #0c0c0d;
    --hit: #222226;
    --focus: rgba(255, 255, 255, .26);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 16px 40px -20px rgba(0, 0, 0, .8);
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; transition: text-decoration-color .2s; }
a:hover { text-decoration-color: currentColor; }

code {
  font: 400 .86em var(--mono);
  background: var(--surface-2);
  border-radius: 5px;
  padding: .12em .38em;
  overflow-wrap: anywhere;
}

::selection { background: var(--text); color: var(--bg); }
:focus-visible { outline: 2px solid var(--text); outline-offset: 3px; border-radius: 6px; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 32px; }

/* Верхняя строка */

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
}

.mark {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-weight: 700;
  font-size: 15.5px;
  letter-spacing: -.01em;
  text-decoration: none;
  transition: opacity .2s;
}

.mark img { display: block; filter: var(--icon); }
.mark:hover { opacity: .7; }

.top-nav { display: flex; gap: 28px; font-size: 14px; }
.top-nav a { color: var(--muted); text-decoration: none; transition: color .2s; }
.top-nav a:hover { color: var(--text); }

/* Первый экран */

.hero { padding-top: 104px; padding-bottom: 88px; }

.eyebrow {
  margin: 0 0 20px;
  font-size: 15px;
  line-height: 1.4;
  color: var(--muted);
}

h1 {
  margin: 0;
  max-width: 900px;
  font-weight: 700;
  font-size: clamp(40px, 7.2vw, 84px);
  line-height: 1.02;
  letter-spacing: -.03em;
  text-wrap: balance;
}

.lede {
  margin: 28px 0 44px;
  max-width: 560px;
  font-size: 19px;
  line-height: 1.5;
  color: var(--text-2);
  text-wrap: pretty;
}

.prompt, .panel {
  display: inline-flex;
  align-items: center;
  gap: 18px;
  max-width: 100%;
  padding: 6px 6px 6px 18px;
  vertical-align: top;
  background: var(--panel);
  border: 1px solid var(--line-2);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.prompt .btn, .panel .btn { height: 36px; border-radius: 9px; }

.panel { display: flex; width: 100%; }
.panel p { flex: 1; margin: 0; font-size: 15px; }
.panel:focus-within { border-color: var(--focus); }

.prompt p {
  margin: 0;
  font-size: 15.5px;
  line-height: 1.45;
  color: var(--text);
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 28px;
  margin: 28px 0 0;
  padding: 0;
  list-style: none;
  font-size: 14px;
  color: var(--muted);
}

.meta li { display: flex; align-items: center; gap: 10px; }
.meta li::before { content: ""; width: 4px; height: 4px; border-radius: 50%; background: var(--line-2); }

/* Кнопки */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 38px;
  padding: 0 15px;
  font: 600 14px/1 var(--sans);
  letter-spacing: 0;
  white-space: nowrap;
  text-decoration: none;
  color: var(--text);
  background: var(--raised);
  border: 1px solid var(--line-2);
  border-radius: 10px;
  cursor: pointer;
  transition: background .2s, border-color .2s, transform .1s;
}

.btn:hover { background: var(--surface); }
.btn:active { transform: scale(.98); }

.btn-primary { color: var(--bg); background: var(--text); border-color: var(--text); }
.btn-primary:hover { background: var(--text); opacity: .86; }
.btn.is-done { pointer-events: none; }
.btn:disabled { opacity: .35; pointer-events: none; }

/* Сетка иконок */

.showcase { padding-bottom: 136px; }

/* линии рисуют сами ячейки справа и снизу, а сетка на пиксель шире рамки:
   так крайние линии прячутся под рамку и неполный последний ряд выглядит аккуратно */
.grid-frame {
  border: 1px solid var(--line);
  border-radius: 20px;
  overflow: hidden;
  overflow: clip;
}

/* свёрнутая сетка уходит в затемнение, как список */
.grid-frame:not(.is-open) .grid {
  -webkit-mask-image: linear-gradient(#000 62%, transparent);
          mask-image: linear-gradient(#000 62%, transparent);
}

.grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  margin: 0 -1px -1px 0;
}

.cell {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  box-shadow: inset -1px -1px 0 var(--line);
  cursor: pointer;
  transition: background .25s var(--ease);
}

.cell:hover { background: var(--surface); }
.cell .ico { width: 38%; height: 38%; transition: transform .35s var(--ease); }
.cell:hover .ico { transform: scale(1.12); }

.cell::after {
  content: attr(data-name);
  position: absolute;
  left: 50%;
  bottom: 8px;
  transform: translate(-50%, 4px);
  max-width: calc(100% - 8px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  color: var(--muted);
  opacity: 0;
  transition: opacity .2s, transform .25s var(--ease);
  pointer-events: none;
}

.cell:hover::after { opacity: 1; transform: translate(-50%, 0); }

.cell.is-extra { display: none; }
.grid-frame.is-open .cell.is-extra { display: grid; }


.caption { margin: 18px 0 0; font-size: 13.5px; color: var(--muted); }

/* Иконки TGS */

.ico { display: inline-block; width: 22px; height: 22px; position: relative; }
.ico svg { display: block; }

.ico[data-fallback]::before {
  content: attr(data-fallback);
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 18px;
  filter: grayscale(1);
  opacity: .35;
}

/* Разделы со списком и гайдом */

.split {
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 7fr);
  gap: 64px;
  padding-top: 64px;
  padding-bottom: 120px;
  border-top: 1px solid var(--line);
}

.aside-in { position: sticky; top: 32px; }

h2 {
  margin: 0;
  font-weight: 700;
  font-size: clamp(28px, 3.2vw, 38px);
  line-height: 1.1;
  letter-spacing: -.02em;
  text-wrap: balance;
}

.aside-text { margin: 16px 0 24px; color: var(--text-2); font-size: 15px; line-height: 1.6; }

.search {
  flex: 1;
  min-width: 0;
  height: 36px;
  padding: 0;
  font: 400 15px var(--sans);
  color: var(--text);
  background: none;
  border: 0;
  -webkit-appearance: none;
  appearance: none;
}

.search::placeholder { color: var(--muted); }
.search:focus { outline: none; }
.search::-webkit-search-cancel-button { cursor: pointer; }

.aside-note { margin: 12px 0 0 2px; font-size: 13.5px; color: var(--muted); }
.aside-note a { color: var(--text-2); }

/* Список как цитата в Telegram: полоска слева, кавычки, сворачивание */

.quote {
  position: relative;
  margin: 0;
  padding: 10px 14px 6px 20px;
  background: var(--surface);
  border-radius: 6px 14px 14px 6px;
  box-shadow: inset 3px 0 0 var(--text);
}

.quote::before {
  content: "";
  position: absolute;
  top: 14px;
  right: 14px;
  width: 14px;
  height: 11px;
  background: var(--muted);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 11'%3E%3Cpath d='M0 11V6.6C0 2.9 1.9.7 5.4 0l.6 1.5C4 2.1 3 3.4 2.9 5.3H5.8V11H0Zm8.2 0V6.6C8.2 2.9 10.1.7 13.6 0l.4 1.5c-2 .6-3 1.9-3.1 3.8H14V11H8.2Z'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 11'%3E%3Cpath d='M0 11V6.6C0 2.9 1.9.7 5.4 0l.6 1.5C4 2.1 3 3.4 2.9 5.3H5.8V11H0Zm8.2 0V6.6C8.2 2.9 10.1.7 13.6 0l.4 1.5c-2 .6-3 1.9-3.1 3.8H14V11H8.2Z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.rows { list-style: none; margin: 0; padding: 0 28px 0 0; }

.quote.is-collapsed .rows {
  max-height: 588px;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(#000 62%, transparent);
          mask-image: linear-gradient(#000 62%, transparent);
}

.row {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto 22px;
  align-items: center;
  gap: 16px;
  height: 42px;
  padding: 0 10px 0 18px;
  margin: 0 -10px 0 -16px;
  border-radius: 9px;
  cursor: pointer;
  transition: background .15s;
}

.row[hidden] { display: none; }
.row:hover { background: var(--surface-2); }
.row.is-hit { background: var(--hit); transition: none; }

.row .fb { order: 4; text-align: center; font-size: 14px; filter: grayscale(1); opacity: .4; }
.row .nm { order: 2; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; letter-spacing: -.005em; }
.row .ico { order: 1; }
.row code { order: 3; background: none; padding: 0; font-size: 13px; color: var(--muted); letter-spacing: -.01em; }

.empty { margin: 14px 0; color: var(--muted); }

/* кнопка «Показать все» одинаковая у сетки и у списка */
.toggle-foot { display: flex; justify-content: center; padding: 6px 0 12px; }

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 16px;
  font: 600 13.5px/1 var(--sans);
  color: var(--text);
  background: var(--raised);
  border: 1px solid var(--line-2);
  border-radius: 999px;
  box-shadow: var(--shadow);
  cursor: pointer;
}

.toggle::after {
  content: "";
  width: 6px;
  height: 6px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
  transition: transform .25s var(--ease);
}

.quote:not(.is-collapsed) .toggle-foot,
.grid-frame.is-open .toggle-foot { position: sticky; bottom: 20px; }
.toggle[aria-expanded="true"]::after { transform: translateY(2px) rotate(-135deg); }
.quote.is-filtered .toggle-foot { display: none; }

/* Гайд */

.guide h3 {
  margin: 48px 0 14px;
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -.015em;
}

.guide h3:first-child { margin-top: 6px; }

.guide p, .guide li { color: var(--text-2); font-size: 15.5px; line-height: 1.65; text-wrap: pretty; }
.guide p { margin: 0 0 12px; }
.guide ol, .guide ul { margin: 0 0 12px; padding-left: 20px; }
.guide li { margin: 0 0 8px; padding-left: 4px; }
.guide li::marker { color: var(--muted); font-size: 14px; }

.code {
  margin: 18px 0 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}

.code-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 38px;
  padding: 0 6px 0 16px;
  border-bottom: 1px solid var(--line);
  font: 600 12.5px/1 var(--sans);
  color: var(--muted);
}

.code-copy {
  height: 28px;
  padding: 0 10px;
  font: 600 12.5px/1 var(--sans);
  color: var(--muted);
  background: none;
  border: 0;
  border-radius: 7px;
  cursor: pointer;
  transition: color .2s, background .2s;
}

.code-copy:hover { color: var(--text); background: var(--surface-2); }

.code pre {
  margin: 0;
  padding: 16px;
  overflow-x: auto;
  font: 400 13px/1.7 var(--mono);
  color: var(--text);
  tab-size: 4;
}

.code pre code { background: none; padding: 0; font-size: inherit; overflow-wrap: normal; }

.ai-note {
  margin-top: 32px;
  padding: 18px 20px;
  background: var(--surface);
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-2);
}

.ai-note p { margin: 0; }
.ai-note-title { margin-bottom: 4px !important; font-weight: 700; color: var(--text); }

/* Подвал */

.foot {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 32px;
  padding-top: 28px;
  padding-bottom: 48px;
  border-top: 1px solid var(--line);
  font-size: 14px;
  color: var(--muted);
}

.foot p { margin: 0; }
.foot a { color: var(--text); }
.foot .donate { font-weight: 700; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 12px) scale(.98);
  max-width: calc(100% - 32px);
  padding: 11px 18px;
  font-size: 14px;
  color: var(--bg);
  background: var(--text);
  border-radius: 12px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .3s var(--ease);
  z-index: 10;
}

.toast.is-on { opacity: 1; transform: translate(-50%, 0) scale(1); }

/* Планшет */

@media (max-width: 960px) {
  .grid { grid-template-columns: repeat(8, 1fr); }
  .split { grid-template-columns: minmax(0, 1fr); gap: 36px; padding-bottom: 96px; }
  .aside-in { position: static; }
  .hero { padding-top: 72px; }
}

/* Телефон */

@media (max-width: 640px) {
  .wrap { padding: 0 16px; }
  .top { height: 60px; }
  .top-nav { gap: 18px; font-size: 13.5px; }
  .top-nav a[href="/llms.txt"] { display: none; }
  .hero { padding-top: 48px; padding-bottom: 56px; }
  .lede { font-size: 17px; margin: 20px 0 32px; }
  .prompt { display: flex; flex-direction: column; align-items: stretch; gap: 12px; padding: 14px; }
  .prompt .btn { width: 100%; height: 40px; }
  .top-nav a[href*="donationalerts"] { display: none; }
  .meta { flex-direction: column; gap: 8px; }
  .showcase { padding-bottom: 88px; }
  .grid { grid-template-columns: repeat(6, 1fr); border-radius: 16px; }
  .cell:nth-child(n + 37) { display: none; }
  .grid-frame.is-open .cell { display: grid; }
  .cell::after { display: none; }
  .cell .ico { width: 46%; height: 46%; }
  .split { padding-top: 48px; }
  .rows { padding-right: 20px; }
  .row { grid-template-columns: 22px minmax(0, 1fr); grid-template-rows: auto auto; gap: 0 14px; height: auto; padding: 7px 10px 7px 18px; }
  .row .ico { grid-row: span 2; }
  .row .fb { display: none; }
  .row code { font-size: 12.5px; line-height: 1.5; }
  .quote.is-collapsed .rows { max-height: 620px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
