/* Перебивка: стили сайта. Только системные шрифты, без внешних файлов. */

:root {
  --paper: #eeeeeb;
  --paper-2: #e4e4e0;
  --ink: #171716;
  --ink-2: #4a4a47;
  --ink-3: #6b6b67;
  --rule: #cfcfca;
  --tally: #c8361b;
  --tally-ink: #fbfaf7;
  --frame: #1d1d1c;
  --focus: #c8361b;

  --f-display: "Bahnschrift", "DIN Alternate", "DIN Condensed", "Roboto Condensed", "Arial Narrow", sans-serif;
  --f-text: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "PT Sans", "Noto Sans", sans-serif;
  --f-mono: "Cascadia Mono", "Consolas", "SF Mono", "Menlo", "PT Mono", ui-monospace, monospace;

  --wrap: 1480px;
  --gut: clamp(16px, 3vw, 40px);
  --ease: cubic-bezier(0.22, 0.8, 0.24, 1);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #121211;
    --paper-2: #1b1b1a;
    --ink: #ecebe6;
    --ink-2: #b7b6b0;
    --ink-3: #8f8e88;
    --rule: #2e2e2c;
    --tally: #e2502f;
    --tally-ink: #121211;
    --frame: #050505;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --paper: #121211;
  --paper-2: #1b1b1a;
  --ink: #ecebe6;
  --ink-2: #b7b6b0;
  --ink-3: #8f8e88;
  --rule: #2e2e2c;
  --tally: #e2502f;
  --tally-ink: #121211;
  --frame: #050505;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 16px/1.55 var(--f-text);
  font-feature-settings: "kern", "liga";
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img, video { display: block; max-width: 100%; height: auto; }

a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { color: var(--tally); }

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

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gut); }

.skip {
  position: absolute; left: 8px; top: -60px; z-index: 30;
  background: var(--ink); color: var(--paper); padding: 8px 12px;
}
.skip:focus { top: 8px; }

/* Шапка */

.top { border-bottom: 1px solid var(--rule); }
.top .wrap { display: flex; align-items: center; gap: 28px; min-height: 64px; }

.brand {
  display: inline-flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--ink);
  font: 700 27px/1 var(--f-display); font-stretch: 85%;
  letter-spacing: -0.01em;
}
.brand:hover { color: var(--ink); }
.brand-mark { width: 12px; height: 12px; background: var(--tally); flex: none; transform: translateY(-1px); }
.brand small {
  font: 400 13px/1.2 var(--f-text); letter-spacing: 0; color: var(--ink-3);
  padding-left: 12px; border-left: 1px solid var(--rule); margin-left: 4px;
}

.nav { display: flex; gap: 24px; margin-left: auto; font-size: 15px; }
.nav a { text-decoration: none; color: var(--ink-2); padding: 6px 0; border-bottom: 2px solid transparent; }
.nav a:hover { color: var(--ink); }
.nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--tally); }

.top-search { display: flex; }
.top-search input {
  width: 190px; height: 34px; padding: 0 10px;
  border: 1px solid var(--rule); background: var(--paper-2); color: var(--ink);
  font: inherit; font-size: 14px; border-radius: 0;
}
.top-search input::placeholder { color: var(--ink-3); }

/* Типографика */

h1, h2, h3 { font-family: var(--f-display); font-weight: 700; font-stretch: 85%; letter-spacing: -0.015em; margin: 0; }
h1 { font-size: clamp(40px, 4.6vw, 70px); line-height: 1; }
h2 { font-size: clamp(28px, 3vw, 42px); line-height: 1.04; }
h3 { font-size: 22px; line-height: 1.15; font-stretch: 90%; }

.lede { font-size: 19px; line-height: 1.5; color: var(--ink-2); max-width: 46ch; margin: 22px 0 0; }
.prose { max-width: 66ch; }
.prose p, .prose ul, .prose ol { margin: 0 0 1em; }
.prose h2 { margin: 2.2em 0 0.6em; font-size: 30px; }
.prose h2:first-child { margin-top: 0; }
.prose li { margin-bottom: 0.4em; }
.mono { font-family: var(--f-mono); font-size: 0.86em; }
.muted { color: var(--ink-3); }

.btn {
  display: inline-flex; align-items: center; gap: 10px;
  min-height: 46px; padding: 0 20px;
  background: var(--ink); color: var(--paper);
  font: 600 15px/1 var(--f-text); text-decoration: none; border: 0; cursor: pointer;
  transition: background-color 0.25s var(--ease), transform 0.15s var(--ease);
}
.btn:hover { background: var(--tally); color: var(--tally-ink); }
.btn:active { transform: translateY(1px); }
.link-arrow { font-weight: 600; text-decoration: none; border-bottom: 1px solid currentColor; padding-bottom: 2px; }

/* Главная: первый экран */

.hero { padding: clamp(28px, 4vw, 56px) 0 clamp(40px, 6vw, 88px); }
.hero-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(24px, 4vw, 64px); align-items: end; }
.hero-copy { padding-bottom: 6px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 22px; align-items: center; margin-top: 34px; }
.hero-figure { margin: 0; }
.hero-frame { position: relative; aspect-ratio: 16 / 9; background: var(--frame); overflow: hidden; }
.hero-frame img, .hero-frame video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hero-frame video { opacity: 0; transition: opacity 0.8s var(--ease); }
.hero-frame video.is-on { opacity: 1; }
.hero-figure figcaption {
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding-top: 10px; font-size: 14px; color: var(--ink-3);
}
.hero-figure figcaption a { color: var(--ink); text-decoration: none; font-weight: 600; }

.counts { display: flex; gap: clamp(20px, 4vw, 56px); margin-top: 40px; padding-top: 18px; border-top: 1px solid var(--rule); }
.counts div { font-size: 14px; color: var(--ink-3); }
.counts b { display: block; font: 700 34px/1 var(--f-display); font-stretch: 85%; color: var(--ink); margin-bottom: 4px; }

/* Разделы главной */

.band { padding: clamp(48px, 7vw, 104px) 0; border-top: 1px solid var(--rule); }
.band-head { display: flex; align-items: baseline; justify-content: space-between; gap: 20px; margin-bottom: 28px; }
.band-head a { font-size: 15px; white-space: nowrap; }

.fresh { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 40px 20px; }
.fresh-side { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px 20px; align-content: start; }
.fresh-rest { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 28px 20px; }
.fresh-lead .card-title { font-size: 24px; }

/* Карточка ролика */

.card { display: block; text-decoration: none; color: var(--ink); min-width: 0; }
.card:hover { color: var(--ink); }
.card-frame { display: block; position: relative; aspect-ratio: 16 / 9; background: var(--frame); overflow: hidden; }
.card-frame img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.6s var(--ease); }
.card:hover .card-frame img { transform: scale(1.015); }
.card-frame .scrub {
  position: absolute; left: 0; bottom: 0; height: 3px; width: 25%;
  background: var(--tally); transform: translateX(0); opacity: 0;
  transition: opacity 0.2s var(--ease), transform 0.15s var(--ease);
}
.card:hover .scrub { opacity: 1; }
.card-title { display: block; margin-top: 10px; font: 600 17px/1.3 var(--f-text); }
.card:hover .card-title { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
.card-meta { display: flex; gap: 14px; margin-top: 4px; font-family: var(--f-mono); font-size: 12.5px; color: var(--ink-3); }

/* Темы на главной */

.topics { display: grid; gap: 0; }
.topic-row {
  display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); gap: 24px; align-items: center;
  padding: 18px 0; border-top: 1px solid var(--rule); text-decoration: none; color: var(--ink);
}
.topic-row:last-child { border-bottom: 1px solid var(--rule); }
.topic-row:hover { color: var(--ink); background: var(--paper-2); }
.topic-name { font: 700 clamp(30px, 3.4vw, 48px)/1 var(--f-display); font-stretch: 80%; display: flex; align-items: baseline; gap: 14px; }
.topic-name span { font: 400 14px/1 var(--f-mono); color: var(--ink-3); }
.topic-row:hover .topic-name { color: var(--tally); }
.strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.strip img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: var(--frame); }

/* Подборки */

.sets-preview { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 20px; }
.set-tile { position: relative; display: block; text-decoration: none; color: var(--ink); }
.set-tile img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: var(--frame); }
.set-tile:nth-child(2) img { aspect-ratio: 4 / 3; }
.set-tile h3 { margin-top: 14px; }
.set-tile p { margin: 6px 0 0; color: var(--ink-2); max-width: 52ch; }
.set-tile:hover h3 { color: var(--tally); }

.set { padding: clamp(36px, 5vw, 72px) 0; border-top: 1px solid var(--rule); }
.set-head { max-width: 70ch; margin-bottom: 26px; }
.set-head p { color: var(--ink-2); margin: 10px 0 0; }
.set-row { display: grid; grid-auto-flow: column; grid-auto-columns: max(240px, calc((100% - 72px) / 4.4)); gap: 18px; overflow-x: auto; padding-bottom: 12px; scroll-snap-type: x proximity; }
.set-row .card { scroll-snap-align: start; }

/* Откуда ролики */

.sources { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(24px, 5vw, 80px); }
.sources-list { margin: 0; padding: 0; list-style: none; columns: 2; column-gap: 40px; }
.sources-list li { break-inside: avoid; padding: 0 0 18px; }
.sources-list b { display: block; font-weight: 600; }
.sources-list span { color: var(--ink-3); font-size: 14px; }

/* Каталог */

.page-head { padding-top: clamp(28px, 4vw, 56px); padding-bottom: 26px; }
.page-head p { margin: 14px 0 0; color: var(--ink-2); max-width: 60ch; font-size: 17px; }
.crumbs { font-size: 14px; color: var(--ink-3); margin-bottom: 14px; }
.crumbs a { color: var(--ink-2); }

.catalog { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: clamp(24px, 3vw, 48px); padding-bottom: 96px; align-items: start; }
.filters { position: sticky; top: 16px; font-size: 15px; }
.filters[hidden] { display: none; }
.filter-more summary { display: none; }
@media (max-width: 860px) {
  .filter-more summary {
    display: flex; align-items: center; justify-content: space-between;
    min-height: 44px; padding: 0 14px; margin-bottom: 18px;
    border: 1px solid var(--ink-3); cursor: pointer; font-weight: 600; list-style: none;
  }
  .filter-more summary::-webkit-details-marker { display: none; }
  .filter-more summary::after { content: "+"; font: 400 20px/1 var(--f-mono); color: var(--ink-3); }
  .filter-more[open] summary::after { content: "\2212"; }
  .filter-more fieldset { display: inline-block; vertical-align: top; width: calc(50% - 12px); margin-right: 8px; }
}
.filters fieldset { border: 0; margin: 0 0 22px; padding: 0; }
.filters legend { font-weight: 700; margin-bottom: 8px; padding: 0; font-size: 14px; color: var(--ink-2); }
.filters label { display: flex; align-items: center; gap: 9px; padding: 4px 0; cursor: pointer; }
.filters label span { margin-left: auto; font-family: var(--f-mono); font-size: 12px; color: var(--ink-3); }
.filters input[type="checkbox"], .filters input[type="radio"] { accent-color: var(--tally); width: 16px; height: 16px; margin: 0; }
.field { display: grid; gap: 6px; margin-bottom: 22px; }
.field label { padding: 0; font-weight: 700; font-size: 14px; color: var(--ink-2); }
.field input, .field select {
  height: 42px; padding: 0 12px; width: 100%;
  border: 1px solid var(--ink-3); background: var(--paper); color: var(--ink);
  font: inherit; border-radius: 0;
}
.reset { background: none; border: 0; padding: 0; font: inherit; color: var(--ink-2); text-decoration: underline; cursor: pointer; }

.results-bar { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding-bottom: 16px; margin-bottom: 22px; border-bottom: 1px solid var(--rule); color: var(--ink-3); font-size: 14px; }
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 34px 20px; }
.grid .card[hidden] { display: none; }
.empty { padding: 40px 0; color: var(--ink-2); }
.empty[hidden] { display: none; }

/* Страница ролика */

.clip-head { padding-top: clamp(24px, 3vw, 44px); padding-bottom: 22px; }
.clip-head h1 { font-size: clamp(34px, 4.2vw, 62px); max-width: 22ch; }
.clip-sub { margin: 12px 0 0; color: var(--ink-2); font-size: 17px; }

.player { background: var(--frame); }
.player video { width: 100%; max-height: 82vh; margin: 0 auto; background: var(--frame); }
.player-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; padding: 12px 0 0; font-size: 14px; color: var(--ink-3); }
.quality { display: flex; gap: 0; border: 1px solid var(--rule); }
.quality button {
  min-width: 64px; height: 34px; padding: 0 12px; border: 0; border-left: 1px solid var(--rule);
  background: transparent; color: var(--ink-2); font: 600 13px/1 var(--f-mono); cursor: pointer;
}
.quality button:first-child { border-left: 0; }
.quality button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.quality[hidden] { display: none; }

.clip-body { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: clamp(28px, 5vw, 80px); padding-top: clamp(32px, 4vw, 56px); padding-bottom: clamp(56px, 7vw, 96px); }
.clip-body h2 { font-size: 24px; margin: 0 0 14px; font-stretch: 90%; }
.clip-desc p { margin: 0 0 1em; max-width: 62ch; font-size: 17px; }

.frames { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin: 34px 0 0; }
.frames figure { margin: 0; }
.frames img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: var(--frame); }
.frames figcaption { font-family: var(--f-mono); font-size: 12px; color: var(--ink-3); padding-top: 4px; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 30px 0 0; padding: 0; list-style: none; }
.tags a { display: inline-block; padding: 5px 10px; border: 1px solid var(--rule); text-decoration: none; font-size: 14px; color: var(--ink-2); }
.tags a:hover { border-color: var(--tally); color: var(--tally); }

.downloads { margin: 0 0 36px; padding: 0; list-style: none; border-top: 2px solid var(--ink); }
.downloads li { border-bottom: 1px solid var(--rule); }
.downloads a { display: grid; grid-template-columns: auto 1fr auto; gap: 4px 14px; align-items: baseline; padding: 14px 0; text-decoration: none; }
.downloads b { font-weight: 700; }
.downloads .dl-spec { font-family: var(--f-mono); font-size: 12.5px; color: var(--ink-3); }
.downloads .dl-size { font-family: var(--f-mono); font-size: 14px; }
.downloads a:hover b { color: var(--tally); }

.facts { display: grid; grid-template-columns: max-content 1fr; gap: 9px 20px; margin: 0 0 36px; font-size: 15px; }
.facts dt { color: var(--ink-3); }
.facts dd { margin: 0; }
.credit { padding: 18px 20px; background: var(--paper-2); font-size: 15px; }
.credit p { margin: 0 0 8px; }
.credit p:last-child { margin: 0; }
.credit .attrib { font-family: var(--f-mono); font-size: 12.5px; word-break: break-word; color: var(--ink-2); }

.more { padding: clamp(40px, 5vw, 72px) 0; border-top: 1px solid var(--rule); }
.more .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* Текстовые страницы */

.text-page { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 8fr); gap: clamp(24px, 5vw, 80px); padding-top: 8px; padding-bottom: clamp(64px, 8vw, 120px); }
.text-aside img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; background: var(--frame); }
.text-aside p { font-size: 13px; color: var(--ink-3); margin: 8px 0 0; }

.toc { position: sticky; top: 24px; align-self: start; display: grid; gap: 8px; font-size: 15px; }
.toc p { margin: 0 0 4px; font-size: 13px; color: var(--ink-3); }
.toc a { color: var(--ink-2); text-decoration: none; padding-left: 12px; border-left: 2px solid var(--rule); }
.toc a:hover { color: var(--ink); border-left-color: var(--tally); }
.lic-table { width: 100%; border-collapse: collapse; margin: 8px 0 1.4em; font-size: 15px; }
.lic-table th, .lic-table td { text-align: left; vertical-align: top; padding: 10px 12px 10px 0; border-bottom: 1px solid var(--rule); }
.lic-table th { font-size: 13px; color: var(--ink-3); font-weight: 600; }

/* 404 */

.lost { display: grid; grid-template-columns: minmax(0, 6fr) minmax(0, 6fr); gap: clamp(24px, 4vw, 64px); align-items: center; padding-top: clamp(40px, 6vw, 96px); padding-bottom: clamp(64px, 8vw, 120px); }
.lost img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: var(--frame); }
.lost-code { font: 700 15px/1 var(--f-mono); color: var(--tally); margin-bottom: 16px; }

/* Подвал */

.foot { border-top: 1px solid var(--rule); padding: 40px 0 48px; font-size: 14px; color: var(--ink-3); }
.foot .wrap:first-child { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 4fr) minmax(0, 3fr); gap: 24px; }
.foot p { margin: 0 0 6px; }
.foot .wrap + .wrap p { margin-top: 28px; font-size: 13px; }
.foot ul { list-style: none; margin: 0; padding: 0; columns: 2; }
.foot li { margin-bottom: 6px; }
.foot a { color: var(--ink-2); }
.foot .brand { font-size: 22px; margin-bottom: 10px; }

/* Узкие экраны */

@media (max-width: 1100px) {
  .fresh { grid-template-columns: minmax(0, 1fr); }
  .fresh-rest { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid, .more .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .top-search { display: none; }
}

@media (max-width: 860px) {
  .top .wrap { flex-wrap: wrap; gap: 0 20px; padding-top: 10px; }
  .brand small { display: none; }
  .nav { order: 3; width: 100%; margin: 0; gap: 18px; overflow-x: auto; padding-bottom: 4px; font-size: 15px; }
  .nav a { white-space: nowrap; }
  .hero-grid, .sources, .sets-preview, .clip-body, .text-page, .lost, .catalog { grid-template-columns: minmax(0, 1fr); }
  .hero-figure { order: -1; }
  .clip-body aside { order: -1; }
  .topic-row { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .filters { position: static; }
  .text-aside, .toc { display: none; }
  .foot .wrap:first-child { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 560px) {
  body { font-size: 16px; }
  .lede { font-size: 17px; }
  .grid, .more .grid { grid-template-columns: minmax(0, 1fr); }
  .fresh-side, .fresh-rest { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 12px; }
  .fresh-side .card-title, .fresh-rest .card-title { font-size: 15px; }
  .fresh-side .card-meta, .fresh-rest .card-meta { gap: 8px; font-size: 11.5px; }
  .fresh-lead .card-title { font-size: 19px; }
  .counts { gap: 22px; }
  .counts b { font-size: 28px; }
  .sources-list { columns: 1; }
  .frames { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .facts { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .facts dd { margin-bottom: 10px; }
  .band-head { flex-direction: column; gap: 8px; }
}

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