/* Капка на ден — стилове
   Светла „хартиена“ тема с тъмна алтернатива. Mobile-first. */

:root {
  --bg: #f5f1e8;
  --paper: #fffdf8;
  --paper-2: #f0ebdf;
  --ink: #1c2226;
  --muted: #545c62;
  --rule: #ddd5c4;
  --thread: #c4baa5;
  --accent: #0e6e6a;
  --accent-ink: #ffffff;
  --repo: #0e6e6a;
  --repo-soft: #dcefec;
  --tool: #8a3b62;
  --tool-soft: #f3e1ea;
  --what: #0e6e6a;
  --why: #a65a12;
  --try: #8a3b62;
  --code-bg: #ece6d8;
  --focus: #1f5fd1;
  --shadow: 0 1px 0 rgba(28, 34, 38, .04), 0 6px 20px -12px rgba(28, 34, 38, .25);

  --font: "Sofia Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  --rail-x: 14px;      /* позиция на нишката (мобилно) */
  --gutter: 40px;      /* отстъп на картата от лявото (мобилно) */
  --radius: 16px;

  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14181c;
    --paper: #1b2127;
    --paper-2: #222930;
    --ink: #ebe7de;
    --muted: #a7afb5;
    --rule: #2e363e;
    --thread: #3c4650;
    --accent: #5cc8bf;
    --accent-ink: #0d1a19;
    --repo: #5cc8bf;
    --repo-soft: #173533;
    --tool: #eb9cc2;
    --tool-soft: #3a2230;
    --what: #5cc8bf;
    --why: #e9a75f;
    --try: #eb9cc2;
    --code-bg: #262e36;
    --focus: #8fb4ff;
    --shadow: 0 1px 0 rgba(0, 0, 0, .3), 0 10px 30px -18px rgba(0, 0, 0, .8);
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-padding-top: 16px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.55;
  text-rendering: optimizeLegibility;
}

.wrap { width: 100%; max-width: 920px; margin: 0 auto; padding: 0 18px; }

a { color: var(--accent); text-underline-offset: .18em; }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
  border-radius: 6px;
}

code {
  font-family: var(--mono);
  font-size: .84em;
  background: var(--code-bg);
  padding: .12em .4em;
  border-radius: 6px;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.skip {
  position: absolute; left: 12px; top: -60px;
  background: var(--ink); color: var(--bg);
  padding: 10px 14px; border-radius: 10px; z-index: 10;
  text-decoration: none; font-weight: 600;
}
.skip:focus { top: 12px; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- Герой ---------- */
.hero { padding: 40px 0 24px; }

.brand {
  display: inline-flex; align-items: center; gap: 8px;
  margin: 0 0 18px;
  font-weight: 800; font-size: .95rem; letter-spacing: .02em;
  text-transform: uppercase; color: var(--accent);
}
.brand__drop { width: 20px; height: 20px; fill: currentColor; }

.hero__title {
  margin: 0;
  font-size: clamp(2.3rem, 9vw, 4.2rem);
  line-height: 1.02;
  font-weight: 800;
  letter-spacing: -.02em;
  max-width: 14ch;
}

.hero__lead {
  margin: 16px 0 0;
  max-width: 46ch;
  font-size: 1.15rem;
  color: var(--muted);
}

.hero__legend {
  list-style: none; margin: 22px 0 0; padding: 0;
  display: flex; flex-wrap: wrap; gap: 8px 18px;
  font-size: .92rem; font-weight: 600;
}
.hero__legend li { display: inline-flex; align-items: center; gap: 8px; }

.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.dot--what { background: var(--what); }
.dot--why { background: var(--why); }
.dot--try { background: var(--try); }

/* ---------- Инструменти ---------- */
.tools {
  margin: 8px 0 28px;
  padding: 16px;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  display: grid; gap: 14px;
}

.search__label, .filter legend {
  display: block; padding: 0;
  font-size: .78rem; font-weight: 800;
  letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 6px;
}

.search__field { position: relative; }
.search__field svg {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 20px; height: 20px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round;
  pointer-events: none;
}
.search__field input {
  width: 100%;
  font: inherit; color: inherit;
  padding: 12px 14px 12px 42px;
  min-height: 48px;
  background: var(--bg);
  border: 1.5px solid var(--rule);
  border-radius: 12px;
}
.search__field input::placeholder { color: var(--muted); opacity: .8; }
.search__field input:focus-visible { outline-offset: 1px; border-color: var(--focus); }

.filter { border: 0; margin: 0; padding: 0; min-width: 0; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }

.chip {
  font: inherit; font-size: .92rem; font-weight: 600;
  color: var(--ink);
  background: transparent;
  border: 1.5px solid var(--rule);
  border-radius: 999px;
  padding: 7px 14px;
  min-height: 40px;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  transition: background-color .15s, border-color .15s, color .15s;
}
.chip:hover { border-color: var(--thread); background: var(--paper-2); }
.chip[aria-pressed="true"] {
  background: var(--ink); color: var(--bg); border-color: var(--ink);
}
.chip__n { font-family: var(--mono); font-size: .75rem; opacity: .7; }

.tools__status {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px;
  font-size: .92rem; color: var(--muted);
}
.tools__status p { margin: 0; }

.link-btn {
  font: inherit; font-weight: 700; color: var(--accent);
  background: none; border: 0; padding: 8px 0; cursor: pointer;
  text-decoration: underline; text-underline-offset: .2em;
}

/* ---------- Линията ---------- */
.line { position: relative; padding-bottom: 32px; outline: none; }
.line__loading, .empty { color: var(--muted); }

.empty {
  text-align: center; padding: 40px 16px;
  border: 1.5px dashed var(--rule); border-radius: var(--radius);
}
.empty strong { display: block; color: var(--ink); font-size: 1.15rem; margin-bottom: 4px; }

.stops { list-style: none; margin: 0; padding: 0; }

.stop {
  position: relative;
  padding: 0 0 26px var(--gutter);
}

/* нишката */
.stop::before {
  content: "";
  position: absolute;
  left: calc(var(--rail-x) - 1.5px);
  top: 0; bottom: 0;
  width: 3px;
  background: var(--thread);
  border-radius: 3px;
}
.stop:first-child::before { top: 22px; }
.stop:last-child::before { bottom: auto; height: 22px; }
.stop:only-child::before { display: none; }

.stop__marker {
  position: absolute;
  left: calc(var(--rail-x) - 11px);
  top: 8px;
  width: 22px; height: 28px;
  color: var(--repo);
}
.stop--tool .stop__marker { color: var(--tool); }
.stop__marker svg { width: 100%; height: 100%; display: block; }
.stop__marker .drop-fill { fill: currentColor; }
.stop__marker .drop-ring { fill: none; stroke: var(--bg); stroke-width: 3; }

.stop--latest .stop__marker::after {
  content: "";
  position: absolute; left: 50%; top: 62%;
  width: 34px; height: 34px; margin: -17px 0 0 -17px;
  border-radius: 50%;
  border: 2px solid currentColor;
  opacity: 0;
  animation: ripple 2.6s ease-out infinite;
}
@keyframes ripple {
  0% { transform: scale(.5); opacity: .55; }
  100% { transform: scale(1.5); opacity: 0; }
}

.stop__date {
  display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px;
  margin: 0 0 8px; padding-top: 10px;
  font-size: .9rem; color: var(--muted);
}
.stop__date time { font-weight: 800; color: var(--ink); }
.stop__weekday { text-transform: lowercase; }
.stop__badge {
  font-size: .72rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
  background: var(--accent); color: var(--accent-ink);
  padding: 2px 8px; border-radius: 999px;
}

/* ---------- Картичка ---------- */
.card {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: border-color .2s, transform .2s;
}
.stop.is-open .card { border-color: var(--thread); }

.card__head {
  padding: 16px 16px 14px;
  cursor: pointer;
}

.card__type {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: .78rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
  color: var(--repo);
  background: var(--repo-soft);
  padding: 3px 10px; border-radius: 999px;
}
.stop--tool .card__type { color: var(--tool); background: var(--tool-soft); }
.card__type svg { width: 14px; height: 14px; fill: currentColor; }

.card__title { margin: 10px 0 6px; font-size: 1.55rem; line-height: 1.15; font-weight: 800; letter-spacing: -.01em; }

.card__toggle {
  font: inherit; color: inherit; font-weight: inherit; letter-spacing: inherit;
  background: none; border: 0; padding: 0; margin: 0;
  text-align: left; cursor: pointer;
  display: inline-flex; align-items: center; gap: 10px;
}
.card__toggle:hover .card__name { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: .15em; }
.card__chev {
  flex: none; width: 28px; height: 28px; border-radius: 50%;
  display: inline-grid; place-items: center;
  background: var(--paper-2);
  transition: transform .25s ease;
}
.card__chev svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.stop.is-open .card__chev { transform: rotate(180deg); }

.card__summary { margin: 0; color: var(--muted); }
.stop:not(.is-open) .card__summary {
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.stop.is-open .card__summary { display: none; }

.tags { list-style: none; margin: 0; padding: 0 16px 16px; display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  font: inherit; font-size: .82rem; font-weight: 600;
  color: var(--muted);
  background: var(--paper-2);
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 4px 10px; min-height: 32px;
  cursor: pointer;
}
.tag::before { content: "#"; opacity: .55; margin-right: 1px; }
.tag:hover { color: var(--ink); border-color: var(--rule); }
.tag[aria-pressed="true"] { color: var(--bg); background: var(--ink); }

/* детайл */
.card__detail {
  border-top: 1px dashed var(--rule);
  padding: 4px 16px 18px;
}
.card__detail[hidden] { display: none; }

.part { padding: 14px 0 4px; }
.part + .part { border-top: 1px solid var(--rule); }
.part__h {
  display: flex; align-items: center; gap: 8px;
  margin: 0 0 6px;
  font-size: .8rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
}
.part--what .part__h { color: var(--what); }
.part--why .part__h { color: var(--why); }
.part--try .part__h { color: var(--try); }
.part p { margin: 0; }

.steps { list-style: none; counter-reset: step; margin: 4px 0 0; padding: 0; display: grid; gap: 10px; }
.steps li {
  counter-increment: step;
  position: relative;
  padding: 10px 12px 10px 46px;
  background: var(--paper-2);
  border-radius: 12px;
}
.steps code {
  white-space: pre-wrap;
  overflow-wrap: break-word;
  word-break: normal;
}
.steps li::before {
  content: counter(step);
  position: absolute; left: 10px; top: 9px;
  width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--mono); font-weight: 600; font-size: .85rem;
  background: var(--try); color: var(--paper);
}

.card__actions {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px;
  margin-top: 18px;
}
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 46px; padding: 10px 18px;
  font-weight: 800; text-decoration: none;
  background: var(--accent); color: var(--accent-ink);
  border-radius: 12px;
}
.btn:hover { filter: brightness(1.08); }
.btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

.extra { display: flex; flex-wrap: wrap; gap: 6px 14px; font-weight: 600; font-size: .95rem; }

.copy-link {
  font: inherit; font-size: .9rem; font-weight: 600; color: var(--muted);
  background: none; border: 0; padding: 6px 0; cursor: pointer;
  text-decoration: underline; text-underline-offset: .2em;
}

/* ---------- Футър ---------- */
.foot {
  border-top: 1px solid var(--rule);
  padding: 26px 0 40px;
  color: var(--muted); font-size: .95rem;
}
.foot p { margin: 0; }
.foot__small { margin-top: 4px !important; font-size: .85rem; }

/* ---------- По-широки екрани ---------- */
@media (min-width: 560px) {
  .wrap { padding: 0 28px; }
  .card__head { padding: 20px 22px 14px; }
  .tags { padding: 0 22px 20px; }
  .card__detail { padding: 6px 22px 22px; }
}

@media (min-width: 900px) {
  :root { --rail-x: 190px; --gutter: 230px; }
  .hero { padding: 72px 0 36px; }
  .tools { padding: 20px 22px; gap: 16px; }

  .stop { padding-bottom: 34px; }
  .stop__date {
    position: absolute; left: 0; top: 10px;
    width: calc(var(--rail-x) - 26px);
    flex-direction: column; align-items: flex-end; text-align: right;
    gap: 2px; padding-top: 0; margin: 0;
  }
  .stop__date time { font-size: 1.05rem; }
  .card__title { font-size: 1.8rem; }
}

/* ---------- Достъпност ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

@media (forced-colors: active) {
  .stop::before { background: CanvasText; }
  .chip[aria-pressed="true"], .tag[aria-pressed="true"] { outline: 2px solid Highlight; }
}

@media print {
  .tools, .skip, .card__chev, .copy-link { display: none !important; }
  .card__detail[hidden] { display: block !important; }
  .stop:not(.is-open) .card__summary { display: none; }
}
