/* Zalosim documentation layout. Builds on the Codebox Global system (tokens, base, components)
   without changing it: ink, paper and white, solid colours, pill buttons, 16px panels.
   Pages are generated by site/docs-src/build.py. */

.brand__mark--zalosim svg { width: 100%; height: 100%; }
.page-docs { background: var(--white); }
.page-docs .site-header:not(.is-menu-open) { background: var(--white); }
.page-docs .site-header { border-bottom-color: var(--line); }
/* The Docs link sits in the bar only where it fits beside the centred mark; the menu always lists it. */

/* ---- Frame: sidebar, then the article ---- */
.docs {
  display: grid; grid-template-columns: minmax(0, 1fr);
  max-width: var(--max); margin-inline: auto;
  padding: var(--header-h) var(--gutter) 0;
}
@media (min-width: 1000px) {
  .docs { grid-template-columns: 264px minmax(0, 1fr); column-gap: clamp(32px, 4vw, 72px); }
}

/* ---- Sidebar ---- */
.docs-side { min-width: 0; }
.docs-side__bar { display: flex; align-items: center; gap: 12px; padding-block: 14px; border-bottom: 1px solid var(--line); }
.docs-side__toggle {
  display: inline-flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 16px;
  border-radius: var(--pill); background: var(--paper); font-weight: 500; font-size: var(--fs-sm);
}
.docs-side__toggle .icon { width: 16px; height: 16px; transition: transform var(--t); }
.docs-side__toggle[aria-expanded='true'] .icon { transform: rotate(180deg); }
.docs-side__here { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--mute); font-size: var(--fs-sm); }
.docs-side__panel { padding-block: 16px 24px; border-bottom: 1px solid var(--line); }
.js .docs-side__panel { display: none; }
.js .docs-side.is-open .docs-side__panel { display: block; }
@media (min-width: 1000px) {
  .docs-side__bar { display: none; }
  .js .docs-side__panel, .docs-side__panel {
    display: block; position: sticky; top: var(--header-h);
    max-height: calc(100svh - var(--header-h)); overflow-y: auto; overscroll-behavior: contain;
    padding-block: 32px 48px; border-bottom: 0;
  }
}
.docs-nav__group + .docs-nav__group { margin-top: 22px; }
.docs-nav__heading { margin-bottom: 6px; padding-inline: 12px; font-size: var(--fs-xs); font-weight: 500; color: var(--mute); }
.docs-nav__list { display: grid; gap: 1px; }
.docs-nav__list a {
  display: block; padding: 6px 12px; border-radius: var(--r-sm);
  font-size: var(--fs-sm); line-height: 1.35; color: var(--ink); transition: background-color var(--t);
}
.docs-nav__list a:hover { background: var(--paper); }
.docs-nav__list a[aria-current='page'] { background: var(--paper-2); font-weight: 600; }
.docs-nav__list .docs-nav__sub a { padding-left: 24px; color: var(--mute); }
.docs-nav__list .docs-nav__sub a[aria-current='page'] { color: var(--ink); }

/* ---- Search ---- */
.docs-search { position: relative; margin-bottom: 22px; }
.docs-search__label { display: block; margin-bottom: 6px; padding-inline: 12px; font-size: var(--fs-xs); font-weight: 500; color: var(--mute); }
.docs-search__input {
  width: 100%; min-height: 44px; padding: 8px 14px; border: 1px solid var(--line-field); border-radius: var(--r-sm);
  background: var(--white); font-size: var(--fs-sm);
}
.docs-search__input::placeholder { color: var(--mute); }
.docs-search__input:focus { outline: 2px solid var(--ink); outline-offset: 0; }
.docs-search__results {
  margin-top: 8px; padding: 6px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--white);
  max-height: 60svh; overflow-y: auto;
}
.docs-search__results a { display: block; padding: 8px 10px; border-radius: 8px; font-size: var(--fs-sm); line-height: 1.3; }
.docs-search__results a small { display: block; margin-top: 2px; color: var(--mute); font-size: var(--fs-xs); }
.docs-search__results a:hover, .docs-search__results a.is-active { background: var(--paper); }
.docs-search__empty { padding: 8px 10px; color: var(--mute); font-size: var(--fs-sm); }

/* ---- Article ---- */
.docs-main { min-width: 0; padding-block: clamp(28px, 4vw, 56px) clamp(64px, 8vw, 120px); }
@media (min-width: 1320px) {
  .docs-main { display: grid; grid-template-columns: minmax(0, 72ch) 220px; column-gap: clamp(40px, 4vw, 80px); align-items: start; }
  .docs-main > * { grid-column: 1; }
  .docs-main > .docs-toc { grid-column: 2; grid-row: 1 / span 4; position: sticky; top: calc(var(--header-h) + 32px); }
}
.docs-head, .docs-body, .docs-pager, .docs-toc { max-width: 72ch; }
.docs-crumb { margin-bottom: 14px; font-size: var(--fs-sm); color: var(--mute); }
.docs-crumb a { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line-field); }
.docs-crumb a:hover { color: var(--ink); }
.docs-title { font-size: clamp(2rem, 4vw, 3rem); font-weight: 500; letter-spacing: -0.035em; line-height: 1.05; }
.docs-lede { margin-top: 16px; font-size: var(--fs-lede); line-height: 1.4; letter-spacing: -0.012em; color: var(--mute); text-wrap: pretty; }

/* On this page */
.docs-toc { margin-top: 28px; padding: 16px 20px; border: 1px solid var(--line); border-radius: var(--r); }
.docs-toc__heading { margin-bottom: 8px; font-size: var(--fs-xs); font-weight: 500; color: var(--mute); }
.docs-toc ol { display: grid; gap: 4px; }
.docs-toc a { font-size: var(--fs-sm); line-height: 1.35; color: var(--ink); }
.docs-toc a:hover { text-decoration: underline; text-underline-offset: 3px; }
@media (min-width: 1320px) { .docs-toc { margin-top: 0; padding: 0; border: 0; border-radius: 0; } .docs-toc a { color: var(--mute); } .docs-toc a:hover, .docs-toc a.is-here { color: var(--ink); } }

/* Body copy */
.docs-body { margin-top: clamp(28px, 3vw, 40px); }
.docs-body > * + * { margin-top: 18px; }
.docs-body h2 { margin-top: clamp(44px, 5vw, 64px); padding-top: 4px; font-size: clamp(1.5rem, 2.2vw, 1.875rem); font-weight: 500; letter-spacing: -0.03em; line-height: 1.15; scroll-margin-top: calc(var(--header-h) + 20px); }
.docs-body h3 { margin-top: 36px; font-size: 1.1875rem; font-weight: 600; letter-spacing: -0.015em; line-height: 1.3; scroll-margin-top: calc(var(--header-h) + 20px); }
.docs-body h4 { margin-top: 26px; font-size: var(--fs-body); font-weight: 600; }
.docs-body h2 + *, .docs-body h3 + *, .docs-body h4 + * { margin-top: 10px; }
.docs-body > :first-child { margin-top: 0; }
.docs-body p, .docs-body li { text-wrap: pretty; }
.docs-body a:not(.btn) { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.docs-body a:not(.btn):hover { text-decoration-thickness: 2px; }
.docs-body strong { font-weight: 600; }
.docs-body ul { display: grid; gap: 6px; padding-left: 1.2em; list-style: disc; }
.docs-body ul ul { margin-top: 6px; list-style: circle; }
.docs-body ol:not(.steps) { display: grid; gap: 6px; padding-left: 1.4em; list-style: decimal; }
.docs-body li::marker { color: var(--mute); }
.docs-body code { font-family: var(--font-code); font-size: 0.875em; padding: 1px 5px; border-radius: 5px; background: var(--paper); overflow-wrap: anywhere; }
.docs-body .ui { font-weight: 600; } /* a button or label in the app */

/* Numbered procedures */
.steps { counter-reset: step; display: grid; gap: 14px; }
.steps > li { counter-increment: step; position: relative; padding-left: 44px; min-height: 28px; }
.steps > li::before {
  content: counter(step); position: absolute; left: 0; top: 0; width: 28px; height: 28px; border-radius: 50%;
  background: var(--ink); color: var(--white); font-size: var(--fs-xs); font-weight: 600; display: grid; place-items: center;
}
.steps > li > ul { margin-top: 8px; }
.steps .check { display: block; margin-top: 6px; font-size: var(--fs-sm); color: var(--mute); }

/* Keys */
kbd {
  display: inline-block; min-width: 1.6em; padding: 1px 7px; border: 1px solid var(--line-field); border-bottom-width: 2px;
  border-radius: 6px; background: var(--white); font-family: var(--font); font-size: 0.8125rem; font-weight: 600;
  line-height: 1.5; text-align: center; white-space: nowrap;
}
.keys { white-space: nowrap; }

/* Tables: scroll inside their own box on narrow screens */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: var(--r-sm); }
.docs-body table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); line-height: 1.45; }
.docs-body th, .docs-body td { padding: 10px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.docs-body thead th { background: var(--paper); font-weight: 600; white-space: nowrap; }
.docs-body tbody tr:last-child > * { border-bottom: 0; }
.docs-body td.num, .docs-body th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.docs-body table.wide { min-width: 640px; }
.docs-body td.keys { width: 40%; }

/* Notes */
.note { padding: 16px 20px; border-radius: var(--r); background: var(--paper); }
.note > * + * { margin-top: 8px; }
.note__title { font-weight: 600; }

/* Screenshots: whole, square corners, hairline border */
.shot { margin-block: 28px; }
.shot img { width: 100%; height: auto; object-fit: contain; border: 1px solid var(--line); border-radius: 0; background: var(--white); }
.shot figcaption { margin-top: 10px; font-size: var(--fs-sm); color: var(--mute); }
.shots { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 20px; margin-block: 28px; }
.shots .shot { margin: 0; }
.shot--phone { max-width: 300px; }
.shots .shot--phone { max-width: none; }

/* Link cards (index pages) */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 14px; }
.card { display: grid; gap: 6px; align-content: start; padding: 20px; border: 1px solid var(--line); border-radius: var(--r); transition: background-color var(--t), border-color var(--t); text-decoration: none !important; }
.card:hover { background: var(--paper); border-color: var(--paper-2); }
.card__title { font-weight: 600; letter-spacing: -0.01em; }
.card__text { font-size: var(--fs-sm); color: var(--mute); line-height: 1.45; }
.card__meta { font-size: var(--fs-xs); color: var(--mute); }
.docs-body .btns { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }

/* Definition rows for results */
.results { display: grid; gap: 0; border-top: 1px solid var(--line); }
.results div { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px; padding-block: 10px; border-bottom: 1px solid var(--line); font-size: var(--fs-sm); }
.results dt { color: var(--mute); }
.results dd { font-weight: 600; font-variant-numeric: tabular-nums; }

/* Previous / next */
.docs-pager { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: clamp(56px, 6vw, 88px); }
.docs-pager a { display: grid; gap: 4px; padding: 16px 20px; border: 1px solid var(--line); border-radius: var(--r); transition: background-color var(--t); }
.docs-pager a:hover { background: var(--paper); }
.docs-pager small { font-size: var(--fs-xs); color: var(--mute); }
.docs-pager span { font-weight: 600; line-height: 1.3; }
.docs-pager .next { grid-column: 2; text-align: right; }
@media (max-width: 519px) { .docs-pager { grid-template-columns: minmax(0, 1fr); } .docs-pager .next { grid-column: 1; } }

/* Logo on the left, nav centred, actions right (Codebox centres the mark). */
@media (min-width: 1180px) {
  .site-header__inner { grid-template-columns: auto minmax(0, 1fr) auto; }
  .site-header__inner > .brand { grid-column: 1; }
  .site-nav { grid-column: 2; justify-self: center; }
  .site-header__actions { grid-column: 3; }
}
