:root {
  color-scheme: dark;
  --bg: #0a0c10;
  --fg: #eef0f6;
  --muted: #8f97ab;
  --gap: clamp(14px, 2vw, 24px);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

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

body {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: clamp(32px, 6vw, 80px) clamp(16px, 4vw, 48px);
  background: var(--bg);
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
}

/* Backdrop: three slow-drifting colour washes under a faint grid that fades out. */
.bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; }
.bg::before {
  content: "";
  position: absolute;
  inset: -20%;
  background:
    radial-gradient(48rem 36rem at 15% 5%, oklch(0.36 0.15 285 / .55), transparent 65%),
    radial-gradient(44rem 34rem at 90% 15%, oklch(0.40 0.13 160 / .35), transparent 65%),
    radial-gradient(52rem 38rem at 55% 105%, oklch(0.42 0.16 35 / .35), transparent 65%);
  animation: drift 32s ease-in-out infinite alternate;
}
.bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(oklch(1 0 0 / .045) 1px, transparent 1px),
    linear-gradient(90deg, oklch(1 0 0 / .045) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse at 50% 35%, #000 0, transparent 70%);
}
@keyframes drift { to { transform: translate3d(3%, 2%, 0) scale(1.08); } }

main { width: min(960px, 100%); }

header { margin-bottom: clamp(32px, 6vw, 64px); }
.eyebrow {
  font: 500 .8rem/1 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--muted);
}
h1 {
  margin-top: 1rem;
  font-size: clamp(2.75rem, 8vw, 5.5rem);
  font-weight: 700;
  line-height: .95;
  letter-spacing: -.045em;
  background: linear-gradient(180deg, #fff 20%, #8b94ad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.lede { margin-top: 1rem; font-size: clamp(1rem, 2vw, 1.25rem); color: var(--muted); }

/* 1 column on phones, then 2, then 3. Tiles stay square; the last row is short when the count isn't a multiple of 3. */
.grid {
  list-style: none;
  padding: 0;
  display: grid;
  gap: var(--gap);
  grid-template-columns: 1fr;
}
@media (min-width: 480px)  { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 780px)  { .grid { grid-template-columns: repeat(3, 1fr); } }

.grid li { animation: rise .7s cubic-bezier(.2, .7, .2, 1) both; animation-delay: calc(var(--i) * 70ms + 100ms); }
.grid li:nth-child(1) { --i: 0; }
.grid li:nth-child(2) { --i: 1; }
.grid li:nth-child(3) { --i: 2; }
.grid li:nth-child(4) { --i: 3; }
.grid li:nth-child(5) { --i: 4; }
.grid li:nth-child(6) { --i: 5; }
.grid li:nth-child(7) { --i: 6; }
.grid li:nth-child(8) { --i: 7; }
.grid li:nth-child(9) { --i: 8; }
.grid li:nth-child(10) { --i: 9; }
.grid li:nth-child(11) { --i: 10; }
.grid li:nth-child(12) { --i: 11; }
.grid li:nth-child(13) { --i: 12; }
@keyframes rise { from { opacity: 0; transform: translateY(18px); } }

/* One hue per app; everything else on the tile is derived from it. */
.fin     { --h: 160; }
.gnosis  { --h: 285; }
.trapdoor{ --h: 85; }
.forge   { --h: 40; }
.hush    { --h: 225; }
.quovadis{ --h: 350; }
.bell    { --h: 195; }
.familydrive { --h: 255; }
.inventory   { --h: 120; }
.sidelight   { --h: 15; }
.friendchat  { --h: 315; }
.shopping    { --h: 62; }
.housediary  { --h: 140; }

.tile {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  aspect-ratio: 1;
  padding: clamp(18px, 2vw, 26px);
  overflow: hidden;
  border-radius: 18px;
  border: 1px solid oklch(1 0 0 / .09);
  background: linear-gradient(155deg, oklch(0.31 0.085 var(--h)), oklch(0.17 0.02 var(--h)) 72%);
  color: inherit;
  text-decoration: none;
  transition: transform .25s ease, border-color .25s ease, box-shadow .25s ease;
}

/* Spotlight that follows the pointer (app.js sets --mx / --my). */
.tile::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: radial-gradient(16rem circle at var(--mx, 50%) var(--my, 0%), oklch(0.72 0.17 var(--h) / .30), transparent 65%);
  opacity: 0;
  transition: opacity .3s ease;
}
a.tile:hover, a.tile:focus-visible {
  transform: translateY(-5px);
  border-color: oklch(0.78 0.14 var(--h) / .65);
  box-shadow: 0 24px 48px -24px oklch(0.65 0.2 var(--h) / .7);
}
a.tile:hover::before, a.tile:focus-visible::before { opacity: 1; }
a.tile:focus-visible { outline: 2px solid oklch(0.88 0.1 var(--h)); outline-offset: 4px; }

.top { display: flex; justify-content: space-between; align-items: flex-start; }
.icon {
  width: 2rem;
  height: 2rem;
  fill: none;
  stroke: oklch(0.82 0.13 var(--h));
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.go {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: oklch(1 0 0 / .07);
  color: oklch(0.9 0.08 var(--h));
  transition: transform .25s ease, background .25s ease;
}
a.tile:hover .go, a.tile:focus-visible .go { transform: translate(2px, -2px); background: oklch(0.75 0.15 var(--h) / .35); }

.name { margin-top: auto; font-size: clamp(1.25rem, 1.8vw, 1.5rem); font-weight: 650; letter-spacing: -.02em; }
.desc { margin-top: .35rem; font-size: .92rem; line-height: 1.35; color: var(--muted); }

/* Big faint index number in the empty middle of the tile, clear of the text. */
.num {
  position: absolute;
  right: .8rem;
  top: 50%;
  transform: translateY(-62%);
  z-index: -1;
  font: 700 6.5rem/1 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  letter-spacing: -.06em;
  color: oklch(1 0 0 / .045);
  user-select: none;
}

/* No link yet: same tile, dimmed, dashed, not clickable. */
.tile.soon { border-style: dashed; background: oklch(0.2 0.02 var(--h) / .55); cursor: default; }
.tile.soon .icon { stroke: oklch(0.7 0.06 var(--h)); }
.pill {
  padding: .3rem .65rem;
  border-radius: 999px;
  border: 1px solid oklch(1 0 0 / .12);
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
}

@media (prefers-reduced-motion: reduce) {
  .bg::before, .grid li { animation: none; }
  .tile, .go { transition: none; }
  a.tile:hover, a.tile:focus-visible, a.tile:hover .go, a.tile:focus-visible .go { transform: none; }
}
