/* ============ СТАТЬИ (SSR, Jinja) ============ */
.article-page {
  --bg: #04070d;
  --card: rgba(255, 255, 255, 0.035);
  --stroke: rgba(180, 215, 255, 0.1);
  --txt: #e8eefb;
  --muted: #8895ad;
  --accent: #3fe6cf;
  --accent2: #5f9dff;
  --accent3: #a97cff;
  --r: 18px;
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--txt);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  background-image: radial-gradient(
      900px 420px at 15% -10%,
      color-mix(in srgb, var(--accent) 12%, transparent),
      transparent 70%
    ),
    radial-gradient(
      900px 520px at 90% 0%,
      color-mix(in srgb, var(--accent2) 12%, transparent),
      transparent 72%
    );
  background-attachment: fixed;
}

.article-page *,
.article-page *::before,
.article-page *::after {
  box-sizing: border-box;
}

.article-page a {
  color: inherit;
  text-decoration: none;
}

.article-page h1,
.article-page h2,
.article-page h3,
.article-page h4,
.article-page p,
.article-page ul,
.article-page ol,
.article-page blockquote {
  margin: 0;
}

.art-wrap {
  width: min(880px, calc(100% - 40px));
  margin-inline: auto;
}

/* Header */
.art-header {
  border-bottom: 1px solid var(--stroke);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.art-header__inner {
  width: min(1120px, calc(100% - 40px));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  padding: 14px 0;
}

.art-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  letter-spacing: -0.02em;
  font-size: 17px;
}

.art-logo__mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 900;
  color: #03060c;
  background: linear-gradient(150deg, var(--accent), var(--accent2) 55%, var(--accent3));
  clip-path: polygon(50% 0%, 93% 25%, 93% 75%, 50% 100%, 7% 75%, 7% 25%);
}

.art-nav {
  display: flex;
  gap: 22px;
  font-size: 14px;
  color: var(--muted);
}

.art-nav a:hover {
  color: var(--txt);
}

.art-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.theme-switch {
  display: inline-flex;
  gap: 2px;
  padding: 4px;
  border: 1px solid var(--stroke);
  border-radius: 11px;
}

.theme-switch button {
  width: 28px;
  height: 26px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
}

.theme-switch button:hover {
  color: var(--txt);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}

.art-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 12px;
  font-weight: 650;
  font-size: 14px;
  color: #03060c;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  transition: box-shadow 0.25s, transform 0.25s;
}

.art-btn:hover {
  box-shadow: 0 12px 32px -12px color-mix(in srgb, var(--accent) 75%, transparent);
  transform: translateY(-1px);
}

.art-btn--ghost {
  background: transparent;
  color: var(--txt);
  border: 1px solid var(--stroke);
}

/* Main */
.art-main {
  padding: 54px 0 40px;
}

.art-list h1,
.art-article h1,
.art-404 h1 {
  font-size: clamp(2rem, 4vw, 3.1rem);
  line-height: 1.1;
  letter-spacing: -0.04em;
  font-weight: 800;
  margin: 8px 0 14px;
}

.art-kicker {
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
}

.art-lead {
  color: var(--muted);
  font-size: 1.06rem;
  line-height: 1.7;
  max-width: 68ch;
  margin-bottom: 18px;
}

/* Список статей */
.art-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
  margin: 34px 0 18px;
}

.art-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--stroke);
  border-radius: var(--r);
  background: var(--card);
  overflow: hidden;
  transition: transform 0.3s, border-color 0.3s, box-shadow 0.3s;
  height: 100%;
}

.art-card:hover {
  transform: translateY(-4px);
  border-color: color-mix(in srgb, var(--accent2) 45%, transparent);
  box-shadow: 0 22px 48px -32px color-mix(in srgb, var(--accent2) 65%, transparent);
}

.art-card__cover {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-bottom: 1px solid var(--stroke);
}

.art-card__body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.art-card__date {
  font-size: 12px;
  color: var(--muted);
}

.art-card h2,
.art-card h3 {
  font-size: 17px;
  line-height: 1.35;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.art-card p {
  font-size: 13.8px;
  color: var(--muted);
  line-height: 1.6;
}

.art-card__more {
  margin-top: auto;
  padding-top: 10px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 650;
}

.art-empty {
  color: var(--muted);
  margin: 28px 0;
}

.art-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 26px;
  padding-top: 18px;
  border-top: 1px solid var(--stroke);
  font-size: 14px;
  color: var(--muted);
}

.art-pagination a {
  color: var(--accent);
  font-weight: 600;
}

/* Статья */
.art-crumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12.5px;
  color: var(--muted);
  margin-bottom: 18px;
}

.art-crumbs a:hover {
  color: var(--accent);
}

.art-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 26px;
}

.art-tag {
  padding: 3px 9px;
  border-radius: 7px;
  background: color-mix(in srgb, var(--accent2) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent2) 26%, transparent);
  color: color-mix(in srgb, var(--accent2) 45%, white);
  font-size: 11.5px;
  font-weight: 600;
}

.art-cover {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 18px;
  border: 1px solid var(--stroke);
  margin: 8px 0 26px;
}

.art-preview {
  margin-bottom: 18px;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid rgba(255, 206, 122, 0.28);
  background: rgba(255, 206, 122, 0.08);
  color: #ffce7a;
  font-size: 13.5px;
}

/* Типографика статьи */
.art-body {
  font-size: 16.5px;
  line-height: 1.75;
  color: color-mix(in srgb, var(--txt) 92%, var(--muted));
}

.art-body > * + * {
  margin-top: 18px;
}

.art-body h2 {
  font-size: clamp(1.45rem, 2.6vw, 1.9rem);
  line-height: 1.2;
  letter-spacing: -0.03em;
  margin-top: 40px;
  color: var(--txt);
}

.art-body h3 {
  font-size: 1.22rem;
  margin-top: 28px;
  color: var(--txt);
}

.art-body p,
.art-body li {
  color: color-mix(in srgb, var(--txt) 90%, var(--muted));
}

.art-body ul,
.art-body ol {
  padding-left: 22px;
}

.art-body ul li {
  list-style: disc;
}

.art-body ol li {
  list-style: decimal;
}

.art-body li + li {
  margin-top: 6px;
}

.art-body a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent);
  text-underline-offset: 3px;
}

.art-body strong {
  color: var(--txt);
  font-weight: 700;
}

.art-body blockquote {
  padding: 16px 20px;
  border-left: 3px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 6%, transparent);
  border-radius: 0 14px 14px 0;
  color: var(--muted);
}

.art-body code {
  padding: 2px 6px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--accent2) 14%, transparent);
  color: color-mix(in srgb, var(--accent2) 45%, white);
  font-size: 0.92em;
}

.art-body pre {
  padding: 16px 18px;
  border-radius: 14px;
  overflow-x: auto;
  background: color-mix(in srgb, var(--bg) 65%, black);
  border: 1px solid var(--stroke);
}

.art-body pre code {
  background: none;
  padding: 0;
  color: var(--txt);
}

.art-body img {
  max-width: 100%;
  height: auto;
  border-radius: 14px;
  border: 1px solid var(--stroke);
}

.art-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14.5px;
}

.art-body th,
.art-body td {
  padding: 10px 12px;
  border: 1px solid var(--stroke);
  text-align: left;
}

.art-body th {
  background: color-mix(in srgb, var(--accent2) 8%, transparent);
}

.art-cta {
  margin-top: 44px;
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  border-radius: 18px;
  border: 1px solid var(--stroke);
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--accent) 8%, transparent),
    color-mix(in srgb, var(--accent2) 10%, transparent)
  );
}

.art-cta p {
  color: var(--txt);
  font-weight: 600;
}

/* Похожие и футер */
.art-related {
  margin-top: 46px;
  padding-top: 26px;
  border-top: 1px solid var(--stroke);
}

.art-related h2 {
  font-size: 1.35rem;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.art-grid--compact {
  margin-top: 18px;
}

.art-footer {
  margin-top: 50px;
  padding: 26px 0 34px;
  border-top: 1px solid var(--stroke);
  color: var(--muted);
  font-size: 13px;
}

.art-footer__inner {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.art-footer__links {
  display: flex;
  gap: 16px;
}

.art-footer__links a:hover {
  color: var(--accent);
}

.art-404 {
  padding: 40px 0 20px;
}

.art-404__actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 20px;
}

@media (max-width: 820px) {
  .art-nav {
    display: none;
  }
  .art-header__inner {
    padding: 10px 0;
  }
  .art-main {
    padding-top: 36px;
  }
  .art-body {
    font-size: 16px;
  }
}

@media (max-width: 520px) {
  .art-wrap {
    width: calc(100% - 28px);
  }
  .art-actions .art-btn {
    display: none;
  }
  .art-cta {
    padding: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .article-page *,
  .article-page *::before,
  .article-page *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}
