/* Playbook: one founder question per page, on Trail. The answer comes in the
   first screen, then a 62ch reading column with tables, callouts and numbered
   steps, the questions, the author as a base camp card, and the cluster's
   closing band. From 1100px a sticky sidebar carries the contents and the
   related playbooks. Every playbook shares this template, and
   tools/check_playbooks.py reads its markup (the plain <h1>, details.pb-q,
   plain markdown tables), so change those with the checker in view. */

.pb { padding-top: clamp(var(--space-7), 6vw, var(--space-9)); }

/* ---------- Grid ---------- */
.pb-grid { max-width: var(--container); margin: 0 auto; padding: 0 var(--pad); }
.pb-main, .pb-side { max-width: 42rem; margin: 0 auto; }
.pb-toc { display: none; }
.pb-body h2, .pb-faq h2 { scroll-margin-top: 6rem; }
@media (min-width: 1100px) {
  .pb-grid {
    display: grid; grid-template-columns: minmax(0, 42rem) 16rem;
    justify-content: space-between; gap: var(--space-8);
  }
  .pb-main, .pb-side { max-width: none; margin: 0; }
  .pb-side-inner { position: sticky; top: 6rem; }
  .pb-toc { display: block; margin-bottom: var(--space-7); }
}

/* ---------- Head ---------- */
.pb-crumbs {
  display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center;
  font-size: var(--text-label); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted); margin-bottom: var(--space-4);
}
.pb-crumbs a { color: var(--trail-text); text-decoration: none; }
.pb-crumbs a:hover { text-decoration: underline; }
.pb-head h1 { font-size: clamp(38px, 4.4vw, 56px); line-height: 1.05; max-width: 22ch; }
.pb-meta {
  display: flex; flex-wrap: wrap; gap: var(--space-2);
  margin-top: var(--space-4); font-size: var(--text-small); color: var(--muted);
}

/* ---------- The answer ----------
   The direct answer an AI engine quotes and a skimming founder reads: the
   lead face behind an ink rule, flat at rest. */
.pb-answer {
  margin: var(--space-6) 0 var(--space-7);
  padding-left: var(--space-5); border-left: 2px solid var(--ink);
  font-family: var(--font-display); font-size: var(--fs-lead);
  line-height: 1.45; color: var(--ink); max-width: var(--measure);
}

/* ---------- Body ---------- */
.pb-body { margin-bottom: var(--space-8); }
.pb-body h2 { font-size: clamp(30px, 3vw, 40px); line-height: 1.1; }
.pb-body h3 { font-size: 24px; }
.pb-body li strong { color: var(--ink); }

/* A callout is a markdown blockquote that opens on a bold label: the
   exception or the honest limit a skimming reader shouldn't miss. A card
   in the body face, so it never reads as the display-face quote. */
.pb-body blockquote {
  margin-top: var(--space-6); padding: var(--space-5);
  font-family: var(--font-body); font-size: var(--text-body); line-height: 1.6;
  background: var(--card); border: 0; border-radius: var(--radius-card);
  box-shadow: inset 3px 0 0 var(--juniper);
}
.pb-body blockquote p { color: var(--ink-soft); }
.pb-body blockquote strong { color: var(--juniper); }

/* Numbered steps: each number sits in a hollow ring, the marker for a stop
   still ahead, so a sequence reads as one. No line joins them: a list of
   steps in an article isn't a route with a start and a flag. */
.pb-body ol { list-style: none; padding-left: 0; counter-reset: pb-step; }
.pb-body ol > li { counter-increment: pb-step; position: relative; padding-left: 44px; min-height: 28px; }
.pb-body ol > li + li { margin-top: var(--space-4); }
.pb-body ol > li::before {
  content: counter(pb-step);
  position: absolute; left: 0; top: 0;
  display: flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--card); box-shadow: inset 0 0 0 2px var(--ink);
  font-size: 14px; font-weight: 600; line-height: 1; color: var(--ink);
}

/* Tables fit the reading column on a desktop (the template caps them at four
   columns). The scroll box is a backstop for a long unbroken word, so the
   page never scrolls sideways. Below 720px each row becomes a card. */
.pb-body table {
  display: block; overflow-x: auto; max-width: 100%;
  border-collapse: collapse; font-size: var(--text-small); line-height: 1.5;
}
.pb-body thead tr { border-bottom: 2px solid var(--ink); }
.pb-body th, .pb-body td {
  text-align: left; vertical-align: top;
  padding: var(--space-3) var(--space-4) var(--space-3) 0;
}
.pb-body tbody tr { border-bottom: 1px solid var(--line); }
.pb-body th {
  font-size: var(--text-label); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted);
}
.pb-body td { color: var(--ink-soft); }
.pb-body td:first-child { color: var(--ink); font-weight: 600; }

/* ---------- Template ----------
   A fill-in template the reader copies (a ```template fence). Body font,
   wrapped rather than scrolled, so it reads as text on a phone. The Copy
   button ships hidden and src/js/playbook.js reveals it where the clipboard
   works. */
.pb-body .pb-template {
  position: relative; margin-top: var(--space-5); padding: var(--space-5);
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-card);
}
.pb-template figcaption {
  font-size: var(--text-label); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--trail-text); margin-bottom: var(--space-3); padding-right: 6rem;
}
.pb-template pre {
  white-space: pre-wrap; overflow-wrap: anywhere;
  font-family: var(--font-body); font-size: var(--text-body); line-height: 1.6; color: var(--ink);
}
.pb-copy {
  position: absolute; top: calc(var(--space-5) - 6px); right: var(--space-4);
  display: inline-flex; align-items: center; min-height: 32px; padding: 0 14px;
  font-family: var(--font-body); font-size: var(--text-label); font-weight: 600; line-height: 1;
  color: var(--juniper); background: var(--card);
  border: 1.5px solid var(--juniper); border-radius: var(--radius-pill);
  cursor: pointer;
}
.pb-copy:hover { background: var(--juniper-tint); }
.pb-copy.is-copied { color: var(--on-juniper); background: var(--juniper); }

/* ---------- Questions (the shared .faq, placed) ---------- */
.pb-faq { margin-bottom: var(--space-8); }
.pb-faq h2 { font-size: clamp(30px, 3vw, 40px); line-height: 1.1; margin-bottom: var(--space-5); }
.pb-faq .faq summary { font-size: 21px; }

/* ---------- Author: who Jonathan is, off the route ---------- */
.pb-author { align-items: flex-start; margin-bottom: var(--space-8); }
.pb-author img { width: 96px; height: 96px; }
.pb-author-name { font-family: var(--font-display); font-size: 22px; font-weight: 500; color: var(--ink); }
.pb-author p + p { margin-top: var(--space-2); }
.pb-author p { font-size: var(--text-small); line-height: 1.6; max-width: 56ch; }
.pb-author-links { display: flex; flex-wrap: wrap; gap: var(--space-5); font-weight: 600; }

/* ---------- Sidebar: contents and related ---------- */
.pb-toc h2, .pb-related h2 {
  font-family: var(--font-body); font-size: var(--text-label); font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase; line-height: 1.2;
  color: var(--muted); margin-bottom: var(--space-3);
}
.pb-toc ol { list-style: none; border-left: 2px solid var(--line); }
.pb-toc a {
  display: block; margin-left: -2px; padding: 6px 0 6px var(--space-4);
  border-left: 2px solid transparent;
  font-size: var(--text-small); line-height: 1.4; color: var(--ink-soft); text-decoration: none;
}
.pb-toc a:hover { color: var(--juniper); border-left-color: var(--juniper); }
.pb-related { margin-bottom: var(--space-8); }
.pb-related ul { list-style: none; border-top: 2px solid var(--ink); }
.pb-related li { padding: var(--space-3) 0; border-bottom: 1px solid var(--line); font-size: var(--text-small); line-height: 1.45; }
.pb-related a { color: var(--ink); text-decoration: none; font-weight: 500; }
.pb-related a:hover { color: var(--juniper); text-decoration: underline; }

@media (max-width: 720px) {
  /* Each row is a card: the first cell titles it, and every later cell
     prints its column's header above the value, from the data-label that
     eleventy.config.js sets. The header row stays for screen readers. */
  .pb-body table { position: relative; overflow: visible; border-top: 2px solid var(--ink); }
  .pb-body tbody, .pb-body tr, .pb-body td { display: block; }
  .pb-body thead {
    position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
    overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
  }
  .pb-body tr { padding: var(--space-4) 0; }
  .pb-body td { padding: 0; }
  .pb-body td:empty { display: none; }
  .pb-body td + td { margin-top: var(--space-3); }
  .pb-body td + td[data-label]::before {
    content: attr(data-label); display: block; margin-bottom: 2px;
    font-size: var(--text-label); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
    color: var(--muted);
  }
  .pb-body .pb-template { padding: var(--space-4); }
  .pb-copy { top: calc(var(--space-4) - 6px); right: var(--space-3); }
  .pb-author { flex-direction: column; }
  .pb-author img { width: 72px; height: 72px; }
}
