/* hankcrew.com. Inks and type are HANK's own (see docs/design/hank/login-town.html). Nothing eases:
   every move is a few hard cuts (steps), the way the town moves. */
@font-face { font-family: "Departure Mono"; font-display: block; src: url("fonts/DepartureMono-Regular.woff2") format("woff2"); }
:root { --ground: #fbfaf7; --ink: #1b1917; --body: #3d3831; --muted: #746c60; --firm: #cfc7b8; --blue: #3a6a9e; --wood: #b07a43;
  --pixel: "Departure Mono", ui-monospace, monospace; --sans: "Space Grotesk", ui-sans-serif, system-ui, sans-serif; --px: 2px; }
* { box-sizing: border-box; }
html { background: #93c062; }
body { margin: 0; font: 16px/1.45 var(--sans); color: var(--body); font-synthesis-weight: none; -webkit-text-size-adjust: 100%; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; box-shadow: 0 0 0 2px var(--ground); }
.word { font: 900 58px/1 "Doto", ui-monospace, monospace; letter-spacing: .03em; margin: 0;
  background: linear-gradient(180deg, #5a8fc4 0 33%, #e0604a 33% 44%, #e8b33a 44% 55%, #e8843a 55% 66%, #7fae5a 66%);
  -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---- without script: a plain page of words on paper ---- */
html:not(.js) body { background: var(--ground); max-width: 640px; margin: 0 auto; padding: 24px 20px 64px; }
html:not(.js) :is(#stage, #chrome, #hint, #ticks, #plate, #sheet, #story) { display: none; }
html:not(.js) #places[hidden] { display: grid; }
html:not(.js) #intro { margin-bottom: 24px; }

/* ---- with script: the town fills the window and never scrolls ---- */
html.js, html.js body { height: 100%; overflow: hidden; overscroll-behavior: none; }
#stage { position: fixed; inset: 0; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; cursor: grab; }
#stage.dragging { cursor: grabbing; }
#world { position: absolute; left: 50%; top: 50%; width: 0; height: 0; }
#town, #stand { position: absolute; left: 0; top: 0; image-rendering: pixelated; pointer-events: none; }
.wait #world { visibility: hidden; }
/* a door you can go through: a real link laid over each flagged building and each of the crew */
.spot { position: absolute; display: block; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.spot:focus-visible { outline: 2px solid var(--ink); outline-offset: 0; box-shadow: 0 0 0 4px var(--ground); }

/* the patch of the square the town keeps clear for its stone sign (the sign itself is drawn in the town) */
.js #hero { position: absolute; left: 0; top: 0; width: 230px; height: 120px; transform: translate(-50%, -50%); visibility: hidden; pointer-events: none; }
.go, .btn { display: flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 16px; border: 2px solid var(--ink); background: var(--ink); color: var(--ground);
  font: 12px/1 var(--pixel); letter-spacing: 2px; text-transform: uppercase; text-decoration: none; cursor: pointer; box-shadow: 3px 3px 0 var(--firm); border-radius: 0; }
.go:hover, .btn.ink:hover { background: var(--ground); color: var(--ink); }
.go:active, .btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--firm); }
.look { min-height: 44px; border: 0; background: none; color: var(--ink); cursor: pointer; font: 12px/1 var(--pixel); letter-spacing: 1px; text-transform: uppercase; text-decoration: underline; text-underline-offset: 4px; }
.look:hover { color: var(--blue); }
/* signing in: a hole opens in the square, dirt flies, and the way in comes up out of it. Every
   position is set by the script, a drawing at a time; nothing here moves on its own. */
#dig { position: absolute; left: 0; top: 0; width: 0; height: 0; z-index: 2; }
#dig .hole { position: absolute; image-rendering: pixelated; transform: translate(-50%, -50%); }
#dig .riser { position: absolute; left: -130px; bottom: 0; width: 260px; overflow: hidden; padding: 0 12px; }
.found { position: relative; background: var(--ground); border: 2px solid var(--ink); border-bottom: 0; padding: 16px 16px 20px; display: grid; gap: 8px; text-align: center; cursor: default; }
.found::after { content: ''; position: absolute; top: 6px; right: -10px; bottom: 0; width: 8px; background: repeating-linear-gradient(90deg, var(--ink) 0 1px, transparent 1px 3px); }
.found .word { font-size: 44px; }
.found .say { margin: 0; min-height: 1.4em; font: 500 16px/1.4 var(--sans); color: var(--ink); }
.found .go { min-height: 44px; visibility: hidden; }
.found.ready .go { visibility: visible; }
.clod { position: absolute; }

/* ---- the words round the town ---- */
#chrome { position: fixed; z-index: 5; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: flex-start; pointer-events: none;
  padding: calc(10px + env(safe-area-inset-top)) calc(10px + env(safe-area-inset-right)) 0 calc(10px + env(safe-area-inset-left)); }
#chrome > * { pointer-events: auto; }
#chrome .right { display: flex; gap: 8px; margin-left: auto; }
#home { display: none; min-height: 44px; align-items: center; padding: 3px 10px 0; background: var(--ground); border: 2px solid var(--ink); text-decoration: none; box-shadow: 3px 3px 0 rgba(27, 25, 23, .35); }
#home .word { font-size: 30px; }
#signin { display: flex; }
:is(.away, .reading, .telling) #home { display: flex; }
.btn { min-height: 44px; box-shadow: 3px 3px 0 rgba(27, 25, 23, .35); }
.btn:not(.ink) { background: var(--ground); color: var(--ink); }
.btn:not(.ink):hover, .btn[aria-expanded="true"] { background: var(--ink); color: var(--ground); }
#places { position: fixed; z-index: 6; top: calc(64px + env(safe-area-inset-top)); right: calc(10px + env(safe-area-inset-right)); width: min(300px, calc(100vw - 20px));
  background: var(--ground); border: 2px solid var(--ink); box-shadow: 4px 4px 0 rgba(27, 25, 23, .35); display: grid; padding: 12px 0 4px; }
.js #places[hidden] { display: none; }
#places:not([hidden]) { animation: unroll .25s steps(3, jump-none); }
@keyframes unroll { from { clip-path: inset(0 -8px 100% -8px); } to { clip-path: inset(0 -8px -8px -8px); } }
.tab { position: absolute; top: -9px; left: 12px; margin: 0; padding: 0 6px; background: var(--ground); font: 11px/16px var(--pixel); letter-spacing: 1px; color: var(--muted); }
#places a { display: flex; align-items: baseline; gap: 10px; min-height: 44px; padding: 11px 16px; text-decoration: none; color: var(--body); border-top: 1px dashed var(--firm); }
#places a:first-of-type { border-top: 0; }
#places a b { font: 12px/1 var(--pixel); letter-spacing: 1px; text-transform: uppercase; color: var(--ink); min-width: 104px; }
#places a:hover, #places a[aria-current] { background: var(--ink); color: var(--ground); }
#places a:hover b, #places a[aria-current] b { color: var(--ground); }
#who { position: fixed; z-index: 4; left: 0; right: 0; bottom: calc(10px + env(safe-area-inset-bottom)); display: flex; justify-content: center; gap: 8px; padding: 0 10px; pointer-events: none; }
#who .btn { pointer-events: auto; flex: 0 1 200px; min-height: 48px; padding: 0 8px; letter-spacing: 1px; text-align: center; }
:is(.reading, .telling, .digging) #who { display: none; }
html:not(.js) #who { position: static; margin: 0 0 24px; justify-content: flex-start; padding: 0; }
#hint { position: fixed; z-index: 4; left: 50%; bottom: calc(68px + env(safe-area-inset-bottom)); transform: translateX(-50%); margin: 0; padding: 7px 12px; white-space: nowrap;
  background: var(--ink); color: var(--ground); font: 11px/16px var(--pixel); letter-spacing: .5px; pointer-events: none; }
:is(.seen, .reading, .telling, .digging) #hint { display: none; }
/* a red mark at the window's edge for each flag that is out of sight */
.tick { position: fixed; z-index: 3; width: 14px; height: 14px; margin: -7px 0 0 -7px; pointer-events: none; animation: bob .5s steps(2, jump-none) infinite alternate; }
.tick svg { display: block; width: 14px; height: 14px; }
@keyframes bob { from { translate: 0 0; } to { translate: var(--bx, 0) var(--by, 0); } }
:is(.reading, .telling, .wait) .tick { display: none; }
/* a name tag over one of the crew */
#plate { position: fixed; z-index: 7; max-width: 220px; padding: 7px 10px 6px; background: var(--ground); border: 2px solid var(--ink); box-shadow: 3px 3px 0 rgba(27, 25, 23, .35);
  font: 14px/1.3 var(--sans); color: var(--body); pointer-events: none; animation: pop .17s steps(2, jump-none); }
#plate b { display: block; font: 12px/18px var(--pixel); letter-spacing: 1.5px; text-transform: uppercase; color: var(--ink); }
#plate canvas, #plate a { display: none; }
#plate a:has(b) { display: block; text-decoration: none; }

/* a day in town: Hank's line at the bottom while the town walks to what he is talking about */
#story { position: fixed; z-index: 8; left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); max-width: 520px; margin: 0 auto; padding: 16px 16px 10px;
  background: var(--ground); border: 2px solid var(--ink); box-shadow: 4px 4px 0 rgba(27, 25, 23, .35); animation: pop .17s steps(2, jump-none); }
#story[hidden] { display: none; }
#story-say { margin: 0 0 8px; min-height: 2.8em; font: 500 18px/1.4 var(--sans); color: var(--ink); }
#story .row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
#story .btn { min-height: 44px; box-shadow: 3px 3px 0 var(--firm); }

/* ---- a page: a sheet of paper beside its building ---- */
.js #pages { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
#sheet { position: fixed; z-index: 8; left: 10px; right: 10px; bottom: 0; max-height: 64svh; display: flex; flex-direction: column;
  background: var(--ground); border: 2px solid var(--ink); border-bottom: 0; box-shadow: 4px -2px 0 rgba(27, 25, 23, .3); outline: none;
  padding-bottom: env(safe-area-inset-bottom); animation: rise .34s steps(4, jump-none); }
#sheet[hidden] { display: none; }
@keyframes rise { from { transform: translateY(100%); } to { transform: none; } }
#sheet::before { content: attr(data-place); display: block; flex: none; height: 30px; padding: 0 56px 0 16px; background: var(--strip, var(--ink)); color: var(--ground);
  font: 12px/30px var(--pixel); letter-spacing: 2px; text-transform: uppercase; border-bottom: 2px solid var(--ink); }
#sheet-close { position: absolute; top: 0; right: 0; width: 46px; height: 44px; border: 0; border-left: 2px solid var(--ink); border-bottom: 2px solid var(--ink); background: var(--ground); color: var(--ink);
  font: 22px/1 var(--pixel); cursor: pointer; border-radius: 0; z-index: 1; }
#sheet-close:hover { background: var(--ink); color: var(--ground); }
#sheet-body { min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 18px 16px 4px; -webkit-overflow-scrolling: touch; }
#sheet .back { flex: none; display: flex; align-items: center; min-height: 44px; margin: 0 16px 6px; font: 11px/1 var(--pixel); letter-spacing: 1px; text-transform: uppercase; color: var(--muted); text-underline-offset: 4px; }
#sheet .back:hover { color: var(--ink); }
article h2 { margin: 0 0 10px; font: 700 26px/1.1 var(--sans); color: var(--ink); letter-spacing: -.01em; text-wrap: balance; }
article p { margin: 0 0 12px; max-width: 46ch; }
article a { color: var(--blue); text-underline-offset: 3px; }
article .next { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 16px; }
article .next a { display: inline-flex; align-items: center; min-height: 44px; font: 12px/1 var(--pixel); letter-spacing: 1px; text-transform: uppercase; color: var(--ink); }
article .next a::after { content: '>>'; margin-left: 6px; text-decoration: none; display: inline-block; }
article ul { list-style: none; margin: 14px 0 12px; padding: 0; border-top: 2px solid var(--ink); }
.wedges li { display: flex; align-items: center; gap: 12px; min-height: 56px; border-bottom: 1px dashed var(--firm); }
.wedges li:last-child { border-bottom: 2px solid var(--ink); }
.wedges canvas { width: 32px; height: 28px; image-rendering: pixelated; flex: none; }
.wedges span { flex: 1; font-weight: 500; color: var(--ink); }
.wedges b { font: 11px/1 var(--pixel); letter-spacing: 1px; color: var(--body); text-align: right; }
.crew li { display: grid; grid-template-columns: 42px 1fr; column-gap: 12px; align-items: center; padding: 8px 0; min-height: 64px; border-bottom: 1px dashed var(--firm); }
.crew li:last-child { border-bottom: 2px solid var(--ink); }
.crew canvas { grid-row: span 2; width: 42px; height: 78px; image-rendering: pixelated; }
.crew a { align-self: end; text-decoration: none; color: var(--ink); min-height: 24px; }
.crew a b { font: 13px/1 var(--pixel); letter-spacing: 1.5px; text-transform: uppercase; text-decoration: underline; text-underline-offset: 4px; }
.crew span { align-self: start; font-size: 15px; line-height: 1.3; }
html:not(.js) article { margin: 0 0 36px; padding-top: 12px; border-top: 2px solid var(--ink); }
html:not(.js) article canvas { display: none; }

@media (min-width: 900px) {
  #sheet { left: auto; right: 40px; top: 120px; bottom: auto; width: 420px; max-height: calc(100svh - 160px); border-bottom: 2px solid var(--ink); box-shadow: 5px 5px 0 rgba(27, 25, 23, .3); font-size: 17px;
    animation-name: unroll; padding-bottom: 0; }
  #sheet-body { padding: 22px 22px 4px; }
  #sheet .back { margin: 0 22px 8px; }
  #chrome { padding: 16px 20px 0; }
  #places { top: 72px; right: 20px; }
  #who { bottom: 20px; } #hint { bottom: 80px; }
}
/* a short window (a phone on its side): a smaller board */
@media (max-height: 520px) { #hint { display: none; }
  #sheet { max-height: 78svh; left: auto; width: min(420px, calc(100vw - 20px)); } }

/* at night the paper goes dark with the town, in HANK's own dark panel colours */
html[data-light="night"] { --ground: #23211d; --ink: #e8e3d8; --body: #d8d2c5; --muted: #a59d90; --firm: #4a463e; --blue: #8fb8e0; }
html[data-light="night"] :is(.go, .btn.ink) { color: #1b1917; }
html[data-light="night"] :is(.go, .btn.ink):hover { color: var(--ink); }
html[data-light="night"] #sheet::before { color: #fbfaf7; }
html[data-light="night"] :is(#places a:hover, #places a[aria-current], .btn:not(.ink):hover, .btn[aria-expanded="true"], #sheet-close:hover) { color: #1b1917; }
html[data-light="night"] :is(#places a:hover b, #places a[aria-current] b) { color: #1b1917; }
html[data-light="night"] #hint { color: #1b1917; }
.snowcap { position: absolute; z-index: 1; pointer-events: none; image-rendering: pixelated; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; } }
