/* The home page: the header (shell), then the contest kit. On a landscape
   computer screen, with the script, the kit is in a toolbox drawn in
   perspective whose lid opens as the page scrolls (home.js). Anywhere else
   (phones, tablets either way up, no script) the same markup is the kit laid
   out on a table: the first-timer page across the top, then each piece over
   its label, as many to a row as fit. */

body { margin: 0; background: var(--tc-white); color: var(--tc-black); font: 400 17px/1.6 var(--tc-text); -webkit-text-size-adjust: 100%; }
* { box-sizing: border-box; }
p, li { text-wrap: pretty; }

/* ---------- the header, a little shorter than the shell's ---------- */
.tc-hero--home .tc-slab { padding-top: 32px; padding-bottom: 34px; }
.tc-hero--home .tc-slab h1 { font-size: clamp(34px, 4.2vw, 48px); }
.tc-hero--home .tc-lede { max-width: 64ch; }
@media (min-width: 761px) { .tc-hero--home .tc-patch { width: clamp(150px, 17vw, 210px); } }

/* ---------- the kit ---------- */
.kit { padding: 30px 0 64px; }
.kit > h2 { margin: 0; text-align: center; font: 700 15px/1.3 var(--tc-display); letter-spacing: .06em; text-transform: uppercase; color: var(--tc-hint-ink); }

/* The first-timer page, across the top of the table. */
.manual { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 22px; padding: 18px 22px; background: var(--tc-yellow); color: var(--tc-black); border: 2px solid var(--tc-black); border-radius: var(--tc-radius); box-shadow: 5px 5px 0 var(--tc-black); text-decoration: none; text-align: left; }
.manual .tag { display: none; }
.manual b { font: 800 21px/1.2 var(--tc-display); }
.manual span:not(.tag) { flex: 1 1 300px; font: 400 16.5px/1.45 var(--tc-text); }
.manual i { font: 800 17px/1 var(--tc-display); font-style: normal; white-space: nowrap; text-decoration: underline; }
.manual:hover { background: #ffd21f; }
.manual:focus-visible, .tape:focus-visible { outline: 3px solid var(--tc-navy); outline-offset: 4px; }

/* Each tool's label, under its piece; the piece goes to the same tool, and
   pointing at either lights both (home.js). */
.tape { display: block; text-align: center; text-decoration: none; color: var(--tc-navy); }
.tape b { display: block; font: 700 16px/1.3 var(--tc-display); text-decoration: underline; }
.tape small { display: block; max-width: 240px; margin: 4px auto 0; font: 400 14px/1.4 var(--tc-text); color: var(--tc-hint-ink); }
.tape .testing { display: inline-block; margin-top: 6px; padding: 1px 7px; font: 700 12px/1.6 var(--tc-display); background: #fff3c4; color: #5a4500; border-radius: var(--tc-radius); }
.tape:hover b, .tape.hot b { text-decoration-thickness: 3px; }
.art { position: relative; z-index: 2; display: block; text-decoration: none; color: inherit; }
.art .d { transition: transform .15s; }
.art.hot .d { transform: translateY(-6px) rotate(0deg); }

/* ---------- drawings of what each tool makes (as on Your first contest) ---------- */
/* ---------- the drawings: what each tool makes ---------- */
.d { position: relative; display: block; font-size: 11px; line-height: 1.35; color: var(--tc-black); }
.d span { display: block; }
.d .tc-patch { position: absolute; z-index: 2; width: 74px; height: 74px; filter: drop-shadow(0 2px 2px rgb(0 0 0 / .25)); }

.d-phone { width: 150px; height: 270px; padding: 26px 10px 18px; background: #1c1c1c; border-radius: 26px; box-shadow: 0 10px 24px rgb(0 0 0 / .22); transform: rotate(-4deg); }
.d-phone .scr { display: flex; flex-direction: column; gap: 5px; height: 100%; padding: 10px; background: var(--tc-white); border-radius: 6px; }
.d-phone .ttl { padding-bottom: 5px; border-bottom: 1.5px solid var(--tc-black); font: 700 9.5px/1.25 var(--tc-display); color: var(--tc-hint-ink); }
.d-phone .ln { height: 5px; background: #e6e8f4; }
.d-phone .sig { margin-top: auto; padding-bottom: 2px; border-bottom: 1.5px solid var(--tc-black); font: 700 17px/1.1 var(--tc-hand); color: var(--tc-navy); }
.d-phone .ok { align-self: flex-start; margin-top: 6px; padding: 2px 7px; background: var(--tc-go); border-radius: 3px; font: 700 9.5px/1.4 var(--tc-display); color: #fff; }
.d-phone .tc-patch { top: -24px; right: -34px; transform: rotate(10deg); }

.d-booklet { display: flex; width: 250px; transform: rotate(-2deg); filter: drop-shadow(0 8px 16px rgb(0 0 0 / .2)); }
.d-booklet .pg { flex: 1; aspect-ratio: 1 / 1.414; padding: 10px; overflow: hidden; background: var(--tc-white); border: 1px solid #d9dbe8; }
.d-booklet b { display: block; margin-bottom: 5px; font: 700 9px/1.2 var(--tc-display); color: var(--tc-navy); }
.d-booklet .thanks { margin-top: 8px; }
.d-booklet .bar { height: 5px; margin: 3px 0; background: #e6e8f4; }
.d-booklet .ch { display: grid; gap: 3px; margin-top: 5px; }
.d-booklet .ch i { display: block; height: 9px; margin: 0 auto; background: var(--tc-navy); }
.d-booklet .ch .row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 2px; }
.d-booklet .ch .row i { width: auto; height: 8px; background: #c9cbe6; }
.d-booklet .ch i.y { background: var(--tc-yellow); outline: 1.5px solid var(--tc-black); }
.d-booklet .tc-patch { bottom: -28px; left: -28px; transform: rotate(-10deg); }

.d-folder { width: 240px; margin-top: 24px; padding: 22px 16px 16px; background: #f2d98f; border-radius: 0 6px 6px 6px; box-shadow: 0 10px 24px rgb(0 0 0 / .18); transform: rotate(2deg); }
.d-folder::before { content: ""; position: absolute; left: 0; top: -20px; width: 50%; height: 21px; background: inherit; border-radius: 6px 6px 0 0; }
.d-folder .tab { position: absolute; top: -15px; left: 12px; font: 700 12.5px/1 var(--tc-display); color: var(--tc-navy); }
.d-folder .divs { display: grid; gap: 4px; }
.d-folder .divs > span { padding: 4px 8px; background: #fbf3dc; border-radius: 3px 3px 0 0; box-shadow: inset 0 2px 0 var(--tc-navy); font: 700 10.5px/1.2 var(--tc-display); }
.d-folder small { display: block; font: 9.5px/1.3 var(--tc-typed); color: #4b3d12; }
.d-folder .tc-patch { top: -40px; right: -26px; transform: rotate(8deg); }

.d-script { width: 230px; margin-top: 16px; padding: 28px 14px 14px 30px; background: var(--tc-white) linear-gradient(transparent 19px, #dfe6f5 19px) 0 10px / 100% 20px; box-shadow: 0 10px 24px rgb(0 0 0 / .18); transform: rotate(-2deg); }
.d-script::before { content: ""; position: absolute; top: 0; bottom: 0; left: 22px; width: 1.5px; background: #f0b6b6; }
.d-script .clip { position: absolute; top: -12px; left: 50%; width: 80px; height: 24px; margin-left: -40px; background: #2e2e33; border-radius: 6px 6px 3px 3px; }
.d-script .typed { font: 11px/20px var(--tc-typed); }
.d-script mark { background: #ffe27a; color: inherit; }
.d-script .tc-patch { top: -34px; right: -30px; transform: rotate(-6deg); }

.d-cert { width: 240px; padding: 6px; background: #fffdf7; box-shadow: 0 10px 24px rgb(0 0 0 / .18); transform: rotate(1.5deg); text-align: center; }
.d-cert .fr { padding: 16px 10px 18px; border: 4px double var(--tc-navy); }
.d-cert .of { font: 600 9.5px var(--tc-text); color: var(--tc-hint-ink); }
.d-cert b { display: block; margin-top: 4px; font: 700 15px/1.15 var(--tc-display); color: var(--tc-navy); }
.d-cert .rule { width: 70px; height: 2px; margin: 8px auto 6px; background: var(--tc-yellow); }
.d-cert .nm { font: 700 15px/1.2 var(--tc-hand); }
.d-cert .tc-patch { bottom: -30px; right: -22px; transform: rotate(6deg); }


/* ---------- anywhere but a landscape computer screen: the table ---------- */
.toolbox { margin: 22px 0 0; padding: 30px 30px 46px; background: var(--tc-tint) linear-gradient(#ebe7d8 1px, transparent 1px) 0 0 / 22px 22px; border: 1px solid #e3dfcf; border-radius: 6px; }
.toolbox .back, .toolbox .front, .toolbox .outer, .toolbox .skirt, .toolbox .shade { display: none; }
.lid .manual { max-width: 900px; margin: 0 auto; }
.items { box-sizing: border-box; margin: 46px 0 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-start; gap: 50px 56px; }
.slot { display: flex; flex-direction: column; align-items: center; }
.cell { display: flex; justify-content: center; }
.slot .tape { margin-top: 22px; }
@media (max-width: 560px) {
  .toolbox { padding: 22px 12px 34px; }
  .items { gap: 44px 20px; }
}

/* ---------- on a landscape computer screen, with the script: the toolbox ----------
   A 1200×760 stage, scaled to the width by home.js. Back of the box, the lid
   (3D, hinged at the back), the kit standing in the box, the lid's shadow,
   the front wall over the pieces' feet, and the labels on the front. */
@media (min-width: 1024px) and (orientation: landscape) and (hover: hover) and (pointer: fine) {
  .kit-js .toolbox { position: relative; max-width: 1120px; margin: 22px auto 0; padding: 0; background: none; border: 0; border-radius: 0; }
  /* The first-timer page, taped inside the lid. */
  .kit-js .manual { position: relative; display: grid; gap: 6px; max-width: 600px; margin: 0 auto; padding: 18px 20px 16px; background: #fffef8; border-radius: 4px; box-shadow: 3px 4px 0 rgb(0 0 0 / .35); }
  .kit-js .manual::before, .kit-js .manual::after { content: ""; position: absolute; top: -12px; width: 74px; height: 24px; background: rgb(240 232 200 / .9); border: 1px solid rgb(0 0 0 / .1); }
  .kit-js .manual::before { left: 18px; transform: rotate(-8deg); }
  .kit-js .manual::after { right: 18px; transform: rotate(7deg); }
  .kit-js .manual .tag { display: block; justify-self: start; padding: 2px 8px; background: var(--tc-navy); color: var(--tc-yellow); font: 800 12px/1.5 var(--tc-display); letter-spacing: .06em; text-transform: uppercase; }
  .kit-js .manual span:not(.tag) { font-size: 15.5px; }
  .kit-js .manual i { color: var(--tc-navy); }
  .kit-js .manual:hover { background: #fff6d0; }
  .kit-js .manual:focus-visible, .kit-js .tape:focus-visible { outline: 3px solid var(--tc-yellow); outline-offset: 3px; box-shadow: 0 0 0 6px var(--tc-black); }
  /* Each label as a label-maker strip on the front of the box. */
  .kit-js .tape { position: relative; z-index: 4; padding: 9px 12px 10px; background: linear-gradient(#262626, #111); color: #fff; border-radius: 4px; box-shadow: 0 2px 0 rgb(0 0 0 / .45), inset 0 1px 0 rgb(255 255 255 / .12); }
  .kit-js .tape b { font-weight: 800; letter-spacing: .05em; text-transform: uppercase; text-decoration: none; }
  .kit-js .tape small { max-width: none; color: #d4d4da; }
  .kit-js .tape:hover b, .kit-js .tape.hot b { text-decoration: underline; text-decoration-thickness: auto; text-underline-offset: 3px; }
  .kit-js .tape.hot { background: var(--tc-navy); box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--tc-navy); }
  .kit-js .art.hot .d { transform: translateY(-10px) rotate(0deg); }

  .kit-js .stage { position: absolute; top: 0; left: 0; width: 1200px; height: 760px; transform-origin: 0 0;
    /* The camera puts the shut lid's front edge exactly on the box's rim. */
    perspective: 2149px; perspective-origin: 600px -623px; }
  .kit-js .back, .kit-js .front { display: block; position: absolute; inset: 0; width: 100%; height: 100%; }
  .kit-js .back { z-index: 0; }
  .kit-js .front { z-index: 3; pointer-events: none; }

  .kit-js .lid { position: absolute; z-index: var(--lidz, 1); left: 86px; top: 10px; width: 1028px; height: 290px; transform-origin: 50% 100%; transform-style: preserve-3d; transform: rotateX(var(--lid, 12deg)); }
  .kit-js .lid > * { outline: 1px solid transparent; will-change: transform; }
  .kit-js .lid .face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border: 5px solid var(--tc-black); border-radius: 0; }
  .kit-js .lid .inner { display: block; padding: 30px 56px 26px; background: linear-gradient(#e9b200, #d9a300); filter: brightness(var(--lidlight, 1)); }
  .kit-js .lid .panel { border: 5px solid #b88a00; border-radius: 8px; box-shadow: inset 0 0 0 2px #f6c726; height: 100%; display: flex; align-items: center; justify-content: center; padding: 10px 20px; border-width: 5px; }
  .kit-js .lid .outer { display: grid; place-items: center; align-content: center; gap: 26px; padding-bottom: 70px; transform: rotateX(180deg);
    background:
      linear-gradient(90deg, rgb(0 0 0 / .14), transparent 9%, transparent 91%, rgb(0 0 0 / .14)),
      linear-gradient(transparent 0 30px, rgb(0 0 0 / .18) 30px 34px, rgb(255 255 255 / .35) 34px 37px, transparent 37px calc(100% - 37px), rgb(255 255 255 / .35) calc(100% - 37px) calc(100% - 34px), rgb(0 0 0 / .18) calc(100% - 34px) calc(100% - 30px), transparent calc(100% - 30px)),
      linear-gradient(#b88a00, #e5b000 25%, var(--tc-yellow) 60%, #ffd84a); }
  /* Seen from above at a steep angle, the lid's outside is foreshortened:
     its handle and label are stretched to read the right way up. */
  .kit-js .outer > * { transform: scaleY(2.4); }
  .kit-js .grip { position: relative; width: 340px; height: 40px; background: linear-gradient(#3a3a40, #111); border: 4px solid var(--tc-black); border-radius: 20px; box-shadow: 0 6px 0 rgb(0 0 0 / .25); }
  .kit-js .grip::before, .kit-js .grip::after { content: ""; position: absolute; top: 6px; width: 46px; height: 22px; background: linear-gradient(#cfcfd6, #77777f); border: 3px solid var(--tc-black); border-radius: 4px; }
  .kit-js .grip::before { left: -30px; }
  .kit-js .grip::after { right: -30px; }
  .kit-js .grip i { position: absolute; inset: 10px 40px; border-radius: 8px; background: repeating-linear-gradient(90deg, #222 0 6px, #3a3a40 6px 10px); }
  .kit-js .lidtape { padding: 10px 18px; }
  .kit-js .lidtape b { font-size: 22px; }
  /* The lid's lip, along its free edge and down each side, tucked just inside
     the face's border so no daylight shows between them. */
  .kit-js .skirt { display: block; position: absolute; background: linear-gradient(#f2b800, #c99600); border: 4px solid var(--tc-black); }
  .kit-js .skirt.front { left: 0; right: 0; top: 3px; height: 28px; transform-origin: 50% 0; transform: rotateX(90deg); border-radius: 0 0 8px 8px; background: linear-gradient(#ffd23a, #e0a800 60%, #b88a00); }
  .kit-js .skirt.left { left: 3px; top: 0; bottom: -10px; width: 28px; transform-origin: 0 50%; transform: rotateY(-90deg); }
  .kit-js .skirt.right { right: 3px; top: 0; bottom: -10px; width: 28px; transform-origin: 100% 50%; transform: rotateY(90deg); }
  .kit-js .catch { position: absolute; bottom: -4px; width: 56px; height: 20px; background: linear-gradient(#f0f0f3, #a4a4ac 55%, #6c6c74); border: 3px solid var(--tc-black); border-radius: 4px 4px 2px 2px; }
  .kit-js .catch:first-child { left: 252px; }
  .kit-js .catch:last-child { left: 720px; }
  .kit-js .toolbox:not(.open) .inner { pointer-events: none; }
  .kit-js .toolbox.open .outer { pointer-events: none; }

  /* The kit: each piece in a cell that stands in the box, its label on the
     front wall below. Only the drawings take the pointer, never the empty
     cells, which overlap the bottom of the lid. */
  .kit-js .items { position: absolute; left: 110px; right: 110px; top: 160px; bottom: 0; margin: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0 14px; pointer-events: none; }
  .kit-js .slot { position: relative; display: block; }
  .kit-js .cell { box-sizing: border-box; position: absolute; left: -40px; right: -40px; top: 0; height: 290px; padding: 0 0 30px; align-items: flex-end; }
  /* Shut, nothing pokes up over the back of the box. */
  .kit-js .toolbox.shut .cell { top: 140px; height: 150px; overflow: hidden; }
  .kit-js .cell .d { zoom: .7; pointer-events: auto; }
  .kit-js .slot .tape { position: absolute; left: 0; right: 0; top: 362px; width: auto; margin: 0; pointer-events: auto; }
  /* A low lid shades the inside of the box, from the back. */
  .kit-js .shade { display: block; position: absolute; z-index: 2; inset: 0; pointer-events: none; clip-path: polygon(100px 300px, 1100px 300px, 1170px 444px, 30px 444px);
    background: linear-gradient(rgb(0 0 0 / .9), rgb(0 0 0 / .45) 444px); opacity: var(--boxshade, 0); }
}
