/* ★ "ON THIS PAGE" FOR EVERY GUIDE (Pete, 27 Nov 2026: "a little narrow… the
   guides", then, of the rail: "really nice… could it also be on mobile too…
   like a bottom sheet"). Written into each guide by scripts/guide-toc.mjs.
   Wide screens: a rail on the left that stays in view, the section being read
   marked; prose keeps its measure; tables, the steps and the box run wider.
   Narrow screens: a bar at the foot naming the section, opening a sheet of every
   section. Without the script the list simply sits above the article. */
.guide-nav .gn-bar{display:none}
.wrap .guide-nav .gn-tag{font-family:var(--sans);font-size:12px;font-weight:500;color:var(--ink);margin:0 0 12px}
.wrap .guide-nav ol{list-style:none;margin:0;padding:0;max-width:none;border-left:1px solid var(--rule-2)}
.wrap .guide-nav li{margin:0}
.wrap .guide-nav ol a{display:block;padding:6px 0 6px 14px;margin-left:-1px;border-left:1px solid transparent;font-family:var(--sans);font-size:13px;line-height:1.4;color:var(--mute);text-decoration:none}
.wrap .guide-nav ol a:hover{color:var(--ink)}
.wrap .guide-nav ol a.on{color:var(--ink);border-left-color:var(--ink)}
.guide-grid > .guide h2[id]{scroll-margin-top:24px}

@media (min-width:1180px){
  .guide-grid{display:grid;grid-template-columns:200px minmax(0,1fr);gap:0 56px;align-items:start}
  .guide-grid > .guide{max-width:1000px;width:100%;margin:0}
  .guide-nav{position:sticky;top:28px;margin-top:clamp(1.6rem,4vw,2.4rem);padding-top:3px;max-height:calc(100vh - 56px);overflow:auto}
}

@media (max-width:1179px){
  /* No script: the list sits above the article, as a plain contents box. */
  .guide-nav .gn-sheet{border:1px solid var(--rule);background:var(--sheet);padding:16px 18px;margin:24px 0 0}
  /* With the script: a bar at the foot, and a sheet that rises from it. */
  .gn-js .guide-nav{position:fixed;left:12px;right:12px;bottom:calc(12px + env(safe-area-inset-bottom));z-index:40;pointer-events:none;display:flex;flex-direction:column-reverse}
  .gn-js .guide-nav .gn-bar{display:flex;align-items:center;gap:10px;width:100%;min-height:48px;padding:10px 16px;border:1px solid var(--rule-2);border-radius:999px;background:var(--sheet);color:var(--ink);font-family:var(--sans);font-size:14px;text-align:left;cursor:pointer;box-shadow:0 6px 24px rgba(0,0,0,.28);pointer-events:auto;transform:translateY(calc(100% + 24px));transition:transform .22s ease}
  .gn-js .guide-nav.show .gn-bar,.gn-js .guide-nav.open .gn-bar{transform:none}
  .gn-js .guide-nav .gn-bar .gn-tag{margin:0;flex:none;color:var(--mute);font-size:12px}
  .gn-js .guide-nav .gn-cur{flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  .gn-js .guide-nav .gn-bar svg{flex:none;transition:transform .2s ease}
  .gn-js .guide-nav.open .gn-bar svg{transform:rotate(180deg)}
  .gn-js .guide-nav .gn-sheet{display:none;margin:0 0 8px;max-height:min(65vh,520px);overflow:auto;border:1px solid var(--rule-2);border-radius:14px;box-shadow:0 10px 36px rgba(0,0,0,.35);pointer-events:auto}
  .gn-js .guide-nav.open .gn-sheet{display:block}
  .gn-js .guide-nav .gn-sheet ol a{font-size:15px;padding:10px 0 10px 14px}
  .gn-js .gn-veil{position:fixed;inset:0;z-index:39;background:rgba(0,0,0,.35)}
  .gn-js .gn-veil[hidden]{display:none}
}
@media (prefers-reduced-motion:reduce){.gn-js .guide-nav .gn-bar,.gn-js .guide-nav .gn-bar svg{transition:none}}

/* ★ TABLES AS CARDS ON A PHONE (Pete, 27 Nov 2026: the four-column tables were
   cramped, a word or two a line with the last column scrolling off). Each row
   becomes a card: the first cell is its title, the rest are labelled with their
   column's heading (data-label, written by scripts/guide-toc.mjs). Numbers sit
   on one line beside their label. */
@media (max-width:640px){
  .guide table.figs thead{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
  .guide table.figs,.guide table.figs tbody,.guide table.figs tr,.guide table.figs td{display:block;width:auto}
  .guide table.figs tr{border:1px solid var(--rule);background:var(--sheet);padding:12px 14px;margin:0 0 10px}
  .guide table.figs td{border:0;padding:3px 0;text-align:left;white-space:normal}
  .guide table.figs td:first-child{font-weight:500;color:var(--ink);padding-bottom:6px}
  .guide table.figs td:empty{display:none}
  .guide table.figs td[data-label]:not(:first-child)::before{content:attr(data-label);display:block;font-family:var(--sans);font-size:12px;color:var(--mute);margin-bottom:1px}
  .guide table.figs td.n:not(:first-child){display:flex;justify-content:space-between;gap:12px}
  .guide table.figs td.n:not(:first-child)::before{display:inline;margin:0}
  .guide .tablewrap{overflow:visible}
}
