/* The member assignments page (/r/<uuid>/assignments, and the demo's preview of it):
   heading, team switcher, "Your spots", the page rail and the read-only tables. The .as-* parts (table,
   spots) are the shared read-only view in app/assignments/assignment-view.js; its
   label parts are in dashboard/css/assignments.css, linked before this file. Icon
   sizes are in dashboard/css/icons.css. */
.assignments-body {
  min-height: 100vh;
  background: var(--bg-primary);
}

.assignments-main {
  padding-block: 32px 72px;
}

.ap-heading h1 {
  margin: 4px 0 8px;
  font-size: 30px;
  line-height: 1.15;
}

.ap-sub,
.ap-note,
.ap-none {
  margin: 0;
  color: var(--text-secondary);
  font-size: 14px;
}

.ap-warning {
  margin: 12px 0 0;
  color: var(--warning);
  font-size: 14px;
}

/* Team switcher */
.ap-teams {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 20px 0 0;
}

.ap-team,
.ap-tab {
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
  color: var(--text-secondary);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.ap-team:hover,
.ap-tab:hover {
  border-color: var(--border-hover);
  color: var(--text-primary);
}

.ap-team[aria-pressed="true"],
.ap-tab[aria-current="true"] {
  border-color: var(--accent-border);
  background: var(--accent-soft);
  color: var(--text-primary);
}

.ap-team:focus-visible,
.ap-tab:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

/* Your spots: a card per spot that shows its page, in as many columns as fit. */
.ap-spots {
  margin: 24px 0 0;
}

.ap-spots h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  font-size: 18px;
}

.ap-count {
  padding: 1px 7px;
  border-radius: 5px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}

.ap-spot-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ap-spot-list li {
  display: grid;
}

/* The card's left edge carries the table's color, or the accent for a table without one
   or whose stripe is off. Its left corners are square, so the stripe runs straight. */
.ap-spot {
  --ap-spot-color: var(--accent);
  --ap-spot-stripe: var(--accent);
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--ap-spot-stripe);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: var(--bg-card);
  color: var(--text-primary);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.ap-spot[data-color] {
  --ap-spot-color: var(--as-table-color);
}

.ap-spot[data-stripe] {
  --ap-spot-stripe: var(--as-table-color);
}

.ap-spot:hover {
  border-color: var(--border-hover);
  border-left-color: var(--ap-spot-stripe);
  background: var(--bg-hover);
}

.ap-spot:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

.ap-spot-head {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ap-spot-page {
  min-width: 0;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

/* The arrow says the card leads to its page. */
.ap-spot-go {
  flex: none;
  color: var(--text-muted);
}

.ap-spot:hover .ap-spot-go {
  color: var(--accent);
}

.ap-spot-number {
  flex: none;
  margin-left: auto;
  padding: 1px 7px;
  border-radius: 5px;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 700;
}

.ap-spot-what {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-width: 0;
  font-size: 16px;
  overflow-wrap: anywhere;
}

.ap-spot-what .as-label-text {
  font-weight: 700;
}

.ap-spot-table {
  color: var(--ap-spot-color);
  font-size: 13px;
  font-weight: 600;
}

.ap-spot-character {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
}

.ap-spot-with {
  color: var(--text-secondary);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.ap-spot-with span {
  font-weight: 600;
}

/* Pages: on phones every page stacked under a bar of page buttons that scroll to them; from
   768px the rail beside the one page on show. */
.ap-pages {
  margin-top: 24px;
}

.ap-rail {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  gap: 6px;
  margin: 0 0 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  background: var(--bg-primary);
  overflow-x: auto;
  scrollbar-width: none;
}

.ap-rail .ap-tab {
  display: flex;
  flex: none;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
}

.ap-tab-name {
  min-width: 0;
}

/* How many of the viewer's spots a page holds. */
.ap-tab-count {
  flex: none;
  min-width: 20px;
  padding: 1px 6px;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 11px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
}

/* Stacked, the last page tapped isn't "the" page: every tab looks alike. */
.ap-rail .ap-tab[aria-current="true"] {
  border-color: var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
}

.ap-page {
  margin-bottom: 28px;
  scroll-margin-top: 64px;
}

.ap-page > h2:focus {
  outline: none;
}

.ap-page > h2 {
  margin: 0 0 12px;
  font-size: 20px;
}

.ap-sheets {
  min-width: 0;
}

@media (min-width: 768px) {
  .ap-pages:not(.is-single) {
    display: grid;
    grid-template-columns: 200px minmax(0, 1fr);
    gap: 24px;
    align-items: start;
  }

  .ap-rail {
    top: 16px;
    display: grid;
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
  }

  .ap-rail .ap-tab {
    justify-content: space-between;
    padding: 8px 12px 8px 14px;
    text-align: left;
    overflow-wrap: anywhere;
  }

  .ap-rail .ap-tab[aria-current="true"] {
    border-color: var(--accent-border);
    background: var(--accent-soft);
    color: var(--text-primary);
  }

  .ap-page {
    scroll-margin-top: 16px;
  }

  .ap-pages:not(.is-single) .ap-page:not(.is-current) {
    display: none;
  }
}

/* Tables: a box with the title and note in a tinted header, then a row per label. */
.as-table-box {
  --as-head-tint: var(--bg-elevated);
  container-type: inline-size;
  margin: 0 0 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-card);
}

.as-table-box[data-color] {
  --as-head-tint: color-mix(in srgb, var(--as-table-color) 12%, var(--bg-card));
}

/* Square left corners, so the stripe runs straight down the box. */
.as-table-box[data-stripe] {
  border-left: 3px solid var(--as-table-color);
  border-radius: 0 var(--radius) var(--radius) 0;
}

/* Fixed layout, so the label column keeps its width whatever the rows hold. */
.as-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.as-table caption {
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--as-head-tint);
  text-align: left;
  caption-side: top;
}

.as-table-title {
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.as-table-box[data-color] .as-table-title {
  color: var(--as-table-color);
}

.as-table th,
.as-table td {
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.as-table tr:first-child th,
.as-table tr:first-child td {
  border-top: 0;
}

/* One label width in every table, so the people line up from table to table. */
.as-table th {
  width: 220px;
  padding-top: 15px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

/* The viewer's rows: tinted, with an accent bar at the start. */
.as-table tr:has(.is-mine) {
  background: var(--accent-soft);
}

.as-table tr:has(.is-mine) th {
  box-shadow: inset 3px 0 0 var(--accent);
}

/* A row's people as chips in columns; a row with several spots numbers them. */
.as-slots {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(210px, 100%), 1fr));
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: spot;
}

.as-slot {
  display: flex;
  gap: 7px;
  align-items: center;
  min-width: 0;
  min-height: 36px;
  padding: 4px 10px 4px 6px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-secondary);
  counter-increment: spot;
}

.as-slot.is-open {
  border-style: dashed;
  background: none;
}

.as-slot.is-mine {
  border-color: var(--accent-border);
  background: var(--bg-card);
}

.as-slots.is-numbered .as-slot::before {
  content: counter(spot) / "";
  flex: none;
  min-width: 20px;
  padding: 1px 4px;
  border-radius: 5px;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 700;
  text-align: center;
}

.as-slots:not(.is-numbered) .as-slot {
  padding-left: 8px;
}

.as-slot .icon-pair {
  flex: none;
}

.as-person {
  min-width: 0;
  font-weight: 600;
  overflow-wrap: anywhere;
}

/* A narrow box (a tablet beside the page rail) gives the people more of the width. */
@container (max-width: 620px) {
  .as-table th {
    width: 36%;
  }
}

.ap-you {
  flex: none;
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 11px;
  font-weight: 700;
}

.class-warrior {
  color: var(--class-warrior);
}

.class-paladin {
  color: var(--class-paladin);
}

.class-hunter {
  color: var(--class-hunter);
}

.class-rogue {
  color: var(--class-rogue);
}

.class-priest {
  color: var(--class-priest);
}

.class-shaman {
  color: var(--class-shaman);
}

.class-mage {
  color: var(--class-mage);
}

.class-warlock {
  color: var(--class-warlock);
}

.class-druid {
  color: var(--class-druid);
}

/* Phones: a row is its label over its spots, full width, and long words wrap. */
@media (max-width: 760px) {
  .assignments-main {
    overflow-wrap: anywhere;
  }

  .as-table,
  .as-table caption,
  .as-table tbody,
  .as-table tr,
  .as-table th,
  .as-table td {
    display: block;
    width: 100%;
    min-width: 0;
  }

  .as-table th {
    padding-top: 10px;
    padding-bottom: 6px;
    border-top: 1px solid var(--border);
  }

  .as-table td {
    padding-top: 0;
    border-top: 0;
  }

  .as-table tr:first-child th {
    border-top: 0;
  }

  .as-table tr:has(.is-mine) th {
    box-shadow: none;
  }

  .as-table tr:has(.is-mine) {
    box-shadow: inset 3px 0 0 var(--accent);
  }

  .as-slots {
    grid-template-columns: minmax(0, 1fr);
  }

  .ap-spot-list {
    grid-template-columns: minmax(0, 1fr);
  }

  .ap-heading h1 {
    font-size: 24px;
  }
}
