/* The vocab-flashcards page (modules/vocab-flashcards.ts): the landing's
 * mode choices, the one-card stage, and the fixed progress bar. */

@import url('page.css');

:root {
  --fc-card-bg: #ffffff;
  --fc-card-border: #c8c8c8;
  --fc-card-shadow: rgba(0, 0, 0, 0.08);
  --fc-rule: #d8d8d8;
  --fc-muted: #666;
  --fc-primary: #1d6fd8;
  --fc-primary-fg: #ffffff;
  --fc-missed: #b00020;
  --fc-got-it: #2e7d32;
  --fc-progress-bg: #ffffff;
  --fc-track: #dddddd;
  --fc-fill: #1d6fd8;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --fc-card-bg: #1f1f1f;
    --fc-card-border: #555;
    --fc-card-shadow: rgba(0, 0, 0, 0.5);
    --fc-rule: #444;
    --fc-muted: #aaa;
    --fc-primary: #7ab3ff;
    --fc-primary-fg: #101010;
    --fc-missed: #ff6b7a;
    --fc-got-it: #8fd19e;
    --fc-progress-bg: #181818;
    --fc-track: #444;
    --fc-fill: #7ab3ff;
  }
}

:root[data-theme='dark'] {
  --fc-card-bg: #1f1f1f;
  --fc-card-border: #555;
  --fc-card-shadow: rgba(0, 0, 0, 0.5);
  --fc-rule: #444;
  --fc-muted: #aaa;
  --fc-primary: #7ab3ff;
  --fc-primary-fg: #101010;
  --fc-missed: #ff6b7a;
  --fc-got-it: #8fd19e;
  --fc-progress-bg: #181818;
  --fc-track: #444;
  --fc-fill: #7ab3ff;
}

#vocab-flashcards {
  padding-bottom: 3.5em; /* clear the fixed progress bar */
}

#vocab-flashcards .intro,
#vocab-flashcards .hint {
  max-width: 40em;
}

#vocab-flashcards .hint,
#vocab-flashcards .preview-note,
#vocab-flashcards .saved {
  color: var(--fc-muted);
  font-size: 0.9em;
}

#vocab-flashcards .preview-note {
  font-style: italic;
}

/* ---- Landing: the three modes ---- */

#vocab-flashcards .modes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14em, 1fr));
  gap: 1em 1.5em;
  max-width: 48em;
  margin: 1.5em 0;
}

#vocab-flashcards .mode p {
  margin: 0.4em 0 0;
}

#vocab-flashcards button {
  font: inherit;
  padding: 0.4em 1.2em;
  border: 1px solid var(--fc-card-border);
  border-radius: 6px;
  background: var(--fc-card-bg);
  cursor: pointer;
}

#vocab-flashcards button.primary {
  background: var(--fc-primary);
  color: var(--fc-primary-fg);
  border-color: var(--fc-primary);
}

#vocab-flashcards button.missed {
  color: var(--fc-missed);
  border-color: var(--fc-missed);
}

#vocab-flashcards button.got-it {
  color: var(--fc-got-it);
  border-color: var(--fc-got-it);
}

/* ---- The stage: header, one card, the controls ---- */

#stage .study-header {
  font-weight: normal;
  margin: 0.5em 0;
}

#stage .current {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 14em;
  margin: 1em 0;
}

#stage .card {
  width: min(32em, 100%);
  min-height: 12em;
  box-sizing: border-box;
  padding: 1.5em;
  border: 1px solid var(--fc-card-border);
  border-radius: 12px;
  background: var(--fc-card-bg);
  box-shadow: 0 2px 8px var(--fc-card-shadow);
  text-align: center;
  cursor: pointer;
  user-select: none;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.75em;
}

#stage .card.revealed {
  cursor: default;
}

#stage .card .front {
  font-size: 1.6em;
  font-weight: bold;
}

#stage .card .back {
  font-size: 1.1em;
  padding-top: 0.75em;
  border-top: 1px solid var(--fc-rule);
}

#stage .controls {
  display: flex;
  justify-content: center;
  gap: 1em;
  min-height: 2.5em;
}

/* ---- Done screen ---- */

#stage .study-done {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75em;
}

#stage .study-done .message {
  font-size: 1.3em;
  margin: 0;
}

#stage .study-done .done-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5em;
}

/* ---- The retired-cards progress bar, fixed along the bottom ---- */

#study-progress {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  gap: 0.8em;
  padding: 0.5em 1em;
  box-sizing: border-box;
  background: var(--fc-progress-bg);
  border-top: 1px solid var(--fc-rule);
  font-size: 0.85rem;
  color: var(--fc-muted);
  z-index: 5;
}

#study-progress[hidden] {
  display: none;
}

#study-progress .track {
  flex: 1;
  height: 8px;
  background: var(--fc-track);
  border-radius: 4px;
  overflow: hidden;
}

#study-progress .fill {
  height: 100%;
  width: 0;
  background: var(--fc-fill);
  border-radius: 4px;
  transition: width 0.2s;
}

#study-progress .count {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  margin-left: auto;
}

#study-progress .reset {
  font: inherit;
  color: var(--fc-primary);
  background: none;
  border: none;
  padding: 0;
  text-decoration: underline;
  cursor: pointer;
  white-space: nowrap;
}

@media (max-width: 600px) {
  #stage .card .front {
    font-size: 1.4em;
  }
}
