:root {
  --bg: #050505;
  --square: #ffffff;   /* resting outline color (drawn at low opacity) */
  --accent: #ff2a2a;   /* gradient start (top-left) */
  --accent-2: #a30a12; /* gradient end (bottom-right) */
  --flash: #ff6a3d;    /* color ripples wash squares toward */
  --letter: #ff1a1a;   /* squares that spell out the word */
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Lock the page to the viewport: no scrolling, ever. */
html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none; /* touch drags move the grid instead of panning */
}

body {
  height: 100dvh;
  background: var(--bg);
  color: #fff;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

#grid {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
}

.content {
  position: relative;
  z-index: 1;
  height: 100%;
  display: grid;
  place-items: center;
  /* Let the mouse pass through empty areas to the grid */
  pointer-events: none;
}

.content > * {
  pointer-events: auto;
}

/* Project links. grid.js snaps each one onto the square grid ("snapped");
   without JS they fall back to a simple centered row. */
.projects {
  counter-reset: project;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.projects.snapped {
  position: absolute;
  inset: 0;
  display: block;
  pointer-events: none;
}

.projects a {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 46px;
  padding: 0 14px;
  white-space: nowrap;
  font: 500 13px/1 ui-monospace, "Cascadia Mono", "SF Mono", Consolas, monospace;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.72);
  text-decoration: none;
  background: var(--bg);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 3px;
  transition: color 0.2s, border-color 0.2s, background-color 0.2s, box-shadow 0.2s;
}

.projects.snapped a {
  position: absolute;
  pointer-events: auto;
}

.projects a::before {
  counter-increment: project;
  content: counter(project, decimal-leading-zero);
  color: var(--letter);
}

.projects a::after {
  content: "\2197";
  margin-left: auto;
  padding-left: 4px;
  opacity: 0.35;
  transition: opacity 0.2s, transform 0.2s;
}

/* Hover styles only on devices that can hover, so they don't stick after a tap */
@media (hover: hover) {
  .projects a:hover {
    color: #fff;
    background: #140405;
    border-color: var(--letter);
    box-shadow: 0 0 20px rgba(255, 26, 26, 0.22);
  }

  .projects a:hover::after {
    opacity: 1;
    transform: translate(2px, -2px);
  }
}

.projects a:focus-visible,
.projects a:active {
  color: #fff;
  background: #140405;
  border-color: var(--letter);
  box-shadow: 0 0 20px rgba(255, 26, 26, 0.22);
}

.projects a:focus-visible {
  outline: 1px solid var(--letter);
  outline-offset: 3px;
}

.projects a:focus-visible::after {
  opacity: 1;
  transform: translate(2px, -2px);
}

@media (max-width: 480px) {
  .projects a {
    font-size: 12px;
  }
}

/* Hidden visually but read by screen readers (the word itself is drawn on the canvas) */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
