/* v2: кнопки в тексті статті не перефарбовуються правилом .a-body a
   Статті Document Servis Plus — той самий токен-набір, що й головна.
   Файл версіонований (v1): /assets/* кешується на рік як immutable,
   тож при змінах стилю — нове ім'я файлу (article.v2.css) і правка в build-articles.js. */

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

:root {
  --obsidian:  #000000;
  --graphite:  #0e0e0e;
  --carbon:    #1d1d1f;
  --steel:     #333336;
  --slate:     #6e6e73;
  --ash:       #8f8f94;
  --porcelain: #f5f5f7;
  --text:      #d2d2d7;
  --gold:      #d4ae5c;
  --gold-lt:   #ecd59b;
  --gold-dk:   #8d6d28;
  --pad:   clamp(20px, 5vw, 64px);
  --max:   1200px;
  --read:  720px;
  --nav-h: 52px;
  --r:     28px;
}

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  background: var(--obsidian); color: var(--porcelain);
  font-family: 'Onest', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 17px; line-height: 1.6; letter-spacing: -.005em;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--gold-lt); outline-offset: 3px; border-radius: 6px; }
::selection { background: var(--gold); color: #000; }
[id] { scroll-margin-top: calc(var(--nav-h) + 16px); }

.wrap { width: 100%; max-width: var(--max); margin-inline: auto; padding-inline: var(--pad); }
.read { width: 100%; max-width: calc(var(--read) + 2 * var(--pad)); margin-inline: auto; padding-inline: var(--pad); }

/* ── nav (як на головній) ─────────────────────────── */
.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 90; height: var(--nav-h);
  background: rgba(14,14,14,.82);
  backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.nav__in { height: 100%; display: flex; align-items: center; gap: 20px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-size: 14px; font-weight: 600; letter-spacing: -.01em; }
.brand svg { width: 30px; height: 30px; }
.brand span b { color: var(--gold); font-weight: 600; }
.nav__in > nav { margin-inline: auto; }
.nav__links { display: flex; gap: clamp(18px, 2.6vw, 34px); list-style: none; }
.nav__links a { font-size: 13px; color: rgba(245,245,247,.8); text-decoration: none; transition: color .2s; padding: 8px 0; }
.nav__links a:hover, .nav__links a[aria-current="page"] { color: #fff; }
.lang { margin-right: -8px; min-width: 44px; min-height: 44px; display: inline-grid; place-items: center; font-size: 13px; font-weight: 600; letter-spacing: .04em; color: rgba(245,245,247,.8); text-decoration: none; }
.lang:hover { color: var(--gold-lt); }
.burger { display: none; width: 44px; height: 44px; margin-right: -10px; background: none; border: 0; color: var(--porcelain); cursor: pointer; align-items: center; justify-content: center; }
.burger span, .burger span::before, .burger span::after { display: block; width: 17px; height: 1.5px; background: currentColor; border-radius: 2px; transition: transform .3s ease, background .2s; }
.burger span { position: relative; }
.burger span::before, .burger span::after { content: ''; position: absolute; left: 0; }
.burger span::before { top: -5px; } .burger span::after { top: 5px; }
.burger[aria-expanded="true"] span { background: transparent; }
.burger[aria-expanded="true"] span::before { transform: translateY(5px) rotate(45deg); }
.burger[aria-expanded="true"] span::after  { transform: translateY(-5px) rotate(-45deg); }

.pill { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 11px 22px; border-radius: 980px; font: 500 15px/1 'Onest', sans-serif; letter-spacing: -.01em; text-decoration: none; cursor: pointer; border: 0; transition: background .2s, box-shadow .2s; }
.pill svg { width: 17px; height: 17px; flex: none; }
.pill--gold { background: var(--gold); color: #000; }
.pill--gold:hover { background: var(--gold-lt); }
.pill--line { background: transparent; color: var(--gold-lt); box-shadow: inset 0 0 0 1px rgba(212,174,92,.55); }
.pill--line:hover { box-shadow: inset 0 0 0 1px var(--gold-lt); background: rgba(212,174,92,.08); }
.pill--sm { min-height: 32px; padding: 7px 15px; font-size: 13px; }

/* ── article header ────────────────────────────────── */
.a-head { position: relative; padding-top: calc(var(--nav-h) + clamp(40px, 6vw, 80px)); padding-bottom: clamp(28px, 4vw, 44px); overflow: hidden; }
.a-head::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse 60% 80% at 50% 0%, rgba(212,174,92,.13), transparent 70%);
  -webkit-mask-image: linear-gradient(to bottom, #000 50%, transparent 100%); mask-image: linear-gradient(to bottom, #000 50%, transparent 100%);
}
.crumbs { position: relative; display: flex; flex-wrap: wrap; gap: 6px; list-style: none; font-size: 13px; color: var(--ash); margin-bottom: 22px; }
.crumbs a { color: var(--ash); text-decoration: none; }
.crumbs a:hover { color: var(--gold-lt); }
.crumbs li + li::before { content: '›'; margin-right: 6px; color: var(--steel); }
.a-cat { position: relative; display: inline-block; font-size: 14px; font-weight: 600; color: var(--gold); margin-bottom: 12px; }
.a-head h1 { position: relative; font-size: clamp(30px, 4.6vw, 52px); font-weight: 700; line-height: 1.08; letter-spacing: -.035em; }
.a-lead { position: relative; margin-top: 20px; font-size: clamp(17px, 1.6vw, 20px); line-height: 1.5; color: var(--ash); }
.a-meta { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; margin-top: 24px; font-size: 13px; color: var(--ash); }
.a-meta img { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; object-position: 50% 25%; }
.a-meta .who { display: inline-flex; align-items: center; gap: 10px; color: var(--porcelain); font-weight: 500; }

/* ── article body ──────────────────────────────────── */
.a-body { padding-bottom: clamp(40px, 6vw, 72px); color: var(--text); }
.toc { background: var(--graphite); border: 1px solid var(--carbon); border-radius: 18px; padding: 18px 22px; margin-bottom: 36px; }
.toc b { display: block; font-size: 13px; font-weight: 600; color: var(--gold); margin-bottom: 8px; }
.toc ol { padding-left: 20px; display: grid; gap: 4px; font-size: 15px; }
.toc a { color: var(--text); text-decoration: none; }
.toc a:hover { color: var(--gold-lt); }
.a-body h2 { font-size: clamp(23px, 2.6vw, 29px); font-weight: 650; line-height: 1.2; letter-spacing: -.02em; color: var(--porcelain); margin: 44px 0 14px; }
.a-body h3 { font-size: 19px; font-weight: 600; color: var(--porcelain); margin: 28px 0 10px; }
.a-body p { margin-bottom: 16px; }
.a-body ul, .a-body ol { margin: 0 0 18px 0; padding-left: 22px; display: grid; gap: 8px; }
.a-body li::marker { color: var(--gold); }
.a-body strong { color: var(--porcelain); font-weight: 600; }
.a-body a { color: var(--gold-lt); text-underline-offset: 3px; }
/* .a-body a (0,1,1) перебивало колір кнопок — повертаємо їм власні кольори */
.a-body .pill { text-decoration: none; }
.a-body .pill--gold { color: #000; }
.a-body .pill--line { color: var(--gold-lt); }
.note { border-left: 3px solid var(--gold); background: linear-gradient(90deg, rgba(212,174,92,.08), transparent 80%); border-radius: 0 14px 14px 0; padding: 14px 18px; margin: 22px 0; }
.note p:last-child { margin-bottom: 0; }
.warn { border-left-color: #e0795b; background: linear-gradient(90deg, rgba(224,121,91,.09), transparent 80%); }

.cta {
  margin: 40px 0; padding: clamp(22px, 3vw, 30px); border-radius: var(--r);
  background: radial-gradient(ellipse 70% 120% at 100% 0%, rgba(212,174,92,.16), transparent 60%), var(--carbon);
  display: grid; grid-template-columns: 1fr auto; gap: 18px 24px; align-items: center;
}
.cta h2, .cta .cta__t { margin: 0 0 6px; font-size: 21px; font-weight: 650; color: var(--porcelain); letter-spacing: -.02em; }
.cta p { margin: 0; color: var(--ash); font-size: 15px; }
.cta__btns { display: flex; flex-wrap: wrap; gap: 10px; }

.faq { margin-top: 12px; display: grid; gap: 10px; }
.faq details { background: var(--graphite); border: 1px solid var(--carbon); border-radius: 16px; padding: 0 20px; }
.faq summary { cursor: pointer; list-style: none; padding: 16px 28px 16px 0; font-weight: 600; color: var(--porcelain); position: relative; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; position: absolute; right: 0; top: 13px; font-size: 22px; color: var(--gold); transition: transform .2s; }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details > div { padding-bottom: 16px; }
.faq details > div p:last-child { margin-bottom: 0; }

.sources { margin-top: 36px; padding-top: 22px; border-top: 1px solid var(--carbon); font-size: 14px; color: var(--ash); }
.sources b { display: block; color: var(--porcelain); font-weight: 600; margin-bottom: 8px; }
.sources ul { padding-left: 18px; gap: 4px; }
.sources a { color: var(--ash); word-break: break-word; }
.disclaimer { margin-top: 18px; font-size: 13px; color: var(--slate); }

/* ── cards (related + hub) ─────────────────────────── */
.more { padding: clamp(40px, 6vw, 72px) 0 clamp(56px, 8vw, 96px); border-top: 1px solid var(--carbon); }
.more h2 { font-size: clamp(24px, 3vw, 34px); font-weight: 650; letter-spacing: -.025em; margin-bottom: 24px; }
.cards { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 14px; }
.card {
  display: flex; flex-direction: column; gap: 10px; min-height: 180px;
  background: var(--graphite); border: 1px solid var(--carbon); border-radius: 22px;
  padding: 22px; text-decoration: none; transition: background .25s, border-color .25s, transform .25s;
}
.card:hover { background: #141415; border-color: rgba(212,174,92,.35); transform: translateY(-2px); }
.card small { font-size: 12.5px; font-weight: 600; color: var(--gold); }
.card b { font-size: 18px; font-weight: 600; line-height: 1.3; letter-spacing: -.015em; color: var(--porcelain); }
.card span { font-size: 14.5px; color: var(--ash); line-height: 1.45; }
.card i { margin-top: auto; font-style: normal; font-size: 13px; color: var(--gold-lt); }

/* hub */
.hub-head { padding-top: calc(var(--nav-h) + clamp(48px, 7vw, 96px)); padding-bottom: clamp(24px, 4vw, 40px); position: relative; }
.hub-head h1 { font-size: clamp(36px, 6vw, 72px); font-weight: 700; letter-spacing: -.045em; line-height: 1; }
.hub-head p { margin-top: 18px; color: var(--ash); font-size: clamp(17px, 1.6vw, 20px); max-width: 60ch; }
.hub-cat { margin: 44px 0 16px; font-size: 15px; font-weight: 600; color: var(--gold); }
.hub-wrap { padding-bottom: clamp(56px, 8vw, 110px); }

/* ── footer ────────────────────────────────────────── */
.foot { padding: 28px 0 40px; font-size: 12px; color: var(--slate); border-top: 1px solid var(--carbon); }
.foot .wrap { display: flex; justify-content: space-between; gap: 10px 24px; flex-wrap: wrap; }

/* ── responsive ────────────────────────────────────── */
@media (max-width: 960px) { .cards { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 860px) {
  .nav__links {
    position: fixed; inset: var(--nav-h) 0 auto 0; flex-direction: column; gap: 0;
    background: rgba(14,14,14,.97); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    padding: 8px var(--pad) 28px; border-bottom: 1px solid var(--carbon);
    opacity: 0; visibility: hidden; transform: translateY(-6px);
    transition: opacity .25s, transform .25s, visibility .25s;
  }
  .nav__links[data-open="true"] { opacity: 1; visibility: visible; transform: none; }
  .nav__links li { border-bottom: 1px solid var(--carbon); }
  .nav__links a { display: block; padding: 16px 0; font-size: 17px; font-weight: 500; }
  .nav .pill { display: none; }
  .burger { display: inline-flex; }
}
@media (max-width: 600px) {
  body { font-size: 16.5px; }
  .cards { grid-template-columns: 1fr; }
  .card { min-height: 0; }
  .cta { grid-template-columns: 1fr; }
  .cta__btns .pill { flex: 1 1 100%; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .001ms !important; }
}
