* {
  box-sizing: border-box;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin: 0;
  line-height: var(--fp-leading-ui);
}

main {
  --text-start: 1.2rem;
  --text-end: 1.2rem;
  padding-block: 3.5rem 3rem;
  flex: 1;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Match the Site and Spec reading column. */
@media (width > 60em) {
  main {
    --text-start: calc(max(var(--fp-nav-width), (100vw - var(--fp-col-width)) / 2) + 3rem);
    --text-end: 2rem;
    padding-top: 2rem;
  }
}

.gallery-intro,
.topic-heading,
.sheet-grid {
  max-width: var(--fp-col-width);
  margin-inline: var(--text-start) var(--text-end);
}

.gallery-intro h1 {
  color: var(--fp-text-strong);
  font-size: var(--fp-size-h1);
  margin: 0;
}

.gallery-intro p {
  color: var(--fp-text-muted);
  margin: 0.65rem 0 1.15rem;
}

.topic-nav ul {
  padding: 0;
  margin: 0;
  list-style: none;
}

.topic-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.topic-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  text-decoration: none;
}

.topic {
  margin-top: clamp(1.65rem, 4vw, 2.5rem);
}

.topic h2 {
  color: var(--fp-text-strong);
  margin-block: 0 0.7rem;
  padding: 0.65rem 0 0;
  border-top: 1px solid var(--fp-border);
  scroll-margin-top: 1rem;
  font-size: var(--fp-size-h2);
}

.sheet-grid {
  --columns: 1;
  --card-gap: clamp(0.75rem, 1.5vw, 1rem);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  margin-block: 0;
  padding: 0;
  list-style: none;
  gap: var(--card-gap);
}

.sheet-grid > li {
  flex: 0 0 calc((100% - (var(--columns) - 1) * var(--card-gap)) / var(--columns));
  min-width: 0;
}

@media (min-width: 32rem) {
  .sheet-grid {
    --columns: 2;
  }
}

@media (min-width: 48rem) {
  .sheet-grid {
    --columns: 3;
  }
}

.sheet-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  border: 1px solid var(--fp-border);
  border-radius: var(--fp-radius-xl);
  color: var(--fp-text);
  background: var(--fp-surface);
  text-decoration: none;
}

.sheet-card:hover {
  border-color: var(--fp-accent);
}

.sheet-card:focus-visible,
.topic-nav a:focus-visible {
  outline: 2px solid var(--fp-accent);
  outline-offset: 4px;
}

.sheet-preview {
  border-bottom: 1px solid var(--fp-border);
  border-radius: var(--fp-radius-xl) var(--fp-radius-xl) 0 0;
  padding: 0.4rem;
  background: var(--fp-surface-2);
}

.sheet-preview img {
  display: block;
  width: 100%;
  height: auto;
  background: white;
}

.sheet-caption {
  padding: 0.6rem 0.7rem 0.7rem;
}

.sheet-label {
  display: flex;
  justify-content: space-between;
  gap: 0.65rem;
  align-items: baseline;
}

.sheet-label h3 {
  font-size: 1rem;
  line-height: 1.3;
  margin: 0;
  color: var(--fp-text-strong);
}

.sheet-card:hover h3 {
  color: var(--fp-accent);
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

.sheet-format {
  font-family: var(--fp-font-mono);
  font-size: 0.8rem;
  color: var(--fp-text-muted);
}

.sheet-caption p {
  margin: 0.25rem 0 0;
  color: var(--fp-text-muted);
  font-size: 0.9rem;
}
