/* DevCraft Platform documentation (platform.devcraft.cz/documentation). Builds on style.css tokens. */

.container--wide { max-width: 1440px; }
body.docs { background: var(--bg); }

.doc-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr) 220px; gap: 48px; align-items: start; padding-top: 32px; padding-bottom: 72px; }

/* ---------- Sidebar ---------- */
.doc-side { position: sticky; top: calc(var(--header-h) + 24px); max-height: calc(100vh - var(--header-h) - 48px); overflow-y: auto; padding-right: 6px; }
.doc-side__toggle { display: none; }
.doc-nav__group { margin: 22px 0 6px; font-size: .72rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--text-soft); }
.doc-nav__group:first-child { margin-top: 0; }
.doc-nav ul { display: grid; gap: 1px; }
.doc-nav a { display: block; padding: 6px 12px; border-radius: var(--radius-sm); color: var(--text-muted); text-decoration: none; font-size: .92rem; line-height: 1.4; border-left: 2px solid transparent; }
.doc-nav a:hover { color: var(--text); background: var(--bg-tint); }
.doc-nav a.is-current { color: var(--emerald-700); background: var(--emerald-50); border-left-color: var(--emerald-500); font-weight: 600; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }

/* ---------- On-page table of contents ---------- */
.doc-aside { position: sticky; top: calc(var(--header-h) + 24px); max-height: calc(100vh - var(--header-h) - 48px); overflow-y: auto; }
.doc-toc__title { margin: 0 0 8px; font-size: .72rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--text-soft); }
.doc-toc ul { display: grid; gap: 2px; border-left: 1px solid var(--border); }
.doc-toc a { display: block; padding: 4px 0 4px 14px; margin-left: -1px; border-left: 2px solid transparent; color: var(--text-soft); text-decoration: none; font-size: .84rem; line-height: 1.4; }
.doc-toc a:hover { color: var(--text); }
.doc-toc a.is-active { color: var(--emerald-700); border-left-color: var(--emerald-500); }

/* ---------- Article ---------- */
.doc { max-width: 800px; min-width: 0; }
.doc .doc-crumbs { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 22px; padding: 0; list-style: none; font-size: .84rem; color: var(--text-soft); }
.doc-crumbs li + li::before { content: '/'; margin-right: 6px; color: var(--border); }
.doc-crumbs a { color: var(--text-soft); text-decoration: none; }
.doc-crumbs a:hover { color: var(--emerald-700); }
.doc h1 { font-size: clamp(2rem, 4vw, 2.6rem); margin-bottom: 10px; }
.doc-meta { font-size: .84rem; color: var(--text-soft); margin-bottom: 28px; }
.doc-lead { font-size: 1.15rem; color: var(--text-muted); line-height: 1.6; margin-bottom: 32px; }
.doc h2 { font-size: 1.6rem; margin: 56px 0 14px; padding-top: 22px; border-top: 1px solid var(--border); }
.doc h3 { font-size: 1.15rem; margin: 32px 0 10px; }
.doc h2, .doc h3 { scroll-margin-top: calc(var(--header-h) + 16px); }
.doc h2 a.anchor, .doc h3 a.anchor { margin-left: 8px; color: var(--border); text-decoration: none; font-weight: 400; opacity: 0; transition: opacity .15s; }
.doc h2:hover a.anchor, .doc h3:hover a.anchor, .doc a.anchor:focus { opacity: 1; color: var(--emerald-600); }
.doc p, .doc li, .doc dd { color: #1e293b; }
.doc a { color: var(--emerald-700); text-underline-offset: 2px; }
.doc ul, .doc ol { margin: 0 0 1.1em; padding-left: 1.4em; }
.doc ul { list-style: disc; }
.doc ol { list-style: decimal; }
.doc li { margin: .3em 0; }
.doc li > ul, .doc li > ol { margin: .3em 0; }
.doc dl { margin: 0 0 1.2em; }
.doc dt { font-weight: 650; margin-top: .8em; }
.doc dd { margin: .2em 0 0 1.2em; }
.doc :not(pre) > code { padding: .12em .38em; border-radius: 5px; background: #f1f5f9; border: 1px solid #e5eaf1; font-size: .86em; color: #0f2a44; overflow-wrap: anywhere; }

/* Code blocks */
.doc pre { position: relative; margin: 0 0 1.4em; padding: 18px 20px; border-radius: var(--radius); background: var(--navy-950); border: 1px solid var(--navy-700); overflow-x: auto; font-family: var(--mono); font-size: .86rem; line-height: 1.65; color: #dbe3ee; }
.doc pre code { font-size: inherit; background: none; border: 0; padding: 0; color: inherit; white-space: pre; }
.doc pre[data-lang]::before { content: attr(data-lang); position: absolute; top: 8px; right: 52px; font-size: .68rem; letter-spacing: .08em; text-transform: uppercase; color: var(--navy-300); }
.copy-btn { position: absolute; top: 6px; right: 8px; padding: 3px 9px; border-radius: 6px; border: 1px solid var(--navy-600); background: var(--navy-800); color: var(--navy-200); font: 600 .72rem var(--font); cursor: pointer; }
.copy-btn:hover { color: #fff; border-color: var(--emerald-500); }

/* Tables */
.table-wrap { margin: 0 0 1.4em; overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
.doc table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.doc th, .doc td { padding: 10px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); }
.doc thead th { background: var(--bg-tint); font-weight: 650; font-size: .8rem; letter-spacing: .02em; color: var(--navy-700); white-space: nowrap; }
.doc tbody tr:last-child td { border-bottom: 0; }
.doc td code { white-space: nowrap; }
.doc td .status { font-size: .7rem; padding: 1px 8px; }

/* Callouts */
.callout { margin: 0 0 1.4em; padding: 14px 18px; border-radius: var(--radius-sm); border: 1px solid; border-left-width: 4px; }
.callout p:last-child, .callout ul:last-child { margin-bottom: 0; }
.callout--note { background: #f0f7ff; border-color: #cfe2fb; border-left-color: #3b82f6; }
.callout--tip { background: var(--emerald-50); border-color: var(--emerald-100); border-left-color: var(--emerald-500); }
.callout--warn { background: var(--amber-soft); border-color: #fde68a; border-left-color: #f59e0b; }
.callout--planned { background: var(--bg-tint); border-color: var(--border); border-left-color: #94a3b8; border-style: dashed solid dashed solid; }

/* Steps */
.doc ol.steps-list { list-style: none; padding: 0; counter-reset: step; }
.doc ol.steps-list > li { position: relative; padding: 2px 0 14px 44px; margin: 0; counter-increment: step; }
.doc ol.steps-list > li::before { content: counter(step); position: absolute; left: 0; top: 0; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--emerald-50); border: 1px solid var(--emerald-100); color: var(--emerald-700); font-weight: 700; font-size: .82rem; }
.doc ol.steps-list > li::after { content: ''; position: absolute; left: 14px; top: 32px; bottom: 2px; width: 1px; background: var(--border); }
.doc ol.steps-list > li:last-child::after { display: none; }

/* Overview cards */
.doc-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin: 0 0 1.6em; padding: 0 !important; list-style: none !important; }
.doc-cards li { margin: 0; }
.doc-cards a { display: flex; flex-direction: column; gap: 4px; height: 100%; padding: 18px 20px; border-radius: var(--radius); border: 1px solid var(--border); text-decoration: none; transition: border-color .2s, box-shadow .2s, transform .2s; }
.doc-cards a:hover { border-color: var(--emerald-500); box-shadow: var(--shadow); transform: translateY(-2px); }
.doc-cards strong { color: var(--text); font-size: 1rem; }
.doc-cards span { color: var(--text-muted); font-size: .88rem; line-height: 1.5; }

/* Pager */
.doc-pager { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 64px; padding-top: 28px; border-top: 1px solid var(--border); }
.doc-pager a { display: flex; flex-direction: column; gap: 2px; padding: 14px 18px; border: 1px solid var(--border); border-radius: var(--radius); text-decoration: none; color: var(--text); font-weight: 600; }
.doc-pager a:hover { border-color: var(--emerald-500); background: var(--emerald-50); }
.doc-pager small { font-size: .76rem; font-weight: 500; color: var(--text-soft); }
.doc-pager__next { text-align: right; grid-column: 2; }

.site-footer--slim { padding: 0 0 28px; }
.site-footer--slim .footer__bottom { margin-top: 0; }

/* ---------- Responsive ---------- */
@media (max-width: 1200px) {
  .doc-layout { grid-template-columns: 230px minmax(0, 1fr); gap: 40px; }
  .doc-aside { display: none; }
}
@media (max-width: 860px) {
  .doc-layout { grid-template-columns: minmax(0, 1fr); gap: 0; padding-top: 0; }
  .doc-side { position: sticky; top: var(--header-h); z-index: 20; max-height: none; overflow: visible; margin: 0 -16px; padding: 0; background: #fff; border-bottom: 1px solid var(--border); }
  .doc-side__toggle { display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 48px; padding: 0 16px; border: 0; background: transparent; font: 600 .92rem var(--font); color: var(--text); cursor: pointer; }
  .doc-side__toggle::after { content: ''; width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); transition: transform .2s; }
  .doc-side__toggle[aria-expanded="true"]::after { transform: rotate(-135deg); }
  .js .doc-nav { display: none; }
  .doc-nav { max-height: calc(100vh - var(--header-h) - 48px); overflow-y: auto; padding: 4px 16px 18px; }
  .doc-nav.is-open { display: block; }
  .no-js .doc-side__toggle { display: none; }
  .doc { padding-top: 24px; }
  .doc-cards { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .doc h2 { font-size: 1.35rem; margin-top: 44px; }
  .doc-pager { grid-template-columns: 1fr; }
  .doc-pager__next { grid-column: 1; }
  .doc pre { margin-left: -16px; margin-right: -16px; border-radius: 0; border-left: 0; border-right: 0; }
}
