/* The entry wizard.
   Scoped to .traver-wizard throughout, because this drops into a theme we do
   not control and must not touch anything around it. Fonts are inherited
   from the theme so the form reads as part of the site; the one colour that
   is ours is --traver-accent, taken from the Foundation's own crimson, and
   changing the site's palette means changing that line alone.

   The audience skews older and less computer-literate: big targets, one
   question at a time, nothing hidden behind a hover. */

.traver-wizard {
  --traver-accent:  #cd2653;
  --traver-ink:     #22262a;
  --traver-soft:    #5d666e;
  --traver-line:    #d6d9dd;
  --traver-ok:      #2f6b45;
  --traver-warn:    #a9741a;
  --traver-stop:    #a32020;
  --traver-paper:   #fff;

  max-width: 780px;
  margin: 0 auto;
  padding: 8px 0 48px;
  color: var(--traver-ink);
  font-size: 17px;
  line-height: 1.6;
  box-sizing: border-box;
}
.traver-wizard *, .traver-wizard *::before, .traver-wizard *::after { box-sizing: inherit; }

.traver-lede { color: var(--traver-soft); margin: 0 0 24px; }
.traver-muted { color: var(--traver-soft); font-size: 15.5px; }
.traver-opt { font-weight: 400; color: var(--traver-soft); }

/* ---- the step bar ------------------------------------------------------ */
.traver-steps {
  display: flex; flex-wrap: wrap; gap: 8px;
  list-style: none; margin: 0 0 30px; padding: 0; counter-reset: traver-step;
}
.traver-steps li {
  flex: 1 1 130px; margin: 0; padding: 10px 12px; text-align: center;
  border: 1px solid var(--traver-line); border-radius: 5px;
  background: var(--traver-paper); color: var(--traver-soft);
  font-size: 14.5px; font-weight: 600; counter-increment: traver-step;
}
.traver-steps li::before { content: counter(traver-step) ". "; }
.traver-steps li.is-active {
  background: var(--traver-accent); border-color: var(--traver-accent); color: #fff;
}
.traver-steps li.is-done {
  background: var(--traver-ok); border-color: var(--traver-ok); color: #fff;
}

/* ---- panels and fields ------------------------------------------------- */
.traver-panel { display: none; }
.traver-panel.is-active { display: block; }

.traver-field { margin: 0 0 20px; }
.traver-field label { display: block; font-weight: 600; font-size: 16.5px; margin-bottom: 6px; }
.traver-hint { display: block; color: var(--traver-soft); font-size: 15px; margin-bottom: 8px; }
.traver-field input {
  width: 100%; padding: 13px 14px; font: inherit; font-size: 17px;
  border: 2px solid var(--traver-line); border-radius: 5px;
  background: var(--traver-paper); color: var(--traver-ink);
}
.traver-field input:focus, .traver-editor:focus {
  outline: 2px solid var(--traver-accent); outline-offset: 1px;
  border-color: var(--traver-accent);
}
.traver-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }

/* Hidden from people, irresistible to bots. Not display:none, which some
   bots check for, and not visibility either -- just out of the way. */
.traver-trap { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---- the editor -------------------------------------------------------- */
.traver-toolbar { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.traver-toolbar button {
  font: inherit; font-size: 15px; font-weight: 700; padding: 8px 14px;
  border: 1px solid var(--traver-line); border-radius: 4px;
  background: var(--traver-paper); color: var(--traver-ink); cursor: pointer;
}
.traver-toolbar button:hover { border-color: var(--traver-accent); }
.traver-toolbar .traver-sep { width: 1px; background: var(--traver-line); margin: 0 4px; }

/* A pressed button has to look pressed, or the entrant cannot tell whether
   what they are about to type will be italic. */
.traver-toolbar button.is-on {
  background: var(--traver-ink); border-color: var(--traver-ink); color: #fff;
  box-shadow: inset 0 1px 2px rgb(0 0 0 / .35);
}
.traver-toolbar button.is-on:hover { border-color: var(--traver-ink); }

.traver-editor {
  min-height: 340px; max-height: 60vh; overflow-y: auto;
  padding: 18px 20px; border: 2px solid var(--traver-line); border-radius: 5px;
  background: var(--traver-paper);
  font-family: Georgia, "Times New Roman", serif; font-size: 17px; line-height: 1.7;

  /* Stated outright, never inherited. The live theme sets font-weight 300 on
     the body and leaves <b> computing to 400 -- which is not bold by any
     browser's reckoning. Chrome's queryCommandState therefore reported bold
     text as unbolded, so the button never lit and clicking it again refused
     to switch bold off; 300 against 400 is also near enough invisible, which
     is what made it look like a glitch rather than a dead button. The
     entrant's emphasis has to survive whatever theme this page lands in. */
  font-weight: 400;
  font-style: normal;
  letter-spacing: normal;
  text-transform: none;
}
.traver-editor b, .traver-editor strong { font-weight: 700; }
.traver-editor i, .traver-editor em     { font-style: italic; font-weight: inherit; }
/* One hairline, whatever the weight -- the PDF draws 0.588pt at 12pt for
   every face, so the screen says the same. Left to itself the browser takes
   the thickness from the font, and bold faces declare a much heavier one. */
.traver-editor u, .traver-editor ins {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.14em;
}
/* The box is never truly empty now -- it holds a paragraph waiting to be
   typed into -- so the prompt hangs off a class rather than :empty. */
.traver-editor { position: relative; }
.traver-editor.is-empty::before {
  content: attr(data-placeholder); color: #98a0a8;
  position: absolute; left: 20px; top: 18px; pointer-events: none;
}

/* A paragraph gap of one whole line, because that is exactly what the PDF
   puts between paragraphs. Shift+Enter gives a <br> and no gap, likewise.
   The editor is only worth having if it shows what the judges will get. */
.traver-editor p { margin: 0 0 1.7em; }
.traver-editor p:last-child { margin-bottom: 0; }

/* Margin to margin, exactly as the PDF draws it across the text column.
   The element is given real height so there is something to aim at -- a
   one-pixel rule is an unkind target for anyone, and this form is built for
   people in their seventies -- while the hairline itself is drawn down the
   middle of it. */
.traver-editor hr {
  position: relative;
  width: 100%; height: 14px; margin: 1.2em 0;
  border: 0; background: none; cursor: pointer;
}
.traver-editor hr::before {
  content: ""; position: absolute; left: 0; right: 0; top: 50%;
  border-top: 1px solid var(--traver-ink);
}
.traver-editor hr:hover { background: #f1f3f5; border-radius: 3px; }
.traver-editor hr:hover::before { border-top-color: var(--traver-accent); }

/* Picked out by a click, and one Delete away from gone. */
.traver-editor hr.is-picked {
  background: #fdeef2; border-radius: 3px;
  outline: 2px solid var(--traver-accent); outline-offset: 2px;
}
.traver-editor hr.is-picked::before { border-top-color: var(--traver-accent); }

.traver-keys { margin: 10px 0 0; color: var(--traver-soft); font-size: 15px; }
.traver-keys kbd {
  font: inherit; font-size: 13.5px; font-weight: 600; padding: 1px 6px;
  border: 1px solid var(--traver-line); border-bottom-width: 2px; border-radius: 4px;
  background: #f6f7f8; color: var(--traver-ink); white-space: nowrap;
}

.traver-counter {
  display: flex; justify-content: space-between; gap: 12px;
  margin: 8px 0 0; color: var(--traver-soft); font-size: 15.5px;
}
.traver-counter.is-over { color: var(--traver-stop); font-weight: 700; }
.traver-saved { margin: 6px 0 0; color: var(--traver-soft); font-size: 14.5px; }

/* Offering the unfinished draft back, in the page rather than in a browser
   dialog -- those only ever offer OK and Cancel, and "Cancel" is no answer
   to "shall we put your writing back?". */
.traver-restore .traver-notice { margin-top: 0; }
.traver-restore-buttons { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.traver-restore-buttons .traver-btn { font-size: 16px; padding: 10px 18px; }

/* ---- choices and the dropzone ----------------------------------------- */
.traver-choice { display: grid; gap: 12px; margin-bottom: 20px; }
.traver-choice label {
  display: flex; gap: 12px; align-items: flex-start; padding: 16px 18px;
  border: 2px solid var(--traver-line); border-radius: 5px;
  background: var(--traver-paper); cursor: pointer;
}
.traver-choice label:has(input:checked) { border-color: var(--traver-accent); background: #fdf7f8; }
.traver-choice input { width: 20px; height: 20px; margin: 3px 0 0; flex: none; }
.traver-choice .t { display: block; font-weight: 700; font-size: 17px; }
.traver-choice .d { display: block; color: var(--traver-soft); font-size: 15px; margin-top: 2px; }

.traver-drop {
  padding: 28px 20px; text-align: center; border-radius: 5px;
  border: 2px dashed var(--traver-line); background: var(--traver-paper);
}
.traver-drop.has-file { border-style: solid; border-color: var(--traver-ok); background: #f3f8f4; }
.traver-drop.is-dragging {
  border-color: var(--traver-accent); background: #fdf7f8;
}
.traver-drop p { margin: 0 0 12px; }
.traver-drop p:last-child { margin: 12px 0 0; }
.traver-dropline { font-size: 18px; }
.traver-filename:empty { display: none; }
.traver-filename { color: var(--traver-ok); font-weight: 600; font-size: 15.5px; }

/* Everything inside the box is a drop target too, or dropping onto the
   wording in the middle of it would miss. */
.traver-drop * { pointer-events: none; }
.traver-drop button { pointer-events: auto; }

/* ---- notices ----------------------------------------------------------- */
.traver-notice {
  margin: 18px 0; padding: 16px 18px; border-radius: 5px;
  border-left: 5px solid; font-size: 16px;
}
.traver-notice b { display: block; margin-bottom: 4px; }
.traver-good { background: #eef5ef; border-color: var(--traver-ok); }
.traver-warn { background: #fdf6ec; border-color: var(--traver-warn); }
.traver-stop { background: #fbeeea; border-color: var(--traver-stop); }
.traver-notice label { display: block; margin-top: 10px; font-weight: 600; }
.traver-notice input[type=checkbox] { width: 18px; height: 18px; margin-right: 6px; }

/* The one tick that unlocks the button below it, so it is worth the room. */
.traver-notice label.traver-ack {
  display: flex; gap: 12px; align-items: flex-start; margin-top: 14px;
  padding: 12px 14px; border-radius: 5px; background: #fff;
  border: 2px solid var(--traver-stop); cursor: pointer;
}
.traver-notice .traver-ack input[type=checkbox] {
  width: 22px; height: 22px; margin: 2px 0 0; flex: none;
}

/* ---- preview, summary, buttons ---------------------------------------- */
.traver-preview {
  width: 100%; height: 620px; border: 2px solid var(--traver-line);
  border-radius: 5px; background: var(--traver-paper);
}

.traver-summary {
  display: grid; grid-template-columns: auto 1fr; gap: 8px 18px;
  margin: 0 0 22px; padding: 20px 22px;
  border: 1px solid var(--traver-line); border-radius: 5px; background: var(--traver-paper);
}
.traver-summary dt { color: var(--traver-soft); font-size: 15.5px; }
.traver-summary dd { margin: 0; font-weight: 600; font-size: 16px; }

.traver-nav { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 26px; }
.traver-nav .traver-spacer { flex: 1; }

.traver-btn {
  font: inherit; font-size: 17px; font-weight: 600; padding: 13px 24px;
  border: 2px solid var(--traver-line); border-radius: 5px;
  background: var(--traver-paper); color: var(--traver-ink); cursor: pointer;
}
.traver-btn:hover { border-color: var(--traver-accent); }
.traver-primary {
  background: var(--traver-accent); border-color: var(--traver-accent); color: #fff;
}
.traver-primary:hover { filter: brightness(.92); }
.traver-btn.is-busy { opacity: .55; pointer-events: none; }
.traver-big { font-size: 19px; padding: 16px 30px; }
.traver-pay-note { margin: 10px 0 0; font-size: 15.5px; color: var(--traver-soft); font-weight: 400; }
.traver-notice p { margin: 12px 0 0; }

/* Greyed out and unclickable, with the reason in the tooltip and, more to
   the point, written out immediately above it. */
.traver-btn[disabled] {
  background: #eceef0; border-color: var(--traver-line); color: #8d959c;
  cursor: not-allowed; filter: none;
}
.traver-btn[disabled]:hover { border-color: var(--traver-line); }

@media (max-width: 640px) {
  .traver-row2 { grid-template-columns: 1fr; }
  .traver-preview { height: 460px; }
}
