/* The reciprocal course list (courses.html). Loaded after style.css, which supplies the
   colours, masthead and button styles this builds on. */

.masthead-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
}

.asof {
  margin: .35rem 0 0;
  color: var(--muted);
}

/* Phone numbers are hidden until asked for: members book through the pro shop. The
   column is dropped from the layout entirely rather than made invisible, so the other
   columns reclaim the width and the printed sheet has no gap where it was. */
.courses.hide-phones .phone-col {
  display: none;
}

.callout {
  border-left: 3px solid var(--green);
  padding-left: .75rem;
}

/* a wide table on a narrow screen scrolls sideways rather than squashing every column */
.table-scroll {
  overflow-x: auto;
  background: var(--sheet);
  border: 1px solid var(--rule-soft);
  border-radius: 6px;
}

.courses {
  border-collapse: collapse;
  width: 100%;
  font-size: .95rem;
}

.courses th,
.courses td {
  padding: .5rem .7rem;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--rule-soft);
  white-space: nowrap;
}

.courses tbody th {
  font-weight: 600;
  font-family: var(--serif);
}

.courses thead th {
  padding: 0;
  border-bottom: 2px solid var(--rule);
  background: var(--tint);
  position: sticky;                 /* headings stay put while the list scrolls */
  top: 0;
}

.courses thead th.num,
.courses td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.courses thead th.num {
  padding: .55rem .7rem;
}

/* the heading is a button so it is reachable by keyboard and announced as clickable */
.sort {
  width: 100%;
  padding: .55rem .7rem;
  font: inherit;
  font-weight: 600;
  color: inherit;
  text-align: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}

.sort::after {
  content: " \2195";                /* up-down arrow: this column can be sorted */
  color: var(--muted);
}

.sort.active::after {
  content: " \2191";
  color: var(--green);
}

.sort.active.descending::after {
  content: " \2193";
}

.courses tbody tr:hover {
  background: var(--tint);
}

.courses .notes {
  white-space: normal;
  min-width: 16rem;
  color: var(--muted);
}

.courses a {
  color: var(--green-deep);
}

.not-participating {
  margin-top: 2rem;
  background: var(--sheet);
  border: 1px solid var(--rule-soft);
  border-radius: 6px;
  padding: 1.1rem 1.25rem 1.25rem;
}

.not-participating h2 {
  font-size: 1.15rem;
}

.not-participating ul {
  margin: .6rem 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: .5rem .75rem;
}

.not-participating li {
  padding: .3rem .7rem;
  background: var(--paper);
  border: 1px solid var(--rule-soft);
  border-radius: 999px;
  font-weight: 600;
}

.footnote {
  margin-top: 1.5rem;
  max-width: 48rem;
}

.nowrap {
  white-space: nowrap;
}

/* ---------- print ----------
   The point of this page is a sheet to pin on a wall, so printing is the real output:
   landscape (nine columns), no interactive chrome, and headings repeated on every page. */
@media print {
  @page {
    size: landscape;
    margin: 12mm;
  }

  body {
    background: #fff;
  }

  /* only the interactive chrome goes: the explanatory lines are worth having on the wall */
  .masthead-actions,
  #loading {
    display: none;
  }

  .masthead,
  main {
    max-width: none;
    padding-inline: 0;
  }

  .masthead {
    padding-block: 0 .5rem;
  }

  .logo {
    width: 70px;
  }

  .table-scroll,
  .not-participating {
    overflow: visible;
    border: 0;
    border-radius: 0;
    padding: 0;
  }

  .courses {
    font-size: 8.5pt;
  }

  /* repeat the column headings at the top of every printed page */
  .courses thead {
    display: table-header-group;
  }

  .courses thead th {
    position: static;
    background: none;
    border-bottom: 1.5pt solid #000;
    padding: .25rem .4rem;
  }

  .sort {
    padding: 0;
  }

  /* no sort arrows on paper -- the .active rules are more specific than .sort::after,
     so they have to be named here too or the current column keeps its arrow */
  .sort::after,
  .sort.active::after,
  .sort.active.descending::after {
    content: "";
  }

  .courses th,
  .courses td {
    padding: .22rem .4rem;
    border-bottom: 0.4pt solid #999;
  }

  .courses tr {
    break-inside: avoid;            /* never split a course across two pages */
  }

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

  .not-participating {
    margin-top: 1rem;
    break-inside: avoid;
  }

  .footnote {
    display: block;
    margin-top: .6rem;
    font-size: 8pt;
  }
}
