/* django-flashdeck
 *
 * The colours are custom properties, which a site can set on .flashdeck to match
 * its own palette: --flashdeck-ink, -muted, -line, -surface, -input, -accent and
 * -accent-on; -right, -nearly and -wrong (the colours of marks as text);
 * -bar-right, -bar-nearly and -bar-wrong (the chart's bars); and -page (the
 * reference dialog's background). The defaults follow the page's text colour and
 * its color-scheme (light or dark).
 */

.flashdeck {
  --fd-ink: var(--flashdeck-ink, currentColor);
  --fd-muted: var(--flashdeck-muted, color-mix(in srgb, currentColor 70%, transparent));
  --fd-line: var(--flashdeck-line, color-mix(in srgb, currentColor 25%, transparent));
  --fd-surface: var(--flashdeck-surface, color-mix(in srgb, currentColor 4%, transparent));
  --fd-accent: var(--flashdeck-accent, light-dark(#1d4ed8, #93c5fd));
  --fd-accent-on: var(--flashdeck-accent-on, light-dark(#ffffff, #0b1220));
  --fd-right: var(--flashdeck-right, light-dark(#166534, #86efac));
  --fd-nearly: var(--flashdeck-nearly, light-dark(#854d0e, #fde047));
  --fd-wrong: var(--flashdeck-wrong, light-dark(#b91c1c, #fca5a5));
  /* The chart's marks: blue, grey and red, validated as distinguishable with each
     kind of colour blindness, on light and dark pages. Text never uses them. */
  --fd-bar-right: var(--flashdeck-bar-right, light-dark(#2a78d6, #3987e5));
  --fd-bar-nearly: var(--flashdeck-bar-nearly, light-dark(#8f8d87, #b0aea8));
  --fd-bar-wrong: var(--flashdeck-bar-wrong, light-dark(#e34948, #e66767));
  --fd-page: var(--flashdeck-page, Canvas);
  color: var(--fd-ink);
  line-height: 1.5;
}

.flashdeck h1 { font-size: 1.75rem; font-weight: 700; line-height: 1.2; margin: 0 0 1rem; }
.flashdeck h2 { font-size: 1.25rem; font-weight: 600; line-height: 1.3; margin: 1.5rem 0 0.5rem; }
.flashdeck p { margin: 0.5rem 0; }
.flashdeck a { color: var(--fd-accent); }

.flashdeck-topbar {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between;
  gap: 0.25rem 1rem; margin-bottom: 1rem; font-size: 0.875rem; color: var(--fd-muted);
}
.flashdeck-crumbs { font-size: 0.875rem; color: var(--fd-muted); margin-bottom: 1rem; }
.flashdeck-topbar .flashdeck-crumbs { margin-bottom: 0; }
.flashdeck-crumbs a { color: inherit; }
.flashdeck-muted { color: var(--fd-muted); font-size: 0.875rem; }

.flashdeck-decks { list-style: none; padding: 0; margin: 0; }
.flashdeck-decks li { padding: 0.375rem 0; border-top: 1px solid var(--fd-line); }
.flashdeck-due {
  display: inline-block; margin-left: 0.5rem; padding: 0 0.5rem; border-radius: 999px;
  font-size: 0.8125rem; font-weight: 600; vertical-align: middle;
  background: var(--fd-accent); color: var(--fd-accent-on);
}

.flashdeck-card {
  padding: 1.25rem; border: 1px solid var(--fd-line); border-radius: 0.75rem;
  background: var(--fd-surface);
}
.flashdeck-prompt { margin-bottom: 1rem; }
.flashdeck-prompt img {
  display: block; max-width: 100%; height: auto; max-height: 60vh;
  margin: 0 auto 0.75rem; border-radius: 0.5rem;
}
.flashdeck .flashdeck-prompt-text { font-size: 1.375rem; font-weight: 600; line-height: 1.35; margin: 0; }

/* Answer boxes, each with its label (such as a pronoun) to the left. */
.flashdeck-row { display: flex; align-items: center; gap: 0.75rem; margin: 0.5rem 0; }
.flashdeck-row label,
.flashdeck-label { flex: 0 0 7.5rem; text-align: right; color: var(--fd-muted); }
.flashdeck-row input {
  flex: 1; min-width: 0; padding: 0.5rem 0.625rem;
  font: inherit; font-size: max(1rem, 16px); /* 16px or more stops phones zooming in */
  color: inherit; background: var(--flashdeck-input, transparent);
  border: 1px solid var(--fd-line); border-radius: 0.375rem;
}
.flashdeck-row input:focus { outline: 2px solid var(--fd-accent); outline-offset: 1px; }

.flashdeck-characters { display: flex; flex-wrap: wrap; gap: 0.375rem; margin: 0.75rem 0; }
.flashdeck-characters button {
  min-width: 2.5rem; min-height: 2.5rem; font: inherit; color: inherit; cursor: pointer;
  background: transparent; border: 1px solid var(--fd-line); border-radius: 0.375rem;
}

.flashdeck-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; margin-top: 1rem; }
.flashdeck-primary,
.flashdeck-button {
  display: inline-block; padding: 0.5rem 1.25rem; border-radius: 0.375rem;
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
}
.flashdeck .flashdeck-primary { background: var(--fd-accent); color: var(--fd-accent-on); border: 1px solid var(--fd-accent); }
.flashdeck .flashdeck-button { background: transparent; color: var(--fd-accent); border: 1px solid var(--fd-line); }
.flashdeck-primary:focus-visible,
.flashdeck-button:focus-visible,
.flashdeck-claim:focus-visible { outline: 2px solid var(--fd-accent); outline-offset: 2px; }

/* Results. */
.flashdeck-verdict { font-size: 1.25rem; font-weight: 700; margin: 0.5rem 0 0.75rem; }
.flashdeck-verdict.flashdeck-right,
.flashdeck-verdict.flashdeck-claimed { color: var(--fd-right); }
.flashdeck-verdict.flashdeck-nearly { color: var(--fd-nearly); }
.flashdeck-verdict.flashdeck-wrong { color: var(--fd-wrong); }
.flashdeck-results { list-style: none; padding: 0; margin: 0; }
.flashdeck-result {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 0.75rem;
  padding: 0.375rem 0; border-top: 1px solid var(--fd-line);
}
.flashdeck-mark { font-weight: 700; }
.flashdeck-right .flashdeck-mark,
.flashdeck-claimed .flashdeck-mark { color: var(--fd-right); }
.flashdeck-nearly .flashdeck-mark { color: var(--fd-nearly); }
.flashdeck-wrong .flashdeck-mark { color: var(--fd-wrong); }
.flashdeck-wrong .flashdeck-given { text-decoration: line-through; text-decoration-color: var(--fd-wrong); }
.flashdeck-expected { font-weight: 600; color: var(--fd-right); }
.flashdeck-claim {
  margin-left: auto; padding: 0.125rem 0.625rem; font: inherit; font-size: 0.875rem;
  color: var(--fd-accent); background: transparent; cursor: pointer;
  border: 1px solid var(--fd-line); border-radius: 999px;
}
/* Card options: hiding a card, and how often it comes back. */
.flashdeck-options { margin-top: 1rem; font-size: 0.875rem; }
.flashdeck-options summary { cursor: pointer; color: var(--fd-muted); }
.flashdeck-choices { display: flex; flex-wrap: wrap; align-items: center; gap: 0.375rem; margin: 0.5rem 0; }
.flashdeck-choice {
  padding: 0.125rem 0.625rem; font: inherit; font-size: 0.875rem;
  color: var(--fd-accent); background: transparent; cursor: pointer;
  border: 1px solid var(--fd-line); border-radius: 999px;
}
.flashdeck .flashdeck-choice[aria-pressed="true"] {
  color: var(--fd-accent-on); background: var(--fd-accent); border-color: var(--fd-accent);
}
.flashdeck-choice:focus-visible,
.flashdeck-link:focus-visible { outline: 2px solid var(--fd-accent); outline-offset: 2px; }
.flashdeck-link {
  padding: 0; font: inherit; color: var(--fd-accent); background: none; border: 0;
  text-decoration: underline; cursor: pointer;
}
.flashdeck-minor { margin-top: 0.75rem; font-size: 0.875rem; text-align: right; }
.flashdeck-notice {
  margin-bottom: 0.75rem; padding: 0.5rem 0.75rem; font-size: 0.875rem;
  border: 1px solid var(--fd-line); border-radius: 0.5rem;
}
.flashdeck-account { margin-left: auto; }
.flashdeck-account form { display: inline; }
.flashdeck-setting { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem; }
.flashdeck-setting form { margin: 0; }

.flashdeck-notes { margin-top: 1rem; padding-top: 0.5rem; border-top: 1px solid var(--fd-line); }
.flashdeck-credit { font-size: 0.8125rem; color: var(--fd-muted); }

.flashdeck-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}

@media (max-width: 30rem) {
  .flashdeck-row label,
  .flashdeck-label { flex-basis: 5.5rem; }
  .flashdeck-card { padding: 1rem; }
}

/* Tables (the reference, the progress page and Markdown). */
.flashdeck table { width: 100%; border-collapse: collapse; font-size: 0.9375rem; }
.flashdeck th,
.flashdeck td { padding: 0.375rem 0.5rem; text-align: left; vertical-align: top; border-top: 1px solid var(--fd-line); }
.flashdeck thead th { font-weight: 600; color: var(--fd-muted); border-top: 0; }
.flashdeck td { font-variant-numeric: tabular-nums; }
.flashdeck-scroll { overflow-x: auto; }
.flashdeck-prose { margin: 0.5rem 0 1rem; }
.flashdeck-prose table { width: auto; margin: 0.75rem 0; }
.flashdeck-prose ul, .flashdeck-prose ol { padding-left: 1.5rem; }
.flashdeck-prose ul { list-style: disc; }
.flashdeck-prose ol { list-style: decimal; }

/* Progress: three figures for today, the chart and its table. */
.flashdeck-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; list-style: none; padding: 0; margin: 0 0 1.5rem; }
.flashdeck-tiles li { padding: 0.75rem; border: 1px solid var(--fd-line); border-radius: 0.5rem; color: var(--fd-muted); font-size: 0.875rem; }
.flashdeck-tiles strong { display: block; font-size: 1.75rem; line-height: 1.2; color: var(--fd-ink); font-variant-numeric: tabular-nums; }
.flashdeck-chart { margin: 0 0 0.5rem; }
.flashdeck-chart figcaption { font-weight: 600; margin-bottom: 0.25rem; }
.flashdeck-legend { display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; list-style: none; padding: 0; margin: 0 0 0.5rem; font-size: 0.875rem; color: var(--fd-muted); }
.flashdeck-legend li { display: flex; align-items: center; gap: 0.375rem; }
.flashdeck-swatch { display: inline-block; width: 0.75rem; height: 0.75rem; border-radius: 2px; }
.flashdeck-bar-right { background: var(--fd-bar-right); }
.flashdeck-bar-nearly { background: var(--fd-bar-nearly); }
.flashdeck-bar-wrong { background: var(--fd-bar-wrong); }
.flashdeck-plot { position: relative; height: 9rem; padding-top: 1.25rem; border-bottom: 1px solid var(--fd-line); }
.flashdeck-plot-max { position: absolute; top: 0; left: 0; font-size: 0.75rem; color: var(--fd-muted); }
.flashdeck-bars {
  display: grid; grid-template-columns: repeat(30, minmax(0, 1fr)); gap: 2px;
  height: 100%; margin: 0; padding: 0; list-style: none;
  border-top: 1px dashed var(--fd-line); /* the busiest day */
}
.flashdeck-day { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; outline-offset: 1px; }
.flashdeck-day:focus-visible { outline: 2px solid var(--fd-accent); }
.flashdeck-stack { display: flex; flex-direction: column; gap: 2px; width: 70%; max-width: 24px; }
.flashdeck-stack > span { flex-basis: 0; min-height: 2px; }
.flashdeck-stack > span:first-child { border-radius: 4px 4px 0 0; }
.flashdeck-day:hover .flashdeck-stack,
.flashdeck-day:focus-visible .flashdeck-stack { filter: brightness(1.12); }
.flashdeck-plot-axis { display: flex; justify-content: space-between; font-size: 0.75rem; color: var(--fd-muted); margin-top: 0.25rem; }
.flashdeck-table-view { margin-bottom: 1.5rem; font-size: 0.875rem; }
.flashdeck-table-view summary { cursor: pointer; color: var(--fd-muted); }
.flashdeck-missed { padding-left: 1.5rem; }
.flashdeck-missed li { margin: 0.25rem 0; }
.flashdeck-today { margin-top: 0.75rem; }

/* The reference: search, the index, the forms of a card, and the dialog. */
.flashdeck-search { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin: 0.75rem 0; }
.flashdeck-search input {
  flex: 1; min-width: 12rem; padding: 0.5rem 0.625rem; font: inherit; font-size: max(1rem, 16px);
  color: inherit; background: var(--flashdeck-input, transparent);
  border: 1px solid var(--fd-line); border-radius: 0.375rem;
}
.flashdeck-search input:focus { outline: 2px solid var(--fd-accent); outline-offset: 1px; }
.flashdeck-index { columns: 12rem; column-gap: 1.5rem; list-style: none; padding: 0; margin: 0; }
.flashdeck-index li { padding: 0.125rem 0; break-inside: avoid; }
.flashdeck-forms {
  display: grid; grid-auto-flow: column; grid-template-rows: repeat(var(--flashdeck-rows, 1), auto);
  grid-auto-columns: minmax(0, 1fr); gap: 0.125rem 1rem; list-style: none; padding: 0; margin: 0;
}
.flashdeck-reference-table th { width: 30%; font-weight: 600; }
.flashdeck-reference-table th a { color: inherit; }
.flashdeck-thumb { display: block; max-width: 6rem; max-height: 6rem; margin-bottom: 0.25rem; border-radius: 0.25rem; }
.flashdeck-section { margin-bottom: 1rem; }
.flashdeck-section h2 a { color: inherit; }
.flashdeck-dialog {
  width: min(48rem, 100vw - 2rem); max-height: min(80vh, 48rem); padding: 0;
  color: var(--fd-ink); background: var(--fd-page);
  border: 1px solid var(--fd-line); border-radius: 0.75rem;
}
.flashdeck-dialog::backdrop { background: rgb(0 0 0 / 0.4); }
.flashdeck-dialog-bar {
  position: sticky; top: 0; z-index: 1; display: flex; align-items: center; gap: 0.75rem;
  padding: 0.5rem 1rem; background: var(--fd-page); border-bottom: 1px solid var(--fd-line);
}
.flashdeck-dialog-bar .flashdeck-muted { flex: 1; }
.flashdeck-dialog-body { padding: 0.5rem 1rem 1rem; overflow-y: auto; max-height: calc(min(80vh, 48rem) - 3.5rem); }
.flashdeck-dialog-body h1 { font-size: 1.375rem; }
@media (max-width: 40rem) {
  .flashdeck-dialog { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; border-radius: 0; border: 0; }
  .flashdeck-dialog-body { max-height: calc(100dvh - 3.5rem); }
  .flashdeck-tiles strong { font-size: 1.375rem; }
}
