@font-face {
  font-family: "JetBrains Mono";
  src: url("/fonts/JetBrainsMono-Regular.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "JetBrains Mono";
  src: url("/fonts/JetBrainsMono-Bold.ttf") format("truetype");
  font-weight: 700;
  font-display: swap;
}

:root {
  --bg: #0d1016;
  --bg-vignette: #131a20;
  --tile-bg: rgba(255, 255, 255, 0.04);
  --tile-border: rgba(255, 255, 255, 0.09);
  --text: rgba(235, 245, 244, 0.95);
  --text-dim: rgba(210, 225, 224, 0.4);
  --accent: #2fd8c8;
  --accent-deep: #0f6e7a;
  --status: #3ce6d4;
}

* {
  box-sizing: border-box;
}

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

body {
  position: relative;
  background: var(--bg);
  color: var(--text);
  font-family: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  isolation: isolate;
}

/* Ambient atmosphere: a slow, barely-visible drift behind everything,
   so the page still feels alive when the cursor is still. */
body::before {
  content: "";
  position: fixed;
  inset: -10%;
  z-index: -1;
  background: radial-gradient(45% 40% at 50% 10%, var(--bg-vignette) 0%, transparent 70%);
  animation: drift 26s ease-in-out infinite;
}

.spotlight {
  position: fixed;
  top: 0;
  left: 0;
  width: 560px;
  height: 560px;
  margin: -280px 0 0 -280px;
  pointer-events: none;
  background: radial-gradient(
    circle,
    var(--accent) 0%,
    var(--accent-deep) 45%,
    transparent 75%
  );
  opacity: 0;
  mix-blend-mode: screen;
  filter: blur(16px);
  transition: opacity 0.4s ease;
  will-change: transform;
  z-index: 0;
}

.spotlight.active {
  opacity: 0.4;
}

.grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 140px));
  justify-content: center;
  gap: 18px;
  padding: 24px;
  max-width: 900px;
}

.tile {
  position: relative;
  aspect-ratio: 1;
  border-radius: 20px;
  background: var(--tile-bg);
  border: 1px solid var(--tile-border);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 14px;
  text-decoration: none;
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  overflow: hidden;
  cursor: pointer;

  --rx: 0deg;
  --ry: 0deg;
  --glow: 0;

  opacity: 0;
  transform: translateY(10px) scale(0.96) perspective(700px) rotateX(var(--rx)) rotateY(var(--ry));
  border-color: color-mix(in srgb, var(--tile-border) calc(100% - var(--glow) * 70%), var(--accent) calc(var(--glow) * 70%));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 0 calc(var(--glow) * 34px) rgba(47, 216, 200, calc(var(--glow) * 0.45));
  transition:
    transform 0.5s cubic-bezier(0.16, 1, 0.3, 1),
    opacity 0.5s ease,
    border-color 0.25s ease,
    box-shadow 0.25s ease;
}

.tile.in {
  opacity: 1;
  transform: translateY(0) scale(1) perspective(700px) rotateX(var(--rx)) rotateY(var(--ry));
}

.tile.in:hover,
.tile.in:focus-visible {
  transform: translateY(-3px) scale(1.045) perspective(700px) rotateX(var(--rx)) rotateY(var(--ry));
  transition: transform 0.15s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.25s ease, box-shadow 0.25s ease;
}

.tile.in:active {
  transform: translateY(1px) scale(0.97) perspective(700px) rotateX(var(--rx)) rotateY(var(--ry));
  transition: transform 0.08s ease;
}

.tile::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(circle at 50% 30%, rgba(255, 255, 255, 0.14), transparent 60%);
  opacity: calc(var(--glow) * 0.9);
  transition: opacity 0.15s ease;
  pointer-events: none;
}

.tile .status {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--status);
  box-shadow: 0 0 6px var(--status);
  opacity: 0;
  transition: opacity 0.4s ease;
}

.tile .status.on {
  opacity: 1;
  animation: breathe 2.6s ease-in-out infinite;
}

.tile span:last-child {
  position: relative;
  word-break: break-word;
  line-height: 1.35;
}

.empty {
  color: var(--text-dim);
  font-size: 0.85rem;
  z-index: 1;
}

@keyframes breathe {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

@keyframes drift {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(2%, -3%); }
}

@media (prefers-reduced-motion: reduce) {
  .tile, .tile .status, body::before {
    transition: none !important;
    animation: none !important;
  }
  .tile {
    opacity: 1;
    transform: none;
  }
  .tile .status {
    opacity: 0.7;
  }
  .spotlight,
  body::before {
    display: none;
  }
}

@media (prefers-reduced-transparency: reduce) {
  .tile {
    background: #171d22;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
  .spotlight {
    display: none;
  }
}
