/* Transcript Forge. No framework, no build step.
   Readable on a phone first, then given room on a wider screen. */

:root {
  --bg: #fbfaf8;
  --surface: #ffffff;
  --ink: #1c1a17;
  --ink-soft: #5f5a52;
  --line: #e3ded6;
  --accent: #7a4f1d;
  --ok: #2f6f43;
  --bad: #a33224;
  --radius: 10px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16150f;
    --surface: #1f1e18;
    --ink: #ece7dd;
    --ink-soft: #a49d90;
    --line: #33312a;
    --accent: #d9a25f;
    --ok: #6fbf87;
    --bad: #e08374;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        "Helvetica Neue", Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}

.wrap {
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
  padding: 0 20px;
}

/* --- header / footer ------------------------------------------------ */

.site-header {
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 60px;
}
.brand {
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.01em;
}
nav a {
  color: var(--ink-soft);
  text-decoration: none;
  margin-left: 18px;
  font-size: 0.94rem;
}
nav a:hover { color: var(--accent); }

.site-footer {
  margin-top: 56px;
  padding: 20px 0 36px;
  border-top: 1px solid var(--line);
  font-size: 0.86rem;
  color: var(--ink-soft);
}
.site-footer .wrap {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

/* --- content -------------------------------------------------------- */

main { padding-top: 36px; }

h1 {
  font-size: 1.7rem;
  line-height: 1.25;
  margin: 0 0 12px;
  letter-spacing: -0.02em;
}
h2 {
  font-size: 1.05rem;
  margin: 0 0 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.lede {
  color: var(--ink-soft);
  max-width: 60ch;
  margin: 0 0 32px;
}
.muted { color: var(--ink-soft); }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}
.card p:last-child { margin-bottom: 0; }

/* --- status --------------------------------------------------------- */

.pill {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 3px 9px;
  border-radius: 999px;
}
.pill-ok  { background: color-mix(in srgb, var(--ok) 16%, transparent);  color: var(--ok); }
.pill-bad { background: color-mix(in srgb, var(--bad) 16%, transparent); color: var(--bad); }

.checks { width: 100%; border-collapse: collapse; }
.checks td {
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.checks tr:last-child td { border-bottom: 0; }
.check-name   { font-weight: 500; width: 8.5rem; }
.check-mark   { width: 2rem; text-align: center; }
.check-detail { font-size: 0.9rem; word-break: break-word; }

/* Colour the tick by what it means. The previous rule painted every mark
   green, so a failed check showed a green cross. */
.check-mark.mark-ok  { color: var(--ok); }
.check-mark.mark-bad { color: var(--bad); }

.warnings {
  margin: 14px 0 0;
  padding: 12px 12px 12px 30px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--bad) 10%, transparent);
  color: var(--bad);
  font-size: 0.9rem;
}

/* On a narrow screen the table stops behaving like a table: each check
   becomes a block with its name and tick on one line and the detail
   beneath. These selectors are qualified with .checks so they outrank
   `.checks td { display: block }` -- unqualified they lose on specificity
   and every cell stacks onto its own line. */
@media (max-width: 540px) {
  .checks tr { display: block; padding: 10px 0; border-bottom: 1px solid var(--line); }
  .checks tr:last-child { border-bottom: 0; }
  .checks td { display: block; border: 0; padding: 0; }
  .checks td.check-name,
  .checks td.check-mark  { display: inline-block; width: auto; text-align: left; }
  .checks td.check-mark  { margin-left: 8px; }
  .checks td.check-detail { margin-top: 2px; }
}

/* ====================================================================
   Phase 2: accounts, jobs, upload
   ==================================================================== */

.narrow { max-width: 34rem; }

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
.page-head h1 { margin: 0; }

.filename { word-break: break-word; font-size: 1.35rem; }

nav a.here { color: var(--accent); font-weight: 500; }

.inline-form { display: inline; margin: 0; }
.linkish {
  background: none;
  border: 0;
  padding: 0;
  margin-left: 18px;
  font: inherit;
  font-size: 0.94rem;
  color: var(--ink-soft);
  cursor: pointer;
}
.linkish:hover { color: var(--accent); }

/* --- buttons and forms ---------------------------------------------- */

.btn {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: 8px;
  padding: 10px 18px;
  font: inherit;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: opacity .12s ease;
}
.btn:hover { opacity: .88; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

@media (prefers-color-scheme: dark) {
  .btn { color: #1a1710; }
}

.stack { display: flex; flex-direction: column; gap: 16px; margin-top: 20px; }
.stack label { display: flex; flex-direction: column; gap: 6px; }
.stack label > span { font-weight: 500; font-size: 0.94rem; }

input[type="email"],
input[type="password"],
input[type="text"],
select {
  width: 100%;
  padding: 10px 12px;
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}
input:focus, select:focus, .dropzone:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.field-row { display: flex; gap: 18px; flex-wrap: wrap; }
.field-row > label { flex: 1 1 14rem; display: flex; flex-direction: column; gap: 6px; }

.check {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-top: 14px;
  flex-wrap: wrap;
}
.check input { margin-top: 3px; }
.check > span { font-weight: 500; font-size: 0.94rem; }
.block { display: block; width: 100%; }

/* --- alerts ---------------------------------------------------------- */

.alert {
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 0.93rem;
  margin: 0 0 20px;
}
.alert-bad {
  background: color-mix(in srgb, var(--bad) 12%, transparent);
  color: var(--bad);
}
.alert-info {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent);
}
.alert a { color: inherit; }

.small { font-size: 0.9rem; }
.tiny  { font-size: 0.82rem; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }

/* --- jobs table ------------------------------------------------------ */

.jobs { width: 100%; border-collapse: collapse; margin-bottom: 14px; }
.jobs th {
  text-align: left;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ink-soft);
  font-weight: 600;
  padding: 0 10px 8px 0;
  border-bottom: 1px solid var(--line);
}
.jobs td {
  padding: 12px 10px 12px 0;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.jobs tr:last-child td { border-bottom: 0; }
.job-name { color: var(--ink); text-decoration: none; font-weight: 500; word-break: break-word; }
.job-name:hover { color: var(--accent); }

.status {
  display: inline-block;
  font-size: 0.74rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
}
.status.big { font-size: 0.8rem; padding: 5px 12px; }
.status-queued    { background: color-mix(in srgb, var(--ink-soft) 16%, transparent); color: var(--ink-soft); }
.status-running   { background: color-mix(in srgb, var(--accent) 18%, transparent);   color: var(--accent); }
.status-complete  { background: color-mix(in srgb, var(--ok) 16%, transparent);       color: var(--ok); }
.status-failed    { background: color-mix(in srgb, var(--bad) 16%, transparent);      color: var(--bad); }
.status-cancelled { background: color-mix(in srgb, var(--ink-soft) 12%, transparent); color: var(--ink-soft); }

.empty { text-align: center; padding: 34px 20px; }
.empty h2 { justify-content: center; }
.empty p { margin-left: auto; margin-right: auto; max-width: 34ch; }

/* --- definition lists ------------------------------------------------ */

.facts { margin: 0; }
.facts > div {
  display: flex;
  gap: 14px;
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.facts > div:last-child { border-bottom: 0; }
.facts dt { color: var(--ink-soft); min-width: 9.5rem; font-size: 0.92rem; }
.facts dd { margin: 0; font-size: 0.94rem; word-break: break-word; }

.fingerprint { margin-top: 16px; line-height: 1.5; }
.fingerprint code {
  font-size: 0.78rem;
  word-break: break-all;
  background: color-mix(in srgb, var(--ink) 6%, transparent);
  padding: 2px 5px;
  border-radius: 4px;
}

.yes { color: var(--ok); font-weight: 500; }
.no  { color: var(--ink-soft); }

/* --- pipeline stages ------------------------------------------------- */

.stages { list-style: none; margin: 16px 0 0; padding: 0; }
.stage {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.stage:last-child { border-bottom: 0; }
.stage-mark {
  width: 9px; height: 9px;
  border-radius: 50%;
  flex: none;
  background: var(--line);
  border: 1px solid var(--ink-soft);
}
.stage-name { font-weight: 500; min-width: 6.5rem; font-size: 0.94rem; }
.stage-detail { flex: 1 1 100%; padding-left: 19px; }

.stage-done    .stage-mark { background: var(--ok);     border-color: var(--ok); }
.stage-running .stage-mark { background: var(--accent); border-color: var(--accent); }
.stage-failed  .stage-mark { background: var(--bad);    border-color: var(--bad); }
.stage-pending .stage-name { color: var(--ink-soft); font-weight: 400; }
.stage-skipped .stage-name { color: var(--ink-soft); text-decoration: line-through; }

.pending { opacity: .72; }

.steps { padding-left: 1.2rem; margin: 0 0 4px; }
.steps li { margin-bottom: 7px; }

/* --- upload dropzone ------------------------------------------------- */

.dropzone {
  display: block;
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  margin-bottom: 20px;
  transition: border-color .12s ease, background .12s ease;
}
.dropzone:hover { border-color: var(--accent); }
.dropzone.dragging {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
}
.dropzone.too-big { border-color: var(--bad); }
.dropzone.too-big .muted { color: var(--bad); }

.dropzone-inner { display: flex; flex-direction: column; gap: 6px; align-items: center; }
.dropzone-inner strong { font-size: 1.02rem; word-break: break-word; max-width: 100%; }

/* --- narrow screens -------------------------------------------------- */

@media (max-width: 560px) {
  .site-header .wrap { flex-wrap: wrap; padding-top: 10px; padding-bottom: 10px; }
  nav a, .linkish { margin-left: 0; margin-right: 16px; }
  .page-head { align-items: flex-start; }

  .jobs thead { display: none; }
  .jobs, .jobs tbody, .jobs tr, .jobs td { display: block; width: 100%; }
  .jobs tr { padding: 12px 0; border-bottom: 1px solid var(--line); }
  .jobs td { border: 0; padding: 2px 0; }
  .jobs td.right { text-align: left; }

  .facts > div { flex-direction: column; gap: 2px; }
  .facts dt { min-width: 0; }
}

/* --- show / hide password -------------------------------------------- */

.password-field { position: relative; display: block; width: 100%; }

/* Room for the button, so the password does not run underneath it. */
.password-field input { padding-right: 46px; }

/* Edge and IE add their own reveal control. Two eyes in one field is
   confusing, and theirs cannot be styled, so hide it and keep ours. */
.password-field input::-ms-reveal,
.password-field input::-ms-clear { display: none; }

.password-toggle {
  position: absolute;
  top: 50%;
  right: 5px;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: none;
  color: var(--ink-soft);
  cursor: pointer;
  transition: color .12s ease, background .12s ease;
}
.password-toggle:hover {
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}
.password-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.password-toggle svg { width: 19px; height: 19px; display: block; }

/* Pressed state reads as "currently revealed", which is worth showing:
   it is the state where somebody behind you can read the password. */
.password-toggle[aria-pressed="true"] { color: var(--accent); }

/* ====================================================================
   Phase 3: progress, transcript, downloads
   ==================================================================== */

.progress-track {
  height: 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--ink) 9%, transparent);
  overflow: hidden;
  margin: 4px 0 10px;
}
.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  transition: width .4s ease;
  min-width: 2px;
}

/* --- the transcript --------------------------------------------------- */

.transcript {
  margin-top: 18px;
  max-height: 34rem;
  overflow-y: auto;
  padding-right: 10px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

/* Verbatim text is full of hesitations and restarts. A slightly looser
   line height and a measure that stops around 70 characters keeps it
   readable rather than dense. */
.transcript .tp {
  margin: 0 0 14px;
  line-height: 1.72;
  max-width: 68ch;
}

.transcript .ts {
  display: inline-block;
  min-width: 3.4rem;
  margin-right: 8px;
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  color: var(--ink-soft);
  user-select: none;
}

/* --- downloads -------------------------------------------------------- */

.downloads { list-style: none; margin: 0; padding: 0; }
.downloads li {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.downloads li:last-child { border-bottom: 0; }
.downloads a { color: var(--accent); text-decoration: none; font-weight: 500; }
.downloads a:hover { text-decoration: underline; }

@media (max-width: 560px) {
  .transcript { max-height: none; }
  .transcript .ts { display: block; margin-bottom: 2px; }
}
