/* GitHub-тренды — брендбук Royalty Analytics: чёрное поле, сетка, красное свечение, хром. */
:root {
  --bg: #070707;
  --ink: #f3f3f1;
  --muted: #a3a3a0;
  --dim: #74746f;
  --line: rgba(255,255,255,.09);
  --line-strong: rgba(255,255,255,.18);
  --glass: rgba(255,255,255,.04);
  --glass-strong: rgba(255,255,255,.08);
  --chrome: linear-gradient(180deg, #ffffff 0%, #d9d9d9 45%, #a9a9a9 100%);
  --red: #c8141c;
  --red-soft: #ff6a70;
  --red-glow: rgba(190, 12, 20, .5);
  --radius: 14px;
  --pill: 999px;
  --w: 1160px;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: "Instrument Serif", "Iowan Old Style", "Times New Roman", Georgia, serif;
  --grid: 140px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--ink); font: 16px/1.5 var(--sans); -webkit-font-smoothing: antialiased; position: relative; overflow-x: hidden; }
body::before {
  content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(70% 45% at 50% 108%, var(--red-glow), transparent 70%),
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px),
    var(--bg);
  background-size: auto, var(--grid) var(--grid), var(--grid) var(--grid), auto;
  background-position: center, -1px -1px, -1px -1px, 0 0;
}
a { color: inherit; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line-strong); }
a:hover { text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid var(--red-soft); outline-offset: 2px; border-radius: 6px; }
::selection { background: rgba(200, 20, 28, .55); color: #fff; }
.serif { font-family: var(--serif); font-style: italic; font-weight: 400; letter-spacing: 0; }
.wrap { width: 100%; max-width: var(--w); margin: 0 auto; padding: 0 20px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -9999px; top: 8px; }
.skip:focus { left: 16px; z-index: 50; background: var(--ink); color: var(--bg); padding: 8px 12px; border-radius: 8px; }

/* шапка */
.top { position: sticky; top: 0; z-index: 20; background: rgba(7,7,7,.78); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.top-in { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; }
.logo { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.logo span { display: flex; flex-direction: column; line-height: 1.1; }
.logo b { font-weight: 700; font-size: 16px; letter-spacing: -.01em; white-space: nowrap; }
.l-short { display: none; }
.logo small { color: var(--dim); font-size: 12px; }
.top-nav { display: flex; gap: 4px; }
.top-nav a { text-decoration: none; color: var(--muted); font-size: 14px; padding: 8px 12px; border-radius: var(--pill); white-space: nowrap; }
.top-nav a:hover, .top-nav a[aria-current] { color: var(--ink); background: var(--glass-strong); }

/* первый экран */
.hero { padding: 44px 0 20px; }
.crumbs { display: flex; flex-wrap: wrap; gap: 8px; font-size: 13px; color: var(--dim); margin-bottom: 14px; }
.crumbs a { color: var(--muted); }
h1 { font-size: clamp(34px, 5.4vw, 64px); line-height: 1.02; letter-spacing: -.035em; font-weight: 600; margin: 0 0 16px; text-wrap: balance; hyphens: manual; max-width: 22ch; }
h1 .serif { font-size: 1.08em; color: #e9e9e6; }
.h1-lang { display: inline-block; font-size: .5em; vertical-align: middle; letter-spacing: -.01em; padding: .15em .55em; border: 1px solid var(--line-strong); border-radius: var(--pill); background: var(--glass); }
h2 { font-size: 22px; line-height: 1.2; letter-spacing: -.015em; font-weight: 600; margin: 0 0 14px; text-wrap: balance; }
.lead { font-size: clamp(17px, 2vw, 20px); line-height: 1.45; color: #d4d4d1; max-width: 62ch; margin: 0 0 12px; text-wrap: pretty; }
.stamp { color: var(--dim); font-size: 14px; margin: 0; }
.stamp a { color: var(--muted); }

/* переключатели */
.seg, .tabs, .chips, .pager { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.seg::-webkit-scrollbar, .tabs::-webkit-scrollbar, .chips::-webkit-scrollbar { display: none; }
.seg { padding: 5px; border: 1px solid var(--line); border-radius: var(--pill); background: var(--glass); width: max-content; max-width: 100%; margin: 12px 0 14px; }
.seg a { text-decoration: none; padding: 9px 16px; border-radius: var(--pill); font-size: 15px; font-weight: 500; color: var(--muted); white-space: nowrap; }
.seg a:hover { color: var(--ink); }
.seg a[aria-current] { background: var(--chrome); color: #0a0a0a; box-shadow: 0 1px 0 rgba(255,255,255,.6) inset; }
.tabs { border-bottom: 1px solid var(--line); margin-bottom: 14px; gap: 22px; }
.tabs a { text-decoration: none; color: var(--muted); padding: 10px 0 12px; font-size: 15px; white-space: nowrap; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current] { color: var(--ink); border-color: var(--red); }
.chips { margin-bottom: 18px; flex-wrap: wrap; }
.chips a { display: inline-flex; align-items: center; gap: 7px; text-decoration: none; font-size: 13px; color: var(--muted); padding: 6px 12px; border: 1px solid var(--line); border-radius: var(--pill); white-space: nowrap; }
.chips a:hover { color: var(--ink); border-color: var(--line-strong); }
.chips a[aria-current] { color: var(--ink); border-color: var(--ink); background: var(--glass-strong); }
.chips i, .lang i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }

.note { border: 1px solid rgba(200,20,28,.45); background: rgba(200,20,28,.1); color: #ffc9cb; padding: 12px 16px; border-radius: 12px; font-size: 14px; margin: 0 0 16px; }
.empty { color: var(--muted); padding: 40px 0; }
.hint { color: var(--dim); font-size: 13px; margin: 10px 0 0; }

/* список */
.list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.row {
  display: grid; grid-template-columns: 44px 40px minmax(0, 1fr) 120px 150px; gap: 0 16px; align-items: center;
  padding: 16px 12px; border-bottom: 1px solid var(--line); transition: background .15s ease;
}
.row:hover { background: var(--glass); }
.rank { color: var(--dim); font-size: 15px; font-variant-numeric: tabular-nums; text-align: right; }
.ava { width: 40px; height: 40px; border-radius: 10px; background: #1a1a1a; border: 1px solid var(--line); display: block; }
.ava-lg { width: 64px; height: 64px; border-radius: 16px; }
.row-main { min-width: 0; }
.row-name { margin: 0; font-size: 17px; line-height: 1.3; font-weight: 600; letter-spacing: -.01em; overflow-wrap: break-word; min-width: 0; }
.row-name a { text-decoration: none; }
.row-name a:hover { text-decoration: underline; text-decoration-color: var(--line-strong); }
.owner { color: var(--muted); font-weight: 400; }
.row-desc { margin: 3px 0 6px; color: #c9c9c6; font-size: 14px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.facts { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--dim); font-size: 13px; }
.facts .lang { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.spark { width: 120px; height: 34px; }
.spark-l { fill: none; stroke: #e6e6e3; stroke-width: 1.5; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.spark-a { fill: rgba(200, 20, 28, .28); stroke: none; }
.gain { text-align: right; display: flex; flex-direction: column; align-items: flex-end; }
.gain b { font-size: 22px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; background: var(--chrome); -webkit-background-clip: text; background-clip: text; color: transparent; white-space: nowrap; }
.gain small { color: var(--dim); font-size: 12px; line-height: 1.3; }
.list-spikes .row { grid-template-columns: 52px 40px minmax(0, 1fr) 190px; }
.list-spikes .rank { font-size: 14px; }
.day { margin-top: 28px; }

.pager { margin: 22px 0 0; }
.pager a { text-decoration: none; color: var(--muted); border: 1px solid var(--line); border-radius: var(--pill); padding: 8px 14px; font-size: 14px; white-space: nowrap; }
.pager a[aria-current] { color: var(--ink); border-color: var(--ink); }

.explain, .block { margin: 48px 0 0; padding: 28px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--glass); }
.explain p, .prose p { color: #cfcfcc; max-width: 72ch; margin: 0 0 12px; }
.explain p:last-child { margin: 0; }
.prose h2 { margin-top: 26px; }
.prose h2:first-child { margin-top: 0; }
pre { overflow-x: auto; background: #0d0d0d; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
code { font: 14px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: #d9d9d6; }

/* страница репозитория */
.repo-head { display: flex; align-items: center; gap: 18px; margin-bottom: 14px; min-width: 0; }
.repo-head h1 { margin: 0; overflow-wrap: break-word; min-width: 0; max-width: none; font-size: clamp(28px, 4.6vw, 54px); }
.owner-line { display: block; font-size: .42em; letter-spacing: -.01em; margin-bottom: 4px; }
.lead-strong { color: var(--ink); font-weight: 500; }
.ru-long { color: #cfcfcc; font-size: 16px; line-height: 1.55; max-width: 72ch; margin: 0 0 12px; }
.orig { color: var(--dim); font-size: 14px; line-height: 1.45; max-width: 72ch; margin: 0 0 12px; }
.orig span:first-child { color: var(--muted); }

.facts-lg { font-size: 15px; gap: 6px 18px; margin: 4px 0 14px; }
.topics { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 18px; }
.topics span { font-size: 13px; color: var(--muted); border: 1px solid var(--line); border-radius: var(--pill); padding: 4px 10px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0 0; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 46px; padding: 0 22px; border-radius: var(--pill);
  background: var(--chrome); color: #0a0a0a; border: 1px solid rgba(255,255,255,.7); font: 600 15px/1 var(--sans); text-decoration: none; white-space: nowrap;
  box-shadow: 0 1px 0 rgba(255,255,255,.6) inset, 0 8px 24px rgba(0,0,0,.45);
}
.btn:hover { filter: brightness(1.05); }
.btn-ghost { background: var(--glass); color: var(--ink); border-color: var(--line-strong); box-shadow: none; }
.gains { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.gains li { border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 4px; background: rgba(0,0,0,.25); }
.g-period { color: var(--dim); font-size: 13px; }
.gains b { font-size: 22px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.g-rank { font-size: 13px; color: var(--muted); }
.block .note { margin: 16px 0 0; }
.chart-wrap { overflow: hidden; }
.chart { width: 100%; height: auto; display: block; }
.chart .bar { fill: #dcdcd9; }
.chart .bar:hover { fill: var(--red-soft); }
.chart .bar-nodata { fill: #3a3a38; }
.chart .axis { stroke: var(--line-strong); }
.chart text { fill: var(--dim); font-size: 12px; font-family: var(--sans); }
.spike-mini { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; color: #cfcfcc; }
.spike-mini time { color: var(--dim); display: inline-block; min-width: 150px; }

.foot { margin-top: 64px; border-top: 1px solid var(--line); padding: 24px 0 40px; color: var(--dim); font-size: 14px; }
.foot-in { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; }
.foot p { margin: 0; }
.foot a { color: var(--muted); }

@media (max-width: 1000px) {
  .row { grid-template-columns: 36px 40px minmax(0, 1fr) 130px; }
  .row .spark { display: none; }
}
@media (max-width: 640px) {
  .wrap { padding: 0 16px; }
  .top-in { min-height: 56px; }
  .logo small { display: none; }
  .logo svg { width: 26px; height: 26px; }
  .l-full { display: none; }
  .l-short { display: inline; }
  .chips { flex-wrap: nowrap; margin-right: -16px; padding-right: 16px; }
  .row { position: relative; }
  .row .rank { position: absolute; left: -2px; top: 8px; z-index: 1; font-size: 11px; line-height: 16px; min-width: 20px; padding: 0 5px; text-align: center; color: var(--ink); background: #070707; border: 1px solid var(--line-strong); border-radius: var(--pill); }

  .top-nav { gap: 0; }
  .top-nav a { padding: 7px 8px; font-size: 13px; }
  .top-nav a[href="/about#api"] { display: none; }
  .hero { padding: 28px 0 12px; }
  .seg { width: auto; }
  .seg a { padding: 8px 13px; font-size: 14px; }
  .row, .list-spikes .row { grid-template-columns: 40px minmax(0, 1fr) auto; grid-template-areas: "ava name gain" "ava desc desc" "ava facts facts"; gap: 2px 12px; padding: 14px 4px; align-items: start; }
  .row .ava { grid-area: ava; width: 40px; height: 40px; }
  .row-main { display: contents; }
  .row-name { grid-area: name; font-size: 16px; align-self: center; }
  .row-desc { grid-area: desc; margin: 2px 0 4px; }
  .row .facts { grid-area: facts; }
  .gain { grid-area: gain; }
  .list-spikes .row { grid-template-areas: "ava time time" "ava name gain" "ava desc desc" "ava facts facts"; }
  .list-spikes .row .rank { position: static; grid-area: time; background: none; border: 0; padding: 0; min-width: 0; text-align: left; color: var(--dim); font-size: 12px; }
  .gain b { font-size: 18px; }
  .gain small { font-size: 11px; max-width: 110px; }
  .explain, .block { padding: 20px 16px; margin-top: 36px; }
  .gains { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .repo-head { gap: 12px; }
  .ava-lg { width: 48px; height: 48px; border-radius: 12px; }
  .spike-mini time { display: block; min-width: 0; }
}
@media (max-width: 380px) {
  .top-nav a[href="/about"] { display: none; }
}
