:root {
  --pico-font-family-sans-serif: 'Inter', -apple-system, system-ui, 'Segoe UI', Roboto, sans-serif;
  --pico-font-family-monospace: 'JetBrains Mono', ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;
  --pico-font-family: var(--pico-font-family-sans-serif);
  --pico-primary: #2563eb;
  --pico-primary-hover: #1d4ed8;
  --pico-font-size: 93.75%;     /* 15px base instead of 16px */
  --pico-line-height: 1.55;
  --pico-typography-spacing-vertical: .9rem;
}

/* Tighter heading scale */
article h1 { font-size: 1.875rem; line-height: 1.25; }   /* ~28px */
article h2 { font-size: 1.4rem;   line-height: 1.3;  margin-top: 2.25rem; }   /* ~21px */
article h3 { font-size: 1.15rem;  line-height: 1.35; margin-top: 1.5rem; }    /* ~17px */
article h4 { font-size: 1rem; }
article p, article li { font-size: .95rem; }

main.container { max-width: 1100px; }

/* ==== Top nav ==== */
nav.top {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  padding: .75rem 0;
  border-bottom: 1px solid var(--pico-muted-border-color);
}
nav.top .brand {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  font-weight: 700;
  font-size: 1.1rem;
  text-decoration: none;
}
.brand-logo {
  width: 36px;
  height: 36px;
  display: block;
  transition: transform .15s;
}
.brand:hover .brand-logo { transform: scale(1.05); }
nav.top .nav-actions {
  display: flex;
  align-items: center;
  gap: .5rem;
  order: 2;
}
/* Side drawer: выезжает справа при клике на гамбургер */
nav.top .nav-links {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  width: min(340px, 90vw);
  background: var(--pico-background-color, #fff);
  box-shadow: -8px 0 24px rgba(0, 0, 0, .15);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  list-style: none;
  margin: 0;
  padding: 4rem 1.25rem 1.25rem;
  z-index: 200;
  transform: translateX(100%);
  transition: transform .25s ease;
  overflow-y: auto;
}
nav.top .nav-links.open { transform: translateX(0); }
.drawer-phase + .drawer-phase {
  border-top: 1px solid var(--pico-muted-border-color);
  padding-top: .75rem;
  margin-top: .75rem;
}
.drawer-phase ul li a {
  display: block;
  padding: .5rem .75rem .5rem 1.5rem;
  text-decoration: none;
  color: var(--pico-color);
  font-weight: 500;
  font-size: .9rem;
  line-height: 1.3;
  border-radius: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  position: relative;
}
.drawer-phase ul li a::before {
  content: "";
  position: absolute;
  left: .65rem;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--pico-muted-color);
  opacity: .5;
}
.drawer-phase ul li a:hover {
  color: var(--pico-primary);
  background: var(--pico-muted-border-color);
}
.drawer-phase ul li a:hover::before {
  background: var(--pico-primary);
  opacity: 1;
}

/* Затемнение фона при открытом drawer */
.nav-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .4);
  z-index: 199;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}
.nav-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

/* Hamburger — hidden on desktop */
.hamburger {
  --pico-background-color: transparent;
  --pico-border-color: transparent;
  --pico-color: var(--pico-muted-color);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.4rem;
  padding: 0;
  margin: 0;
  line-height: 1;
  user-select: none;
  width: 36px;
  height: 36px;
  border-radius: 8px;
}
.hamburger:hover {
  --pico-background-color: var(--pico-card-background-color);
}

/* Search box */
.search-box {
  flex: 1 1 0;
  min-width: 120px;
  max-width: 360px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  order: 1;
}
.search-box input {
  margin: 0;
  height: 36px;
  width: 100%;
  padding: 0 .75rem;
  border-radius: 8px;
  font-size: .9rem;
}


/* ==== Article layout ==== */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 2.5rem;
  margin-top: 2rem;
}
/* Tablet: 769–1024 — narrower sidebar (220px) so article gets more room. */
@media (max-width: 1024px) and (min-width: 901px) {
  .layout { grid-template-columns: minmax(0, 1fr) 220px; gap: 1.75rem; }
}

/* Tablet portrait / small laptop: 768–900 — sidebar drops below article. */
@media (max-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
}

/* overflow-x: clip prevents horizontal page scroll without breaking
   position: sticky on descendants (overflow-x: hidden would). */
html, body { overflow-x: clip; }

.sidebar {
  position: sticky;
  top: 1.5rem;
  align-self: start;
  max-height: calc(100vh - 3rem);
  overflow-y: auto;
  font-size: .9rem;
}
@media (max-width: 900px) {
  .sidebar { position: static; max-height: none; overflow: visible; }
}

.sidebar > div + div,
.sidebar > details + details {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--pico-muted-border-color);
}
.sidebar h4 {
  margin: 0 0 .75rem;
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--pico-muted-color);
}
.sidebar ul { list-style: none; padding: 0; margin: 0; }

/* === Sidebar collapsible groups (TOC, Related, Articles) === */
.sidebar-group { margin: 0; }
.sidebar-group summary {
  list-style: none;
  cursor: pointer;
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--pico-muted-color);
  padding: .25rem 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
  outline-offset: 2px;
}
.sidebar-group summary::-webkit-details-marker { display: none; }
.sidebar-group summary::after {
  content: "▾";
  margin-left: .5em;
  color: var(--pico-muted-color);
  transition: transform .2s;
  font-size: .8rem;
}
.sidebar-group:not([open]) summary::after {
  transform: rotate(-90deg);
}
.sidebar-group summary:hover {
  color: var(--pico-primary);
}
.sidebar-group summary:hover::after {
  color: var(--pico-primary);
}
.sidebar-group > ul {
  margin-top: .75rem;
}

.toc li { padding: .2rem 0; }
.toc li.toc-level-3 { padding-left: 1rem; }
.toc a {
  display: block;
  text-decoration: none;
  color: var(--pico-muted-color);
  border-left: 2px solid transparent;
  padding-left: .5rem;
  line-height: 1.4;
  transition: color .15s, border-color .15s;
}
.toc a:hover { color: var(--pico-primary); }
.toc a.active {
  color: var(--pico-primary);
  border-left-color: var(--pico-primary);
  font-weight: 500;
}

.related li {
  padding: .4rem 0;
  border-bottom: 1px dashed var(--pico-muted-border-color);
}
.related a { text-decoration: none; }
.related a:hover { color: var(--pico-primary); }

article {
  min-width: 0;
  overflow-wrap: break-word;
  word-wrap: break-word;
}
article h2 { margin-top: 2.5rem; }
article pre,
article pre[class*="language-"] {
  font-size: .8rem;
  max-width: 100%;
  background: #f6f8fa;
  border: 1px solid var(--pico-muted-border-color);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin: 1rem 0;
  font-family: var(--pico-font-family-monospace);
  line-height: 1.55;
  white-space: pre-wrap !important;
  word-break: break-word !important;
  overflow-wrap: anywhere !important;
  overflow-x: hidden !important;
  word-wrap: break-word !important;
}
article pre code,
article pre[class*="language-"] code,
article pre code[class*="language-"],
article code[class*="language-"] {
  white-space: pre-wrap !important;
  word-break: break-word !important;
  overflow-wrap: anywhere !important;
  word-wrap: break-word !important;
}

/* Disable line numbers gutter on narrow screens — it conflicts with wrapping
   and adds horizontal padding that pushes content out of the viewport. */
@media (max-width: 600px) {
  pre.line-numbers { padding-left: 1rem !important; }
  pre.line-numbers > .line-numbers-rows { display: none; }
}

/* Toolbar & copy button polish */
div.code-toolbar > .toolbar {
  top: .5rem;
  right: .5rem;
  opacity: 0;
  transition: opacity .15s;
}
div.code-toolbar:hover > .toolbar { opacity: 1; }
div.code-toolbar > .toolbar > .toolbar-item > button {
  background: rgba(0,0,0,.06);
  color: #1f2937;
  border: 1px solid rgba(0,0,0,.1);
  border-radius: 4px;
  padding: .25rem .55rem;
  font-size: .75rem;
  cursor: pointer;
}
div.code-toolbar > .toolbar > .toolbar-item > button:hover {
  background: rgba(0,0,0,.12);
}

/* Line numbers gutter */
pre.line-numbers {
  position: relative;
  padding-left: 3rem !important;
  counter-reset: linenumber;
}
pre.line-numbers > code { position: relative; white-space: inherit; }
.line-numbers .line-numbers-rows {
  border-right: 1px solid #d1d5db;
  padding-top: 1rem;
}
.line-numbers-rows > span:before { color: #9ca3af; }
article :not(pre) > code {
  background: #f1f3f5;
  /* #ad1457 vs #f1f3f5 → ~4.9 contrast (WCAG AA passes for normal text).
     Previous #d6336c was 4.49 — failed AA by a hair, Lighthouse a11y. */
  color: #ad1457;
  padding: .15rem .4rem;
  border-radius: 4px;
  font-size: .85em;
  font-family: var(--pico-font-family-monospace);
  word-break: break-word;
}
article pre code {
  background: none;
  color: inherit;
  padding: 0;
  word-break: normal;
}
article img {
  max-width: 100%;
  height: auto;
}
article table {
  display: block;
  overflow-x: auto;
  max-width: 100%;
}
article .mermaid {
  overflow-x: auto;
  display: block;
  text-align: center;
}
article .mermaid svg {
  display: inline-block;
  vertical-align: top;
}
/* Skill banner — для статей, у которых есть привязанный AI-скилл */
.skill-banner {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 1.5rem 0 2rem;
  padding: 1rem 1.25rem;
  background: #fffbeb;
  border: 2px solid #f59e0b;
  border-radius: 12px;
  text-decoration: none;
  color: inherit;
  transition: transform .15s, box-shadow .15s, background .15s;
}
.skill-banner:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(245, 158, 11, .25);
  background: #fef3c7;
}
.skill-banner-icon {
  flex-shrink: 0;
  display: block;
  /* Чёрный логотип -> янтарный (#d97706). Сгенерировано через известный hex→filter подход. */
  filter: brightness(0) saturate(100%) invert(50%) sepia(98%) saturate(2000%) hue-rotate(11deg) brightness(99%) contrast(95%);
}
.skill-banner-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: .15rem;
  min-width: 0;
}
.skill-banner-title {
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #b45309;
  font-weight: 700;
}
.skill-banner-name {
  font-weight: 600;
  font-size: 1.05rem;
  color: #78350f;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.skill-banner-arrow {
  color: #d97706;
  font-size: 1.4rem;
  transition: transform .2s;
}
.skill-banner:hover .skill-banner-arrow {
  transform: translateX(4px);
}

/* Green variant — для статей со связанной библиотекой */
.skill-banner-lib {
  background: #f0fdf4;
  border-color: #16a34a;
}
.skill-banner-lib:hover {
  background: #dcfce7;
  box-shadow: 0 4px 16px rgba(22, 163, 74, .25);
}
.skill-banner-lib .skill-banner-icon {
  /* Чёрный логотип -> зелёный (#16a34a). */
  filter: brightness(0) saturate(100%) invert(45%) sepia(72%) saturate(550%) hue-rotate(85deg) brightness(95%) contrast(90%);
}
.skill-banner-lib .skill-banner-title { color: #15803d; }
.skill-banner-lib .skill-banner-name { color: #14532d; }
.skill-banner-lib .skill-banner-arrow { color: #16a34a; }

/* Blue variant — эталонный пример реализации */
.skill-banner-example {
  background: #eff6ff;
  border-color: #2563eb;
}
.skill-banner-example:hover {
  background: #dbeafe;
  box-shadow: 0 4px 16px rgba(37, 99, 235, .25);
}
.skill-banner-example .skill-banner-icon {
  /* Чёрный логотип -> синий (#2563eb). */
  filter: brightness(0) saturate(100%) invert(28%) sepia(98%) saturate(2200%) hue-rotate(218deg) brightness(95%) contrast(95%);
}
.skill-banner-example .skill-banner-title { color: #1d4ed8; }
.skill-banner-example .skill-banner-name { color: #1e3a8a; }
.skill-banner-example .skill-banner-arrow { color: #2563eb; }

article img.mermaid-image {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 1.5rem auto;
  cursor: zoom-in;
  transition: opacity .15s;
}
article img.mermaid-image:hover { opacity: .85; }

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .9);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 2rem;
  overflow: auto;
  cursor: zoom-out;
}
.lightbox.open { display: flex; }
.lightbox img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  cursor: default;
  background: #fff;
  border-radius: 8px;
}
.lightbox-close {
  position: fixed;
  top: 1rem;
  right: 1.25rem;
  background: rgba(255, 255, 255, .15);
  border: 0;
  color: #fff;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  z-index: 1001;
}
.lightbox-close:hover { background: rgba(255, 255, 255, .3); }
.article-header {
  margin-bottom: 1.5rem;
}
.article-header h1 {
  margin: 0 0 .75rem 0;
}
.article-excerpt {
  color: var(--pico-muted-color);
  font-size: 1.05rem;
  margin: 0;
  line-height: 1.5;
}

.breadcrumb {
  display: block;
  font-size: .85rem;
  color: var(--pico-muted-color);
  margin: 1rem 0;
}
.breadcrumb a, .breadcrumb .sep {
  display: inline;
}
.breadcrumb .sep {
  margin: 0 .35rem;
  color: var(--pico-muted-color);
}

article .og-hero {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 1.5rem 0 2rem;
  border-radius: 12px;
}
article table { margin: 1.5rem 0; }
article ul li, article ol li { margin: .3rem 0; }

/* ==== Prev / next ==== */
.prevnext {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--pico-muted-border-color);
}
@media (max-width: 600px) { .prevnext { grid-template-columns: 1fr; } }
.prevnext a {
  display: block;
  padding: 1rem;
  border: 1px solid var(--pico-muted-border-color);
  border-radius: 8px;
  text-decoration: none;
}
.prevnext a:hover { background: var(--pico-card-background-color); }
.prevnext .label {
  font-size: .75rem;
  text-transform: uppercase;
  color: var(--pico-muted-color);
  letter-spacing: .05em;
}
.prevnext .title { font-weight: 600; margin-top: .2rem; }
.prevnext .next { text-align: right; }

/* ==== Home page hero ==== */
.home-hero {
  margin: 2.5rem 0 3rem;
  padding: 2rem 0 1rem;
  border-bottom: 1px solid var(--pico-muted-border-color);
}
.home-hero h1 {
  font-size: 2.75rem;
  margin: 0 0 1rem;
  letter-spacing: -.02em;
}
.home-tagline {
  font-size: 1.15rem;
  line-height: 1.6;
  color: var(--pico-color);
  max-width: 720px;
  margin: 0 0 1.75rem;
}
.home-cta {
  margin: 0 0 .5rem;
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
}
.home-cta-primary {
  display: inline-block;
  padding: .65rem 1.2rem;
  background: var(--pico-primary);
  color: var(--pico-primary-inverse);
  border: 2px solid var(--pico-primary);
  border-radius: 8px;
  font-weight: 600;
  text-decoration: none;
  transition: filter .15s;
}
.home-cta-primary:hover { filter: brightness(1.1); }
.home-cta-secondary {
  display: inline-block;
  padding: .65rem 1.2rem;
  background: transparent;
  color: var(--pico-primary);
  border: 2px solid var(--pico-primary);
  border-radius: 8px;
  font-weight: 600;
  text-decoration: none;
  transition: background .15s, color .15s;
}
.home-cta-secondary:hover {
  background: var(--pico-primary);
  color: var(--pico-primary-inverse);
}
.home-author {
  margin: 1.25rem 0 0;
  font-size: .9rem;
  color: var(--pico-muted-color);
}
.home-author a {
  color: var(--pico-color);
  text-decoration: none;
  border-bottom: 1px dashed var(--pico-muted-border-color);
  transition: color .15s, border-bottom-color .15s;
}
.home-author a:hover {
  color: var(--pico-primary);
  border-bottom-color: var(--pico-primary);
}
.home-sections-title {
  font-size: .85rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--pico-muted-color);
  font-weight: 600;
  margin: 2rem 0 1rem;
}

/* ==== Home: three pillars ==== */
.pillars {
  margin: 0 0 3.5rem;
}
.pillars-title {
  font-size: .85rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--pico-muted-color);
  font-weight: 600;
  margin: 0 0 .5rem;
}
.pillars-intro {
  color: var(--pico-muted-color);
  margin: 0 0 1.5rem;
  max-width: 720px;
}
.pillars-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}
@media (max-width: 900px) {
  .pillars-grid { grid-template-columns: 1fr; }
}
.pillar {
  display: flex;
  flex-direction: column;
  gap: .75rem;
  padding: 1.5rem 1.5rem 1.25rem;
  border: 2px solid;
  border-radius: 12px;
  text-decoration: none;
  color: inherit;
  transition: transform .15s, box-shadow .15s;
}
.pillar:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, .08);
}
.pillar h3 {
  margin: 0;
  font-size: 1.25rem;
}
.pillar p {
  margin: 0;
  font-size: .95rem;
  line-height: 1.55;
  color: var(--pico-color);
  flex-grow: 1;
}
.pillar p code {
  font-size: .85em;
  padding: .1em .35em;
  background: rgba(0, 0, 0, .05);
  border-radius: 4px;
}
.pillar-badge {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  align-self: flex-start;
  padding: .2rem .55rem;
  border-radius: 6px;
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.pillar-link {
  margin-top: .25rem;
  font-size: .85rem;
  font-weight: 600;
  border-bottom: 1px dashed currentColor;
  align-self: flex-start;
}

/* Yellow badger — AI skills */
.pillar-skill {
  background: #fffbeb;
  border-color: #f59e0b;
}
.pillar-skill h3 { color: #78350f; }
.pillar-skill .pillar-badge {
  background: #fef3c7;
  color: #78350f;
}
.pillar-skill .pillar-badge .pillar-icon,
.pillar-skill .pillar-link {
  color: #b45309;
}
.pillar-skill .pillar-icon {
  filter: brightness(0) saturate(100%) invert(50%) sepia(98%) saturate(2000%) hue-rotate(11deg) brightness(99%) contrast(95%);
}

/* Green badger — libraries */
.pillar-lib {
  background: #f0fdf4;
  border-color: #16a34a;
}
.pillar-lib h3 { color: #14532d; }
.pillar-lib .pillar-badge {
  background: #dcfce7;
  color: #14532d;
}
.pillar-lib .pillar-link {
  color: #15803d;
}
.pillar-lib .pillar-icon {
  filter: brightness(0) saturate(100%) invert(45%) sepia(72%) saturate(550%) hue-rotate(85deg) brightness(95%) contrast(90%);
}

/* Blue badger — example case */
.pillar-example {
  background: #eff6ff;
  border-color: #2563eb;
}
.pillar-example h3 { color: #1e3a8a; }
.pillar-example .pillar-badge {
  background: #dbeafe;
  color: #1e3a8a;
}
.pillar-example .pillar-link {
  color: #1d4ed8;
}
.pillar-example .pillar-icon {
  filter: brightness(0) saturate(100%) invert(28%) sepia(98%) saturate(2200%) hue-rotate(218deg) brightness(95%) contrast(95%);
}

/* ==== Roadmap on home ==== */
.roadmap { margin: 1rem 0 4rem; }
.roadmap-intro {
  color: var(--pico-muted-color);
  margin: 0 0 2rem;
  max-width: 720px;
}
.roadmap-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}
.roadmap-phase {
  border-left: 3px solid var(--pico-primary);
  padding-left: 1.5rem;
}
.roadmap-phase summary {
  list-style: none;
  cursor: pointer;
  outline-offset: 4px;
}
.roadmap-phase summary::-webkit-details-marker { display: none; }
.roadmap-phase-head {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
}
.roadmap-toggle {
  margin-left: auto;
  align-self: center;
  font-size: 1.4rem;
  color: var(--pico-muted-color);
  transition: transform .2s;
}
.roadmap-phase details[open] .roadmap-toggle { transform: rotate(180deg); }
.roadmap-phase details:not([open]) .roadmap-phase-head { margin-bottom: 0; }
.roadmap-num {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--pico-primary);
  color: var(--pico-primary-inverse);
  font-weight: 700;
  font-size: 1.1rem;
}
.roadmap-phase-head h3 {
  margin: .25rem 0 .25rem;
  font-size: 1.35rem;
}
.roadmap-phase-head p {
  margin: 0;
  color: var(--pico-muted-color);
  font-size: .95rem;
}
.roadmap-sections {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.roadmap-sections a {
  display: flex;
  flex-direction: column;
  gap: .15rem;
  padding: .85rem 1rem;
  border: 1px solid var(--pico-muted-border-color);
  border-radius: 8px;
  text-decoration: none;
  color: inherit;
  transition: border-color .15s, transform .15s;
}
.roadmap-sections a:hover {
  border-color: var(--pico-primary);
  transform: translateX(4px);
}
.roadmap-section-title { font-weight: 600; }
.roadmap-section-excerpt {
  color: var(--pico-muted-color);
  font-size: .85rem;
}

/* ==== Drawer phases ==== */
.drawer-home {
  display: block;
  padding: .55rem .75rem;
  margin: 0 0 .25rem;
  background: var(--pico-primary);
  color: var(--pico-primary-inverse) !important;
  border-radius: 6px;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.drawer-home-title {
  display: inline;
  font-weight: 600;
  font-size: .9rem;
}
.drawer-home-sub {
  display: inline;
  font-size: .8rem;
  opacity: .85;
  margin-left: .35rem;
}
.drawer-phase { margin-top: .85rem; }
.drawer-libs h4 { color: #15803d; }
.drawer-libs-icon {
  filter: brightness(0) saturate(100%) invert(45%) sepia(72%) saturate(550%) hue-rotate(85deg) brightness(95%) contrast(90%);
}
.drawer-phase h4 {
  display: flex;
  align-items: center;
  gap: .4rem;
  margin: 0 0 .25rem;
  padding: 0 .5rem;
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--pico-muted-color);
  font-weight: 600;
}
.drawer-phase-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--pico-primary);
  color: var(--pico-primary-inverse);
  font-size: .75rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
  text-transform: none;
}
.drawer-phase ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.drawer-phase ul li {
  display: block;
  width: 100%;
}

/* ==== Home page list (legacy, kept for backwards compat) ==== */
.home-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin: 1rem 0 3rem;
}
.home-item {
  display: block;
  padding: 1.25rem 1.5rem;
  border: 1px solid var(--pico-muted-border-color);
  border-radius: 12px;
  text-decoration: none;
  color: inherit;
  transition: box-shadow .2s, transform .2s, border-color .2s;
}
.home-item:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,.08);
  transform: translateY(-2px);
  border-color: var(--pico-primary);
}
.home-item h2 {
  margin: 0 0 .35rem 0;
  font-size: 1.25rem;
}
.home-item p {
  margin: 0;
  color: var(--pico-muted-color);
  font-size: .9rem;
}

/* ==== Scroll-to-top ==== */
.scroll-top {
  position: fixed;
  right: 1.5rem;
  bottom: 1.5rem;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: var(--pico-primary);
  color: var(--pico-primary-inverse);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity .2s, transform .2s;
  box-shadow: 0 4px 12px rgba(0,0,0,.15);
  z-index: 100;
}
.scroll-top.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
.scroll-top:hover { filter: brightness(1.1); }

/* ==== Footer ==== */
footer {
  margin-top: 4rem;
  padding: 2rem 0;
  text-align: center;
  color: var(--pico-muted-color);
  font-size: .85rem;
  border-top: 1px solid var(--pico-muted-border-color);
}

.home-tagline-secondary {
  margin-top: -.5rem;
  color: var(--pico-muted-color);
  font-size: .98em;
}

.home-glance {
  margin: 3rem 0 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--pico-muted-border-color);
}
.home-glance-title {
  margin-bottom: .5rem;
  font-size: 1.4rem;
}
.home-glance-intro {
  color: var(--pico-muted-color);
  margin-bottom: 1rem;
}
.home-glance pre {
  margin: 0;
}
.home-glance-link {
  margin-top: .75rem;
  font-size: .95rem;
}

.pillars-legend {
  margin-top: 1.25rem;
  font-size: .9rem;
  color: var(--pico-muted-color);
  text-align: center;
}
.legend-mark {
  display: inline-block;
  padding: 0 .35em;
  border-radius: .25em;
  font-weight: 600;
}
.legend-mark-skill { background: #fffbeb; color: #92400e; }
.legend-mark-lib { background: #ecfdf5; color: #065f46; }
.legend-mark-example { background: #eff6ff; color: #1e40af; }

.nav-services {
  display: inline-flex;
  align-items: center;
  padding: .4rem .85rem;
  border-radius: 6px;
  background: var(--pico-primary);
  color: var(--pico-primary-inverse) !important;
  font-weight: 600;
  font-size: .9rem;
  text-decoration: none;
  margin-right: .5rem;
  transition: filter .15s;
}
.nav-services:hover { filter: brightness(1.1); }
@media (max-width: 640px) {
  .nav-services { display: none; }
}

/* === Drawer group title (UCP / «Важно знать для UCP») === */
.drawer-group-title {
  margin: 1.5rem 0 .25rem;
  padding: 0 .25rem;
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--pico-primary);
  border-top: 1px solid var(--pico-muted-border-color);
  padding-top: .85rem;
}
.drawer-group-title:first-of-type {
  margin-top: 1rem;
  border-top: none;
  padding-top: 0;
}

/* === Home roadmap foundation block separator === */
.roadmap-foundation-title {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 2px solid var(--pico-muted-border-color);
}

/* === Right sidebar collapse toggle === */
.sidebar-toggle {
  position: fixed;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 64px;
  padding: 0;
  border: 1px solid var(--pico-muted-border-color);
  border-right: none;
  border-radius: 8px 0 0 8px;
  background: var(--pico-card-background-color);
  color: var(--pico-muted-color);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color .15s, border-color .15s;
}
.sidebar-toggle:hover {
  color: var(--pico-primary);
  border-color: var(--pico-primary);
}
.sidebar-toggle-icon {
  display: inline-block;
  transition: transform .2s;
}
body.sidebar-collapsed .sidebar-toggle-icon {
  transform: rotate(180deg);
}
@media (max-width: 900px) {
  /* Mobile: sidebar already stacks below article (см. .layout @media 900px),
     collapse-toggle бесполезен и съедает место. */
  .sidebar-toggle { display: none; }
}

/* Collapsed state — sidebar hides, content takes full width */
body.sidebar-collapsed .layout {
  grid-template-columns: minmax(0, 1fr) !important;
}
body.sidebar-collapsed .sidebar {
  display: none;
}

/* === Home services preview === */
.home-services {
  margin: 3rem 0 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--pico-muted-border-color);
}
.home-services-title {
  margin-bottom: 1rem;
  font-size: 1.4rem;
}
.home-services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}
.home-service-card {
  display: block;
  padding: 1.1rem 1.2rem;
  border: 1px solid var(--pico-muted-border-color);
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
  transition: border-color .15s, transform .15s;
}
.home-service-card:hover {
  border-color: var(--pico-primary);
  transform: translateY(-2px);
}
.home-service-card h3 {
  margin: 0 0 .35rem;
  font-size: 1.05rem;
  color: var(--pico-primary);
}
.home-service-card p {
  margin: 0;
  font-size: .9rem;
  color: var(--pico-muted-color);
}
.home-services-cases {
  margin-top: 1.25rem;
  text-align: right;
  font-size: .95rem;
}

/* === Footer CTA banner === */
.footer-cta {
  margin: 3rem 0 1.5rem;
  padding: 1.75rem 1.5rem;
  background: linear-gradient(135deg, #f0f7ff 0%, #e6f0ff 100%);
  border: 1px solid #c7dbff;
  border-radius: 12px;
}
.footer-cta-inner {
  max-width: 720px;
  margin: 0 auto;
  text-align: center;
}
.footer-cta-title {
  margin: 0 0 .5rem;
  font-size: 1.4rem;
}
.footer-cta-text {
  margin: 0 0 1rem;
  color: #1e3a5f;
  font-size: .98rem;
}
.footer-cta-actions {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  justify-content: center;
}
.footer-cta-primary,
.footer-cta-secondary {
  display: inline-block;
  padding: .65rem 1.2rem;
  border-radius: 8px;
  font-weight: 600;
  text-decoration: none;
  border: 2px solid var(--pico-primary);
  transition: filter .15s, background .15s, color .15s;
}
.footer-cta-primary {
  background: var(--pico-primary);
  color: var(--pico-primary-inverse);
}
.footer-cta-primary:hover { filter: brightness(1.1); }
.footer-cta-secondary {
  background: transparent;
  color: var(--pico-primary);
}
.footer-cta-secondary:hover {
  background: var(--pico-primary);
  color: var(--pico-primary-inverse);
}

/* Prism syntax-highlighting overrides for WCAG AA on the #f5f2f0 code-block
   background. Default Prism palette uses light pastels (#999 punctuation,
   #9a6e3a operator, #dd4a68 function, #e90 variable/regex) that all fail
   4.5:1 contrast — flagged by Lighthouse. The replacements below keep the
   semantic role of each color (gray for comments, purple for numbers, green
   for strings, etc.) but darkened to pass AA. */
.token.cdata,
.token.comment,
.token.doctype,
.token.prolog { color: #5a6e80; }
.token.punctuation { color: #595959; }
.token.boolean,
.token.constant,
.token.deleted,
.token.number,
.token.property,
.token.symbol,
.token.tag { color: #6a0440; }
.token.attr-name,
.token.builtin,
.token.char,
.token.inserted,
.token.selector,
.token.string { color: #486800; }
.language-css .token.string,
.style .token.string,
.token.entity,
.token.operator,
.token.url { color: #7a4f1e; }
.token.atrule,
.token.attr-value,
.token.keyword { color: #006699; }
.token.class-name,
.token.function { color: #b91d50; }
.token.important,
.token.regex,
.token.variable { color: #a35900; }
