/* The applicant's pages (/apply/link, /apply/signin, /apply/account), in the landing page's
   language: ink #161616 on white and #f4f4f4 tiles, square edges, Cossette Texte headlines,
   IBM Plex Mono lowercase notes, one red. Buttons are the product's (landing.css).
   Interaction follows Apple's fluid-interface rules: feedback on press, sheets that rise from
   and return to where they came from with a critically damped curve, nothing that blocks input
   while it moves, and calmer equivalents under reduced motion / transparency / more contrast. */

:root {
  --ink: #161616; --ink-2: #393939; --ink-3: #525252; --line: #e0e0e0; --tile: #f4f4f4;
  --red: #d8180b; --red-ink: #b01409; --ok: #24a148;
  /* Critically damped spring (damping 1.0, response ~0.35s) as a cubic-bezier, and its mirror for exits. */
  --spring: cubic-bezier(.2, .9, .25, 1);
  --spring-out: cubic-bezier(.75, 0, .8, .1);
  --enter: 340ms; --exit: 200ms;
}

body { margin: 0; background: #fff; color: var(--ink); font-family: 'Cossette Texte', 'IBM Plex Sans', 'Helvetica Neue', Arial, sans-serif; }

/* Translucent header: content scrolls under it; a soft edge instead of a hard rule once scrolled. */
.ap-head { position: sticky; top: 0; z-index: 10; background: rgba(255, 255, 255, .78);
  -webkit-backdrop-filter: blur(20px) saturate(180%); backdrop-filter: blur(20px) saturate(180%);
  transition: box-shadow 200ms ease; }
.ap-head.scrolled { box-shadow: 0 1px 0 var(--line), 0 8px 16px -12px rgba(0, 0, 0, .25); }
.ap-head .wrap { height: 48px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.ap-brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--red); }
.ap-brand span { display: flex; flex-direction: column; font-size: 15px; line-height: 12px; letter-spacing: -0.07em; }
.ap-head nav { display: flex; gap: 24px; font-size: 14px; }
.ap-head nav a { color: var(--ink-3); text-decoration: none; min-height: 44px; display: flex; align-items: center; }
.ap-head nav a:hover { color: var(--ink); }

.ap-main { padding: 72px 0 120px; }
.ap-grid { display: grid; grid-template-columns: repeat(16, minmax(0, 1fr)); column-gap: 32px; row-gap: 32px; }
.ap-intro { grid-column: 1 / 7; display: flex; flex-direction: column; gap: 20px; align-self: start; position: sticky; top: 96px; }
.ap-work { grid-column: 8 / 17; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.ap-kicker { font-family: 'IBM Plex Mono', ui-monospace, monospace; font-size: 12px; letter-spacing: .32px; color: var(--red); margin: 0; }
.ap-title { margin: 0; font-weight: 400; font-size: clamp(36px, 4.2vw, 56px); line-height: 1.04; letter-spacing: -0.03em; text-wrap: balance; }
.ap-title:focus { outline: none; }
.ap-lede { margin: 0; font-size: 18px; line-height: 1.5; color: var(--ink-2); text-wrap: pretty; }
.ap-note { margin: 0; font-family: 'IBM Plex Mono', ui-monospace, monospace; font-size: 12px; line-height: 1.6; letter-spacing: .32px; color: var(--ink-3); }

.ap-tile { background: var(--tile); padding: 28px; display: flex; flex-direction: column; gap: 18px; }
.ap-tile h2 { margin: 0; font-weight: 400; font-size: 24px; line-height: 1.2; letter-spacing: -0.02em; }
.ap-tile .row { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.ap-label { font-family: 'IBM Plex Mono', ui-monospace, monospace; font-size: 12px; letter-spacing: .32px; color: var(--ink-3); }

/* Status: one square per stage; done in ink, the current one in red, what is ahead outlined. */
.ap-track { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; }
.ap-track li { display: flex; flex-direction: column; gap: 8px; font-size: 13px; color: var(--ink-3); }
.ap-track .bar { height: 6px; background: #c6c6c6; transform-origin: left; }
.ap-track .done .bar { background: var(--ink); }
.ap-track .now .bar { background: var(--red); animation: ap-grow var(--enter) var(--spring) both; }
.ap-track .now { color: var(--ink); }
.ap-status { margin: 0; font-size: 28px; line-height: 1.2; letter-spacing: -0.02em; }
@keyframes ap-grow { from { transform: scaleX(0); } }

dl.ap-facts { margin: 0; display: grid; grid-template-columns: minmax(120px, 30%) 1fr; gap: 0; }
.ap-facts dt, .ap-facts dd { margin: 0; padding: 12px 0; border-top: 1px solid var(--line); }
.ap-facts dt { font-family: 'IBM Plex Mono', ui-monospace, monospace; font-size: 12px; letter-spacing: .32px; color: var(--ink-3); padding-top: 15px; }
.ap-facts dd { font-size: 16px; overflow-wrap: anywhere; }

/* Fields, as the pilot form's (design.css .pf-row). */
.ap-field { display: flex; flex-direction: column; gap: 6px; }
.ap-field label { font-family: 'IBM Plex Mono', ui-monospace, monospace; font-size: 12px; letter-spacing: .32px; color: var(--ink-3); }
.ap-field input { height: 48px; border: 0; border-bottom: 1px solid #8d8d8d; background: #fff; padding: 0 14px; font: inherit; font-size: 16px; color: var(--ink); border-radius: 0; outline: none; -webkit-appearance: none; appearance: none; transition: box-shadow 120ms ease; }
.ap-field input:focus { box-shadow: inset 0 0 0 2px var(--ink); border-bottom-color: transparent; }
.ap-field input[aria-invalid=true] { box-shadow: inset 0 0 0 2px var(--red); }
.ap-err { margin: 0; font-family: 'IBM Plex Mono', ui-monospace, monospace; font-size: 12px; color: var(--red-ink); }
.ap-err:empty { display: none; }
.ap-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* A switch for the optional consent: tracks the press at once (feedback on pointer-down). */
.ap-switch { display: flex; justify-content: space-between; align-items: center; gap: 16px; cursor: pointer; }
.ap-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.ap-switch .knob { flex: 0 0 auto; width: 44px; height: 24px; background: #8d8d8d; position: relative; transition: background 160ms ease; }
.ap-switch .knob::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; background: #fff; transition: transform 260ms var(--spring); }
.ap-switch input:checked + .knob { background: var(--ink); }
.ap-switch input:checked + .knob::after { transform: translateX(20px); }
.ap-switch:active .knob::after { width: 22px; }
.ap-switch input:checked:active + .knob::after { transform: translateX(16px); }
.ap-switch input:focus-visible + .knob { outline: 2px solid var(--ink); outline-offset: 2px; }
.ap-switch[aria-busy=true] { cursor: progress; opacity: .6; }

.btn-danger, .btn-danger:hover { background: #fff; color: var(--red-ink); border-color: #d6d6d6; }
.btn-danger:hover { border-color: var(--red); }
.btn-danger.solid, .btn-danger.solid:hover { background: var(--red); color: #fff; border-color: transparent; }
.ap-link { background: none; border: 0; padding: 0; font: inherit; color: var(--red); cursor: pointer; text-decoration: none; min-height: 44px; }
.ap-link:hover { text-decoration: underline; }

/* Ledger of consents: plain rows, mono dates. */
.ap-ledger { list-style: none; margin: 0; padding: 0; }
.ap-ledger li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); font-size: 14px; flex-wrap: wrap; }
.ap-ledger .m { font-family: 'IBM Plex Mono', ui-monospace, monospace; font-size: 12px; color: var(--ink-3); }

/* Entrance: content rises 12px into place, staggered; it is never blocked while it moves. */
.ap-in { animation: ap-in var(--enter) var(--spring) both; }
.ap-in:nth-child(2) { animation-delay: 40ms; } .ap-in:nth-child(3) { animation-delay: 80ms; }
.ap-in:nth-child(4) { animation-delay: 120ms; } .ap-in:nth-child(5) { animation-delay: 160ms; }
@keyframes ap-in { from { opacity: 0; transform: translateY(12px); } }

/* Sheet: a modal task, so it dims the page. It grows from the button that opened it
   (transform-origin is set from the trigger) and returns there on close, along the same path.
   On phones it rises from the bottom edge and leaves the same way. */
dialog.ap-sheet { border: 0; padding: 0; width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 64px);
  background: #fff; color: var(--ink); box-shadow: 0 24px 64px -16px rgba(0, 0, 0, .35);
  opacity: 0; transform: scale(.94); transition: opacity var(--exit) var(--spring-out), transform var(--exit) var(--spring-out), overlay var(--exit) allow-discrete, display var(--exit) allow-discrete; }
dialog.ap-sheet[open] { opacity: 1; transform: none; transition-duration: var(--enter); transition-timing-function: var(--spring); }
@starting-style { dialog.ap-sheet[open] { opacity: 0; transform: scale(.94); } }
dialog.ap-sheet::backdrop { background: rgba(22, 22, 22, 0); transition: background var(--exit) ease, overlay var(--exit) allow-discrete, display var(--exit) allow-discrete; }
dialog.ap-sheet[open]::backdrop { background: rgba(22, 22, 22, .42); }
@starting-style { dialog.ap-sheet[open]::backdrop { background: rgba(22, 22, 22, 0); } }
.ap-sheet form, .ap-sheet .body { padding: 28px; display: flex; flex-direction: column; gap: 18px; }
.ap-sheet .ap-field input { background: var(--tile); }
.ap-sheet h2 { margin: 0; font-weight: 400; font-size: 28px; line-height: 1.15; letter-spacing: -0.02em; }
.ap-sheet p { margin: 0; font-size: 16px; line-height: 1.5; color: var(--ink-2); }
.ap-sheet .ap-actions { justify-content: flex-end; }

/* A small confirmation, bottom-left, gone after a few seconds. */
.ap-toast { position: fixed; left: 16px; bottom: 16px; z-index: 30; background: var(--ink); color: #fff; padding: 12px 16px;
  font-size: 14px; display: flex; gap: 10px; align-items: center; max-width: calc(100vw - 32px);
  animation: ap-toast-in var(--enter) var(--spring) both; }
.ap-toast::before { content: ''; width: 8px; height: 8px; background: var(--red); flex: 0 0 auto; }
.ap-toast.leaving { animation: ap-toast-out var(--exit) var(--spring-out) both; }
@keyframes ap-toast-in { from { opacity: 0; transform: translateY(16px); } }
@keyframes ap-toast-out { to { opacity: 0; transform: translateY(16px); } }

.ap-skel { background: linear-gradient(90deg, #ececec, #f6f6f6, #ececec); background-size: 200% 100%; animation: ap-shimmer 1.4s linear infinite; height: 160px; }
@keyframes ap-shimmer { to { background-position: -200% 0; } }

[hidden] { display: none !important; }

@media (max-width: 1055px) {
  .ap-intro { grid-column: 1 / -1; position: static; }
  .ap-work { grid-column: 1 / -1; }
}
@media (max-width: 671px) {
  .ap-main { padding: 40px 0 80px; }
  .ap-tile { padding: 20px; }
  .ap-track { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .ap-track .name { font-size: 11px; }
  dl.ap-facts { grid-template-columns: 1fr; }
  .ap-facts dd { border-top: 0; padding-top: 0; }
  .ap-head nav { gap: 16px; }
  dialog.ap-sheet { width: 100vw; max-width: 100vw; margin: auto 0 0; transform: translateY(100%); }
  dialog.ap-sheet[open] { transform: none; }
  @starting-style { dialog.ap-sheet[open] { transform: translateY(100%); } }
  .ap-sheet .ap-actions { flex-direction: column-reverse; }
  .ap-sheet .ap-actions .btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .ap-in, .ap-track .now .bar, .ap-toast, .ap-toast.leaving, .ap-skel { animation: none; }
  dialog.ap-sheet, dialog.ap-sheet[open] { transform: none !important; transition-property: opacity, overlay, display; }
  .ap-switch .knob::after { transition: none; }
}
@media (prefers-reduced-transparency: reduce) {
  .ap-head { background: #fff; -webkit-backdrop-filter: none; backdrop-filter: none; }
}
@media (prefers-contrast: more) {
  .ap-head { background: #fff; backdrop-filter: none; box-shadow: 0 1px 0 var(--ink); }
  .ap-tile { outline: 1px solid var(--ink); }
  .ap-note, .ap-label, .ap-facts dt { color: var(--ink); }
}
