/* The examples gallery (/examples/ and /examples/<slug>/, generated by platform/scripts/docs_build.py from examples/*.md).
   Founder's mockup of 2026-10-23: image-led cards in a three-column grid, filter chips, a story page per example. */
article.ex-index, article.ex-page { padding: 28px 0 72px; }

/* index head */
.ex-head { max-width: 860px; margin: 16px 0 28px; }
.ex-eyebrow { color: var(--accent); }
article.ex-index h1 { font-size: clamp(36px, 4.6vw, 56px); line-height: 1.05; margin: 0 0 16px; text-wrap: balance; }
article.ex-index h1 em { font-style: italic; font-weight: 500; color: var(--accent); }
.ex-head .lede { font-size: 19px; margin-bottom: 0; }

/* filter chips (examples.js shows them; without it every card shows) */
.ex-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 24px; }
.ex-chips button { font: inherit; font-size: 14px; min-height: 36px; padding: 6px 16px; border-radius: 999px; border: 1px solid var(--rule); background: #fff; color: var(--ink); cursor: pointer; }
.ex-chips button:hover { border-color: var(--ink); }
.ex-chips button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.ex-none { color: var(--muted); }

/* the grid of cards */
.ex-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
.ex-card { margin: 0; }
.ex-card[hidden] { display: none; }
.ex-card > a { display: flex; flex-direction: column; height: 100%; background: #fff; border: 1px solid var(--rule); border-radius: 7px; overflow: hidden; color: var(--ink); transition: border-color .15s, transform .15s; }
.ex-card > a:hover { border-color: var(--ink-soft); transform: translateY(-2px); }
.ex-card > a:focus-visible { outline-offset: 2px; }
.ex-img { position: relative; display: block; aspect-ratio: 16 / 10; background: var(--bg-soft); }
.ex-img img { display: block; width: 100%; height: 100%; object-fit: cover; }
.ex-text { display: flex; flex-direction: column; flex: 1; padding: 12px 14px 14px; }
.ex-marks { display: flex; flex-wrap: wrap; gap: 4px 12px; list-style: none; margin: 0 0 8px; padding: 0; font-family: var(--mono); font-size: 11px; color: var(--ink); }
.ex-marks > * { display: inline-flex; align-items: center; gap: 6px; }
.ex-marks img { width: 14px; height: 14px; object-fit: contain; }
.ex-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin: 0 4px; }
.ex-title { font-family: var(--serif); font-weight: 500; font-size: 20px; line-height: 1.2; letter-spacing: -.01em; margin: 0 0 4px; font-variation-settings: "opsz" 24; }
.ex-outcome { display: block; color: var(--ink-soft); font-size: 14px; line-height: 1.45; margin: 0 0 10px; }
.ex-tags { display: flex; flex-wrap: wrap; gap: 4px; margin: 0 0 12px; }
.ex-tags span { font-size: 11.5px; color: var(--ink-soft); background: var(--bg-soft); border: 1px solid var(--rule); border-radius: 4px; padding: 1px 7px; }

/* the example page: a walkthrough in the guides' components (article.ex-page.guide2), the mockup of 2026-10-23 */
article.ex-page.guide2 { max-width: none; }
.ex-hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 40px; align-items: center; margin: 4px 0 40px; }
.ex-hero .eyebrow { color: var(--accent); margin-bottom: 14px; }
article.ex-page h1 { font-size: clamp(32px, 3.6vw, 44px); line-height: 1.08; margin: 0 0 14px; text-wrap: balance; }
.ex-hero .lede { font-size: 19px; margin-bottom: 16px; }
.ex-hero .ex-marks { font-size: 12px; margin-bottom: 12px; }
.ex-verified { font-size: 13px; color: var(--muted); margin: 0; }
.ex-hero-img { margin: 0; }
.ex-hero-img img { display: block; width: 100%; height: auto; border-radius: 7px; border: 1px solid var(--rule); background: var(--bg-soft); }
.ex-hero:has(.ex-diagram) { grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); }
.ex-diagram svg { display: block; width: 100%; height: auto; background: #fff; border: 1px solid var(--rule); border-radius: 7px; padding: 10px 8px 4px; box-sizing: border-box; }
.ex-hero-img figcaption { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
article.ex-page .g2-grid { grid-template-columns: minmax(0, 1fr) 210px; }
article.ex-page .g2-main { max-width: 820px; }
.ex-intro { margin: 0 0 40px; }
.ex-intro > h2, .ex-before > h2 { font-family: var(--serif); font-weight: 400; font-size: clamp(24px, 2.4vw, 30px); letter-spacing: -.015em; margin: 0 0 12px; }
.ex-intro p { font-size: 16.5px; line-height: 1.6; color: var(--ink-soft); max-width: 68ch; }
.ex-flow { list-style: none; margin: 24px 0 8px; padding: 0; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 24px; counter-reset: step; }
.ex-flow li { position: relative; padding: 12px 0 0; border-top: 2px solid var(--ink); counter-increment: step; }
.ex-flow li::before { content: counter(step, decimal-leading-zero); display: block; font-family: var(--mono); font-size: 11px; letter-spacing: .14em; color: var(--accent); margin-bottom: 4px; }
.ex-flow li + li::after { content: "→"; position: absolute; left: -19px; top: 22px; color: var(--accent); font-size: 15px; }
.ex-flow strong { display: block; font-family: var(--serif); font-weight: 500; font-size: 17px; line-height: 1.2; margin-bottom: 4px; }
.ex-flow span { display: block; color: var(--ink-soft); font-size: 13.5px; line-height: 1.4; }
.ex-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0 20px; margin: 28px 0 6px; }
.ex-stats > div { display: flex; flex-direction: column-reverse; justify-content: flex-end; padding: 12px 0; border-top: 1px solid var(--rule); }
.ex-stats dd { margin: 0 0 4px; font-family: var(--serif); font-size: clamp(26px, 2.6vw, 32px); line-height: 1; letter-spacing: -.02em; color: var(--ink); }
.ex-stats dt { color: var(--ink-soft); font-size: 13.5px; line-height: 1.35; }
.ex-note { font-size: 12.5px; color: var(--muted); margin: 0; }
.ex-before { margin: 0 0 48px; }
.ex-before ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.ex-before li { background: #fff; border: 1px solid var(--rule); border-radius: 7px; padding: 14px 16px; }
.ex-before strong { display: block; font-size: 15px; margin-bottom: 4px; }
.ex-before span { display: block; color: var(--ink-soft); font-size: 14px; line-height: 1.45; }
/* the steps: the guides' components, with room for screenshots and query results */
article.ex-page .g2-fig img { max-height: 440px; width: auto; max-width: 100%; margin: 0 auto; display: block; }
article.ex-page .g2-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
article.ex-page .g2-pair .g2-fig img { max-height: 420px; }
article.ex-page .g2-reply code { font-size: 12.5px; word-break: break-word; }
article.ex-page .g2-body table { border-collapse: collapse; width: 100%; font-size: 13.5px; margin: 0 0 8px; }
article.ex-page .g2-body th, article.ex-page .g2-body td { text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--rule); white-space: nowrap; }
article.ex-page .g2-body th { font-family: var(--mono); font-size: 11px; letter-spacing: .06em; color: var(--ink-soft); font-weight: 500; background: var(--bg-soft); }
article.ex-page .g2-body .num, article.ex-page .g2-body td[style*="right"] { text-align: right; font-variant-numeric: tabular-nums; }
article.ex-page .tablewrap { overflow-x: auto; margin: 0 0 6px; }
.g2-sql { margin: 18px 0 12px; border: 1px solid var(--rule); border-radius: 7px; background: var(--code); }
.g2-sql > summary { cursor: pointer; padding: 10px 14px; font-family: var(--mono); font-size: 12px; letter-spacing: .04em; color: var(--ink); }
.g2-sql > summary:hover { color: var(--accent-deep); }
.g2-sql[open] > summary { border-bottom: 1px solid var(--rule); }
.g2-sqlbar { display: flex; justify-content: flex-end; padding: 6px 10px 0; }
.g2-sql pre { margin: 0; padding: 8px 14px 14px; overflow-x: auto; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 12.5px; line-height: 1.6; background: none; color: var(--ink); }
.g2-sql .k { color: var(--accent-deep); font-weight: 600; }
.g2-sql .f { color: #6b46a3; }
.g2-sql .s { color: #2a7d4f; }
.g2-sql .n { color: #2f5d86; }
.g2-sql .c { color: var(--muted); font-style: italic; }
.ex-rail .ex-rail-links { display: flex; flex-direction: column; gap: 8px; margin: 18px 0 0; padding-top: 14px; border-top: 1px solid var(--rule); font-size: 13.5px; }
.ex-rail .ex-rail-links a { color: var(--accent-deep); }
.ex-endlinks { display: flex; justify-content: space-between; gap: 16px; margin: 48px 0 0; padding-top: 16px; border-top: 1px solid var(--rule); font-size: 14.5px; }
.ex-endlinks a { color: var(--accent-deep); }

@media (max-width: 1100px) {
  .ex-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  /* one column: each as specific as the desktop rule it undoes (.ex-hero:has(.ex-diagram) and article.ex-page .g2-grid
     outranked the collapse, so a phone kept two columns: the text 130 px wide beside the hero, then beside the hidden rail) */
  .ex-hero, .ex-hero:has(.ex-diagram) { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  article.ex-page .g2-grid { grid-template-columns: minmax(0, 1fr); }
  .ex-flow { grid-auto-flow: row; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ex-flow li + li::after { content: none; }
  .ex-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 800px) { .ex-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) {
  .ex-grid { grid-template-columns: 1fr; }
  .ex-flow { grid-template-columns: 1fr 1fr; }
  .ex-before ul, article.ex-page .g2-pair { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { .ex-card > a { transition: none; } .ex-card > a:hover { transform: none; } }

/* a live piece of an example page (the `demo` component; the elevation example's map, /assets/examples/terrain/) */
.ex-demo { margin: 22px 0 28px; border: 1px solid var(--rule); border-radius: 8px; background: #fff; overflow: hidden; }
.ex-demo-fallback { padding: 18px 20px; }
.ex-demo-fallback > :last-child { margin-bottom: 0; }
.ex-demo-poster { position: relative; padding: 56px 32px 40px; min-height: 360px; display: flex; flex-direction: column; justify-content: flex-end;
  background: linear-gradient(180deg, rgba(20, 19, 17, .05) 0%, rgba(20, 19, 17, .72) 100%), url(/assets/examples/elevation-hero.webp) center / cover; color: #fff; }
.ex-demo-poster p { margin: 0; max-width: 54ch; }
.ex-demo-kicker { font-family: var(--mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; opacity: .9; margin-bottom: 8px !important; }
.ex-demo-big { font-family: var(--serif); font-size: clamp(24px, 3vw, 32px); line-height: 1.12; letter-spacing: -.01em; margin-bottom: 10px !important; }
.ex-demo-sub { font-size: 14.5px; line-height: 1.5; opacity: .92; margin-bottom: 18px !important; }
.ex-demo-start { align-self: flex-start; font: inherit; font-weight: 600; font-size: 15px; min-height: 44px; padding: 10px 22px; border: 0; border-radius: 999px; background: var(--accent); color: #fff; cursor: pointer; }
.ex-demo-start:hover { filter: brightness(1.08); }
.ex-demo-start:disabled { opacity: .7; cursor: progress; }
.ex-demo-status { font-size: 14px; margin-top: 12px !important; min-height: 1.4em; }
.ex-demo-bar { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; padding: 12px; border-bottom: 1px solid var(--rule); background: var(--bg-soft); }
.ex-demo-presets, .ex-demo-tools { display: flex; flex-wrap: wrap; gap: 6px; }
.ex-demo-bar button { font: inherit; font-size: 13px; min-height: 34px; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--rule); background: #fff; color: var(--ink); cursor: pointer; }
.ex-demo-bar button:hover { border-color: var(--ink); }
.ex-demo-bar .ex-demo-paint, .ex-demo-bar .ex-demo-mode[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.ex-demo-map { height: 520px; background: #eef1f2; }
.ex-demo.is-busy .ex-demo-map { cursor: progress; }
.ex-demo.is-busy .ex-demo-run { opacity: .55; }
.ex-demo-panel { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); border-top: 1px solid var(--rule); }
.ex-demo-result { padding: 16px 18px 18px; min-width: 0; }
.ex-demo-ran { padding: 16px 18px 18px; border-left: 1px solid var(--rule); background: var(--bg-soft); min-width: 0; }
.ex-demo-ranhead { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.ex-demo-ranhead p, .ex-demo-label { font-family: var(--mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin: 0; }
.ex-demo-copy { font: inherit; font-size: 12px; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--rule); background: #fff; cursor: pointer; }
.ex-demo-sql { margin: 0; max-height: 150px; overflow: auto; font-size: 12px; line-height: 1.5; white-space: pre-wrap; word-break: break-all; }
.ex-demo-run { font-size: 13px; line-height: 1.5; color: var(--ink-soft); margin: 10px 0 0; }
.ex-demo-value { font-family: var(--serif); font-size: 40px; line-height: 1.05; letter-spacing: -.02em; margin: 6px 0 6px; }
.ex-demo-meta, .ex-demo-hint { font-size: 13.5px; line-height: 1.5; color: var(--ink-soft); margin: 0; overflow-wrap: anywhere; }
.ex-demo-error { color: #b42318; font-size: 14px; margin: 0; }
.ex-demo-facts { display: grid; grid-template-columns: repeat(3, auto); justify-content: start; gap: 6px 26px; margin: 8px 0 6px; }
.ex-demo-facts dt { font-size: 12px; color: var(--muted); }
.ex-demo-facts dd { margin: 0; font-family: var(--serif); font-size: 22px; letter-spacing: -.01em; white-space: nowrap; }
@media (max-width: 480px) { .ex-demo-facts { gap: 6px 16px; } .ex-demo-facts dd { font-size: 18px; } }
.ex-demo-chart { display: block; width: 100%; height: auto; margin: 6px 0 4px; touch-action: none; }
.ex-demo-chart text { font: 10.5px var(--mono, monospace); fill: var(--muted); }
.ex-demo-chart .grid { stroke: var(--rule); stroke-width: 1; }
.ex-demo-chart .area { fill: rgba(217, 69, 26, .14); }
.ex-demo-chart .stroke { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; }
.ex-demo-chart .cursor { stroke: var(--ink); stroke-width: 1; stroke-dasharray: 3 3; }
.ex-demo-chart .tip { font-weight: 600; fill: var(--ink); }
@media (max-width: 760px) {
  .ex-demo-map { height: 420px; }
  .ex-demo-panel { grid-template-columns: minmax(0, 1fr); }
  .ex-demo-ran { border-left: 0; border-top: 1px solid var(--rule); }
  .ex-demo-poster { padding: 40px 20px 28px; min-height: 320px; }
}
/* a live map in an example (examples/<slug>.md: <div class="ex-map" data-map="…">, its script in `scripts`) */
.ex-map { margin: 20px 0 28px; }
.ex-map-bar { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 10px; }
.ex-map-bar button { font: inherit; font-size: 14px; min-height: 36px; padding: 6px 16px; border-radius: 999px; border: 1px solid var(--rule); background: #fff; color: var(--ink); cursor: pointer; }
.ex-map-bar button:hover { border-color: var(--ink); }
.ex-map-bar button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.ex-map-canvas { height: 520px; border: 1px solid var(--rule); border-radius: 7px; overflow: hidden; background: var(--bg-soft); }
.ex-map-note { font-size: 14px; color: var(--muted); margin: 8px 0 4px; min-height: 1.4em; }
.ex-map-sql summary { font-size: 14px; color: var(--ink-soft); cursor: pointer; }
.ex-map-sql pre { font-size: 12.5px; }
@media (max-width: 720px) { .ex-map-canvas { height: 400px; } }
