@font-face {
  font-family: "Archivo";
  src: url("./fonts/archivo-latin-wght-normal.woff2") format("woff2");
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --paper: #f2efe6;
  --title: #080808;
  --accent: #cc3027;
  --ink: var(--title);
  --edge: clamp(10px, 1.7vmin, 22px);
  --icon-padding: .045;
}

* { box-sizing: border-box; }

html,
body {
  margin: 0;
  width: 100%;
  min-height: 100%;
  background: var(--paper);
  color: var(--ink);
}

body {
  overflow: hidden;
  font-family: Arial, Helvetica, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

.stage {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: var(--paper);
}
.stage.clickable { cursor: pointer; }

.field {
  position: absolute;
  inset: var(--edge);
  visibility: hidden;
}
.stage.ready .field { visibility: visible; }

.signature {
  position: absolute;
  left: var(--edge);
  bottom: var(--edge);
  z-index: 3;
  margin: 0;
  color: var(--title);
  font-family: "Archivo", "Helvetica Neue", Arial, sans-serif;
  font-size: clamp(92px, min(30vw, 26vh), 280px);
  font-weight: 880;
  font-variation-settings: "wght" 880;
  line-height: .78;
  letter-spacing: -.075em;
  opacity: .18;
  transition: opacity 320ms ease;
  pointer-events: none;
  text-rendering: geometricPrecision;
}
.stage.ready .signature { opacity: 1; }

.signature span { display: block; }

@media (max-width: 700px) {
  .signature {
    bottom: calc(var(--edge) + .05em + env(safe-area-inset-bottom));
  }
}

.node {
  --service-accent: var(--accent);
  --service-ink: var(--paper);
  position: absolute;
  left: calc(var(--x) * 1%);
  top: calc(var(--y) * 1%);
  width: calc(var(--w) * 1%);
  height: calc(var(--h) * 1%);
  appearance: none;
  border: 0;
  padding: 0;
  color: inherit;
  background: none;
  font: inherit;
  text-decoration: none;
  isolation: isolate;
  outline: none;
  z-index: 2;
  pointer-events: none;
  opacity: 0;
}

.stage.ready .node {
  animation: node-reveal 300ms cubic-bezier(.2, .8, .2, 1) both;
  animation-delay: calc(var(--reveal-index) * 14ms);
}


.glyph {
  position: absolute;
  inset: calc(var(--icon-padding) * 100%);
  display: block;
  width: auto;
  height: auto;
  object-fit: contain;
  transform: rotate(var(--rotation));
  transform-origin: 50% 50%;
  opacity: .82;
  transition: transform 150ms cubic-bezier(.2,.8,.2,1), opacity 150ms ease, filter 150ms ease;
  pointer-events: none;
}

.node.hovered,
.node:focus-visible,
.node.armed {
  z-index: 100;
}

.node.hovered .glyph,
.node:focus-visible .glyph,
.node.armed .glyph {
  transform: rotate(var(--rotation)) scale(1.07);
  opacity: 1;
  filter: drop-shadow(4px 4px 0 var(--service-accent));
}

.stage.clickable .node:not(.hovered) .glyph {
  opacity: .54;
}

.label {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 4;
  padding: .48em .72em .43em;
  border: 2px solid var(--title);
  color: var(--service-ink);
  background: var(--service-accent);
  box-shadow: 4px 4px 0 var(--title);
  font-family: "Archivo", "Helvetica Neue", Arial, sans-serif;
  font-size: clamp(16px, 2.35vmin, 32px);
  font-weight: 850;
  line-height: 1;
  letter-spacing: -.035em;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%) rotate(-2deg) scale(.82);
  transition: opacity 90ms linear, transform 140ms cubic-bezier(.2,.8,.2,1);
}

.node.hovered .label,
.node:focus-visible .label,
.node.armed .label {
  opacity: 1;
  transform: translate(-50%, -50%) rotate(-2deg) scale(1);
}

dialog {
  width: min(260px, calc(100vw - 32px));
  padding: 0;
  border: 0;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 12px 12px 0 var(--ink);
}

dialog::backdrop { background: rgb(8 8 8 / 72%); }

dialog img { display: block; width: 100%; height: auto; }

dialog button {
  width: 100%;
  border: 0;
  border-top: 4px solid var(--ink);
  padding: 12px;
  color: var(--service-ink);
  background: var(--service-accent);
  font: 800 15px/1 Arial, Helvetica, sans-serif;
  cursor: pointer;
}

@media (max-width: 699px), (max-aspect-ratio: 4 / 5) {
  :root { --icon-padding: .035; }
  .label { font-size: 14px; }
}

@media (hover: none) {
  .field.has-armed .node:not(.armed) .glyph { opacity: .54; }
}

@keyframes node-reveal {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .signature,
  .glyph,
  .label { transition: none; }

  .stage.ready .node {
    opacity: 1;
    animation: none;
  }
}
