/* Tilbury Ventures secure upload portal
   Light palette on :root, dark redefined under prefers-color-scheme. */

:root {
  --brand: #1a3d5c;
  --brand-strong: #12293e;
  --brand-tint: #eaf1f7;
  --bg: #f4f5f7;
  --surface: #ffffff;
  --text: #1c2024;
  --text-muted: #5c6570;
  --border: #d8dde3;
  --border-strong: #b9c2cc;
  --danger: #b3261e;
  --danger-bg: #fdeceb;
  --warn-bg: #fff8e6;
  --warn-border: #e8c76a;
  --success: #1a7f47;
  --success-bg: #e8f5ee;
  --focus: #2f6fb0;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 8px 24px rgba(16, 24, 40, .06);
}

@media (prefers-color-scheme: dark) {
  :root {
    --brand: #4a90c4;
    --brand-strong: #6aa8d6;
    --brand-tint: #16232f;
    --bg: #14181d;
    --surface: #1b2027;
    --text: #e6e9ed;
    --text-muted: #98a2ae;
    --border: #2e3640;
    --border-strong: #414b57;
    --danger: #f2857c;
    --danger-bg: #34201f;
    --warn-bg: #2b2413;
    --warn-border: #6b5a25;
    --success: #5fc98d;
    --success-bg: #14291d;
    --focus: #6aa8d6;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .35);
  }
}

* { box-sizing: border-box; }

/* The `hidden` attribute only works through the user-agent stylesheet's
   `display: none`, so ANY author rule that sets `display` silently defeats it.
   That is how the retry button stayed visible during a successful upload:
   `.btn` sets `display: inline-flex`. Enforce it globally instead of patching
   each component. */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--surface); color: var(--text);
  padding: 10px 16px; z-index: 100; border-radius: 0 0 var(--radius) 0;
}
.skip-link:focus { left: 0; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- masthead ---------- */

.masthead {
  background: var(--brand);
  padding: 14px 20px;
}
@media (prefers-color-scheme: dark) {
  .masthead { background: #101923; border-bottom: 1px solid var(--border); }
}

.masthead-inner {
  max-width: 620px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}

.brand { color: #fff; font-size: 16px; font-weight: 600; letter-spacing: .2px; }

.secure-badge {
  display: inline-flex; align-items: center; gap: 6px;
  color: rgba(255, 255, 255, .88); font-size: 12.5px; white-space: nowrap;
}

.icon-sm { width: 14px; height: 14px; fill: currentColor; flex-shrink: 0; }
.icon-lg { width: 26px; height: 26px; fill: var(--text-muted); }

/* ---------- layout ---------- */

main { max-width: 620px; margin: 0 auto; padding: 28px 20px 48px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
}

@media (max-width: 560px) { .card { padding: 20px; } }

h1 { margin: 0 0 8px; font-size: 21px; line-height: 1.3; letter-spacing: -.2px; }
.lede { margin: 0 0 20px; color: var(--text-muted); font-size: 14.5px; }

/* ---------- step indicator ---------- */

.steps {
  list-style: none; display: flex; gap: 8px;
  margin: 0 0 18px; padding: 0;
}
.step {
  flex: 1; display: flex; align-items: center; gap: 8px;
  font-size: 12.5px; color: var(--text-muted);
  padding-top: 10px; border-top: 3px solid var(--border);
  transition: color .2s, border-color .2s;
}
.step-dot {
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--border); color: var(--surface);
  display: grid; place-items: center;
  font-size: 11px; font-weight: 700; flex-shrink: 0;
  transition: background .2s;
}
.step.is-current { color: var(--text); border-top-color: var(--brand); font-weight: 600; }
.step.is-current .step-dot { background: var(--brand); }
.step.is-done { border-top-color: var(--success); }
.step.is-done .step-dot { background: var(--success); }
@media (max-width: 480px) { .step-label { display: none; } }

/* ---------- panels ---------- */

.panel[hidden] { display: none; }
.panel-done { text-align: center; }
.panel-done .notice { text-align: left; margin-top: 22px; }

/* ---------- notices ---------- */

.notice {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 14px; border-radius: 8px;
  font-size: 13.5px; line-height: 1.5; margin: 0 0 22px;
}
.notice-warn { background: var(--warn-bg); border: 1px solid var(--warn-border); }
.notice-info { background: var(--bg); border: 1px solid var(--border); color: var(--text-muted); }
.notice .icon-sm { margin-top: 2px; }

/* ---------- form ---------- */

.field-row { display: flex; gap: 14px; }
@media (max-width: 560px) { .field-row { flex-direction: column; gap: 0; } }

.field { flex: 1; margin-bottom: 16px; }

label, .label-text {
  display: block; margin-bottom: 5px;
  font-size: 13px; font-weight: 600; color: var(--text);
}
.optional { font-weight: 400; color: var(--text-muted); font-size: 12px; }

input[type="text"], input[type="email"], select, textarea {
  width: 100%; padding: 9px 11px;
  border: 1px solid var(--border-strong); border-radius: 7px;
  background: var(--surface); color: var(--text);
  font: inherit; font-size: 14.5px;
  transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; min-height: 60px; }

input:focus-visible, select:focus-visible, textarea:focus-visible,
.dropzone:focus-visible, .btn:focus-visible, .file-remove:focus-visible {
  outline: 2px solid var(--focus); outline-offset: 2px;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-tint); outline: none;
}
.field.has-error input, .field.has-error select, .field.has-error textarea {
  border-color: var(--danger);
}

.field-hint { margin: 5px 0 0; font-size: 12.5px; color: var(--text-muted); }
.field-error, .form-error {
  margin: 5px 0 0; font-size: 13px; color: var(--danger); min-height: 0;
}
.field-error:empty, .form-error:empty { display: none; }
.form-error {
  margin: 0 0 14px; padding: 10px 12px;
  background: var(--danger-bg); border-radius: 7px; border: 1px solid var(--danger);
}

.code-input {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 26px; letter-spacing: 9px; text-align: center; padding: 12px;
}

/* ---------- dropzone ---------- */

.dropzone {
  border: 2px dashed var(--border-strong); border-radius: var(--radius);
  padding: 26px 18px; text-align: center; cursor: pointer;
  background: var(--bg); transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.is-dragover {
  border-color: var(--brand); background: var(--brand-tint);
}
.dropzone.is-dragover .icon-lg { fill: var(--brand); }
.dropzone-title { margin: 8px 0 3px; font-size: 14px; font-weight: 500; }
.dropzone-hint { margin: 0; font-size: 12.5px; color: var(--text-muted); }
.link-look { color: var(--brand); text-decoration: underline; }

/* ---------- file list ---------- */

.file-list { list-style: none; margin: 12px 0 0; padding: 0; }
.file-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px; margin-bottom: 6px;
  background: var(--bg); border: 1px solid var(--border); border-radius: 7px;
  font-size: 13.5px;
}
.file-name {
  flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.file-size { color: var(--text-muted); font-size: 12.5px; white-space: nowrap; }
.file-remove {
  background: none; border: none; cursor: pointer; padding: 3px;
  color: var(--text-muted); font-size: 17px; line-height: 1; border-radius: 4px;
}
.file-remove:hover { color: var(--danger); }

.file-item.is-invalid { border-color: var(--danger); background: var(--danger-bg); }
.file-item.is-done { border-color: var(--success); background: var(--success-bg); }
.file-item.is-failed { border-color: var(--danger); background: var(--danger-bg); }
.file-status { font-size: 12.5px; color: var(--text-muted); white-space: nowrap; }
.file-item.is-done .file-status { color: var(--success); font-weight: 600; }
.file-item.is-failed .file-status { color: var(--danger); font-weight: 600; }

/* Failure reason sits on its own line under the file name. */
.file-item { flex-wrap: wrap; }
.file-reason {
  flex-basis: 100%;
  margin-top: 5px;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--danger);
}

.progress-track {
  width: 62px; height: 5px; border-radius: 3px;
  background: var(--border); overflow: hidden; flex-shrink: 0;
}
.progress-fill {
  height: 100%; width: 0; background: var(--brand);
  transition: width .25s ease;
}
.file-item.is-done .progress-fill { background: var(--success); }

/* ---------- buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 11px 18px; margin-top: 6px;
  border-radius: 8px; border: 1px solid transparent;
  font: inherit; font-size: 15px; font-weight: 600; cursor: pointer;
  transition: background .15s, opacity .15s;
}
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--brand-strong); }
@media (prefers-color-scheme: dark) { .btn-primary { color: #0f1720; } }

.btn-quiet {
  background: none; color: var(--text-muted);
  border-color: transparent; font-weight: 500; font-size: 14px;
}
.btn-quiet:hover { color: var(--text); text-decoration: underline; }

.btn:disabled { opacity: .6; cursor: not-allowed; }

.spinner { display: none; width: 15px; height: 15px; flex-shrink: 0; }
.btn.is-busy .spinner {
  display: block;
  border: 2px solid rgba(255, 255, 255, .35);
  border-top-color: #fff; border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .btn.is-busy .spinner { animation-duration: 2s; }
  .progress-fill { transition: none; }
}

/* ---------- done panel ---------- */

.success-mark {
  width: 52px; height: 52px; margin: 0 auto 16px;
  border-radius: 50%; background: var(--success-bg);
  display: grid; place-items: center;
}
.success-mark svg { width: 30px; height: 30px; fill: var(--success); }

.reference-box {
  display: inline-flex; flex-direction: column; gap: 3px;
  padding: 13px 26px; margin: 6px 0 18px;
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
}
.reference-label {
  font-size: 11.5px; text-transform: uppercase; letter-spacing: .6px;
  color: var(--text-muted);
}
.reference-value {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 19px; font-weight: 700; letter-spacing: 1.5px; color: var(--brand);
}

.fine-print { font-size: 13px; color: var(--text-muted); margin: 0; }

/* ---------- footer ---------- */

.footer {
  margin-top: 20px; text-align: center;
  font-size: 12.5px; color: var(--text-muted);
}
.footer p { margin: 0; }
