/* ==========================================================================
   guide.css (v2): the guide's contents rail and the few text objects only the
   guide needs, re-set in the night world. legacy.php keeps this sheet beside
   night.css, shell.css and pages.css; it shadows the live copy on v2.

   Unlayered on purpose: a layered rule loses to every plain rule in night.css.
   ========================================================================== */

/* ------------------------------------------------------------------------
   The shell. One column on a phone with the contents collapsed at the top,
   two columns from 60rem with the contents pinned beside the text.
   ------------------------------------------------------------------------ */
main .guide-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2rem;
  align-items: start;
  padding-block: 0 var(--space-section);
}
@media (min-width: 60rem) {
  main .guide-shell { grid-template-columns: 14rem minmax(0, 1fr); gap: clamp(2.5rem, 5vw, 4.5rem); }
}

/* Sixteen sections at the site's full rhythm is several screens of empty
   ground, so the guide runs at its own tighter rhythm with a hairline between. */
main .guide-main { min-width: 0; }
main .guide-main > .section { padding-block: clamp(2.5rem, 5vw, 4rem); margin-inline: 0; border: 0; background: none; }
main .guide-main > .section:first-child { padding-block-start: 0; }
main .guide-main > .section + .section { border-top: 1px solid var(--hair); }
main .guide-main > .section.band { background: none; border-block: 0; border-top: 1px solid var(--hair); }
main .guide-main > .section:first-child.band { border-top: 0; }
main .guide-main > .section.tools-section { padding-block: 0 clamp(2.5rem, 5vw, 4rem); border-top: 0; }

/* Everything past the first section is left unrendered until it comes near
   the viewport; the script lays the whole guide out while a jump is in flight. */
main .guide-main > .section:not(:first-child) { content-visibility: auto; contain-intrinsic-size: auto 1800px; }
main .guide-main.is-jumping > .section { content-visibility: visible; }

/* Every heading is a jump target under a sticky bar. */
main .guide-main :is(h2, h3, h4)[id],
main .guide-main > .section[id] { scroll-margin-top: calc(var(--bar-height) + 1.25rem); }

main .guide-main > .section > :is(h2, .lede) { max-width: var(--measure); }
main .guide-main > .section > .lede { margin-top: 1rem; }
main .guide-main > .section > h2 + .fold { margin-top: 0; }
main .guide-main > .section > .fold > .lede:first-of-type { margin-top: 1rem; }
main .guide-main h3 { margin-top: clamp(2rem, 3.5vw, 3rem); }
main .guide-main .row > h3, main .guide-main .row > h4 { margin-top: 0; }
@media (max-width: 59.999rem) { main .guide-main > .section { padding-block: 1.5rem; } main .guide-main > .section:first-child { padding-top: 0; } }
main .guide-main h4 { margin-top: 1.5rem; margin-bottom: 0.5rem; }
main .guide-main :is(ol, ul):not(.list-plain):not(.rows):not(.shots):not(.rel-list):not(.tool-strip) { margin-top: 1rem; padding-left: 1.3rem; max-width: var(--measure); color: var(--mute); }
main .guide-main :is(ol, ul):not(.rows) li + li { margin-top: 0.4em; }
main .guide-main .guide-steps { margin-top: clamp(1.75rem, 3vw, 2.5rem); }
main .guide-main .section-note + .callout { margin-top: 1.5rem; }
main .guide-main .fold > .prose + .shots, main .guide-main .fold > .callout + .shots, main .guide-main .fold > .shots + h3 { margin-top: clamp(1.75rem, 3vw, 2.5rem); }

/* ------------------------------------------------------------------------
   The anchor beside a heading, built by the page script. Invisible until the
   heading is hovered or the link itself is focused.
   ------------------------------------------------------------------------ */
main .guide-anchor { margin-left: 0.75rem; font-family: var(--font-mono); font-size: 0.7em; color: var(--lum); text-decoration: none; opacity: 0; transition: opacity var(--dur-fast) var(--ease); }
main :is(h2, h3):hover > .guide-anchor, main .guide-anchor:focus-visible { opacity: 1; }
.guide-live { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* A code block and its copy key. */
main .guide-code { position: relative; margin-top: 1.5rem; }
main .guide-code pre { margin: 0; padding: 1rem 5.5rem 1rem 1.25rem; white-space: pre; overflow-x: auto; font-size: var(--size-sm); }
main .guide-copy { position: absolute; top: 0.6rem; right: 0.6rem; min-height: 2.25rem; padding: 0.35rem 0.7rem; background: var(--ink-800); border: 1px solid var(--hair-strong); border-radius: var(--radius-sm); color: var(--mute); font: 500 var(--size-xs) / 1.2 var(--font-body); letter-spacing: 0.04em; cursor: pointer; }
main .guide-copy:hover { color: var(--lum); border-color: var(--lum); }

/* ------------------------------------------------------------------------
   The contents rail, desktop form: a hairline list, the current section lit.
   ------------------------------------------------------------------------ */
main .guide-toc { display: none; }
@media (min-width: 60rem) {
  main .guide-toc { display: block; position: sticky; top: calc(var(--bar-height) + 1.5rem); max-height: calc(100vh - var(--bar-height) - 3rem); overflow-y: auto; scrollbar-width: thin; }
}
main .guide-toc-title { display: block; margin: 0 0 0.75rem; padding: 0; border: 0; background: none; box-shadow: none; white-space: normal; font: 500 var(--size-xs) / 1.4 var(--font-body); letter-spacing: 0.08em; text-transform: uppercase; color: var(--quiet); }
main .guide-toc ol { list-style: none; margin: 0; padding: 0; counter-reset: toc; border-top: 1px solid var(--hair); }
main .guide-toc li { margin: 0; max-width: none; counter-increment: toc; border-bottom: 1px solid var(--hair); }
main .guide-toc a { display: flex; gap: 0.75rem; align-items: baseline; min-height: 2.75rem; padding: 0.55rem 0.5rem 0.55rem 0.75rem; border-left: 1px solid transparent; font-size: var(--size-sm); line-height: 1.35; color: var(--mute); text-decoration: none; transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease); }
main .guide-toc a::before { content: counter(toc, decimal-leading-zero); flex: none; font: 400 var(--size-xs) / 1.6 var(--font-mono); color: var(--quiet); }
main .guide-toc a:hover { color: var(--text); border-left-color: var(--hair-strong); }
/* Set by the observer in the page. Colour alone would not survive a reader
   who cannot distinguish it, so the rule lights with it. */
main .guide-toc a[aria-current="location"] { color: var(--lum); border-left-color: var(--wake); text-shadow: 0 0 12px var(--lum-faint); }
main .guide-toc a[aria-current="location"]::before { color: var(--lum); }

/* ------------------------------------------------------------------------
   The contents rail, phone form: a native disclosure, one line when closed.
   ------------------------------------------------------------------------ */
main .guide-toc-phone { position: static; max-height: 40dvh; overflow-y: auto; overscroll-behavior: contain; margin: 0; padding: 0 1.25rem; background: var(--ink-700); border: 1px solid var(--hair); border-radius: var(--radius-card); }
@media (min-width: 60rem) { main .guide-toc-phone { display: none; } }
main .guide-toc-phone > summary { padding: 0.9rem 0; font: 500 var(--size-sm) / 1.3 var(--font-body); color: var(--lum); }
main .guide-toc-phone ol { list-style: none; margin: 0; padding: 0.25rem 0 0.75rem; columns: 2; column-gap: 1rem; }
main .guide-toc-phone li { margin: 0; max-width: none; break-inside: avoid; }
main .guide-toc-phone a { display: flex; min-height: 44px; align-items: center; font-size: var(--size-sm); color: var(--mute); text-decoration: none; }
main .guide-toc-phone a:hover { color: var(--lum); }
@media (max-width: 24rem) { main .guide-toc-phone ol { columns: 1; } }

/* ------------------------------------------------------------------------
   An inline chip for a literal the reader types or taps.
   ------------------------------------------------------------------------ */
main .guide-key { display: inline-block; font-family: var(--font-mono); font-size: 0.85em; line-height: 1.5; padding: 0.1em 0.5em; white-space: nowrap; color: var(--text); background: var(--ink-800); border: 1px solid var(--hair-strong); border-radius: var(--radius-xs); box-shadow: none; text-shadow: none; }
main .guide-keys { display: inline-flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.5rem; }

/* ------------------------------------------------------------------------
   Cause and fix: the troubleshooting list, the cause as the term.
   ------------------------------------------------------------------------ */
main .guide-dl { margin: 1.5rem 0 0; max-width: var(--measure); }
main .guide-dl dt { margin-top: 1.5rem; font: 500 var(--size-base) / 1.4 var(--font-body); color: var(--text); }
main .guide-dl dt:first-child { margin-top: 0; }
main .guide-dl dt::before { content: ""; display: inline-block; width: 0.9rem; height: 1px; margin: 0 0.6rem 0.3em 0; vertical-align: middle; background: var(--wake); box-shadow: 0 0 8px var(--lum-soft); }
main .guide-dl dd { margin: 0.4rem 0 0; color: var(--mute); font-size: var(--size-sm); line-height: 1.6; }

/* The version and date stamp under the page heading. */
main .guide-stamp { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; margin-top: 1.5rem; font: 400 var(--size-xs) / 1.6 var(--font-mono); color: var(--quiet); }
main .guide-stamp b { color: var(--mute); font-weight: 400; }

/* A step's own duration, set above its heading in the quick start. */
main .guide-time { display: block; margin: 0 0 0.35rem; font: 400 var(--size-xs) / 1.6 var(--font-mono); letter-spacing: 0.04em; color: var(--quiet); }
main .guide-time b { font-weight: 500; color: var(--lum); }

@media (prefers-reduced-motion: reduce) {
  main .guide-anchor, main .guide-toc a { transition: none; }
}
