/* ==========================================================================
   CAREERS APPLICATION FORM — CV attachments (drag & drop), upload progress and
   the "sent" state. Driven by js/apply-form.js; loaded only on careers/.
   ========================================================================== */
.form-field .field-label { font-size: 0.8rem; font-weight: 600; color: var(--rg-grey-100); letter-spacing: 0.02em; }
.form-field .field-label em { font-style: normal; font-weight: 500; color: var(--rg-text-faint); }

/* ---- Drop zone ---- */
.dropzone {
  position: relative; border: 1.5px dashed var(--rg-border-strong); border-radius: var(--radius-md);
  background: var(--rg-charcoal-2);
  transition: border-color 0.25s var(--ease-out), background 0.25s var(--ease-out), box-shadow 0.25s var(--ease-out), transform 0.3s var(--ease-out);
}
.dropzone:hover, .dropzone:focus-within { border-color: var(--rg-cyan); background: var(--rg-charcoal-3); }
.dropzone:focus-within { box-shadow: 0 0 0 3px rgb(0 174 239 / 0.22); }
/* The real <input type=file> stays in the page (keyboard + screen-reader friendly) but out of sight. */
.form-field .dropzone-input {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; border: 0; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); opacity: 0; background: none;
}
.form-field .dropzone-body {
  display: flex; align-items: center; gap: 1rem; padding: 1.15rem 1.2rem; cursor: pointer;
  font-size: 0.95rem; font-weight: 400; letter-spacing: 0; color: var(--rg-text-dim);
}
.dropzone-icon {
  position: relative; flex: none; width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center;
  font-size: 1.35rem; color: var(--rg-cyan-light);
  background: radial-gradient(circle at 30% 25%, rgb(0 174 239 / 0.28), rgb(46 49 146 / 0.14));
  border: 1px solid rgb(0 174 239 / 0.35);
}
.dropzone-icon i { transition: transform 0.35s var(--ease-out); }
.dropzone:hover .dropzone-icon i, .dropzone:focus-within .dropzone-icon i { transform: translateY(-3px); }
.dropzone-text { display: block; min-width: 0; }
.dropzone-title { display: block; font-size: 0.95rem; line-height: 1.45; color: var(--rg-white); }
.dropzone-title strong { font-weight: 700; }
.dropzone-title u { text-decoration-color: rgb(0 174 239 / 0.6); text-underline-offset: 3px; color: var(--rg-cyan-light); }
.dropzone-hint { display: block; margin-top: 0.25rem; font-size: 0.78rem; line-height: 1.5; color: var(--rg-text-faint); }
.dropzone.is-dragover {
  border-style: solid; border-color: var(--rg-cyan); background: rgb(0 174 239 / 0.09);
  box-shadow: 0 0 0 5px rgb(0 174 239 / 0.14), 0 18px 44px -20px rgb(0 174 239 / 0.7); transform: scale(1.012);
}
.dropzone.is-dragover .dropzone-icon i { animation: applyBounce 0.6s var(--ease-out) infinite alternate; }
@keyframes applyBounce { to { transform: translateY(-7px); } }

/* ---- Attached files ---- */
.file-list { display: grid; gap: 0.6rem; margin-top: 0.8rem; }
.file-list:empty { display: none; }
.file-item {
  --tone: 0 174 239;
  display: flex; align-items: center; gap: 0.85rem; padding: 0.65rem 0.75rem 0.65rem 0.65rem; min-width: 0;
  background: var(--rg-charcoal-2); border: 1px solid var(--rg-border); border-radius: var(--radius-sm);
  animation: applyIn 0.42s var(--ease-out) both;
}
.file-item.is-leaving { animation: applyOut 0.22s ease forwards; }
.file-ico {
  flex: none; width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; font-size: 1.15rem;
  color: rgb(var(--tone)); background: rgb(var(--tone) / 0.13); border: 1px solid rgb(var(--tone) / 0.32);
}
.file-meta { min-width: 0; flex: 1; }
.file-name { display: block; font-size: 0.88rem; font-weight: 600; color: var(--rg-white); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-size { display: block; margin-top: 2px; font-size: 0.75rem; color: var(--rg-text-dim); }
.file-remove {
  flex: none; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; cursor: pointer;
  color: var(--rg-text-dim); font-size: 0.85rem; transition: background 0.2s, color 0.2s, transform 0.2s var(--ease-out);
}
.file-remove:hover, .file-remove:focus-visible { background: rgb(255 90 90 / 0.14); color: #ff7b7b; transform: rotate(90deg); outline: none; }
.file-remove:focus-visible { box-shadow: 0 0 0 2px rgb(255 90 90 / 0.5); }
.file-msg { min-height: 1.3em; margin-top: 0.55rem; font-size: 0.82rem; line-height: 1.5; color: var(--rg-text-dim); }
.file-msg.error { color: #ff8a8a; }
.file-msg.ok { color: var(--rg-cyan-light); }
@keyframes applyIn { from { opacity: 0; transform: translateY(10px) scale(0.97); } to { opacity: 1; transform: none; } }
@keyframes applyOut { to { opacity: 0; transform: translateX(16px) scale(0.96); } }

/* ---- Submit button + upload progress ---- */
.btn.is-loading { pointer-events: none; opacity: 0.9; }
.btn.is-loading i { animation: applySpin 0.9s linear infinite; }
@keyframes applySpin { to { rotate: 360deg; } }
.upload-progress { margin-top: 1rem; }
.upload-progress[hidden] { display: none; }
.upload-track { height: 6px; border-radius: 6px; background: var(--rg-border-strong); overflow: hidden; }
.upload-track span {
  display: block; height: 100%; width: 0%; border-radius: 6px;
  background: linear-gradient(90deg, var(--rg-indigo), var(--rg-cyan), var(--rg-indigo)); background-size: 200% 100%;
  animation: applyFlow 1.4s linear infinite; transition: width 0.25s var(--ease-out);
}
@keyframes applyFlow { to { background-position: -200% 0; } }
.upload-label { margin-top: 0.5rem; font-size: 0.8rem; color: var(--rg-text-dim); }
.form-status a { color: inherit; text-decoration: underline; text-underline-offset: 3px; font-weight: 600; }

/* ---- Sent ---- */
.apply-success { grid-column: 1 / -1; text-align: center; padding: 2.2rem 1rem 1.4rem; animation: applyIn 0.6s var(--ease-out) both; outline: none; }
.apply-success h3 { margin-top: 1.1rem; font-size: 1.5rem; }
.apply-success p { max-width: 420px; margin: 0.7rem auto 1.5rem; font-size: 0.95rem; line-height: 1.7; color: var(--rg-text-dim); }
.apply-success p b { color: var(--rg-white); }
.apply-check { width: 76px; height: 76px; }
.apply-check circle { fill: rgb(0 174 239 / 0.1); stroke: var(--rg-cyan); stroke-width: 2; stroke-dasharray: 152; stroke-dashoffset: 152; animation: applyDraw 0.7s var(--ease-out) 0.05s forwards; }
.apply-check path { fill: none; stroke: var(--rg-cyan-light); stroke-width: 3.4; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 44; stroke-dashoffset: 44; animation: applyDraw 0.5s var(--ease-out) 0.55s forwards; }
@keyframes applyDraw { to { stroke-dashoffset: 0; } }
.form-grid.is-done > :not(.apply-success) { display: none; }

/* A honeypot: invisible to people, tempting to bots. */
.hp-field { position: absolute; left: -9999px; top: auto; width: 1px; height: 1px; overflow: hidden; }

/* ---- Light theme: the soft red needs more contrast on white ---- */
:root[data-theme="light"] .file-msg.error, :root[data-theme="light"] .form-status.error { color: #c62828; }
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) .file-msg.error, :root:not([data-theme="dark"]) .form-status.error { color: #c62828; } }

@media (max-width: 560px) {
  .form-field .dropzone-body { flex-direction: column; text-align: center; padding: 1.3rem 1rem; }
}
@media (prefers-reduced-motion: reduce) {
  .file-item, .apply-success, .upload-track span, .btn.is-loading i, .dropzone.is-dragover .dropzone-icon i { animation: none; }
  .apply-check circle, .apply-check path { animation: none; stroke-dashoffset: 0; }
  .dropzone, .dropzone-icon i { transition: none; }
}
