/* The People's Page: homepage styles */

:root {
  --void: #e4e0d4;
  --paper: #faf8f2;
  --ink: #141414;
  --ink-2: #5d5a52;
  --line: rgba(20, 20, 20, 0.14);
  --accent: #ff4d1c;
  --open: #1f7a52;

  --serif: "Instrument Serif", Georgia, serif;
  --sans: "Inter Tight", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --gutter: 20px;
  --shadow: 4px 4px 0 var(--ink);
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
}

body {
  background: var(--void);
  color: var(--ink);
  font: 15px/1.55 var(--sans);
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

/* ---- stage --------------------------------------------------------------- */

.stage {
  position: fixed;
  inset: 0;
}

#wall {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: crosshair;
  user-select: none;
}

#wall.is-dragging {
  cursor: grabbing;
}

.surface {
  background: var(--paper);
  border: 1px solid var(--ink);
  box-shadow: var(--shadow);
}

/* ---- masthead -------------------------------------------------------------- */

.masthead {
  position: absolute;
  top: var(--gutter);
  left: var(--gutter);
  padding: 12px 16px 14px;
  pointer-events: none;
}

.wordmark {
  margin: 0;
  font: 400 32px/1 var(--serif);
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.wordmark em {
  color: var(--accent);
}

.tally {
  margin: 8px 0 6px;
  font: 500 11px/1 var(--mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-2);
}

.tally span {
  color: var(--ink);
}

.tally-bar {
  height: 3px;
  background: var(--line);
}

.tally-bar span {
  display: block;
  height: 100%;
  background: var(--accent);
}

/* ---- buttons --------------------------------------------------------------- */

.actions {
  position: absolute;
  top: var(--gutter);
  right: var(--gutter);
  display: flex;
  gap: 10px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 11px 16px;
  font: 500 12px/1 var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
  cursor: pointer;
  transition: transform 0.12s var(--ease), box-shadow 0.12s var(--ease), background-color 0.12s;
}

.btn:hover {
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0 var(--ink);
}

.btn:active {
  transform: translate(3px, 3px);
  box-shadow: 0 0 0 var(--ink);
}

.btn-accent {
  background: var(--accent);
}

.btn-ghost:hover {
  background: #fff;
}

.btn-block {
  display: flex;
  width: 100%;
  padding: 15px 16px;
}

.btn .arrow {
  transition: transform 0.15s var(--ease);
}

.btn:hover .arrow {
  transform: translateX(3px);
}

.label-short {
  display: none;
}

.link {
  padding: 0;
  background: none;
  border: 0;
  font: 500 12px/1 var(--mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
  cursor: pointer;
}

.link-muted {
  color: var(--ink-2);
  text-decoration-color: var(--line);
}

/* ---- intro card ------------------------------------------------------------ */

.intro {
  position: absolute;
  left: var(--gutter);
  bottom: calc(var(--gutter) + 62px);
  width: 330px;
  padding: 16px 18px 18px;
  animation: rise 0.5s 0.2s var(--ease) both;
}

.intro-lede {
  margin: 0 0 8px;
  font: 400 22px/1.15 var(--serif);
}

.intro-hint {
  margin: 0 0 16px;
  font-size: 13.5px;
  color: var(--ink-2);
}

.intro-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

/* ---- HUD ------------------------------------------------------------------- */

.hud {
  position: absolute;
  left: var(--gutter);
  bottom: var(--gutter);
  display: flex;
  gap: 10px;
  align-items: stretch;
}

.readout {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 280px;
  height: 40px;
  padding: 0 14px;
  font: 500 12px/1 var(--mono);
  white-space: nowrap;
}

#readout-coord {
  font-variant-numeric: tabular-nums;
  min-width: 82px;
}

#readout-status {
  color: var(--ink-2);
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

#readout-status.is-open {
  color: var(--open);
}

.zoom {
  display: flex;
  height: 40px;
}

.zoom button {
  width: 40px;
  padding: 0;
  display: grid;
  place-items: center;
  background: none;
  border: 0;
  border-left: 1px solid var(--line);
  font: 400 18px/1 var(--mono);
  cursor: pointer;
}

.zoom button:first-child {
  border-left: 0;
}

.zoom button:hover {
  background: var(--ink);
  color: var(--paper);
}

.zoom output {
  display: grid;
  place-items: center;
  min-width: 58px;
  border-left: 1px solid var(--line);
  font: 500 11px/1 var(--mono);
  font-variant-numeric: tabular-nums;
  color: var(--ink-2);
}

/* ---- minimap --------------------------------------------------------------- */

.minimap {
  position: absolute;
  right: var(--gutter);
  bottom: var(--gutter);
  padding: 6px;
}

#minimap {
  display: block;
  width: 132px;
  height: 132px;
  cursor: pointer;
  touch-action: none;
  image-rendering: pixelated;
}

/* ---- panel ----------------------------------------------------------------- */

.panel {
  position: absolute;
  z-index: 10;
  top: var(--gutter);
  right: var(--gutter);
  bottom: var(--gutter);
  width: min(400px, calc(100vw - 2 * var(--gutter)));
  display: flex;
  flex-direction: column;
  transform: translateX(calc(100% + 40px));
  visibility: hidden;
  transition: transform 0.32s var(--ease), visibility 0s 0.32s;
}

.panel.is-open {
  transform: none;
  visibility: visible;
  transition: transform 0.32s var(--ease);
}

.panel-close {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 1;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  background: var(--paper);
  border: 0;
  border-left: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
  cursor: pointer;
}

.panel-close:hover {
  background: var(--ink);
  color: var(--paper);
}

.panel-body {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.sheet {
  padding: 18px 22px 26px;
}

.sheet > p {
  margin: 0 0 16px;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 26px;
  margin: 0 44px 16px 0 !important;
  font: 500 12px/1 var(--mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.tag {
  padding: 4px 6px;
  font-size: 10px;
  border: 1px solid var(--ink);
}

.tag-open {
  color: var(--paper);
  background: var(--open);
  border-color: var(--open);
}

.sheet-title {
  margin: 20px 0 10px;
  font: 400 30px/1.05 var(--serif);
  letter-spacing: -0.01em;
}

.sheet-title em {
  color: var(--accent);
}

.sheet h3 {
  margin: 0 0 2px;
  font: 600 15px/1.3 var(--sans);
}

.sheet code {
  font: 500 0.85em var(--mono);
  padding: 1px 4px;
  background: var(--void);
}

/* specimen: the big preview of one square */

.specimen {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid var(--ink);
  box-shadow: var(--shadow);
  container-type: inline-size;
  margin-bottom: 18px;
}

.specimen img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.specimen img.is-pixel {
  image-rendering: pixelated;
}

.specimen-text {
  position: relative;
  width: 86%;
  text-align: center;
}

.specimen-sub {
  font-family: var(--sans);
  font-weight: 500;
  line-height: 1.2;
  opacity: 0.8;
}

.specimen-text span {
  display: block;
  white-space: nowrap;
}

.font-sans {
  font-family: var(--sans);
  font-weight: 600;
}

.font-serif {
  font-family: var(--serif);
  font-weight: 400;
}

.font-mono {
  font-family: var(--mono);
  font-weight: 500;
}

.specimen.is-empty {
  background: repeating-linear-gradient(-45deg, transparent 0 9px, var(--line) 9px 10px) var(--paper);
  box-shadow: none;
  border-style: dashed;
  align-content: center;
  gap: 6px;
}

.specimen-plus {
  font: 300 72px/0.8 var(--sans);
  color: var(--accent);
}

.specimen-coord {
  padding: 4px 8px;
  font: 500 13px/1 var(--mono);
  background: var(--paper);
}

.caption {
  font: 400 22px/1.2 var(--serif);
}

.meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin: 0 0 22px;
  border-top: 1px solid var(--ink);
}

.meta div {
  padding: 10px 0;
}

.meta dt {
  font: 500 10px/1 var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-2);
  margin-bottom: 6px;
}

.meta dd {
  margin: 0;
  font-weight: 600;
}

.nearby {
  padding-top: 16px;
  border-top: 1px dashed var(--line);
}

.nearby p {
  margin: 0 0 12px;
  font-size: 14px;
  color: var(--ink-2);
}

.nearby strong {
  white-space: nowrap;
  font: 500 13px var(--mono);
  color: var(--ink);
}

.fine {
  margin-top: 12px !important;
  font-size: 13px;
  color: var(--ink-2);
}

.fine a {
  color: var(--ink);
  text-decoration-color: var(--accent);
  text-underline-offset: 3px;
}

/* about */

.steps {
  list-style: none;
  margin: 22px 0;
  padding: 0;
  border-top: 1px solid var(--ink);
}

.steps li {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 8px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.steps p {
  margin: 0;
  font-size: 14px;
  color: var(--ink-2);
}

.step-n {
  font: 500 12px/1.6 var(--mono);
  color: var(--accent);
}

.rules {
  margin: 0 0 22px;
  padding: 14px 16px;
  background: var(--void);
}

.rules h3 {
  font: 500 11px/1 var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.rules ul {
  margin: 0;
  padding-left: 18px;
  font-size: 14px;
}

.rules li + li {
  margin-top: 4px;
}

.signoff {
  margin: 22px 0 0 !important;
  font: italic 400 20px/1 var(--serif);
  color: var(--ink-2);
}

/* request form */

.request .lede {
  font-size: 14px;
  color: var(--ink-2);
}

.q {
  margin: 0 0 22px;
  padding: 14px 0 0;
  border: 0;
  border-top: 1px solid var(--ink);
  min-width: 0;
}

.q legend {
  float: left;
  width: 100%;
  margin: 0 0 12px;
  padding: 0;
  font: 600 16px/1.3 var(--sans);
}

.q legend + * {
  clear: both;
}

.q-n {
  margin-right: 10px;
  font: 500 12px var(--mono);
  color: var(--accent);
}

.field {
  display: grid;
  gap: 6px;
  margin-top: 14px;
}

.q legend + .field,
.q legend + .coord-inputs,
.q legend + .choices {
  margin-top: 0;
}

.field-label {
  font: 500 11px/1 var(--mono);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.optional {
  margin-left: 6px;
  color: var(--ink-2);
  text-transform: none;
  letter-spacing: 0;
}

.field-help {
  font-size: 12.5px;
  color: var(--ink-2);
}

.request input:not([type="radio"]):not([type="color"]),
.request textarea,
.request select {
  width: 100%;
  padding: 10px 12px;
  font: 400 15px/1.35 var(--sans);
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--ink);
  border-radius: 0;
  -webkit-appearance: none;
  appearance: none;
}

.request textarea {
  resize: vertical;
  min-height: 64px;
}

.request select {
  background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%), linear-gradient(-45deg, transparent 50%, var(--ink) 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
  padding-right: 34px;
}

.request input:focus,
.request textarea:focus,
.request select:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}

.coord-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.coord-field {
  display: flex;
  align-items: stretch;
}

.coord-field span {
  display: grid;
  place-items: center;
  width: 38px;
  flex: none;
  font: 500 13px var(--mono);
  color: var(--paper);
  background: var(--ink);
}

.coord-field input {
  font-family: var(--mono) !important;
  font-variant-numeric: tabular-nums;
}

.hint {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--ink-2);
}

.hint.is-ok {
  color: var(--open);
}

.hint.is-bad {
  color: #c62a12;
}

.error {
  margin: 6px 0 0;
  font-size: 13px;
  font-weight: 500;
  color: #c62a12;
}

.error:empty {
  display: none;
}

.choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.choice {
  position: relative;
  cursor: pointer;
}

.choice input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.choice span {
  display: block;
  padding: 10px 12px;
  font-size: 14px;
  font-weight: 500;
  text-align: center;
  border: 1px solid var(--ink);
  background: #fff;
  transition: background-color 0.12s, color 0.12s;
}

.choice:hover span {
  background: var(--void);
}

.choice input:checked + span {
  color: var(--paper);
  background: var(--ink);
}

.choice input:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.swatch {
  display: flex;
  align-items: center;
  border: 1px solid var(--ink);
  background: #fff;
}

.swatch input[type="color"] {
  width: 44px;
  height: 40px;
  padding: 0;
  border: 0;
  border-right: 1px solid var(--ink);
  background: none;
  cursor: pointer;
}

.swatch input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

.swatch input[type="color"]::-webkit-color-swatch {
  border: 0;
}

.swatch input[type="color"]::-moz-color-swatch {
  border: 0;
}

.swatch output {
  padding: 0 10px;
  font: 500 13px var(--mono);
}

.preview {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 18px;
  padding: 14px;
  background: var(--void);
}

.preview-square {
  flex: none;
  width: 112px;
}

.preview-square .specimen {
  margin: 0;
  box-shadow: 3px 3px 0 var(--ink);
}

.preview-note {
  margin: 0;
  font-size: 13px;
  color: var(--ink-2);
}

.sent {
  margin-top: 22px;
  padding: 16px;
  border: 1px solid var(--ink);
  background: #fff;
}

.sent h3 {
  font: 400 24px/1.1 var(--serif);
  margin-bottom: 8px;
}

.sent p {
  margin: 0 0 10px;
  font-size: 14px;
}

.sent a:not(.btn) {
  color: var(--ink);
  text-decoration-color: var(--accent);
  text-underline-offset: 3px;
}

.sent textarea {
  margin: 4px 0 12px;
  font: 400 12px/1.45 var(--mono) !important;
  background: var(--paper) !important;
}

/* ---- small screens ------------------------------------------------------------ */

@media (max-width: 860px) {
  .minimap {
    display: none;
  }
}

@media (max-width: 640px) {
  :root {
    --gutter: 12px;
    --shadow: 3px 3px 0 var(--ink);
  }

  .masthead {
    padding: 9px 12px 11px;
  }

  .wordmark {
    font-size: 23px;
  }

  .tally {
    font-size: 10px;
    margin: 6px 0 5px;
  }

  .actions {
    gap: 8px;
  }

  .actions .btn {
    padding: 10px 12px;
  }

  .label-long {
    display: none;
  }

  .label-short {
    display: inline;
  }

  #open-about {
    width: 38px;
    padding-inline: 0;
    font-size: 15px;
  }

  .intro {
    left: var(--gutter);
    right: var(--gutter);
    width: auto;
    bottom: calc(var(--gutter) + 54px);
  }

  .hud {
    right: var(--gutter);
  }

  .readout {
    flex: 1;
    width: auto;
    min-width: 0;
    gap: 8px;
  }

  #readout-coord {
    min-width: 0;
  }

  .zoom output {
    display: none;
  }

  .zoom button {
    width: 38px;
  }

  .panel {
    top: auto;
    left: var(--gutter);
    width: auto;
    max-height: 80vh;
    max-height: 80dvh;
    transform: translateY(calc(100% + 40px));
  }

  .sheet {
    padding: 14px 16px 20px;
  }

  .specimen {
    width: min(100%, 300px);
    margin-inline: auto;
  }
}

@media (max-width: 360px) {
  .wordmark {
    font-size: 20px;
  }
}

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