/* making-tax-digital-exemptions: the sieve. A pull-out sheet across the whole width of the case
   file: the case written on a form at the top, the stack of screens drawn on a canvas with its
   labels beside it, one screen's question on a card, and the case note under them. Without the
   script the sheet holds only the table of what each screen catches. */

/* an insert in the file: a sheet of its own with perforated edges */
.ex-sieve { container-type: inline-size; margin: 26px calc(-1 * var(--pad, 0px)) 30px; padding: 30px var(--pad, 0px) 32px; background: var(--paper); border-top: 1px dashed var(--mute-line); border-bottom: 1px dashed var(--mute-line); }
.exs-wait { display: none; }
.exs-wait::after { content: attr(data-msg); }
.exs-booting:not(.exs-on) .exs-wait { display: flex; align-items: center; justify-content: center; min-height: 1120px; font-family: var(--mono); font-size: 13px; color: var(--ink-3); }
.exs-label { margin: 0 0 6px; font-family: var(--mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--red); }

/* ---- the case, written on a form */
.exs-sheet { margin: 0 0 22px; }
.exs-hint { margin: 0 0 12px; font-size: 15px; color: var(--ink-3); }
.exs-incs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 26px; }
.exs-inc { display: flex; flex-direction: column; min-width: 0; }
.exs-inc-y { font-family: var(--mono); font-weight: 600; font-size: 13px; color: var(--ink); }
.exs-inc-f { display: flex; align-items: baseline; gap: 4px; border-bottom: 2px solid var(--ink); }
.exs-inc-f i { font-style: normal; font-family: var(--mono); font-size: 18px; color: var(--ink-3); }
.exs-inc input { flex: 1; min-width: 0; height: 44px; padding: 0 2px; border: 0; background: transparent; font-family: var(--mono); font-size: 21px; font-variant-numeric: tabular-nums; color: var(--ink); }
.exs-inc input:focus { outline: none; }
.exs-inc-f:focus-within { border-bottom-color: var(--link); box-shadow: 0 2px 0 var(--link); }
.exs-inc-e { display: block; font-size: 13px; line-height: 1.35; color: var(--red-deep); }
.exs-inc-e:empty { display: none; }
.exs-inc-t { margin-top: 5px; font-family: var(--mono); font-size: 12px; line-height: 1.4; color: var(--ink-3); }

/* ---- the stack and the card */
.exs-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; align-items: start; }
@container (min-width: 760px) {
	.exs-body { grid-template-columns: minmax(0, 1fr) minmax(280px, 330px); gap: 26px; }
	.exs-card { position: sticky; top: 16px; }
}
.exs-stage { position: relative; min-height: 360px; }
.exs-stage canvas { position: absolute; left: 0; top: 0; }
.exs-heads span { position: absolute; transform: translateX(-50%); text-align: center; white-space: nowrap; }
.exs-heads b { display: block; font-family: var(--mono); font-weight: 600; font-size: 13px; color: var(--ink); }
.exs-heads small { display: block; font-family: var(--mono); font-size: 12px; color: var(--ink-3); }
.exs-trays span { position: absolute; transform: translateX(-50%); text-align: center; line-height: 1.25; }
.exs-trays b { display: block; font-family: var(--mono); font-weight: 600; font-size: 13px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.exs-trays small { display: block; font-family: var(--mono); font-size: 12px; color: var(--ink-3); }
.exs-trays .exs-t-in b, .exs-trays .exs-t-in small { color: var(--red); }
.exs-trays .exs-t-exempt b { color: var(--ink); }
.entry-body .exs-plates { margin: 0; padding: 0; list-style: none; }
.entry-body .exs-plates li { position: absolute; left: 0; margin: 0; transform: translateY(-50%); }
.exs-plate { position: relative; display: grid; grid-template-columns: 24px minmax(0, 1fr); align-content: center; column-gap: 4px; width: 100%; min-height: 44px; padding: 5px 12px 5px 0; background: none; border: 0; text-align: left; cursor: pointer; color: var(--ink); }
.exs-plate b { grid-row: span 2; align-self: center; font-family: var(--mono); font-weight: 600; font-size: 13px; color: var(--ink-3); }
.exs-pn { font-size: 14.5px; line-height: 1.2; }
.exs-ps { font-family: var(--mono); font-size: 12px; line-height: 1.3; color: var(--ink-3); }
.exs-plate.is-catch .exs-ps { color: var(--ink); }
.exs-plate.is-apply .exs-ps { color: var(--red); }
/* a hairline leads from the chosen label to its screen */
.exs-plate::after { content: ""; position: absolute; right: 0; top: 50%; width: 10px; border-top: 1px solid var(--ink-4); }
.exs-plate[aria-current="step"] .exs-pn { font-weight: 600; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }
.exs-plate[aria-current="step"] b { color: var(--ink); }
.exs-plate[aria-current="step"]::after { border-top: 2px solid var(--ink); width: 12px; }
.exs-plate:hover .exs-pn { text-decoration: underline; text-underline-offset: 3px; }
.exs-plate:focus-visible { outline: 2px solid var(--link); outline-offset: 0; }

.exs-card { background: var(--card); border: 1px solid var(--rule); border-top: 3px solid var(--ink); padding: 16px 18px 14px; }
.exs-set { margin: 0; padding: 0; border: 0; min-width: 0; }
.exs-set legend { display: flex; flex-direction: column; gap: 2px; margin: 0 0 8px; padding: 0; }
.exs-no { font-family: var(--mono); font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.exs-qn { font-family: var(--cond); font-weight: 700; font-size: 22px; line-height: 1.15; }
.exs-q { font-size: 16px; line-height: 1.4; color: var(--ink-2); }
.exs-opt { position: relative; display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 10px; align-items: start; min-height: 44px; padding: 10px 0 9px; border-bottom: 1px dotted var(--mute); font-size: 15px; line-height: 1.35; cursor: pointer; }
.exs-opt:last-of-type { border-bottom: 0; }
.exs-opt input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
/* one answer per screen: a round mark that fills with ink, as on a paper form's "mark one" */
.exs-box { position: relative; width: 20px; height: 20px; margin-top: 0; border: 1.5px solid var(--ink); border-radius: 50%; background: var(--card); }
.exs-box::before { content: ""; position: absolute; inset: 3.5px; border-radius: 50%; background: var(--ink); transform: scale(0); transition: transform 180ms var(--ease); }
.exs-opt input:checked + .exs-box::before { transform: scale(1); }
.exs-opt input:focus-visible + .exs-box { outline: 2px solid var(--link); outline-offset: 2px; }
.exs-opt:hover .exs-box { background: var(--wash-2); }
.exs-when { margin: 12px 0 0; padding: 10px 0 0; border: 0; border-top: 1px solid var(--rule); min-width: 0; }
.exs-when legend { padding: 0; font-family: var(--mono); font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.exs-out { margin: 12px 0 14px; padding: 2px 0 2px 12px; border-left: 2px solid var(--ink); font-size: 15px; line-height: 1.45; color: var(--ink-2); }
.exs-nav { display: flex; justify-content: space-between; gap: 10px; }
.exs-nav button { min-height: 44px; padding: 0 16px; border: 1px solid var(--ink); background: var(--card); font: 600 15px var(--sans); color: var(--ink); cursor: pointer; }
.exs-nav .exs-next { background: var(--ink); color: var(--paper); }
.exs-nav button:disabled { opacity: .45; cursor: default; }
.exs-acts { display: flex; flex-wrap: wrap; gap: 0 18px; margin: 10px 0 0; }
.exs-acts button { min-height: 44px; padding: 0; border: 0; background: none; font-family: var(--mono); font-size: 13px; color: var(--ink-2); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.exs-acts button:hover { color: var(--ink); }

/* ---- the case note */
.exs-note { margin: 24px 0 0; padding: 20px 22px 16px; background: var(--card); border: 1px solid var(--rule); }
.exs-verdict { margin: 0 0 6px; font-family: var(--cond); font-weight: 700; font-size: 28px; line-height: 1.12; color: var(--ink); }
.exs-sum { margin: 0 0 12px; font-size: 16px; color: var(--ink-2); max-width: 44em; }
.entry-body .exs-items { margin: 0 0 12px; padding: 0; list-style: none; border-top: 1px solid var(--ink); }
.entry-body .exs-items li { display: grid; grid-template-columns: 150px minmax(0, 1fr); column-gap: 16px; margin: 0; padding: 10px 0; border-bottom: 1px dotted var(--mute); font-size: 15px; line-height: 1.45; }
.exs-items li > span { grid-column: 2; }
.exs-tag { grid-row: span 5; font-family: var(--mono); font-weight: 600; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink); padding-top: 2px; }
.exs-k-apply .exs-tag { color: var(--red); }
.exs-k-none .exs-tag { color: var(--ink-3); }
.exs-t { font-weight: 600; }
.exs-nb, .exs-how { color: var(--ink-3); font-size: 15px; }
.exs-how { color: var(--red-deep); }
.exs-ann { margin: 0 0 12px; padding: 2px 0 2px 14px; border-left: 2px dashed var(--ink-3); font-size: 15px; color: var(--ink-2); }
.exs-ann p { margin: 0 0 6px; }
.exs-cav, .exs-sa, .exs-none { font-size: 15px; color: var(--ink-2); margin: 0 0 8px; max-width: 46em; }
.exs-note .src { max-width: 46em; }

/* ---- the server's facts */
.exs-facts { margin: 26px 0 0; }
.exs-on .exs-facts { padding-top: 22px; border-top: 1px solid var(--rule); }
.exs-fold { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; margin: 0 0 4px; padding: 0; border: 0; background: none; font: 600 15px var(--sans); color: var(--ink); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.exs-fold::before { content: ""; width: 8px; height: 8px; border-right: 2px solid var(--ink); border-bottom: 2px solid var(--ink); transform: rotate(-45deg); transition: transform 200ms var(--ease); }
.exs-fold[aria-expanded="true"]::before { transform: rotate(45deg); }
.exs-folded .exs-table { display: none; }
.exs-qq { display: block; margin-top: 2px; font-size: 15px; color: var(--ink-3); }
.exs-ans { display: block; font-weight: 600; }
.exs-table li { margin: 0 0 9px; }
.exs-eg { margin: 14px 0 0; font-size: 15px; color: var(--ink-2); max-width: 46em; }

@container (max-width: 520px) {
	/* the three returns as lines of the form, one under another */
	.exs-incs { grid-template-columns: minmax(0, 1fr); gap: 4px; }
	.exs-inc { display: grid; grid-template-columns: minmax(0, 1fr) 150px; column-gap: 12px; align-items: end; padding: 6px 0 8px; border-bottom: 1px dotted var(--mute); }
	.exs-inc-y { grid-column: 1; grid-row: 1; }
	.exs-inc-t { grid-column: 1; grid-row: 2; margin-top: 2px; }
	.exs-inc-e { grid-column: 1 / -1; grid-row: 3; margin-top: 4px; }
	.exs-inc-f { grid-column: 2; grid-row: 1 / span 2; }
	.exs-inc input { font-size: 19px; height: 44px; }
	.exs-inc-f i { font-size: 15px; }
	.exs-ps { display: none; }
	.exs-plate b { grid-row: auto; }
	.exs-pn { font-size: 14px; line-height: 1.15; }
	.exs-heads b { font-size: 12px; }
	.exs-trays b { font-size: 12px; letter-spacing: 0; }
	.exs-plate { grid-template-columns: 20px minmax(0, 1fr); padding-right: 8px; }
	.exs-plate::after { width: 6px; }
	.exs-card { padding: 14px 14px 12px; }
	.exs-note { padding: 16px 14px 12px; }
	.exs-verdict { font-size: 24px; }
	.entry-body .exs-items li { grid-template-columns: minmax(0, 1fr); }
	.exs-items li > span { grid-column: 1; }
	.exs-tag { grid-row: auto; }
}
@media (max-width: 700px) {
	.exs-booting:not(.exs-on) .exs-wait { min-height: 1650px; }
	.ex-sieve { padding-top: 22px; }
	.exs-table thead { display: none; }
	.exs-table tr { display: grid; grid-template-columns: 28px minmax(0, 1fr); }
	.exs-table td { border-bottom: 0; padding: 8px 0 0; }
	.exs-table td:last-child { grid-column: 2; padding-bottom: 10px; border-bottom: 1px dotted var(--mute); }
}
@media (prefers-reduced-motion: reduce) {
	.exs-box::before { transition: none; }
}
