/* The user guide and the docs: the reading layout, on Meridian's tokens (assets/meridian/styles.css) and the site's
   own layer (assets/site.css). Every colour and space is a Meridian token, so both themes come for free. */

.g-wrap { width: 100%; max-width: var(--container-max); margin-inline: auto; padding-inline: var(--space-6); }
.g-main { padding-block: var(--space-10) var(--space-20); }
.g-main:focus { outline: none; }
.g-grid { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: var(--space-10); align-items: start; }
.g-label { font-size: var(--text-sm); font-weight: var(--weight-semibold); color: var(--text-primary); }
.g-small { font-size: var(--text-sm); }
.g-muted { color: var(--text-secondary); }

/* the list of every page, at the left; on a narrow screen it folds above the article */
.g-side { position: sticky; top: calc(var(--site-header-h) + var(--space-5)); max-height: calc(100vh - var(--site-header-h) - var(--space-6));
  overflow-y: auto; font-size: var(--text-sm); }
.g-side summary { display: none; }
.g-side ul { display: grid; gap: 2px; margin: 0 0 var(--space-4); padding: 0; list-style: none; }
.g-side a { display: block; padding: var(--space-1) var(--space-2); margin-left: calc(-1 * var(--space-2)); border-radius: var(--radius-sm); color: var(--text-secondary); }
.g-side a:hover { color: var(--text-primary); background: var(--surface-sunken); }
.g-side a[aria-current="page"] { color: var(--text-primary); background: var(--surface-sunken); font-weight: var(--weight-medium); box-shadow: inset 2px 0 0 var(--text-link); }
.g-side__group { margin: 0 0 var(--space-2); }
.g-side__home { margin-bottom: var(--space-4); }

.g-article { max-width: 720px; min-width: 0; }
/* breadcrumb: Docs > Apps > Page, a list that wraps on a narrow screen; the last step is the page and not a link */
.g-crumbs { margin-bottom: var(--space-3); font-size: var(--text-sm); color: var(--text-secondary); }
.g-crumbs ol { display: flex; flex-wrap: wrap; align-items: center; gap: 0 var(--space-2); margin: 0; padding: 0; list-style: none; }
.g-crumbs li { min-width: 0; overflow-wrap: anywhere; }
.g-crumbs li:not(:last-child)::after { content: "\203A"; content: "\203A" / ""; margin-left: var(--space-2); }
.g-crumbs a { display: inline-block; padding-block: var(--space-1); color: var(--text-primary); text-decoration: underline; text-underline-offset: 2px; }
.g-crumbs a:hover { text-decoration-thickness: 2px; }
.g-crumbs [aria-current="page"] { padding-block: var(--space-1); color: var(--text-primary); font-weight: var(--weight-medium); }
.g-status a, .g-path a { color: var(--text-primary); text-decoration: underline; text-underline-offset: 2px; }
.g-article h1 { font-size: clamp(var(--text-4xl), 2vw + 1.4rem, var(--text-5xl)); line-height: var(--leading-tight); margin-bottom: var(--space-4); }
.g-lead { font-size: var(--text-lg); line-height: var(--leading-relaxed); color: var(--text-secondary); max-width: 60ch; margin-bottom: var(--space-5); }
.g-status { font-size: var(--text-sm); color: var(--text-secondary); margin-bottom: var(--space-5); }
.g-status .g-pill { margin-right: var(--space-2); }

.g-toc { border: 1px solid var(--border-default); border-radius: var(--radius-lg); background: var(--surface-card); padding: var(--space-4) var(--space-5); margin-bottom: var(--space-6); }
.g-toc ul { display: grid; gap: var(--space-1); margin: var(--space-2) 0 0; padding: 0; list-style: none; font-size: var(--text-sm); }
.g-toc a { color: var(--text-primary); text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 3px; }
.g-toc a:hover { text-decoration-color: currentColor; }

/* the page text */
.g-body { font-size: 17px; line-height: 1.65; }
.g-body > * + * { margin-top: var(--space-4); }
.g-body h2 { font-size: clamp(var(--text-2xl), 1vw + 1.1rem, var(--text-3xl)); margin-top: var(--space-10); }
.g-body h3 { font-size: var(--text-xl); margin-top: var(--space-8); }
.g-body h2 + *, .g-body h3 + * { margin-top: var(--space-3); }
.g-body a, .g-intro a { color: var(--text-link); text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 3px; }
.g-body a:hover, .g-intro a:hover { text-decoration-color: currentColor; }
.g-body b { font-weight: var(--weight-semibold); }
.g-body code, .g-path code, .g-intro code { font-family: var(--font-mono); font-size: 0.88em; padding: 1px 5px; border-radius: var(--radius-xs);
  background: var(--surface-code); color: var(--text-code); border: 1px solid var(--border-code); overflow-wrap: anywhere; }
.g-list { padding-left: 1.4em; display: grid; gap: var(--space-2); }
.g-list--ol { list-style: decimal; }
.g-list--ul { list-style: disc; }
.g-list li::marker { color: var(--text-secondary); }
.g-note { border: 1px solid var(--accent-subtle-border); background: var(--accent-subtle); border-radius: var(--radius-lg); padding: var(--space-3) var(--space-4); }

/* "Coming": a part that is not built yet; it links to its entry on the What is coming page */
.g-pill { display: inline-block; vertical-align: 0.1em; font: var(--weight-medium) 12px/1 var(--font-sans); padding: 4px 8px; border-radius: var(--radius-full);
  color: var(--text-primary); background: var(--warning-100); border: 1px solid var(--warning-300); text-decoration: none !important; white-space: nowrap; }
[data-theme="dark"] .g-pill { color: var(--warning-on-dark); background: transparent; }
a.g-pill:hover { border-color: currentColor; }
.g-coming { border-top: 1px solid var(--border-default); padding-top: var(--space-5); }
.g-coming h2 { margin-top: 0; }

/* a screenshot; until guide/shots/NAME.png exists the page leaves it out */
.g-shot { margin-block: var(--space-5); }
.g-shot img { width: 100%; height: auto; border-radius: var(--radius-lg); border: 1px solid var(--border-default); background: var(--surface-card); }
.g-shot figcaption { margin-top: var(--space-2); font-size: var(--text-sm); color: var(--text-secondary); }

.g-pager { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); margin-top: var(--space-12); }
.g-pn { display: grid; gap: var(--space-1); padding: var(--space-4); border: 1px solid var(--border-default); border-radius: var(--radius-lg);
  background: var(--surface-card); color: var(--text-primary); font-weight: var(--weight-medium); }
.g-pn:hover { border-color: var(--border-strong); color: var(--text-primary); }
.g-pn--next { text-align: right; grid-column: 2; }
.g-path { margin-top: var(--space-6); }

/* the guide's and the docs' index */
.g-article--index { max-width: 960px; }
.g-intro { margin-bottom: var(--space-8); max-width: 64ch; display: grid; gap: var(--space-4); line-height: var(--leading-relaxed); }
.g-intro > .g-status { margin-bottom: 0; }
.g-group + .g-group { margin-top: var(--space-10); }
.g-group h2 { font-size: var(--text-2xl); margin-bottom: var(--space-4); }
.g-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--space-3); }
.g-card { display: grid; align-content: start; gap: var(--space-2); padding: var(--space-4) var(--space-5); background: var(--surface-card);
  border: 1px solid var(--border-default); border-radius: var(--radius-lg); color: var(--text-primary); }
.g-card:hover { border-color: var(--border-strong); color: var(--text-primary); }
.g-card__title { font-weight: var(--weight-semibold); }
.g-card .g-pill { justify-self: start; }

@media (max-width: 1023px) {
  .g-grid { grid-template-columns: minmax(0, 1fr); gap: var(--space-5); }
  .g-side { position: static; max-height: none; overflow: visible; }
  .g-side summary { display: list-item; font-weight: var(--weight-medium); padding: var(--space-3) var(--space-4); min-height: var(--tap-min); }
  .g-side__fold { border: 1px solid var(--border-default); border-radius: var(--radius-lg); background: var(--surface-card); }
  .g-side__fold[open] { padding-bottom: var(--space-2); }
  .g-side__fold > :not(summary) { padding-inline: var(--space-4); }
  .g-side a { margin-left: 0; padding-block: var(--space-2); }
}
@media (max-width: 639px) {
  .g-wrap { padding-inline: 18px; }
  .g-main { padding-top: var(--space-6); }
  .g-body { font-size: 16px; }
  .g-pager { grid-template-columns: 1fr; }
  .g-pn--next { grid-column: 1; }
}
