/* irbr-cms public blog — theme fix + designer redesign 2026-05-10
 * Brand-aligned with /assets/css/main.css (single source of truth).
 * Uses ONLY var() from main.css :root and [data-theme=dark]. No hardcoded
 * UI colors — both light and dark themes must work via toggleTheme().
 *
 * Code blocks remain always-dark (GitHub-style) — that is intentional and
 * the only hardcoded theming.
 *
 * WCAG AA contrast, focus-visible, semantic HTML, mobile-first.
 */

/* ─── Reset / base ────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
body.blog {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: 'cv11','ss01';
  position: relative;
}

/* ─── Terminal grid (subtle 48px navy/blue lines, theme-aware) ─── */
body.blog::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(10, 37, 64, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(10, 37, 64, 0.05) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
  z-index: 0;
  mask-image: radial-gradient(ellipse at top, #000 0%, transparent 80%);
  -webkit-mask-image: radial-gradient(ellipse at top, #000 0%, transparent 80%);
}
[data-theme="dark"] body.blog::before {
  background-image:
    linear-gradient(rgba(108, 158, 212, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(108, 158, 212, 0.045) 1px, transparent 1px);
}

/* ─── Layout ──────────────────────────────────────── */
main.container { padding-top: 2.5rem; padding-bottom: 5rem; position: relative; z-index: 1; }
.container-narrow {
  width: 100%;
  max-width: var(--container-narrow);
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ─── Breadcrumbs ────────────────────────────────── */
.crumbs {
  display: flex; flex-wrap: wrap;
  gap: 0.4rem 0.6rem;
  font-size: 0.8125rem;
  color: var(--fg-subtle);
  margin-bottom: 1.5rem;
  font-family: var(--font-mono);
}
.crumbs a { color: var(--fg-muted); }
.crumbs a:hover { color: var(--brand); }
.crumbs .sep { color: var(--fg-subtle); }
.crumbs .current { color: var(--fg); font-weight: 500; }

/* ─── Hero ───────────────────────────────────────── */
.hero {
  padding: 3rem 0 2.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 3rem;
}
.hero .eyebrow {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--accent);
  margin-bottom: 0.875rem;
}
.hero h1 {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: clamp(2.25rem, 5vw, 3.5rem);
  line-height: 1.1;
  letter-spacing: -0.025em;
  color: var(--fg);
  margin-bottom: 0.875rem;
}
.hero .lede {
  font-size: clamp(1.0625rem, 1.5vw, 1.25rem);
  color: var(--fg-muted);
  line-height: 1.6;
  max-width: 56ch;
}
.hero code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--brand-subtle);
  color: var(--brand);
  padding: 0.15em 0.5em;
  border-radius: var(--radius-sm);
}

/* ─── Bento grid (post listing) ──────────────────── */
.post-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin-bottom: 3rem;
}
@media (max-width: 1024px) { .post-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px)  { .post-grid { grid-template-columns: 1fr; gap: 1.25rem; } }

.post-card {
  display: flex; flex-direction: column;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: transform 0.2s var(--ease), border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
  position: relative;
  min-height: 340px;
}
.post-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
}
.post-card .cover {
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: linear-gradient(135deg, var(--brand-subtle), var(--accent-subtle));
  position: relative;
}
.post-card .cover img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 0.4s var(--ease);
}
.post-card:hover .cover img { transform: scale(1.04); }
.post-card .cover.placeholder::after {
  content: "ИРБР";
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font-family: var(--font-serif);
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--brand);
  opacity: 0.25;
}

.post-card .card-body {
  display: flex; flex-direction: column;
  gap: 0.75rem;
  padding: 1.25rem 1.25rem 1.5rem;
  flex: 1;
}
.post-card .meta {
  display: flex; flex-wrap: wrap; gap: 0.4rem 0.75rem;
  align-items: center;
  font-size: 0.8125rem;
  color: var(--fg-subtle);
  font-family: var(--font-mono);
}
.post-card .meta .chip {
  display: inline-flex; align-items: center; gap: 0.3rem;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  color: var(--fg-muted);
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-family: var(--font-mono);
}
.post-card .meta .chip.tag { color: var(--accent); border-color: var(--accent-subtle); }
.post-card h2 {
  font-family: var(--font-serif);
  font-size: 1.375rem;
  line-height: 1.25;
  letter-spacing: -0.015em;
  font-weight: 600;
  margin: 0;
}
.post-card h2 a { color: var(--fg); }
.post-card:hover h2 a { color: var(--brand); }
.post-card .excerpt {
  color: var(--fg-muted);
  font-size: 0.9375rem;
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.post-card .more {
  margin-top: auto;
  color: var(--brand);
  font-weight: 600;
  font-size: 0.875rem;
  display: inline-flex; align-items: center; gap: 0.25rem;
}
.post-card .more::after { content: "→"; transition: transform 0.2s var(--ease); }
.post-card:hover .more::after { transform: translateX(3px); }

/* ─── Pagination ─────────────────────────────────── */
.pager {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 2rem;
  padding: 1.5rem 0;
  border-top: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.875rem;
}
.pager a {
  color: var(--brand); font-weight: 600;
  padding: 0.5rem 0.875rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: all 0.15s var(--ease);
}
.pager a:hover { background: var(--brand-subtle); border-color: var(--brand); }
.pager .info { color: var(--fg-muted); }

/* ─── Single post ────────────────────────────────── */
.post { display: block; }
.post-head { margin-bottom: 2.5rem; max-width: var(--container-narrow); margin-left: auto; margin-right: auto; }
.post-head .meta {
  display: flex; flex-wrap: wrap; gap: 0.5rem 0.875rem;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--fg-subtle);
  margin-bottom: 1rem;
}
.post-head .chip {
  display: inline-flex; align-items: center; gap: 0.3rem;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  color: var(--fg-muted);
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
}
.post-head .chip.tag { color: var(--accent); border-color: var(--accent-subtle); }
.post-head h1 {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: clamp(2rem, 5.5vw, 3.5rem);
  line-height: 1.1;
  letter-spacing: -0.025em;
  color: var(--fg);
  margin: 0.5rem 0 1rem;
}
.post-head .lede {
  font-size: clamp(1.125rem, 1.6vw, 1.3125rem);
  line-height: 1.55;
  color: var(--fg-muted);
  max-width: 60ch;
}
.post-head .cover {
  margin: 2rem 0 0;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
}
.post-head .cover img { width: 100%; }

/* Article body container — narrow for reading */
.post-body {
  max-width: var(--container-narrow);
  margin: 0 auto;
}

/* ─── Prose typography ───────────────────────────── */
.prose {
  color: var(--fg);
  font-size: 1.0625rem;
  line-height: 1.75;
}
.prose > * + * { margin-top: 1.25em; }
.prose h2, .prose h3, .prose h4 {
  font-family: var(--font-serif);
  letter-spacing: -0.015em;
  color: var(--fg);
  margin-top: 2.5em;
  margin-bottom: 0.6em;
  scroll-margin-top: 5rem;
}
.prose h2 { font-size: 1.875rem; font-weight: 600; }
.prose h3 { font-size: 1.4375rem; font-weight: 600; }
.prose h4 { font-size: 1.1875rem; font-weight: 600; font-family: var(--font-sans); }
.prose p { margin: 0 0 1.25em; }
.prose strong { color: var(--fg); font-weight: 600; }
.prose em { color: var(--fg); }
.prose a {
  color: var(--brand);
  text-decoration: underline;
  text-decoration-color: var(--brand-subtle);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
  transition: text-decoration-color 0.15s var(--ease);
}
.prose a:hover { text-decoration-color: var(--brand); }

.prose code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--bg-subtle);
  color: var(--accent);
  padding: 0.15em 0.45em;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

/* Code blocks — always-dark (GitHub-style accepted pattern). Single hardcoded colour set. */
.prose pre {
  background: #0a1320;
  color: #e8edf5;
  padding: 1.25rem 1.5rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.6;
  position: relative;
  margin: 1.75em 0;
}
.prose pre code {
  background: transparent;
  border: 0;
  padding: 0;
  color: inherit;
  font-size: inherit;
}
.prose pre .copy-btn {
  position: absolute; top: 0.625rem; right: 0.625rem;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.10);
  color: #d4d4d8;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  padding: 0.3rem 0.55rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s var(--ease), background 0.15s var(--ease);
}
.prose pre:hover .copy-btn { opacity: 1; }
.prose pre .copy-btn:hover { background: rgba(255,255,255,0.12); }
.prose pre .copy-btn.ok { color: #66d19e; }

.prose blockquote {
  border-left: 3px solid var(--brand);
  background: var(--brand-subtle);
  padding: 0.875rem 1.25rem;
  margin: 1.5em 0;
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--fg-muted);
  font-style: italic;
}
.prose blockquote p { margin: 0; }
.prose img {
  max-width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin: 1.5em 0;
}
.prose ul, .prose ol { padding-left: 1.5em; }
.prose ul { list-style: disc; }
.prose ol { list-style: decimal; }
.prose li { margin-bottom: 0.5em; }
.prose li::marker { color: var(--brand); }
.prose hr { border: 0; border-top: 1px solid var(--border); margin: 2.5em 0; }
.prose table {
  border-collapse: collapse;
  width: 100%;
  margin: 1.5em 0;
  font-size: 0.9375rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.prose table th, .prose table td {
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 1rem;
  text-align: left;
}
.prose table th { background: var(--bg-subtle); font-weight: 600; color: var(--fg); }
.prose table tr:last-child th, .prose table tr:last-child td { border-bottom: 0; }

/* ─── Author bio ─────────────────────────────────── */
.author-bio {
  display: flex; gap: 1rem;
  align-items: flex-start;
  margin: 3rem auto 0;
  max-width: var(--container-narrow);
  padding: 1.25rem 1.5rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.author-bio .avatar {
  flex: 0 0 56px;
  width: 56px; height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--accent));
  display: grid; place-items: center;
  color: #ffffff;
  font-weight: 700; font-size: 1.25rem;
  font-family: var(--font-serif);
}
.author-bio .info { flex: 1; }
.author-bio .name { font-weight: 600; color: var(--fg); }
.author-bio .role { font-size: 0.875rem; color: var(--fg-subtle); margin-top: 0.15rem; }

/* ─── Share / post foot ──────────────────────────── */
.post-foot {
  display: flex; flex-wrap: wrap;
  justify-content: space-between; align-items: center;
  gap: 1rem;
  margin: 3rem auto 0;
  max-width: var(--container-narrow);
  padding: 1.5rem 0 0;
  border-top: 1px solid var(--border);
}
.post-foot .back {
  color: var(--brand);
  font-weight: 600;
  font-size: 0.9375rem;
}
.post-foot .back:hover { color: var(--brand-hover); }
.share { display: inline-flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.share .label { color: var(--fg-subtle); font-size: 0.875rem; margin-right: 0.25rem; font-family: var(--font-mono); }
.share-btn {
  display: inline-flex; align-items: center; gap: 0.35rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--fg-muted);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s var(--ease);
}
.share-btn:hover { color: var(--fg); border-color: var(--brand); background: var(--brand-subtle); }
.share-btn.ok { color: var(--accent); border-color: var(--accent); }

/* ─── Related posts ──────────────────────────────── */
.related {
  margin: 4rem auto 0;
  max-width: var(--container);
}
.related h2 {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  margin-bottom: 1.25rem;
  color: var(--fg);
}
.related .post-grid { gap: 1.25rem; }
.related .post-card { min-height: auto; }
.related .post-card .card-body { padding: 1rem 1.125rem 1.25rem; }
.related .post-card h2 { font-size: 1.125rem; }
@media (max-width: 900px) { .related .post-grid { grid-template-columns: 1fr; } }

/* ─── Utilities ──────────────────────────────────── */
.muted { color: var(--fg-muted); }
.muted.small { font-size: 0.8125rem; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0;
  margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ─── Responsive ─────────────────────────────────── */
@media (max-width: 768px) {
  main.container { padding-top: 1.5rem; padding-bottom: 3rem; }
  .container-narrow { padding: 0 1rem; }
  .hero { padding: 2rem 0 1.75rem; margin-bottom: 2rem; }
  .post-head h1 { font-size: clamp(1.75rem, 7vw, 2.5rem); }
  .author-bio { padding: 1rem 1.125rem; }
}

/* ─── Reduced motion ─────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ─── Print ──────────────────────────────────────── */
@media print {
  body.blog::before { display: none; }
  body.blog { background: #fff; color: #000; }
  .prose a { color: #000; text-decoration: underline; }
  .site-header, .site-footer, .post-foot, .share, .related { display: none; }
}

/* NOTE: cookie banner styling lives in /assets/css/main.css and uses var()
 * tokens — we deliberately do NOT override .cc-banner / .cc-modal here so
 * the banner inherits the active theme on every page (parity with main site).
 */
