/* DeskAnkor - основни стилове. Без вградени (inline) стилове в HTML: CSP е style-src 'self'. */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 1.5rem; }
body {
  margin: 0;
  background: var(--bg-page);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: var(--step-0);
  line-height: 1.6;
  overflow-wrap: break-word;
}
img { display: block; max-width: 100%; height: auto; }
a { color: var(--accent); text-underline-offset: 0.18em; }
a:hover { color: var(--accent-hover); }
:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 3px; border-radius: 2px; }
h1, h2, h3 { margin: 0; line-height: 1.15; text-wrap: balance; font-weight: 700; }
h1 { font-size: var(--step-3); font-weight: 750; line-height: 1.08; }
h2 { font-size: var(--step-2); }
h3 { font-size: var(--step-1); line-height: 1.25; }
p { margin: 0 0 var(--space-2); max-width: 66ch; }
ul, ol { margin: 0; padding: 0; }
code, .kbd {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--bg-sunken);
  border-radius: var(--radius-s);
  padding: 0.1em 0.4em;
}
.container { width: min(100% - 2 * var(--gutter), var(--container)); margin-inline: auto; }
.skip-link {
  position: absolute; left: var(--space-2); top: -4rem; z-index: 10;
  background: var(--text-primary); color: #fff; padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-s);
}
.skip-link:focus { top: var(--space-1); }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}

/* Хедър */
.site-header { padding-block: var(--space-2); }
.site-header .container { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 0.65rem; color: var(--text-primary); text-decoration: none; font-weight: 750; font-size: 1.2rem; }
.brand img { width: 36px; height: 36px; border-radius: 9px; }
.brand:hover { color: var(--text-primary); }
.nav { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.nav ul { display: flex; gap: var(--space-3); list-style: none; flex-wrap: wrap; }
.nav a:not(.btn) { color: var(--text-primary); text-decoration: none; padding-block: 0.7rem; display: inline-block; }
.nav a:not(.btn):hover { text-decoration: underline; text-underline-offset: 0.3em; }

@media (max-width: 47.99rem) {
  .site-header .container { flex-wrap: nowrap; }
  .nav ul { display: none; }
  .nav .btn { min-height: 44px; padding: 0.5rem 1rem; }
  .brand span { font-size: 1.1rem; }
  .status-bar .container { gap: 0.1rem 1rem; padding-block: 0.5rem; }
  .status-bar .container span:last-child { display: none; }
}

/* Бутони */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  min-height: 48px; padding: 0.7rem 1.35rem; border-radius: var(--radius-m);
  font: inherit; font-weight: 650; text-decoration: none; cursor: pointer;
  border: 2px solid transparent;
  transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); color: var(--on-accent); }
.btn-ghost { background: transparent; color: var(--text-primary); border-color: var(--border-strong); }
.btn-ghost:hover { background: var(--bg-sunken); color: var(--text-primary); }
.btn[disabled] { opacity: 0.6; cursor: progress; }

/* Лента със статус */
.status-bar { border-block: 1px solid var(--border-subtle); background: var(--bg-surface); font-size: var(--step--1); }
.status-bar .container { display: flex; flex-wrap: wrap; gap: 0.25rem var(--space-4); padding-block: 0.6rem; }
.status-bar strong { font-weight: 700; }
.status-bar .pill {
  display: inline-flex; align-items: center; gap: 0.45rem; font-weight: 700;
  color: var(--text-primary);
}
.status-bar .pill::before { content: ""; width: 0.6rem; height: 0.6rem; border-radius: 50%; background: var(--state-unsaved); }

/* Hero */
.hero { padding-top: var(--space-6); }
.hero-copy { max-width: 46rem; }
.hero .lead { font-size: var(--step-1); line-height: 1.5; color: var(--text-muted); margin-top: var(--space-3); max-width: 44rem; }
.hero .actions { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-4); }
.hero .fineprint { margin-top: var(--space-2); font-size: var(--step--1); color: var(--text-muted); }
.facts {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  margin: var(--space-6) 0 0; padding: 0; border-top: 1px solid var(--border-subtle);
}
.facts > div { padding: var(--space-2) var(--space-3) var(--space-2) 0; }
.facts dt { font-weight: 700; }
.facts dd { margin: 0; color: var(--text-muted); font-size: var(--step--1); }

/* Прозорец със скрийншот */
.window { margin: 0; }
.window .frame {
  background: var(--bg-app); border-radius: var(--radius-l); overflow: hidden;
  box-shadow: var(--shadow-l); border: 1px solid #3a3d42;
}
.window img { width: 100%; }
.window figcaption { margin-top: var(--space-1); font-size: var(--step--1); color: var(--text-muted); }
.hero .window { margin-top: var(--space-4); }
.hero .facts { margin-top: var(--space-4); }

/* Секции */
.section { padding-block: var(--space-12); }
.section.alt { background: var(--bg-surface); border-block: 1px solid var(--border-subtle); }
.section-head { max-width: 46rem; margin-bottom: var(--space-6); }
.section-head p { color: var(--text-muted); margin-top: var(--space-2); }
.split { display: grid; gap: var(--space-6); align-items: start; }
@media (min-width: 60rem) { .split { grid-template-columns: 7fr 5fr; gap: var(--space-8); } .split.flip { grid-template-columns: 5fr 7fr; } }

/* Стъпки */
.steps { list-style: none; counter-reset: step; display: grid; gap: var(--space-4); }
.steps li { counter-increment: step; display: grid; grid-template-columns: 3rem 1fr; gap: var(--space-2); }
.steps li::before {
  content: counter(step); display: grid; place-items: center; width: 2.4rem; height: 2.4rem;
  border: 2px solid var(--text-primary); border-radius: 50%; font-weight: 750;
}
.steps h3 { margin-bottom: 0.25rem; }
.steps p { margin: 0; color: var(--text-muted); }

/* Какво прави / какво не */
.cols { display: grid; gap: var(--space-3); }
@media (min-width: 50rem) { .cols { grid-template-columns: 1fr 1fr; } }
.card { background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: var(--radius-l); padding: var(--space-4); box-shadow: var(--shadow-s); }
.section.alt .card { background: var(--bg-page); box-shadow: none; }
.card h3 { margin-bottom: var(--space-2); display: flex; align-items: center; gap: 0.6rem; }
.card ul { list-style: none; display: grid; gap: 0.9rem; }
.card li { display: grid; grid-template-columns: 1.4rem 1fr; gap: 0.7rem; }
.card li svg { width: 1.4rem; height: 1.4rem; margin-top: 0.15rem; }
.card.does svg { color: var(--state-saved); }
.card.doesnt svg { color: var(--state-blocked); }
.card li span { display: block; }
.card li small { display: block; color: var(--text-muted); font-size: var(--step--1); line-height: 1.45; }

/* Състояния на файловете */
.states { list-style: none; display: grid; margin-top: var(--space-4); border-top: 1px solid var(--border-subtle); }
.states li {
  display: grid; grid-template-columns: 1.6rem minmax(9.5rem, 13rem) 1fr; gap: var(--space-2);
  padding: 0.95rem 0; border-bottom: 1px solid var(--border-subtle); align-items: baseline;
}
@media (max-width: 40rem) { .states li { grid-template-columns: 1.6rem 1fr; } .states li p { grid-column: 2; } }
.states .dot { width: 0.9rem; height: 0.9rem; border-radius: 50%; background: var(--c); margin-top: 0.4rem; justify-self: center; }
.states .name { font-family: var(--font-mono); font-size: 0.92rem; font-weight: 600; }
.states p { margin: 0; color: var(--text-muted); }
.states .saved { --c: var(--state-saved); }
.states .unsaved { --c: var(--state-unsaved); }
.states .blocked { --c: var(--state-blocked); }
/* Подпис: точките светват една по една (само при JS и без prefers-reduced-motion) */
.states.is-armed .dot { background: var(--state-none); transform: scale(0.7); }
.states.is-armed.is-live .dot { background: var(--c); transform: scale(1); transition: background-color 500ms var(--ease), transform 500ms var(--ease); }
.states.is-armed.is-live li:nth-child(2) .dot { transition-delay: 350ms; }
.states.is-armed.is-live li:nth-child(3) .dot { transition-delay: 700ms; }
.states.is-armed.is-live li:nth-child(4) .dot { transition-delay: 1050ms; }

.callout { margin-top: var(--space-4); border-left: 4px solid var(--accent); background: var(--accent-soft); padding: var(--space-2) var(--space-3); border-radius: 0 var(--radius-m) var(--radius-m) 0; }
.callout p { margin: 0; max-width: none; }
.callout p + p { margin-top: 0.6rem; }

/* Таблица „вече има“ */
.table-wrap { overflow-x: auto; border: 1px solid var(--border-subtle); border-radius: var(--radius-m); background: var(--bg-surface); }
table { border-collapse: collapse; width: 100%; min-width: 36rem; }
th, td { text-align: left; vertical-align: top; padding: 0.9rem 1rem; border-bottom: 1px solid var(--border-subtle); }
th { background: var(--bg-sunken); font-weight: 700; font-size: var(--step--1); }
tr:last-child td { border-bottom: 0; }
td:first-child { font-weight: 650; }

/* Бета блок */
.alpha-grid { display: grid; gap: var(--space-6); align-items: start; }
.alpha-grid h2 { margin-bottom: var(--space-2); }
@media (min-width: 60rem) { .alpha-grid { grid-template-columns: 1fr 1fr; gap: var(--space-8); } }
.meta { margin: var(--space-3) 0; display: grid; grid-template-columns: max-content 1fr; gap: 0.35rem var(--space-3); font-size: var(--step--1); border-block: 1px solid var(--border-subtle); padding-block: var(--space-2); }
.meta dt { font-weight: 700; }
.meta dd { margin: 0; color: var(--text-muted); }
details { border-bottom: 1px solid var(--border-subtle); }
details:first-of-type { border-top: 1px solid var(--border-subtle); }
summary { cursor: pointer; font-weight: 650; padding: 1rem 0; min-height: 48px; list-style: none; display: flex; justify-content: space-between; gap: var(--space-2); }
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; font-size: 1.4rem; line-height: 1; font-weight: 400; }
details[open] summary::after { content: "−"; }
details > div { padding: 0 0 var(--space-2); color: var(--text-muted); }
details > div p:last-child { margin-bottom: 0; }

/* Форма */
.form { background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: var(--radius-l); padding: var(--space-4); box-shadow: var(--shadow-s); }
.form h3 { margin-bottom: var(--space-1); }
.form > p { color: var(--text-muted); }
.field { margin-top: var(--space-3); }
.field label { display: block; font-weight: 650; margin-bottom: 0.35rem; }
.field .hint { display: block; font-weight: 400; color: var(--text-muted); font-size: var(--step--1); }
.field input, .field select, .field textarea {
  width: 100%; min-height: 48px; padding: 0.65rem 0.8rem; font: inherit; color: inherit;
  background: #fff; border: 2px solid var(--border-strong); border-radius: var(--radius-m);
}
.field textarea { min-height: 6.5rem; resize: vertical; }
.field input:focus-visible, .field select:focus-visible, .field textarea:focus-visible { outline-offset: 1px; border-color: var(--focus-ring); }
.field [aria-invalid="true"] { border-color: var(--state-blocked); }
.field .error { color: var(--state-blocked); font-size: var(--step--1); margin-top: 0.3rem; font-weight: 600; }
.form .trap { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.form .submit-row { margin-top: var(--space-3); display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }
.form .legal { font-size: var(--step--1); color: var(--text-muted); margin: var(--space-2) 0 0; }
.form-status { margin-top: var(--space-2); font-weight: 650; }
.form-status.ok { color: var(--state-saved); }
.form-status.err { color: var(--state-blocked); }

/* ЧЗВ */
.faq { max-width: 50rem; }

/* Подвал */
.site-footer { padding-block: var(--space-6); border-top: 1px solid var(--border-subtle); font-size: var(--step--1); color: var(--text-muted); }
.site-footer .container { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-4); justify-content: space-between; }
.site-footer a { color: var(--text-muted); }

/* Страница „Поверителност“ */
.prose { max-width: 46rem; padding-block: var(--space-8) var(--space-12); }
.prose h1 { margin-bottom: var(--space-3); }
.prose h2 { font-size: var(--step-1); margin: var(--space-4) 0 var(--space-1); }
.draft { background: #fff4e5; border: 2px solid var(--state-unsaved); padding: var(--space-2) var(--space-3); border-radius: var(--radius-m); margin-bottom: var(--space-4); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
@media (forced-colors: active) {
  .btn-primary { border-color: ButtonText; }
  .states .dot { border: 2px solid CanvasText; }
}
