/* =====================================================================
   Registration flow · layout and form states
   Uses the YL27 tokens and component styles (TextField, Button).
   Layout: form on the left, a sticky image panel on the right whose
   image and short instructions change with each step and category.
   ===================================================================== */

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.reg-page .header-inner .yl-link { min-height: var(--control-s); }

/* ---------- Shell: form left, image right ---------- */
.reg-shell {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  min-height: calc(100vh - var(--header-h));
}
.reg-main { order: 1; min-width: 0; }
.reg-visual { order: 2; }
.reg-inner {
  max-width: 760px;
  padding: var(--space-64) var(--margin) var(--space-128);
  padding-left: max(var(--margin), env(safe-area-inset-left, 0px));
  margin-left: auto;
  margin-right: auto;
}
.reg-eyebrow { color: var(--signal-red-600); margin-bottom: var(--space-16); }
.reg-title { margin-bottom: var(--space-24); }
.reg-intro { display: flex; flex-direction: column; gap: var(--space-24); margin-bottom: var(--space-48); }
.reg-intro .body-large { max-width: 56ch; }
.reg-state { display: flex; flex-direction: column; gap: var(--space-24); align-items: flex-start; }
.reg-state .body-large { max-width: 52ch; }

/* ---------- Image panel ---------- */
.reg-visual {
  position: sticky;
  top: calc(var(--header-h) + env(safe-area-inset-top, 0px) + var(--space-16));
  height: calc(100vh - var(--header-h) - 2 * var(--space-16));
  height: calc(100svh - var(--header-h) - env(safe-area-inset-top, 0px) - 2 * var(--space-16));
  margin: var(--space-16) max(var(--space-16), env(safe-area-inset-right, 0px)) var(--space-16) 0;
  border-radius: var(--radius-media);
  isolation: isolate;
  overflow: hidden;
  background: var(--surface-inverse);
  color: var(--text-inverse);
}
.reg-visual-img {
  position: absolute; inset: 0; width: 100%; height: 100%; max-width: none;
  object-fit: cover; object-position: center 30%;
  opacity: 0;
}
.reg-visual-img.is-current { opacity: 1; }
@media (prefers-reduced-motion: no-preference) {
  .reg-visual-img { transition: opacity 320ms cubic-bezier(.16, 1, .3, 1); }
}
/* The brief: a 20% black overlay so the instructions read over the photo. */
.reg-visual-overlay { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.2); }
.reg-visual-text {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: var(--space-48);
  display: flex; flex-direction: column; gap: var(--space-12);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}
.reg-visual-text .eyebrow { color: var(--text-inverse); }
.reg-visual-title {
  font-family: var(--font-display); font-weight: 400; text-transform: uppercase; letter-spacing: -0.07em;
  font-size: var(--fs-h3); line-height: var(--lh-h3);
  max-width: 14ch; text-wrap: balance;
}
.reg-visual-body { font: 400 var(--fs-body)/var(--lh-body) var(--font-sans); max-width: 40ch; }

/* ---------- Stepper ---------- */
/* Honeypot: moved off screen rather than display:none, which many bots skip */
.hp-field { position: absolute; left: -9999px; top: auto; width: 1px; height: 1px; overflow: hidden; }
.stepper { margin-bottom: var(--space-32); }
.stepper-count { color: var(--text-secondary); margin-bottom: var(--space-12); }
.stepper-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--space-8); }
.stepper-item {
  width: 100%; display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-4);
  padding: var(--space-12) 0 0; min-height: var(--control-s);
  background: none; border: 0; border-top: 4px solid var(--border-subtle);
  font-family: var(--font-sans); color: var(--text-secondary); text-align: left; cursor: default;
}
.stepper-num { font-family: var(--font-display); font-size: 20px; line-height: 20px; letter-spacing: -0.04em; }
.stepper-label { font: 400 12px/18px var(--font-sans); letter-spacing: 0.12em; text-transform: uppercase; }
.stepper-item.is-done { border-top-color: var(--charcoal-900); color: var(--text-primary); cursor: pointer; }
.stepper-item.is-done:hover .stepper-label { text-decoration: underline; text-underline-offset: 3px; }
.stepper-item.is-current { border-top-color: var(--accent-signal); color: var(--text-primary); }
.stepper-item.is-current .stepper-label { font-weight: 700; }
.stepper-item:disabled { cursor: default; }
.stepper-item:not(:disabled) { cursor: pointer; }
.stepper-item:not(:disabled):hover .stepper-label { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Error summary ---------- */
.error-summary {
  margin-bottom: var(--space-32); padding: var(--space-24);
  border: 2px solid var(--feedback-error); border-radius: var(--radius-4);
}
.error-summary h2 { color: var(--feedback-error); margin-bottom: var(--space-8); }
.error-summary ul { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: var(--space-4); }
.error-summary a { color: var(--feedback-error); font-weight: 400; }

/* ---------- Steps and fields ---------- */
.js .reg-step { display: none; }
.js .reg-step.is-current { display: block; }
.no-js .reg-step + .reg-step { margin-top: var(--space-64); padding-top: var(--space-48); border-top: 1px solid var(--border-subtle); }
.step-title { margin-bottom: var(--space-32); outline: none; font-size: clamp(28px, calc(1.5625vw + 16px), 32px); line-height: 1.1; }
.step-title:focus-visible { outline: var(--focus-ring-width) solid var(--focus-default); outline-offset: var(--focus-ring-offset); }
.step-lead { margin: calc(var(--space-16) * -1) 0 var(--space-32); color: var(--text-secondary); max-width: 60ch; }
.reg-form .yl-field { max-width: none; }
.reg-form .yl-field, .reg-form .choice-group, .reg-form .upload-field, .reg-form .links-field { margin-bottom: var(--space-32); }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 var(--gutter); }
.yl-field__hint[hidden] { display: none; }
.textarea-field .yl-field__input { height: auto; min-height: 112px; padding-block: var(--space-12); resize: vertical; line-height: 1.5; }

/* Category cards (radio) */
.choice-group { border: 0; margin: 0; padding: 0; min-width: 0; }
.choice-group legend { padding: 0; margin-bottom: var(--space-8); }
.choice-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-16); margin-bottom: var(--space-8); }
.choice { position: relative; display: block; cursor: pointer; }
.choice input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.choice-body {
  position: relative; display: flex; flex-direction: column; gap: var(--space-4); height: 100%;
  padding: var(--space-16) var(--space-16) var(--space-20);
  border: 1px solid var(--border-control); border-radius: var(--radius-4); background: var(--surface-default);
  transition: background-color 120ms cubic-bezier(.2, 0, 0, 1), border-color 120ms cubic-bezier(.2, 0, 0, 1);
}
.choice:hover .choice-body { background: var(--surface-subtle); }
.choice-name { font-family: var(--font-display); font-size: 28px; line-height: 32px; letter-spacing: -0.07em; text-transform: uppercase; }
.choice-desc { color: var(--text-secondary); padding-right: var(--space-24); }
.choice-mark {
  position: absolute; top: var(--space-12); right: var(--space-12);
  width: 24px; height: 24px; display: none; align-items: center; justify-content: center;
  background: var(--action-primary); color: var(--text-primary); font: 700 14px/1 var(--font-sans); border-radius: var(--radius-4);
}
.choice input:checked + .choice-body { border: 2px solid var(--charcoal-900); padding: calc(var(--space-16) - 1px) calc(var(--space-16) - 1px) calc(var(--space-20) - 1px); }
.choice input:checked + .choice-body .choice-mark { display: inline-flex; }
.choice input:focus-visible + .choice-body { outline: var(--focus-ring-width) solid var(--focus-default); outline-offset: var(--focus-ring-offset); }
.choice-group.is-invalid .choice-body { border-color: var(--feedback-error); }
.choice-group.is-invalid .yl-field__hint { color: var(--feedback-error); }

/* Uploads */
.upload-field .yl-field__label { margin-bottom: var(--space-8); }
.upload-field > .yl-field__hint { margin-bottom: var(--space-12); }
.dropzone {
  position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-16);
  padding: var(--space-20); border: 1px dashed var(--border-control); border-radius: var(--radius-4);
  background: var(--surface-default); cursor: pointer;
  transition: background-color 120ms cubic-bezier(.2, 0, 0, 1);
}
.dropzone:hover, .dropzone.is-dragover { background: var(--surface-subtle); }
.dropzone:focus-within { outline: var(--focus-ring-width) solid var(--focus-default); outline-offset: var(--focus-ring-offset); }
.dropzone .yl-btn { pointer-events: none; }
.dropzone-text { color: var(--text-secondary); }
.upload-field.is-invalid .dropzone { border: 2px solid var(--feedback-error); }
.upload-field.is-invalid > .yl-field__hint { color: var(--feedback-error); }
.upload-field[data-upload="single"].has-file .dropzone { display: none; }

.file-list { list-style: none; margin: var(--space-12) 0 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-12); }
.file-list:empty { display: none; }
.file-item { border: 1px solid var(--border-subtle); border-radius: var(--radius-4); padding: var(--space-16); }
.file-item.is-error { border: 2px solid var(--feedback-error); padding: calc(var(--space-16) - 1px); }
.file-top { display: flex; align-items: flex-start; gap: var(--space-16); }
.file-info { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: var(--space-4); }
.file-name { font: 700 14px/20px var(--font-sans); overflow-wrap: anywhere; }
.file-meta { font: 400 13px/1.5 var(--font-sans); color: var(--text-secondary); }
.file-status { display: flex; align-items: center; gap: var(--space-8); font: 400 13px/1.5 var(--font-sans); }
.file-status.is-ok { color: var(--text-primary); }
.file-status.is-error { color: var(--feedback-error); font-weight: 700; }
.status-mark { font-weight: 700; }
.file-actions { display: flex; gap: var(--space-4); flex-shrink: 0; }
.file-actions .yl-btn { height: var(--control-s); padding: 0 var(--space-12); }
.progress { height: 4px; background: var(--charcoal-100); border-radius: 2px; overflow: hidden; margin-top: var(--space-4); }
.progress span { display: block; height: 100%; width: 0; background: var(--charcoal-900); transform-origin: left; }
.file-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 var(--space-16); margin-top: var(--space-16); }
.file-fields .yl-field { margin-bottom: 0 !important; }
.file-fields .yl-field__input { height: var(--control-s); }

.count { margin: var(--space-16) 0 0; display: flex; flex-direction: column; gap: var(--space-8); }
.count-bar { height: 4px; background: var(--charcoal-100); border-radius: 2px; overflow: hidden; }
.count-bar span { display: block; height: 100%; width: 0; background: var(--accent-signal); }
.count.is-met .count-bar span { background: var(--charcoal-900); }

/* Film links */
.links-field .reg-note { margin-bottom: var(--space-16); }
.link-list { list-style: none; margin: var(--space-16) 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-12); }
.link-item { border: 1px solid var(--border-subtle); border-radius: var(--radius-4); padding: var(--space-16); }
.link-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--space-8); }
.link-head .yl-btn { height: var(--control-s); padding: 0 var(--space-12); }
.link-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 0 var(--space-16); }
.link-grid .yl-field { margin-bottom: 0 !important; }
.link-warn { display: flex; gap: var(--space-8); margin-top: var(--space-12); padding: var(--space-12); background: var(--surface-subtle); border-radius: var(--radius-4); font: 400 13px/1.5 var(--font-sans); }
.links-field .textarea-field { margin-top: var(--space-32); }
.links-field.is-invalid > .yl-field__hint { color: var(--feedback-error); margin-top: var(--space-8); }

/* Notes */
.reg-note { padding: var(--space-24); background: var(--surface-subtle); border-radius: var(--radius-0); display: flex; flex-direction: column; gap: var(--space-8); }
.reg-note-strong { background: var(--surface-default); border: 2px solid var(--charcoal-900); }
.privacy-note { color: var(--text-secondary); max-width: 64ch; }
.privacy-note strong { color: var(--text-primary); }

/* Review */
.review { display: flex; flex-direction: column; gap: var(--space-16); margin-bottom: var(--space-48); }
.review-block { border-top: 1px solid var(--charcoal-900); padding-top: var(--space-16); }
.review-head { display: flex; justify-content: space-between; align-items: center; gap: var(--space-16); }
.review-head .yl-btn { height: var(--control-s); padding: 0 var(--space-12); }
.review-list { margin: var(--space-8) 0 0; display: flex; flex-direction: column; }
.review-list > div { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: var(--space-16); padding: var(--space-8) 0; border-bottom: 1px solid var(--border-subtle); }
.review-list dt { font: 400 14px/22px var(--font-sans); color: var(--text-secondary); }
.review-list dd { margin: 0; font: 400 14px/22px var(--font-sans); overflow-wrap: anywhere; }
.review-list dd.is-missing { color: var(--feedback-error); font-weight: 700; }
/* Review: unfinished steps, listed first */
.review-todo { padding: var(--space-24); border: 2px solid var(--feedback-error); border-radius: var(--radius-box, 16px); display: flex; flex-direction: column; gap: var(--space-8); }
.review-todo-list { margin: 0; padding-left: var(--space-20); display: flex; flex-direction: column; gap: var(--space-4); }
/* Final check before submitting: entries can't be edited afterwards */
.final-check { margin-top: var(--space-16); padding: var(--space-16); background: var(--surface-subtle); border-left: 4px solid var(--accent-signal); }
.review-items { margin: var(--space-8) 0 0; padding-left: 20px; font: 300 14px/22px var(--font-sans); overflow-wrap: anywhere; }

/* Declarations (native checkboxes in the system's ink; the kit has no checkbox yet) */
.declarations { border: 0; margin: 0 0 var(--space-24); padding: 0; min-width: 0; }
.declarations legend { padding: 0; margin-bottom: var(--space-8); }
.check { display: flex; gap: var(--space-12); align-items: flex-start; padding: var(--space-8) 0; cursor: pointer; }
.check input { width: 22px; height: 22px; margin: 3px 0 0; flex-shrink: 0; accent-color: var(--charcoal-900); }
.declarations.is-invalid .yl-field__hint { color: var(--feedback-error); }
.declarations.is-invalid .check input { outline: 2px solid var(--feedback-error); outline-offset: 1px; }
.check-optional { margin-top: var(--space-16); }

.submit-error { margin-top: var(--space-32); padding: var(--space-24); border: 2px solid var(--feedback-error); border-radius: var(--radius-4); display: flex; flex-direction: column; gap: var(--space-8); }
.submit-error .h6 { color: var(--feedback-error); }

/* Actions */
.step-actions { display: flex; justify-content: space-between; align-items: center; gap: var(--space-16); margin-top: var(--space-48); padding-top: var(--space-32); border-top: 1px solid var(--border-subtle); }
.step-actions [data-back] { margin-right: auto; }
.no-js .step-actions [data-back], .no-js .step-actions [data-next] { display: none; }
.yl-btn[aria-busy="true"] { cursor: progress; }
.reg-visual-text { padding-bottom: var(--space-48); }

/* Confirmation */
.confirmation { display: flex; flex-direction: column; gap: var(--space-24); align-items: flex-start; }
.confirmation .h2 { outline: none; }
.confirmation .review-list { width: 100%; }

/* ---------- Tablet and mobile: image becomes a banner above the form ---------- */
@media (max-width: 1023px) {
  .reg-shell { grid-template-columns: minmax(0, 1fr); }
  .reg-visual { order: 0; position: relative; top: auto; height: 320px; margin: var(--space-16) max(var(--space-16), env(safe-area-inset-right, 0px)) 0 max(var(--space-16), env(safe-area-inset-left, 0px)); }
  .reg-visual-text { padding: var(--space-32) max(var(--margin), env(safe-area-inset-left, 0px)); }
  .reg-inner { padding-top: var(--space-48); }
}
@media (max-width: 767px) {
  .reg-visual { height: 280px; }
  .reg-visual-text { padding-bottom: var(--space-24); gap: var(--space-8); }
  .reg-visual-body { font-size: 15px; line-height: 22px; }
  .field-row, .file-fields, .link-grid { grid-template-columns: minmax(0, 1fr); }
  .field-row .yl-field + .yl-field { margin-top: 0; }
  .choice-grid { grid-template-columns: minmax(0, 1fr); gap: var(--space-8); }
  .stepper-label { display: none; }
  .review-list > div { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .step-actions { flex-wrap: wrap-reverse; }
  .step-actions .yl-btn--primary { flex: 1 1 100%; justify-content: space-between; }
  .step-actions [data-back] { flex: 1 1 100%; justify-content: center; }
  .file-fields .yl-field + .yl-field { margin-top: var(--space-12) !important; }

/* The submit label is too long for one line on the narrowest phones, so it wraps inside the button. */
@media (max-width: 400px) {
  .step-actions [data-submit] { min-width: 0; max-width: 100%; height: auto; min-height: var(--control-l); padding-block: var(--space-8); white-space: normal; text-align: left; }
}
}


/* ---------- Shape: rounded fields and containers (site decision, to sit with the pill buttons) ---------- */
:root { --radius-field: 12px; --radius-box: 16px; }
.reg-form .yl-field__input, .reg-form textarea.yl-field__input { border-radius: var(--radius-field); }
.choice-body, .dropzone, .file-item, .link-item, .link-warn, .error-summary, .submit-error, .reg-note, .reg-note-strong { border-radius: var(--radius-box); }

/* Required marker */
.req { color: var(--signal-red-600); font-weight: 700; margin-left: 2px; }
.required-note { color: var(--text-secondary); margin-bottom: var(--space-16); }

/* Portfolio thumbnails */
.file-item.has-thumb .file-top { align-items: center; }
.file-thumb {
  position: relative; flex: none; width: 72px; height: 72px; overflow: hidden;
  border-radius: var(--radius-field); background: var(--surface-subtle); border: 1px solid var(--border-subtle);
}
.file-thumb img, .file-thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.file-thumb.is-doc { display: flex; align-items: center; justify-content: center; }
.file-thumb-type { font: 700 13px/1 var(--font-sans); letter-spacing: 0.08em; color: var(--text-secondary); }
.file-thumb-tag {
  position: absolute; left: 4px; bottom: 4px; padding: 2px 6px; border-radius: var(--radius-999);
  background: rgba(23, 23, 23, 0.8); color: var(--white-50); font: 700 10px/1.4 var(--font-sans); letter-spacing: 0.06em;
}
.file-item.is-error .file-thumb { opacity: 0.5; }

/* Remove buttons: pill with a bin icon in a round chip */
.btn-remove .yl-btn__icon {
  box-sizing: content-box; flex: none; width: 14px; height: 14px; padding: 8px; border-radius: 50%;
  background: var(--charcoal-900); color: var(--white-50);
  transition: background-color 120ms cubic-bezier(.2, 0, 0, 1);
}
.btn-remove { padding-right: 6px !important; }
.btn-remove:hover .yl-btn__icon { background: var(--feedback-error); }
.file-actions .yl-btn, .link-head .yl-btn { height: var(--control-s); padding: 0 var(--space-16); }
@media (max-width: 767px) {
  .file-item.has-thumb .file-top { flex-wrap: wrap; }
  .file-thumb { width: 64px; height: 64px; }
}

/* Restored-details notice */
.draft-note {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-12) var(--space-16);
  margin-bottom: var(--space-24); padding: var(--space-12) var(--space-12) var(--space-12) var(--space-20);
  background: var(--golden-yellow-50); border: 1px solid var(--golden-yellow-500); border-radius: var(--radius-box);
}
.draft-note[hidden] { display: none; }

/* Bot check on the Review step: reserves its height so the page doesn't jump when it loads. */
.turnstile-field { margin-top: var(--space-24); }
.turnstile-field [data-turnstile] { min-height: 65px; }
