/* ==========================================================================
   Кирпичи — неофициальный фанатский сайт по Roblox
   Концепция вёрстки: дашборд-каталог плейсов (горизонтальные ряды карточек)
   Палитра: графит #111214 / белый + фирменный красный #F62A2A + серебро
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. ТОКЕНЫ ТЕМЫ
   -------------------------------------------------------------------------- */
:root {
  --accent:        #f62a2a;
  --accent-hover:  #ff4242;
  --accent-press:  #c81e1e;
  --accent-soft:   rgba(246, 42, 42, .12);

  --silver:        #b8bcc2;
  --silver-light:  #d9dde2;

  /* Светлая тема — по умолчанию */
  --bg:            #ffffff;
  --bg-sunken:     #f2f3f5;
  --surface:       #ffffff;
  --surface-2:     #f7f8f9;
  --surface-3:     #eceef1;
  --border:        #e3e5e8;
  --border-strong: #d2d5da;
  --text:          #16171a;
  --text-2:        #45474d;
  --text-dim:      #6b6f76;

  --shadow-1: 0 1px 2px rgba(16, 17, 20, .06), 0 2px 6px rgba(16, 17, 20, .05);
  --shadow-2: 0 4px 10px rgba(16, 17, 20, .09), 0 12px 28px rgba(16, 17, 20, .10);
  --shadow-3: 0 24px 70px rgba(16, 17, 20, .28);

  --r:    8px;   /* базовый радиус по ТЗ */
  --r-sm: 6px;
  --r-lg: 14px;

  --topbar-h: 60px;
  --side-w:   236px;
  --gutter:   clamp(16px, 3.4vw, 44px);

  --ease: cubic-bezier(.2, .7, .3, 1);
}

html[data-theme="dark"] {
  --bg:            #111214;
  --bg-sunken:     #0b0c0d;
  --surface:       #1a1c1f;
  --surface-2:     #212327;
  --surface-3:     #2a2d32;
  --border:        #2b2e33;
  --border-strong: #3a3e45;
  --text:          #f3f4f6;
  --text-2:        #c6c9cf;
  --text-dim:      #8d9299;

  --shadow-1: 0 1px 2px rgba(0, 0, 0, .5);
  --shadow-2: 0 6px 14px rgba(0, 0, 0, .45), 0 16px 40px rgba(0, 0, 0, .38);
  --shadow-3: 0 28px 80px rgba(0, 0, 0, .7);
}

/* --------------------------------------------------------------------------
   2. БАЗА
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

/* Атрибут hidden должен побеждать любые display в правилах ниже */
[hidden] { display: none !important; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}

body.is-locked { overflow: hidden; }

h1, h2, h3, h4 { margin: 0; line-height: 1.22; letter-spacing: -.015em; font-weight: 700; }
p { margin: 0 0 1em; }
img, svg { max-width: 100%; }
ul, ol { margin: 0 0 1em; padding-left: 1.2em; }
li { margin-bottom: .38em; }

a { color: inherit; text-decoration: none; }
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

code, pre { font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

.skip-link {
  position: fixed; top: -60px; left: 12px; z-index: 200;
  padding: 10px 16px; border-radius: var(--r);
  background: var(--accent); color: #fff; font-weight: 600;
  transition: top .18s var(--ease);
}
.skip-link:focus { top: 12px; }

/* --------------------------------------------------------------------------
   3. ВЕРХНЯЯ ПАНЕЛЬ (как шапка клиента Roblox)
   -------------------------------------------------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 60;
  display: flex; align-items: center; gap: 12px;
  height: var(--topbar-h);
  padding: 0 var(--gutter);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--border);
}

.brand { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.brand__logo { width: 34px; height: 34px; display: block; }
.brand__text {
  display: flex; flex-direction: column; line-height: 1.05;
}
.brand__name { font-weight: 800; font-size: 17px; letter-spacing: -.03em; }
.brand__sub {
  font-size: 10px; font-weight: 500; letter-spacing: .09em;
  text-transform: uppercase; color: var(--text-dim);
}

.search {
  position: relative; flex: 1 1 auto;
  max-width: 460px; margin: 0 auto;
}
.search__icon {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 17px; height: 17px; color: var(--text-dim); pointer-events: none;
}
.search input {
  width: 100%; height: 38px;
  padding: 0 36px 0 36px;
  font: inherit; font-size: 14px;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  transition: border-color .15s var(--ease), background .15s var(--ease);
}
.search input::placeholder { color: var(--text-dim); }
.search input:focus { border-color: var(--accent); background: var(--surface); outline: none; }
.search input::-webkit-search-cancel-button { display: none; }
.search__clear {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 26px; height: 26px; display: grid; place-items: center;
  border: 0; border-radius: 50%; cursor: pointer;
  background: var(--surface-3); color: var(--text-2);
}
.search__clear svg { width: 13px; height: 13px; }

.topbar__actions { display: flex; align-items: center; gap: 6px; margin-left: auto; flex-shrink: 0; }

.icon-btn {
  width: 38px; height: 38px; flex-shrink: 0;
  display: grid; place-items: center;
  background: transparent; color: var(--text-2);
  border: 1px solid transparent; border-radius: var(--r);
  cursor: pointer; transition: background .15s var(--ease), color .15s var(--ease);
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn svg { width: 20px; height: 20px; }

.nav-toggle { display: none; }
html[data-theme="dark"] .icon-theme .i-moon { display: none; }
html:not([data-theme="dark"]) .icon-theme .i-sun { display: none; }

/* --------------------------------------------------------------------------
   4. КАРКАС: боковое меню + рабочая область
   -------------------------------------------------------------------------- */
.shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); }

.sidenav {
  /* max-height, а не height: иначе на высоком окне колонка растягивает
     всю сетку и подвал уезжает вниз с пустой полосой */
  position: sticky; top: var(--topbar-h); align-self: start;
  max-height: calc(100vh - var(--topbar-h));
  padding: 18px 14px 24px;
  overflow-y: auto;
  display: flex; flex-direction: column; gap: 6px;
}
.sidenav__label {
  font-size: 10.5px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--text-dim);
  padding: 14px 10px 6px;
}
.navlink {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 11px; border-radius: var(--r);
  font-size: 14px; font-weight: 500; color: var(--text-2);
  cursor: pointer; border: 0; background: none; width: 100%; text-align: left;
  font-family: inherit;
  transition: background .14s var(--ease), color .14s var(--ease);
}
.navlink svg { width: 19px; height: 19px; flex-shrink: 0; color: var(--text-dim); }
.navlink:hover { background: var(--surface-2); color: var(--text); }
.navlink:hover svg { color: var(--text-2); }
.navlink.is-active {
  background: var(--accent-soft); color: var(--accent); font-weight: 600;
}
.navlink.is-active svg { color: var(--accent); }

.sidenav__note {
  margin: auto 10px 0; padding-top: 18px;
  font-size: 11.5px; line-height: 1.5; color: var(--text-dim);
  border-top: 1px solid var(--border);
}

.scrim {
  position: fixed; inset: 0; z-index: 61;
  background: rgba(0, 0, 0, .5);
  opacity: 0; pointer-events: none;
  transition: opacity .2s var(--ease);
}
.scrim.is-on { opacity: 1; pointer-events: auto; }

.workspace { padding: 22px var(--gutter) 60px; min-width: 0; border-left: 1px solid var(--border); }

/* --------------------------------------------------------------------------
   5. СПОТЛАЙТ — не «геройский блок», а широкая плитка каталога
   -------------------------------------------------------------------------- */
.spotlight {
  position: relative; overflow: hidden;
  display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
  min-height: 268px;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-1);
}
.spotlight__text { padding: 30px clamp(20px, 3vw, 38px); display: flex; flex-direction: column; justify-content: center; }
.spotlight__kicker {
  display: inline-flex; align-items: center; gap: 7px; align-self: flex-start;
  padding: 5px 11px; margin-bottom: 14px;
  border-radius: 999px; background: var(--accent-soft); color: var(--accent);
  font-size: 11.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
}
.spotlight__kicker svg { width: 14px; height: 14px; }
.spotlight h1 {
  font-size: clamp(23px, 3.1vw, 36px); font-weight: 800;
  letter-spacing: -.03em; margin-bottom: 12px;
}
.spotlight p { color: var(--text-2); max-width: 46ch; font-size: 15px; }
.spotlight__cta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; }

.spotlight__art {
  position: relative; min-height: 220px;
  background:
    radial-gradient(120% 120% at 78% 22%, rgba(246, 42, 42, .55) 0%, transparent 58%),
    linear-gradient(140deg, #2c2f36 0%, #16171a 100%);
}
.spotlight__pic {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover; display: block;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 20px;
  font: inherit; font-size: 14.5px; font-weight: 600;
  border-radius: var(--r); border: 1px solid transparent;
  cursor: pointer; white-space: nowrap;
  transition: background .15s var(--ease), transform .12s var(--ease), border-color .15s var(--ease);
}
.btn svg { width: 17px; height: 17px; }
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--accent); color: #fff; box-shadow: 0 2px 8px rgba(246, 42, 42, .28); }
.btn--primary:hover { background: var(--accent-hover); }
.btn--ghost { background: var(--surface-2); color: var(--text); border-color: var(--border-strong); }
.btn--ghost:hover { background: var(--surface-3); }

/* --------------------------------------------------------------------------
   6. ФИЛЬТР-ЧИПСЫ
   -------------------------------------------------------------------------- */
.chips {
  display: flex; gap: 8px; flex-wrap: wrap;
  margin: 26px 0 4px;
}
.chip {
  padding: 7px 15px; font: inherit; font-size: 13.5px; font-weight: 600;
  color: var(--text-2); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 999px;
  cursor: pointer; transition: all .14s var(--ease);
}
.chip:hover { border-color: var(--border-strong); color: var(--text); }
.chip.is-active { background: var(--accent); border-color: var(--accent); color: #fff; }

.result-line {
  margin: 14px 0 0; font-size: 13.5px; color: var(--text-dim);
}
.empty-state {
  margin: 40px 0; padding: 40px 24px; text-align: center;
  border: 1px dashed var(--border-strong); border-radius: var(--r-lg);
  color: var(--text-dim);
}
.empty-state svg { width: 34px; height: 34px; margin-bottom: 10px; color: var(--text-dim); }
.empty-state b { display: block; color: var(--text); font-size: 16px; margin-bottom: 4px; }

/* --------------------------------------------------------------------------
   7. РЯДЫ КАРТОЧЕК — ядро концепции
   -------------------------------------------------------------------------- */
.row { margin-top: 30px; position: relative; }
.row__head {
  display: flex; align-items: baseline; gap: 10px;
  margin-bottom: 12px; padding-right: 84px;
}
.row__title { font-size: 17.5px; font-weight: 700; letter-spacing: -.02em; }
.row__hint { font-size: 12.5px; color: var(--text-dim); }

.row__nav {
  position: absolute; top: -4px; right: 0;
  display: flex; gap: 6px;
}
.row__arrow {
  width: 30px; height: 30px; display: grid; place-items: center;
  border-radius: var(--r-sm); cursor: pointer;
  background: var(--surface-2); color: var(--text-2);
  border: 1px solid var(--border);
  transition: all .14s var(--ease);
}
.row__arrow:hover:not(:disabled) { background: var(--accent); border-color: var(--accent); color: #fff; }
.row__arrow:disabled { opacity: .32; cursor: default; }
.row__arrow svg { width: 15px; height: 15px; }
.row__arrow--prev svg { transform: rotate(180deg); }

.row__track {
  display: flex; gap: 14px;
  overflow-x: auto; overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  scroll-padding-left: 2px;
  padding: 3px 2px 12px;
  scrollbar-width: none;
}
.row__track::-webkit-scrollbar { display: none; }

/* --------------------------------------------------------------------------
   8. КАРТОЧКА ПЛЕЙСА
   -------------------------------------------------------------------------- */
.card {
  flex: 0 0 232px; scroll-snap-align: start;
  display: flex; flex-direction: column;
  border-radius: var(--r); background: transparent;
  transition: transform .16s var(--ease);
}
.card:hover { transform: translateY(-3px); }
.card:hover .card__thumb { box-shadow: var(--shadow-2); }
.card:hover .card__title { color: var(--accent); }

.card__thumb {
  position: relative; overflow: hidden;
  aspect-ratio: 16 / 10;
  border-radius: var(--r);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-1);
  display: grid; place-items: center;
  transition: box-shadow .18s var(--ease);
}
.card__pic {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover; display: block;
}
.card__badge {
  position: absolute; z-index: 2; left: 8px; top: 8px;
  padding: 3px 8px; border-radius: 999px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .03em;
  color: #fff; background: rgba(10, 11, 13, .62);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.card__badge--accent { background: var(--accent); }

.card__body { padding: 10px 2px 0; }
.card__title {
  display: block; font-size: 14.5px; font-weight: 600; line-height: 1.32;
  transition: color .14s var(--ease);
}
.card__meta {
  display: block; margin-top: 4px;
  font-size: 12px; color: var(--text-dim);
}

/* Цветовые схемы обложек (заглушки под скриншоты плейсов) */
.t-red    { background: linear-gradient(140deg, #f62a2a 0%, #7c1111 100%); }
.t-steel  { background: linear-gradient(140deg, #545a63 0%, #23262b 100%); }
.t-indigo { background: linear-gradient(140deg, #4d5bd6 0%, #1b1f45 100%); }
.t-teal   { background: linear-gradient(140deg, #159c8b 0%, #0c3b39 100%); }
.t-amber  { background: linear-gradient(140deg, #e08a12 0%, #6b3607 100%); }
.t-violet { background: linear-gradient(140deg, #8546d4 0%, #331a52 100%); }
.t-night  { background: linear-gradient(140deg, #2b3350 0%, #0b0d16 100%); }

/* --------------------------------------------------------------------------
   9. РЕЖИМ ФИЛЬТРАЦИИ: ряды превращаются в сетку
   -------------------------------------------------------------------------- */
.workspace.is-filtering .row__track {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(212px, 1fr));
  overflow: visible;
}
.workspace.is-filtering .card { flex: initial; }
.workspace.is-filtering .row__nav,
.workspace.is-filtering .row__hint,
.workspace.is-filtering .spotlight { display: none; }
.card[hidden], .row[hidden] { display: none; }

/* --------------------------------------------------------------------------
   10. СТРАНИЦА СТАТЬИ
   -------------------------------------------------------------------------- */
.article { min-width: 0; }

.article__hero {
  position: relative; overflow: hidden;
  height: clamp(180px, 25vw, 290px);
  margin: 4px 0 26px;
  border-radius: var(--r-lg);
}
.article__pic {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover; display: block;
}

/* Иллюстрация внутри текста статьи */
.fig { margin: 26px 0; }
.fig img {
  display: block; width: 100%; height: auto;
  border: 1px solid var(--border); border-radius: var(--r);
}
.fig figcaption {
  margin-top: 9px; font-size: 12.8px; line-height: 1.5; color: var(--text-dim);
}
.article__title {
  font-size: clamp(24px, 3.4vw, 34px); font-weight: 800;
  letter-spacing: -.03em; line-height: 1.18;
}

.meta-tags { display: flex; flex-wrap: wrap; gap: 7px; margin: 14px 0 26px; }
.tag {
  padding: 4px 11px; border-radius: 999px;
  font-size: 12px; font-weight: 600;
  background: var(--surface-2); color: var(--text-2);
  border: 1px solid var(--border);
}
.tag--accent { background: var(--accent-soft); color: var(--accent); border-color: transparent; }

.related { margin-top: 48px; padding-top: 30px; border-top: 1px solid var(--border); }
.related__title { font-size: 18px; font-weight: 700; letter-spacing: -.02em; margin-bottom: 16px; }
.related__grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}
.related .card { flex: initial; }

/* --------------------------------------------------------------------------
   11. ТИПОГРАФИКА СТАТЕЙ
   -------------------------------------------------------------------------- */
.prose { font-size: 15.3px; line-height: 1.72; color: var(--text-2); }
.prose > *:last-child { margin-bottom: 0; }
.prose h3 {
  margin: 30px 0 12px; font-size: 18px; font-weight: 700; color: var(--text);
  letter-spacing: -.02em;
}
.prose h4 { margin: 22px 0 8px; font-size: 15.5px; font-weight: 700; color: var(--text); }
.prose strong, .prose b { color: var(--text); font-weight: 600; }
.prose a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.prose .lead { font-size: 16.5px; line-height: 1.62; color: var(--text); }
.prose ul, .prose ol { padding-left: 1.25em; }
.prose li::marker { color: var(--accent); font-weight: 600; }
.prose hr { border: 0; border-top: 1px solid var(--border); margin: 28px 0; }

.prose dl { margin: 0 0 1em; }
.prose dt { font-weight: 700; color: var(--text); margin-top: 12px; }
.prose dd { margin: 2px 0 0; padding-left: 0; }

.callout {
  display: flex; gap: 12px; align-items: flex-start;
  margin: 20px 0; padding: 14px 16px;
  border-radius: var(--r); border: 1px solid var(--border);
  background: var(--surface-2); font-size: 14.4px; line-height: 1.62;
}
.callout svg { width: 19px; height: 19px; flex-shrink: 0; margin-top: 2px; }
.callout p:last-child { margin-bottom: 0; }
.callout--tip   { border-left: 3px solid #159c8b; }
.callout--tip svg   { color: #159c8b; }
.callout--warn  { border-left: 3px solid var(--accent); background: var(--accent-soft); }
.callout--warn svg  { color: var(--accent); }
.callout--info  { border-left: 3px solid var(--silver); }
.callout--info svg  { color: var(--text-dim); }

.prose pre {
  margin: 16px 0; padding: 14px 16px;
  background: #16171a; color: #e6e8ec;
  border: 1px solid #2b2e33; border-radius: var(--r);
  overflow-x: auto; font-size: 13px; line-height: 1.6;
}
html:not([data-theme="dark"]) .prose pre { background: #1a1c1f; }
.prose pre code { color: inherit; background: none; padding: 0; }
.prose :not(pre) > code {
  padding: 2px 6px; border-radius: var(--r-sm);
  background: var(--surface-3); color: var(--text);
  font-size: .89em;
}
.code-label {
  display: block; margin: 16px 0 -8px;
  font-size: 12px; font-weight: 600; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: .06em;
}

.steps { list-style: none; padding: 0; counter-reset: s; margin: 18px 0; }
.steps > li {
  counter-increment: s; position: relative;
  padding: 0 0 2px 42px; margin-bottom: 18px;
}
.steps > li::before {
  content: counter(s);
  position: absolute; left: 0; top: 0;
  width: 28px; height: 28px; display: grid; place-items: center;
  border-radius: var(--r-sm);
  background: var(--accent); color: #fff;
  font-size: 13.5px; font-weight: 700;
}
.steps > li > b, .steps > li > strong { display: block; color: var(--text); margin-bottom: 3px; }

.entry {
  margin: 22px 0; padding: 18px 20px;
  border: 1px solid var(--border); border-radius: var(--r);
  background: var(--surface-2);
}
.entry__head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.entry__num {
  width: 26px; height: 26px; flex-shrink: 0; display: grid; place-items: center;
  border-radius: var(--r-sm); background: var(--accent); color: #fff;
  font-size: 13px; font-weight: 700;
}
.entry__name { font-size: 16.5px; font-weight: 700; color: var(--text); }
.entry__genre { font-size: 12px; color: var(--text-dim); margin-left: auto; }
.entry p:last-child { margin-bottom: 0; }


/* --------------------------------------------------------------------------
   12. ПОДВАЛ
   -------------------------------------------------------------------------- */
.footer {
  margin-top: 10px; padding: 44px var(--gutter) 34px;
  border-top: 1px solid var(--border);
  background: var(--bg-sunken);
}
.footer__grid {
  display: grid; grid-template-columns: minmax(0, 1.6fr) repeat(3, minmax(0, 1fr));
  gap: 30px; max-width: 1400px;
}
.footer h4 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-dim); margin-bottom: 12px; font-weight: 700; }
.footer p { font-size: 13.6px; color: var(--text-2); }
.footer ul { list-style: none; padding: 0; margin: 0; font-size: 13.8px; }
.footer li { margin-bottom: 8px; }
.footer a { color: var(--text-2); }
.footer a:hover { color: var(--accent); }
.footer__brand { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }

.footer__legal {
  margin-top: 34px; padding-top: 22px;
  border-top: 1px solid var(--border);
}
.disclaimer {
  font-size: 12.4px; line-height: 1.65; color: var(--text-dim);
  max-width: 108ch;
}
.footer__copy { font-size: 12.6px; color: var(--text-dim); margin-top: 14px; }

/* --------------------------------------------------------------------------
   13. COOKIE-ПЛАШКА
   -------------------------------------------------------------------------- */
.cookie {
  /* Справа, чтобы не перекрывать боковое меню каталога */
  position: fixed; z-index: 140; right: 16px; bottom: 16px;
  width: min(430px, calc(100vw - 32px));
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--r-lg);
  box-shadow: var(--shadow-3);
  animation: slide-up .28s var(--ease);
}
.cookie[hidden] { display: none; }
@keyframes slide-up { from { opacity: 0; transform: translateY(14px); } }
.cookie__head { display: flex; align-items: center; gap: 9px; margin-bottom: 8px; }
.cookie__head svg { width: 19px; height: 19px; color: var(--accent); }
.cookie__head b { font-size: 15px; }
.cookie p { font-size: 13.2px; line-height: 1.55; color: var(--text-2); margin-bottom: 14px; }
.cookie a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.cookie__row { display: flex; gap: 9px; flex-wrap: wrap; }
.cookie .btn { height: 38px; padding: 0 16px; font-size: 13.5px; }

/* --------------------------------------------------------------------------
   14. ЮРИДИЧЕСКИЕ СТРАНИЦЫ
   -------------------------------------------------------------------------- */
.doc-wrap {
  display: grid; grid-template-columns: 236px minmax(0, 1fr);
  gap: clamp(24px, 4vw, 56px);
  max-width: 1180px; margin: 0 auto;
  padding: 34px var(--gutter) 70px;
}
.toc { position: sticky; top: calc(var(--topbar-h) + 24px); align-self: start; font-size: 13.4px; }
.toc b { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .09em; color: var(--text-dim); margin-bottom: 10px; }
.toc ol { list-style: none; padding: 0; margin: 0; counter-reset: t; }
.toc li { counter-increment: t; margin-bottom: 2px; }
.toc a {
  display: block; padding: 6px 10px; border-radius: var(--r-sm);
  color: var(--text-2); line-height: 1.4;
}
.toc a::before { content: counter(t) ". "; color: var(--text-dim); }
.toc a:hover { background: var(--surface-2); color: var(--text); }

.doc { min-width: 0; }
.doc__crumbs { font-size: 13px; color: var(--text-dim); margin-bottom: 14px; }
.doc__crumbs a { color: var(--accent); }
.doc h1 { font-size: clamp(26px, 4vw, 36px); font-weight: 800; letter-spacing: -.03em; margin-bottom: 10px; }
.doc__date { font-size: 13.4px; color: var(--text-dim); margin-bottom: 30px; }
.doc section { margin-bottom: 30px; scroll-margin-top: calc(var(--topbar-h) + 20px); }
.doc h2 {
  font-size: 19px; font-weight: 700; margin-bottom: 12px;
  letter-spacing: -.02em; display: flex; gap: 10px;
}
.doc h2 .n { color: var(--accent); flex-shrink: 0; }
.doc p, .doc li { font-size: 14.8px; line-height: 1.72; color: var(--text-2); }
.doc strong { color: var(--text); font-weight: 600; }
.doc a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.doc ul, .doc ol { padding-left: 1.3em; }

.doc-note {
  padding: 16px 18px; margin: 22px 0;
  border: 1px solid var(--border); border-left: 3px solid var(--accent);
  border-radius: var(--r); background: var(--surface-2);
  font-size: 14.2px; line-height: 1.65;
}
.doc-note p:last-child { margin-bottom: 0; }

/* --------------------------------------------------------------------------
   15. АДАПТИВ
   -------------------------------------------------------------------------- */
@media (max-width: 1180px) {
  :root { --side-w: 214px; }
  .spotlight { grid-template-columns: minmax(0, 1fr); }
  .spotlight__art { min-height: 150px; order: -1; }
}

@media (max-width: 960px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .workspace { border-left: 0; }
  .nav-toggle { display: grid; }
  .brand__sub { display: none; }

  .sidenav {
    /* Выше шапки: выдвижная панель должна перекрывать её целиком */
    position: fixed; z-index: 62; left: 0; top: 0;
    width: 268px; height: 100dvh; max-height: none;
    padding: 16px 14px 24px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    transform: translateX(-102%);
    transition: transform .24s var(--ease);
    box-shadow: var(--shadow-3);
  }
  .sidenav.is-open { transform: none; }

  .footer__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 26px; }
  .doc-wrap { grid-template-columns: minmax(0, 1fr); }
  .toc { position: static; padding-bottom: 18px; border-bottom: 1px solid var(--border); }
  .toc ol { columns: 2; column-gap: 18px; }
  #toc ol { columns: 1; }   /* оглавление статьи: заголовки длинные */
}

@media (max-width: 720px) {
  body { font-size: 14.5px; }

  /* На узком экране поиск не помещается в одну строку с логотипом —
     переносим его на вторую строку шапки */
  .topbar { flex-wrap: wrap; height: auto; gap: 8px; padding: 9px 14px; }
  .search { order: 3; flex: 1 0 100%; max-width: none; margin: 0; }
  .brand { margin-right: auto; }
  .brand__name { font-size: 16px; }
  .workspace { padding: 16px 14px 46px; }
  .row__hint { display: none; }

  .card { flex: 0 0 66vw; }
  .row__track { gap: 11px; }
  .row__nav { display: none; }
  .row__head { padding-right: 0; }
  .workspace.is-filtering .row__track { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }

  .spotlight__text { padding: 22px 18px 26px; }
  .spotlight__cta .btn { flex: 1 1 auto; }

  .footer__grid { grid-template-columns: minmax(0, 1fr); }
  .cookie { left: 10px; right: 10px; bottom: 10px; width: auto; padding: 16px; }
  .toc ol { columns: 1; }
  .entry { padding: 15px 16px; }
}

@media (hover: none) {
  .row__nav { display: none; }
  .card:hover { transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* Печать */
@media print {
  .topbar, .sidenav, .cookie, .row__nav, .chips, .toc, .related { display: none !important; }
  body { background: #fff; color: #000; }
}

/* --------------------------------------------------------------------------
   16. ИСХОДНИКИ СТАТЕЙ (в DOM ради индексации, скрыты через CSS).
       Если JS отключён — раскрываются как обычные статьи (см. <noscript>).
   -------------------------------------------------------------------------- */
.library { display: none; }
.library-fallback {
  display: block; max-width: 820px; margin: 0 auto; padding: 30px var(--gutter) 60px;
}
.library-fallback .src {
  padding-bottom: 30px; margin-bottom: 30px; border-bottom: 1px solid var(--border);
}
.library-fallback .src > h2 { font-size: 24px; margin-bottom: 16px; }
