/* YCTC — Careers: role listings and the application form.
   Loaded after glass.css on careers.html and apply.html only. */

/* ---------- Role listings (careers.html, and the role picker on apply.html) ---------- */
.rolegroup { margin-top: clamp(2rem, 4vw, 3rem); }
.rolegroup:first-child { margin-top: 0; }
.rolegroup-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.5rem 1rem; padding-bottom: 0.9rem; }
.rolegroup-head h2, .rolegroup-head h3 { font-family: var(--font-display); font-weight: 460; font-size: clamp(1.25rem, 2vw, 1.5rem); letter-spacing: -0.01em; color: var(--text); }
.rolegroup-head .rg-count { font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--gold-2); }
.rolegroup-head p { flex-basis: 100%; color: var(--text-2); font-size: 0.94rem; max-width: 70ch; }
.rolegroup .roles { border-top: 1px solid var(--line-2); }
.rolegroup .role { padding: 1.25rem 0; }
.rolegroup .role h3 { font-size: clamp(1.15rem, 1.7vw, 1.4rem); }
.role .r-sum { color: var(--text-2); font-size: 0.93rem; margin-top: 0.45rem; max-width: 62ch; }
.role > div:first-child { min-width: 0; }
.role .btn { flex: none; white-space: nowrap; }
.roles-note { margin-top: 1.6rem; color: var(--text-2); font-size: 0.88rem; max-width: 72ch; }

/* ---------- Apply page layout ---------- */
.apply-hero { padding-bottom: clamp(1.5rem, 3vw, 2.5rem); }
.apply-hero .crumb { font-family: var(--font-mono); font-size: 0.74rem; letter-spacing: 0.06em; color: var(--text-2); }
.apply-hero .crumb a { color: var(--gold-2); border-bottom: 1px solid var(--gold-line); }
.hero.apply-hero .display { margin: 1.1rem 0 0.9rem; max-width: 22ch; }
.apply-hero .r-meta { display: flex; flex-wrap: wrap; gap: 0.5rem 1.2rem; font-family: var(--font-mono); font-size: 0.76rem; color: var(--text-2); letter-spacing: 0.03em; }
.apply-hero .r-meta span { display: inline-flex; align-items: center; gap: 0.4rem; }
.apply-hero .r-meta span::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--gold); }

.apply-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: clamp(1.5rem, 3vw, 2.5rem); align-items: start; }
@media (min-width: 1000px) { .apply-grid { grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.5fr); } }

.apply-brief { border: 1px solid var(--line-2); border-radius: 18px; padding: clamp(1.3rem, 2.4vw, 1.9rem); background: rgba(255, 255, 255, 0.03); }
@media (min-width: 1000px) and (min-height: 900px) { .apply-brief { position: sticky; top: 104px; } }
.apply-brief h2 { font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--gold-2); margin: 1.4rem 0 0.7rem; }
.apply-brief h2:first-child { margin-top: 0; }
.apply-brief p { color: var(--text-2); font-size: 0.96rem; }
.apply-brief ul { list-style: none; display: grid; gap: 0.55rem; }
.apply-brief li { position: relative; padding-left: 1.1rem; color: var(--text-2); font-size: 0.93rem; }
.apply-brief li::before { content: ""; position: absolute; left: 0; top: 0.62em; width: 5px; height: 5px; border-radius: 50%; background: var(--gold); }
.apply-brief .ab-time { margin-top: 1.4rem; padding-top: 1.1rem; border-top: 1px solid var(--line); font-size: 0.86rem; color: var(--text-2); }

/* ---------- The form shell ---------- */
.apply-form { border: 1px solid var(--line-2); border-radius: 20px; padding: clamp(1.2rem, 3vw, 2.4rem); background: rgba(255, 255, 255, 0.035); scroll-margin-top: 110px; }
.apply-form [hidden] { display: none !important; }
.af-legend { color: var(--text-2); font-size: 0.84rem; margin-bottom: 1.2rem; }
.af-legend .req, .af-label .req { color: var(--gold-2); }

/* Progress */
.af-progress { margin-bottom: 1.6rem; }
.af-progress-top { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-2); }
.af-progress-top strong { color: var(--gold-2); font-weight: 500; flex: none; white-space: nowrap; }
.af-progress-top span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: right; }
.af-bar { height: 3px; border-radius: 3px; background: var(--line-2); margin-top: 0.7rem; overflow: hidden; }
.af-bar span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--gold), var(--gold-2)); transition: width 0.45s var(--ease); }
.af-steps { list-style: none; display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.9rem; }
.af-steps li { min-width: 0; }
.af-steps button, .af-steps span.af-dot {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem; max-width: 100%;
  font: inherit; font-size: 0.8rem; color: var(--text-2); background: transparent;
  border: 1px solid var(--line); border-radius: 999px; padding: 0.38rem 0.75rem; min-height: 44px; min-width: 44px;
}
.af-steps .n { font-family: var(--font-mono); font-size: 0.68rem; color: inherit; }
.af-steps .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.af-steps button { cursor: pointer; color: var(--text-2); border-color: var(--line-2); }
.af-steps button:hover { border-color: var(--gold-line); color: var(--gold-2); }
.af-steps button:focus-visible { outline: 2px solid var(--gold-2); outline-offset: 2px; }
.af-steps span.af-dot[aria-current="step"] { color: #14110a; background: var(--gold); border-color: var(--gold); font-weight: 600; }
.af-steps .is-done .n::before { content: "✓ "; }
@media (max-width: 640px) { .af-steps .t { display: none; } .af-steps [aria-current="step"] .t { display: inline; } }

/* Step panel */
.af-step > h2 { font-family: var(--font-display); font-weight: 440; font-size: clamp(1.45rem, 2.6vw, 1.9rem); letter-spacing: -0.015em; color: var(--text); }
.af-step > h2:focus { outline: none; }
.af-step > h2:focus-visible { outline: 2px solid var(--gold-2); outline-offset: 6px; border-radius: 4px; }
.af-step .af-intro { color: var(--text-2); font-size: 0.95rem; margin-top: 0.5rem; max-width: 62ch; }
.af-fields { margin-top: 1.6rem; display: grid; gap: 1.55rem; }

/* Field */
.af-field { min-width: 0; border: 0; padding: 0; margin: 0; }
.af-label, .af-field > legend { display: block; padding: 0; font-family: var(--font-body); font-size: 0.98rem; font-weight: 550; line-height: 1.4; color: var(--text); margin-bottom: 0.4rem; }
.af-label .opt, .af-field > legend .opt { font-weight: 400; font-size: 0.82rem; color: var(--text-2); }
.af-help { color: var(--text-2); font-size: 0.86rem; line-height: 1.45; margin: -0.1rem 0 0.55rem; }
.af-control { width: 100%; font: inherit; font-size: max(1rem, 1em); min-height: 48px; }
.af-control, .af-file input[type="file"] { border-color: rgba(236, 234, 227, 0.4); }
.af-control::placeholder { color: var(--text-2); opacity: 0.85; }
.af-field { scroll-margin-top: 110px; }
textarea.af-control { min-height: 132px; line-height: 1.5; resize: vertical; }
.af-control:focus-visible { outline: 2px solid var(--gold-2); outline-offset: 2px; }
.af-count { margin-top: 0.35rem; text-align: right; font-family: var(--font-mono); font-size: 0.7rem; color: var(--text-2); }
.af-count.is-near { color: var(--gold-2); }

/* Choices: radio and checkbox as full-width tap targets.
   The checked look comes from an .is-checked class set by apply.js rather than :has(),
   so it also works in the older Android browsers many applicants use. */
.af-choices { display: grid; gap: 0.5rem; }
.af-choices.is-inline { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.af-choice { position: relative; display: flex; align-items: flex-start; gap: 0.7rem; min-height: 48px; padding: 0.72rem 0.9rem; border: 1px solid var(--line-2); border-radius: 12px; background: rgba(255, 255, 255, 0.03); cursor: pointer; color: var(--text-2); font-size: 0.95rem; line-height: 1.4; transition: border-color 0.2s, background 0.2s, color 0.2s; }
.af-choice:hover { border-color: var(--gold-line); }
.af-choice input { flex: none; width: 1.15rem; height: 1.15rem; margin: 0.12rem 0 0; accent-color: var(--gold); }
.af-choice.is-checked { border-color: var(--gold); background: var(--gold-dim); color: var(--text); }
.af-choice:focus-within { outline: 2px solid var(--gold-2); outline-offset: 2px; }

/* Matrix: one row per item, four ratings */
.af-matrix { display: grid; gap: 0.55rem; }
.af-mrow { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.5rem; padding: 0.7rem 0.8rem; border: 1px solid var(--line); border-radius: 12px; background: rgba(255, 255, 255, 0.02); min-width: 0; }
.af-mitem { font-size: 0.93rem; font-weight: 500; color: var(--text); line-height: 1.35; }
.af-mopts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.35rem; }
.af-mopt { position: relative; display: flex; align-items: center; justify-content: center; overflow-wrap: anywhere; min-height: 44px; padding: 0.35rem 0.3rem; border: 1px solid var(--line-2); border-radius: 9px; font-size: 0.82rem; color: var(--text-2); cursor: pointer; text-align: center; transition: border-color 0.2s, background 0.2s, color 0.2s; }
.af-mopt input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.af-mopt:hover { border-color: var(--gold-line); }
.af-mopt.is-checked { background: var(--gold); border-color: var(--gold); color: #14110a; font-weight: 600; }
.af-mopt:focus-within { outline: 2px solid var(--gold-2); outline-offset: 2px; }
@media (min-width: 720px) {
  .af-mrow { grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); align-items: center; }
}

/* File */
.af-file { display: grid; gap: 0.5rem; }
.af-file input[type="file"] { width: 100%; min-height: 48px; padding: 0.7rem 0.8rem; border: 1px dashed var(--line-2); border-radius: 12px; background: rgba(255, 255, 255, 0.03); color: var(--text-2); font: inherit; font-size: 0.92rem; }
.af-file input[type="file"]::file-selector-button { font: inherit; font-size: 0.86rem; margin-right: 0.8rem; padding: 0.45rem 0.8rem; border-radius: 8px; border: 1px solid var(--gold-line); background: var(--gold-dim); color: var(--gold-2); cursor: pointer; }
.af-file input[type="file"]:focus-visible { outline: 2px solid var(--gold-2); outline-offset: 2px; }
.af-file-name { font-size: 0.86rem; color: var(--text-2); }

.af-file-remove, .af-clear { font: inherit; font-size: 0.86rem; color: var(--gold-2); background: none; border: 0; border-bottom: 1px solid var(--gold-line); padding: 0.2rem 0; cursor: pointer; justify-self: start; min-height: 32px; }
.af-file-remove:hover, .af-clear:hover { border-bottom-color: var(--gold-2); }
.af-file-remove:focus-visible, .af-clear:focus-visible { outline: 2px solid var(--gold-2); outline-offset: 3px; border-radius: 3px; }
.af-restored { border: 1px solid var(--gold-line); background: var(--gold-dim); border-radius: 12px; padding: 0.8rem 1rem; margin-bottom: 1.3rem; font-size: 0.9rem; color: var(--text-2); }
.af-step[inert] { opacity: 0.55; }

/* Errors: text plus icon, never colour alone */
.af-error { display: none; align-items: flex-start; gap: 0.4rem; margin-top: 0.5rem; color: #f0a392; font-size: 0.88rem; line-height: 1.4; }
.af-error::before { content: "!"; flex: none; display: inline-grid; place-items: center; width: 1.05rem; height: 1.05rem; margin-top: 0.1rem; border-radius: 50%; background: #f0a392; color: #1a0f0c; font-weight: 700; font-size: 0.72rem; }
.af-field.is-invalid .af-error { display: flex; }
.af-field.is-invalid .af-control, .af-field.is-invalid .af-file input[type="file"] { border-color: #e08a78; }
.af-field.is-invalid .af-choices, .af-field.is-invalid .af-matrix { outline: 1px solid rgba(224, 138, 120, 0.7); outline-offset: 6px; border-radius: 12px; }

.af-summary { border: 1px solid rgba(224, 138, 120, 0.6); background: rgba(200, 80, 60, 0.1); border-radius: 12px; padding: 1rem 1.1rem; margin-top: 1.3rem; }
.af-summary:focus { outline: none; }
.af-summary:focus-visible { outline: 2px solid #f0a392; outline-offset: 2px; }
.af-summary h3 { font-size: 0.98rem; font-weight: 600; color: #f6b8aa; margin-bottom: 0.5rem; }
.af-summary ul { list-style: none; display: grid; gap: 0; }
.af-summary a { display: inline-block; padding: 0.45rem 0; color: #f6b8aa; font-size: 0.9rem; text-decoration: underline; text-underline-offset: 3px; }
.af-summary a:hover { color: #fff; }

/* Navigation */
.af-nav { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.8rem; margin-top: 2rem; padding-top: 1.4rem; border-top: 1px solid var(--line); }
.af-nav .btn { min-height: 48px; }
.af-nav .btn[aria-disabled="true"], .af-nav .btn:disabled { opacity: 0.6; cursor: progress; }
.af-nav .af-spacer { flex: 1; }
.af-saved { flex-basis: 100%; font-size: 0.8rem; color: var(--text-2); }
.af-status { margin-top: 1rem; padding: 0.9rem 1rem; border-radius: 12px; font-size: 0.93rem; }
.af-status:empty { padding: 0; margin: 0; border: 0; }
.af-status.is-err { border: 1px solid rgba(224, 138, 120, 0.6); background: rgba(200, 80, 60, 0.1); color: #f6b8aa; }
.af-status.is-busy { border: 1px solid var(--line-2); color: var(--text-2); }
.af-status a { color: inherit; border-bottom: 1px solid currentColor; }

/* Consent rows */
.af-consent .af-choice { font-size: 0.92rem; }
.af-consent a { color: var(--gold-2); border-bottom: 1px solid var(--gold-line); }

/* Success */
.af-done { text-align: left; }
.af-done .af-tick { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: var(--gold-dim); border: 1px solid var(--gold-line); color: var(--gold-2); font-size: 1.5rem; margin-bottom: 1.2rem; }
.af-done h2 { font-family: var(--font-display); font-weight: 440; font-size: clamp(1.6rem, 3vw, 2.2rem); letter-spacing: -0.015em; }
.af-done h2:focus { outline: none; }
.af-done p { color: var(--text-2); margin-top: 0.8rem; max-width: 60ch; }
.af-ref { display: inline-flex; flex-wrap: wrap; align-items: baseline; gap: 0.6rem; margin-top: 1.3rem; padding: 0.7rem 1rem; border: 1px solid var(--gold-line); border-radius: 12px; background: var(--gold-dim); font-family: var(--font-mono); font-size: 0.82rem; color: var(--text-2); }
.af-ref strong { color: var(--gold-2); font-size: 1rem; letter-spacing: 0.04em; }
.af-done .btn-row { margin-top: 1.8rem; }

/* Screen-reader only */
.af-sr { position: absolute; clip-path: inset(50%); overflow: hidden; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0; white-space: nowrap; }

/* Honeypot: off-screen, out of the tab order and the accessibility tree */
.af-hp { position: absolute; left: -9999px; top: auto; width: 1px; height: 1px; overflow: hidden; }

/* No-script and empty states */
.apply-fallback { border: 1px solid var(--line-2); border-radius: 18px; padding: clamp(1.3rem, 3vw, 2rem); color: var(--text-2); }
.apply-fallback a { color: var(--gold-2); border-bottom: 1px solid var(--gold-line); }

/* On phones the floating WhatsApp, back-to-top and chat buttons sit on top of answer options and
   the Continue button, so they are hidden while someone is filling in an application. Help by
   email is offered in the role brief. */
@media (max-width: 760px) {
  .is-applying .yctc-wa, .is-applying .to-top, .is-applying .yctc-cw:not(.open) { display: none !important; }
}

/* "Start the application" jump link: only useful when the role brief sits above the form */
.apply-start { margin-top: 1.4rem; }
@media (min-width: 1000px) { .apply-start { display: none; } }

/* four ratings do not fit across a narrow or zoomed phone: stack them two by two */
@media (max-width: 480px) {
  .af-mopts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.af-mrow.is-missing { border-color: #e08a78; }
@media (forced-colors: active) {
  .af-mopt.is-checked, .af-choice.is-checked { forced-color-adjust: none; background: Highlight; color: HighlightText; border-color: Highlight; }
}

@media (max-width: 600px) {
  .apply-form { border-radius: 16px; }
  .af-nav .btn { flex: 1; justify-content: center; }
  .af-nav .af-spacer { display: none; }
  .role .btn { width: 100%; justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
  .af-bar span, .af-choice, .af-mopt { transition: none; }
}
