/* The guide page (/guide). Built on /site.css and /pieces.css; this file only lays out the reading page.
   Contents: a sidebar beside the text from 768px up (tablet and desktop), sticky while the text scrolls.
   Below 768px the same list opens from a Contents button fixed at the bottom of the screen (a popover, so it works
   with scripts blocked). pieces.js marks the section in view and closes the popover after a tap.
   Also: numbered steps, keys, inline tags, the two tables and the app pieces set into the text. */

.g-top{padding:clamp(40px,6vw,88px) 0 clamp(32px,4vw,56px)}
.g-top .lede{margin-top:18px}

.g-layout{display:grid;grid-template-columns:minmax(0,1fr)}
@media (min-width:768px){
  .g-layout{grid-template-columns:184px minmax(0,1fr);gap:40px;justify-content:start}
}
@media (min-width:1000px){
  .g-layout{grid-template-columns:216px minmax(0,720px);gap:72px}
}

/* ---------- contents: the sidebar (768px and up) ---------- */
.toc{font-size:15px;line-height:1.3}
.toc h2{font-size:13px;font-weight:500;letter-spacing:.015em;color:var(--soft);margin-bottom:6px}
.toc ol{list-style:none;padding:0;margin:0;max-width:none}
.toc li{margin:0}
.toc a{display:flex;align-items:center;min-height:36px;padding:4px 0 4px 12px;margin-left:-12px;border-left:2px solid transparent;text-decoration:none;color:var(--soft);text-wrap:balance}
.toc a:hover,.toc a:focus-visible{color:var(--text)}
.toc a[aria-current]{color:var(--text);border-left-color:var(--text);font-weight:500}
.toc ol ol{padding-left:14px;font-size:14px}
.toc ol ol a{min-height:32px}
.toc-open{display:none}
@media (min-width:768px){
  .toc{position:sticky;top:24px;align-self:start;max-height:calc(100vh - 48px);overflow-y:auto;overscroll-behavior:contain;padding-left:12px;scrollbar-width:thin}
  .has-nav .toc{top:calc(var(--header-h) + 16px);max-height:calc(100vh - var(--header-h) - 32px)}
  /* The popover attribute is ignored here: the list is the sidebar. */
  .toc[popover]{display:block;position:sticky;inset:24px auto auto auto;width:auto;height:auto;margin:0;border:0;padding:0 0 0 12px;background:none;color:inherit;overflow-y:auto}
  .has-nav .toc[popover]{top:calc(var(--header-h) + 16px)}
}

/* ---------- contents: the button and sheet on phones (under 768px) ---------- */
@media (max-width:767px){
  .toc-open{display:flex;position:fixed;z-index:30;left:50%;bottom:calc(16px + env(safe-area-inset-bottom));transform:translateX(-50%);
    align-items:center;gap:10px;max-width:calc(100% - 32px);min-height:48px;padding:12px 20px;border:1px solid var(--line);border-radius:999px;
    background:color-mix(in srgb,var(--bg) 88%,transparent);-webkit-backdrop-filter:blur(12px);backdrop-filter:blur(12px);
    color:var(--text);font:500 15px/1.2 var(--sans);cursor:pointer;box-shadow:0 10px 30px -14px rgba(0,0,0,.45)}
  .toc-open .i{width:18px;height:18px;flex:none;fill:none;stroke:currentColor;stroke-width:1.6;stroke-linecap:round}
  .toc-open .here{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--soft)}
  .toc-open .here:empty{display:none}
  .toc[popover]{position:fixed;inset:auto 0 0 0;width:100%;max-width:none;max-height:min(78vh,640px);margin:0;padding:20px 16px calc(24px + env(safe-area-inset-bottom));
    overflow-y:auto;overscroll-behavior:contain;border:0;border-top:1px solid var(--line);background:var(--bg) var(--grain-image) repeat;background-size:var(--grain-size);color:var(--text);
    transition:transform .3s var(--ease),opacity .3s var(--ease),display .3s allow-discrete,overlay .3s allow-discrete}
  .toc[popover]:popover-open{transform:none;opacity:1}
  @starting-style{.toc[popover]:popover-open{transform:translateY(24px);opacity:0}}
  .toc[popover]::backdrop{background:rgba(17,19,25,.35)}
  .toc .toc-head{display:flex;align-items:center;justify-content:space-between;gap:16px;margin-bottom:8px}
  .toc .toc-head h2{margin:0;font-size:17px;font-weight:600;color:var(--text);letter-spacing:0}
  .toc-close{display:inline-flex;align-items:center;min-height:44px;padding:0 4px;border:0;background:none;color:var(--text);font:500 15px var(--sans);text-decoration:underline;text-underline-offset:.2em;cursor:pointer}
  .toc a{min-height:44px;font-size:17px;padding-left:12px;margin-left:0}
  .toc ol ol{font-size:16px}
  .toc ol ol a{min-height:44px}
  /* Room under the last section so the button never covers the footer links. */
  body{padding-bottom:calc(80px + env(safe-area-inset-bottom))}
}
/* Where popovers are not supported the list shows above the text as a plain list. */
@supports not selector(:popover-open){
  .toc-open,.toc-close{display:none!important}
}
@media (min-width:768px){.toc-head .toc-close{display:none}}

/* ---------- the text ---------- */
/* 62 characters of Outfit at 17px is about 28em (the shared 62ch measures the wide "0" and runs to about 90). */
.g-main{min-width:0;--measure:28em}
.g-sec{scroll-margin-top:24px}
.g-sec+.g-sec{margin-top:clamp(56px,7vw,96px);padding-top:32px;border-top:1px solid var(--line)}
.has-nav .g-sec,.has-nav .g-part,.has-nav .g-sec h3[id]{scroll-margin-top:calc(var(--header-h) + 16px)}
.g-sec>h2{margin-bottom:20px}
.g-sec>*+*:not(h2){margin-top:16px}
.g-sec h3{margin-top:40px}
.g-sec>[data-needs]>*+*{margin-top:16px}
.g-sec>[data-needs]>.piece{margin-top:24px}
.g-sec>[data-needs]>h3+*{margin-top:12px}
.g-sec h3+*{margin-top:12px}
.g-part{scroll-margin-top:24px}
.g-sec>.g-part{margin-top:40px}
.g-part>*+*{margin-top:12px}
.g-part>h3{margin-top:0}
.g-intro{font-size:19px;line-height:1.5}
.g-main .filename{font-family:var(--mono);font-size:14px;line-height:1.5;padding:12px 14px;border:1px solid var(--hair);background:color-mix(in srgb,var(--surface) 55%,transparent);max-width:560px}
.g-main code{font:500 .88em var(--mono);overflow-wrap:anywhere}
.g-main ul{padding-left:1.25em}
.g-main ul li+li{margin-top:6px}
.quote{font-weight:500}
.nowrap{white-space:nowrap}

/* keys, written with the menu path: File > Add Clips… ⌘I */
/* Outfit, not the mono face, so the letter O in ⌘O never reads as the zero in ⌘0. */
kbd{display:inline-block;font:500 .86em/1.4 var(--sans);letter-spacing:.02em;padding:0 6px;border:1px solid var(--line);border-bottom-width:2px;border-radius:4px;white-space:nowrap;vertical-align:.06em}

/* inline Decide, Select and Reject tags: the shared .app-badge, given the app's colours outside a piece */
.tag{--orange:#ff9500;--green:#28cd41;--red:#ff3b30;--gray:#8e8e93;--blue:#007aff;--purple:#af52de;--r-badge:4px;
  font-size:.8em!important;vertical-align:.08em;padding:0 5px!important}

/* ---------- numbered steps ---------- */
.steps{list-style:none;padding:0;margin-top:24px;counter-reset:step;max-width:none}
.steps>li{counter-increment:step;position:relative;padding-left:48px}
.steps>li+li{margin-top:32px}
.steps>li::before{content:counter(step);position:absolute;left:0;top:-2px;width:32px;height:32px;display:grid;place-items:center;border:1px solid var(--line);border-radius:50%;font-size:15px;font-weight:600;font-variant-numeric:tabular-nums}
.steps>li>h3{margin-top:0;font-size:19px;line-height:32px}
.steps>li>*+*{margin-top:8px}
.steps.plain>li>p:first-child{padding-top:3px}
.steps.plain>li+li{margin-top:16px}
@media (max-width:420px){.steps>li{padding-left:42px}}

/* ---------- app pieces set into the text, at their own size ---------- */
.piece{margin:28px 0 32px;max-width:100%}
.piece.narrow{max-width:520px}
.piece .app-timeline,.piece .app-plays{max-width:520px}
.piece .app-send{margin-bottom:28px}
.g-sec>.piece,.g-part>.piece,.steps .piece{margin-top:24px}

/* ---------- tables: play text styles, problems and keys ---------- */
.g-table{width:100%;max-width:560px;border-collapse:collapse;font-size:16px;margin-top:16px}
.g-table caption{text-align:left;font-size:17px;font-weight:600;padding-bottom:8px}
.g-table th,.g-table td{text-align:left;vertical-align:top;padding:9px 16px 9px 0;border-bottom:1px solid var(--hair);overflow-wrap:anywhere}
.g-table th:last-child,.g-table td:last-child{padding-right:0}
.g-table thead th{font-size:13px;font-weight:500;letter-spacing:.015em;color:var(--soft);border-bottom-color:var(--line)}
.g-table tbody th{font-weight:500;width:38%}
.g-table.styles{max-width:none}
.g-table.styles tbody th{width:auto;white-space:nowrap}
.g-table.styles td{font-family:var(--mono);font-size:14px;line-height:1.55}
@media (min-width:1000px){.g-table.styles td{white-space:nowrap}}
@media (max-width:600px){
  .g-table.styles thead{display:none}
  .g-table.styles tr{display:block;padding:10px 0;border-bottom:1px solid var(--hair)}
  .g-table.styles th,.g-table.styles td{display:block;padding:2px 0;border:0}
  .g-table.styles td::before{content:attr(data-label) ": ";font-family:var(--sans);color:var(--soft)}
}
.g-table.periods tbody th{white-space:nowrap}
.keys td{white-space:nowrap}
.keys{display:grid;gap:32px;margin-top:24px}
.keys .g-table{margin-top:0;max-width:none}
.keys .g-table th{width:44%;font-weight:400}
.keys kbd{font-size:.9em;white-space:normal}
@media (max-width:380px){.g-table{font-size:15px}.g-table.styles td{font-size:13px}}

.g-actions{margin-top:24px}
