/*
  The XML guide (/Documentation/Xml). Its rules come from the site's design
  guide (docs/WEBSITE-DESIGN-GUIDE.md, section 3), not from new choices:
  - prose at the site's reading width (.prose, 70ch; the owner kept 70 to 85
    characters, docs/WEBSITE.md "Where the site departs");
  - "let tables and visual work areas use more space": tables, code and
    diagrams are not held to the reading width;
  - spacing from the guide's scale (4, 8, 12, 16, 20, 24, 32 px), table
    cells 12 px by 16 px.
  The diagrams are inline SVG drawn with classes from here, so they take the
  theme's colours (theme.css) in every theme; no colour is written in a page.
*/

.guide-page { min-width: 0; }
.guide-page h2 { margin-top: 32px; }
.guide-page h3 { margin-top: 24px; font-size: 1.1rem; }
.guide-page p, .guide-page ul, .guide-page ol, .guide-page .callout { max-width: 70ch; }
.guide-page .local-nav { margin-bottom: 24px; }

.guide-steps { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 32px 0 8px;
    padding-top: 16px; border-top: 1px solid var(--border); }
.guide-steps a { display: block; max-width: 24rem; }
.guide-steps .next { margin-left: auto; text-align: right; }
.guide-steps small { display: block; color: var(--text-2); }

/* Code: an example to copy, scrolled within itself on a narrow screen. */
.guide-page pre { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 12px 16px;
    overflow-x: auto; font-size: .85rem; line-height: 1.5; color: var(--text); }
.guide-page :not(pre) > code { background: var(--surface-2); border: 1px solid var(--border); border-radius: 4px;
    padding: 0 4px; font-size: .9em; color: var(--text); }
.example-label { font-size: .8rem; color: var(--text-2); margin: 16px 0 4px; }

/* Tables scroll within their own labelled region; the page never does. */
.guide-table-wrap { overflow-x: auto; margin: 16px 0; }
.guide-table { border-collapse: collapse; font-size: .875rem; min-width: 32rem; }
.guide-table th, .guide-table td { border-bottom: 1px solid var(--border); padding: 12px 16px; text-align: left; vertical-align: top; }
.guide-table th:first-child, .guide-table td:first-child { padding-left: 0; }
.guide-table thead th { color: var(--heading-section); font-weight: 600; }

/* Diagrams: a figure with a caption; the drawing scrolls sideways on a
   phone rather than shrinking its labels too small to read. Its labels grow
   with the drawing, so it stops at 52rem, where they are about the page's
   own text size; wider, they would outgrow it. */
.diagram { margin: 24px 0; max-width: 52rem; }
.diagram-scroll { overflow-x: auto; }
.diagram svg { display: block; width: 100%; min-width: 34rem; height: auto; }
.diagram figcaption { color: var(--text-2); font-size: .85rem; margin-top: 8px; max-width: 70ch; }

.d-screen { fill: var(--surface-2); stroke: var(--border); stroke-width: 1.5; }
.d-parent { fill: var(--surface); stroke: var(--control-border); stroke-width: 1.5; }
.d-child { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 2; }
.d-ghost { fill: none; stroke: var(--control-border); stroke-width: 1.5; stroke-dasharray: 6 5; }
.d-wrong { fill: none; stroke: var(--error-line); stroke-width: 2; stroke-dasharray: 6 5; }
.d-point { fill: var(--accent); }
.d-point-target { fill: var(--eyebrow); }
.d-point-loser { fill: var(--surface); stroke: var(--error-line); stroke-width: 2; }
.d-line { stroke: var(--control-border); stroke-width: 1.5; fill: none; }
.d-arrow { stroke: var(--eyebrow); stroke-width: 2; fill: none; }
.d-arrowhead { fill: var(--eyebrow); }
.d-text { fill: var(--text); font-size: 14px; font-family: system-ui, -apple-system, "Segoe UI", sans-serif; }
.d-small { fill: var(--text-2); font-size: 12px; font-family: system-ui, -apple-system, "Segoe UI", sans-serif; }
.d-code { fill: var(--text); font-size: 12.5px; font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; }
.d-strong { font-weight: 600; }
.d-middle { text-anchor: middle; }
.d-end { text-anchor: end; }
/* A number on a marker dot (.d-point-target): the theme's text-on-accent colour. */
.d-badge { fill: var(--on-accent); font-size: 12px; font-weight: 700; font-family: system-ui, -apple-system, "Segoe UI", sans-serif; }

/* The five draw layers and the strata, in tones from the theme's message
   colours, so each stays readable in every theme. */
.d-layer-1 { fill: var(--surface-2); stroke: var(--control-border); stroke-width: 1.5; }
.d-layer-2 { fill: var(--info-bg); stroke: var(--info-line); stroke-width: 1.5; }
.d-layer-3 { fill: var(--success-bg); stroke: var(--success-line); stroke-width: 1.5; }
.d-layer-4 { fill: var(--warning-bg); stroke: var(--warning-line); stroke-width: 1.5; }
.d-layer-5 { fill: var(--error-bg); stroke: var(--error-line); stroke-width: 1.5; }

/* The element reference: one wide table across the whole width. */
.reference-table { width: 100%; }
.reference-element { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-weight: 600; white-space: nowrap; }
.reference-names { overflow-wrap: anywhere; }
.reference-uses { color: var(--text-2); }

/* Wide screens (the user, 2026-11-20, of the XML guide only: "the rest of it
   is fine ... its just the XML docs"): each code example and diagram sits
   beside the text that explains it. The page marks each pair as a
   .guide-row of .guide-text and .guide-aside, in whichever order reads best
   on a phone; here both start level, the text at its reading width and the
   example taking the rest. The design guide: two columns "only while both
   columns have room to read", which needs the reading column (70ch, about
   600 px) beside a diagram at its smallest (34rem) with room to spare, so
   from 1600 px; below that the page reads in one column as before. */
@media (min-width: 1600px) {
    .guide-row { display: grid; grid-template-columns: minmax(0, 70ch) minmax(0, 1fr); column-gap: 32px; align-items: start; }
    .guide-row > .guide-text { grid-column: 1; grid-row: 1; }
    .guide-row > .guide-aside { grid-column: 2; grid-row: 1; }
    .guide-aside > :first-child { margin-top: 0; }
}
