/* Notan's board in the cabinet: notan/notan.css, scoped to .bx-notan and moved onto the
 * cabinet's tokens (frame and marks take --ink and --guide; done numbers take --guide; a
 * locked line takes --accent where the game uses red). Luke Steuber. */

.bx-notan:not(button) { position: relative; display: flex; justify-content: center; }
.bx-notan .nt-board {
  position: relative;
  --cell: 32px; --f: 13px; --cw: 40px; --ch: 40px; --dot: 5px;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  touch-action: none;
}
.bx-notan.nt-instant, .bx-notan.nt-instant *, .bx-notan.nt-instant *::before, .bx-notan.nt-instant *::after { transition: none !important; animation: none !important; }
.bx-notan .sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; margin: -1px; padding: 0; }

.bx-notan .cursor {
  position: absolute; z-index: 3;
  width: var(--cell); height: var(--cell);
  border: 2px solid var(--ink);
  box-shadow: 0 0 0 1px var(--bg), inset 0 0 0 1px var(--bg);
  pointer-events: none; display: none;
}
.bx-notan .cursor.on { display: block; }
/* Hint: a ring on one square, dashed when the square is wrong, solid when the
 * outlined clue settles it. It pulses three times, then stays until the next move. */
.bx-notan .hint {
  position: absolute; z-index: 3;
  width: var(--cell); height: var(--cell);
  border: 3px solid var(--ink);
  box-shadow: 0 0 0 1px var(--bg), inset 0 0 0 1px var(--bg);
  pointer-events: none; display: none;
}
.bx-notan .hint.on { display: block; animation: bx-notan-pulse 1.2s ease-in-out 3; }
.bx-notan .hint.wrong { border-style: dashed; }
@keyframes bx-notan-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.15; } }
/* The hint shows its answer inside the ring: a faint fill, or the empty dot. */
.bx-notan .hint.fill::after, .bx-notan .hint.empty::after { content: ""; position: absolute; background: var(--ink); opacity: 0.38; }
.bx-notan .hint.fill::after { inset: 22%; }
.bx-notan .hint.empty::after { left: 50%; top: 50%; width: var(--dot); height: var(--dot); margin: calc(var(--dot) / -2) 0 0 calc(var(--dot) / -2); border-radius: 50%; opacity: 0.8; }
.bx-notan .clue.hinted { outline: 2px solid var(--ink); outline-offset: -2px; }

.bx-notan .grid { position: relative; z-index: 1; }
.bx-notan .gr { display: flex; }
.bx-notan .corner { flex: none; width: var(--cw); height: var(--ch); }

.bx-notan .clue {
  flex: none; display: flex; position: relative;
  font: 500 var(--f)/1.18 var(--mono);
  font-variant-numeric: tabular-nums;
  color: var(--text);
  transition: color 0.3s, opacity 0.25s ease-out;
}
.bx-notan .cc { width: var(--cell); height: var(--ch); flex-direction: column; justify-content: flex-end; align-items: center; padding-bottom: calc(var(--f) * 0.4); }
.bx-notan .rc { width: var(--cw); height: var(--cell); justify-content: flex-end; align-items: center; gap: calc(var(--f) * 0.5); padding-right: calc(var(--f) * 0.55); }
.bx-notan .clue.ok { color: var(--guide); }
/* Each number fades on its own once its run is finished. It does not bounce. */
.bx-notan .clue span { display: inline-block; transition: color 0.3s; }
.bx-notan .clue span.n-done { color: var(--guide); text-decoration: line-through; text-decoration-thickness: 2px; }
/* A line that can't work as marked gets a short dashed tick beside it. */
.bx-notan .clue.bad::after { content: ""; position: absolute; border: 0 dashed var(--text); }
.bx-notan .cc.bad::after { left: 25%; right: 25%; bottom: 2px; border-bottom-width: 1px; }
.bx-notan .rc.bad::after { top: 25%; bottom: 25%; right: 2px; border-right-width: 1px; }
/* A locked line's numbers take the accent (red in the game). */
.bx-notan .clue.locked, .bx-notan .clue.locked span, .bx-notan .clue.locked span.n-done { color: var(--accent); }

.bx-notan .cell {
  flex: none; position: relative;
  width: var(--cell); height: var(--cell);
  --guide-x: 0px; --guide-y: 0px;
  --lt: transparent; --ll: transparent; --lr: var(--line); --lb: var(--line);
  box-shadow:
    inset calc(-1px - var(--guide-x)) 0 0 var(--lr),
    inset 0 calc(-1px - var(--guide-y)) 0 var(--lb),
    inset 1px 0 0 var(--ll),
    inset 0 1px 0 var(--lt);
  outline: none; cursor: pointer;
  transition: box-shadow 0.3s;
}
.bx-notan .cell.gx { --lr: var(--guide); --guide-x: 1px; }
.bx-notan .cell.gy { --lb: var(--guide); --guide-y: 1px; }
.bx-notan .cell.t { --lt: var(--ink); }
.bx-notan .cell.l { --ll: var(--ink); }
.bx-notan .cell.rt { --lr: var(--ink); }
.bx-notan .cell.bt { --lb: var(--ink); }
.bx-notan .cell::before {
  content: ""; position: absolute;
  left: 0; top: 0; right: 1px; bottom: 1px;
  background: var(--ink);
  transform: scale(0);
  transition: transform 0.12s ease-out;
}
.bx-notan .cell.t::before { top: 1px; }
.bx-notan .cell.l::before { left: 1px; }
.bx-notan .cell.ink::before { transform: scale(1); }
.bx-notan .cell.gx::before { right: 0; box-shadow: inset -2px 0 var(--bg); }
.bx-notan .cell.gy::before { bottom: 0; box-shadow: inset 0 -2px var(--bg); }
.bx-notan .cell.gx.gy::before { box-shadow: inset -2px 0 var(--bg), inset 0 -2px var(--bg); }
.bx-notan .cell::after {
  content: ""; position: absolute;
  left: 50%; top: 50%;
  width: var(--dot); height: var(--dot);
  margin: calc(var(--dot) / -2) 0 0 calc(var(--dot) / -2);
  border-radius: 50%;
  background: var(--guide);
  opacity: 0;
  transition: opacity 0.12s;
}
.bx-notan .cell.mark::after { opacity: 1; }

/* Solved, as in the game: the numbers, marks and inner lines go and the picture stays.
 * The plate keeps its frame, so the holes read as cut into it. */
.bx-notan .solved .cell { --line: transparent; cursor: default; }
.bx-notan .solved .cell.gx { --lr: transparent; }
.bx-notan .solved .cell.gy { --lb: transparent; }
.bx-notan .solved .cell.rt { --lr: var(--ink); }
.bx-notan .solved .cell.bt { --lb: var(--ink); }
.bx-notan .solved .clue,
.bx-notan .solved .cell::after,
.bx-notan .solved .cursor,
.bx-notan .solved .hint { opacity: 0; }

/* The unlock: the punched squares close into one shape (seams gone), then lift off the plate
 * as the key, in the accent, leaving their holes behind as a recess with an ink edge. */
.bx-notan .nt-lift { position: absolute; z-index: 2; overflow: visible; pointer-events: none; }
.bx-notan .nt-hole { fill: var(--line); opacity: 0; transition: opacity 0.2s ease 0.3s; }
.bx-notan .nt-hole-edge { fill: none; stroke: var(--ink); stroke-width: 1.5; stroke-linecap: square; opacity: 0; transition: opacity 0.2s ease 0.3s; }
.bx-notan .nt-key { fill: var(--ink); transform: translate(0, 0); transition: transform 0.45s cubic-bezier(0.3, 1.45, 0.55, 1) 0.32s, fill 0.3s ease 0.32s; animation: bx-notan-join 0.22s ease-out both; }
@keyframes bx-notan-join { from { opacity: 0; } to { opacity: 1; } }
.bx-notan .solved .cell::before { visibility: hidden; transition: visibility 0s linear 0.3s; }
.bx-notan.nt-up .nt-hole, .bx-notan.nt-up .nt-hole-edge { opacity: 1; }
.bx-notan.nt-up .nt-key { fill: var(--accent); transform: translate(var(--lx), var(--ly)); }

/* The game's Mark mode button, in the cabinet toolbar. */
.bx-notan.nt-mode[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.bx-notan.nt-mode:disabled { opacity: 0.32; cursor: default; }

@media (forced-colors: active) {
  .bx-notan .nt-board { forced-color-adjust: none; }
  .bx-notan .cursor, .bx-notan .hint { border-color: Highlight; }
  .bx-notan .clue.locked { outline: 1px solid CanvasText; outline-offset: -2px; }
}
