/* Завръщането на комунизма: обща стилова таблица за всички страници. */

@font-face {
  font-family: "Sofia Sans"; font-weight: 400 700; font-style: normal; font-display: swap;
  src: url("fonts/SofiaSans.woff2") format("woff2");
}
@font-face {
  font-family: "Sofia Sans Extra Condensed"; font-weight: 700 800; font-style: normal; font-display: swap;
  src: url("fonts/SofiaSansExtraCondensed.woff2") format("woff2");
}

:root {
  color-scheme: light;
  --paper: #F1F2EE;      /* архивна хартия, студена */
  --ink: #1C2230;        /* синьо-черно мастило */
  --ink-soft: #555D6C;
  --rule: #C9CDC5;       /* тънки разделители (украса) */
  --rule-strong: #868C93;/* графики и рамки на бутони: контраст 3:1 */
  --stamp: #5B3D9E;      /* виолетов печат */
  --stamp-wash: #E6E1F0;
  --alarm: #A8231C;      /* гласът на автора, етапи 4–5 */
  --display: "Sofia Sans Extra Condensed", "Arial Narrow", sans-serif;
  --text: "Sofia Sans", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.0625rem/1.6 var(--text);
  font-feature-settings: "locl" 1, "kern" 1;
}
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: .18em; }
a:hover { color: var(--stamp); }
a:focus-visible, summary:focus-visible, button:focus-visible { outline: 2px solid var(--stamp); outline-offset: 2px; border-radius: 2px; }
.page { max-width: 42rem; margin: 0 auto; padding: .5rem 1rem 4rem; }

.banner { background: var(--alarm); color: #fff; font-size: .9rem; padding: .55rem 1rem; text-align: center; }
.banner.is-draft { background: var(--ink); }

/* Меню */
.topnav { display: flex; flex-wrap: wrap; gap: 0 1.4rem; margin: 0 0 1.25rem; font-size: .92rem; font-weight: 600; }
.topnav a { display: inline-flex; align-items: center; min-height: 44px; color: var(--ink-soft); text-decoration: none; }
.topnav a:hover { color: var(--stamp); }
.topnav a[aria-current="page"] { color: var(--ink); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: .35em; }
.brand { display: inline-block; font: 800 1.9rem/1 var(--display); text-decoration: none; margin-top: 1rem; }
.red { color: var(--alarm); }

/* Заглавна част на доклада */
.mast h1 { font: 800 clamp(3rem, 11vw, 5.4rem)/.86 var(--display); margin: 0; letter-spacing: -.012em; }
.mast .lede { margin: .75rem 0 0; color: var(--ink-soft); font-size: 1.125rem; }
.mast-bar {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: .25rem 1.5rem;
  border-top: 3px solid var(--ink); margin-top: 1.5rem; padding-top: .6rem;
  font-weight: 600; font-variant-numeric: tabular-nums;
}
.mast-bar .count { color: var(--ink-soft); font-weight: 400; }

/* Заглавие на вътрешна страница */
.page-head { border-bottom: 3px solid var(--ink); padding-bottom: .9rem; margin-bottom: 1.5rem; }
.page-head h1 { font: 800 clamp(2.4rem, 8vw, 3.6rem)/.95 var(--display); margin: .4rem 0 .5rem; }
.page-head .lede { margin: 0; color: var(--ink-soft); font-size: 1.1rem; }

/* Топлинна карта: 12 признака, по-тъмно = повече записи */
.kartoteka { margin-top: 2rem; }
.kartoteka h2 { font: 600 1rem/1.3 var(--text); margin: 0 0 .6rem; }
.cells { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.cell a {
  display: flex; flex-direction: column; justify-content: space-between; gap: .3rem;
  min-height: 3.6rem; height: 100%; padding: .45rem .55rem .4rem;
  border: 1px solid var(--rule-strong); text-decoration: none;
}
.cell a:hover { outline: 2px solid var(--stamp); outline-offset: -2px; }
.cell-name { font: 600 .95rem/1.2 var(--text); color: var(--ink-soft); }
.cell-n { font-size: .78rem; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.cell.lvl-1 a { background: #E6E1F0; border-color: var(--stamp); }
.cell.lvl-1 .cell-name, .cell.lvl-1 .cell-n { color: var(--stamp); }
.cell.lvl-2 a { background: #CEC3E6; border-color: var(--stamp); }
.cell.lvl-2 .cell-name, .cell.lvl-2 .cell-n { color: #3F2A78; }
.cell.lvl-3 a { background: #A893D6; border-color: var(--stamp); }
.cell.lvl-3 .cell-name, .cell.lvl-3 .cell-n { color: var(--ink); }
.cell.lvl-4 a { background: var(--stamp); border-color: var(--stamp); }
.cell.lvl-4 .cell-name, .cell.lvl-4 .cell-n { color: #fff; }
.kartoteka .key { font-size: .85rem; color: var(--ink-soft); margin: .5rem 0 0; }

/* Събитие */
.ev { border-top: 3px solid var(--ink); margin-top: 3.25rem; padding-top: .7rem; }
.ev-meta, .fold[open] .fold-meta { display: flex; align-items: flex-start; gap: .4rem 1.25rem; flex-wrap: wrap; color: var(--ink-soft); font-size: .92rem; font-variant-numeric: tabular-nums; }
.stamp, .fold[open] .fold-stamp {
  display: inline-block; margin-left: auto; margin-top: -1.35rem;
  color: var(--stamp); font: 800 1.2rem/1 var(--display); letter-spacing: .09em; text-transform: uppercase; text-decoration: none;
  padding: .42rem .75rem .34rem; border: 2px solid currentColor; border-radius: 4px;
  box-shadow: 0 0 0 2px var(--paper), 0 0 0 3.5px currentColor;
  background: var(--paper);
  transform: rotate(-4deg); opacity: .9;
  animation: stamp .32s cubic-bezier(.3, 1.6, .5, 1) both;
}
a.stamp:hover { color: var(--ink); opacity: 1; }
.ev:nth-of-type(2) .stamp { animation-delay: .12s; }
.ev:nth-of-type(n+3) .stamp { animation-delay: .24s; }
@keyframes stamp { from { transform: rotate(-9deg) scale(1.5); opacity: 0; } to { transform: rotate(-4deg) scale(1); opacity: .9; } }

.ev-title, .fold[open] .fold-title { font: 700 clamp(2rem, 6vw, 2.75rem)/1 var(--display); margin: .9rem 0 .35rem; letter-spacing: -.005em; text-wrap: balance; }
.ev-title a { text-decoration: none; }
.ev-title a:hover { text-decoration: underline; text-decoration-thickness: 2px; }
.also { margin: 0; font-size: .92rem; color: var(--ink-soft); }
.also a.tag { color: var(--stamp); font-weight: 600; text-decoration: none; }
.also a.tag:hover { text-decoration: underline; }

.etap { display: flex; align-items: center; gap: .7rem; margin: .8rem 0 1.4rem; font-size: .92rem; }
.bars { display: inline-flex; gap: 3px; flex: none; }
.bars i { width: 1.6rem; height: .5rem; background: var(--paper); box-shadow: inset 0 0 0 1px var(--rule-strong); }
.bars i.on { background: var(--ink); box-shadow: none; }
.etap.is-high .bars i.on { background: var(--alarm); }
.etap b { font-weight: 600; }

/* Отметка „Висок риск“ */
.risk {
  display: inline-block; margin-top: .1rem; padding: .28rem .45rem .24rem; border-radius: 2px;
  background: var(--alarm); color: #fff; font: 700 .72rem/1 var(--text); letter-spacing: .06em; text-transform: uppercase; text-decoration: none;
}
a.risk:hover { color: #fff; background: var(--ink); }
/* Дата и отметка заедно: на тесен екран отметката слиза под датата, а печатът остава вдясно */
.when { display: inline-flex; flex-wrap: wrap; align-items: center; gap: .25rem .6rem; min-width: 0; }
.when time { white-space: nowrap; }
.ev-meta, .fold[open] .fold-meta { flex-wrap: nowrap; }
.stamp, .fold-stamp { flex: none; white-space: nowrap; }

/* Малка скала на етапа в сгънатия ред */
.mini { display: inline-flex; gap: 2px; margin-left: .7rem; vertical-align: .1em; }
.mini i { width: .7rem; height: .32rem; background: var(--paper); box-shadow: inset 0 0 0 1px var(--rule-strong); }
.mini i.on { background: var(--ink-soft); box-shadow: none; }
.mini.is-high i.on { background: var(--alarm); }
.fold[open] .mini { display: none; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Подредба и филтър в началото: само с JavaScript */
.tools { display: none; }
.js .tools {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: .6rem 1.1rem;
  margin-top: 2.25rem; padding-top: .7rem; border-top: 1px solid var(--rule-strong);
}
.tools label { flex: 1 1 9.5rem; max-width: 14rem; min-width: 0; display: flex; flex-direction: column; gap: .2rem; font-size: .85rem; font-weight: 600; color: var(--ink-soft); }
.tools select {
  width: 100%; min-height: 44px; padding: .3rem 2rem .3rem .6rem; font: 400 1rem/1.2 var(--text); color: var(--ink);
  background: var(--paper) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%231C2230' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right .65rem center / .75rem .5rem;
  border: 1px solid var(--rule-strong); border-radius: 2px; -webkit-appearance: none; appearance: none;
}
.tools select:hover { border-color: var(--ink); }
.tools select:focus-visible, .tools input:focus-visible { outline: 2px solid var(--stamp); outline-offset: 2px; }
.tools .chk { flex: none; max-width: none; flex-direction: row; align-items: center; gap: .5rem; min-height: 44px; font-size: .95rem; color: var(--ink); cursor: pointer; }
.tools .chk input { width: 1.15rem; height: 1.15rem; margin: 0; accent-color: var(--alarm); cursor: pointer; }
.t-count { flex-basis: 100%; margin: 0; font-size: .9rem; color: var(--ink-soft); }
.t-count:empty { display: none; }
.all { border-bottom: 1px solid var(--rule-strong); }
.all > .fold:last-child { border-bottom: 0; }

.runin { font-weight: 700; }
.ev p strong:not(.runin), .ev li strong { font-weight: 600; color: var(--ink); }
.ev p { margin: 0 0 .9rem; }
.official { color: var(--ink-soft); }
.analysis { border-left: 3px solid var(--alarm); padding: .1rem 0 .1rem 1.1rem; margin: 1.5rem 0; }
.analysis > p:first-child .runin { color: var(--alarm); }
.analysis h3 { font: 700 1rem/1.3 var(--text); margin: 1.1rem 0 .3rem; }
.analysis ul { margin: 0; padding: 0; list-style: none; }
.analysis li { padding-left: 1.1rem; position: relative; margin-bottom: .3rem; }
.analysis li::before { content: "–"; position: absolute; left: 0; color: var(--alarm); font-weight: 400; }

/* Номер на източник: малък на вид, но с голяма зона за пръст */
.ref { font-size: .7em; line-height: 0; margin-left: .08em; }
.ref a { position: relative; text-decoration: none; color: var(--stamp); font-weight: 700; }
.ref a::after { content: ""; position: absolute; top: -.85em; bottom: -.65em; left: -.8em; right: -.8em; }

.sources { font-size: .88rem; color: var(--ink-soft); border-top: 1px solid var(--rule); }
.sources summary {
  display: inline-flex; align-items: center; gap: .45rem; min-height: 44px; cursor: pointer; list-style: none;
  font-weight: 600; color: var(--ink);
}
.sources summary::-webkit-details-marker { display: none; }
.sources summary:hover { color: var(--stamp); }
.chev { width: .75rem; height: .5rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: transform .2s ease; }
.sources[open] .chev { transform: rotate(180deg); }
.sources ol { margin: 0 0 .4rem; padding-left: 1.3rem; }
.sources li { margin-bottom: .25rem; }
.sources li:target { background: var(--stamp-wash); }
.corr { font-size: .9rem; background: var(--stamp-wash); padding: .5rem .75rem; margin-top: 1rem; }

.empty { margin-top: 2rem; font-size: 1.15rem; }

/* Бележка под доклада */
.note { margin-top: 4.5rem; border-top: 3px solid var(--ink); padding-top: .8rem; font-size: .95rem; color: var(--ink-soft); }
.note p { margin: 0 0 .6rem; }

/* По-стари записи в началото: сгънати на един ред, отварят се с щракване */
.older { margin-top: 3.25rem; }
.fold { border-top: 1px solid var(--rule-strong); scroll-margin-top: 1rem; }
.fold:last-child { border-bottom: 1px solid var(--rule-strong); }
.fold > summary {
  display: grid; grid-template-columns: 1fr auto; column-gap: .9rem; align-items: center;
  min-height: 44px; padding: .65rem 0 .7rem; cursor: pointer; list-style: none;
}
.fold > summary::-webkit-details-marker { display: none; }
.fold-meta { font-size: .88rem; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.fold-stamp { color: var(--stamp); font-weight: 600; margin-left: .7rem; }
.fold-title { font: 700 1.4rem/1.1 var(--display); margin: .15rem 0 0; text-wrap: balance; }
.fold > summary .chev { grid-column: 2; grid-row: 1 / span 2; width: .9rem; height: .6rem; }
.fold > summary:hover .fold-title { color: var(--stamp); }
.fold[open] > summary .chev { transform: rotate(180deg); }
/* Отвореният запис изглежда като разгънатите горе: дебела линия, печат, голямо заглавие */
.fold[open] { border-top: 3px solid var(--ink); margin-top: 3.25rem; padding-bottom: 1.2rem; }
.fold[open] + .fold:not([open]) { border-top-width: 1px; }
.fold[open] > summary { padding-top: .7rem; align-items: start; }
.fold[open] > summary .chev { grid-row: 1; margin-top: .35rem; }
.fold[open] > summary:hover .fold-title { color: inherit; }
.fold .ev { border-top: 0; margin-top: 0; padding-top: .2rem; }
.permalink { font-size: .88rem; margin-top: .6rem; }

/* Признаци */
.belezi { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px; }
.belezi li { padding: .7rem .8rem; border: 1px solid var(--rule-strong); scroll-margin-top: 1rem; }
.belezi li:target { border-color: var(--stamp); background: var(--stamp-wash); outline: 2px solid var(--stamp); outline-offset: -2px; }
.belezi b { display: block; font: 700 1.1rem/1.25 var(--text); color: var(--stamp); }
.belezi span { display: block; margin-top: .3rem; font-size: .92rem; color: var(--ink-soft); }
.belezi .n { margin-top: .45rem; font-size: .82rem; color: var(--ink); font-variant-numeric: tabular-nums; }

.prose h2 { font: 700 1.5rem/1.1 var(--display); margin: 2rem 0 .5rem; }
.prose ul, .prose ol { margin: 0 0 .8rem; padding-left: 1.3rem; }
.prose li { margin-bottom: .3rem; }
.prose p { margin: 0 0 .8rem; }

/* Долу */
.foot { margin-top: 3rem; border-top: 1px solid var(--rule); padding-top: .4rem; font-size: .88rem; color: var(--ink-soft); display: flex; flex-wrap: wrap; gap: 0 1.4rem; }
.foot a { display: inline-flex; align-items: center; min-height: 44px; }

@media (max-width: 34rem) {
  .cells { grid-template-columns: repeat(2, 1fr); }
  .cell a { min-height: 2.8rem; padding: .35rem .5rem .3rem; }
  .stamp, .fold[open] .fold-stamp { font-size: 1.05rem; margin-top: -1.15rem; }
  .belezi { grid-template-columns: 1fr; }
  .topnav { gap: 0 1rem; font-size: .88rem; }
}
@media (prefers-reduced-motion: reduce) { .stamp, .fold-stamp { animation: none; } .chev { transition: none; } }
@media print {
  body { background: #fff; }
  .stamp, .fold-stamp { box-shadow: none; animation: none; }
  .cell a, .corr { background: none !important; }
  .cell .cell-name, .cell .cell-n { color: #000 !important; }
  .topnav, .foot, .tools, .mini { display: none !important; }
  a { text-decoration: none; }
}
