/* Out of Wind: a dark shop, a lamp over the bench, paper notes. */

@font-face { font-family: "Young Serif"; src: url(../fonts/young-serif.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Alegreya Sans"; src: url(../fonts/alegreya-sans-400.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Alegreya Sans"; src: url(../fonts/alegreya-sans-700.woff2) format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Reenie Beanie"; src: url(../fonts/reenie-beanie.woff2) format("woff2"); font-weight: 400; font-display: swap; }

:root {
  --bg: #1d1712;
  --bench: #2b2018;
  --ink: #f3e9d8;
  --ink2: rgba(243, 233, 216, .74);
  --ink3: rgba(243, 233, 216, .5);
  --line: rgba(243, 233, 216, .14);
  --brass: #d9b066;
  --paper: #efe5d1;
  --paper-ink: #2b2018;
  --paper-ink2: #6b5a49;
  --red: #c4462f;
  --green: #4f7d4a;
  --disp: "Young Serif", Georgia, serif;
  --body: "Alegreya Sans", system-ui, sans-serif;
  --pencil: "Reenie Beanie", "Segoe Print", cursive;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg); color: var(--ink); font: 16px/1.45 var(--body);
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- the boards ---------- */
.home {
  max-width: 600px; margin: 0 auto; padding: calc(28px + var(--safe-t)) 16px calc(20px + var(--safe-b));
  min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column;
}
.masthead h1 { margin: 0; font: 400 46px/1 var(--disp); letter-spacing: -.01em; }
.masthead .lede { margin: 10px 0 0; color: var(--ink2); font-size: 17px; max-width: 30em; }
.masthead .progress { margin: 8px 0 0; font: 400 24px/1.1 var(--pencil); color: #e9b48a; }
.go {
  background: var(--brass); color: #22180f; border: 0; border-radius: 999px; padding: 11px 22px;
  font: 700 16px var(--body); box-shadow: 0 2px 0 rgba(0, 0, 0, .25);
}
.go:active { transform: translateY(1px); }
.home > .go { align-self: flex-start; margin-top: 20px; }
.rack { list-style: none; margin: 22px 0 0; padding: 0; display: grid; gap: 8px; }
.plank {
  width: 100%; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 10px;
  border: 0; border-radius: 6px; padding: 0; text-align: left; position: relative; overflow: hidden;
  background: #3a2c21; box-shadow: 0 2px 6px rgba(0, 0, 0, .35); min-height: 58px;
}
.plank canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.plank .label {
  position: relative; padding: 8px 12px; display: flex; flex-direction: column; gap: 1px;
  color: #241a12; text-shadow: 0 1px 0 rgba(255, 245, 225, .35);
}
.plank .label b { font: 400 17px/1.15 var(--disp); }
.plank .label span { font-size: 14px; color: rgba(36, 26, 18, .82); }
.plank.dark .label { color: var(--ink); text-shadow: 0 1px 2px rgba(0, 0, 0, .5); }
.plank.dark .label span { color: rgba(243, 233, 216, .85); }
.plank .grade {
  position: relative; margin-right: 12px; font: 400 26px/1 var(--pencil); color: #b3341f;
  transform: rotate(-6deg); text-shadow: 0 0 1px rgba(179, 52, 31, .6);
}
.plank.dark .grade { color: #f28a6c; }
.plank[aria-disabled="true"] { cursor: default; }
.plank[aria-disabled="true"]::after {
  content: ""; position: absolute; inset: 0; background: rgba(20, 15, 11, .62);
}
.plank[aria-disabled="true"] .label { color: var(--ink2); text-shadow: none; z-index: 1; }
.plank[aria-disabled="true"] .label span { color: var(--ink3); }
.plank .lock { position: relative; z-index: 1; margin-right: 16px; display: grid; color: var(--ink3); }
.plank .lock svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.rack li { position: relative; }
.rack li.noted .lock { visibility: hidden; }
/* A paper tag, pencilled: which board to finish first. */
.plank-note {
  position: absolute; right: 8px; top: 50%; margin: 0; z-index: 2; pointer-events: none;
  background: var(--paper); color: var(--paper-ink); border-radius: 5px; padding: 6px 12px 4px;
  font: 400 24px/1 var(--pencil); box-shadow: 0 3px 10px rgba(0, 0, 0, .45);
  transform: translateY(-50%) rotate(-2deg); animation: tag .16s ease-out;
}
@keyframes tag { from { opacity: 0; transform: translateY(-40%) rotate(-2deg); } }
.home-foot { margin-top: 18px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; color: var(--ink3); }
.quiet { background: none; border: 0; padding: 6px 0; color: var(--ink2); font-size: 15px; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line); }
.quiet:hover { color: var(--ink); }
.jd-foot { margin-top: auto; padding-top: 22px; text-align: center; font: 400 14px/1.4 var(--body); color: var(--ink3); }
.jd-foot a { color: inherit; text-decoration: none; border-radius: 2px; }
.jd-foot a:hover, .jd-foot a:focus-visible { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- the bench ---------- */
.bench {
  position: fixed; inset: 0; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; grid-template-columns: minmax(0, 1fr); background: var(--bench);
  user-select: none; -webkit-user-select: none;
}
/* On a phone the board's name has a row of its own, and the four marks a board is graded on share the row under it. */
.hud {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; column-gap: 4px;
  padding: calc(2px + var(--safe-t)) 6px 6px;
  background: linear-gradient(#1d1712, rgba(29, 23, 18, .92)); border-bottom: 1px solid rgba(0, 0, 0, .35); z-index: 2;
}
.icon {
  flex: none; width: 40px; height: 40px; border-radius: 50%; border: 0; background: transparent; display: grid; place-items: center;
}
.icon:active { background: rgba(243, 233, 216, .1); }
.icon svg { width: 22px; height: 22px; fill: none; stroke: var(--ink); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon svg circle { fill: var(--ink); stroke: none; }
.hud .name { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 8px; line-height: 1.15; }
.hud .name strong { flex: none; font: 400 17px var(--disp); white-space: nowrap; }
.hud .name span { min-width: 0; font-size: 14px; color: var(--ink2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stats { grid-row: 2; grid-column: 1 / -1; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
.hud #menuBtn { grid-row: 1; grid-column: 3; }
.stat { display: grid; grid-template-columns: auto; justify-items: center; line-height: 1.1; min-width: 0; }
.stat .k { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink3); }
.stat b { font: 700 16px var(--body); font-variant-numeric: tabular-nums; }
.stat .sub { font-size: 12px; color: var(--ink2); font-variant-numeric: tabular-nums; }
.stat.warn b { color: #f0a35e; }
.stat.over b { color: #ff8a6a; }
.stat.ok b { color: #bfdc9c; }
.stage { position: relative; overflow: hidden; touch-action: none; }
#cv { position: absolute; inset: 0; display: block; touch-action: none; }
.toast {
  position: absolute; left: 50%; top: 10px; transform: translateX(-50%); margin: 0; max-width: min(92%, 460px);
  background: rgba(21, 16, 12, .9); border: 1px solid var(--line); color: var(--ink); border-radius: 12px;
  padding: 8px 14px; font-size: 15px; line-height: 1.35; text-align: center; pointer-events: none;
  opacity: 0; transition: opacity .25s;
}
.toast.on { opacity: 1; }
.toast.on.dim { opacity: .16; } /* while a stroke is under way: the far end of the board is under it */
.loupe-note { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); margin: 0; }

.tray {
  display: flex; justify-content: center; gap: 6px; padding: 6px 6px calc(8px + var(--safe-b));
  background: linear-gradient(rgba(29, 23, 18, .92), #1d1712); border-top: 1px solid rgba(0, 0, 0, .35); z-index: 2;
}
.group { display: flex; gap: 2px; }
.group.planes { padding-right: 6px; border-right: 1px solid var(--line); }
.tool {
  flex: none; width: 54px; border: 0; border-radius: 10px; background: transparent; padding: 5px 1px 4px;
  display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--ink2);
}
.tool#edgeBtn { width: 72px; }
.tool svg { width: 42px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.tool span { font-size: 12.5px; line-height: 1.1; white-space: nowrap; }
@media (min-width: 390px) { .tool { width: 57px; } .tool#edgeBtn { width: 74px; } }
.tool:active { background: rgba(243, 233, 216, .08); }
.tool[aria-checked="true"], .tool[aria-pressed="true"] { color: #22180f; background: var(--brass); }

/* ---------- sheets ---------- */
.sheet {
  position: fixed; inset: 0; z-index: 10; display: flex; align-items: center; justify-content: center;
  padding: calc(16px + var(--safe-t)) 16px calc(16px + var(--safe-b)); background: rgba(10, 7, 5, .55);
}
.card {
  width: min(100%, 440px); max-height: 100%; overflow: auto; background: var(--paper); color: var(--paper-ink);
  border-radius: 14px; padding: 22px 22px 18px; box-shadow: 0 18px 50px rgba(0, 0, 0, .5);
}
.card h2 { margin: 0; font: 400 28px/1.1 var(--disp); }
.card .kicker { margin: 0 0 4px; font-size: 13px; letter-spacing: .1em; text-transform: uppercase; color: var(--paper-ink2); }
.card .facts { margin: 10px 0 0; display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; font-size: 15px; line-height: 1.35; }
.card .facts dt { color: var(--paper-ink2); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; padding-top: 2px; }
.card .facts dd { margin: 0; }
.card .note { margin: 12px 0 0; font-size: 17px; line-height: 1.45; }
.card .go { margin-top: 18px; }
.card .alt {
  margin-top: 10px; background: none; border: 1px solid rgba(43, 32, 24, .25); color: var(--paper-ink); border-radius: 999px;
  padding: 9px 18px; font-size: 15px;
}
.card .buttons { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 16px; }
.card .buttons .go, .card .buttons .alt { margin: 0; }
.card .small { margin: 12px 0 0; font-size: 14px; color: var(--paper-ink2); }
.stamp {
  float: right; margin: -6px -4px 0 10px; font: 400 44px/1 var(--pencil); color: var(--red); transform: rotate(-8deg);
  text-shadow: 0 0 1px var(--red), 0 0 1px var(--red);
}
.marks { list-style: none; margin: 14px 0 0; padding: 0; clear: both; display: grid; gap: 6px; }
.marks li { display: grid; grid-template-columns: 22px 1fr auto; gap: 8px; align-items: baseline; font-size: 16px; }
.marks li .tick { font: 700 17px var(--body); color: var(--green); }
.marks li.miss .tick { color: #a99a8a; }
.marks li .v { font-variant-numeric: tabular-nums; color: var(--paper-ink2); font-size: 15px; text-align: right; }
.menu-card { display: flex; flex-direction: column; align-items: stretch; }
.menu-card h2 { margin-bottom: 8px; }
.menu-card .row {
  background: none; border: 0; border-bottom: 1px solid rgba(43, 32, 24, .12); text-align: left; padding: 13px 2px;
  font-size: 17px; color: var(--paper-ink);
}
.menu-card .alt { align-self: flex-start; margin-top: 14px; }
.menu-card .jd-foot, .how-card .jd-foot { color: var(--paper-ink2); }
/* The tabletop, and the tally of grades pencilled under it. */
.table-card canvas { display: block; width: 100%; aspect-ratio: 16 / 10; margin: 8px 0 0; }
.table-card .small { margin-top: 6px; }
.tally { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 1px; }
.tally li { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: baseline; padding: 3px 0; border-bottom: 1px solid rgba(43, 32, 24, .1); font-size: 15px; }
.tally .n { font: 400 15px var(--disp); }
.tally .w { color: var(--paper-ink2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tally .g { font: 400 23px/1 var(--pencil); color: var(--red); transform: rotate(-4deg); }
.how-card p { margin: 10px 0 0; font-size: 16px; line-height: 1.45; }
.how-card b { font-weight: 700; }
.how-card .grain-fig { display: block; width: 100%; max-width: 340px; height: auto; margin: 8px 0 2px; }
/* The grain figure the way the bench shows the board: along the screen, or standing up it. */
.how-card .grain-fig.tall { display: none; max-width: 260px; }
@media (orientation: portrait) {
  .how-card .grain-fig.wide { display: none; }
  .how-card .grain-fig.tall { display: block; }
}

.noscript { position: fixed; inset: 0; margin: 0; display: flex; align-items: center; justify-content: center; padding: 16px; text-align: center; font: 400 22px var(--disp); background: var(--bg); }

/* Wider screens: the HUD's numbers get more room, the tray its labels. */
@media (min-width: 700px) {
  .hud { display: flex; padding: calc(10px + var(--safe-t)) 16px 10px; gap: 14px; }
  .hud .name { flex-direction: column; align-items: flex-start; gap: 0; }
  .hud .name strong { font-size: 19px; }
  .stats { display: flex; gap: 24px; }
  .stat { justify-items: end; }
  .stat b { font-size: 19px; }
  .tool, .tool#edgeBtn { width: 92px; padding: 7px 4px 6px; }
  .tool svg { width: 48px; height: 24px; }
  .tool span { font-size: 14px; }
  .group { gap: 6px; }
  .group.planes { padding-right: 12px; }
  .tray { gap: 12px; }
}
/* A phone on its side: tools down the right. */
@media (max-height: 500px) and (orientation: landscape) {
  .bench { grid-template-rows: auto 1fr; grid-template-columns: 1fr auto; }
  .hud { grid-column: 1 / -1; padding-top: 4px; padding-bottom: 4px; }
  .tray { grid-row: 2; grid-column: 2; flex-direction: column; justify-content: center; padding: 6px calc(6px + env(safe-area-inset-right, 0px)) 6px 6px; border-top: 0; border-left: 1px solid rgba(0, 0, 0, .35); }
  .group { flex-direction: column; }
  .group.planes { border-right: 0; padding-right: 0; border-bottom: 1px solid var(--line); padding-bottom: 6px; }
  .tool, .tool#edgeBtn { width: 78px; padding: 3px 2px; }
  .tool svg { height: 18px; }
}
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } .plank-note { animation: none; } }
