/* The penalties page's brace tree (data-explainer="pen-tree"): what resets points and what cancels
   them, drawn with curly braces as an old textbook drew a classification. The braces are CSS, so the
   chart is whole without any script; the points card marks the branch its own record is on. */

.pen-tree { margin: 26px 0 36px; container: pentree / inline-size; }
.pt { display: flex; align-items: center; padding: 26px 22px 24px 20px; background: var(--card); border: 1px solid var(--rule);
	background-image: repeating-linear-gradient(0deg, transparent 0 31px, rgba(23, 32, 51, .045) 31px 32px); }
.pt-root { flex: 0 0 170px; display: grid; justify-items: start; gap: 6px; margin: 0; }
.pt-root b { font-family: var(--cond); font-weight: 700; font-size: 23px; line-height: 1.08; }
.pt-root > span:last-child { font: 13px/1.35 var(--mono); color: var(--ink-3); }
.pt-seal { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border: 2px solid var(--red); border-radius: 50%; box-shadow: inset 0 0 0 2px var(--card), inset 0 0 0 3px var(--red); font: 700 20px/1 var(--cond); color: var(--red); transform: rotate(-6deg); }

.pt-sub { display: flex; align-items: stretch; flex: 1 1 auto; min-width: 0; }
.pt-l1, .pt-l2 { list-style: none; margin: 0; padding: 0; flex: 1 1 auto; min-width: 0; }
.pt-l1 { display: grid; gap: 22px; }
.pt-l2 { display: grid; gap: 10px; align-content: center; }
.pt-branch { display: flex; align-items: center; min-width: 0; margin: 0; }
.pt-q { flex: 0 0 150px; display: grid; gap: 2px; margin: 0 4px 0 0; }
.pt-q b { font-family: var(--cond); font-weight: 700; font-size: 19px; line-height: 1.12; }
.pt-q span { font: 13px/1.35 var(--mono); color: var(--ink-3); }
.pt-l2 li { margin: 0; padding: 4px 8px 4px 0; font-size: 15px; line-height: 1.45; color: var(--ink-2); }
.pt-l2 li b { color: var(--ink); font-weight: 600; }
.pt-you { display: block; margin-top: 4px; font: normal 600 13px/1.4 var(--mono); color: var(--red); }
.pt-you[hidden] { display: none; }

.entry-body .pt-l1, .entry-body .pt-l2 { margin: 0; padding: 0; }
.entry-body .pt-l1 > li, .entry-body .pt-l2 > li { margin: 0; }

/* A curly brace from five pieces: the top curl, a stem, the point, a stem, the bottom curl. */
.br { flex: 0 0 24px; display: flex; flex-direction: column; margin: 2px 8px 2px 0; }
.br i { display: block; border: 0 solid var(--ink); transition: border-color 300ms; }
.br i:nth-child(1) { height: 12px; margin-left: 11px; border-left-width: 2px; border-top-width: 2px; border-top-left-radius: 12px 12px; }
.br i:nth-child(2), .br i:nth-child(4) { flex: 1 1 0; min-height: 4px; margin-left: 11px; border-left-width: 2px; }
.br i:nth-child(3) { position: relative; height: 24px; }
.br i:nth-child(3)::before, .br i:nth-child(3)::after { content: ""; position: absolute; left: 0; width: 13px; height: 12px; border: 0 solid; border-color: inherit; border-right-width: 2px; }
.br i:nth-child(3)::before { top: 0; border-bottom-width: 2px; border-bottom-right-radius: 12px 12px; }
.br i:nth-child(3)::after { bottom: 0; border-top-width: 2px; border-top-right-radius: 12px 12px; }
.br i:nth-child(5) { height: 12px; margin-left: 11px; border-left-width: 2px; border-bottom-width: 2px; border-bottom-left-radius: 12px 12px; }
.pt-sub-1 > .br { flex-basis: 30px; }

/* The branch the reader's card is on. */
.pt-l2 li.pt-on { background: var(--red-wash); box-shadow: -10px 0 0 var(--red-wash), 0 0 0 1px rgba(179, 38, 30, .15); }
.pt-branch:has(.pt-on) .pt-q b { color: var(--red); }
.pt-branch:has(.pt-on) > .pt-sub > .br i, .pt:has(.pt-on) > .pt-sub-1 > .br i { border-color: var(--red); }

.pen-tree figcaption { margin: 10px 0 0; max-width: 46em; font-size: 14px; color: var(--ink-3); }

/* Narrow: the root on top, each branch's question above its leaves. */
@container pentree (max-width: 700px) {
	.pt { flex-direction: column; align-items: stretch; padding: 18px 14px 18px 12px; }
	.pt-root { flex: none; grid-template-columns: auto minmax(0, 1fr); align-items: center; column-gap: 12px; margin: 0 0 14px; }
	.pt-root .pt-seal { grid-row: span 2; }
	.pt-root b { font-size: 21px; }
	.pt-branch { flex-direction: column; align-items: stretch; }
	.pt-q { flex: none; margin: 0 0 6px; }
	.pt-l1 { gap: 18px; }
	.br { flex-basis: 20px; margin-right: 6px; }
	.pt-sub-1 > .br { flex-basis: 22px; }
}
@media (prefers-reduced-motion: reduce) { .br i { transition: none; } }
