body {
  font-family: "Arial";
  font-size: 1.5rem;
}

.table-wrap {
  width: clamp(100px, 100vw, 1500px);
  margin: auto;
  height: auto;
}

caption {
  text-align: left;
  margin-bottom: 2rem;
}

table {
  width: 100%;
}

table thead th {
  border-bottom: 1px solid black;
  padding-bottom: 1rem;
}

table.sortable {
  table-layout: fixed;
}

table.sortable tbody td {
  border-bottom: 1px solid black;
  padding: 0.5rem 0.5rem;
  vertical-align: top;
}

table.sortable tbody td.cms-other {
  background-color: #ffffd5;
}

table.sortable tbody td.cms.kirby {
  background-color: #d5fdff;
}

table.sortable th[aria-sort="descending"] span::after {
  position: relative;
  content: "▼";
  color: currentcolor;
  font-size: 50%;
  top: -0.2rem;
}

table.sortable th[aria-sort="ascending"] span::after {
  position: relative;
  content: "▲";
  color: currentcolor;
  font-size: 50%;
  top: -0.2rem;
}

table.sortable tbody td.link a {
  color: blue;
  text-decoration: underline solid 1.75px blue;
  text-decoration-skip-ink: none;
}

table.sortable tbody td:not(.link) a {
  color: black;
  text-decoration: underline solid 1.75px black;
  text-decoration-skip-ink: none;
}

table.sortable th button {
  font-weight: bold;
  background: transparent;
  border: none;
  display: inline;
  font-size: 100%;
  right: 0;
  left: 0;
  top: 0;
  bottom: 0;
  width: 100%;
  text-align: left;
  outline: none;
  cursor: pointer;
}

td.notes {
  font-size: 0.8rem;
  max-width: 5ch;
}

.year {
  width: 6ch;
}

.credits {
  width: 15ch;
}

@media (max-width: 700px) {
  body {
    font-size: 1.1rem;
  }

  .table-wrap {
    width: 100%;
    padding: 0 1rem;
  }

  table.sortable thead {
    display: none; /* labels move inline via data-label */
  }

  table.sortable,
  table.sortable tbody,
  table.sortable tr,
  table.sortable td {
    display: block;
    width: 100%;
  }

  table.sortable tbody tr {
    margin-bottom: 1.5rem;
    border-bottom: 2px solid black;
    padding-bottom: 0.5rem;
  }

  table.sortable tbody td {
    border-bottom: none;
    padding: 0.3rem 0;
    display: flex;
    gap: 0.75rem;
  }

  table.sortable tbody td::before {
    content: attr(data-label);
    font-weight: bold;
    flex: 0 0 40%;
  }

  /* reset desktop-only width constraints */
  td.notes,
  .year,
  .credits {
    max-width: none;
    width: auto;
  }

  td.notes {
    font-size: 0.85rem;
  }
}
