/* Playbook layout and components. Load after Contang's site.css. */
html:has(body.playbook) { scrollbar-gutter: auto; }
.playbook { position: relative; min-width: 0; overflow-x: visible; }
.playbook .guides { position: absolute; }
.playbook .guides .g > i { transform: none; }
.playbook .nav-wrap { position: relative; top: auto; padding: 24px var(--m) 0; }
.playbook .nav .btn { height: 44px; }
.playbook .nav .brand { padding-right: 16px; }
.playbook .footer { margin-top: clamp(44px, 6vw, 88px); }
.playbook .bigword { padding-top: 26px; padding-bottom: 24px; }
.playbook .bigword .lock { max-width: 290px; }
.playbook .package-line { margin: 0; padding-top: 20px; }
.playbook :is(.package-line, .pb-row, .pb-note, .pb-card, .pb-sources) a,
.playbook .text-link { text-decoration: underline; text-underline-offset: .2em; }
.playbook :focus-visible { outline: 2px solid var(--sky); outline-offset: 4px; }

/* The teaching grid: copy first, media to the right, never alternated. */
.pb-top { padding-top: clamp(32px, 5vw, 64px); }
.pb-section { margin-top: clamp(42px, 6vw, 80px); scroll-margin-top: 20px; }
.pb-title { margin: 22px 0 12px; font-size: clamp(31px, 3.6vw, 54px); line-height: 1.05; letter-spacing: -.042em; }
.pb-note { max-width: 75ch; margin: 0 0 24px; color: var(--ink2); }
.pb-hero, .pb-row {
  display: grid;
  grid-template-columns: minmax(0, .9fr) minmax(0, 1fr);
  gap: clamp(28px, 5vw, 76px);
  align-items: start;
}
.pb-hero { padding-block: clamp(28px, 5vw, 66px) clamp(36px, 6vw, 78px); align-items: center; }
.pb-hero .h2 { font-size: clamp(52px, 6.6vw, 108px); }
.pb-hero .h2 .lt { display: block; }
.pb-hero .pb-note { margin: 18px 0 0; max-width: 47ch; font-size: clamp(17px, 1.6vw, 21px); }
.pb-rows { margin: 0; padding: 0; list-style: none; }
.pb-row { border-top: 1px solid var(--line2); padding-block: clamp(20px, 3vw, 38px); align-items: center; }
.pb-row-copy { max-width: 59ch; }
.pb-row-label { display: block; margin: 0 0 9px; color: var(--ink3); }
.pb-counts { display: flex; flex-wrap: wrap; column-gap: 16px; row-gap: 4px; }
.pb-counts strong { color: var(--ink); font-weight: 600; }
.pb-row-title { margin: 0 0 10px; font-size: clamp(23px, 2.45vw, 36px); letter-spacing: -.035em; line-height: 1.08; }
.pb-row-copy p:not(.pb-row-label) { margin: 0; color: var(--ink2); }
.pb-row-copy strong, .pb-row-copy a { color: var(--ink); }
.pb-row-copy p:not(.pb-row-label) + p { margin-top: 10px; }

/* A single width, one wide variant for text-heavy art, and a pair. */
.pb-media { width: min(100%, 400px); min-width: 0; }
.pb-media--wide { width: min(100%, 520px); }
.pb-media--pair { width: min(100%, 624px); display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(12px, 2vw, 24px); align-items: start; }
.pb-art { min-width: 0; margin: 0; }
.pb-art:has(img) { transition: transform .32s var(--ease); }
.pb-art:has(img):hover { transform: translateY(-4px); }
@media (hover: none) and (pointer: coarse) { .pb-art:has(img):hover { transform: none; } }
.pb-frame { position: relative; background: var(--cell); outline: 1px solid var(--line2); outline-offset: -1px; border-radius: 2px; }
.pb-frame :is(img, video) { display: block; width: 100%; height: auto; border-radius: inherit; }
.pb-media-label { display: block; color: var(--ink3); margin: 0 0 7px; }
.pb-caption { margin: 8px 0 0; padding-top: 7px; border-top: 1px solid var(--line); color: var(--ink2); font-size: 13px; }
.pb-caption a { text-decoration: underline; text-underline-offset: .2em; }
.pb-frame-video video { cursor: pointer; }
.pb-play { position: absolute; right: 12px; bottom: 12px; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: var(--bg); color: var(--ink); opacity: .9; }
.pb-play:hover { opacity: 1; }
.pb-play::before { content: ''; width: 10px; height: 14px; border-inline: 3px solid currentColor; }
.pb-play[data-paused="true"]::before { width: 0; height: 0; margin-left: 2px; border: 7px solid transparent; border-left: 10px solid currentColor; border-right: 0; }

/* Shared card surface; the question flow owns no worksheet or checker state. */
.pb-interactive { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.65fr); align-items: start; gap: clamp(18px, 5vw, 72px); padding-top: 24px; }
.pb-interactive .pb-title { margin-top: 0; }
.pb-card-stack { display: grid; min-width: 0; gap: 16px; }
.pb-card { min-width: 0; padding: clamp(18px, 3.2vw, 38px); border: 1px solid var(--line); border-radius: 14px; background: var(--cell); }
.pb-card input { accent-color: var(--sky); }
.pb-card .pb-note { margin-bottom: 0; }
.pb-worksheet h3 { margin: 0 0 16px; font-size: clamp(18px, 1.9vw, 24px); letter-spacing: -.025em; line-height: 1.2; }
.pb-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); gap: 12px; }
.pb-worksheet label { display: block; font-size: 14px; font-weight: 500; }
.pb-worksheet :is(:where(input:not([type="radio"], [type="checkbox"])), textarea, select) { display: block; width: 100%; min-height: 44px; margin-top: 6px; padding: 9px 11px; border: 1px solid var(--dash); border-radius: 8px; background: var(--bg); color: var(--ink); font: inherit; }
.pb-worksheet textarea { resize: vertical; min-height: 76px; }
.pb-worksheet ::placeholder { color: var(--ink3); }
.pb-print-entry { display: none; }
.pb-checker output { display: block; color: var(--sky-ink); margin-bottom: 14px; }
.pb-checker ul { display: grid; gap: 8px; list-style: none; margin: 0; padding: 0; }
.pb-checker label { display: flex; align-items: flex-start; gap: 12px; min-height: 48px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.pb-checker label:has(input:checked) { border-color: var(--sky-edge); background: var(--sky-tint); }
.pb-checker input { flex: 0 0 auto; width: 23px; height: 23px; margin: 0; cursor: pointer; }

.pb-flow-heading { margin: 0 0 8px; color: var(--ink2); }
.pb-flow [data-pb-question] { min-width: 0; margin: 0; padding: 12px 0; border: 0; }
.pb-flow [data-pb-prompt] { padding: 0; }
.pb-choices { display: flex; gap: 14px; }
.pb-choices label { display: flex; align-items: center; gap: 6px; min-height: 44px; cursor: pointer; }
.pb-choices label:has(input:checked) { color: var(--sky-ink); }
.pb-flow-ready [data-pb-question] { min-height: 170px; padding: 16px 0 0; animation: pb-in .24s var(--ease) both; }
.pb-flow-ready [data-pb-prompt], .pb-flow-score { color: var(--ink); font-size: clamp(24px, 3vw, 42px); font-weight: 650; letter-spacing: -.04em; line-height: 1.08; }
.pb-flow-ready [data-pb-prompt]:focus, .pb-flow-score:focus { outline: none; }
.pb-flow-position { text-align: right; color: var(--ink2); white-space: nowrap; }
.pb-flow-status { display: flex; flex-direction: row-reverse; gap: 13px; align-items: center; margin-bottom: 28px; }
.pb-progress { appearance: none; display: block; width: 100%; height: 3px; border: 0; border-radius: 9px; overflow: hidden; background: var(--line); color: var(--sky); }
.pb-progress::-webkit-progress-bar { background: var(--line); }
.pb-progress::-webkit-progress-value { background: var(--sky); transition: width .22s var(--ease); }
.pb-progress::-moz-progress-bar { background: var(--sky); }
.pb-flow-ready .pb-choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.pb-flow-ready .pb-choices label { position: relative; display: flex; justify-content: space-between; min-height: 58px; padding: 12px 16px; border: 1px solid var(--dash); border-radius: 9px; background: var(--slot); color: var(--ink); font-size: 18px; font-weight: 550; }
.pb-flow-ready .pb-choices label:hover { background: var(--cell2); }
.pb-flow-ready .pb-choices label::after { content: attr(data-pb-key); font: 11px var(--mono); opacity: .7; }
.pb-flow-ready .pb-choices label:has(:checked) { border-color: var(--sky); background: var(--sky); color: var(--sky-label); }
.pb-flow-ready .pb-choices label:has(:focus-visible) { outline: 2px solid var(--sky); outline-offset: 4px; }
.pb-flow-ready .pb-choices input { position: absolute; width: 1px; height: 1px; margin: 0; opacity: 0; }
.pb-flow-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 20px; padding-top: 12px; border-top: 1px solid var(--line2); }
.pb-flow-back { min-height: 44px; padding: 0 8px; margin-left: -8px; color: var(--ink2); font-size: 14px; }
.pb-flow-back:hover { color: var(--ink); }
.pb-flow-back:disabled { visibility: hidden; }
.pb-flow-hint { margin: 0; color: var(--ink3); font-size: 13px; text-align: right; }
.pb-flow-result { animation: pb-in .24s var(--ease) both; }
.pb-flow-score { margin: 0 0 13px; }
.pb-flow-advice { color: var(--ink2); }
.pb-flow-advice > :first-child { margin-top: 0; }
.pb-flow-reset { min-height: 44px; margin-top: 6px; padding: 0 16px; border: 1px solid var(--dash); border-radius: 8px; }
.pb-flow-reset:hover { background: var(--cell2); }
.pb-flow [hidden] { display: none; }
@keyframes pb-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

@media screen and (max-width: 800px) {
  html:has(body.playbook) { --m: 20px; --gap: 12px; }
  .playbook .nav-wrap { padding-top: 16px; }
  .playbook .sh { grid-template-columns: 26px minmax(0, 1fr) auto; }
  .playbook .sh .n { grid-column: 1; }
  .playbook .sh .l { grid-column: 2; }
  .playbook .sh .r { grid-column: 3; }
  .playbook .bigword .lock { max-width: 200px; }
  .pb-hero, .pb-row, .pb-interactive { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .pb-hero .h2 { font-size: clamp(42px, 11vw, 75px); }
  .pb-interactive .pb-note:last-child { margin-bottom: 0; }
}
@media screen and (max-width: 560px) {
  .pb-media--pair { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .pb-flow-ready [data-pb-question] { min-height: 145px; }
  .pb-flow-status { margin-bottom: 22px; }
  .pb-flow-ready .pb-choices label::after { display: none; }
}
@media screen and (max-width: 360px) {
  .playbook .nav .brand { padding-right: 6px; }
  .playbook .nav .btn { padding-inline: 12px; }
}
@media (prefers-reduced-motion: reduce) { .playbook *, .playbook *::before { animation-duration: 0s !important; transition-duration: 0s !important; } }

/* The existing Save as PDF action prints the plain layout and fields. */
@page { margin: 12mm; }
@media print {
  :root[data-theme]:has(body.playbook) { --bg: white; --ink: black; --ink2: black; --ink3: black; --line: gray; --line2: lightgray; --cell: transparent; --slot: transparent; --sky-ink: black; --m: 0px; --gap: 9pt; color-scheme: light; }
  .playbook { font-size: 9.5pt; line-height: 1.27; transition: none; }
  .playbook .nav-wrap, .playbook .guides, .playbook .bigword, .pb-media, .pb-flow-status, .pb-flow-foot, .pb-flow-reset { display: none; }
  .playbook .wrap { max-width: none; }
  .playbook .sh { display: flex; padding-top: 4pt; font-size: 8pt; }
  .playbook .sh .r { margin-left: auto; }
  .playbook .footer { margin-top: 10pt; }
  .playbook .package-line { padding-top: 5pt; }
  .pb-top { padding: 0; }
  .pb-section { margin-top: 14pt; }
  .pb-hero { display: block; padding: 9pt 0 13pt; }
  .pb-hero .h2 { font-size: 30pt; }
  .pb-hero .h2 .lt { display: inline; }
  .pb-hero .pb-note { font-size: 10pt; max-width: none; margin: 5pt 0 0; }
  .pb-title { font-size: 18pt; margin: 8pt 0 4pt; }
  .pb-note { max-width: none; margin-bottom: 6pt; }
  .pb-row { display: block; padding-block: 6pt; break-inside: avoid; }
  .pb-row-copy { max-width: none; }
  .pb-row-label { font-size: 8pt; margin-bottom: 2pt; }
  .pb-row-title { font-size: 12pt; margin-bottom: 2pt; }
  .pb-interactive { display: block; padding-top: 6pt; }
  .pb-card-stack { display: block; }
  .pb-card { margin-bottom: 7pt; padding: 6pt; border-radius: 0; }
  .pb-flow-ready [data-pb-question][hidden] { display: block; }
  .pb-flow-ready [data-pb-question] { min-height: 0; padding: 3pt 0; animation: none; break-inside: avoid; }
  .pb-flow-ready [data-pb-prompt], .pb-flow-score { font-size: 11pt; letter-spacing: 0; }
  .pb-flow-ready .pb-choices { display: flex; }
  .pb-flow-ready .pb-choices label { gap: 3pt; min-height: 0; padding: 2pt 4pt; border: 0; color: var(--ink); background: none; font-size: inherit; }
  .pb-flow-ready .pb-choices label::after { content: none; }
  .pb-flow-ready .pb-choices input { position: static; opacity: 1; width: auto; height: auto; }
  .pb-flow-result:not([hidden]) { margin-top: 5pt; animation: none; }
  .pb-flow-advice p { margin: 3pt 0 0; }
  .pb-checker label { min-height: 0; padding: 4pt; break-inside: avoid; }
  .pb-worksheet { break-inside: avoid; }
  .pb-worksheet h3 { font-size: 11pt; margin-bottom: 4pt; break-after: avoid; }
  .pb-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pb-worksheet label { font-size: 9pt; break-inside: avoid; }
  .pb-worksheet :is(input, textarea, select) { min-height: 0; padding: 2pt 4pt; border-color: var(--line); }
  .pb-worksheet label:has(.pb-print-entry) textarea { display: none; }
  .pb-print-entry { display: block; min-height: 13pt; white-space: pre-wrap; overflow-wrap: anywhere; border-bottom: 1px solid var(--line2); }
  .playbook details::details-content { content-visibility: visible; }
}
