/* =========================================================
   Pioneer Python — Submission save panel

   The panel /js/submission.js puts up after a Submit render finishes: a
   preview of the PNG, a Download link the student clicks themselves, and
   a Done button. Shared by problem sets, the Programming Playground,
   coding quizzes, and the Binary quiz, so it lives in the shared entry
   (styles.css) rather than in any one page's stylesheet.

   Why the student clicks Download rather than the page saving for them is
   explained at length in /js/submission.js — short version: their click is
   the user gesture Chrome requires, and a Chromebook was dropping the
   script-initiated save silently.

   Uses design tokens throughout so it follows both themes, except where a
   value has to hold against whatever is behind it (the scrim).
   ========================================================= */

.submit-save {
  position: fixed;
  inset: 0;
  z-index: 1000; /* above the page chrome and any capture-mode layout */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(0.75rem, 3vw, 2rem);
  /* Not a token: this scrim sits over arbitrary page content in both
     themes, so it needs its own fixed darkness to stay readable. */
  background: rgba(0, 0, 0, 0.65);
}

.submit-save__card {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  width: min(42rem, 100%);
  max-height: 100%;
  overflow-y: auto;
  padding: clamp(1rem, 3vw, 1.75rem);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  text-align: center;
}

.submit-save__title {
  margin: 0;
  font-size: clamp(1.1rem, 2.5vw, 1.4rem);
}

.submit-save__note {
  margin: 0;
  color: var(--color-ink-muted);
}

/* The preview proves to the student that an image really exists before
   they are asked to save it — the old flow gave them no such evidence. */
.submit-save__preview {
  display: block;
  width: 100%;
  height: auto;
  max-height: 45vh;
  object-fit: contain;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

.submit-save__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  justify-content: center;
}

/* Deliberately the largest, most obvious control on the panel: on a
   Chromebook it is the ONLY thing that saves the file. */
.submit-save__download,
.submit-save__done {
  display: inline-block;
  padding: 0.6rem 1.4rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

.submit-save__download {
  background: var(--color-accent);
  border-color: transparent;
  color: var(--color-surface);
}

.submit-save__download:hover,
.submit-save__download:focus-visible {
  filter: brightness(1.08);
}

.submit-save__done {
  background: transparent;
  color: inherit;
}

.submit-save__done:hover,
.submit-save__done:focus-visible {
  background: var(--color-accent-soft);
}

.submit-save__hint {
  margin: 0;
  font-size: 0.85rem;
  color: var(--color-ink-muted);
  word-break: break-all;
}
