/* skemo.net/docs/: documentation layout (sidebar, article, table of contents). Fonts, colours, header, buttons and
   footer come from /brand.css (site/src/brand.css), shared with the landing page. */

.layout { display: grid; grid-template-columns: 252px minmax(0, 1fr) 210px; max-width: 1480px; margin: 0 auto; }
.top-inner { max-width: 1480px; }   /* the header spans the documentation grid */
.sidebar { position: sticky; top: 61px; align-self: start; height: calc(100vh - 61px); overflow-y: auto; padding: 28px 14px 40px 20px;
           border-right: 1px solid var(--line); }
.mobile-nav { display: none; }
.sidebar ul, .mobile-nav ul { list-style: none; margin: 0 0 22px; padding: 0; }
.sidebar li a { display: block; padding: 5px 10px; border-left: 2px solid transparent; color: var(--muted); text-decoration: none; font-size: .92rem; }
.sidebar li a:hover { color: var(--ink); }
.sidebar li a[aria-current] { border-left-color: var(--accent); color: var(--ink); font-weight: 500; background: linear-gradient(90deg, var(--accent-soft), transparent); }
.nav-section { margin: 0 0 6px; padding: 0 10px; font: 500 .7rem/1.3 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); }

main { padding: 40px 48px 72px; min-width: 0; }
article { max-width: 820px; }
article h1 { font-size: clamp(1.9rem, 3.4vw, 2.5rem); letter-spacing: -0.03em; margin: 0 0 .35em; }
article h2 { font-size: 1.4rem; margin: 2.4em 0 .6em; padding-top: 1.2em; border-top: 1px solid var(--line); }
article h3 { font-size: 1.08rem; margin: 1.6em 0 .4em; }
.anchor { color: inherit; text-decoration: none; }
.anchor:hover::after { content: " #"; color: var(--accent-ink); }
.lead { font-size: 1.12rem; color: var(--ink-2); }
article p, article li { color: var(--ink-2); }
article li { margin: .25em 0; }
article strong { color: var(--ink); }
article table { border-collapse: collapse; width: 100%; margin: 1.2em 0 1.6em; font-size: .92rem; display: block; overflow-x: auto;
                border: 1px solid var(--line); border-radius: var(--radius); }
article th, article td { text-align: left; vertical-align: top; padding: 9px 14px; border-bottom: 1px solid var(--line); }
article tr:last-child td { border-bottom: 0; }
article th { background: var(--surface-2); color: var(--muted); font-weight: 500; white-space: nowrap; font-size: .85rem; }
.note, .warn { border: 1px solid var(--line); border-left: 3px solid var(--accent); background: var(--surface); padding: 14px 18px;
               border-radius: 0 var(--radius) var(--radius) 0; margin: 1.4em 0; }
.warn { border-left-color: #C2410C; }
.note p:last-child, .warn p:last-child { margin-bottom: 0; }
.crumbs { font: .78rem/1.4 var(--mono); color: var(--muted); margin-bottom: 14px; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--ink); }
.muted { color: var(--muted); font-size: .9rem; }

pre { margin: 0; padding: 16px 18px; border-radius: 0 0 var(--radius) var(--radius); }
article > pre, li > pre { border-radius: var(--radius); margin: 1.1em 0; }
.code-block { margin: 0 0 12px; }
.code-title { background: var(--code-bg); color: var(--code-muted); font: 500 .74rem/1 var(--mono); padding: 12px 18px 2px;
              border-radius: var(--radius) var(--radius) 0 0; }

/* An example: the diagram and its source as two tabs (radio buttons, no script) */
.example { margin: 1.6em 0 2em; }
.example > input { position: absolute; opacity: 0; pointer-events: none; }
.example > label { display: inline-block; padding: 4px 12px; margin: 0 2px 10px 0; border: 1px solid var(--line); border-radius: 8px;
                   font-size: .82rem; font-weight: 500; color: var(--muted); background: var(--surface-2); cursor: pointer; }
.example > input:checked + label { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.example > input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: 2px; }
.example > .t-fig:checked ~ .p-src, .example > .t-src:checked ~ .p-fig { display: none; }
.pair, .looks .figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; margin: 1.4em 0; }
.figures { display: grid; gap: 12px; }
.figures.steps { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.diagram { margin: 0; overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; }
.diagram svg { display: block; width: 100%; height: auto; margin: 0 auto; border-radius: 6px; }
.diagram img { display: block; width: 100%; height: auto; border-radius: 6px; }
.diagram figcaption { font: .76rem/1.4 var(--mono); color: var(--muted); text-align: center; padding-top: 6px; }

/* Tiles on the documentation's home page */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; margin: 1em 0 1.6em; }
.cards a { display: block; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
           text-decoration: none; transition: border-color .15s; }
.cards a:hover { border-color: var(--accent); }
.cards strong { display: block; color: var(--ink); }
.cards span { display: block; color: var(--muted); font-size: .87rem; margin-top: 2px; }

.pager { display: flex; justify-content: space-between; gap: 16px; max-width: 820px; margin-top: 64px; }
.pager a { flex: 1; max-width: 48%; padding: 14px 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
           text-decoration: none; color: var(--ink); font-weight: 500; }
.pager a:hover { border-color: var(--accent); }
.pager .next { text-align: right; margin-left: auto; }

aside { padding: 40px 20px 0 0; }
.toc { position: sticky; top: 92px; font-size: .84rem; }
.toc p { margin: 0 0 8px; font: 500 .7rem/1.3 var(--mono); color: var(--ink-2); text-transform: uppercase; letter-spacing: .08em; }
.toc ul { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); }
.toc a { display: block; padding: 4px 0 4px 12px; color: var(--muted); text-decoration: none; }
.toc a:hover { color: var(--ink); }

@media (max-width: 1200px) { .layout { grid-template-columns: 232px minmax(0, 1fr); } aside { display: none; } }
@media (max-width: 860px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar { display: none; }
  .mobile-nav { display: block; margin: 0 0 22px; padding: 8px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
  .mobile-nav summary { cursor: pointer; font-weight: 600; padding: 4px 0; }
  .mobile-nav li a { display: block; padding: 4px 0; color: var(--ink-2); text-decoration: none; }
  .mobile-nav li a[aria-current] { color: var(--accent-ink); font-weight: 600; }
  main { padding: 24px 16px 56px; }
  .diagram svg.wide { min-width: 480px; }
  .pager a { max-width: none; }
}
