/* App blog — shared stylesheet. Each page sets --accent on <body>. */
:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #64748b;
  --line: #e5e7eb;
  --soft: color-mix(in srgb, var(--accent, #2563eb) 9%, var(--surface));
  --radius: 16px;
  --shadow: 0 1px 2px rgb(15 23 42 / 0.04), 0 8px 24px rgb(15 23 42 / 0.06);
  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", "Noto Sans Georgian", Arial, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c0e12;
    --surface: #151821;
    --ink: #f1f5f9;
    --ink-2: #cbd5e1;
    --muted: #94a3b8;
    --line: #262b36;
    --soft: color-mix(in srgb, var(--accent, #2563eb) 16%, var(--surface));
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 8px 24px rgb(0 0 0 / 0.25);
  }
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 84px; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 17px/1.65 var(--font); }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-underline-offset: 3px; }
.wrap { width: min(1120px, 100% - 32px); margin-inline: auto; }

/* reading progress — scroll-driven where supported, invisible elsewhere */
.progress { position: fixed; inset: 0 0 auto; height: 3px; background: var(--accent); transform-origin: 0 50%; transform: scaleX(0); z-index: 30; }
@supports (animation-timeline: scroll()) {
  .progress { animation: grow linear both; animation-timeline: scroll(root); }
  @keyframes grow { to { transform: scaleX(1); } }
}

/* top bar */
.topbar { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--surface) 86%, transparent); backdrop-filter: saturate(1.4) blur(14px); border-bottom: 1px solid var(--line); }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 60px; }
.brand { display: inline-flex; align-items: center; gap: 10px; min-width: 0; color: var(--ink); text-decoration: none; font-weight: 700; letter-spacing: -0.01em; }
.brand img { width: 28px; height: 28px; border-radius: 7px; flex: none; }
.brand span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topnav { display: flex; align-items: center; gap: 4px; font-size: 14px; flex: none; }
.topnav > a:not(.btn) { color: var(--ink-2); text-decoration: none; padding: 8px 10px; border-radius: 8px; }
.topnav > a:not(.btn):hover { background: var(--soft); }
.topnav > a[aria-current="page"] { color: var(--ink); font-weight: 600; }
@media (max-width: 640px) {
  .topnav > a:not(.btn) { display: none; }
  .topnav .btn-sm { padding: 0 12px; font-size: 13px; }
}
@media (max-width: 360px) { .lang summary svg { display: none; } }

.lang { position: relative; }
.lang summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; padding: 8px 10px; border-radius: 8px; color: var(--ink-2); font-weight: 600; }
.lang summary::-webkit-details-marker { display: none; }
.lang summary:hover { background: var(--soft); }
.lang ul { position: absolute; right: 0; top: calc(100% + 6px); margin: 0; padding: 6px; list-style: none; min-width: 160px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.lang li a { display: block; padding: 8px 10px; border-radius: 8px; color: var(--ink); text-decoration: none; }
.lang li a:hover, .lang li a[aria-current="true"] { background: var(--soft); }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 12px; font-weight: 650; font-size: 15px; text-decoration: none; transition: transform .15s ease, filter .15s ease; white-space: nowrap; }
.btn:hover { filter: brightness(1.06); transform: translateY(-1px); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-secondary { background: var(--ink); color: var(--surface); }
.btn-sm { min-height: 36px; padding: 0 14px; font-size: 14px; border-radius: 10px; }

/* index */
.index { padding-block: 40px 64px; }
.index-hero { max-width: 760px; margin-bottom: 28px; }
.index-hero h1 { font-size: clamp(34px, 5vw, 48px); line-height: 1.1; letter-spacing: -0.03em; margin: 0 0 8px; }
.index-hero p { margin: 0; color: var(--muted); font-size: 18px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.chip { font: inherit; font-size: 14px; font-weight: 600; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--surface); border-color: var(--ink); }

.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0; color: var(--muted); font-size: 13px; }
.meta-cat { color: var(--accent); font-weight: 600; }

.card { display: grid; grid-template-columns: 220px 1fr; gap: 22px; align-items: start; padding: 18px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); transition: box-shadow .2s ease, transform .2s ease; }
.card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.card[hidden] { display: none; }
.card-media { display: block; border-radius: 12px; overflow: hidden; aspect-ratio: 4 / 3; background: var(--soft); }
.card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.card:hover .card-media img { transform: scale(1.03); }
.card-fallback { display: grid; place-items: center; width: 100%; height: 100%; background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 45%, #000)); }
.card-fallback img { width: 34%; height: auto; border-radius: 22%; box-shadow: 0 10px 30px rgb(0 0 0 / .25); }
.card-body { display: grid; gap: 8px; min-width: 0; }
.card-title { margin: 0; font-size: 19px; line-height: 1.3; letter-spacing: -0.01em; }
.card-title a { color: var(--ink); text-decoration: none; }
.card-title a:hover { color: var(--accent); }
.card-excerpt { margin: 0; color: var(--muted); font-size: 15px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-more { font-weight: 650; text-decoration: none; font-size: 15px; }
.card-featured { grid-template-columns: 1.25fr 1fr; gap: 32px; padding: 22px; margin-bottom: 18px; align-items: center; }
.card-featured .card-media { aspect-ratio: 16 / 10; }
.card-featured .card-title { font-size: clamp(24px, 3vw, 32px); letter-spacing: -0.02em; }
.card-featured .card-excerpt { -webkit-line-clamp: 3; font-size: 16px; }
.list { display: grid; gap: 14px; }
@media (max-width: 760px) {
  .card, .card-featured { grid-template-columns: 1fr; gap: 14px; padding: 14px; }
  .card-media { aspect-ratio: 16 / 9; }
}

.pager { display: flex; justify-content: space-between; align-items: center; margin-top: 28px; color: var(--muted); font-size: 15px; }
.pager a { font-weight: 650; text-decoration: none; }

/* CTA */
.cta { display: grid; grid-template-columns: auto 1fr auto; gap: 18px; align-items: center; padding: 22px; border-radius: var(--radius); background: var(--soft); border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--line)); }
.cta-band { margin-top: 40px; }
.cta-inline { margin-block: 32px; }
.cta-icon { width: 64px; height: 64px; border-radius: 15px; box-shadow: 0 6px 18px rgb(0 0 0 / .14); }
.cta-title { margin: 0; font-weight: 750; font-size: 18px; }
.cta-text { margin: 2px 0 0; color: var(--ink-2); font-size: 15px; line-height: 1.5; }
.cta-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.cta-side { grid-template-columns: auto 1fr; padding: 16px; gap: 12px; }
.cta-side .cta-icon { width: 48px; height: 48px; border-radius: 12px; }
.cta-side .cta-actions { grid-column: 1 / -1; }
.cta-side .btn { width: 100%; }
@media (max-width: 640px) {
  .cta { grid-template-columns: auto 1fr; }
  .cta-actions { grid-column: 1 / -1; }
  .cta-actions .btn { flex: 1 1 100%; }
}

/* post */
.post { padding-block: 24px 64px; }
.crumbs { display: flex; flex-wrap: wrap; gap: 8px; font-size: 14px; color: var(--muted); }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--accent); }
.post-head { max-width: 820px; margin: 22px 0 24px; }
.pill { display: inline-block; margin: 0 0 12px; padding: 4px 12px; border-radius: 999px; background: var(--soft); color: var(--accent); font-weight: 650; font-size: 13px; }
.post-head h1 { margin: 0 0 14px; font-size: clamp(30px, 4.6vw, 46px); line-height: 1.12; letter-spacing: -0.03em; }
.lede { margin: 0 0 16px; font-size: 19px; color: var(--ink-2); }
.figure { margin: 28px 0; }
.figure img { border-radius: var(--radius); width: auto; max-width: 100%; max-height: min(78vh, 720px); margin-inline: auto; }
.figure-portrait img { max-width: min(100%, 340px); box-shadow: var(--shadow); }
.figure-portrait figcaption { justify-content: center; text-align: center; }
.figure figcaption { margin-top: 8px; font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; }
.cover { margin-top: 0; }
.cover img { width: 100%; max-height: none; aspect-ratio: 16 / 9; object-fit: cover; box-shadow: var(--shadow); }
.credit, .credit a { color: var(--muted); }

.post-grid { display: grid; grid-template-columns: minmax(0, 720px) 280px; gap: 56px; justify-content: space-between; align-items: start; }
.post-aside { position: sticky; top: 84px; display: grid; gap: 18px; }
@media (max-width: 1020px) {
  .post-grid { grid-template-columns: minmax(0, 1fr); }
  .post-aside { position: static; order: -1; }
  .post-aside .cta-side { display: none; }
}
.toc { padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); font-size: 14px; }
.toc-title { margin: 0 0 8px; font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.toc ol { margin: 0; padding-left: 18px; display: grid; gap: 6px; }
.toc a { color: var(--ink-2); text-decoration: none; }
.toc a:hover { color: var(--accent); }

.prose { min-width: 0; }
.prose > * + * { margin-top: 1.1em; }
.prose p { margin: 0; }
.prose h2 { margin: 2em 0 .5em; font-size: clamp(24px, 3vw, 30px); line-height: 1.25; letter-spacing: -0.02em; }
.prose h3 { margin: 1.6em 0 .4em; font-size: 21px; line-height: 1.3; }
.prose ul, .prose ol { padding-left: 1.3em; margin-bottom: 0; }
.prose li + li { margin-top: .4em; }
.prose code { font-size: .9em; padding: .1em .35em; border-radius: 6px; background: var(--soft); }
.summary { font-size: 19px; color: var(--ink-2); padding-left: 16px; border-left: 3px solid var(--accent); }
.steps { counter-reset: step; list-style: none; padding-left: 0 !important; }
.steps li { counter-increment: step; position: relative; padding-left: 44px; min-height: 30px; }
.steps li::before { content: counter(step); position: absolute; left: 0; top: 0; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: #fff; font-weight: 700; font-size: 14px; }

.takeaways, .callout { padding: 18px 20px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.takeaways { border-left: 4px solid var(--accent); }
.takeaways-title, .callout-title { margin: 0 0 6px !important; font-weight: 750; }
.takeaways ul { margin: 0; }
.callout-tip { background: var(--soft); border-color: color-mix(in srgb, var(--accent) 25%, var(--line)); }
.callout-warning { background: color-mix(in srgb, #f59e0b 12%, var(--surface)); border-color: color-mix(in srgb, #f59e0b 40%, var(--line)); }
blockquote { margin: 1.6em 0; padding: 4px 0 4px 20px; border-left: 3px solid var(--line); color: var(--ink-2); font-size: 19px; }
blockquote cite { display: block; margin-top: 6px; font-size: 14px; font-style: normal; color: var(--muted); }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
caption { text-align: left; padding: 12px 16px 0; font-weight: 650; }
th, td { padding: 12px 16px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
thead th { background: var(--soft); font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-2); }
tbody tr:last-child > * { border-bottom: 0; }

.video { margin: 28px 0; }
.yt { position: relative; display: block; aspect-ratio: 16 / 9; border-radius: var(--radius); overflow: hidden; background: #000; }
.yt img { width: 100%; height: 100%; object-fit: cover; opacity: .85; transition: opacity .2s ease; }
.yt:hover img { opacity: 1; }
.yt-play { position: absolute; inset: 0; margin: auto; width: 72px; height: 50px; border-radius: 14px; background: rgb(0 0 0 / .72); }
.yt-play::after { content: ""; position: absolute; left: 29px; top: 15px; border-style: solid; border-width: 10px 0 10px 17px; border-color: transparent transparent transparent #fff; }
.yt:hover .yt-play { background: #e11d48; }
.yt iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video figcaption { margin-top: 8px; font-size: 13px; color: var(--muted); }

.faq { margin-top: 2.4em; }
.faq details { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); padding: 0 18px; }
.faq details + details { margin-top: 10px; }
.faq summary { cursor: pointer; padding: 14px 0; font-weight: 650; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--accent); font-weight: 700; font-size: 20px; line-height: 1; }
.faq details[open] summary::after { content: "–"; }
.faq details > div { padding-bottom: 14px; color: var(--ink-2); }
.sources { margin-top: 2.4em; font-size: 14px; color: var(--muted); }
.sources-title { font-size: 16px !important; margin: 0 0 6px !important; }
.sources a { color: var(--ink-2); }

.related { margin-top: 56px; padding-top: 32px; border-top: 1px solid var(--line); }
.related h2 { font-size: 24px; margin: 0 0 18px; letter-spacing: -0.02em; }
.related-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.related-grid .card { grid-template-columns: 1fr; gap: 12px; padding: 12px; }
.related-grid .card-media { aspect-ratio: 16 / 9; }
.related-grid .card-title { font-size: 17px; }
@media (max-width: 860px) { .related-grid { grid-template-columns: 1fr; } }

.footer { border-top: 1px solid var(--line); padding-block: 28px; color: var(--muted); font-size: 14px; }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; }
.footer p { margin: 0; }
.footer nav { display: flex; flex-wrap: wrap; gap: 16px; }
.footer a { color: var(--muted); text-decoration: none; }
.footer a:hover { color: var(--accent); }

:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 60%, transparent); outline-offset: 2px; border-radius: 6px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }
