/* ==========================================================================
   Статиите: главата, напредъкът при четене, споделянето, номерираните раздели
   и съдържанието. Шаблонът е в build_statii.py, поведението в assets/js/statia.js.
   ========================================================================== */

/* лентата за напредъка най-горе */
.ar-prog { position: fixed; left: 0; right: 0; top: 0; z-index: 60; height: 3px; pointer-events: none; }
.ar-prog i { display: block; height: 100%; background: linear-gradient(90deg, var(--forest-l), var(--forest) 60%, var(--zlato-t)); transform-origin: 0 50%; transform: scaleX(var(--p, 0)); box-shadow: 0 0 10px rgba(212, 186, 116, .5); }

/* главата */
.ar-hero .container > * { max-width: 800px; }
.ar-kick { display: inline-flex; align-items: center; gap: 8px; margin: 0 0 18px; padding: 7px 13px; border-radius: 99px; background: var(--chip-g-bg); color: var(--forest); font-size: 11.5px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; animation: arFade .7s ease both; }
.ar-hero h1 { font-size: clamp(34px, 4.2vw, 60px); line-height: 1.04; letter-spacing: -.03em; margin-bottom: 20px; text-wrap: balance; }
.ar-l { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: .1em; margin-bottom: -.1em; }
.ar-l > span { display: inline-block; animation: arUp 1s cubic-bezier(.2, .8, .2, 1) both; animation-delay: calc(var(--i, 0) * .11s + .05s); }
.ar-lead { font-size: clamp(17.5px, 1.45vw, 20px) !important; line-height: 1.55; color: var(--grey-d); animation: arRise .9s cubic-bezier(.2, .8, .2, 1) .28s both; }
@keyframes arUp { from { transform: translateY(108%); } to { transform: none; } }
@keyframes arRise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes arFade { from { opacity: 0; } to { opacity: 1; } }

.ar-meta { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 14px 20px; margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--hairline); animation: arRise .9s cubic-bezier(.2, .8, .2, 1) .4s both; }
.ar-au { display: flex; align-items: center; gap: 12px; }
.ar-au img { width: 46px; height: 46px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 3px #fff, 0 6px 14px -6px rgba(26, 26, 26, .4); }
.ar-au b { display: block; font-size: 15px; }
.ar-au span { display: block; font-size: 13px; color: var(--grey); }

/* споделянето */
.ar-share { display: flex; align-items: center; gap: 8px; }
.ar-sh { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; min-width: 40px; padding: 0 11px; border: 0; border-radius: 99px; background: #fff; color: var(--forest); font: inherit; font-size: 13.5px; font-weight: 800; box-shadow: inset 0 0 0 1px rgba(26, 26, 26, .08), 0 8px 18px -12px rgba(26, 26, 26, .35); cursor: pointer; transition: background .25s ease, color .25s ease, transform .25s ease; text-decoration: none; }
.ar-sh:hover { background: var(--forest); color: var(--paper); transform: translateY(-2px); }
.ar-sh svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ar-sh svg.fill { fill: currentColor; stroke: none; }
.ar-copy { padding: 0 15px 0 13px; }
.ar-copy.done { background: var(--forest); color: var(--paper); }
.ar-sh:focus-visible { outline: 3px solid var(--forest); outline-offset: 2px; }
.ar-viber { display: none; }
@media (hover: none) { .ar-viber { display: inline-flex; } }

/* номерираните раздели */
.article h2 .ar-n { display: inline-flex; align-items: center; justify-content: center; min-width: 38px; height: 26px; margin-right: 12px; padding: 0 9px; border-radius: 99px; background: var(--forest); color: var(--paper); font-size: 12.5px; font-weight: 800; letter-spacing: .04em; vertical-align: .18em; font-variant-numeric: tabular-nums; }
.article h2 { scroll-margin-top: 96px; }

/* фигурите влизат, щом стигнете до тях (само ако скриптът работи) */
.ar-js .ar-rv { transition: opacity .7s ease, transform .8s cubic-bezier(.2, .8, .2, 1); }
.ar-js .ar-rv:not(.in) { opacity: 0; transform: translateY(22px); }

/* съдържанието вдясно: отчет и линия на напредъка */
@media (min-width: 1160px) {
  .toc-h { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
  .toc-n { font-size: 11px; letter-spacing: .06em; color: var(--forest); font-variant-numeric: tabular-nums; }
  .toc ol { position: relative; padding-left: 14px !important; }
  .toc ol::before, .toc ol::after { content: ""; position: absolute; left: 0; top: 6px; bottom: 6px; width: 2px; border-radius: 2px; background: rgba(0, 84, 53, .12); }
  .toc ol::after { background: linear-gradient(var(--forest-l), var(--forest) 60%, var(--zlato-t)); transform-origin: 50% 0; transform: scaleY(var(--tp, 0)); transition: transform .3s ease; }
}

/* на телефон и таблет: плаващо копче и лист със разделите */
.ar-fab { position: fixed; left: 50%; bottom: 16px; z-index: 55; translate: -50% 140%; display: inline-flex; align-items: center; gap: 10px; white-space: nowrap; padding: 11px 16px 11px 18px; border: 0; border-radius: 99px; background: rgba(26, 26, 26, .88); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); color: var(--paper); font: inherit; font-size: 14px; font-weight: 800; box-shadow: 0 16px 34px -12px rgba(0, 0, 0, .5); cursor: pointer; transition: translate .45s cubic-bezier(.2, .8, .2, 1); }
.ar-fab.on { translate: -50% 0; }
.ar-fab .ar-fn { color: var(--zlato); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ar-fab svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; transition: transform .3s ease; }
.ar-fab[aria-expanded="true"] svg { transform: rotate(180deg); }
.ar-fab:focus-visible { outline: 3px solid var(--zlato); outline-offset: 3px; }
.ar-sheet { position: fixed; left: 12px; right: 12px; bottom: 74px; z-index: 56; max-height: 62vh; overflow: auto; padding: 16px 12px 10px; border-radius: 22px; background: #fff; box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .45), inset 0 0 0 1px rgba(26, 26, 26, .06); opacity: 0; transform: translateY(14px) scale(.98); pointer-events: none; transition: opacity .3s ease, transform .35s cubic-bezier(.2, .8, .2, 1); }
.ar-sheet.on { opacity: 1; transform: none; pointer-events: auto; }
.ar-sheet p { margin: 0 8px 8px; font-size: 11px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--grey); }
.ar-sheet ol { list-style: none; margin: 0; padding: 0; counter-reset: s; }
.ar-sheet li { counter-increment: s; }
.ar-sheet a { display: flex; gap: 12px; padding: 11px 8px; border-radius: 12px; color: var(--ink); font-size: 15px; line-height: 1.35; font-weight: 600; }
.ar-sheet a::before { content: counter(s, decimal-leading-zero); flex: none; width: 24px; font-size: 12px; font-weight: 800; color: var(--grey); padding-top: 2px; }
.ar-sheet a.on { background: var(--chip-g-bg); color: var(--forest); }
.ar-sheet a.on::before { color: var(--forest); }
@media (min-width: 1160px) { .ar-fab, .ar-sheet { display: none; } }

/* краят: авторът и още едно споделяне */
.ar-end { flex-wrap: wrap; }
.ar-end-sh { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.ar-end-sh > span { font-size: 13.5px; color: var(--grey-d); max-width: 30ch; line-height: 1.4; text-align: right; }

@media (max-width: 720px) {
  .ar-hero h1 { font-size: 33px; line-height: 1.06; }
  .ar-meta { align-items: flex-start; }
  .ar-share { width: 100%; }
  .ar-copy { flex: 1; }
  .ar-end-sh { margin-left: 0; width: 100%; flex-direction: column; align-items: stretch; }
  .ar-end-sh > span { text-align: left; max-width: none; }
  .article h2 .ar-n { min-width: 34px; height: 24px; margin-right: 10px; font-size: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .ar-kick, .ar-l > span, .ar-lead, .ar-meta { animation: none; }
  .ar-js .ar-rv:not(.in) { opacity: 1; transform: none; }
  .ar-js .ar-rv, .ar-fab, .ar-sheet, .toc ol::after { transition: none; }
}
