/* Theme-neutral structure for every page. Colors, font families, borders and other decoration belong to the
   theme file (css/style-*.css), which styles the same class names and ids. */

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

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-size: 1rem;
  line-height: 1.6;
}

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

a:focus-visible,
button:focus-visible {
  outline: 0.1875rem solid currentColor;
  outline-offset: 0.2rem;
}

/* Header and navigation ------------------------------------------------------------ */

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.75rem 2rem;
  padding: 0.75rem 1rem;
}

/* The container is sized to the artwork (the Logo's empty margin below its lettering is cropped), so the
   header height follows the visible artwork. */
.logo-link {
  display: block;
  flex: 0 0 auto;
  width: min(14rem, 70vw);
  aspect-ratio: 1024 / 760;
  overflow: hidden;
}

.logo {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  object-fit: cover;
  object-position: 50% 32%;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem 1.5rem;
}

.site-nav a {
  display: inline-block;
  padding: 0.4rem 0.25rem;
  text-decoration: none;
  font-weight: 600;
}

.site-nav a:hover {
  text-decoration: underline;
}

/* Main ------------------------------------------------------------------------------ */

main {
  flex: 1 0 auto;
  width: 100%;
  max-width: 75rem;
  margin: 0 auto;
  padding: 1.5rem 1rem 2.5rem;
}

.hero h1 {
  margin: 0 0 0.5rem;
  line-height: 1.15;
  font-size: clamp(1.75rem, 1.2rem + 2.5vw, 3rem);
}

.hero p {
  margin: 0 0 1.5rem;
  max-width: 40rem;
}

.categories {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin: 0 0 2rem;
  padding: 0;
  list-style: none;
}

.category-card {
  display: block;
  flex: 1 1 14rem;
  padding: 1rem 1.25rem;
  font-size: 1.25rem;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
}

/* List page and product cards -------------------------------------------------------- */

.product-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr));
  gap: 1.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.product-card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 0;
  padding: 1rem;
}

.product-card a {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  color: inherit;
  text-decoration: none;
}

.product-card .cover,
.cover {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  aspect-ratio: 3 / 4;
  object-fit: cover;
}

.product-card h2,
.product-card h3 {
  margin: 0.25rem 0 0;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.blurb {
  margin: 0;
  overflow-wrap: anywhere;
}

.status {
  align-self: flex-start;
  display: inline-block;
  padding: 0.15rem 0.7rem;
  font-size: 0.875rem;
  font-weight: 700;
}

.store-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  margin: 1rem 0 0;
  padding: 0;
  list-style: none;
}

.store-links a {
  display: inline-block;
  padding: 0.6rem 1rem;
  font-weight: 700;
  text-decoration: none;
}

.message {
  margin: 1.5rem 0;
  max-width: 40rem;
}

/* Product page (ids) ------------------------------------------------------------------ */

#product-content {
  display: grid;
  gap: 1.5rem;
  align-items: start;
}

#product-cover {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
}

#product-title {
  margin: 0 0 0.5rem;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

#product-description {
  min-width: 0;
  overflow-wrap: anywhere;
}

#product-description > p,
.deck-description > p {
  margin: 0 0 0.75rem;
  overflow-wrap: anywhere;
}

#product-description > p:last-child,
.deck-description > p:last-child {
  margin-bottom: 0;
}

/* List card badge ---------------------------------------------------------------------- */

.product-card-badge {
  align-self: flex-start;
  display: inline-block;
  padding: 0.15rem 0.7rem;
  font-size: 0.875rem;
  font-weight: 700;
  overflow-wrap: anywhere;
}

/* Decks ------------------------------------------------------------------------------- */

.decks-section,
.ways-to-buy {
  min-width: 0;
}

.decks-section h2,
.ways-to-buy h2 {
  margin: 0 0 0.75rem;
  line-height: 1.2;
}

.decks-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr));
  gap: 1rem;
}

.deck {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
  min-width: 0;
  padding: 1rem;
}

.deck-title {
  margin: 0;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.deck-description,
.deck-card-count {
  margin: 0;
  overflow-wrap: anywhere;
}

.deck-sample-link {
  display: inline-block;
  margin-top: auto;
  padding: 0.4rem 1rem;
  font-weight: 700;
  text-decoration: none;
}

/* Ways to buy table --------------------------------------------------------------------- */

.ways-to-buy-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
}

.ways-to-buy-table th,
.ways-to-buy-table td {
  padding: 0.6rem 0.75rem;
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
}

.ways-to-buy-table th:nth-child(1) {
  width: 24%;
}

.ways-to-buy-table th:nth-child(2) {
  width: 30%;
}

.ways-to-buy-table th:nth-child(3) {
  width: 16%;
}

.ways-to-buy-table th:nth-child(4) {
  width: 30%;
}

.option-status {
  display: inline-block;
  padding: 0.15rem 0.7rem;
  font-size: 0.875rem;
  font-weight: 700;
}

.option-buy a {
  display: inline-block;
  margin: 0 0.5rem 0.5rem 0;
  padding: 0.4rem 0.8rem;
  font-weight: 700;
  text-decoration: none;
}

@media (max-width: 40em) {
  .ways-to-buy-table,
  .ways-to-buy-table tbody,
  .ways-to-buy-table tr,
  .ways-to-buy-table td {
    display: block;
    width: 100%;
  }

  /* Visually hidden, still read by screen readers; each cell shows its own label instead. */
  .ways-to-buy-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .ways-to-buy-table tr {
    margin: 0 0 1rem;
  }

  .ways-to-buy-table td::before {
    content: attr(data-label);
    display: block;
    font-size: 0.8125rem;
    font-weight: 700;
    text-transform: uppercase;
  }

  .option-buy:empty {
    display: none;
  }
}

/* Footer ------------------------------------------------------------------------------ */

.site-footer {
  padding: 1.25rem 1rem;
  text-align: center;
  font-size: 0.9rem;
}

/* Responsive ---------------------------------------------------------------------------- */

@media (min-width: 48em) {
  .site-header {
    padding: 1rem 2rem;
  }

  main {
    padding: 2.5rem 2rem 3.5rem;
  }

  #product-content {
    grid-template-columns: minmax(12rem, 22rem) 1fr;
    gap: 2rem;
  }
}

@media (min-width: 90em) {
  body {
    font-size: 1.125rem;
  }

  .logo-link {
    width: 16rem;
  }
}

@media (max-width: 22.5em) {
  .site-nav {
    gap: 0.25rem 0.75rem;
  }

  .category-card {
    flex-basis: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}
