:root {
  --color-text: #000000;
  --color-muted: #9c9c9c;
  --color-accent: #0052e1;
  --font-sans: "42dot Sans", system-ui, -apple-system, sans-serif;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background-color: #ffffff;
  background-image: radial-gradient(circle, #eeeeee 1px, transparent 1px);
  background-size: 12px 12px;
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.25;
}

a {
  color: inherit;
  text-decoration: none;
}

.nav {
  width: 263px;
  max-width: 100%;
  display: flex;
  justify-content: center;
  gap: 48px;
  white-space: nowrap;
}

.nav a {
  position: relative;
  outline: none;
  transition: color 160ms ease, transform 160ms ease;
}

.nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -3px;
  height: 1px;
  background: var(--color-accent);
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 160ms ease;
}

.nav a:hover,
.nav a:focus-visible {
  color: var(--color-accent);
  transform: translateY(-2px);
}

.nav a:hover::after,
.nav a:focus-visible::after {
  transform: scaleX(1);
}

.nav a:active {
  transform: translateY(0);
}

.footer-email-link::before {
  content: attr(data-email);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 9px);
  padding: 6px 8px;
  color: var(--color-text);
  background: #ffffff;
  border: 1px solid #000000;
  box-shadow: 2px 2px 0 #000000;
  font-size: 12px;
  line-height: 1;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 4px);
  transition: opacity 160ms ease, transform 160ms ease;
  white-space: nowrap;
  z-index: 2;
}

.footer-email-link:hover::before,
.footer-email-link:focus-visible::before {
  opacity: 1;
  transform: translate(-50%, 0);
}

.highlight {
  color: var(--color-accent);
}

.figma-page {
  width: 670px;
  max-width: calc(100% - 48px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 35px 0 24px;
  position: relative;
}

.figma-nav,
.figma-footer {
  width: 314px;
  gap: 48px;
  margin: 0 auto;
}

.figma-hero {
  margin-top: 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
}

.figma-hero h1 {
  font-size: 26px;
  font-weight: 400;
  line-height: 1.25;
}

.figma-hero p {
  font-size: 18px;
  white-space: nowrap;
}

.figma-bio {
  width: 510px;
  margin: 27px auto 0;
  display: grid;
  grid-template-columns: 234px 234px;
  gap: 42px;
}

.figma-bio p + p {
  margin-top: 20px;
}

.figma-bio strong {
  font-weight: 800;
}

.figma-card-field {
  height: 287px;
  margin-top: 45px;
  position: relative;
  overflow: visible;
}

.figma-select-card {
  --selector-handle-offset: -5px;
  --selector-handle-size: 7px;
  --selector-corner-distance: 106px;
  position: absolute;
  width: 265px;
  height: 106px;
  padding: 8px;
  border: 1px dashed var(--color-accent);
  background: transparent;
  cursor: grab;
  touch-action: none;
  transition: transform 160ms ease;
  user-select: none;
  contain: layout;
}

.figma-select-card::before,
.figma-select-card::after {
  content: "";
  position: absolute;
  top: var(--selector-handle-offset);
  width: var(--selector-handle-size);
  height: var(--selector-handle-size);
  background: #fffefe;
  box-shadow:
    0 0 0 1px var(--color-accent),
    0 var(--selector-corner-distance) 0 0 #fffefe,
    0 var(--selector-corner-distance) 0 1px var(--color-accent);
  pointer-events: none;
  z-index: 1;
}

.figma-select-card::before {
  left: var(--selector-handle-offset);
}

.figma-select-card::after {
  right: var(--selector-handle-offset);
}

.figma-card-inner {
  width: 248px;
  height: 87px;
  margin-top: 1px;
  display: grid;
  grid-template-columns: 56px 1fr;
  align-items: center;
  gap: 19px;
  padding: 9px;
  overflow: hidden;
  background: #ffffff;
  border: 1px solid #000000;
  box-shadow: 3px 2px 0 #000000;
  transition: box-shadow 160ms ease, transform 160ms ease;
  pointer-events: none;
}

.figma-select-card:hover {
  transform: translateY(-3px);
}

.figma-select-card:hover .figma-card-inner {
  box-shadow: 5px 4px 0 #000000;
}

.figma-select-card.is-dragging {
  cursor: grabbing;
  transform: translateY(-3px) scale(1.01);
}

.figma-select-card.is-dragging .figma-card-inner {
  box-shadow: 6px 5px 0 #000000;
}

.rotate-left {
  transform: rotate(-1deg);
}

.rotate-right {
  transform: rotate(1deg);
}

.figma-logo {
  width: 56px;
  height: 56px;
  border-radius: 5px;
  background: #000000;
  object-fit: cover;
}

.card-uber .figma-logo {
  transform: scale(1.08);
}

.card-uber .figma-card-inner p:first-child {
  font-size: 15px;
}

.figma-card-inner p {
  font-size: 12px;
  line-height: 1.5;
  color: var(--color-muted);
  white-space: nowrap;
}

.figma-card-inner p:first-child {
  font-size: 14px;
  color: var(--color-text);
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-uber {
  left: max(-180px, calc(50% - 520px));
  top: 0;
}

.card-amazon {
  left: min(580px, calc(50% + 245px));
  top: 0;
}

.card-blizzard {
  left: 204px;
  top: 91px;
}

.card-left {
  left: max(-210px, calc(50% - 560px));
  top: 184px;
}

.card-right {
  left: min(600px, calc(50% + 270px));
  top: 184px;
}

.figma-footer {
  position: absolute;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
}

.project-page {
  display: flex;
  flex-direction: column;
}

.project-canvas {
  flex: 1;
  width: 640px;
  max-width: 100%;
  margin: 66px auto 92px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.invaders-shell {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.game-status {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  opacity: 1;
  transform: translateY(0);
  transition: opacity 520ms ease, transform 520ms ease;
}

.stat-card {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 10px;
  background: #ffffff;
  border: 1px solid #000000;
  box-shadow: 2px 2px 0 #000000;
}

.stat-label {
  color: var(--color-text);
  font-size: 14px;
  font-weight: 700;
}

.stat-value {
  color: var(--color-text);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  line-height: 1;
  text-align: right;
}

.life-hearts {
  min-width: 75px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.life-heart {
  position: relative;
  width: 21px;
  height: 18px;
  flex: 0 0 21px;
}

.life-heart::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 0;
  width: 3px;
  height: 3px;
  background: var(--color-accent);
  filter: drop-shadow(1px 1px 0 #000000);
  transform-origin: 10px 9px;
  box-shadow:
    3px 0 var(--color-accent),
    9px 0 var(--color-accent),
    12px 0 var(--color-accent),
    -3px 3px var(--color-accent),
    0 3px var(--color-accent),
    3px 3px var(--color-accent),
    6px 3px var(--color-accent),
    9px 3px var(--color-accent),
    12px 3px var(--color-accent),
    15px 3px var(--color-accent),
    -3px 6px var(--color-accent),
    0 6px var(--color-accent),
    3px 6px var(--color-accent),
    6px 6px var(--color-accent),
    9px 6px var(--color-accent),
    12px 6px var(--color-accent),
    15px 6px var(--color-accent),
    0 9px var(--color-accent),
    3px 9px var(--color-accent),
    6px 9px var(--color-accent),
    9px 9px var(--color-accent),
    12px 9px var(--color-accent),
    3px 12px var(--color-accent),
    6px 12px var(--color-accent),
    9px 12px var(--color-accent),
    6px 15px var(--color-accent);
}

.life-heart.is-empty::before {
  opacity: 0;
}

.life-heart.is-breaking::before {
  animation: heart-break 650ms steps(4, end) forwards;
}

.life-heart.is-breaking::after {
  content: "";
  position: absolute;
  left: 10px;
  top: 6px;
  width: 3px;
  height: 3px;
  background: #000000;
  box-shadow:
    -6px 6px #000000,
    5px 8px #000000;
  animation: heart-sparks 650ms steps(3, end) forwards;
}

.game-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  transform: translateY(0);
  transition: opacity 520ms ease 120ms, transform 520ms ease 120ms;
}

.invaders-shell.is-loading .game-status,
.invaders-shell.is-loading .game-controls {
  opacity: 0;
  pointer-events: none;
  transition-delay: 0ms;
}

.invaders-shell.is-loading .game-status {
  transform: translateY(8px);
}

.invaders-shell.is-loading .game-controls {
  transform: translateY(-8px);
}

#invaders-game {
  width: 100%;
  aspect-ratio: 548 / 300;
  display: block;
  background: #ffffff;
  border: 1px solid #000000;
  box-shadow: 4px 3px 0 #000000;
  contain: strict;
  image-rendering: pixelated;
}

.game-controls {
  color: var(--color-muted);
}

.game-help {
  min-width: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 20px;
}

.control-hint {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.keycap {
  min-width: 22px;
  height: 20px;
  padding: 0 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text);
  background: #ffffff;
  border: 1px solid #000000;
  box-shadow: 1px 1px 0 #000000;
  font-size: 12px;
  line-height: 1;
}

.keycap-wide {
  min-width: 48px;
}

@keyframes heart-break {
  0% {
    opacity: 1;
    transform: translate(0, 0) scale(1);
  }

  35% {
    opacity: 1;
    transform: translate(-2px, -3px) scale(1);
  }

  70% {
    opacity: 0.7;
    transform: translate(3px, 3px) scale(0.75);
  }

  100% {
    opacity: 0;
    transform: translate(0, 9px) scale(0.4);
  }
}

@keyframes heart-sparks {
  0% {
    opacity: 0;
    transform: translate(0, 0);
  }

  30% {
    opacity: 1;
    transform: translate(0, -2px);
  }

  100% {
    opacity: 0;
    transform: translate(4px, 6px);
  }
}

/* Small screens */
@media (max-width: 560px) {
  .figma-page {
    width: 548px;
    min-height: auto;
    padding-bottom: 44px;
  }

  .figma-bio {
    width: 100%;
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .figma-card-field {
    height: auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
  }

  .figma-select-card {
    position: relative;
    left: auto;
    right: auto;
    top: auto;
    width: 100%;
  }

  .figma-card-inner {
    width: 100%;
  }

  .figma-footer {
    position: static;
    transform: none;
    margin-top: 32px;
  }

  .project-canvas {
    margin: 64px auto 32px;
  }

  .game-status {
    grid-template-columns: 1fr;
  }

  .game-controls {
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
  }

  .game-help {
    justify-content: space-between;
  }

}
