/* ==========================================================================
   EveryMark - documentation layout
   Loaded after site.css. Inherits every token from it.
   ========================================================================== */

.docs-shell {
  display: grid;
  grid-template-columns: 244px minmax(0, 1fr) 200px;
  gap: 56px;
  align-items: start;
  padding-block: 48px 96px;
}

/* ---------- Sidebar ---------- */

.docs-nav {
  position: sticky; top: 86px;
  max-height: calc(100vh - 110px);
  overflow-y: auto;
  padding-right: 8px;
}
.docs-nav h4 {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--text-3); font-weight: 500;
  margin: 26px 0 10px;
}
.docs-nav h4:first-child { margin-top: 0; }
.docs-nav ul { list-style: none; padding: 0; display: grid; gap: 1px; }
.docs-nav a {
  display: block; text-decoration: none;
  color: var(--text-2); font-size: .9rem;
  padding: .4em .7em; border-radius: 7px;
  border-left: 2px solid transparent;
  transition: color .14s ease, background .14s ease, border-color .14s ease;
}
.docs-nav a:hover { color: var(--text); background: var(--surface-2); }
.docs-nav a[aria-current="page"] {
  color: var(--text); font-weight: 500;
  background: var(--surface-2);
  border-left-color: var(--accent-line);
}

/* ---------- Article ---------- */

.docs-main { min-width: 0; }
.docs-main .breadcrumb {
  font-family: var(--mono); font-size: 11px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--text-3); margin-bottom: 16px;
}
.docs-main h1 { font-size: clamp(2rem, 4vw, 2.6rem); letter-spacing: -0.032em; }
.docs-main > .lead { margin-top: 16px; max-width: 66ch; }
.docs-main h2 {
  font-size: 1.5rem; letter-spacing: -0.024em;
  margin-top: 56px; padding-top: 28px; border-top: 1px solid var(--border);
  scroll-margin-top: 90px;
}
.docs-main h3 { font-size: 1.08rem; margin-top: 34px; scroll-margin-top: 90px; }
.docs-main p { margin-top: 14px; color: var(--text-2); max-width: 70ch; }
.docs-main ul, .docs-main ol { margin-top: 14px; padding-left: 20px; max-width: 70ch; color: var(--text-2); }
.docs-main li { margin-top: 7px; }
.docs-main li::marker { color: var(--text-3); }
.docs-main strong { color: var(--text); font-weight: 600; }
.docs-main a:not(.btn):not(.link-arrow) { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }

.docs-main code {
  font-family: var(--mono); font-size: .855em;
  background: var(--surface-2); border: 1px solid var(--border);
  padding: .12em .38em; border-radius: 4px; color: var(--text);
  white-space: nowrap;
}
.docs-main kbd {
  font-family: var(--mono); font-size: .8em; font-weight: 500;
  background: var(--surface); border: 1px solid var(--border-2);
  border-bottom-width: 2px;
  padding: .18em .45em; border-radius: 5px; color: var(--text);
  white-space: nowrap;
}

/* callouts */
.note {
  margin-top: 24px; padding: 18px 20px;
  border: 1px solid var(--border); border-left: 2px solid var(--accent-line);
  border-radius: 8px; background: var(--surface);
  max-width: 70ch;
}
.note p { margin-top: 0; color: var(--text-2); font-size: .9375rem; }
.note p + p { margin-top: 10px; }
.note .note-label {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--accent); margin-bottom: 8px;
}

/* steps
   The number is absolutely positioned rather than being a grid/flex track.
   A step's copy is normal inline content - <strong>, <code>, links, plain text -
   and each of those would become a separate grid item if this were a grid,
   scattering the sentence across the number column. Keep it in normal flow. */
.steps { list-style: none; padding: 0; margin-top: 24px; counter-reset: step; max-width: 70ch; }
.steps li {
  counter-increment: step;
  position: relative;
  padding: 16px 0 16px 42px;
  border-top: 1px solid var(--border);
  margin: 0;
  line-height: 1.6;
}
.steps li:last-child { border-bottom: 1px solid var(--border); }
.steps li::before {
  content: counter(step);
  position: absolute; left: 4px; top: 19px;
  font-family: var(--mono); font-size: 11px; color: var(--accent);
}
.steps li > :first-child { margin-top: 0; }
.steps li p { margin-top: 8px; }

/* format / field tables */
.docs-main table {
  width: 100%; border-collapse: collapse; margin-top: 22px;
  font-size: .9rem;
}
.docs-main table th, .docs-main table td {
  text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.docs-main table thead th {
  font-family: var(--mono); font-size: .72rem; letter-spacing: .1em;
  text-transform: uppercase; color: var(--text-3); font-weight: 500;
  background: var(--surface-2);
}
.docs-main table td { color: var(--text-2); }
.docs-main table td:first-child { color: var(--text); }
.docs-main .table-wrap { margin-top: 22px; }
.docs-main .table-wrap table { margin-top: 0; }

.docs-main .chips { margin-top: 16px; }

/* shortcut grid */
.keys { display: grid; gap: 0; margin-top: 22px; max-width: 70ch; }
.keys div {
  display: flex; justify-content: space-between; align-items: baseline; gap: 20px;
  padding: 12px 0; border-bottom: 1px solid var(--border);
}
.keys div:first-child { border-top: 1px solid var(--border); }
.keys .desc { color: var(--text-2); font-size: .9375rem; }

/* prev / next */
.docs-pager {
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  margin-top: 72px; padding-top: 28px; border-top: 1px solid var(--border);
}
.docs-pager a {
  text-decoration: none; display: block;
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 18px; min-width: 200px;
  transition: border-color .16s ease;
}
.docs-pager a:hover { border-color: var(--border-2); }
.docs-pager .dir {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--text-3);
}
.docs-pager .ttl { font-weight: 500; margin-top: 4px; }
.docs-pager .next { text-align: right; margin-left: auto; }

/* ---------- On-this-page ---------- */

.docs-toc { position: sticky; top: 86px; }
.docs-toc h4 {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--text-3); font-weight: 500; margin-bottom: 12px;
}
.docs-toc ul { list-style: none; padding: 0; display: grid; gap: 9px; }
.docs-toc a { text-decoration: none; color: var(--text-2); font-size: .85rem; line-height: 1.4; display: block; }
.docs-toc a:hover { color: var(--text); }

/* ---------- Docs index cards ---------- */

.doc-cards { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 16px; margin-top: 32px; }
.doc-card {
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); padding: 22px; text-decoration: none; display: block;
  transition: border-color .16s ease, box-shadow .16s ease;
}
.doc-card:hover { border-color: var(--border-2); box-shadow: var(--shadow-md); }
.doc-card .n {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--accent);
}
.doc-card h3 { margin-top: 10px; font-size: 1.05rem; }
.doc-card p { margin-top: 8px; color: var(--text-2); font-size: .9rem; }

/* ---------- Responsive ---------- */

@media (max-width: 1080px) {
  .docs-shell { grid-template-columns: 220px minmax(0,1fr); gap: 40px; }
  .docs-toc { display: none; }
}
@media (max-width: 860px) {
  .docs-shell { grid-template-columns: 1fr; gap: 0; padding-block: 32px 72px; }
  .docs-nav {
    position: static; max-height: none; overflow: visible;
    border: 1px solid var(--border); border-radius: var(--radius);
    padding: 18px; margin-bottom: 40px; background: var(--surface);
  }
  .docs-nav ul { grid-template-columns: 1fr 1fr; display: grid; }
  .doc-cards { grid-template-columns: 1fr; }
}
