/* pulatov.tj — стили блога. Тёмная тема по умолчанию, светлая по переключателю. */

:root {
  --accent: #7c5cff;
  --accent-soft: rgba(124, 92, 255, .14);
  --accent-line: rgba(124, 92, 255, .34);

  --bg: #0e0f14;
  --bg-elev: #15171f;
  --bg-elev-2: #1c1f2a;
  --line: #262a37;
  --line-soft: #1e2130;
  --text: #e8eaf2;
  --text-dim: #a3a9bd;
  --text-mute: #6f768d;

  --radius: 14px;
  --radius-sm: 9px;
  --wrap: 1080px;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 30px rgba(0,0,0,.28);

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
          "Noto Sans", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
               "Liberation Mono", monospace;
}

html[data-theme="light"] {
  --accent-soft: rgba(124, 92, 255, .10);
  --accent-line: rgba(124, 92, 255, .30);
  --bg: #fbfbfd;
  --bg-elev: #ffffff;
  --bg-elev-2: #f3f4f8;
  --line: #e3e5ee;
  --line-soft: #edeef4;
  --text: #171a24;
  --text-dim: #545b70;
  --text-mute: #838aa0;
  --shadow: 0 1px 2px rgba(20,22,35,.05), 0 8px 26px rgba(20,22,35,.07);
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* мягкое свечение акцента сверху */
body::before {
  content: "";
  position: fixed;
  inset: -30vh 0 auto 0;
  height: 60vh;
  background: radial-gradient(60% 60% at 50% 50%, var(--accent-soft), transparent 70%);
  pointer-events: none;
  z-index: 0;
}

a { color: var(--text); text-decoration: none; }
a:hover { color: var(--accent); }

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

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 20px; position: relative; z-index: 1; }

.muted { color: var(--text-dim); }
.empty { color: var(--text-mute); padding: 32px 0; }

.skip {
  position: absolute; left: -9999px; top: 0;
  background: var(--accent); color: #fff; padding: 10px 16px; z-index: 100;
}
.skip:focus { left: 8px; top: 8px; }

/* ---------------------------------------------------------------- шапка */

.site-header {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--line-soft);
}
@supports not (backdrop-filter: blur(1px)) { .site-header { background: var(--bg); } }
@supports not (background: color-mix(in srgb, red 50%, blue)) { .site-header { background: var(--bg); } }

.header-inner { display: flex; align-items: center; gap: 16px; height: 64px; }

.brand { display: flex; align-items: center; gap: 11px; margin-right: auto; min-width: 0; }
.brand:hover { color: var(--text); }
.brand-mark {
  flex: none;
  width: 36px; height: 36px; border-radius: 11px;
  display: grid; place-items: center;
  background: linear-gradient(150deg, var(--accent), color-mix(in srgb, var(--accent) 55%, #22d3ee));
  color: #fff; font-weight: 700; font-size: 17px;
  box-shadow: 0 4px 14px var(--accent-soft);
}
@supports not (background: color-mix(in srgb, red 50%, blue)) {
  .brand-mark { background: var(--accent); }
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand-text strong { font-size: 15px; font-weight: 650; letter-spacing: -.01em; }
.brand-text small { font-size: 12px; color: var(--text-mute); }

.site-nav { display: flex; align-items: center; gap: 6px; }
.site-nav > a {
  padding: 7px 11px; border-radius: var(--radius-sm);
  font-size: 14.5px; color: var(--text-dim); font-weight: 500;
}
.site-nav > a:hover { color: var(--text); background: var(--bg-elev-2); }
.nav-search { display: inline-flex; align-items: center; gap: 6px; }

.lang-switch {
  display: inline-flex; margin-left: 4px; padding: 3px;
  background: var(--bg-elev-2); border-radius: var(--radius-sm);
  border: 1px solid var(--line-soft);
}
.lang-switch a {
  padding: 3px 9px; font-size: 12.5px; font-weight: 650;
  color: var(--text-mute); border-radius: 6px; letter-spacing: .02em;
}
.lang-switch a:hover { color: var(--text); }
.lang-switch a.is-active { background: var(--accent); color: #fff; }

.theme-toggle {
  margin-left: 4px; width: 34px; height: 34px; flex: none;
  display: grid; place-items: center; cursor: pointer;
  background: var(--bg-elev-2); border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm); color: var(--text-dim);
}
.theme-toggle:hover { color: var(--text); }
.theme-toggle .i-sun { display: none; }
html[data-theme="dark"] .theme-toggle .i-sun { display: block; }
html[data-theme="dark"] .theme-toggle .i-moon { display: none; }

.nav-toggle { display: none; }

/* ---------------------------------------------------------------- главная */

main { padding: 40px 20px 72px; }

.hero {
  display: flex; gap: 26px; align-items: center;
  padding: 28px; margin-bottom: 44px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 4px);
  box-shadow: var(--shadow);
}
.hero-avatar {
  width: 112px; height: 112px; flex: none;
  border-radius: 50%; object-fit: cover;
  border: 2px solid var(--accent-line);
}
.hero-text { min-width: 0; }
.hero h1 { margin: 0 0 8px; font-size: 32px; line-height: 1.15; letter-spacing: -.025em; }
.hero-sub { margin: 0 0 18px; color: var(--text-dim); font-size: 16px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 9px; }

.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 16px; border-radius: 999px;
  font-size: 14.5px; font-weight: 600; border: 1px solid transparent;
  cursor: pointer; transition: transform .12s ease, background .15s ease, border-color .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { color: #fff; filter: brightness(1.1); }
.btn-ghost { background: var(--bg-elev-2); border-color: var(--line); color: var(--text-dim); }
.btn-ghost:hover { color: var(--text); border-color: var(--accent-line); }

/* ---------------------------------------------------------------- сетка */

.layout { display: grid; grid-template-columns: minmax(0, 1fr) 268px; gap: 44px; align-items: start; }
.layout-side { position: sticky; top: 88px; display: grid; gap: 22px; }

.section-title {
  font-size: 20px; letter-spacing: -.015em; margin: 0 0 16px;
  display: flex; align-items: center; gap: 10px;
}
.section-title::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.cards { display: grid; gap: 18px; }

.card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease;
}
.card:hover { border-color: var(--accent-line); transform: translateY(-2px); box-shadow: var(--shadow); }
.card-cover img { width: 100%; aspect-ratio: 21 / 9; object-fit: cover; }
.card-body { padding: 20px 22px 22px; }
.card-meta {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 13px; color: var(--text-mute); margin-bottom: 8px;
}
.dot { opacity: .5; }
.card-title { margin: 0 0 8px; font-size: 21px; line-height: 1.3; letter-spacing: -.018em; }
.card-summary { margin: 0 0 14px; color: var(--text-dim); font-size: 15.5px; }
.cards-compact .card-body { padding: 16px 18px; }
.cards-compact .card-title { font-size: 17px; }
.cards-compact .card-summary { font-size: 14.5px; }

.badge {
  font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  padding: 2px 7px; border-radius: 5px;
}
.badge-draft { background: #f59e0b22; color: #f59e0b; border: 1px solid #f59e0b44; }

.tag-row { display: flex; flex-wrap: wrap; gap: 7px; }
.tag {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12.5px; padding: 3px 10px; border-radius: 999px;
  background: var(--bg-elev-2); border: 1px solid var(--line-soft); color: var(--text-dim);
}
.tag:hover { border-color: var(--accent-line); color: var(--accent); }
.tag-count { font-size: 11px; color: var(--text-mute); }

.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 32px; }
.pager-info { font-size: 13.5px; color: var(--text-mute); }

/* ---------------------------------------------------------------- сайдбар */

.side-block {
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px;
}
.side-title { margin: 0 0 12px; font-size: 13px; text-transform: uppercase;
  letter-spacing: .07em; color: var(--text-mute); font-weight: 700; }

.search-form { display: flex; gap: 8px; }
.search-form input {
  flex: 1; min-width: 0;
  padding: 9px 12px; font: inherit; font-size: 14.5px;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
}
.search-form input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search-form button {
  flex: none; padding: 0 12px; cursor: pointer;
  background: var(--accent); color: #fff; font: inherit; font-size: 14.5px; font-weight: 600;
  border: none; border-radius: var(--radius-sm);
  display: inline-flex; align-items: center; justify-content: center;
}
.search-form-big { max-width: 520px; margin-bottom: 22px; }
.search-form-big input { padding: 12px 15px; font-size: 16px; }
.search-form-big button { padding: 0 20px; }

.side-rss { display: inline-flex; align-items: center; gap: 8px; font-size: 14.5px; color: var(--text-dim); }
.side-rss:hover { color: var(--accent); }

/* ---------------------------------------------------------------- пост */

.post { max-width: 720px; margin: 0 auto; }
.post-head { margin-bottom: 30px; }
.post-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 13.5px; color: var(--text-mute); margin-bottom: 12px; }
.post-title { margin: 0 0 14px; font-size: 40px; line-height: 1.12; letter-spacing: -.03em; }
.post-lead { margin: 0 0 16px; font-size: 19px; color: var(--text-dim); line-height: 1.55; }
.post-cover { margin: 0 0 32px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); }

.note {
  padding: 11px 15px; border-radius: var(--radius-sm); font-size: 14.5px;
  background: var(--accent-soft); border: 1px solid var(--accent-line); color: var(--text-dim);
  margin: 0 0 26px;
}
.note a { color: var(--accent); font-weight: 600; }

/* содержимое статьи */
.prose { font-size: 17.5px; line-height: 1.75; }
.prose > *:first-child { margin-top: 0; }
.prose h2 { font-size: 26px; line-height: 1.25; letter-spacing: -.02em; margin: 44px 0 14px; }
.prose h3 { font-size: 21px; line-height: 1.3; letter-spacing: -.015em; margin: 34px 0 12px; }
.prose h4 { font-size: 18px; margin: 28px 0 10px; }
.prose p { margin: 0 0 20px; }
.prose a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px;
  text-decoration-color: var(--accent-line); }
.prose a:hover { text-decoration-color: var(--accent); }
.prose ul, .prose ol { margin: 0 0 20px; padding-left: 24px; }
.prose li { margin-bottom: 7px; }
.prose li::marker { color: var(--accent); }
.prose blockquote {
  margin: 24px 0; padding: 4px 0 4px 20px;
  border-left: 3px solid var(--accent); color: var(--text-dim); font-style: italic;
}
.prose blockquote p:last-child { margin-bottom: 0; }
.prose img { border-radius: var(--radius); margin: 26px auto; border: 1px solid var(--line); }
.prose hr { border: none; border-top: 1px solid var(--line); margin: 40px 0; }
.prose code {
  font-family: var(--font-mono); font-size: .88em;
  background: var(--bg-elev-2); padding: 2px 6px; border-radius: 5px;
  border: 1px solid var(--line-soft);
}
.prose pre {
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 18px;
  overflow-x: auto; margin: 0 0 24px; font-size: 14.5px; line-height: 1.6;
}
.prose pre code { background: none; border: none; padding: 0; font-size: inherit; }
.prose table { width: 100%; border-collapse: collapse; margin: 0 0 24px; font-size: 15.5px; display: block; overflow-x: auto; }
.prose th, .prose td { padding: 9px 12px; border: 1px solid var(--line); text-align: left; }
.prose th { background: var(--bg-elev-2); font-weight: 650; }

.related { max-width: 720px; margin: 60px auto 0; }

.post-nav {
  max-width: 720px; margin: 48px auto 0;
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px;
  padding-top: 26px; border-top: 1px solid var(--line);
}
.post-nav-item {
  display: flex; flex-direction: column; gap: 4px;
  padding: 14px 16px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--bg-elev);
}
.post-nav-item:hover { border-color: var(--accent-line); }
.post-nav-item small { font-size: 12.5px; color: var(--text-mute); }
.post-nav-item strong { font-size: 15px; font-weight: 600; line-height: 1.35; }
.post-nav-next { text-align: right; }

/* ---------------------------------------------------------------- 404 */

.notfound { text-align: center; padding: 80px 0; }
.notfound-code { font-size: 76px; font-weight: 800; letter-spacing: -.04em; margin: 0;
  color: var(--accent); opacity: .85; }
.notfound h1 { margin: 4px 0 10px; font-size: 26px; }

/* ---------------------------------------------------------------- подвал */

.site-footer { border-top: 1px solid var(--line-soft); padding: 26px 0; margin-top: 40px; }
.footer-inner {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 12px; font-size: 14px; color: var(--text-mute);
}
.footer-inner p { margin: 0; }
.footer-links { display: flex; gap: 16px; }
.footer-links a { color: var(--text-dim); }
.footer-links a:hover { color: var(--accent); }

/* ---------------------------------------------------------------- адаптив */

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; gap: 34px; }
  .layout-side { position: static; }
  .post-title { font-size: 32px; }
  .hero { flex-direction: column; text-align: center; align-items: center; }
  .hero-actions { justify-content: center; }
}

@media (max-width: 680px) {
  body { font-size: 16.5px; }
  main { padding: 28px 16px 56px; }
  .wrap { padding: 0 16px; }
  .header-inner { height: 58px; }
  .brand-text small { display: none; }

  .nav-toggle {
    display: grid; place-content: center; gap: 4px;
    width: 38px; height: 34px; margin-left: auto;
    background: var(--bg-elev-2); border: 1px solid var(--line-soft);
    border-radius: var(--radius-sm); cursor: pointer;
  }
  .nav-toggle span { display: block; width: 16px; height: 1.8px; background: var(--text-dim); border-radius: 2px; }

  .site-nav {
    position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 2px;
    padding: 10px 16px 16px;
    background: var(--bg); border-bottom: 1px solid var(--line);
    display: none;
  }
  .site-nav.is-open { display: flex; }
  .site-nav > a { padding: 10px 12px; font-size: 16px; }
  .nav-search-label { display: inline; }
  .lang-switch, .theme-toggle { margin: 8px 0 0; align-self: flex-start; }

  .post-title { font-size: 28px; }
  .post-lead { font-size: 17px; }
  .prose { font-size: 17px; }
  .post-nav { grid-template-columns: 1fr; }
  .post-nav-next { text-align: left; }
  .hero-avatar { width: 88px; height: 88px; }
  .hero h1 { font-size: 26px; }
  .footer-inner { flex-direction: column; align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; animation: none !important; }
}
