:root {
  --font-sans: "Inter", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --text-1: #222;
  --text-2: #4b4b4b;
  --border-1: #222;
  --border-2: #0000001f;
  --card-bg: #f5f5f5;
  --max-page-width: 100ch;
  --radius-1: 0.5rem;
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --fs-body: clamp(1rem, 0.97rem + 0.15vw, 1.0625rem);
  --fs-title: clamp(1.1rem, 1.02rem + 0.5vw, 1.35rem);
  --fs-link: 0.875rem;
  --lh-body: 1.6;
  --lh-title: 1.3;
}

html {
  font-size: 100%;
}

body {
  max-width: var(--max-page-width);
  margin-inline: auto;
  padding: calc(1vmin + var(--space-2));
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  color: var(--text-1);
  line-height: var(--lh-body);
}

main {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

h1 {
  margin: 0;
  line-height: 1.15;
}

p {
  margin: 0;
}

a {
  color: var(--text-1);
  text-decoration-style: dotted;
  text-decoration-color: var(--text-2);
}

img {
  max-width: 100%;
  height: auto;
}

/* Blog post content: markdown-rendered articles need normal block spacing,
   unlike the rest of the site which manages spacing via flex `gap`. */
article :where(p, ul, ol, blockquote, pre, img) {
  margin-block: 1em;
}

article :where(h2, h3, h4) {
  margin-block: 1.5em 0.5em;
}

blockquote {
  border-left: 3px solid var(--border-2);
  padding-left: var(--space-4);
  color: var(--text-2);
}

article p:has(> img) + p > em:only-child {
  display: block;
  font-size: 0.9em;
  color: var(--text-2);
  margin-top: -0.8em;
}

.post-list {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.post-list li {
  display: flex;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-1) 0;
}

.post-list time {
  color: var(--text-2);
  font-size: 0.9em;
  white-space: nowrap;
}

.card-title {
  margin: 0;
  line-height: var(--lh-title);
  font-size: var(--fs-title);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-auto-rows: minmax(11.25rem, auto);
  grid-auto-flow: row dense;
  gap: var(--space-4);
}

.card {
  background: var(--card-bg);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  grid-row: span 2;
  border-radius: var(--space-3);
  padding: var(--space-3);
}

.card-thumbnail {
  width: 100%;
  height: auto;
  border-radius: calc(var(--radius-1) - 0.125rem);
  object-fit: contain;
  object-position: center;
}

.card-content {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-width: 0;
  width: 100%;
}

.card-title a,
.card-title span {
  min-width: 0;
}

.more-section summary {
  cursor: pointer;
  user-select: none;
  margin-bottom: var(--space-3);
}

.card-failed-reason {
  color: var(--text-2);
  font-style: italic;
}

@media (max-width: 56.25rem) {
  .cards-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 37.5rem) {
  .cards-grid {
    grid-template-columns: 1fr;
  }

  .card {
    grid-column: span 1;
    grid-row: span 2;
    flex-direction: column;
  }
}
