/* aiforce.army — /czar/ only: the ballot and the nomination form.
 *
 * A candidate is a card: portrait, name, the line on file, the poll. The rest of the
 * record is the file, a popover the name opens. Nothing here is red and nothing here is
 * on a bone sheet: the ballot lives in a dark panel, so gold and the machine's grey are
 * the only marks on it.
 */

.cz-ballot,
.cz-form,
.cz-result {
  margin-top: var(--s-7);
}

/* The ballot's head carries the one way onto it for a name that is not there. */
.cz-ballot__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-3);
}

.cz-ballot__rule {
  margin: var(--s-4) 0 0;
  font-size: var(--fs-nano);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}


.cz-ballot__list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  /* Three across at the column's full width, and one fewer whenever a card would have
     to shrink below 330px. The panel's own padding is why 330 and not 350: three of the
     larger cards do not fit inside it. */
  grid-template-columns: repeat(auto-fill, minmax(min(330px, 100%), 1fr));
  gap: var(--s-3);
  align-items: stretch;
}

.cz-ballot__waiting {
  grid-column: 1 / -1;
  padding: var(--s-4) 0;
}

/* --- The card ------------------------------------------------------------- */

.cz-cand {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: var(--s-3);
  padding: var(--s-4);
  background: var(--c-panel-raised);
  border: var(--bw) solid var(--c-line);
  border-radius: var(--radius);
  transition: border-color var(--dur-1) var(--ease);
}

.cz-cand {
  cursor: pointer;
}

.cz-cand:hover {
  border-color: var(--c-line-brass);
}

.cz-cand__poll,
.cz-file {
  cursor: auto;
}

/* The head is the button that opens the file: portrait and name, nothing that looks
   like a control, because the whole head is the control. */
.cz-cand__head {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.cz-cand__head:focus-visible {
  outline: 2px solid var(--c-brass-bright);
  outline-offset: 3px;
}

.cz-cand__portrait,
.cz-cand__blank {
  flex: none;
  width: 56px;
  height: 56px;
  object-fit: cover;
  border: var(--bw) solid var(--c-line-brass);
  border-radius: var(--radius);
}

.cz-cand__blank {
  background: var(--c-navy);
  -webkit-mask: none;
}

.cz-cand__name {
  display: block;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--fs-display-4);
  line-height: 1.15;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--c-ink);
}

.cz-cand__head:hover .cz-cand__name {
  color: var(--c-brass);
}

.cz-cand__handle {
  display: block;
  margin-top: 2px;
  font-family: var(--font-mono);
  font-size: var(--fs-nano);
  letter-spacing: 0.08em;
  text-transform: none;
  color: var(--c-brass);
}

/* The line on file, clamped so every card keeps to a few lines at rest. */
.cz-cand__quote,
.cz-cand__reason {
  margin: 0;
  font-family: var(--font-text);
  font-size: var(--fs-small);
  line-height: 1.55;
  color: var(--c-ink);
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  overflow: hidden;
  /* Four lines, filled or not, so every card in a row stands the same height and the
     poll sits on one baseline across the ballot. */
  min-height: calc(4 * 1.55em);
}

.cz-cand__reason {
  color: var(--c-ink-dim);
}

/* --- The poll --------------------------------------------------------------- */

.cz-cand__poll {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  padding-top: var(--s-3);
  border-top: var(--bw) solid var(--c-line);
}

.cz-cand__votes {
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--c-brass);
  white-space: nowrap;
}

/* --- The file ----------------------------------------------------------------
   A popover in the top layer: the role, the line in full, where and when it was said,
   the source, and the Office's note. Light-dismissed by a click anywhere else or by
   Escape. Without the popover API it opens in place under the card instead. */

.cz-file {
  display: none;
  width: min(36rem, calc(100vw - 2 * var(--gutter)));
  margin: auto;
  padding: var(--s-5);
  background: var(--c-panel);
  color: var(--c-ink);
  border: var(--bw) solid var(--c-line-brass);
  border-radius: var(--radius);
}

.cz-file:popover-open {
  display: grid;
  gap: var(--s-4);
  position: fixed;
  inset: 0;
  max-height: calc(100vh - 2 * var(--gutter));
  overflow: auto;
}

.cz-file::backdrop {
  background: rgba(4, 7, 20, 0.7);
}

.cz-file.is-open {
  display: grid;
  gap: var(--s-4);
  width: auto;
  margin-top: var(--s-3);
}

.cz-file__head {
  display: flex;
  align-items: center;
  gap: var(--s-4);
}

.cz-file__portrait {
  flex: none;
  width: 80px;
  height: 80px;
  object-fit: cover;
  border: var(--bw) solid var(--c-line-brass);
  border-radius: var(--radius);
}

.cz-file__role {
  margin: var(--s-1) 0 0;
  font-family: var(--font-mono);
  font-size: var(--fs-nano);
  line-height: 1.7;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--c-muted);
}

.cz-file__quote,
.cz-file__reason {
  margin: 0;
  font-family: var(--font-text);
  font-size: var(--fs-body);
  line-height: 1.5;
  color: var(--c-ink);
}

.cz-file__quote--person {
  padding-left: var(--s-3);
  border-left: var(--bw-thick) solid var(--c-line-brass);
}

.cz-file__attr,
.cz-file__note {
  margin: 0;
  font-family: var(--font-mono);
  font-size: var(--fs-nano);
  line-height: 1.7;
  color: var(--c-muted);
  overflow-wrap: break-word;
}

.cz-file__notelabel {
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--c-ink-dim);
}

.cz-file__notelabel::after {
  content: " \00b7";
  color: var(--c-line-strong);
}

.cz-file__close {
  justify-self: end;
}
