/* Behind the Peg — site styles (landing + archive).
   Цвета — только var(--*) из tokens.css; сетка кратна 4px; радиусы 0. */

* { box-sizing: border-box; }
html { -webkit-font-smoothing: antialiased; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--paper); color: var(--ink); overflow-x: clip;
  font-family: 'IBM Plex Sans', system-ui, sans-serif;
  font-size: 16px; line-height: 1.6;
}
a { color: var(--ink); text-decoration: none; }
a:hover { color: var(--green-2); }
::selection { background: var(--green); color: var(--paper); }

@keyframes btp-blink { 0%, 55% { opacity: 1 } 56%, 100% { opacity: 0 } }
@keyframes btp-ticker { from { transform: translateX(0) } to { transform: translateX(-50%) } }

.mono { font-family: 'IBM Plex Mono', monospace; }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 40px; }

h1, h2, h3 {
  font-family: 'Handjet', monospace; font-weight: 700;
  text-transform: uppercase; margin: 0;
}

/* ---------- header ---------- */
.site-header {
  border-bottom: 2px solid var(--ink); position: sticky; top: 0;
  background: var(--paper); z-index: 20;
}
.site-header .in {
  max-width: 1200px; margin: 0 auto; padding: 14px 40px;
  display: flex; align-items: center; gap: 24px;
}
.site-header .logo-link { display: inline-flex; flex: none; }
.site-header .site-nav { margin-left: auto; }
.site-nav {
  display: flex; gap: 24px; align-items: center; flex-wrap: wrap;
  font-family: 'IBM Plex Mono', monospace; font-size: 11px;
  letter-spacing: .14em; text-transform: uppercase;
}
.site-nav a.active { border-bottom: 2px solid var(--green); }
.lang-switch { display: flex; }
.lang-switch a {
  font-family: 'IBM Plex Mono', monospace; font-size: 11px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--ink);
  border: 2px solid var(--ink); padding: 7px 10px;
}
.lang-switch a + a { border-left: none; }
.lang-switch a.active { background: var(--ink); color: var(--paper); }
.lang-switch a:not(.active):hover { color: var(--green-2); }
.btn-theme {
  font-family: 'IBM Plex Mono', monospace; font-size: 11px; letter-spacing: .14em;
  text-transform: uppercase; background: transparent; color: var(--ink);
  border: 2px solid var(--ink); padding: 7px 10px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px;
}
.btn-theme::before { content: ""; width: 10px; height: 10px; background: var(--ink); flex: none; }
.btn-theme:hover { box-shadow: 3px 3px 0 var(--green); }
.btn-menu { display: none; }

/* ---------- ticker ---------- */
.ticker {
  background: var(--ink); color: var(--paper); overflow: hidden; height: 40px;
  display: flex; align-items: center; border-bottom: 2px solid var(--ink);
}
.ticker-track {
  display: flex; width: max-content; animation: btp-ticker 30s linear infinite;
  font-family: 'IBM Plex Mono', monospace; font-size: 11px;
  letter-spacing: .16em; text-transform: uppercase; white-space: nowrap;
}
.ticker-track > div { display: flex; gap: 36px; padding-right: 36px; }
.ticker .up { color: var(--green); }
.ticker .down { color: var(--red); }

/* ---------- hero ---------- */
.hero {
  max-width: 1200px; margin: 0 auto; padding: 88px 40px 64px;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(460px, 100%), 1fr));
  gap: 64px; align-items: start;
}
.hero-left { display: flex; flex-direction: column; gap: 32px; min-width: 0; }
.hero-tagline {
  font-family: 'Handjet', monospace; font-size: 38px; line-height: 1.05;
  font-weight: 700; text-transform: uppercase; max-width: 20ch;
}
.hero-sub { margin: 0; font-size: 19px; line-height: 1.55; max-width: 52ch; color: var(--ink-2); text-wrap: pretty; }
.hero-cta { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; }

.btn {
  font-family: 'IBM Plex Mono', monospace; font-size: 13px; letter-spacing: .1em;
  text-transform: uppercase; padding: 14px 24px; display: inline-block; cursor: pointer;
}
.btn-primary {
  background: var(--ink); color: var(--paper); border: 2px solid var(--ink);
  box-shadow: 4px 4px 0 var(--green);
}
.btn-primary:hover { box-shadow: 0 0 0 var(--green); transform: translate(4px, 4px); color: var(--paper); }
.btn-ghost { border: 2px solid var(--ink); color: var(--ink); }
.btn-ghost:hover { box-shadow: 4px 4px 0 var(--ink); color: var(--ink); }

/* issue card (hero) */
.issue-card { border: 2px solid var(--ink); box-shadow: 8px 8px 0 var(--ink); }
.issue-card .bar {
  background: var(--ink); color: var(--paper); padding: 12px 18px;
  display: flex; justify-content: space-between;
  font-family: 'IBM Plex Mono', monospace; font-size: 11px;
  letter-spacing: .14em; text-transform: uppercase;
}
.issue-card .bar .fresh { color: var(--green); }
.issue-card .body {
  padding: 28px 24px; display: flex; flex-direction: column; gap: 20px;
  background-image: linear-gradient(45deg, var(--paper-2) 25%, transparent 25%, transparent 75%, var(--paper-2) 75%);
  background-size: 8px 8px;
}
.issue-card .kicker {
  font-family: 'IBM Plex Mono', monospace; font-size: 11px;
  letter-spacing: .16em; text-transform: uppercase; color: var(--grey);
}
.issue-card h2 { font-size: 52px; line-height: 1.02; }
.issue-card .points { display: flex; flex-direction: column; gap: 8px; font-size: 15px; line-height: 1.5; color: var(--ink-2); }
.issue-card .points > div { display: flex; gap: 10px; }
.issue-card .points .sq { flex: none; width: 10px; height: 10px; background: var(--ink); margin-top: 6px; }
.issue-card .meta {
  display: flex; gap: 16px; flex-wrap: wrap;
  font-family: 'IBM Plex Mono', monospace; font-size: 11px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--grey);
  border-top: 2px solid var(--rule-2); padding-top: 14px;
}

/* ---------- stats band ---------- */
.stats { border-top: 2px solid var(--ink); border-bottom: 2px solid var(--ink); background: var(--paper); }
.stats .grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.stats .cell { padding: 24px 16px; border-right: 2px solid var(--rule); }
.stats .cell:last-child { border-right: none; }
.stats .label {
  font-family: 'IBM Plex Mono', monospace; font-size: 10px;
  letter-spacing: .14em; text-transform: uppercase; color: var(--grey);
}
.stats .value { font-family: 'Handjet', monospace; font-size: 40px; line-height: 1.1; font-weight: 700; }

/* ---------- layers ---------- */
.layers { max-width: 1200px; margin: 0 auto; padding: 88px 40px; display: flex; flex-direction: column; gap: 40px; scroll-margin-top: 80px; }
.layers h2 { font-size: 56px; line-height: 1.05; max-width: 20ch; }
.layers .grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 2px; background: var(--ink); border: 2px solid var(--ink);
}
.layers .cell { background: var(--paper); padding: 28px; display: flex; flex-direction: column; gap: 16px; }
.layers .icon { width: 48px; height: 48px; position: relative; }
.layers .icon i { position: absolute; background: var(--ink); }
.layers h3 { font-size: 30px; }
.layers p { margin: 0; font-size: 15px; line-height: 1.55; color: var(--ink-2); }

/* ---------- download slab ---------- */
.download { border-top: 2px solid var(--ink); background: var(--ink); color: var(--paper); scroll-margin-top: 80px; }
.download .in {
  max-width: 1200px; margin: 0 auto; padding: 80px 40px;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr));
  gap: 48px; align-items: center;
}
.download .kicker {
  font-family: 'IBM Plex Mono', monospace; font-size: 11px;
  letter-spacing: .16em; text-transform: uppercase; color: var(--green);
}
.download h2 { font-size: 60px; line-height: 1.02; max-width: 16ch; }
.download p { margin: 0; font-size: 17px; line-height: 1.55; color: var(--rule-2); max-width: 50ch; }
.download a { color: var(--paper); }
.dl-panel { border: 2px solid var(--paper); padding: 28px; display: flex; flex-direction: column; gap: 14px; background: var(--ink); }
.dl-panel .head {
  font-family: 'IBM Plex Mono', monospace; font-size: 11px;
  letter-spacing: .14em; text-transform: uppercase; color: var(--rule-2);
}
.dl-btn {
  font-family: 'IBM Plex Mono', monospace; font-size: 13px; letter-spacing: .1em;
  text-transform: uppercase; padding: 14px; text-align: center; font-weight: 600;
  display: flex; justify-content: space-between; gap: 12px;
}
.dl-btn.green { background: var(--green); color: var(--on-accent); border: 2px solid var(--green); box-shadow: 4px 4px 0 var(--paper); }
.dl-btn.green:hover { box-shadow: 0 0 0 var(--paper); transform: translate(4px, 4px); color: var(--on-accent); }
.dl-btn.line { border: 2px solid var(--paper); color: var(--paper); }
.dl-btn.line:hover { box-shadow: 4px 4px 0 var(--paper); color: var(--paper); }
.dl-panel .note {
  font-family: 'IBM Plex Mono', monospace; font-size: 10px; line-height: 1.7;
  color: var(--grey); letter-spacing: .04em;
}

/* ---------- issues grid (landing + archive) ---------- */
.issues { max-width: 1200px; margin: 0 auto; padding: 88px 40px; display: flex; flex-direction: column; gap: 32px; }
.issues .head {
  display: flex; justify-content: space-between; align-items: baseline;
  border-bottom: 2px solid var(--ink); padding-bottom: 12px; gap: 24px; flex-wrap: wrap;
}
.issues .head h2 { font-size: 44px; line-height: 1; }
.issues .head a {
  font-family: 'IBM Plex Mono', monospace; font-size: 12px; letter-spacing: .12em;
  text-transform: uppercase; border-bottom: 2px solid var(--green);
}
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); gap: 24px; }

.card { border: 2px solid var(--ink); display: flex; flex-direction: column; }
.card:hover { box-shadow: 6px 6px 0 var(--ink); color: var(--ink); }
.card .bar {
  border-bottom: 2px solid var(--ink); padding: 10px 16px;
  display: flex; justify-content: space-between; gap: 12px;
  font-family: 'IBM Plex Mono', monospace; font-size: 11px;
  letter-spacing: .12em; text-transform: uppercase;
}
.card .bar .dim { color: var(--grey); }
.card .body { padding: 22px 18px; display: flex; flex-direction: column; gap: 12px; flex: 1; }
.card h3 { font-size: 30px; line-height: 1.05; }
.card p { margin: 0; font-size: 15px; line-height: 1.5; color: var(--ink-2); }
.card .tags {
  display: flex; gap: 8px; flex-wrap: wrap;
  font-family: 'IBM Plex Mono', monospace; font-size: 10px; letter-spacing: .12em;
  text-transform: uppercase; margin-top: auto; padding-top: 12px; border-top: 2px solid var(--rule);
}
.card .tags span { border: 2px solid var(--rule-2); padding: 4px 8px; }

/* featured (archive) */
.card-featured {
  border: 4px solid var(--ink); grid-column: 1 / -1; display: grid;
  grid-template-columns: minmax(0, 220px) minmax(0, 1fr); box-shadow: 8px 8px 0 var(--ink);
}
.card-featured:hover { box-shadow: 0 0 0 var(--ink); transform: translate(8px, 8px); color: var(--ink); }
.card-featured .side {
  border-right: 4px solid var(--ink); padding: 24px;
  display: flex; flex-direction: column; justify-content: space-between; gap: 24px;
  background-image: linear-gradient(45deg, var(--paper-2) 25%, transparent 25%, transparent 75%, var(--paper-2) 75%);
  background-size: 8px 8px;
}
.card-featured .side .meta {
  font-family: 'IBM Plex Mono', monospace; font-size: 11px;
  letter-spacing: .14em; text-transform: uppercase; line-height: 1.9;
}
.card-featured .side .meta .fresh { color: var(--green-2); }
.card-featured .side .meta .dim { color: var(--grey); }
.card-featured .main { padding: 28px; display: flex; flex-direction: column; gap: 14px; }
.card-featured h2 { font-size: 44px; line-height: 1.02; max-width: 22ch; }
.card-featured p { margin: 0; font-size: 16px; line-height: 1.55; max-width: 70ch; color: var(--ink-2); }
.card-featured .tags {
  display: flex; gap: 8px; flex-wrap: wrap;
  font-family: 'IBM Plex Mono', monospace; font-size: 10px; letter-spacing: .12em;
  text-transform: uppercase; margin-top: auto;
}
.card-featured .tags span { border: 2px solid var(--ink); padding: 4px 8px; }

/* ---------- subscribe strip ---------- */
.subscribe { border-top: 2px solid var(--ink); scroll-margin-top: 80px; }
.subscribe .in {
  max-width: 1200px; margin: 0 auto; padding: 64px 40px;
  display: flex; justify-content: space-between; align-items: center; gap: 40px; flex-wrap: wrap;
}
.subscribe h2 { font-size: 40px; line-height: 1; }
.subscribe p { margin: 8px 0 0; font-size: 16px; line-height: 1.5; color: var(--ink-2); max-width: 48ch; }
.subscribe form { display: flex; gap: 0; align-items: stretch; flex-wrap: wrap; }
.subscribe input {
  font-family: 'IBM Plex Mono', monospace; font-size: 13px; padding: 14px 16px;
  border: 2px solid var(--ink); border-right: 0; background: var(--paper);
  color: var(--ink); outline: none; width: 280px; max-width: 100%;
}
.subscribe input:focus { box-shadow: inset 0 0 0 2px var(--green); }
.subscribe button {
  font-family: 'IBM Plex Mono', monospace; font-size: 13px; letter-spacing: .1em;
  text-transform: uppercase; background: var(--ink); color: var(--paper);
  border: 2px solid var(--ink); padding: 14px 22px; cursor: pointer;
}
.subscribe button:hover { background: var(--green-2); border-color: var(--green-2); }

/* ---------- archive page ---------- */
.archive-main { max-width: 1200px; margin: 0 auto; padding: 64px 40px 96px; display: flex; flex-direction: column; gap: 40px; }
.archive-main h1 { font-size: clamp(56px, 8vw, 88px); line-height: 1.02; }
.archive-main .lead { margin: 0; font-size: 18px; line-height: 1.55; max-width: 60ch; color: var(--ink-2); }
.archive-meta {
  display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; align-items: center;
  border-top: 2px solid var(--ink); border-bottom: 2px solid var(--ink); padding: 14px 0;
  font-family: 'IBM Plex Mono', monospace; font-size: 11px;
  letter-spacing: .12em; text-transform: uppercase; color: var(--grey);
}
.archive-note {
  border: 2px solid var(--ink); padding: 24px; display: flex; justify-content: space-between;
  align-items: center; gap: 24px; flex-wrap: wrap;
  background-image: linear-gradient(45deg, var(--paper-2) 25%, transparent 25%, transparent 75%, var(--paper-2) 75%);
  background-size: 8px 8px;
  font-family: 'IBM Plex Mono', monospace; font-size: 12px; letter-spacing: .12em; text-transform: uppercase;
}

/* ---------- footer ---------- */
.site-footer { border-top: 2px solid var(--ink); background: var(--ink); color: var(--paper); padding: 48px 40px; }
.site-footer .in {
  max-width: 1200px; margin: 0 auto; display: flex; justify-content: space-between;
  align-items: flex-end; gap: 32px; flex-wrap: wrap;
}
.site-footer a { color: var(--paper); }
.site-footer a:hover { color: var(--green); }
.site-footer .cols {
  display: flex; gap: 48px; font-family: 'IBM Plex Mono', monospace; font-size: 11px;
  letter-spacing: .12em; text-transform: uppercase; line-height: 2.2;
}
.site-footer .cols .links { display: flex; flex-direction: column; }
.site-footer .cols .meta { color: var(--grey); text-align: right; }
.cursor-blink {
  display: inline-block; width: 8px; height: 12px; background: var(--green);
  margin-left: 8px; vertical-align: -1px; animation: btp-blink 1.1s steps(1) infinite;
}

/* ---------- share bar ---------- */
.share { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.share-label {
  font-family: 'IBM Plex Mono', monospace; font-size: 11px; letter-spacing: .16em;
  text-transform: uppercase; color: var(--grey);
}
.share-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.share-btns a, .share-btns button {
  font-family: 'IBM Plex Mono', monospace; font-size: 11px; letter-spacing: .12em;
  text-transform: uppercase; line-height: 1.2; border: 2px solid var(--ink);
  padding: 8px 12px; background: transparent; color: var(--ink); cursor: pointer;
  text-decoration: none; display: inline-block;
}
.share-btns a:hover, .share-btns button:hover { background: var(--ink); color: var(--paper); box-shadow: 3px 3px 0 var(--green); }
.share-btns .is-done, .share-btns .is-done:hover { background: var(--green); border-color: var(--green); color: var(--on-accent); box-shadow: none; }
.share.on-ink .share-label { color: var(--rule-2); }
.share.on-ink .share-btns a, .share.on-ink .share-btns button { border-color: var(--paper); color: var(--paper); }
.share.on-ink .share-btns a:hover, .share.on-ink .share-btns button:hover { background: var(--paper); color: var(--ink); }

/* ---------- responsive ---------- */
@media (max-width: 720px) {
  .wrap, .hero, .layers, .issues, .download .in, .subscribe .in, .archive-main { padding-left: 20px; padding-right: 20px; }
  /* шапка: одна строка — логотип, квадратная кнопка темы, гамбургер; меню панелью под шапкой */
  .site-header .in { padding: 10px 20px; gap: 8px; }
  .site-header .btn-theme { margin-left: auto; }
  .btn-theme, .btn-menu {
    width: 36px; height: 36px; padding: 0; justify-content: center;
    font-size: 0; letter-spacing: 0; gap: 0;
  }
  .btn-theme::before { width: 12px; height: 12px; }
  .btn-menu {
    display: inline-flex; align-items: center; position: relative;
    background: transparent; border: 2px solid var(--ink); color: var(--ink); cursor: pointer;
  }
  .btn-menu::before {
    content: ""; width: 16px; height: 2px; background: currentColor;
    box-shadow: 0 -5px 0 currentColor, 0 5px 0 currentColor;
  }
  .is-open .btn-menu::before { box-shadow: none; transform: rotate(45deg); }
  .is-open .btn-menu::after {
    content: ""; position: absolute; width: 16px; height: 2px; background: currentColor; transform: rotate(-45deg);
  }
  .site-header .site-nav {
    display: none; position: absolute; left: 0; right: 0; top: 100%;
    flex-direction: column; align-items: stretch; gap: 0; margin-left: 0;
    background: var(--paper); border-bottom: 2px solid var(--ink); font-size: 12px;
  }
  .site-header.is-open .site-nav { display: flex; }
  .site-nav a { padding: 14px 20px; border-top: 2px solid var(--rule); }
  .site-nav a.active { border-bottom: none; box-shadow: inset 4px 0 0 var(--green); }
  .site-nav .lang-switch { padding: 14px 20px; border-top: 2px solid var(--rule); }
  .site-nav .lang-switch a { padding: 7px 12px; border: 2px solid var(--ink); box-shadow: none; }
  .site-nav .lang-switch a + a { border-left: none; }
  .ticker { height: 36px; }
  .site-footer { padding: 40px 20px; }
  .site-footer .in { flex-direction: column; align-items: flex-start; }
  .site-footer .cols { width: 100%; justify-content: space-between; gap: 24px; }
  .hero-tagline { font-size: 32px; }
  .hero-sub { font-size: 17px; }
  .hero-cta { flex-direction: column; align-items: stretch; }
  .hero-cta .btn { text-align: center; }
  .issue-card { box-shadow: 6px 6px 0 var(--ink); }
  .stats .grid { grid-template-columns: repeat(2, 1fr); }
  .stats .cell { border-bottom: 2px solid var(--rule); padding: 20px 12px; }
  .stats .cell:nth-child(2n) { border-right: none; }
  .stats .cell:nth-last-child(-n + 2) { border-bottom: none; }
  .stats .value { font-size: 32px; }
  .download h2 { max-width: none; }
  .dl-panel { padding: 20px; }
  .issues .head h2 { font-size: 36px; }
  .subscribe form { width: 100%; }
  .subscribe input { width: 100%; }
  .subscribe button { width: 100%; margin-top: 8px; }
  .archive-main h1 { font-size: clamp(44px, 12vw, 64px); }
  .hero { padding-top: 48px; padding-bottom: 40px; gap: 40px; }
  .layers, .issues { padding-top: 56px; padding-bottom: 56px; }
  .download .in { padding-top: 56px; padding-bottom: 56px; }
  .issue-card h2 { font-size: 40px; }
  .download h2 { font-size: 44px; }
  .layers h2 { font-size: 40px; }
  .card-featured { grid-template-columns: 1fr; }
  .card-featured .side { border-right: none; border-bottom: 4px solid var(--ink); }
  .subscribe input { border-right: 2px solid var(--ink); }
}

@media (prefers-reduced-motion: reduce) {
  .ticker-track { animation: none; }
  .cursor-blink { animation: none; }
}
