/* village.css — the home page: a full-screen map with a little interface on top. */

.village {
  margin: 0;
  background: #7cb658;
  color: var(--ink);
  font-family: var(--font-display);
}
.js .village {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: var(--ink);
  overscroll-behavior: none;
}

#world {
  display: none;
}
.js #world {
  display: block;
  position: fixed;
  left: 0;
  top: 0;
  image-rendering: pixelated;
  touch-action: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

/* name, top left */
.nameplate {
  padding: var(--s5) var(--s4) 0;
}
.js .nameplate {
  display: grid;
  grid-template-columns: auto auto;
  justify-content: start;
  align-items: center;
  column-gap: var(--s4);
  position: fixed;
  z-index: 3;
  top: max(14px, env(safe-area-inset-top));
  left: max(16px, env(safe-area-inset-left));
  padding: 0;
  pointer-events: none;
}
.nameplate h1 {
  margin: 0;
  font: 600 clamp(1.75rem, 5vw, 2.5rem)/1 var(--font-display);
  letter-spacing: 0.07em;
}
.nameplate p {
  --o: 2px;
  max-width: 24ch;
  margin: 14px 0 0;
  font: 500 1.0625rem/1.2 var(--font-display);
}
.nameplate h1,
.nameplate p {
  color: var(--parchment-hi);
  text-shadow:
    2px 0 0 var(--ink), -2px 0 0 var(--ink), 0 2px 0 var(--ink), 0 -2px 0 var(--ink),
    2px 2px 0 var(--ink), -2px 2px 0 var(--ink), 2px -2px 0 var(--ink), -2px -2px 0 var(--ink),
    0 5px 0 var(--ink), 2px 5px 0 var(--ink), -2px 5px 0 var(--ink);
}
.nameplate p {
  text-shadow:
    2px 0 0 var(--ink), -2px 0 0 var(--ink), 0 2px 0 var(--ink), 0 -2px 0 var(--ink),
    2px 2px 0 var(--ink), -2px 2px 0 var(--ink), 2px -2px 0 var(--ink), -2px -2px 0 var(--ink);
}

.js .nameplate p {
  grid-column: 1 / -1;
}

/* the two small buttons beside the name: time of day, sound */
.tools {
  display: flex;
  gap: var(--s3);
  margin-top: var(--s4);
}
.js .tools {
  grid-row: 1;
  grid-column: 2;
  margin-top: 0;
}
.tools button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 2px;
  font: 600 0.8125rem/1 var(--font-display);
  cursor: pointer;
  pointer-events: auto;
}
.tools svg {
  width: 10px;
  height: 10px;
}

/* the building links */
.places ul {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--s4);
  margin: 0;
  padding: var(--s5) var(--s4);
  list-style: none;
}
.js .places ul,
.js .places li {
  display: contents;
}
.places a {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  padding: 0 5px 1px;
  font: 600 1.0625rem/1 var(--font-display);
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}

/* The building signs and the two buttons: a plate with stepped pixel corners. The corners are an
   8 x 8 pixel drawing stretched around the edges, each of its pixels one --px wide. */
.places a,
.tools button {
  --plate-art: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8' shape-rendering='crispEdges'%3E%3Cpath fill='%232a1f33' d='M2 0h4v1H2zM1 1h1v1H1zM6 1h1v1H6zM0 2h1v4H0zM7 2h1v4H7zM1 6h1v1H1zM6 6h1v1H6zM2 7h4v1H2z'/%3E%3Cpath fill='%23fffaf0' d='M2 1h4v1H2z'/%3E%3Cpath fill='%23f6ecd2' d='M1 2h6v4H1z'/%3E%3Cpath fill='%23dccba4' d='M2 6h4v1H2z'/%3E%3C/svg%3E");
  border: calc(var(--px) * 3) solid transparent;
  border-image: var(--plate-art) 3 fill / calc(var(--px) * 3) stretch;
  border-radius: 0;
  background: none;
  box-shadow: none;
  filter: drop-shadow(0 calc(var(--px) * 1.5) 0 rgba(42, 31, 51, 0.32));
}
.js .places a {
  position: fixed;
  z-index: 2;
  left: 0;
  top: 0;
  visibility: hidden;
}
.js .places a.is-placed {
  visibility: visible;
}
.js .is-veiled .places a {
  visibility: hidden;
}
.places a:hover,
.places a.is-near,
.tools button:hover {
  --plate-art: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8' shape-rendering='crispEdges'%3E%3Cpath fill='%232a1f33' d='M2 0h4v1h1v1h1v4H7v1H6v1H2V7H1V6H0V2h1V1h1z'/%3E%3C/svg%3E");
  color: var(--parchment-hi);
}
.places a:hover .chip,
.places a.is-near .chip {
  box-shadow: 0 0 0 2px var(--parchment-hi);
}
.places a:focus-visible,
.tools :focus-visible,
.dialog :focus-visible {
  outline: 3px solid var(--signal);
  outline-offset: 6px;
}
/* a building that is mostly off screen: its sign is hidden. It stays in the page for screen readers
   and shows again (at the edge of the screen) when it has keyboard focus. */
.js .places a.is-off:not(:focus-visible) {
  opacity: 0;
  pointer-events: none;
}

/* the name of whatever is close enough to read, floating above it */
.tag {
  position: fixed;
  z-index: 2;
  left: 0;
  top: 0;
  margin: 0;
  padding: 5px 10px 4px;
  font: 600 1rem/1 var(--font-display);
  color: var(--parchment-hi);
  background: var(--ink);
  white-space: nowrap;
  pointer-events: none;
}
.tag::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 100%;
  margin-left: -5px;
  border: 5px solid transparent;
  border-top-color: var(--ink);
  border-bottom-width: 0;
}
.is-veiled .tag {
  visibility: hidden;
}

/* message box */
.dialog {
  position: fixed;
  z-index: 5;
  left: 50%;
  bottom: max(18px, env(safe-area-inset-bottom));
  width: min(620px, calc(100% - 32px));
  transform: translateX(-50%);
  padding: 20px 20px 14px;
  background: var(--parchment);
  box-shadow:
    inset 0 var(--px) 0 0 var(--parchment-hi),
    inset 0 calc(var(--px) * -1) 0 0 var(--parchment-lo),
    calc(var(--px) * -1) 0 0 0 var(--ink),
    var(--px) 0 0 0 var(--ink),
    0 calc(var(--px) * -1) 0 0 var(--ink),
    0 var(--px) 0 0 var(--ink),
    0 calc(var(--px) * 3) 0 0 rgba(42, 31, 51, 0.4);
}
.dialog__who {
  position: absolute;
  left: 14px;
  bottom: calc(100% + var(--px));
  margin: 0;
  padding: 5px 12px 4px;
  font: 600 1rem/1 var(--font-display);
  color: var(--parchment-hi);
  background: var(--ink);
}
.dialog__text {
  min-height: 2.7em;
  margin: 0;
  font: 500 1.25rem/1.35 var(--font-display);
}
.dialog__rest {
  visibility: hidden;
}
.dialog__row {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: var(--s4);
  margin-top: var(--s3);
}
.dialog__next,
.dialog__link {
  padding: 7px 16px 8px;
  border: 0;
  border-radius: var(--round);
  font: 600 1.0625rem/1 var(--font-display);
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
  background: var(--signal);
  box-shadow:
    calc(var(--px) * -1) 0 0 0 var(--ink),
    var(--px) 0 0 0 var(--ink),
    0 calc(var(--px) * -1) 0 0 var(--ink),
    0 var(--px) 0 0 var(--ink);
}
.dialog__link {
  background: var(--parchment-hi);
}
.dialog__next:hover,
.dialog__link:hover {
  background: var(--ink);
  color: var(--parchment-hi);
}
.dialog__next:active,
.dialog__link:active {
  transform: translateY(2px);
}

@media (max-width: 480px) {
  .nameplate p {
    font-size: 1rem;
  }
  .dialog__text {
    font-size: 1.125rem;
  }
}
