/* Base type from the old MUI v5 site (CssBaseline). Roboto was never loaded,
   so text falls back to Helvetica/Arial as before. */
html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  box-sizing: border-box;
  -webkit-text-size-adjust: 100%;
}

*, *::before, *::after {
  box-sizing: inherit;
}

body {
  margin: 0;
  color: rgba(0, 0, 0, 0.87);
  font-family: "Roboto", "Helvetica", "Arial", sans-serif;
  font-weight: 400;
  font-size: 1rem;
  line-height: 1.5;
  letter-spacing: 0.00938em;
  background-color: #fff;
}

/* Palette (option D: dark with colour accents). A new palette only changes these values.
   Every accent, and the accent dimmed to 85% for labels and descriptions, meets
   WCAG AA (4.5:1) on its tile, including the brighter hover background. */
:root {
  --page-bg: #0f1115;
  --ink: #f2f2f2;
  --ink-dim: rgba(242, 242, 242, 0.6);
  --seth-bg: #1a1f2b;      --seth-accent: #7cc4ff;
  --sophoto-bg: #221a2b;   --sophoto-accent: #d7a6ff;
  --mywhisky-bg: #2b2219;  --mywhisky-accent: #ffc27a;
  --angrier-bg: #2b1a1a;   --angrier-accent: #ff8a80;
  --fiction-bg: #16261f;   --fiction-accent: #7be3b4;
  --strava-bg: #2b1d14;    --strava-accent: #ff9f5a;
  --wordcloud-bg: #1a2426; --wordcloud-accent: #7fe0e8;
  --elite-bg: #1a140c;     --elite-accent: #ff8a00;
  --tile-radius: 16px;
  --icon-chip-bg: #fff;
}

.tile-seth { --tile-bg: var(--seth-bg); --tile-accent: var(--seth-accent); }
.tile-sophoto { --tile-bg: var(--sophoto-bg); --tile-accent: var(--sophoto-accent); }
.tile-mywhisky { --tile-bg: var(--mywhisky-bg); --tile-accent: var(--mywhisky-accent); }
.tile-angrier { --tile-bg: var(--angrier-bg); --tile-accent: var(--angrier-accent); }
.tile-fiction { --tile-bg: var(--fiction-bg); --tile-accent: var(--fiction-accent); }
.tile-strava { --tile-bg: var(--strava-bg); --tile-accent: var(--strava-accent); }
.tile-wordcloud { --tile-bg: var(--wordcloud-bg); --tile-accent: var(--wordcloud-accent); }
.tile-elite { --tile-bg: var(--elite-bg); --tile-accent: var(--elite-accent); }

.home {
  max-width: 1120px;
  margin: 0 auto;
  padding: 48px 32px;
  color: var(--ink);
  background-color: var(--page-bg);
}

.masthead {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 32px;
  margin-bottom: 16px;
}

.masthead h1 {
  margin: 0;
  font-size: clamp(2.5rem, 7vw, 4.5rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.tagline {
  margin: 0;
  font-size: 1.125rem;
}

.home h2 {
  margin: 40px 0 12px;
  color: var(--ink-dim);
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* Six columns, so a 4/2 row and a row of three equal tiles share one grid. */
.tiles {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tile {
  --tile-dim: color-mix(in srgb, var(--tile-accent) 85%, var(--tile-bg));
  position: relative;
  display: grid;
  grid-column: span 2;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto 1fr auto;
  min-height: 200px;
  padding: 20px 24px 24px;
  color: var(--tile-dim);
  background-color: var(--tile-bg);
  border: 1px solid color-mix(in srgb, var(--tile-accent) 25%, transparent);
  border-radius: var(--tile-radius);
  transition: background-color 150ms, border-color 150ms;
}

.tile.span-4 {
  grid-column: span 4;
}

@media (hover: hover) {
  .tile:hover {
    background-color: color-mix(in srgb, #fff 6%, var(--tile-bg));
    border-color: var(--tile-accent);
  }

  .tile-link:hover {
    text-decoration: underline;
  }

  .more:hover {
    color: var(--tile-accent);
  }
}

/* The label comes after the tile's text in the DOM, so a screen reader announces the name
   first and the label stays with its own tile. The grid places it top-left. */
.label {
  grid-row: 1;
  grid-column: 1;
  margin: 0;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* A light chip keeps every icon readable on the dark tiles. */
.icon {
  display: grid;
  grid-row: 1;
  grid-column: 2;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--icon-chip-bg);
}

.body {
  grid-column: 1 / -1;
  grid-row: 3;
}

.tile h3 {
  margin: 0;
  color: var(--tile-accent);
  font-size: 1.5rem;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

/* The name link's ::after covers the tile, so the whole tile is clickable
   without nesting the secondary link inside it. */
.tile-link {
  color: inherit;
  text-decoration: none;
}

.tile-link::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--tile-radius);
}

.tile-link:focus-visible {
  outline: none;
}

.tile-link:focus-visible::after, .more:focus-visible {
  outline: 2px solid var(--tile-accent);
  outline-offset: 3px;
}

.desc {
  margin: 6px 0 0;
  font-size: 0.9375rem;
  line-height: 1.45;
}

.more {
  position: relative;
  z-index: 1;
  display: inline-block;
  margin-top: 8px;
  color: inherit;
  font-size: 0.875rem;
  text-decoration: underline;
  border-radius: 2px;
}

.home footer {
  margin-top: 40px;
  color: var(--ink-dim);
  font-size: 0.875rem;
}

@media (600px < width <= 900px) {
  .tiles {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .tile {
    grid-column: span 1;
  }

  /* A 4-wide tile and an odd last tile span both columns. The parity check assumes
     span-4 tiles come in pairs, as in Apps & sites. */
  .tile.span-4, .tile:last-child:nth-child(odd) {
    grid-column: span 2;
  }
}

@media (max-width: 600px) {
  .home {
    padding: 24px 16px;
  }

  .tiles {
    grid-template-columns: minmax(0, 1fr);
  }

  .tile, .tile.span-4 {
    grid-column: auto;
    min-height: 170px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tile {
    transition: none;
  }
}

/* 404 page: matches the Next.js default error page, including its dark mode. */
.not-found {
  color: #000;
  background: #fff;
}

.not-found main {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100vh;
  font-family: system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  text-align: center;
}

.not-found .message {
  line-height: 48px;
}

.not-found h1, .not-found .message div {
  display: inline-block;
}

.not-found h1 {
  margin: 0 20px 0 0;
  padding-right: 23px;
  border-right: 1px solid rgba(0, 0, 0, 0.3);
  font-size: 24px;
  font-weight: 500;
  vertical-align: top;
}

.not-found h2 {
  font-size: 14px;
  font-weight: 400;
  line-height: 28px;
}

@media (prefers-color-scheme: dark) {
  .not-found {
    color: #fff;
    background: #000;
  }

  .not-found h1 {
    border-right-color: rgba(255, 255, 255, 0.3);
  }
}
