/* ══════════════════════════════════════════════════════════════
   bars.okcu.io · v2 «брутальная афиша»
   почти чёрный + белый + серые + ОДИН кислотный лайм
   структура тонкими линиями 1px, секции — толстой 4px
   display: Oswald (self-hosted), текст: system-ui, мета: mono
   ══════════════════════════════════════════════════════════════ */

@font-face {
  font-family: "Oswald";
  font-style: normal;
  font-weight: 200 700;
  font-display: swap;
  src: url("../fonts/oswald-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Oswald";
  font-style: normal;
  font-weight: 200 700;
  font-display: swap;
  src: url("../fonts/oswald-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

:root {
  --bg: #0e0e0e;
  --ink: #f2f2ee;
  --grey: #b0b0a8;
  --dim: #8a8a82;
  --line: #2b2b2b;
  --lime: #d8ff3d;

  --display: "Oswald", "Arial Narrow", Impact, sans-serif;
  --body: system-ui, "Segoe UI", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "SF Mono", Consolas, monospace;

  --pad: clamp(16px, 4vw, 56px);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { overflow-x: clip; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* едва заметная газетная фактура */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 2147483647;
  pointer-events: none;
  opacity: .03;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

.mono { font-family: var(--mono); }

a { color: var(--ink); }

button, select, input, output { font: inherit; color: inherit; }

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

#hero, main, footer { max-width: 1280px; margin-inline: auto; padding-inline: var(--pad); }

/* ═══ HERO: газетная шапка ═══ */

#hero { padding-top: 26px; }

.masthead {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  border-block: 1px solid var(--line);
  padding-block: 8px;
  font-size: .72rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--grey);
}

.hero-title {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(2.9rem, 10.5vw, 8rem);
  line-height: 1.04;
  text-transform: uppercase;
  margin-top: clamp(24px, 5vh, 56px);
}

.hero-title .line { display: block; }

/* inline-block: фон заливки ограничен боксом, не течёт на строку выше */
.hero-title .hl {
  display: inline-block;
  background: var(--lime);
  color: var(--bg);
  padding: 0 .14em .04em;
  margin-top: .08em;
}

.hero-sub {
  margin-top: 26px;
  max-width: 62ch;
  color: var(--grey);
  font-size: clamp(1rem, 1.5vw, 1.12rem);
}

.hero-stats {
  margin-top: 22px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: .8rem;
  letter-spacing: .04em;
  color: var(--ink);
}

.stamp {
  display: inline-block;
  margin-top: 18px;
  border: 2px solid var(--lime);
  color: var(--lime);
  font-size: .7rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  padding: 6px 14px;
  transform: rotate(-2deg);
}

/* ═══ СЕКЦИИ: заголовок над толстой линией ═══ */

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 4px solid var(--ink);
  padding-bottom: 6px;
}

.section-title {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(1.7rem, 3.4vw, 2.6rem);
  text-transform: uppercase;
  line-height: 1;
}

.grid-count { color: var(--dim); font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; }

/* ═══ ФИЛЬТРЫ: строгая панель между линиями ═══ */

#filters { margin-top: 44px; border-block: 1px solid var(--line); padding-block: 16px; }

.filters-row {
  display: flex;
  flex-wrap: wrap;
  gap: 18px 44px;
  align-items: flex-end;
}

.filter-group { border: 0; min-width: 0; }

.filter-group legend,
.filter-group label {
  display: block;
  color: var(--dim);
  font-size: .68rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

/* текстовые кнопки-переключатели; актив = лайм-подчёркивание */
.chip {
  display: inline-block;
  font-family: var(--mono);
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--grey);
  padding: 4px 0 3px;
  margin-right: 20px;
  cursor: pointer;
}

.chip:hover { color: var(--ink); }

.chip.is-active { color: var(--ink); border-bottom-color: var(--lime); }

.chip-reset { color: var(--dim); margin-right: 0; }
.chip-reset:hover { color: var(--lime); }

.filter-check { min-width: 220px; }

.filter-check input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 2px;
  background: var(--line);
  outline-offset: 6px;
}

.filter-check input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  background: var(--lime);
  border: none;
  border-radius: 0;
  cursor: pointer;
}

.filter-check input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  background: var(--lime);
  border: none;
  border-radius: 0;
  cursor: pointer;
}

.filter-check output { display: block; margin-top: 8px; font-size: .78rem; color: var(--ink); }

.filter-sort select {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 0;
  padding: 7px 10px;
  font-size: .8rem;
  cursor: pointer;
}

/* ═══ GRID: типографские афиши в 1px-сетке ═══ */

#grid-section { margin-top: 48px; }

#grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-top: none;
}

.empty {
  grid-column: 1 / -1;
  background: var(--bg);
  color: var(--dim);
  padding: 56px 24px;
  text-align: center;
  font-size: .85rem;
}

/* ═══ КАРТОЧКА-АФИША ═══ */

.card {
  background: var(--bg);
  padding: 18px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  cursor: pointer;
  min-height: 340px;
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--mono);
}

.card-index { color: var(--dim); font-size: .78rem; letter-spacing: .08em; }

/* штамп-марка типа */
.card-stamp {
  border: 1px solid var(--grey);
  color: var(--grey);
  font-size: .62rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  padding: 3px 8px;
}

.card-name {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(1.8rem, 2.4vw, 2.4rem);
  line-height: .99;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

.card-meta {
  font-family: var(--mono);
  font-size: .72rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--grey);
}

.card-teaser {
  color: var(--grey);
  font-size: .9rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-cats {
  font-family: var(--mono);
  font-size: .66rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--dim);
}

.card-foot {
  margin-top: auto;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}

/* журнальная оценка */
.card-wow {
  font-family: var(--display);
  font-weight: 700;
  font-size: 3.1rem;
  line-height: 1;
}

.card-wow.top { background: var(--lime); color: var(--bg); padding: 0 10px; }

.radar-mini { width: 152px; flex: none; }

/* сокращённые подписи осей на mini */
.radar-label-s {
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: .04em;
  fill: var(--dim);
}

/* hover = инверсия афиши */
@media (hover: hover) {
  .card { transition: background .12s ease; }

  .card:hover { background: var(--lime); }

  .card:hover .card-name,
  .card:hover .card-index,
  .card:hover .card-meta,
  .card:hover .card-teaser,
  .card:hover .card-cats,
  .card:hover .card-wow { color: var(--bg); }

  .card:hover .card-stamp { border-color: var(--bg); color: var(--bg); }

  .card:hover .card-wow.top { background: var(--bg); color: var(--lime); }

  .card:hover .radar-mini { color: var(--bg); }
  .card:hover .radar-grid,
  .card:hover .radar-spoke { stroke: rgba(14, 14, 14, .35); }
  .card:hover .radar-label-s { fill: rgba(14, 14, 14, .7); }
}

/* ═══ РАДАР: единый лайм на тёмном ═══ */

.radar-mini, .radar-full { color: var(--lime); }

.radar-svg { display: block; width: 100%; height: auto; }

.radar-full { min-height: 320px; }
.radar-full .radar-svg { max-width: 420px; }

.radar-grid  { fill: none; stroke: var(--line); stroke-width: 1; }
.radar-spoke { stroke: var(--line); stroke-width: 1; }

.radar-poly {
  fill: currentColor;
  fill-opacity: .14;
  stroke: currentColor;
  stroke-dasharray: 1; /* с pathLength=1: solid; нужно wow draw-in */
  stroke-width: 2;
  stroke-linejoin: round;
}

.radar-dot { fill: currentColor; }
.radar-hit { fill: transparent; }

.radar-tick { font-family: var(--mono); font-size: 9px; fill: var(--dim); }

.radar-label { font-family: var(--mono); font-size: 10.5px; fill: var(--dim); }
.radar-label .radar-value { fill: var(--ink); }
.radar-label .radar-na    { fill: var(--dim); opacity: .55; }

/* ═══ DETAIL: разворот-досье ═══ */

#detail {
  /* глобальный reset (* { margin: 0 }) убивает UA margin:auto у dialog —
     возвращаем явно, иначе модалка липнет к левому верхнему углу */
  margin: auto;
  background: var(--bg);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 0;
  padding: 0;
  width: min(940px, calc(100vw - 24px));
  max-height: 90dvh;
  overflow-y: auto;
}

#detail::backdrop { background: rgba(0, 0, 0, .78); }

.detail-top {
  position: relative;
  border-bottom: 4px solid var(--ink);
  padding: 26px clamp(18px, 4vw, 32px) 18px;
}

.detail-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 38px;
  height: 38px;
  background: var(--bg);
  border: 1px solid var(--grey);
  border-radius: 0;
  color: var(--ink);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}

.detail-close:hover { background: var(--lime); color: var(--bg); border-color: var(--lime); }

.detail-name {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(2rem, 5vw, 3.4rem);
  line-height: .98;
  text-transform: uppercase;
  padding-right: 48px;
}

.detail-sub {
  margin-top: 10px;
  font-family: var(--mono);
  font-size: .72rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--grey);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
}

/* разворот: слева мета, справа контент */
.detail-grid {
  display: grid;
  grid-template-columns: 280px 1fr;
}

.detail-aside {
  border-right: 1px solid var(--line);
  padding: 22px clamp(16px, 3vw, 24px);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.detail-main {
  padding: 22px clamp(18px, 4vw, 30px) 30px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.detail-block h3 {
  font-family: var(--mono);
  font-size: .68rem;
  font-weight: 400;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--dim);
  margin-bottom: 8px;
}

.detail-block p { font-size: .95rem; color: var(--ink); }

.detail-info { font-family: var(--mono); font-size: .78rem; color: var(--grey); line-height: 1.7; }
.detail-info b { color: var(--ink); font-weight: 400; }

/* минусы без прикрас: толстая серая линия слева */
.anti {
  border-left: 4px solid var(--dim);
  padding-left: 16px;
}

.anti p { color: var(--grey); }

/* чек: строки между тонкими линиями */
.check-table { border-top: 1px solid var(--line); }

.check-cell {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 8px 0;
}

.check-cell .lbl {
  font-family: var(--mono);
  font-size: .68rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--dim);
}

.check-cell .val { font-family: var(--mono); font-size: .9rem; color: var(--ink); }

/* ссылки: подчёркнутые текст-кнопки */
.detail-links { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }

.link-btn {
  font-family: var(--mono);
  font-size: .8rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--lime);
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}

.link-btn:hover { color: var(--lime); }

/* «Слово от Fable 5»: блок-цитата с лайм-линией */
.fable {
  border-left: 4px solid var(--lime);
  padding-left: 16px;
}

.fable h3 {
  font-family: var(--mono);
  font-size: .68rem;
  font-weight: 400;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--lime);
  margin-bottom: 8px;
}

.fable-say { font-size: .95rem; margin-bottom: 10px; }

.fable-badges { display: flex; flex-direction: column; gap: 4px; }

.fable-badge {
  font-family: var(--mono);
  font-size: .74rem;
  letter-spacing: .04em;
}

.fable-badge.go   { color: var(--lime); }
.fable-badge.skip { color: var(--grey); }

/* галерея досье: фото цветные, рамка 1px, ноль скруглений */
.gallery-main {
  display: block;
  width: 100%;
  max-height: 400px;
  object-fit: cover;
  border: 1px solid var(--line);
}

.gallery-thumbs { display: flex; gap: 8px; margin-top: 8px; }

.gallery-thumb {
  width: 72px;
  height: 52px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 0;
  background: none;
  cursor: pointer;
  overflow: hidden;
  /* неактивные превью — газетная ч/б, активное и hover идут в цвет */
  filter: grayscale(1);
  opacity: .75;
}

.gallery-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.gallery-thumb:hover { filter: none; opacity: 1; }

.gallery-thumb.is-active {
  filter: none;
  opacity: 1;
  border-color: var(--lime);
}

/* ═══ MAP: газетная ч/б вклейка ═══ */

#map-section { margin-top: 56px; }

#map {
  height: 70vh;
  min-height: 420px;
  background: #e8e8e4;
  border: 1px solid var(--line);
  border-top: none;
}

/* тайлы в print-ч/б — карта как схема из газеты */
#map .leaflet-tile-pane { filter: grayscale(1) contrast(1.06); }

/* Leaflet двигает маркеры transform'ом при пане/зуме —
   никаких transition на них, иначе пины «плывут» */
#map .leaflet-marker-icon,
#map .leaflet-marker-shadow { transition: none; }

/* пин: квадратная лайм-марка с номером карточки */
.map-pin {
  background: var(--lime);
  color: var(--bg);
  border: 1px solid var(--bg);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* popup под дизайн-систему: без скруглений и теней */
#map .leaflet-popup-content-wrapper {
  background: var(--bg);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 0;
  box-shadow: none;
}

#map .leaflet-popup-tip {
  background: var(--bg);
  border: 1px solid var(--line);
  box-shadow: none;
}

#map .leaflet-popup-content { margin: 14px 16px; }

#map .leaflet-popup-close-button { color: var(--grey); }

.map-popup-name {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.15rem;
  text-transform: uppercase;
  line-height: 1;
  margin-bottom: 6px;
}

.map-popup-meta {
  font-family: var(--mono);
  font-size: .68rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--grey);
  margin-bottom: 10px;
}

.map-popup-btn {
  font-family: var(--mono);
  font-size: .74rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  background: none;
  border: none;
  padding: 0;
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--lime);
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
  cursor: pointer;
}

.map-popup-btn:hover { color: var(--lime); }

/* атрибуция OSM: читаемо, но не кричит */
#map .leaflet-control-attribution {
  background: rgba(232, 232, 228, .85);
  color: #333;
  font-family: var(--mono);
  font-size: 10px;
}

/* подсветка карточки после «к карточке» */
.card.is-flash { outline: 3px solid var(--lime); outline-offset: -3px; }

/* ═══ FOOTER ═══ */

footer {
  margin-top: 64px;
  border-top: 1px solid var(--line);
  padding-block: 22px 40px;
  color: var(--dim);
  font-size: .74rem;
  letter-spacing: .04em;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.footer-preview { color: var(--grey); }

.noscript { padding: 40px var(--pad); color: var(--lime); }

/* ═══ MOTION / RESPONSIVE ═══ */

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

@media (max-width: 720px) {
  .detail-grid { grid-template-columns: 1fr; }
  .detail-aside { border-right: none; border-bottom: 1px solid var(--line); }
}

@media (max-width: 640px) {
  #grid { grid-template-columns: 1fr; }
  .filters-row { flex-direction: column; align-items: stretch; }
  .card { min-height: 0; }
  .masthead { font-size: .62rem; }
  #map { height: 55vh; min-height: 320px; }

  /* модалка на мобиле — полноэкранно */
  #detail {
    margin: 0;
    width: 100vw;
    max-width: none;
    height: 100dvh;
    max-height: none;
    border: none;
  }
}

/* ═══ WOW-СЛОЙ (wow.js; html.wow НЕ ставится при prefers-reduced-motion) ═══ */

/* дым за hero: канвас под контентом */
#hero { position: relative; }
#hero > * { position: relative; z-index: 1; }
#hero .smoke {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: .85;
}

/* скролл-прогресс: лайм-полоска сверху */
#scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: var(--lime);
  transform: scaleX(0);
  transform-origin: 0 50%;
  z-index: 60;
  pointer-events: none;
}

/* бегущая строка-разделитель: без wow-слоя и без данных её нет вовсе */
.marquee { display: none; }

html.wow .marquee.is-filled {
  display: block;
  overflow: hidden;
  border-block: 1px solid var(--line);
  margin-top: 56px;
  padding-block: 10px;
  white-space: nowrap;
}

.marquee-track { display: inline-block; will-change: transform; }

.marquee-half {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.5rem;
  text-transform: uppercase;
  color: var(--grey);
}

.marquee-half b { color: var(--lime); font-weight: 400; padding-inline: 22px; }

@media (prefers-reduced-motion: no-preference) {
  /* кинетическая шапка: одноразовый въезд строк, лайм впечатывается последним */
  html.wow .hero-title .line { animation: line-in .5s cubic-bezier(.2, .7, .2, 1) both; }
  html.wow .hero-title .line:nth-child(1) { animation-delay: .05s; }
  html.wow .hero-title .line:nth-child(2) { animation-delay: .16s; }
  html.wow .hero-title .hl { animation: stamp-in .34s ease-out .52s both; }

  /* scroll-stagger карточек: только transform/opacity */
  html.wow #grid .card { opacity: 0; transform: translateY(12px); }
  html.wow #grid .card.in-view {
    opacity: 1;
    transform: none;
    transition: opacity .35s ease, transform .35s ease;
  }

  /* радар draw-in при появлении карточки (pathLength=1 на полигоне) */
  html.wow #grid .card .radar-poly { stroke-dashoffset: 1; fill-opacity: 0; }
  html.wow #grid .card.in-view .radar-poly {
    stroke-dashoffset: 0;
    fill-opacity: .14;
    transition: stroke-dashoffset .55s ease .12s, fill-opacity .4s ease .5s;
  }
  html.wow #detail .radar-poly { animation: radar-draw .6s ease .1s both; }

  /* marquee: медленно, hover = пауза */
  html.wow .marquee-track { animation: marquee-run 60s linear infinite; }
  html.wow .marquee:hover .marquee-track { animation-play-state: paused; }

  /* микро: удар штампа и подскок оценки на hover карточки */
  html.wow .card .card-stamp,
  html.wow .card .card-wow { transition: transform .16s ease; }
  html.wow .card:hover .card-stamp { transform: rotate(-2deg) scale(1.07); }
  html.wow .card:hover .card-wow { transform: translateY(-2px); }

  /* вход досье: чистый CSS на [open] — надёжнее View Transitions, модалка не ломается */
  html.wow #detail[open] { animation: dossier-in .24s cubic-bezier(.2, .7, .2, 1); }
  html.wow #detail[open]::backdrop { animation: backdrop-in .24s ease; }
}

@keyframes dossier-in {
  from { opacity: 0; transform: translateY(10px) scale(.985); }
  to   { opacity: 1; transform: none; }
}

@keyframes backdrop-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes line-in {
  from { clip-path: inset(0 0 100% 0); transform: translateY(.35em); }
  to   { clip-path: inset(0 0 -12% 0); transform: none; }
}

@keyframes stamp-in {
  0%   { opacity: 0; transform: scale(1.07) translateY(.08em); }
  60%  { opacity: 1; transform: scale(.99); }
  100% { transform: scale(1); }
}

@keyframes radar-draw {
  from { stroke-dashoffset: 1; fill-opacity: 0; }
  to   { stroke-dashoffset: 0; fill-opacity: .14; }
}

@keyframes marquee-run {
  to { transform: translateX(-50%); }
}
