.wk {
  --ink: #15130f;
  --red: #d9261c;
  --paper: #f7f6f1;
  position: relative;
  width: 540px;
  height: 540px;
  overflow: hidden;
  background: var(--paper);
  color: var(--ink);
  font-family: "Mansalva", cursive;
}

.wk *,
.wk-note * { box-sizing: border-box; }

/* ---- the drawing */
.wk-map {
  position: absolute;
  inset: 0;
  width: 540px;
  height: 540px;
  display: block;
}

.wk-grid { mix-blend-mode: multiply; }
.wk-square { fill: none; stroke: #7fb0e2; stroke-width: 0.8; opacity: 0.62; }

.wk-ink { mix-blend-mode: multiply; }
.wk-ink path { fill: none; stroke: var(--ink); stroke-linecap: round; stroke-linejoin: round; }
.wk-ink .wk-fill { fill: var(--ink); stroke: none; }
.wk-sea { stroke-width: 0.95; }
.wk-sea-1 { stroke-width: 0.9; }
.wk-sea-2 { stroke-width: 1; }
.wk-cliff { stroke-width: 1; }
.wk-sand { stroke-width: 1.3; }
.wk-terrace { stroke-width: 0.8; }
.wk-terrace-far { stroke-width: 0.7; opacity: 0.8; }
.wk-tree { stroke-width: 0.9; }
.wk-block { stroke-width: 1.1; }
.wk-block-hatch { stroke-width: 0.9; }
.wk-tower { stroke-width: 1.5; }
.wk-ink .wk-route { fill: var(--red); stroke: none; }

.wk-place {
  position: absolute;
  font-size: 21px;
  line-height: 22px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  white-space: nowrap;
}
.wk-place-a { left: 138px; top: 68px; }
.wk-place-b { right: 13px; top: 317px; font-size: 19px; letter-spacing: 0.07em; }

.wk-scale, .wk-north { position: absolute; font-size: 17px; line-height: 18px; white-space: nowrap; translate: -50% 0; }
.wk-scale { top: 45px; }
.wk-scale-0 { left: 380px; }
.wk-scale-500 { left: 480px; }
.wk-north { translate: -50% -50%; font-size: 20px; }

/* ---- waypoints */
.wk-stop {
  position: absolute;
  width: 44px;
  height: 44px;
  margin: -22px 0 0 -22px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}
.wk-stop svg { display: block; width: 44px; height: 44px; overflow: visible; }
.wk-stop-paper { fill: var(--paper); }
.wk-stop-ring { fill: var(--ink); }
.wk-stop-fill { fill: none; stroke: var(--ink); stroke-width: 1.25; stroke-linecap: round; opacity: 0; transition: opacity 90ms; }
.wk-stop-focus { fill: var(--red); opacity: 0; }
.wk-stop:hover .wk-stop-fill,
.wk-stop.is-open .wk-stop-fill { opacity: 1; }
.wk-stop:focus-visible .wk-stop-focus { opacity: 1; }
.wk-stop:active svg { scale: 0.94; }

/* ---- the note */
.wk-note {
  --ink: #15130f;
  --red: #d9261c;
  width: 322px;
  height: 150px;
  margin: 0;
  padding: 0;
  border: 0;
  overflow: visible;
  background: none;
  color: var(--ink);
  font-family: "Mansalva", cursive;
  transform-origin: var(--transform-origin);
  /* a note never gets in the way of the next waypoint */
  pointer-events: none;
}
.wk-note[data-closed] { transition: opacity 90ms; }
.wk-note[data-ending-style] { opacity: 0; }

.wk-note-ink {
  position: absolute;
  left: -12px;
  top: -12px;
  width: 353px;
  height: 182px;
  overflow: visible;
  filter: url(#wk-tooth);
}
.wk-halo { fill: #f8f7f2; stroke: #f8f7f2; stroke-width: 7; stroke-linejoin: round; }
.wk-shadow { fill: var(--ink); }
.wk-paper { fill: #f8f7f2; }
.wk-box { fill: var(--ink); }
.wk-draw { fill: none; stroke: #fff; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 0; }
.wk-draw-box { stroke-width: 14; }
.wk-draw-lead { stroke-width: 26; }

/* the leader: a 24 px square the SDK centres on the waypoint, turned to whichever edge the note landed on */
.wk-leader {
  position: absolute;
  width: 24px;
  height: 24px;
}
.wk-leader[data-side="bottom"] { top: -12px; }
.wk-leader[data-side="top"] { bottom: -12px; rotate: 180deg; }
.wk-leader[data-side="left"] { right: -12px; rotate: 90deg; }
.wk-leader[data-side="right"] { left: -12px; rotate: -90deg; }
.wk-leader svg { position: absolute; left: 0; top: -27px; display: block; width: 24px; height: 45px; overflow: visible; fill: var(--ink); filter: url(#wk-tooth); }

.wk-write {
  position: absolute;
  inset: 0;
  display: block;
  padding: 13px 20px 0 22px;
}
.wk-kind {
  display: block;
  font-size: 16px;
  line-height: 18px;
  white-space: nowrap;
}
.wk-name {
  position: relative;
  display: block;
  width: max-content;
  margin-top: 1px;
  font: 700 39px/40px "Cabin Sketch", sans-serif;
  letter-spacing: 0.01em;
  white-space: nowrap;
  /* a second pass of the pen over the outlines */
  text-shadow: 0.45px 0.25px 0 var(--ink), -0.35px 0.3px 0 var(--ink);
}
.wk-under { position: absolute; left: 0; top: 38px; display: block; overflow: visible; fill: var(--red); filter: url(#wk-tooth); }
.wk-stats {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-top: 14px;
}
.wk-stat { display: block; white-space: nowrap; }
.wk-stat b { display: block; height: 31px; font-weight: 400; font-size: 30px; line-height: 30px; }
.wk-stat b i { font-style: normal; font-size: 20px; line-height: 20px; margin-left: 4px; }
.wk-stat b u { text-decoration: none; color: var(--red); margin-right: 2px; }
.wk-stat small { display: block; font-size: 14.5px; line-height: 16px; margin-top: 1px; }
.wk-rule { display: block; flex: none; width: 6px; height: 44px; margin-top: 2px; overflow: visible; fill: var(--ink); filter: url(#wk-tooth); }

/* drawn on: the box goes round once, the shadow is hatched in, then the writing */
@keyframes wk-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes wk-wipe { from { clip-path: inset(-4px 100% -4px -4px); } to { clip-path: inset(-4px -4px -4px -4px); } }
@keyframes wk-in { from { opacity: 0; } to { opacity: 1; } }
.wk-note[data-open] .wk-draw-lead { animation: wk-draw 110ms ease-out both; }
.wk-note[data-open] .wk-draw-box { animation: wk-draw 300ms 70ms cubic-bezier(0.4, 0, 0.3, 1) both; }
.wk-note[data-open] .wk-ground { animation: wk-in 110ms 40ms both; }
.wk-note[data-open] .wk-write { animation: wk-wipe 280ms 190ms ease-out both; }
.wk-note[data-open][data-instant] :is(.wk-draw, .wk-ground, .wk-write) { animation-duration: 1ms; animation-delay: 0ms; }

@media (prefers-reduced-motion: reduce) {
  .wk-note[data-open] :is(.wk-draw, .wk-ground, .wk-write) { animation-duration: 1ms; animation-delay: 0ms; }
}
