/* zdravkov.info - single stylesheet
   Maps onto a Ghost theme: body classes .home-template, .post-template,
   .page-template, .tag-template come from Ghost's {{body_class}}. */

:root {
  --bg: #fcfcfa;
  --bg-alt: #f4f3ef;
  --ink: #1c1e21;
  --muted: #5b6270;
  --rule: #e3e1da;
  --accent: #24518f;        /* links, primary action */
  --accent-ink: #1c3f70;    /* hover */
  --accent2: #e8a23c;       /* warm amber, decorative only */
  --code-bg: #f4f3ef;
  --serif: "Charter", "Bitstream Charter", "Sitka Text", Cambria, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
  --measure: 42rem;         /* ~68 characters at 1.0625rem Charter */
  --wide: 66rem;
}

/* ---------- Reset & base ---------- */

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

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

img { max-width: 100%; height: auto; display: block; }

a { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent-ink); }

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

::selection { background: #d9e4f2; }

h1, h2, h3, h4 { font-family: var(--serif); font-weight: 700; line-height: 1.25; margin: 0; text-wrap: balance; }

.wrap { max-width: var(--wide); margin: 0 auto; padding: 0 1.25rem; }

/* ---------- Graphic motifs: engineering grid, crosshairs, numbered sections ---------- */

/* Faint technical grid behind the hero portrait */
.portrait-plot {
  position: relative;
  padding: 2.5rem;
  background-image:
    linear-gradient(var(--rule) 1px, transparent 1px),
    linear-gradient(90deg, var(--rule) 1px, transparent 1px);
  background-size: 28px 28px;
  background-position: center;
}
.portrait-plot::before, .portrait-plot::after,
.portrait-plot .mark::before, .portrait-plot .mark::after {
  content: "+";
  position: absolute;
  font-family: var(--mono); font-size: 0.9rem; line-height: 1;
  color: var(--accent);
}
.portrait-plot::before { top: -0.45em; left: -0.3em; }
.portrait-plot::after { bottom: -0.45em; right: -0.3em; }
.portrait-plot .mark::before { top: -0.45em; right: -0.3em; }
.portrait-plot .mark::after { bottom: -0.45em; left: -0.3em; }

/* Numbered section labels: <p class="kicker" data-num="01"> */
.kicker[data-num]::before {
  content: attr(data-num);
  color: var(--accent);
  margin-right: 1.25em;
}

/* Short accent tick under section h2s */
.section > .wrap > h2::after {
  content: "";
  display: block;
  width: 2rem; height: 3px;
  background: var(--accent2);
  margin-top: 0.75rem;
}

/* Quiet geometric background shapes (amber, decorative) */
.deco { position: absolute; pointer-events: none; }
.deco-circle {
  width: 380px; height: 380px; border-radius: 50%;
  background: var(--accent2);
  opacity: 0.2;
  top: -190px; right: -120px;
}
.deco-arc {
  width: 220px; height: 220px;
  background: var(--accent);
  border-radius: 0 0 100% 0;
  opacity: 0.2;
  top: 0; left: max(-60px, calc(50% - 36rem));
}
.deco-dot {
  width: 10px; height: 10px;
  background: var(--accent);
  border-radius: 50%;
  opacity: 0.2;
}
.deco-square {
  width: 56px; height: 56px;
  background: var(--accent2);
  opacity: 0.2;
  transform: rotate(12deg);
}
.deco-circle-sm {
  width: 90px; height: 90px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.2;
}
@media (max-width: 719px) { .deco-square, .deco-circle-sm { display: none; } }

/* Small uppercase mono label used for section headings and meta */
.kicker {
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.skip-link {
  position: absolute; left: -999px; top: 0;
  background: var(--ink); color: #fff; padding: 0.5rem 1rem; z-index: 10;
}
.skip-link:focus { left: 0; }

/* ---------- Header ---------- */

.site-header { border-bottom: 1px solid var(--rule); }

.site-header .wrap {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.75rem 2rem;
  padding-top: 1.1rem; padding-bottom: 1.1rem;
}

.site-title {
  font-family: var(--mono); font-size: 0.9375rem; font-weight: 600;
  letter-spacing: 0.02em; color: var(--ink); text-decoration: none;
}
.site-title:hover { color: var(--accent); }

.site-nav { margin-left: auto; display: flex; flex-wrap: wrap; gap: 1.4rem; }

.site-nav a {
  font-family: var(--sans); font-size: 0.9375rem; color: var(--ink);
  text-decoration: none;
}
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--accent); }
.site-nav a[aria-current="page"] { text-decoration: underline; text-underline-offset: 5px; }

/* ---------- Footer ---------- */

.site-footer { border-top: 1px solid var(--rule); margin-top: 5rem; background: var(--bg-alt); }

.site-footer .wrap {
  display: grid; gap: 2rem; grid-template-columns: 1fr;
  padding-top: 2.5rem; padding-bottom: 2.5rem;
}
@media (min-width: 640px) { .site-footer .wrap { grid-template-columns: 2fr 1fr 1fr; } }

.site-footer p { margin: 0.25rem 0 0; font-size: 0.9375rem; color: var(--muted); }
.site-footer ul { list-style: none; margin: 0.25rem 0 0; padding: 0; }
.site-footer li { margin: 0.35rem 0; }
.site-footer a { font-family: var(--sans); font-size: 0.9375rem; }

/* ---------- Home ---------- */

.hero { padding: 4.5rem 0 2rem; position: relative; overflow: hidden; }
.hero .wrap {
  display: grid; gap: 2.5rem; align-items: center;
  grid-template-columns: 1fr;
}
@media (min-width: 720px) { .hero .wrap { grid-template-columns: 1fr auto; gap: 4rem; } }

.hero h1 { font-size: clamp(2rem, 5vw, 3rem); letter-spacing: -0.015em; margin: 0.75rem 0 1rem; }
.hero .lede { font-size: 1.1875rem; max-width: 34em; margin: 0 0 2rem; color: var(--ink); }
.hero .lede .sub { color: var(--muted); }

.portrait { width: 168px; border-radius: 50%; position: relative; }
@media (min-width: 720px) { .portrait { width: 216px; } }
@media (max-width: 719px) { .portrait-plot { justify-self: start; } }

.button {
  display: inline-block; font-family: var(--sans); font-size: 0.9375rem; font-weight: 600;
  color: #fff; background: var(--accent); text-decoration: none;
  padding: 0.7rem 1.4rem; border-radius: 3px;
}
.button:hover { background: var(--accent-ink); color: #fff; }

.section { padding: 3.5rem 0 0; position: relative; overflow: hidden; }
.section > .wrap > h2 { font-size: 1.5rem; margin: 0.6rem 0 1.75rem; }
.section .kicker { display: block; padding-top: 1.5rem; border-top: 1px solid var(--rule); }

/* What I do */
.services { display: grid; gap: 2rem; margin: 0; padding: 0; list-style: none; }
@media (min-width: 720px) { .services { grid-template-columns: repeat(3, 1fr); gap: 2.5rem; } }
.services h3 { font-size: 1.125rem; margin-bottom: 0.5rem; }
.services p { margin: 0; font-size: 0.9875rem; color: var(--muted); }

/* How I work */
.principles { display: grid; gap: 1.25rem 2.5rem; margin: 0; padding: 0; list-style: none; counter-reset: p; }
@media (min-width: 720px) { .principles { grid-template-columns: 1fr 1fr; } }
.principles li { counter-increment: p; display: grid; grid-template-columns: auto 1fr; gap: 1rem; font-size: 0.9875rem; }
.principles li::before {
  content: "0" counter(p);
  font-family: var(--mono); font-size: 0.8125rem; color: var(--muted); padding-top: 0.2em;
}

/* Selected work */
.work { display: grid; gap: 1px; margin: 0; padding: 0; list-style: none; background: var(--rule); border: 1px solid var(--rule); }
@media (min-width: 720px) { .work { grid-template-columns: 1fr 1fr; } }
.work li { background: var(--bg); padding: 1.5rem 1.6rem; }
.work h3 { font-size: 1.0625rem; margin-bottom: 0.35rem; }
.work h3 a { color: inherit; text-decoration: none; }
.work h3 a:hover { color: var(--accent); }
.work p { margin: 0; font-size: 0.9375rem; color: var(--muted); }
.work .kicker { border: 0; padding: 0; display: block; margin-bottom: 0.6rem; }

/* Research */
.research-box { border-left: 3px solid var(--accent); padding: 0.25rem 0 0.25rem 1.5rem; max-width: var(--measure); }
.research-box p { margin: 0 0 0.5rem; }
.research-box .meta { font-family: var(--mono); font-size: 0.8125rem; color: var(--muted); }

/* Writing (post lists, shared with blog index) */
.post-list { margin: 0; padding: 0; list-style: none; }
.post-list li { border-top: 1px solid var(--rule); }
.post-list li:last-child { border-bottom: 1px solid var(--rule); }

.post-card { display: block; padding: 1.5rem 0; text-decoration: none; color: inherit; }
.post-card:hover h3 { color: var(--accent); }
.post-card .meta { font-family: var(--mono); font-size: 0.8125rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 0.6rem 1.25rem; margin-bottom: 0.4rem; }
.post-card h3 { font-size: 1.25rem; margin: 0 0 0.35rem; }
.post-card p { margin: 0; color: var(--muted); font-size: 0.9875rem; max-width: 46em; }
.post-card .tags { margin-top: 0.5rem; font-family: var(--sans); font-size: 0.8125rem; color: var(--muted); }

.more-link { font-family: var(--sans); font-size: 0.9375rem; }

/* Contact */
.contact-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 0.5rem; }
.contact-list .kicker { border: 0; padding: 0; display: inline-block; width: 6.5rem; }
.contact-note { color: var(--muted); max-width: var(--measure); }
.firm-line { font-family: var(--mono); font-size: 0.8125rem; color: var(--muted); margin-top: 2rem; }

/* ---------- Blog index / tag archive ---------- */

.page-head { padding: 3.5rem 0 1rem; }
.page-head h1 { font-size: clamp(1.75rem, 4vw, 2.5rem); margin: 0.6rem 0 0.75rem; }
.page-head h1::after { content: ""; display: block; width: 2rem; height: 3px; background: var(--accent2); margin-top: 0.9rem; }
.page-head p { margin: 0; color: var(--muted); max-width: var(--measure); }

.tag-filter { display: flex; flex-wrap: wrap; gap: 0.5rem; padding: 1.5rem 0 0.5rem; }
.tag-filter a {
  font-family: var(--sans); font-size: 0.8125rem; text-decoration: none; color: var(--ink);
  border: 1px solid var(--rule); border-radius: 999px; padding: 0.25rem 0.8rem; background: var(--bg);
}
.tag-filter a:hover { border-color: var(--accent); color: var(--accent); }
.tag-filter a[aria-current="page"] { background: var(--ink); border-color: var(--ink); color: #fff; }

.pagination { display: flex; justify-content: space-between; align-items: baseline; padding: 2.5rem 0; font-family: var(--sans); font-size: 0.9375rem; }
.pagination .page-number { color: var(--muted); font-family: var(--mono); font-size: 0.8125rem; }

/* ---------- Single post / page ---------- */

.post { padding-top: 4rem; }
.post-header { max-width: var(--measure); margin: 0 auto; padding: 0 1.25rem; }
.post-header .meta { font-family: var(--mono); font-size: 0.8125rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 0.6rem 1.25rem; }
.post-header h1 { font-size: clamp(1.875rem, 4.5vw, 2.625rem); margin: 0.75rem 0 1rem; }
.post-header .post-excerpt { font-size: 1.1875rem; color: var(--muted); margin: 0; }
.post-header .tags { margin-top: 1.25rem; font-family: var(--sans); font-size: 0.875rem; }
.post-header .tags a { color: var(--muted); }
.post-header .tags a:hover { color: var(--accent); }

/* Long-form content. Ghost renders post HTML into .gh-content. */
.gh-content { max-width: var(--measure); margin: 0 auto; padding: 2.5rem 1.25rem 0; }

.gh-content > * + * { margin-top: 1.25rem; }
.gh-content p { margin: 0; }
.gh-content h2 { font-size: 1.5rem; margin-top: 2.75rem; }
.gh-content h3 { font-size: 1.1875rem; margin-top: 2.25rem; }
.gh-content h2 + p, .gh-content h3 + p { margin-top: 0.75rem; }
.gh-content ul, .gh-content ol { padding-left: 1.4rem; margin-bottom: 0; }
.gh-content li { margin: 0.4rem 0; }
.gh-content li::marker { color: var(--muted); }
.gh-content hr { border: 0; border-top: 1px solid var(--rule); margin-top: 2.75rem; }
.gh-content strong { font-weight: 700; }

.gh-content code {
  font-family: var(--mono); font-size: 0.875em;
  background: var(--code-bg); border: 1px solid var(--rule);
  padding: 0.1em 0.35em; border-radius: 3px;
}

.gh-content blockquote {
  margin: 1.75rem 0 0; padding: 0.25rem 0 0.25rem 1.5rem;
  border-left: 3px solid var(--accent);
  color: var(--muted); font-style: italic; font-size: 1.0625rem;
}
.gh-content blockquote p + p { margin-top: 0.75rem; }

/* Ghost cards */
.kg-card { margin-top: 1.75rem; }

.kg-code-card, .gh-content pre {
  margin-top: 1.75rem; background: var(--code-bg); border: 1px solid var(--rule);
  border-radius: 4px; overflow-x: auto;
}
.gh-content pre {
  padding: 1.1rem 1.25rem; font-family: var(--mono); font-size: 0.8125rem; line-height: 1.6;
}
.gh-content pre code { background: none; border: 0; padding: 0; font-size: inherit; }
.kg-code-card pre { margin-top: 0; border: 0; border-radius: 0; }
.kg-code-card figcaption {
  font-family: var(--mono); font-size: 0.75rem; color: var(--muted);
  padding: 0.5rem 1.25rem; border-top: 1px solid var(--rule);
}

.kg-image-card { margin-left: 0; margin-right: 0; }
.kg-image-card img { width: 100%; border: 1px solid var(--rule); border-radius: 4px; }
.kg-image-card figcaption, .kg-card figcaption {
  font-family: var(--sans); font-size: 0.8125rem; color: var(--muted);
  margin-top: 0.6rem; text-align: center;
}

.kg-bookmark-card a { text-decoration: none; color: inherit; display: block; }
.kg-bookmark-container { border: 1px solid var(--rule); border-radius: 4px; padding: 1rem 1.25rem; }
.kg-bookmark-container:hover { border-color: var(--accent); }
.kg-bookmark-title { font-family: var(--sans); font-weight: 600; font-size: 0.9375rem; }
.kg-bookmark-description { font-family: var(--sans); font-size: 0.875rem; color: var(--muted); margin-top: 0.25rem; }
.kg-bookmark-metadata { font-family: var(--mono); font-size: 0.75rem; color: var(--muted); margin-top: 0.6rem; }

/* Author block at the end of a post */
.post-footer { max-width: var(--measure); margin: 3.5rem auto 0; padding: 0 1.25rem; }
.author-card {
  display: grid; grid-template-columns: auto 1fr; gap: 1.25rem; align-items: center;
  border-top: 1px solid var(--rule); padding-top: 2rem;
}
.author-card img { width: 64px; border-radius: 50%; }
.author-card p { margin: 0; font-size: 0.9375rem; color: var(--muted); }
.author-card .name { font-family: var(--sans); font-weight: 600; color: var(--ink); font-size: 0.9375rem; }

/* Subscribe (Ghost members) - discreet */
.subscribe {
  max-width: var(--measure); margin: 2.5rem auto 0; padding: 0 1.25rem;
}
.subscribe-inner { background: var(--bg-alt); border: 1px solid var(--rule); border-radius: 4px; padding: 1.5rem 1.6rem; }
.subscribe p { margin: 0 0 0.9rem; font-size: 0.9375rem; color: var(--muted); }
.subscribe form { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.subscribe input[type="email"] {
  flex: 1 1 14rem; font-family: var(--sans); font-size: 0.9375rem;
  padding: 0.6rem 0.9rem; border: 1px solid var(--rule); border-radius: 3px; background: var(--bg);
  color: var(--ink);
}
.subscribe input[type="email"]:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.subscribe button {
  font-family: var(--sans); font-size: 0.9375rem; font-weight: 600; cursor: pointer;
  color: #fff; background: var(--ink); border: 0; border-radius: 3px; padding: 0.6rem 1.2rem;
}
.subscribe button:hover { background: var(--accent-ink); }

/* Generic page tweaks */
.page-template .post-header h1 { font-size: clamp(1.75rem, 4vw, 2.25rem); }


/* Ghost editor width cards */
.gh-content .kg-width-wide { max-width: 52rem; margin-left: auto; margin-right: auto; }
.gh-content .kg-width-full { max-width: 100%; margin-left: calc(50% - 50vw); margin-right: calc(50% - 50vw); width: 100vw; }
.gh-content .kg-width-full img { width: 100%; }


/* По-плътен ритъм на секциите след hero */
.hero + .section { padding-top: 2.5rem; }

/* Key takeaways callout: a bold-only paragraph immediately followed by a list.
   Matches the "Key takeaways" pattern in articles; FAQ questions are followed
   by paragraphs, not lists, so they stay untouched. */
.gh-content p:has(> strong:only-child):has(+ ul) {
  margin-top: 2rem;
  margin-bottom: 0;
  padding: 1rem 1.5rem 0;
  background: var(--bg-alt);
  border-left: 3px solid var(--accent2);
  border-radius: 10px 10px 0 0;
}
.gh-content p:has(> strong:only-child):has(+ ul) strong {
  font-family: var(--mono);
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-ink);
}
.gh-content p:has(> strong:only-child) + ul {
  margin-top: 0;
  padding: 0.35rem 1.5rem 1.15rem 2.9rem;
  background: var(--bg-alt);
  border-left: 3px solid var(--accent2);
  border-radius: 0 0 10px 10px;
}
.gh-content p:has(> strong:only-child) + ul li::marker { color: var(--accent2); }
