/*
 * Default styling of the playing handicap table. The file is loaded via the
 * asset collector of the layout. Project specific adjustments belong into
 * gkmb_template/Resources/Public/Css/Extensions/playhcptable.css, that file is
 * loaded before this one and needs more specific selectors.
 *
 * The class names are the ones of the predecessor, so existing project styles
 * keep working. The colours of a tee stay inline, they come from the record.
 */

.tx-gkmbplayhcptable-pi1 {
  /* The lines between the cells separate the colour areas of the tees, the
     project stylesheet can overwrite the colour. */
  --playhcp-cellborder: #ffffff;
  --playhcp-head: var(--c-neutral-lightest, #f2f2f2);
  --playhcp-gap: 2px;
  /*
   * The template holds its colours as the three components of an rgb() call,
   * not as a finished colour - "215, 215, 215" instead of "#d7d7d7". Without
   * the rgb() around it the rule is invalid and the border simply does not
   * appear, which is why the fallbacks are written the same way.
   */
  --playhcp-border: rgb(var(--c-neutral-light, 215, 215, 215));
}

/* Course, gender and tee as a filter above the table */

.gkmb_playHcpFilterList {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.5rem 1rem;
  margin-bottom: 1.5rem;
}

.gkmb_playHcpFilterField {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1 1 12rem;
}

/*
 * Border and padding of the fields are the ones every other form of the site
 * has, so the filter does not stand out as something of its own. Written out
 * here and not left to the template, because the extension has to look
 * finished without it as well.
 */

.gkmb_playHcpFilterSelect {
  border: 1px solid var(--playhcp-border);
  padding: calc(0.6rem - 1px) 0.6rem;
  line-height: 1.4;
  background-color: rgb(var(--c-neutral-lightest, 255, 255, 255));
  max-width: 100%;
  /* The fields carry their spacing from the filter itself */
  margin: 0;
}

.gkmb_playHcpFilterSubmit {
  flex: 0 0 auto;
}

/* While the table is fetched it steps back instead of pretending to be current */

.gkmb_playHcpFilterCardPending {
  opacity: 0.5;
  transition: opacity 0.2s;
}

/* Tee selection */

.gkmb_playHcpTableTop {
  display: grid;
  grid-gap: 1rem 2rem;
  margin-bottom: 1.5rem;
}

/* One group per course: the name above a row of equally sized tees */

.gkmb_pscoreTeeSelect {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.gkmb_pscoreTeeSelectCourse {
  font-weight: bold;
}

.gkmb_playHcpTeeList {
  display: grid;
  grid-gap: var(--playhcp-gap);
}

.gkmb_pscoreTeeSelectTee {
  display: flex;
  flex: 0 0 auto;
  min-width: 5rem;
}

.gkmb_pscoreTeeSelectTeeLink {
  display: block;
  flex: 1;
  padding: 0.5rem;
  text-decoration: none;
}

.gkmb_pscoreTeeSelectTeeLink:hover,
.gkmb_pscoreTeeSelectTeeLink:focus-visible {
  text-decoration: underline;
}

/* Head of a tee */

.gkmb_playHcpTee {
  margin-bottom: 2rem;
  /* The template sets the distance a fixed header needs */
  scroll-margin-top: var(--m-scroll, 1rem);
}

.gkmb_playHcpTeeHeader2 {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  margin-bottom: 0.5rem;
}

.gkmb_playHcpTeeHeaderCoursename {
  font-weight: bold;
  width: 100%;
}

.gkmb_playHcpTeeHeaderTeename {
  padding: 0.25rem 0.75rem;
}

/* The template is rendered without whitespace, the gap to the value comes from
   the label itself. */

.gkmb_playHcpTeeHeaderLabel {
  margin-right: 0.35em;
  font-weight: bold;
}

/* Tables, one column per group of handicap indexes */

.gkmb_playHcpTables {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  gap: 1rem;
}

.gkmb_playHcpTable table {
  width: 100%;
  border-collapse: collapse;
}

/* The head carries no border, only the cells with the colour of the tee do. */

.gkmb_playHcpTable th {
  background: var(--playhcp-head);
  border: 0;
  padding: 0.25rem 0.5rem;
  text-align: center;
  vertical-align: bottom;
}

.gkmb_playHcpTable td {
  border: 1px solid var(--playhcp-cellborder);
  padding: 0.25rem 0.5rem;
  white-space: nowrap;
}

/* The cell stays a plain table cell – a flex box would break the alignment with
   the playing handicap next to it. The numbers are aligned by their own width. */

.gkmb_playHcpRange {
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.gkmb_playHcpFrom,
.gkmb_playHcpTo {
  display: inline-block;
  min-width: 4ch;
}

.gkmb_playHcpFrom {
  text-align: right;
}

.gkmb_playHcpTo {
  text-align: left;
}

.gkmb_playHcpSeparator {
  padding: 0 0.35em;
}

.gkmb_playHcpValue {
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* Back link and footer */

.gkmb_playHcpBack {
  margin-top: 0.5rem;
  text-align: right;
}

.gkmb_playHcpEmpty {
  margin: 1rem 0;
}

.gkmb_pscoreFooter {
  margin-top: 1rem;
  font-size: 0.75em;
}
