:root {
  --bg: #f4f5f8;
  --bg-tile: #ffffff;
  --accent: #8195c9;
  --accent-2: #c79bb8;
  --accent-3: #93c2b3;
  --text: #424657;
  --text-muted: #9398a8;
  --border: rgba(129, 149, 201, 0.16);
  --shadow: 0 4px 14px rgba(80, 90, 120, 0.08);
  --shadow-hover: 0 12px 28px rgba(80, 90, 120, 0.16);
  --gap: 24px;
  --radius: 18px;
  --max-width: 1100px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  /* Soft muted glow matching the palette accents. */
  background-image:
    radial-gradient(820px 520px at 12% -8%, rgba(129, 149, 201, 0.20), transparent 60%),
    radial-gradient(720px 520px at 92% 0%, rgba(199, 155, 184, 0.20), transparent 58%),
    radial-gradient(680px 520px at 50% 115%, rgba(147, 194, 179, 0.18), transparent 60%);
  background-attachment: fixed;
  color: var(--text);
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  display: flex;
  flex-direction: column;
}

.site-header {
  text-align: center;
  padding: 64px 24px 24px;
}

.site-title {
  margin: 0;
  font-size: 2.6rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  /* Soft multi-pastel gradient text. */
  background: linear-gradient(100deg, var(--accent) 0%, var(--accent-2) 55%, var(--accent-3) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.site-subtitle {
  margin: 12px 0 0;
  color: var(--text-muted);
  font-size: 1.05rem;
}

main {
  flex: 1;
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 24px;
}

/* Grid: exactly 3 tiles per row, left-to-right, top-to-bottom. */
.grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--gap);
}

.grid__error {
  grid-column: 1 / -1;
  color: #e06a8a;
  text-align: center;
}

/* Each item: an image tile with the name centered below it. */
.project {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  color: var(--text);
}

.tile {
  position: relative;
  width: 100%;
  display: block;
  overflow: hidden;
  background: var(--bg-tile);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  /* Moderate tile image height. */
  aspect-ratio: 16 / 9;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

/* Optional colored tint laid over a tile's image — fades out on hover. */
.tile--tint::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--tint, rgba(129, 149, 201, 0.4));
  pointer-events: none;
  transition: opacity 0.18s ease;
}

.project:hover .tile--tint::after,
.project:focus-visible .tile--tint::after {
  opacity: 0;
}

.project:hover .tile,
.project:focus-visible .tile {
  border-color: var(--accent);
  transform: translateY(-6px);
  box-shadow: var(--shadow-hover);
  outline: none;
}

.tile__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.25s ease;
}

.project:hover .tile__image {
  transform: scale(1.05);
}

.project__name {
  margin-top: 12px;
  text-align: center;
  font-size: 1.2rem;
  font-weight: 700;
}

.site-footer {
  text-align: center;
  padding: 28px 24px 36px;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* Responsive: 2 per row on tablet, 1 on phone. */
@media (max-width: 800px) {
  .grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 520px) {
  .grid {
    grid-template-columns: 1fr;
  }
  .site-title {
    font-size: 2.1rem;
  }
}
