/*
 * Onion Links clean UI
 * Fonts: Manrope (headings), Inter (body), IBM Plex Mono (labels/UI metadata).
 * No framework bundle. No theme switcher. No search UI.
 */
:root {
  --bg: #13161c;
  --surface: #1b1f27;
  --surface-2: #20242e;
  --surface-3: #171a21;
  --text: #f1f3f7;
  --text-soft: #c9ced8;
  --muted: #8c94a3;
  --muted-2: #656d7b;
  --line: #303540;
  --line-soft: #272c35;
  --accent: #f4f5f7;
  --accent-ink: #14171d;
  --cyan: #7fd8ec;
  --orange: #d46a3c;
  --success: #58d39b;
  --max: 1520px;
  --narrow: 880px;
  --sidebar: 235px;
  --radius: 18px;
  --radius-lg: 24px;
  --font-body: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-display: "Manrope", var(--font-body);
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; color-scheme: dark; }
body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: #fff; }
button, input, textarea, select { font: inherit; }
.container { width: min(calc(100% - 48px), var(--max)); margin-inline: auto; }
.content-narrow { width: min(calc(100% - 48px), var(--narrow)); margin-inline: auto; }
.skip-link { position: fixed; left: 18px; top: -100px; z-index: 999; padding: 10px 14px; border-radius: 8px; background: #fff; color: #111; }
.skip-link:focus { top: 18px; }

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(19, 22, 28, .94);
  backdrop-filter: blur(16px);
}
.header-inner { min-height: 66px; display: flex; align-items: center; gap: 32px; }
.brand { display: inline-flex; align-items: baseline; gap: 11px; margin-right: auto; text-decoration: none; white-space: nowrap; }
.brand-name,
.footer-brand { font-family: var(--font-display); font-size: 20px; font-weight: 800; line-height: 1; letter-spacing: -.045em; color: var(--text); }
.brand-name span,
.footer-brand span { font-weight: 600; }
.brand-name b,
.footer-brand b { color: var(--orange); font-weight: 800; }
.brand-code { color: var(--muted-2); font-family: var(--font-mono); font-size: 11px; letter-spacing: .05em; }
.site-nav ul { display: flex; align-items: center; gap: 6px; padding: 0; margin: 0; list-style: none; }
.site-nav a {
  display: block;
  padding: 8px 11px;
  border: 1px solid transparent;
  border-radius: 9px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .045em;
  text-decoration: none;
  text-transform: uppercase;
}
.site-nav a:hover,
.site-nav .is-active a { border-color: var(--line); background: var(--surface); color: var(--text); }
.menu-toggle {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}
.menu-toggle-label { font-family: var(--font-mono); font-size: 11px; letter-spacing: .06em; }
.menu-toggle-icon { display: grid; width: 18px; gap: 4px; }
.menu-toggle-icon i { display: block; height: 1px; background: currentColor; }

/* Shared small UI */
.eyebrow,
.panel-label,
.listing-toolbar,
.status,
.badge,
.browse-group h2,
.breadcrumbs,
.article-meta,
.footer-status {
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: .075em;
}
.eyebrow { display: inline-block; color: var(--muted); font-size: 11px; font-weight: 500; }
.panel-label { display: block; margin-bottom: 16px; color: var(--muted-2); font-size: 10px; }
.badge {
  flex: none;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: transparent;
  font-size: 9px;
  font-weight: 500;
  white-space: nowrap;
}
.status { display: inline-flex; align-items: center; gap: 8px; min-width: 0; color: var(--muted); font-size: 9px; font-weight: 500; }
.status i,
.footer-status i { width: 6px; height: 6px; flex: none; border-radius: 50%; background: var(--success); box-shadow: 0 0 8px rgba(88, 211, 155, .45); }
.button,
.card-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid #f6f7f8;
  border-radius: 11px;
  background: #f6f7f8;
  color: #171a20;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .045em;
  text-decoration: none;
  text-transform: uppercase;
  transition: background .16s ease, color .16s ease, border-color .16s ease, transform .16s ease;
}
.button { min-height: 44px; padding: 10px 17px; }
.card-button { min-height: 38px; padding: 8px 13px; }
.button:hover,
.card-button:hover { background: transparent; color: var(--text); border-color: var(--line); transform: translateY(-1px); }

/* Hero */
.hero,
.page-hero,
.article-header { border-bottom: 1px solid var(--line-soft); background: var(--bg); }
.hero { padding: 10px 0 10px; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(300px, .62fr); gap: 64px; align-items: center; }
.hero h1,
.page-hero h1,
.article-header h1 {
  margin: 14px 0 13px;
  font-family: var(--font-display);
  font-size: clamp(39px, 4.4vw, 66px);
  font-weight: 600;
  line-height: 1.03;
  letter-spacing: -.055em;
}
.hero-copy > p,
.page-hero > .container > p,
.page-hero .container > p { max-width: 800px; margin: 0 0 25px; color: var(--muted); font-size: 15px; line-height: 1.6; }
.hero-note {
  position: relative;
  padding: 25px 26px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background-color: var(--surface-3);
  background-image: radial-gradient(circle at 1px 1px, #313641 1px, transparent 0);
  background-size: 7px 7px;
}

.hero h1 {    
    font-size: clamp(39px, 4.4vw, 44px);
    font-weight: 900;    
    letter-spacing: -0.01em;
    text-transform: uppercase;
}

.hero-copy > p { margin: 0; }
.hero-note::before { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(19,22,28,.18), rgba(19,22,28,.65)); pointer-events: none; }
.hero-note > * { position: relative; }
.hero-note strong { display: block; margin-bottom: 8px; font-family: var(--font-display); font-size: 16px; font-weight: 700; }
.hero-note p { margin: 0; color: var(--text-soft); font-size: 13px; }

.page-hero { padding: 46px 0 40px; }
.page-hero.compact { padding: 40px 0 36px; }
.page-hero h1 { max-width: 980px; font-size: clamp(38px, 4vw, 58px); }
.breadcrumbs { margin-bottom: 20px; color: var(--muted-2); font-size: 10px; }
.breadcrumbs ol { display: flex; flex-wrap: wrap; gap: 7px; padding: 0; margin: 0; list-style: none; }
.breadcrumbs li:not(:last-child)::after { content: "/"; margin-left: 7px; color: #4a515e; }
.breadcrumbs a { color: inherit; text-decoration: none; }
.breadcrumbs a:hover { color: var(--text); }

/* Directory layout + sidebar */
.directory-section { padding: 34px 0 72px; }
.directory-layout { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); gap: 38px; align-items: start; }
.desktop-sidebar { position: sticky; top: 96px; }
.browse-sidebar { min-width: 0; }
.browse-group { padding: 0 0 24px; margin: 0 0 22px; border-bottom: 1px solid var(--line-soft); }
.browse-group:last-child { margin-bottom: 0; border-bottom: 0; }
.browse-group h2 { margin: 0 0 10px; color: var(--muted-2); font-size: 10px; font-weight: 500; }
.browse-list { padding: 0; margin: 0; list-style: none; }
.browse-list li { margin: 0; }
.browse-list a,
.browse-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 36px;
  padding: 6px 2px;
  color: var(--muted);
  font-size: 13px;
  text-decoration: none;
}
.browse-list a:hover,
.browse-list .is-active a { color: var(--text); }
.browse-label { min-width: 0; }
.browse-arrow { display: inline-block; width: 17px; color: #535a67; font-family: var(--font-mono); }
.browse-count { flex: none; color: var(--muted-2); font-family: var(--font-mono); font-size: 10px; }
.mobile-browser { display: none; }
.directory-content { min-width: 0; }
.intro-panel,
.bottom-copy {
  margin-bottom: 42px;
  padding: 25px 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-3);
}
.intro-panel h2 { margin-top: 0; }

/* Resource cards */
.resource-section { scroll-margin-top: 92px; margin-bottom: 52px; }
.resource-section:last-child { margin-bottom: 0; }
.section-heading { display: grid; grid-template-columns: minmax(0, 1fr) minmax(240px, .7fr); gap: 28px; align-items: end; margin-bottom: 19px; }
.section-heading h2 { margin: 5px 0 0; font-family: var(--font-display); font-size: clamp(25px, 2.7vw, 35px); font-weight: 600; line-height: 1.15; letter-spacing: -.035em; }
.section-heading > p { margin: 0; color: var(--muted); font-size: 13px; }
.resource-grid,
.post-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.resource-card,
.post-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color .16s ease, transform .16s ease, background .16s ease;
}
.resource-card:hover,
.post-card:hover { border-color: #424854; transform: translateY(-2px); background: #1d212a; }
.resource-media,
.post-card-media {
  display: block;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  background: #0f1116;
  text-decoration: none;
}
.resource-media { aspect-ratio: 16 / 9; }
.post-card-media { aspect-ratio: 16 / 9; }
.resource-media img,
.post-card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .25s ease; }
.resource-card:hover .resource-media img,
.post-card:hover .post-card-media img { transform: scale(1.018); }
.resource-placeholder,
.post-card-placeholder {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 8px;
  padding: 23px;
  isolation: isolate;
  background:
    linear-gradient(135deg, rgba(127,216,236,.08), transparent 42%),
    radial-gradient(circle at 75% 15%, rgba(212,106,60,.13), transparent 34%),
    #12151b;
}
.resource-placeholder::before,
.post-card-placeholder::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: .6;
  background-image: linear-gradient(#272c35 1px, transparent 1px), linear-gradient(90deg, #272c35 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(to top, #000, transparent 78%);
}
.resource-placeholder span,
.post-card-placeholder span { color: var(--cyan); font-family: var(--font-mono); font-size: 9px; letter-spacing: .09em; }
.resource-placeholder strong,
.post-card-placeholder strong { max-width: 94%; color: #e9edf2; font-family: var(--font-display); font-size: 17px; line-height: 1.24; letter-spacing: -.025em; }
.resource-card-body,
.post-card-body { display: flex; flex-direction: column; min-height: 230px; padding: 18px 19px 16px; }
.resource-card-top,
.post-card-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.resource-card h3,
.post-card-title { margin: 0; font-family: var(--font-display); font-size: 16px; font-weight: 650; line-height: 1.3; letter-spacing: -.025em; }
.post-card-title a { text-decoration: none; }
.resource-card p,
.post-card p { margin: 12px 0 19px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.card-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: auto; padding-top: 13px; border-top: 1px solid var(--line-soft); }
.card-actions .status { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Blog / archives */
.listing-section { padding-top: 28px; }
.listing-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 45px;
  margin-bottom: 17px;
  color: var(--muted);
  font-size: 10px;
}
.listing-mode { padding: 8px 11px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--text-soft); }
.empty-state { grid-column: 1 / -1; padding: 48px 28px; border: 1px dashed #3b414d; border-radius: var(--radius); text-align: center; background: var(--surface-3); }
.empty-state h2 { margin: 0 0 8px; font-family: var(--font-display); }
.empty-state p { margin: 0; color: var(--muted); }

.pagination { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 28px; }
.page-numbers { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.page-link {
  min-width: 38px;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  text-decoration: none;
}
.page-link:hover { color: var(--text); border-color: #454b58; }
.page-link.is-current { background: #f3f4f6; border-color: #f3f4f6; color: #171a20; }
.page-gap { color: var(--muted-2); }

/* Article / static page */
.article-header { padding: 46px 0 32px; }
.article-header h1 { max-width: 920px; font-size: clamp(37px, 4.7vw, 63px); }
.article-lead { max-width: 780px; margin: 0 0 22px; color: var(--muted); font-size: 16px; line-height: 1.65; }
.article-meta { display: flex; flex-wrap: wrap; gap: 9px 18px; color: var(--muted-2); font-size: 10px; }
.article-meta span:not(:first-child)::before { content: "/"; margin-right: 18px; color: #484f5b; }
.article-image-wrap { width: min(calc(100% - 48px), 1160px); padding-top: 30px; }
.article-image { width: 100%; max-height: 650px; object-fit: cover; border: 1px solid var(--line); border-radius: var(--radius-lg); }
.article-body,
.page-hero + .section .prose { margin-top: 34px; margin-bottom: 34px; padding: 34px 38px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-3); }
.article-footer-meta { display: flex; flex-wrap: wrap; gap: 12px 24px; padding: 19px 0; border-top: 1px solid var(--line-soft); color: var(--muted); font-size: 12px; }
.post-navigation { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; padding: 23px 0 60px; border-top: 1px solid var(--line-soft); }
.post-navigation > div { min-width: 0; }
.post-navigation span { display: block; margin-bottom: 5px; color: var(--muted-2); font-family: var(--font-mono); font-size: 9px; text-transform: uppercase; letter-spacing: .08em; }
.post-navigation a { color: var(--text-soft); font-family: var(--font-display); font-weight: 650; line-height: 1.35; text-decoration: none; }
.post-navigation a:hover { color: #fff; }
.next-post { text-align: right; }
.related-posts { padding: 0 0 72px; }
.related-posts-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
  padding-top: 30px;
  border-top: 1px solid var(--line-soft);
}
.related-posts-heading h2 {
  margin: 5px 0 0;
  font-family: var(--font-display);
  font-size: clamp(26px, 2.8vw, 37px);
  font-weight: 650;
  line-height: 1.15;
  letter-spacing: -.035em;
}
.related-posts-count {
  color: var(--muted-2);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: .075em;
  text-transform: uppercase;
}
.related-posts-grid .post-card-body { min-height: 215px; }
.section { padding: 18px 0 58px; }

.prose { color: var(--text-soft); font-size: 15px; }
.prose-wide { max-width: 1040px; }
.prose > :first-child { margin-top: 0; }
.prose > :last-child { margin-bottom: 0; }
.prose h2,
.prose h3,
.prose h4 { color: var(--text); font-family: var(--font-display); line-height: 1.18; letter-spacing: -.035em; }
.prose h2 { margin: 2em 0 .7em; font-size: clamp(25px, 3vw, 34px); font-weight: 650; }
.prose h3 { margin: 1.8em 0 .6em; font-size: clamp(21px, 2.4vw, 28px); font-weight: 650; }
.prose h4 { margin: 1.6em 0 .5em; font-size: 19px; }
.prose p { margin: 0 0 1.2em; }
.prose a { color: #dce6ef; }
.prose a:hover { color: #fff; }
.prose ul,
.prose ol { margin: 0 0 1.4em; padding-left: 1.4em; }
.prose li + li { margin-top: .42em; }
.prose blockquote { margin: 1.8em 0; padding: 17px 19px; border-left: 2px solid var(--cyan); border-radius: 0 10px 10px 0; background: var(--surface); color: var(--text-soft); }
.prose blockquote p { margin: 0; }
.prose code { padding: .15em .38em; border: 1px solid var(--line); border-radius: 5px; background: #12151a; color: #e6e9ee; font-family: var(--font-mono); font-size: .88em; }
.prose pre { overflow: auto; padding: 18px; border: 1px solid var(--line); border-radius: 11px; background: #0f1217; color: #eef0f4; }
.prose pre code { padding: 0; border: 0; background: none; color: inherit; }
.prose table { width: 100%; margin: 1.7em 0; border-collapse: collapse; font-size: 13px; }
.prose th,
.prose td { padding: 10px 12px; border: 1px solid var(--line); text-align: left; vertical-align: top; }
.prose th { background: var(--surface); color: var(--text); }
.prose img { margin: 1.8em auto; border: 1px solid var(--line); border-radius: 12px; }
.prose hr { margin: 2.2em 0; border: 0; border-top: 1px solid var(--line); }

/* Video */
.video-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.video-card { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.video-media { display: grid; place-items: center; min-height: 220px; border-bottom: 1px solid var(--line); background: #0e1116; color: var(--text); }
.video-media iframe { width: 100%; aspect-ratio: 16 / 9; border: 0; }
.video-card-body { padding: 18px; }
.video-card h2 { margin: 0 0 8px; font-family: var(--font-display); font-size: 16px; line-height: 1.3; }
.video-card p { margin: 0; color: var(--muted); font-size: 13px; }

/* Footer */
.site-footer { margin-top: 34px; padding: 38px 0 20px; border-top: 1px solid var(--line-soft); background: #101319; color: var(--muted); }
.footer-grid { display: grid; grid-template-columns: 1fr auto; gap: 40px; align-items: start; }
.footer-brand { display: inline-block; text-decoration: none; }
.footer-copy { max-width: 560px; margin: 8px 0 0; font-size: 12px; }
.footer-nav { display: flex; flex-wrap: wrap; gap: 8px 18px; justify-content: flex-end; }
.footer-nav a { color: var(--muted); font-family: var(--font-mono); font-size: 10px; letter-spacing: .045em; text-decoration: none; text-transform: uppercase; }
.footer-nav a:hover { color: var(--text); }
.footer-bottom { display: flex; justify-content: space-between; gap: 24px; margin-top: 28px; padding-top: 16px; border-top: 1px solid var(--line-soft); color: var(--muted-2); font-family: var(--font-mono); font-size: 9px; letter-spacing: .04em; text-transform: uppercase; }
.footer-status { display: inline-flex; align-items: center; gap: 8px; }
.back-to-top {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 40;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(28, 32, 40, .92);
  color: var(--text);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: .2s ease;
}
.back-to-top.is-visible { opacity: 1; pointer-events: auto; transform: translateY(0); }

@media (max-width: 1260px) {
  .resource-grid,
  .post-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .video-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 920px) {
  .container,
  .content-narrow { width: min(calc(100% - 32px), var(--max)); }
  .header-inner { min-height: 62px; }
  .menu-toggle { display: inline-flex; }
  .site-nav {
    position: absolute;
    top: 61px;
    left: 16px;
    right: 16px;
    display: none;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #181c23;
  }
  .site-nav.is-open { display: block; }
  .site-nav ul { display: block; }
  .site-nav a { padding: 11px 12px; }
  .hero-grid { grid-template-columns: 1fr; gap: 28px; }
  .hero-note { max-width: 720px; }
  .desktop-sidebar { display: none; }
  .directory-layout { display: block; }
  .mobile-browser {
    display: block;
    margin-bottom: 28px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-3);
  }
  .mobile-browser summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 56px;
    padding: 13px 18px;
    color: var(--text);
    cursor: pointer;
    list-style: none;
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: .07em;
  }
  .mobile-browser summary::-webkit-details-marker { display: none; }
  .mobile-browser[open] summary { border-bottom: 1px solid var(--line); }
  .mobile-browser[open] summary span { transform: rotate(180deg); }
  .mobile-browser .browse-sidebar { padding: 22px 18px 8px; }
  .mobile-browser .browse-group:last-child { padding-bottom: 8px; }
  .section-heading { grid-template-columns: 1fr; gap: 9px; }
  .article-image-wrap { width: min(calc(100% - 32px), 1160px); }
  .video-grid { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  body { font-size: 15px; }
  .container,
  .content-narrow { width: min(calc(100% - 24px), var(--max)); }
  .brand-code { display: none; }
  .brand-name { font-size: 18px; }
  .hero { padding: 42px 0 34px; }
  .hero h1,
  .page-hero h1,
  .article-header h1 { margin-top: 11px; font-size: clamp(34px, 11vw, 48px); line-height: 1.05; }
  .hero-copy > p { font-size: 14px; }
  .hero-note { padding: 20px; }
  .page-hero,
  .page-hero.compact { padding: 34px 0 28px; }
  .directory-section { padding: 28px 0 52px; }
  .resource-grid,
  .post-list { grid-template-columns: 1fr; gap: 16px; }
  .resource-card-body,
  .post-card-body { min-height: 0; }
  .resource-media,
  .post-card-media { aspect-ratio: 16 / 9.2; }
  .listing-toolbar { min-height: auto; margin: 0 0 15px; }
  .listing-mode { display: none; }
  .pagination { display: grid; grid-template-columns: 1fr 1fr; }
  .page-numbers { grid-column: 1 / -1; grid-row: 1; }
  .page-prev { grid-column: 1; grid-row: 2; justify-self: start; }
  .page-next { grid-column: 2; grid-row: 2; justify-self: end; }
  .article-image-wrap { width: min(calc(100% - 24px), 1160px); padding-top: 22px; }
  .article-body,
  .page-hero + .section .prose { margin-top: 24px; padding: 24px 20px; }
  .post-navigation { grid-template-columns: 1fr; }
  .next-post { text-align: left; }
  .related-posts { padding-bottom: 52px; }
  .related-posts-heading { align-items: flex-start; flex-direction: column; gap: 8px; padding-top: 24px; }
  .footer-grid { grid-template-columns: 1fr; gap: 22px; }
  .footer-nav { justify-content: flex-start; }
  .footer-bottom { flex-direction: column; gap: 8px; }
}

/* Catalog filters / AJAX directory */
.catalog-layout { align-items: start; }
.catalog-category-row { display: grid; grid-template-columns: minmax(0, 1fr) 28px; align-items: center; }
.catalog-category-row > .catalog-filter { min-width: 0; }
.subcategory-toggle {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted-2);
  cursor: pointer;
}
.subcategory-toggle span { display: block; font-family: var(--font-mono); font-size: 15px; transition: transform .16s ease, color .16s ease; }
.subcategory-toggle:hover { color: var(--text); }
.catalog-category.is-open .subcategory-toggle span { transform: rotate(90deg); }
.catalog-category.is-context > .catalog-category-row .category-filter { color: var(--text); }

.browse-sublist {
  padding: 1px 0 7px 18px;
  margin: 0 0 2px 7px;
  border-left: 1px solid var(--line-soft);
  list-style: none;
}
.browse-sublist[hidden] { display: none; }
.browse-sublist a {
  min-height: 31px;
  padding: 4px 0 4px 8px;
  color: var(--muted-2);
  font-size: 12px;
}
.browse-sublist a:hover,
.browse-sublist a.is-active { color: var(--text); }
.catalog-filter.is-active { color: var(--text); }
.catalog-all .catalog-filter.is-active { font-weight: 600; }

.tags-group { padding-bottom: 21px; }
.tag-cloud { display: flex; flex-wrap: wrap; gap: 7px; }
.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: .055em;
  text-decoration: none;
}
.tag-chip span { color: var(--muted-2); font-size: 8px; }
.tag-chip:hover,
.tag-chip.is-active { border-color: #4a515e; background: var(--surface-2); color: var(--text); }
.clear-filters {
  display: inline-flex;
  margin-top: 15px;
  color: var(--muted-2);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: .07em;
  text-decoration: none;
}
.clear-filters:hover { color: var(--text); }

.catalog-toolbar {
  min-height: 84px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
}
.catalog-count,
.catalog-state {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .075em;
  text-transform: uppercase;
}
.catalog-count b { color: var(--text-soft); font-weight: 500; }
.catalog-toolbar h2 {
  margin: 7px 0 3px;
  font-family: var(--font-display);
  font-size: clamp(22px, 2.1vw, 31px);
  font-weight: 600;
  line-height: 1.16;
  letter-spacing: -.035em;
}
.catalog-toolbar p { max-width: 680px; margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.catalog-state {
  flex: none;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text-soft);
}

.resource-card h3 a { color: inherit; text-decoration: none; }
.resource-placeholder small {
  position: absolute;
  top: 17px;
  right: 18px;
  color: var(--muted-2);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: .06em;
}
.resource-taxonomy {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 10px;
  margin: -4px 0 15px;
  color: var(--muted-2);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: .045em;
  text-transform: uppercase;
}
.resource-taxonomy span:not(:last-child)::after { content: "/"; margin-left: 10px; color: #444b57; }
.card-action-buttons { display: flex; align-items: center; gap: 7px; flex: none; }
.card-button-ghost { border-color: var(--line); background: transparent; color: var(--muted); }
.card-button-ghost:hover { border-color: #555d6a; color: var(--text); }
.resource-grid { transition: opacity .14s ease, transform .14s ease; }
.resource-grid.is-loading { opacity: .42; transform: translateY(2px); pointer-events: none; }
.noscript-note { margin: 16px 0 0; color: var(--muted-2); font-family: var(--font-mono); font-size: 10px; }
.bottom-copy { margin-top: 46px; }

/* Resource detail screenshot */
.resource-hero-screenshot {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  margin: 27px 0 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: #0c0f14;
  box-shadow: 0 18px 46px rgba(0, 0, 0, .20);
}
.resource-hero-screenshot img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Resource detail page */
.resource-header .article-lead { max-width: 820px; }
.resource-detail-taxonomy { display: flex; flex-wrap: wrap; gap: 8px; margin: 22px 0 0; }
.resource-detail-taxonomy a {
  display: inline-flex;
  align-items: center;
  min-height: 31px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: .045em;
  text-decoration: none;
  text-transform: uppercase;
}
.resource-detail-taxonomy a:hover { color: var(--text); border-color: #4b5360; }
.resource-detail-actions { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-top: 25px; padding-top: 19px; border-top: 1px solid var(--line-soft); }
.resource-related { padding: 8px 0 64px; }
.compact-heading { display: block; margin-bottom: 18px; }
.compact-heading h2 { font-size: clamp(24px, 2.4vw, 32px); }

@media (max-width: 920px) {
  .catalog-toolbar { min-height: 0; align-items: flex-start; margin-bottom: 18px; }
  .mobile-browser .tag-cloud { padding-bottom: 3px; }
}

@media (max-width: 680px) {
  .catalog-toolbar { display: block; }
  .catalog-state { display: inline-flex; margin-top: 13px; }
  .resource-taxonomy { margin-bottom: 13px; }
  .card-actions { align-items: flex-end; }
  .card-actions .status { white-space: normal; line-height: 1.35; }
  .card-action-buttons { gap: 6px; }
  .card-button { min-height: 36px; padding: 7px 10px; font-size: 10px; }
  .resource-detail-actions { align-items: flex-start; flex-direction: column; }
  .resource-detail-actions .button { width: 100%; }
}

/* Resource card metrics */
.resource-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 9px 14px;
  margin: -1px 0 15px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: .045em;
  text-transform: uppercase;
}
.resource-card-meta > span { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.flag-icon { display: inline-block; width: 20px; height: 14px; object-fit: cover; border-radius: 3px; box-shadow: inset 0 0 0 1px rgba(255,255,255,.08); vertical-align: middle; }
.card-audience .flag-icon { flex: 0 0 auto; }
.card-rating i,
.stars { color: #f0c86e; font-style: normal; letter-spacing: .06em; white-space: nowrap; }
.card-comments span { color: var(--text-soft); font-size: 13px; line-height: 1; }

/* Resource detail facts */
.resource-facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin: 27px 0 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--line);
}
.resource-facts > div { min-width: 0; padding: 16px 17px 17px; background: var(--surface-3); }
.resource-facts dt {
  margin-bottom: 7px;
  color: var(--muted-2);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: .075em;
  text-transform: uppercase;
}
.resource-facts dd { margin: 0; color: var(--text-soft); font-size: 12px; line-height: 1.45; }
.detail-rating { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.detail-rating .stars { font-size: 13px; }
.detail-audience { display: flex; align-items: center; gap: 8px; }
.detail-audience .flag-icon { width: 22px; height: 15px; }
.detail-audience span { font-size: 14px; line-height: 1; letter-spacing: .04em; }

/* Public / onion links */
.resource-links-panel {
  margin-top: 34px;
  margin-bottom: 34px;
  padding: 28px 30px 30px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-3);
}
.resource-links-heading { margin-bottom: 18px; }
.resource-links-heading p { max-width: 560px; color: var(--muted); font-size: 12px; }
.resource-links-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.resource-link-column {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
}
.resource-link-column-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 13px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--text-soft);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: .075em;
}
.resource-link-column-head b { color: var(--muted-2); font-weight: 500; }
.resource-link-list { display: grid; }
.resource-link-row { min-width: 0; padding: 12px 13px; }
.resource-link-row + .resource-link-row { border-top: 1px solid var(--line-soft); }
.resource-link-row code {
  display: block;
  overflow: hidden;
  margin-bottom: 9px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9px;
  line-height: 1.55;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.resource-link-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.resource-link-actions button,
.resource-link-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 31px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: .05em;
  text-decoration: none;
  text-transform: uppercase;
}
.resource-link-actions button:hover,
.resource-link-actions a:hover { border-color: #4d5562; color: var(--text); }
.resource-link-actions a { background: #f4f5f7; border-color: #f4f5f7; color: #15181e; }
.resource-link-actions a:hover { color: #15181e; background: #fff; border-color: #fff; }

/* Comments */
.comments-section { padding: 8px 0 20px; }
.comment-form-section { padding: 18px 0 72px; }
.comments-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}
.comments-heading h2 { margin: 4px 0 0; font-family: var(--font-display); font-size: clamp(25px, 2.4vw, 33px); letter-spacing: -.035em; }
.comments-total { color: var(--muted-2); font-family: var(--font-mono); font-size: 9px; letter-spacing: .075em; }
.comments-list {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-3);
}
.comment-item { display: grid; grid-template-columns: 48px minmax(0, 1fr); gap: 14px; padding: 18px 20px; }
.comment-item + .comment-item { border-top: 1px solid var(--line-soft); }
.comment-item.is-extra { display: none; }
.comment-avatar { width: 48px; height: 48px; border: 1px solid var(--line); border-radius: 50%; background: var(--surface); }
.comment-content { min-width: 0; }
.comment-meta { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 16px; }
.comment-meta strong { color: var(--text-soft); font-family: var(--font-display); font-size: 13px; font-weight: 650; }
.comment-meta time { color: var(--muted-2); font-family: var(--font-mono); font-size: 8px; letter-spacing: .045em; text-transform: uppercase; }
.comment-content p { margin: 7px 0 0; color: var(--muted); font-size: 13px; line-height: 1.62; }
.comment-actions { margin-top: 9px; }
.comment-reply-button {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted-2);
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.comment-reply-button:hover { color: var(--text-soft); }
.comment-replies {
  margin-top: 14px;
  border-top: 1px solid var(--line-soft);
}
.comment-reply {
  grid-template-columns: 38px minmax(0, 1fr);
  margin-left: 10px;
  padding: 14px 0 0 16px;
  border-left: 1px solid var(--line-soft);
}
.comment-reply + .comment-reply { margin-top: 13px; border-top: 0; }
.comment-reply .comment-avatar { width: 38px; height: 38px; }
.comment-reply-target {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--muted);
  font-size: 11px;
}
.comment-reply-target.is-hidden { display: none; }
.comment-reply-target strong { color: var(--text-soft); }
.comment-reply-target button {
  border: 0;
  background: transparent;
  color: var(--muted-2);
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: .05em;
  text-transform: uppercase;
}
.comment-reply-target button:hover { color: var(--text-soft); }
.show-all-comments {
  width: 100%;
  min-height: 46px;
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
  color: var(--text-soft);
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.show-all-comments span { color: var(--muted-2); }
.show-all-comments:hover { border-color: #4c5360; color: var(--text); }

.comment-form {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-3);
}
.comment-form-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(220px, .52fr); gap: 14px; margin-top: 14px; }
.comment-field { display: grid; gap: 7px; }
.comment-field > span { color: var(--muted); font-family: var(--font-mono); font-size: 9px; letter-spacing: .06em; text-transform: uppercase; }
.comment-field input,
.comment-field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: 0;
  background: var(--surface);
  color: var(--text);
  padding: 11px 12px;
  font-family: var(--font-body);
  font-size: 13px;
  resize: vertical;
}
.comment-field input:focus,
.comment-field textarea:focus { border-color: #545d6a; box-shadow: 0 0 0 2px rgba(127,216,236,.05); }
.comment-submit { margin-top: 16px; }
.form-notice { margin: 0 0 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text-soft); font-size: 12px; }
.form-notice p { margin: 0; }
.form-notice p + p { margin-top: 4px; }
.form-notice.success { border-color: rgba(88,211,155,.35); }
.form-notice.error { border-color: rgba(212,106,60,.45); }

@media (max-width: 920px) {
  .resource-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .resource-links-grid { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  .resource-card-meta { gap: 8px 11px; }
  .resource-facts { grid-template-columns: 1fr 1fr; }
  .resource-facts > div { padding: 14px; }
  .resource-links-panel { margin-top: 24px; margin-bottom: 24px; padding: 22px 18px; }
  .comment-item { grid-template-columns: 40px minmax(0, 1fr); padding: 15px; }
  .comment-avatar { width: 40px; height: 40px; }
  .comment-reply { grid-template-columns: 32px minmax(0, 1fr); margin-left: 4px; padding-left: 10px; }
  .comment-reply .comment-avatar { width: 32px; height: 32px; }
  .comment-meta { display: block; }
  .comment-meta time { display: block; margin-top: 2px; }
  .comment-form { padding: 18px; }
  .comment-form-row { grid-template-columns: 1fr; }
  .comment-submit { width: 100%; }
}

/* Resource editorial content */
.resource-content-date {
  margin: 0 0 28px !important;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
  color: var(--muted-2);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .075em;
  text-transform: uppercase;
}
.resource-content-date time { color: inherit; }
.resource-feature-list {
  display: grid;
  gap: 9px;
  margin-bottom: 1.8em !important;
}
.resource-feature-list li::marker { color: var(--cyan); }

/* Migrated data helpers */
.resource-link-empty {
  padding: 12px 14px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  color: var(--muted-2);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.video-media img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; display: block; }
.video-date { display: block; margin-top: 12px; color: var(--muted-2); font-family: var(--font-mono); font-size: 10px; text-transform: uppercase; }
.video-link { display: inline-flex; margin-top: 14px; }


/* Comment submission popup */
.comment-toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 1200;
  display: flex;
  align-items: flex-start;
  gap: 11px;
  width: min(420px, calc(100vw - 32px));
  padding: 15px 16px;
  border: 1px solid var(--success);
  border-radius: 12px;
  background: var(--success);
  color: #07120d;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .34);
  opacity: 1;
  transform: translateY(0);
  transition: opacity .38s ease, transform .38s ease;
}
.comment-toast.is-hiding { opacity: 0; transform: translateY(10px); pointer-events: none; }
.comment-toast-icon {
  display: grid;
  place-items: center;
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  border: 1px solid rgba(7, 18, 13, .28);
  border-radius: 50%;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
}
.comment-toast-copy { display: grid; gap: 2px; min-width: 0; }
.comment-toast-copy strong { color: inherit; font-family: var(--font-display); font-size: 13px; font-weight: 750; }
.comment-toast-copy span { color: inherit; font-size: 12px; line-height: 1.45; }

@media (max-width: 680px) {
  .comment-toast { right: 16px; bottom: 16px; left: 16px; width: auto; }
}

/* Language switcher: Russian is the default URL set, English lives under /en/. */
.header-actions { display: inline-flex; align-items: center; gap: 10px; }
.language-switcher {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1;
  letter-spacing: .06em;
  white-space: nowrap;
}
.language-switcher a { color: var(--muted-2); text-decoration: none; }
.language-switcher a:hover { color: var(--text); }
.language-switcher a.is-active { color: var(--orange); font-weight: 600; }
.language-switcher span { color: var(--line-strong, var(--line)); }
@media (max-width: 760px) {
  .header-inner { gap: 12px; }
  .header-actions { margin-left: auto; gap: 7px; }
  .language-switcher { padding: 7px; }
}
@media (max-width: 420px) {
  .language-switcher { font-size: 10px; gap: 4px; padding: 6px; }
}
