/* Tennis (sports/tennis.js): a season's tournaments and ranking, a tournament's draw by round. */

.tn-h {
  margin: 0;
  padding: 10px 14px;
  font: 700 20px/1.1 var(--display);
  border-bottom: 1px solid var(--line);
}
.tn-h-sub { margin-left: 6px; font: 500 13px var(--body); color: var(--muted); }
.tn-none { color: var(--faint); }
.tn-nw { white-space: nowrap; }
.tn-cc { margin-left: 6px; font-size: 11px; font-weight: 600; color: var(--muted); }
.tn-slam {
  display: inline-block;
  margin-left: 6px;
  padding: 0 6px;
  border-radius: 4px;
  background: var(--major);
  color: #fff;
  font: 700 11px/1.6 var(--body);
  text-transform: uppercase;
  vertical-align: 2px;
}

/* ─── Season: tournaments beside the ranking ─── */

.tn-season {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 16px;
  align-items: start;
}

.tn-cal, .tn-rk-t { width: 100%; border-collapse: collapse; }
.tn-cal { table-layout: fixed; }
.tn-cal thead th, .tn-rk-t thead th {
  padding: 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: left;
}
.tn-cal th.tn-date { width: 132px; }
.tn-cal th.tn-champ { width: 34%; }
.tn-cal thead th:first-child, .tn-cal td:first-child { padding-left: 14px; }
.tn-cal td {
  padding: 8px;
  border-top: 1px solid var(--line);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tn-cal tr.tn-mo th {
  padding: 7px 14px;
  background: var(--surface-2);
  border-top: 1px solid var(--line);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: left;
}
.tn-cal tr.tn-ev { cursor: pointer; }
.tn-cal tr.tn-ev:hover td { background: var(--surface-2); }
/* A date range breaks after its dash rather than lose a day to the ellipsis */
.tn-cal td.tn-date { color: var(--muted); white-space: normal; text-overflow: clip; }
.tn-cal .tn-name a { font-weight: 600; text-decoration: none; }
.tn-cal .tn-name a:hover { text-decoration: underline; text-underline-offset: 3px; }
.tn-cal tr.is-slam .tn-name a { font-weight: 700; }
.tn-champ-sm { display: none; }

.tn-rk-t { font-size: 14px; }
.tn-rk-t td { padding: 6px 8px; border-top: 1px solid var(--line); white-space: nowrap; }
.tn-rk-t .tn-rk { width: 40px; padding-left: 14px; text-align: right; color: var(--muted); }
.tn-rk-t td.tn-pl { max-width: 0; width: 100%; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.tn-rk-t .tn-pts { text-align: right; }
.tn-rk-t .tn-mv { width: 44px; padding-right: 14px; text-align: right; font-size: 12px; font-weight: 600; }
.tn-up { color: var(--win); }
.tn-down { color: var(--loss); }

/* ─── Tournament ─── */

.tn-back {
  display: inline-block;
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
}
.tn-back:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.tn-meta { margin: 4px 0 14px; font-size: 14px; color: var(--muted); }
.tn-meta .tn-slam { margin: 0 8px 0 0; }
.tn-dot { margin: 0 7px; color: var(--faint); }

.tn-tabs, .tn-jump { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.tn-tab, .tn-chip {
  padding: 5px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: none;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}
.tn-chip { padding: 3px 10px; font-size: 13px; font-weight: 500; }
.tn-tab:hover, .tn-chip:hover { background: var(--surface); }
.tn-tab.is-on { background: var(--ink); border-color: var(--ink); color: #fff; }
.tn-tab:focus-visible, .tn-chip:focus-visible, .tn-back:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

.tn-round { margin-bottom: 12px; scroll-margin-top: 12px; }
.tn-matches {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 28px;
  padding: 0 14px;
  margin-bottom: -1px; /* the last row's rule sits under the card's edge */
}
.tn-mw { padding: 4px 0; border-bottom: 1px solid var(--line); }
/* A match is a link to itself; a click opens it in place. */
.tn-match {
  display: block;
  margin: 0 -8px;
  padding: 3px 8px;
  border-radius: 6px;
  color: inherit;
  text-decoration: none;
}
.tn-match:hover, .tn-mw.is-open .tn-match { background: var(--surface-2); }
.tn-match:focus-visible { outline: 2px solid var(--ink); outline-offset: 0; }
.tn-mx {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 2px -8px -2px 0;
  padding-left: 26px;
  font-size: 13px;
  color: var(--muted);
}
.tn-mx-t { min-width: 0; }
.tn-side {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  line-height: 1.55;
}
.tn-seed { font-size: 12px; color: var(--muted); text-align: right; }
.tn-who { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.tn-side.is-win .tn-who { font-weight: 700; }
.tn-side.is-loss .tn-who { color: var(--muted); }
.tn-sm { display: none; }
.tn-tag { margin-left: 6px; font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--muted); }
.tn-sets { display: flex; }
.tn-set { width: 26px; text-align: center; color: var(--muted); }
.tn-set.is-won { color: var(--ink); font-weight: 700; }
.tn-set sup { margin-left: 1px; font-size: 10px; line-height: 0; }

.tn-qual > summary { display: block; margin-bottom: 12px; cursor: pointer; list-style: none; }
.tn-qual > summary::-webkit-details-marker { display: none; }
.tn-qual > summary .tn-h { display: block; border-bottom: 0; }
.tn-qual > summary .tn-h::after { content: " ▸"; font-size: 14px; color: var(--muted); }
.tn-qual[open] > summary .tn-h::after { content: " ▾"; }
.tn-qual > summary:hover { background: var(--surface-2); }
.tn-qual > summary:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

@media (max-width: 900px) {
  .tn-season { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 600px) {
  .tn-h { padding: 9px 12px; font-size: 19px; }
  .tn-cal th.tn-date { width: 92px; }
  .tn-cal thead th:first-child, .tn-cal td:first-child, .tn-cal tr.tn-mo th { padding-left: 12px; }
  .tn-cal .tn-champ { display: none; }
  .tn-cal td.tn-name { white-space: normal; }
  .tn-cal td.tn-date { font-size: 13px; vertical-align: top; white-space: normal; }
  .tn-champ-sm { display: block; font-size: 13px; color: var(--muted); }
  .tn-rk-t .tn-rk { padding-left: 12px; }
  .tn-matches { grid-template-columns: minmax(0, 1fr); padding: 0 12px; }
  .tn-lg { display: none; }
  .tn-sm { display: inline; }
  .tn-set { width: 22px; }
}

/* ─── Tournament: the last eight as a bracket (sports/bracket.js) ─── */

.tn-bk { margin-bottom: 12px; scroll-margin-top: 12px; }
/* A bracket cell is also .tn-mw and its link .tn-match, so it opens like a listed match; the
   list's spacing stays off it. */
.tn-bk .tn-mw { padding: 0; border: 1px solid var(--bk-rule); }
.tn-bk .tn-match { display: flex; margin: 0; padding: 0; border-radius: 5px; }
.tn-bk .tn-set { width: 18px; text-align: left; }
.tn-bk .tn-set sup { font-size: 9px; }
.tn-bk-x { padding: 9px 14px; border: 0 solid var(--line); border-width: 1px 0 0; }
.tn-bk-x:empty { display: none; }
.tn-bk-x .tn-mx { margin: 0; padding: 0; }

@media (max-width: 600px) {
  .tn-bk .tn-set { width: 16px; }
  .tn-bk-x { padding: 8px 12px; }
}
