/* Palette and type from style-guide.md. */
:root {
  --clr-yellow: hsl(47, 88%, 63%);
  --clr-white: hsl(0, 0%, 100%);
  --clr-gray-500: hsl(0, 0%, 42%);
  --clr-gray-950: hsl(0, 0%, 7%);

  --font-body: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  --fw-medium: 500;
  --fw-bold: 800;

  --shadow-offset: 8px;
  --shadow-offset-hover: 6px;
  --radius-card: 20px;
  --radius-image: 10px;
}

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

body {
  margin: 0;
  padding: 1.5rem;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;

  background-color: var(--clr-yellow);
  color: var(--clr-gray-950);
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: var(--fw-medium);
}

h2,
p {
  margin: 0;
}

.card {
  /* Fluid below the design width instead of a hard 350px, which overflowed
     a 320px viewport. */
  width: 100%;
  max-width: 384px;
  padding: 1.5rem;

  background-color: var(--clr-white);
  border: 1px solid var(--clr-gray-950);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-offset) var(--shadow-offset) 0 0 var(--clr-gray-950);

  /* Animate the transform, not the shadow geometry: the browser can composite
     a transform without redoing layout. */
  transition: transform 150ms ease, box-shadow 150ms ease;
}

.card:hover,
.card:focus-within {
  transform: translate(2px, 2px);
  box-shadow: var(--shadow-offset-hover) var(--shadow-offset-hover) 0 0 var(--clr-gray-950);
}

/* Respect a reader who has asked their system to stop moving things. */
@media (prefers-reduced-motion: reduce) {
  .card {
    transition: none;
  }
  .card:hover,
  .card:focus-within {
    transform: none;
  }
}

.card__illustration {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius-image);
}

.card__body {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.card__tag {
  align-self: start;
  padding: 0.25rem 0.75rem;
  background-color: var(--clr-yellow);
  border-radius: 4px;
  font-size: 0.875rem;
  font-weight: var(--fw-bold);
}

.card__date {
  font-size: 0.875rem;
  font-weight: var(--fw-bold);
}

.card__title {
  font-size: 1.5rem;
  font-weight: var(--fw-bold);
  line-height: 1.25;
}

.card__title a {
  color: inherit;
  text-decoration: none;
}

.card__title a:hover {
  color: var(--clr-yellow);
}

.card__title a:focus-visible {
  outline: 2px solid var(--clr-gray-950);
  outline-offset: 3px;
  border-radius: 2px;
}

.card__description {
  color: var(--clr-gray-500);
  line-height: 1.5;
}

.card__author {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.card__avatar {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
}

.card__author-name {
  font-size: 0.875rem;
  font-weight: var(--fw-bold);
}
