/* A team's pages: Overview, Events, Members, Admin (docs/adr/0019, 0033). */

.team-overview + .team-overview {
    margin-top: 2.5rem;
}

.team-overview h2 {
    margin-bottom: 0.75rem;
}

.team-overview__more {
    margin-top: 0.75rem;
}

/* Events: a list of events under a heading that sticks while in view. */
.events {
    max-width: 40rem;
    margin-top: 1rem;
}

/* With the button beneath it, when a manager has nothing to list (docs/adr/0111). */
.events__empty {
    margin-bottom: 1rem;
}

.events__heading {
    position: sticky;
    top: 0;
    z-index: 2;
    margin-bottom: 0.75rem;
    padding: 0.5rem 0;
    border-bottom: 0.125rem solid var(--border);
    background-color: var(--white);
}

.team-overview__sport {
    margin-bottom: 1.5rem;
}

/* Typed in a textarea: keep the owner's line breaks. */
.team-overview__description,
.admin__description {
    max-width: 40rem;
    white-space: pre-line;
}

.team-overview__description {
    margin-bottom: 0.75rem;
}

/* Admin: team details, then the owner and who could take over. */
.admin {
    max-width: 40rem;
}

.admin__section + .admin__section {
    margin-top: 2.5rem;
}

.admin__section h2 {
    margin-bottom: 0.75rem;
}

.admin__section h3 {
    margin: 1.5rem 0 0.5rem;
}

.admin__details dt {
    font-weight: 700;
}

.admin__details dd + dt {
    margin-top: 0.75rem;
}

.admin__people {
    padding-left: 1.25rem;
    list-style: disc;
}

/* A list folded away under its heading, with how many (docs/adr/0120). */
.admin__fold-summary {
    display: flex;
    align-items: baseline;
    cursor: pointer;
}

.admin__fold-count {
    font-weight: 400;
}

.admin__after {
    margin-bottom: 1rem;
}

/* A roster entry's Account section: invite or unlink (docs/adr/0029). */
.member-account {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 40rem;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 0.125rem solid var(--border);
}

.member-account__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.invite-link {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1rem;
  border: 0.125rem solid var(--black);
  background-color: var(--row-stripe);
}

.invite-link__row {
  display: flex;
  gap: 0.75rem;
}

.invite-link__input {
  flex-grow: 1;
  min-width: 0;
  font-family: ui-monospace, monospace;
  font-size: 0.875rem;
}

/*
 * Members: the team's join link, for its managers (docs/adr/0091) - a box
 * like a new invite link's, between the Add buttons and the table.
 */
.join-link {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: 48rem;
  margin-bottom: 1.5rem;
  padding: 1rem;
  border: 0.125rem solid var(--black);
  background-color: var(--row-stripe);
}

.join-link__heading {
  font-size: 1.125rem;
}

/* No link yet, and people to list first (docs/adr/0112): the heading, a line and the button on one row. */
.join-link--compact {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.375rem 1rem;
  padding: 0.625rem 1rem;
}

.join-link--compact .join-link__heading {
  font-size: 1rem;
}

.join-link__off {
  flex: 1 1 14rem;
}

.join-link__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.join-link .help-text {
  font-size: 0.875rem;
  opacity: 0.85;
}

.invite__summary,
.invite__sign-in {
  margin-bottom: 1.25rem;
}

.invite__not-you {
  margin-top: 1rem;
  font-size: 0.875rem;
}

.member-account .help-text,
.login-card .help-text {
  font-size: 0.875rem;
  opacity: 0.85;
}

/* "Invited" / "No account" beside Edit on the Members page (docs/adr/0029). */
.member-status {
  margin-right: 0.75rem;
}

/*
 * Members: an Invite link for anyone still to join (docs/adr/0045) - a plain
 * link like Edit beside it, so Add a member is the page's one yellow
 * (docs/adr/0112).
 */
.member-status--invite {
  color: inherit;
  font-size: 0.875rem;
}

/* Members: anyone who joined in the last two weeks (docs/adr/0104). */
.member-status--new {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  background-color: var(--black);
  color: var(--white);
  font-size: 0.8rem;
  font-weight: 700;
}

/*
 * Members on phones (docs/adr/0045): each row a card - number, then name
 * and roles, then Invite and Edit - with the positions underneath, rather
 * than a table to scroll sideways. The table's explicit roles (in the
 * template) keep it a table for screen readers.
 */
@media (max-width: 40rem) {
  #members thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  #members,
  #members tbody {
    display: block;
  }

  #members tbody tr {
    display: grid;
    grid-template-areas:
      "number name actions"
      "number positions positions";
    grid-template-columns: 2rem minmax(0, 1fr) auto;
    gap: 0.375rem 0.75rem;
    padding: 0.75rem 0.5rem;
    border-bottom: 0.0625rem solid var(--border);
  }

  #members tbody th,
  #members tbody td {
    display: block;
    min-width: 0;
    padding: 0;
    border: 0;
  }

  #members .data-table__number {
    grid-area: number;
    width: auto;
    text-align: left;
  }

  #members .data-table__name {
    grid-area: name;
  }

  #members .members__positions {
    grid-area: positions;
  }

  #members .data-table__actions {
    grid-area: actions;
    width: auto;
  }

  #members .data-table__actions .member-status {
    margin-right: 0.5rem;
  }

  #members .data-table__role-column {
    display: none;
  }
}

/* A new team's setup steps, on its Overview (docs/adr/0045). */
.setup {
  max-width: 40rem;
  margin-bottom: 2rem;
  padding: 1rem 1.25rem;
  border: 0.25rem solid var(--black);
  border-radius: 0.5rem;
  box-shadow: 0.375rem 0.375rem var(--black);
  background-color: var(--tertiary);
  color: var(--black);
}

.setup h2 {
  margin-bottom: 0.75rem;
  font-size: 1.25rem;
}

/*
 * Each step is the indicator, then its words and link in a column of their
 * own, with a line down to the next step's indicator (docs/adr/0094).
 * Steps are spaced by padding, not a gap, so the line runs through it.
 */
.setup__step {
  position: relative;
  display: grid;
  grid-template-columns: 1.5rem 1fr;
  align-items: start;
  column-gap: 0.625rem;
  padding-bottom: 0.75rem;
}

.setup__step:last-child {
  padding-bottom: 0;
}

.setup__step:not(:last-child)::before {
  content: "";
  position: absolute;
  top: 1.5rem;
  bottom: 0;
  left: calc((1.5rem - 0.125rem) / 2);
  width: 0.125rem;
  background-color: var(--black);
}

.setup__number {
  display: grid;
  place-items: center;
  width: 1.5rem;
  height: 1.5rem;
  border: 0.125rem solid var(--black);
  border-radius: 50%;
  background-color: var(--white);
  font-size: 0.8rem;
  font-weight: 700;
}

/* Steps still to do after the next one. */
.setup__step:not(.is-done) ~ .setup__step:not(.is-done) .setup__number {
  border-color: var(--muted);
  color: var(--muted);
}

.setup__tick {
  width: 1.5rem;
  height: 1.5rem;
}

.setup__tick .icon__circle {
  fill: var(--done);
  stroke-width: 2;
}

.setup__tick .icon__mark {
  stroke: var(--white);
}

/*
 * The label grows to fill its line, so the link sits at the right while
 * both fit, and starts a line of its own, at the left, when they don't.
 */
.setup__body {
  display: flex;
  flex-wrap: wrap;
  column-gap: 0.625rem;
}

.setup__label {
  flex: 1 1 auto;
}

/* A step with two ways (docs/adr/0112): what they are, then each, on lines of their own. */
.setup__hint {
  flex: 1 0 100%;
  font-size: 0.9375rem;
}

.setup__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
}

.setup__hint ~ .setup__actions {
  flex: 1 0 100%;
}

.setup__step.is-done .setup__label {
  text-decoration: line-through;
  opacity: 0.75;
}

.setup__action {
  font-weight: 700;
}

/* How much of the last three months each came to (docs/adr/0048). */
.members__came {
  white-space: nowrap;
}

/* Said by the column's header, except on phones, where there's none. */
.members__came-label {
  display: none;
}

.members__note {
  max-width: 40rem;
  margin-top: 0.75rem;
  font-size: 0.875rem;
}

@media (max-width: 40rem) {
  #members tbody tr {
    grid-template-areas:
      "number name actions"
      "number positions came";
  }

  #members .members__came {
    grid-area: came;
    align-self: end;
    font-size: 0.875rem;
  }

  .members__came-label {
    display: inline;
  }
}

/* Who's left (docs/adr/0050): folded away under the Members table. */
.former-members {
  max-width: 48rem;
  margin-top: 2rem;
  border-top: 0.125rem solid var(--black);
}

.former-members__summary {
  display: flex;
  align-items: baseline;
  padding: 0.75rem 0;
  cursor: pointer;
}

.former-members__heading {
  font-size: 1.25rem;
}

.former-members__count {
  font-weight: 400;
}

.former-members__member {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  padding: 0.625rem 0;
  border-bottom: 0.0625rem solid var(--border);
}

.former-members__name {
  font-weight: 600;
}

.former-members__action {
  display: inline;
}

.former-members__note {
  margin-top: 0.75rem;
  font-size: 0.875rem;
}

/* The Overview's results (docs/adr/0061): the record, then the latest few. */
.team-record {
    margin-bottom: 0.75rem;
}

.team-results__match {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem 0.75rem;
    padding: 0.375rem 0;
}

.team-results__outcome {
    display: inline-grid;
    place-items: center;
    width: 1.75rem;
    height: 1.75rem;
    border: 0.125rem solid var(--black);
    border-radius: 50%;
    font-weight: 700;
}

.team-results__outcome--won {
    background-color: var(--reply-attending);
}

.team-results__outcome--drew {
    background-color: var(--reply-maybe);
}

.team-results__outcome--lost {
    background-color: var(--reply-not-attending);
}

.team-results__when {
    font-size: 0.875rem;
}

/* Fines, for fun (docs/adr/0062): counts in a table, the team's fines as tags. */
.fines-table__count {
    text-align: center;
}

/*
 * Phones: a card a person - their name, then a tag for each fine they've
 * had, and the total - not a table to scroll sideways (docs/adr/0118).
 */
@media (max-width: 40rem) {
    .fines-table thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip-path: inset(50%);
        white-space: nowrap;
    }

    .fines-table,
    .fines-table tbody {
        display: block;
    }

    .fines-table tbody tr {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 0.375rem 0.5rem;
        padding: 0.75rem 0.25rem;
        border-bottom: 0.0625rem solid var(--border);
    }

    .fines-table tbody th {
        flex: 1 0 100%;
        padding: 0;
        border: 0;
    }

    .fines-table tbody td {
        display: inline-flex;
        gap: 0.375rem;
        padding: 0.125rem 0.625rem;
        border: 0.125rem solid var(--black);
        border-radius: 1rem;
        background-color: var(--tertiary);
        font-weight: 700;
        text-align: left;
    }

    .fines-table tbody td::before {
        content: attr(data-label);
        font-weight: 400;
    }

    .fines-table tbody td[data-empty] {
        display: none;
    }

    .fines-table tbody td.fines-table__total {
        margin-left: auto;
        background-color: var(--white);
    }
}

.fine-types {
    max-width: 40rem;
    margin-top: 2rem;
}

.fine-types__list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    margin: 0.75rem 0 1.5rem;
}

.fine-types__type,
.fine-list__fine {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.fine-types__action,
.fine-list__action {
    display: inline;
}

.fine-tag {
    display: inline-block;
    padding: 0.125rem 0.625rem;
    border: 0.125rem solid var(--black);
    border-radius: 1rem;
    background-color: var(--tertiary);
    color: var(--black);
    font-weight: 600;
}

/* A new member's first prompt, on the Overview (docs/adr/0117). */
.team-welcome {
  max-width: 40rem;
  margin-bottom: 1.5rem;
}
