/* Jev fills in forms. The page is an official form: pale green stock, white answer boxes,
   printed dark-green labels, answers typed in blue, red rubber stamp, yellow carbon copy. */
:root {
  --sheet: #dfebdd;      /* form stock */
  --tint: #c9dcc8;       /* shaded "office use" areas */
  --box: #ffffff;        /* answer boxes */
  --print: #12382b;      /* printed text and rules */
  --pencil: #4f6158;     /* guidance notes */
  --ink: #1b3f9e;        /* what Jev typed */
  --stamp: #c1272d;
  --carbon: #fff3b8;     /* the copy you keep */
  --rule: 2px solid var(--print);
  --sans: "Public Sans", system-ui, sans-serif;
  --typed: "Courier Prime", "Courier New", monospace;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; scroll-padding-top: 16px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { animation: none !important; transition: none !important; } }
body { margin: 0; background: var(--sheet); color: var(--print); font: 400 17px/1.55 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: var(--ink); text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
.skip { position: absolute; left: -999px; } .skip:focus { left: 8px; top: 8px; background: var(--box); padding: 8px; z-index: 9; }

.sheet-head, main, footer { max-width: 760px; margin: 0 auto; padding: 0 20px; }
.sheet-head { padding-top: 28px; }
.formref { display: flex; justify-content: space-between; gap: 12px; font-weight: 600; font-size: 14px; border-bottom: var(--rule); padding-bottom: 8px; }
.formref span { font-weight: 400; }
h1 { font-size: clamp(44px, 9.5vw, 88px); line-height: .95; letter-spacing: -.045em; font-weight: 800; margin: 26px 0 22px; }
.lede { font-size: clamp(18px, 2.4vw, 21px); line-height: 1.45; margin: 0 0 14px; max-width: 34em; }

.contents { max-width: 760px; margin: 22px auto 0; padding: 0 20px; font-size: 15px; }
.contents p { font-weight: 800; margin: 0 0 6px; }
.contents ol { margin: 0; padding: 0; list-style: none; columns: 2; column-gap: 28px; }
.contents li { break-inside: avoid; padding: 2px 0; }
.contents a { color: var(--print); text-decoration: none; display: flex; gap: 8px; }
.contents a:hover span:last-child { text-decoration: underline; }
.contents a span:first-child { font-family: var(--typed); width: 1.6em; flex: none; }
@media (min-width: 1240px) {
  .contents { position: fixed; top: 28px; left: max(20px, calc(50vw - 380px - 250px)); width: 210px; margin: 0; padding: 0; max-height: calc(100vh - 56px); overflow: auto; }
  .contents ol { columns: 1; }
}
@media (max-width: 520px) { .contents ol { columns: 1; } }

.part { margin: 64px 0 0; padding: 10px 14px; background: var(--print); color: var(--sheet); font-weight: 800; font-size: 19px; letter-spacing: -.01em; }
section { padding: 34px 0 6px; }
section + section { border-top: var(--rule); margin-top: 34px; }
h2 { display: flex; align-items: center; gap: 12px; font-size: clamp(24px, 4vw, 31px); line-height: 1.1; letter-spacing: -.025em; font-weight: 800; margin: 0 0 16px; }
h2 b { flex: none; display: grid; place-items: center; min-width: 40px; height: 40px; padding: 0 6px; border: var(--rule); background: var(--box); font: 700 21px/1 var(--typed); letter-spacing: 0; }
p { margin: 0 0 14px; max-width: 38em; }
.aside { border-left: 5px solid var(--print); padding: 2px 0 2px 14px; color: var(--pencil); font-size: 16px; }
.typed { font-family: var(--typed); color: var(--ink); font-weight: 700; }
.cap { font-weight: 600; font-size: 14px; margin: 0 0 4px; }

/* the attached message */
.letter { background: var(--box); border: 1px solid var(--print); padding: 16px 18px; margin: 18px 0; font: 400 17px/1.5 var(--typed); position: relative; max-width: 38em; box-shadow: 4px 4px 0 var(--tint); }
.letter::before { content: ""; position: absolute; top: -9px; left: 22px; width: 34px; height: 16px; border: 2px solid #7d8a84; border-bottom: 0; border-radius: 8px 8px 0 0; }
.letter.dark { background: var(--print); color: var(--sheet); font-family: var(--sans); font-size: 16px; box-shadow: none; }
.letter.dark::before { display: none; }

/* the form */
.form { border: var(--rule); background: var(--tint); margin: 18px 0; }
.field { display: grid; grid-template-columns: minmax(0, 15em) minmax(0, 1fr); border-bottom: 1px solid var(--print); }
.field:last-child { border-bottom: 0; }
.field > label, .field > .lab { padding: 12px 14px; font-weight: 600; font-size: 15.5px; line-height: 1.3; }
.field > div:not(.lab) { background: var(--box); border-left: 1px solid var(--print); padding: 10px 12px; min-height: 48px; }
@media (max-width: 600px) { .field { grid-template-columns: 1fr; } .field > div:not(.lab) { border-left: 0; border-top: 1px solid var(--print); } .field > label, .field > .lab { padding-bottom: 8px; } }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px 14px; }
.form > .actions { border-top: 1px solid var(--print); }

/* tick boxes: the box inks up from the bottom in proportion to the probability */
.ticks { display: grid; gap: 7px; }
.tick { display: grid; grid-template-columns: 26px minmax(0, 1fr) minmax(3.2em, auto); gap: 10px; align-items: center; font-size: 15.5px; }
.tick i { width: 26px; height: 26px; border: var(--rule); position: relative; display: block; background: linear-gradient(to top, var(--ink) var(--p, 0%), transparent var(--p, 0%)); transition: background .25s; }
.tick.chosen i::after { content: ""; position: absolute; left: 7px; top: 1px; width: 8px; height: 15px; border: solid #fff; border-width: 0 3px 3px 0; transform: rotate(40deg); }
.tick.chosen span:nth-child(2) { font-weight: 800; }
.tick em { text-align: right; }
.tick em, .yesno em, .scale em { font: 700 15px var(--typed); color: var(--ink); font-style: normal; }
.tick small { display: block; color: var(--pencil); font-size: 13.5px; font-weight: 400; }

/* score: a ladder of boxes */
.scale { display: grid; gap: 8px; }
.ladder { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; }
.ladder i { height: 30px; border: var(--rule); display: block; background: linear-gradient(to top, var(--ink) var(--p, 0%), transparent var(--p, 0%)); transition: background .25s; }
.ladder-labels { display: flex; justify-content: space-between; gap: 8px; font-size: 13.5px; color: var(--pencil); }

/* yes / no */
.yesno { display: grid; gap: 6px; }
.meter { height: 22px; border: var(--rule); position: relative; background: var(--box); }
.meter b { position: absolute; inset: 0 auto 0 0; width: var(--p, 0%); background: var(--ink); transition: width .3s; }
.meter::after { content: ""; position: absolute; left: 50%; top: -4px; bottom: -4px; border-left: 2px dotted var(--print); }
.yn-labels { display: flex; justify-content: space-between; font-size: 13.5px; color: var(--pencil); }
.blank { color: var(--pencil); font-size: 15px; }

/* buttons */
button { font: inherit; color: inherit; }
.act { background: var(--print); color: var(--sheet); border: var(--rule); padding: 10px 18px; font-weight: 800; cursor: pointer; border-radius: 3px; }
.act:hover { background: #0b2a1f; }
.act:active { transform: translateY(1px); }
.act.quiet { background: transparent; color: var(--print); }
.act.quiet:hover { background: var(--tint); }
.choices { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0; }
.choices.stack { display: grid; }
.choices button, .tabs button { background: var(--box); border: var(--rule); padding: 8px 13px; cursor: pointer; border-radius: 3px; text-align: left; font-size: 15.5px; line-height: 1.3; }
.choices button[aria-pressed=true], .tabs button[aria-selected=true] { background: var(--print); color: var(--sheet); font-weight: 600; }
.choices.stack button { font-family: var(--typed); }
.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 12px; }

/* rubber stamp */
.stamp { display: inline-block; border: 3px solid var(--stamp); color: var(--stamp); padding: 4px 10px; font: 700 14px/1.25 var(--typed); text-transform: uppercase; letter-spacing: .04em; transform: rotate(-3deg); border-radius: 4px; mix-blend-mode: multiply; }
.stamp.hit { animation: thud .28s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes thud { from { transform: rotate(-9deg) scale(1.7); opacity: 0; } to { transform: rotate(-3deg) scale(1); opacity: 1; } }

/* the carbon copy: what actually went over the wire */
.carbon details { background: var(--carbon); border: 1px solid var(--print); margin: 0 0 18px; }
.carbon summary { cursor: pointer; padding: 9px 14px; font-weight: 600; font-size: 15px; }
.carbon .bits { display: flex; flex-wrap: wrap; gap: 4px 18px; padding: 0 14px 10px; font: 400 14.5px var(--typed); }
.carbon h3 { margin: 0; padding: 8px 14px 4px; font-size: 14px; font-weight: 800; border-top: 1px solid var(--print); }
pre { margin: 0; white-space: pre-wrap; word-break: break-word; }
.carbon pre { padding: 4px 14px 12px; font: 400 13px/1.45 var(--typed); max-height: 300px; overflow: auto; }
.typed-block { background: var(--box); border: 1px solid var(--print); padding: 12px 14px; font: 400 13.5px/1.5 var(--typed); color: var(--ink); overflow: auto; }
.typed-block.scroll { max-height: 340px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
@media (max-width: 640px) { .two { grid-template-columns: 1fr; } }

.attached { display: grid; gap: 6px; font: 400 14.5px/1.4 var(--typed); }
.attached div { border-left: 4px solid var(--tint); padding-left: 8px; }

/* threshold */
.slider { background: var(--tint); border: var(--rule); padding: 12px 14px; margin: 16px 0 10px; }
.slider label { display: block; font-weight: 600; margin-bottom: 6px; }
.slider output { font-family: var(--typed); color: var(--ink); font-weight: 700; }
input[type=range] { width: 100%; accent-color: var(--print); height: 28px; }
.tally { display: grid; grid-template-columns: repeat(3, 1fr); border: var(--rule); background: var(--box); margin-bottom: 10px; }
.tally div { padding: 9px 12px; border-right: 1px solid var(--print); font-size: 14.5px; line-height: 1.3; }
.tally div:last-child { border-right: 0; }
.tally b { display: block; font: 700 24px/1.1 var(--typed); color: var(--ink); }
.tally .bad b { color: var(--stamp); }
.inbox { list-style: none; margin: 0 0 18px; padding: 0; border: var(--rule); background: var(--box); }
.inbox li { display: grid; grid-template-columns: 3.2em 1fr auto; gap: 10px; align-items: baseline; padding: 7px 12px; border-bottom: 1px solid var(--tint); font-size: 15px; line-height: 1.35; }
.inbox li:last-child { border-bottom: 0; }
.inbox li > span:first-child { font: 700 15px var(--typed); color: var(--ink); }
.inbox li .verdict { font-size: 13px; font-weight: 600; white-space: nowrap; }
.inbox li.person { background: repeating-linear-gradient(135deg, transparent 0 7px, #12382b0d 7px 9px); }
.inbox li.person .verdict { color: var(--pencil); }
.inbox li.wrong { background: #c1272d1a; } .inbox li.wrong .verdict { color: var(--stamp); }
@media (max-width: 520px) { .inbox li { grid-template-columns: 3em 1fr; } .inbox li .verdict { grid-column: 2; } .tally b { font-size: 20px; } }

/* noughts and crosses */
.ttt-wrap { display: grid; grid-template-columns: minmax(0, 300px) 1fr; gap: 22px; align-items: start; margin: 18px 0; }
@media (max-width: 640px) { .ttt-wrap { grid-template-columns: 1fr; } }
.ttt { display: grid; grid-template-columns: repeat(3, 1fr); border: var(--rule); background: var(--print); gap: 2px; max-width: 300px; }
.ttt button { aspect-ratio: 1; border: 0; border-radius: 0; background: var(--box); font: 800 46px/1 var(--sans); cursor: pointer; position: relative; padding: 0; color: var(--print); }
.ttt button:disabled { cursor: default; color: var(--print); }
.ttt button.o { color: var(--ink); font-family: var(--typed); }
.ttt button i { position: absolute; inset: auto 0 0 0; height: var(--p, 0%); background: #1b3f9e2e; }
.ttt button small { position: absolute; right: 5px; bottom: 3px; font: 700 12px var(--typed); color: var(--ink); }
.status { font-weight: 600; min-height: 3em; margin-bottom: 8px; }
.score-line { font-family: var(--typed); color: var(--pencil); font-size: 15px; }
.ttt-wrap .actions { padding: 0; }

/* paint */
.paint-wrap { display: grid; grid-template-columns: minmax(0, 300px) 1fr; gap: 22px; align-items: start; margin: 6px 0 16px; }
@media (max-width: 640px) { .paint-wrap { grid-template-columns: 1fr; } }
canvas { width: 100%; max-width: 300px; aspect-ratio: 1; image-rendering: pixelated; border: var(--rule); background: var(--box); display: block; }
.check { display: flex; gap: 8px; align-items: center; font-size: 15.5px; margin-bottom: 8px; }
.check input { width: 20px; height: 20px; accent-color: var(--print); }

/* tables */
.marks { width: 100%; border-collapse: collapse; border: var(--rule); background: var(--box); margin: 16px 0 18px; font-size: 15.5px; }
.marks th, .marks td { padding: 9px 12px; border-bottom: 1px solid var(--tint); text-align: left; vertical-align: top; }
.marks th { background: var(--tint); font-weight: 600; font-size: 14.5px; border-bottom: 1px solid var(--print); }
.marks td.n { font: 700 16px var(--typed); color: var(--ink); white-space: nowrap; text-align: right; }
.marks td.bad { color: var(--stamp); }
.marks tr:last-child td { border-bottom: 0; }

.found, .tests { padding-left: 0; list-style: none; display: grid; gap: 14px; max-width: 38em; }
.tests { counter-reset: t; } .tests li { counter-increment: t; padding-left: 44px; position: relative; }
.tests li::before { content: counter(t); position: absolute; left: 0; top: 0; width: 30px; height: 30px; border: var(--rule); background: var(--box); display: grid; place-items: center; font: 700 16px var(--typed); }
.found li { border-left: 5px solid var(--print); padding-left: 14px; }
.found b, .tests b { display: block; }

.words { display: grid; grid-template-columns: 8.5em 1fr; border: var(--rule); background: var(--tint); margin: 16px 0; }
.words dt { padding: 10px 14px; font-weight: 800; border-bottom: 1px solid var(--print); }
.words dd { margin: 0; padding: 10px 14px; background: var(--box); border-left: 1px solid var(--print); border-bottom: 1px solid var(--print); font-size: 16px; }
.words dt:last-of-type, .words dd:last-of-type { border-bottom: 0; }
@media (max-width: 520px) { .words { grid-template-columns: 1fr; } .words dt { border-bottom: 0; padding-bottom: 0; } .words dd { border-left: 0; background: transparent; padding-top: 4px; } }

footer { margin-top: 56px; padding-top: 18px; padding-bottom: 60px; border-top: var(--rule); font-size: 15px; color: var(--pencil); }

/* small fixes after looking at it */
.actions .stamp { margin: 4px 10px 4px 2px; }
#order-form .field { grid-template-columns: minmax(0, 13em) minmax(0, 1fr); }
#order-form .field > div:not(.lab) { padding: 7px 12px; min-height: 0; }
#order-form .field > .lab { padding: 7px 14px; }
#order-form .yesno { grid-template-columns: 1fr 3em; align-items: center; gap: 10px; }
#order-form .meter { height: 16px; }
@media (max-width: 600px) { #order-form .field { grid-template-columns: 8.5em 1fr; } #order-form .field > div:not(.lab) { border-top: 0; border-left: 1px solid var(--print); } }
