/* The builder page: an exam paper cover, two model answers, an answer booklet and a typed-up prompt. */

.skip {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 60;
  padding: 8px 14px;
  background: var(--card);
  color: var(--ink);
  font-weight: 700;
}
.skip:focus {
  top: 12px;
}

.wrap {
  max-width: 1340px;
  margin: 0 auto;
  padding: 22px 22px 48px;
}

/* ---------------------------------------------------------------- the cover */
.cover {
  padding: 26px 34px 24px;
}
.cover-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
}
.logo {
  display: block;
  width: auto;
  height: 50px;
}
.paper-box {
  position: relative;
  display: grid;
  grid-auto-flow: column;
  margin: 0;
  border: 1.5px solid var(--ink);
}
.paper-box > div {
  padding: 6px 14px 5px;
  min-width: 96px;
}
.paper-box > div + div {
  border-left: 1.5px solid var(--ink);
}
.paper-box dt {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--pencil);
}
.paper-box dd {
  position: relative;
  margin: 0;
  font-family: var(--typed);
  font-weight: 700;
  font-size: 17px;
  white-space: nowrap;
}
.scribble {
  position: absolute;
  left: -6px;
  top: 100%;
  margin-top: 12px;
  font-weight: 400;
  font-size: 17px;
  line-height: 1;
  transform: rotate(-3deg);
  transform-origin: left top;
}
.cover-kicker {
  margin-top: 22px;
  letter-spacing: 0.2em;
}
h1 {
  margin: 2px 0 10px -3px;
  font-weight: 900;
  font-size: clamp(46px, 7.2vw, 96px);
  line-height: 0.92;
  letter-spacing: -0.04em;
}
.dot {
  color: var(--pen);
}
.strap {
  max-width: 58ch;
  font-size: 19px;
  line-height: 1.4;
}
.instructions {
  margin-top: 20px;
  padding-top: 12px;
  border-top: 1.5px solid var(--ink);
}
.instructions ol {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px 28px;
  margin-top: 8px;
  padding: 0;
  list-style: none;
  counter-reset: step;
}
.instructions li {
  position: relative;
  padding-left: 26px;
  font-size: 15px;
  line-height: 1.4;
  counter-increment: step;
}
.instructions li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  font-weight: 800;
}

.lost {
  max-width: 860px;
  padding-top: 8vh;
}
.lost-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}
.notice {
  margin-top: 22px;
  padding: 16px 22px;
  font-weight: 600;
}

/* ---------------------------------------------------------------- the model answers (index cards) */
.models {
  margin-top: 34px;
}
.models-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 18px;
  margin: 0 6px 14px;
}
.model-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 26px;
}
.model {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 20px;
  align-items: end;
  padding: 16px 22px 18px;
  transform: rotate(-0.55deg);
}
.model:nth-child(even) {
  transform: rotate(0.45deg);
}
.model > * {
  grid-column: 1 / -1;
}
.model-kicker {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 7px;
  border-bottom: 2px solid var(--margin-line);
  color: var(--pen-deep);
}
.model-tag {
  color: var(--pencil);
  letter-spacing: 0.1em;
}
.model h3 {
  margin-top: 8px;
  font-size: 23px;
  font-weight: 800;
  letter-spacing: -0.015em;
  line-height: 1.15;
}
.model-blurb {
  font-size: 15px;
  color: var(--pencil);
}
.model-bare {
  grid-column: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 8px;
  margin-top: 8px;
}
.model-bare .printed-caps {
  flex-basis: 100%;
  font-size: 10.5px;
  color: var(--pencil);
}
.model-line {
  font-size: 15.5px;
}
.model > .tape {
  grid-column: 2;
  grid-row: 4;
  align-self: end;
}

/* ---------------------------------------------------------------- the two columns */
.workbench {
  display: grid;
  grid-template-columns: minmax(0, 1.06fr) minmax(0, 1fr);
  gap: 30px;
  align-items: start;
  margin-top: 36px;
}

/* ---------------------------------------------------------------- the answer booklet */
.booklet {
  --gutter: 58px; /* the margin, left of the red line */
  padding: 22px 0 30px;
  background-image:
    linear-gradient(90deg, transparent var(--gutter), var(--margin-line) var(--gutter), var(--margin-line) calc(var(--gutter) + 1.5px), transparent calc(var(--gutter) + 1.5px)),
    url("paper.png");
  background-color: var(--paper);
}
.booklet::before {
  content: "";
  position: absolute;
  left: 20px;
  top: 22px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--desk-deep);
  box-shadow:
    inset 0 2px 3px rgba(0, 0, 0, 0.55),
    0 1px 0 rgba(255, 255, 255, 0.6);
}
.booklet-head {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 62px;
  padding: 0 22px 0 calc(var(--gutter) + 18px);
}
.booklet-head h2 {
  letter-spacing: 0.2em;
}
.score {
  margin-left: auto;
}
.score-ring {
  position: relative;
  display: grid;
  place-items: center;
  width: 96px;
  height: 66px;
  transform: rotate(-4deg);
}
.score-ring .drawn {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}
.score-number {
  font-weight: 700;
  font-size: 30px;
  line-height: 1;
  padding-top: 5px;
}

.section {
  margin-top: 18px;
}
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 0 20px 0 calc(var(--gutter) + 18px);
}
.section-head h3 {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 16px;
  font-size: 25px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.section-letter {
  letter-spacing: 0.18em;
}
.marks {
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}
.section-intro {
  padding: 4px 70px 0 calc(var(--gutter) + 18px);
  font-size: 15px;
  color: var(--pencil);
}

.q {
  display: grid;
  grid-template-columns: var(--gutter) minmax(0, 1fr) 52px;
  margin-top: 16px;
}
.q-num {
  padding-right: 10px;
  font-weight: 800;
  font-size: 16px;
  text-align: right;
}
.q-body {
  min-width: 0;
  margin: 0;
  padding: 0 0 0 18px;
  border: 0;
}
.q-label {
  display: block;
  padding: 0;
  font-weight: 700;
  font-size: 16px;
}
.q-hint {
  font-size: 13.5px;
  line-height: 1.4;
  color: var(--pencil);
}
.q-mark {
  position: relative;
  padding-top: 1px;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  color: var(--pencil);
}
.q-mark .drawn-tick {
  position: absolute;
  left: 8px;
  top: 16px;
  width: 38px;
  height: 34px;
  overflow: visible;
}

/* an answer: the printed lead-in, then dotted lines to write on */
.answer {
  position: relative;
  margin-top: 5px;
  border-radius: 2px;
}
.stem {
  position: absolute;
  left: 2px;
  top: 0;
  font-weight: 700;
  font-size: 15.5px;
  line-height: 30px;
  color: var(--pencil);
  pointer-events: none;
}
.answer textarea {
  display: block;
  width: 100%;
  min-height: 60px;
  padding: 0 2px;
  border: 0;
  border-radius: 0;
  outline: 0;
  resize: none;
  overflow: hidden;
  background-color: transparent;
  background-image: radial-gradient(circle at 1.2px 1.2px, var(--rule) 1.1px, transparent 1.4px);
  background-size: 6px 30px;
  background-position: 0 24px;
  background-attachment: local;
  font-family: var(--typed);
  font-size: 15.5px;
  line-height: 30px;
  color: var(--ink);
}
.answer textarea::placeholder {
  color: var(--faint);
  opacity: 1;
  font-style: italic;
}
.answer:focus-within {
  outline: 2.5px solid var(--biro);
  outline-offset: 5px;
}
.section-scene .q.active .q-label {
  box-shadow: inset 0 -0.55em 0 var(--hl-scene);
}
.section-ask .q.active .q-label {
  box-shadow: inset 0 -0.55em 0 var(--hl-ask);
}
.q-label {
  width: fit-content;
}

/* the steering tick-boxes */
.options {
  display: grid;
  gap: 12px;
  margin-top: 10px;
}
.option {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 1px 8px;
}
.option input {
  appearance: none;
  -webkit-appearance: none;
  grid-row: 1 / span 2;
  width: 24px;
  height: 24px;
  margin: 1px 0 0;
  border: 2px solid var(--ink);
  border-radius: 3px 6px 4px 7px / 6px 3px 7px 4px;
  background: transparent center / 120% no-repeat;
  transform: rotate(-2deg);
  cursor: pointer;
}
.option input:checked {
  background-image: url("tick.svg");
}
.option label {
  cursor: pointer;
}
.option-name {
  display: block;
  font-weight: 700;
}
.option-says {
  display: block;
  font-size: 14.5px;
  line-height: 1.45;
}
.option-says .hl {
  background-image: none;
}
.option input:checked + label .option-says .hl {
  background-image: linear-gradient(transparent 8%, var(--hl-steer) 8%, var(--hl-steer) 90%, transparent 90%);
}
.option .q-hint {
  grid-column: 2;
}

/* lines for afterwards: a tear-off strip */
.afterwards {
  margin: 22px 20px 0 calc(var(--gutter) + 18px);
  padding-top: 16px;
  border-top: 2px dashed #aeb9c2;
}
.lines {
  display: grid;
  gap: 9px;
  margin-top: 10px;
  padding: 0;
  list-style: none;
}
.lines li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0 12px;
  align-items: start;
}
.line-says {
  font-size: 14.5px;
  line-height: 1.5;
}
.line-why {
  grid-column: 1;
  font-size: 16.5px;
  line-height: 1.25;
}
.line-copy {
  grid-column: 2;
  grid-row: 1;
}
.end-mark {
  margin-top: 30px;
  text-align: center;
  letter-spacing: 0.26em;
}

/* ---------------------------------------------------------------- the marking (red pen on the booklet) */
.marking {
  margin: 6px 22px 6px calc(var(--gutter) + 18px);
  padding: 4px 0 16px;
  border-bottom: 2px dashed var(--margin-line);
  scroll-margin-top: 16px;
}
.marking-top {
  display: flex;
  align-items: center;
  gap: 22px;
  min-height: 54px;
}
.marking-title {
  font-weight: 700;
  font-size: 34px;
  line-height: 1;
  outline: 0;
}
.marking .stamp {
  font-size: 23px;
}
.marking-summary {
  margin-top: 6px;
  font-size: 21px;
  line-height: 1.32;
}
.marking-privacy {
  position: relative;
  margin: 8px 0;
  padding: 10px 16px;
  font-size: 19px;
  line-height: 1.3;
}
.marking-privacy .drawn {
  position: absolute;
  inset: -4px;
  width: calc(100% + 8px);
  height: calc(100% + 8px);
  overflow: visible;
}
.marking-privacy .drawn path {
  vector-effect: non-scaling-stroke;
  stroke-width: 2.5;
}
.marking-block {
  margin-top: 12px;
  font-size: 19px;
  line-height: 1.32;
}
.marking-block h4 {
  font-weight: 700;
  font-size: 20px;
}
.marking-block abbr,
.note-tag {
  padding: 0 5px;
  border: 2px solid currentColor;
  border-radius: 46% 54% 48% 52% / 58% 44% 56% 42%;
  font-weight: 700;
  font-size: 0.82em;
  text-decoration: none;
}
.ticks,
.asks {
  margin-top: 2px;
  padding: 0;
  list-style: none;
}
.ticks li,
.asks li {
  position: relative;
  padding-left: 30px;
}
.ticks .drawn,
.asks .drawn {
  position: absolute;
  left: 2px;
  top: 3px;
  width: 20px;
  height: 20px;
  overflow: visible;
}
.asks .drawn {
  width: 14px;
  left: 6px;
}
.pen-link {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.stronger {
  margin-top: 12px;
}
.stronger summary {
  width: fit-content;
  font-weight: 700;
  font-size: 20px;
  cursor: pointer;
}
.stronger-text {
  margin: 8px 0 12px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.6);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.12);
  font-size: 14.5px;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.marking-small {
  margin-top: 14px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--pencil);
}
/* marking for an earlier draft stays readable, but its stamp fades and a note says so */
.marking.stale .stamp {
  opacity: 0.4;
}
.stale-flag {
  margin: 2px 0 6px;
  padding: 6px 12px;
  border: 2px dashed currentColor;
  font-size: 19px;
  font-weight: 700;
}
.marking-wait,
.marking-problem {
  font-size: 22px;
  font-weight: 700;
}
.dots i {
  display: inline-block;
  width: 5px;
  height: 5px;
  margin-left: 4px;
  border-radius: 50%;
  background: currentColor;
  animation: dot 1.2s infinite both;
}
.dots i:nth-child(2) {
  animation-delay: 0.2s;
}
.dots i:nth-child(3) {
  animation-delay: 0.4s;
}
@keyframes dot {
  0%,
  70%,
  100% {
    opacity: 0.15;
  }
  35% {
    opacity: 1;
  }
}

/* a red-pen note beside the box it is about */
.note {
  margin-top: 8px;
  font-size: 18.5px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}
.note-try {
  margin-top: 2px;
}
.note-example {
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
  box-shadow: inset 0 -1.5px 0 var(--pen);
}

/* ---------------------------------------------------------------- the typed-up prompt */
.side {
  position: sticky;
  top: 14px;
  min-width: 0;
}
.side-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 4px 10px;
}
.switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--desk-ink);
  cursor: pointer;
}
.switch input {
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  margin: 0;
  border: 2px solid var(--desk-ink);
  border-radius: 3px 5px 4px 6px / 5px 3px 6px 4px;
  background: transparent center / 120% no-repeat;
  cursor: pointer;
}
.switch input:checked {
  background-color: var(--hl-scene);
  background-image: url("tick-ink.svg");
}
.switch input:focus-visible {
  outline-color: #fff;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.controls .tape {
  flex: 1 1 auto;
}
.open-in {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin: 14px 4px 14px;
}
.open-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.tool {
  padding: 5px 11px 4px;
  background: var(--card);
  color: var(--ink);
  font-family: var(--typed);
  font-weight: 700;
  font-size: 14px;
  text-decoration: none;
  box-shadow:
    0 1px 0 rgba(0, 0, 0, 0.35),
    0 4px 8px rgba(0, 0, 0, 0.25);
  transition: transform 0.12s ease;
}
.tool:nth-child(odd) {
  transform: rotate(-1.2deg);
}
.tool:nth-child(even) {
  transform: rotate(0.9deg);
}
.tool:hover {
  transform: translateY(-2px) rotate(0deg);
}
.tool:focus-visible {
  outline-color: #fff;
}
.tool:not(.tool-school) {
  background: transparent;
  color: var(--desk-ink);
  box-shadow: inset 0 0 0 1.5px rgba(241, 237, 225, 0.55);
}
.fine {
  margin: 10px 4px 0;
  font-size: 13px;
  line-height: 1.45;
}

.typed-page {
  padding: 44px 20px 0 10px;
  max-height: max(260px, calc(100vh - 172px));
  overflow-y: auto;
  scrollbar-width: thin;
}
.typed-body {
  padding-bottom: 22px;
  font-family: var(--typed);
  font-size: 14px;
  line-height: 1.52;
  outline-offset: 6px;
}
/* when the prompt runs past the bottom of the sheet, a pencilled note says so */
.more-below {
  position: sticky;
  bottom: 0;
  display: none;
  justify-content: flex-end;
  margin: -34px -20px 0 -10px;
  padding: 16px 16px 4px;
  background: linear-gradient(rgba(250, 247, 239, 0), var(--paper) 62%);
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  pointer-events: none;
}
.typed-page.has-more .more-below {
  display: flex;
}
.typed-empty {
  padding: 0 0 6px 64px;
  color: var(--faint);
}
.para {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 0 12px;
}
.para + .para {
  margin-top: 15px;
}
.typed-text {
  overflow-wrap: anywhere;
}
.margin-note {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  padding-top: 1px;
  font-weight: 700;
  font-size: 17px;
  line-height: 1;
  transform: rotate(-4deg);
}
.margin-note .drawn {
  width: 34px;
  height: 17px;
  margin: 2px -2px 0 0;
  overflow: visible;
}
.margin-note .drawn path {
  stroke-width: 2.4;
}
.typed-body:not(.anatomy-on) .margin-note {
  visibility: hidden;
}
.typed-body:not(.anatomy-on) .hl {
  background-image: none;
}
.seg {
  cursor: pointer;
}
.seg.live {
  text-decoration: underline 2px var(--ink);
  text-underline-offset: 3px;
}
.seg.sweep {
  animation: sweep 0.5s ease-out both;
}
@keyframes sweep {
  from {
    background-size: 0% 100%;
  }
  to {
    background-size: 100% 100%;
  }
}
.caret {
  display: inline-block;
  width: 0.55em;
  height: 1.05em;
  margin-left: 3px;
  vertical-align: -0.18em;
  background: var(--ink);
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink {
  50% {
    opacity: 0;
  }
}
.stamp-spot {
  position: absolute;
  top: 9px;
  right: 16px;
  pointer-events: none;
}

.warnings {
  display: grid;
  gap: 8px;
}
.warnings p {
  margin-top: 12px;
  padding: 8px 14px;
  background: var(--card);
  font-size: 18px;
  line-height: 1.3;
  transform: rotate(-0.4deg);
}

.always {
  width: min(310px, 86%);
  margin: 4px 14px 0 auto;
}

/* ---------------------------------------------------------------- the small print, on the desk */
.footer {
  display: grid;
  gap: 8px;
  max-width: 78ch;
  margin-top: 56px;
  padding: 0 6px;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--desk-dim);
}
.footer a {
  color: var(--desk-ink);
  text-underline-offset: 3px;
}
.footer a:focus-visible {
  outline-color: #fff;
}

/* the buttons that follow you down the page on a narrow screen (hidden on a wide one) */
.dock {
  display: none;
}

/* ---------------------------------------------------------------- narrower screens */
@media (max-width: 1080px) {
  .instructions ol {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 940px) {
  .workbench {
    grid-template-columns: minmax(0, 1fr);
  }
  .side {
    position: static;
  }
  .typed-page {
    max-height: none;
  }
  .dock {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 9px 12px calc(9px + env(safe-area-inset-bottom, 0px));
    background: var(--desk-deep);
    box-shadow: 0 -1px 0 rgba(255, 255, 255, 0.14);
    transition: transform 0.2s ease;
  }
  .dock.away {
    transform: translateY(110%);
    visibility: hidden;
  }
  .dock-see {
    margin-right: auto;
    padding: 6px 2px;
    color: var(--desk-ink);
    font-size: 15px;
    font-weight: 700;
    text-underline-offset: 3px;
  }
  .dock-see:focus-visible,
  .dock .tape:focus-visible {
    outline-color: #fff;
  }
  body {
    padding-bottom: 60px;
  }
  .toast {
    bottom: 74px;
  }
  .side {
    scroll-margin-top: 12px;
  }
}
@media (max-width: 760px) {
  .wrap {
    padding: 12px 12px 40px;
  }
  .cover {
    padding: 20px 20px 20px;
  }
  .cover-top {
    flex-direction: column;
    gap: 16px;
  }
  .logo {
    height: 42px;
  }
  .paper-box > div {
    min-width: 0;
    padding: 5px 10px 4px;
  }
  .paper-box {
    margin-bottom: 26px;
  }
  .paper-box dd {
    position: static;
    font-size: 15.5px;
  }
  .scribble {
    left: 2px;
    margin-top: 7px;
    white-space: nowrap;
  }
  .model-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .model > .tape {
    grid-column: 1;
    grid-row: auto;
    justify-self: start;
    margin-top: 10px;
  }
  .booklet {
    --gutter: 34px;
  }
  .booklet-head,
  .section-head {
    padding-left: calc(var(--gutter) + 12px);
    padding-right: 12px;
  }
  .section-intro {
    padding: 4px 12px 0 calc(var(--gutter) + 12px);
  }
  .q {
    grid-template-columns: var(--gutter) minmax(0, 1fr) 40px;
  }
  .q-body {
    padding-left: 12px;
  }
  .q-num {
    padding-right: 6px;
  }
  .q-mark .drawn-tick {
    left: 2px;
  }
  .afterwards,
  .marking {
    margin-left: calc(var(--gutter) + 12px);
    margin-right: 12px;
  }
  .section-head h3 {
    font-size: 22px;
  }
  .para {
    grid-template-columns: 50px minmax(0, 1fr);
    gap: 0 8px;
  }
  .typed-empty {
    padding-left: 58px;
  }
  .margin-note {
    font-size: 15px;
  }
}
