/* mattgrosso.com
   Mobile first: the base rules are the phone layout. The media queries at the
   bottom only add room and columns as the screen grows.

   The look: black type on white, and colour only in flat primary blocks. */

:root {
  --paper: #fafaf7;
  --ink: #111111;
  --muted: #5e5e5a;
  --rule: #e2e2dc;
  --red: #e1251b;
  --yellow: #f7c600;
  --blue: #1f45d6;

  --gutter: 1.25rem;
  --font: "Archivo", ui-sans-serif, system-ui, -apple-system, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #121212;
    --ink: #f2f2ee;
    --muted: #a3a39d;
    --rule: #2c2c2a;
  }
}

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 1rem/1.55 var(--font);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  text-size-adjust: 100%;
}

h1,
h2,
h3,
p {
  margin: 0;
}

a {
  color: inherit;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.2em;
}

:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 3px;
}

.wrap {
  max-width: 74rem;
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.skip,
.sr-only,
.sort legend {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}

.skip:focus {
  z-index: 1;
  width: auto;
  height: auto;
  clip-path: none;
  padding: 0.5rem 0.9rem;
  background: var(--ink);
  color: var(--paper);
}

/* Header */

.hero {
  display: grid;
  gap: 0.75rem;
  padding-top: 3rem;
  padding-bottom: 3rem;
}

.swatches {
  display: flex;
  gap: 6px;
  margin-bottom: 1rem;
}

.swatches span {
  width: 2.25rem;
  height: 2.25rem;
  background: var(--red);
}

.swatches span:nth-child(2) {
  background: var(--yellow);
}

.swatches span:nth-child(3) {
  background: var(--blue);
}

.hero h1 {
  font-size: clamp(2.75rem, 13vw, 5.5rem);
  font-weight: 800;
  line-height: 0.95;
  letter-spacing: -0.035em;
}

.lede {
  max-width: 26ch;
  font-size: clamp(1.25rem, 5vw, 1.6rem);
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.hero p:not(.lede) {
  color: var(--muted);
}

.hero a {
  font-weight: 600;
}

/* Heading row and sort control */

.bar {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
  padding: 1.25rem 0 1.75rem;
  border-top: 2px solid var(--ink);
}

.bar h2 {
  font-size: 1.1rem;
  font-weight: 700;
}

.sort {
  display: flex;
  gap: 1.1rem;
  margin: 0;
  padding: 0;
  border: 0;
}

.sort[hidden] {
  display: none;
}

.sort label {
  position: relative;
}

.sort input {
  position: absolute;
  opacity: 0;
}

.sort span {
  color: var(--muted);
  cursor: pointer;
}

.sort span:hover {
  color: var(--ink);
}

.sort input:checked + span {
  color: var(--ink);
  font-weight: 700;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.35em;
}

.sort input:focus-visible + span {
  outline: 3px solid var(--blue);
  outline-offset: 3px;
}

/* Cards */

.grid {
  display: grid;
  gap: 2.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.card {
  --kind: var(--blue);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.card[data-kind="game"] {
  --kind: var(--red);
}

.card[data-kind="night"] {
  --kind: var(--yellow);
}

/* A flat block of the card's colour with the screenshot rising out of it. */
.shot {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--kind);
}

.shot img {
  position: absolute;
  display: block;
  height: auto;
  box-shadow: 0 0 0 1px rgb(0 0 0 / 0.15);
  transition: translate 0.25s ease;
}

.shot--phone img {
  left: 50%;
  top: 1.5rem;
  width: 44%;
  translate: -50% 0;
  border-radius: 14px;
}

.shot--wide img {
  left: 1.5rem;
  top: 1.5rem;
  width: calc(100% - 3rem);
  border-radius: 6px;
}

.shot--none {
  display: flex;
  align-items: end;
  padding: 1.25rem;
}

.shot--none span {
  color: #fff;
  font-size: clamp(1.75rem, 9vw, 2.5rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.03em;
}

.card[data-kind="night"] .shot--none span {
  color: #111;
}

.body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 0.35rem;
}

.kind {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.kind::before {
  content: "";
  width: 0.7rem;
  height: 0.7rem;
  background: var(--kind);
}

.card h3 {
  font-size: 1.4rem;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.card h3 a {
  text-decoration: none;
}

/* The title link covers the whole card: one big tap target, one link to hear. */
.card h3 a::after {
  content: "";
  position: absolute;
  inset: 0;
}

.card:hover h3 a {
  text-decoration: underline;
}

.desc {
  color: var(--muted);
}

.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem 1rem;
  margin-top: auto;
  padding-top: 0.5rem;
  color: var(--muted);
  font-size: 0.8rem;
}

.stats span:first-child {
  color: var(--ink);
  font-weight: 600;
}

.url {
  color: var(--muted);
  font-size: 0.8rem;
  overflow-wrap: anywhere;
}

.card:has(a:focus-visible) {
  outline: 3px solid var(--blue);
  outline-offset: 6px;
}

.card h3 a:focus-visible {
  outline: none;
}

@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .card:hover .shot--phone img {
    translate: -50% -0.5rem;
  }

  .card:hover .shot--wide img {
    translate: 0 -0.5rem;
  }
}

/* Footer */

.foot {
  display: grid;
  gap: 0.3rem;
  margin-top: 4rem;
  padding-top: 1.25rem;
  padding-bottom: 3rem;
  border-top: 2px solid var(--ink);
  color: var(--muted);
  font-size: 0.9rem;
}

/* Bigger screens */

@media (min-width: 40rem) {
  :root {
    --gutter: 2rem;
  }

  .hero {
    padding-top: 5rem;
    padding-bottom: 4rem;
  }

  .grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 3rem 2rem;
  }
}

@media (min-width: 66rem) {
  .grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
