/* Apply, plus the pieces the other form pages reuse (contact, login and thank-you
   load this file before their own): page head, board fragments (.mini.fx), and the
   form system (fields, purpose tiles live in contact.css). Monochrome only: errors
   are marked with weight, a diamond and a heavier border, never with colour. */

/* ---------- Page head ---------- */
.page-head .eyebrow { font-size: .9375rem; color: var(--muted); }
.page-head h1 { margin-top: 1.25rem; font-size: var(--d-1); line-height: 1.16; }
.page-head .lede { margin-top: 1.5rem; max-width: 32rem; color: var(--fg-2); font-size: clamp(1.0625rem, 1.3vw, 1.25rem); line-height: 1.6; }
.page-head .ctas { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 2.25rem; }
.inline-link { color: inherit; text-decoration: underline; text-decoration-color: var(--line-2); text-decoration-thickness: 1px; text-underline-offset: .28em; transition: text-decoration-color .3s; }
.inline-link:hover { text-decoration-color: currentColor; }
.tnum { font-variant-numeric: tabular-nums; }
.notation { font-family: var(--display); font-size: .875rem; color: var(--fg-2); }

/* ---------- Board fragments: any size, drawn on the server ---------- */
.mini.fx { --s: 3.5rem; width: fit-content; grid-template-columns: 1rem repeat(var(--nf), var(--s)); grid-template-rows: repeat(var(--nr), var(--s)) 1.25rem; }
.mini.fx .frame, .mini.fx .trace { width: calc(var(--s) * var(--nf)); height: calc(var(--s) * var(--nr)); }
/* placed with left/top (GSAP folds the translate property into transform) */
.mini.fx .piece, .mini.fx .start { left: calc(1rem + var(--pc) * var(--s)); top: calc(var(--pr) * var(--s)); }
.mini.fx .piece .shadow { bottom: 6%; }
.mini.fx .start { position: absolute; width: var(--s); height: var(--s); pointer-events: none; }
.mini.fx .start::after { content: ""; position: absolute; inset: 30%; border-radius: 50%; border: 1.25px dashed var(--fg); opacity: .55; }
.mini.fx .trace { clip-path: inset(calc((1 - var(--tp, 1)) * 100%) 0 0 0); }

/* ---------- Apply: head, sticky board and the five stages ---------- */
.ap-top { padding-top: clamp(1.5rem, 4vw, 3rem); overflow-x: clip; }
.ap-grid { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); grid-template-areas: "head board" "stages board"; column-gap: clamp(2rem, 6vw, 6.5rem); }
.ap-head { grid-area: head; min-height: min(calc(100dvh - var(--nav-h) - 6rem), 44rem); display: flex; flex-direction: column; justify-content: center; }
.status { display: inline-flex; align-items: center; gap: .7rem; margin-top: 1.5rem; font-weight: 500; font-size: .9375rem; }
.status .mark { width: .75rem; height: .75rem; border: 1px solid var(--fg); }
.status.is-open .mark { background: var(--fg); }
.ap-board-col { grid-area: board; position: relative; }
.ap-board-stick { position: sticky; top: max(calc(var(--nav-h) + 1rem), calc(50dvh - 13.5rem)); padding-top: clamp(1rem, 6vh, 4rem); }
.ap-board-stick .drawing { top: -1rem; right: -2.5rem; width: 17rem; height: 17rem; --sq: 4.25rem; }
.ap-board { position: relative; z-index: 1; width: fit-content; margin-left: auto; padding: 1.75rem 1.75rem 1.25rem 1rem; }
.ap-board .mini.fx { --s: clamp(3rem, 4vw, 3.6rem); }
.ap-cap { display: flex; gap: .6rem; align-items: baseline; margin-top: .9rem; padding-left: 1rem; min-height: 1.5rem; font-family: var(--display); font-size: .8125rem; color: var(--fg-2); }
.ap-cap-n { color: var(--fg); }
.ap-stages { grid-area: stages; padding-top: clamp(4rem, 10vw, 8rem); }
.stages { margin-top: clamp(2.5rem, 5vw, 3.5rem); }
.stage { display: grid; grid-template-columns: 3.75rem minmax(0, 1fr); gap: 1rem; padding: 1.75rem 0; border-top: 1px solid var(--line); }
.stage:last-child { border-bottom: 1px solid var(--line); }
.stage .no { font-family: var(--display); font-size: clamp(1.25rem, 2vw, 1.6rem); line-height: 1.2; }
.stage h3 { font-family: var(--display); font-weight: 400; font-size: clamp(1.05rem, 1.5vw, 1.3rem); line-height: 1.35; }
.stage p { margin-top: .5rem; max-width: 30rem; color: var(--fg-2); }
/* stepped (desktop, motion): each stage takes its turn while the board keeps still */
.ap-stepped .stage { min-height: 34vh; align-content: center; color: var(--muted); transition: color .5s var(--ease); }
.ap-stepped .stage p { color: var(--muted); transition: color .5s var(--ease); }
.ap-stepped .stage.on { color: var(--fg); }
.ap-stepped .stage.on p { color: var(--fg-2); }
.ap-stepped .stage:last-child { min-height: 42vh; }

/* ---------- What to have ready, and the privacy note ---------- */
.ready-grid { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: clamp(2.5rem, 7vw, 7rem); align-items: center; }
.ready-sheet { padding: clamp(1.75rem, 4.5vw, 3.5rem); }
.needs { margin-top: 2rem; }
.needs li { display: grid; grid-template-columns: 1.5rem minmax(0, 1fr); gap: .75rem; padding: .9rem 0; border-top: 1px solid var(--line); color: var(--fg-2); }
.needs .tick { width: .7rem; height: .7rem; margin-top: .55rem; background: var(--fg); transform: rotate(45deg); }
.privacy { position: relative; padding-left: clamp(1.25rem, 2.5vw, 2rem); border-left: 1px solid var(--fg); max-width: 26rem; }
.privacy-piece { display: block; width: clamp(3.5rem, 6vw, 5rem); height: clamp(3.5rem, 6vw, 5rem); margin-bottom: 1.25rem; }
.privacy-piece [data-piece] { width: 100%; height: 100%; filter: drop-shadow(0 8px 7px rgba(0,0,0,.14)); }
.privacy h2 { font-size: clamp(1.2rem, 1.8vw, 1.5rem); line-height: 1.3; }
.privacy p { margin-top: 1rem; color: var(--fg-2); font-size: 1.0625rem; }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 7fr); gap: clamp(2rem, 6vw, 6rem); align-items: start; }
.form-aside { position: sticky; top: calc(var(--nav-h) + 2rem); }
.form-aside .aside-note { margin-top: 1.5rem; font-size: .9375rem; color: var(--fg-2); }
.form-card { padding: clamp(1.5rem, 4vw, 3.25rem); }
.form {
  --field-line: color-mix(in srgb, var(--fg) 52%, var(--bg));
  --field-bg: color-mix(in srgb, var(--bg) 70%, transparent);
  display: grid; gap: 1.6rem; color-scheme: light;
}
html[data-theme="dark"] .form { color-scheme: dark; --field-bg: color-mix(in srgb, var(--bg) 55%, transparent); }
.form .row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.6rem 1.25rem; }
.field { min-width: 0; margin: 0; padding: 0; border: 0; }
.field > label, .field > legend { display: block; padding: 0; margin-bottom: .5rem; font-size: .9375rem; font-weight: 500; line-height: 1.4; color: var(--fg); }
.field .opt { font-weight: 400; color: var(--muted); }
.field .hint { margin: -.2rem 0 .55rem; font-size: .875rem; line-height: 1.45; color: var(--muted); }
.field input:not([type="checkbox"]):not([type="radio"]), .field textarea, .field select {
  display: block; width: 100%; min-height: 3.25rem; margin: 0; padding: .75rem 1rem;
  font: inherit; font-size: 1.0625rem; line-height: 1.4; color: var(--fg);
  background: var(--field-bg); border: 1px solid var(--field-line); border-radius: 2px;
  transition: border-color .3s, box-shadow .3s;
}
.field textarea { min-height: 10rem; resize: vertical; line-height: 1.55; }
.field ::placeholder { color: var(--muted); opacity: 1; }
.field input:hover, .field textarea:hover, .field select:hover { border-color: var(--fg); }
.field input:not([type="checkbox"]):not([type="radio"]):focus-visible, .field textarea:focus-visible, .field select:focus-visible {
  outline: none; border-color: var(--fg); box-shadow: 0 0 0 1px var(--fg), 0 0 0 6px color-mix(in srgb, var(--fg) 9%, transparent);
}
.select { position: relative; display: block; }
.select select { appearance: none; -webkit-appearance: none; padding-right: 2.75rem; cursor: pointer; }
.select::after { content: ""; position: absolute; right: 1.1rem; top: 50%; width: 8px; height: 8px; margin-top: -6px; border-right: 1.25px solid var(--fg); border-bottom: 1.25px solid var(--fg); transform: rotate(45deg); pointer-events: none; }
.select option { color: #0e0e0e; background: #ffffff; }
html[data-theme="dark"] .select option { color: #ecebe7; background: #1c1c1c; }
/* errors: a diamond, weight and a heavier border (the field's label stays the same) */
.err { display: flex; align-items: baseline; gap: .55rem; margin-top: .55rem; font-size: .9rem; font-weight: 500; line-height: 1.45; color: var(--fg); }
.err::before { content: ""; flex: none; width: .45rem; height: .45rem; background: var(--fg); transform: translateY(-.1rem) rotate(45deg); }
.err:empty { display: none; }
.field [aria-invalid="true"]:not([type="checkbox"]):not([type="radio"]) { border-color: var(--fg); box-shadow: inset 0 0 0 1px var(--fg); }
.field-check { margin-top: -.25rem; }
.field > label.check { display: flex; margin-bottom: 0; font-weight: 400; align-items: flex-start; gap: .85rem; min-height: 2.75rem; padding: .55rem 0; font-size: .9375rem; line-height: 1.5; color: var(--fg-2); cursor: pointer; }
.check input { flex: none; width: 1.3rem; height: 1.3rem; margin: .1rem 0 0; accent-color: var(--fg); cursor: pointer; }
.check input:focus-visible { outline: 1.5px solid var(--fg); outline-offset: 3px; }
.check .inline-link { color: var(--fg); }
/* the honeypot: off-screen for people, still a real field for bots (never display:none alone) */
.hp { position: absolute !important; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; opacity: 0; pointer-events: none; }
.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 1.5rem; margin-top: .25rem; }
.form-actions .note { font-size: .9375rem; color: var(--fg-2); }
.submit { min-width: 13.5rem; }
.submit-busy { position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: currentColor; transform: scaleX(0); transform-origin: 0 50%; }
.form.is-pending .submit { cursor: progress; }
.form.is-pending .submit-busy { animation: form-busy 1.2s var(--ease) infinite; }
@keyframes form-busy { 0% { transform: scaleX(0); transform-origin: 0 50%; } 50% { transform: scaleX(1); transform-origin: 0 50%; } 50.1% { transform-origin: 100% 50%; } 100% { transform: scaleX(0); transform-origin: 100% 50%; } }
.form-alert { padding: 1rem 1.25rem; border-left: 2px solid var(--fg); background: color-mix(in srgb, var(--fg) 5%, transparent); font-size: .9375rem; line-height: 1.5; color: var(--fg); }
.form-alert:focus { outline: none; }
.form-alert:focus-visible { outline: 1.5px solid var(--fg); outline-offset: 3px; }
.form-alert b { display: block; font-weight: 600; }
.form-alert ul { margin-top: .35rem; }
.form-alert a { display: inline-flex; align-items: center; min-height: 2.75rem; color: inherit; text-underline-offset: .25em; }
/* the confirmation that replaces the form */
.form[hidden], .form-done[hidden], .form-alert[hidden], .ref[hidden] { display: none; }
.form-done { padding: clamp(.5rem, 2vw, 1.5rem) 0; }
.form-done:focus { outline: none; }
.done-mark { position: relative; display: block; width: 2.75rem; height: 2.75rem; border: 1px solid var(--fg); }
.done-mark::after { content: ""; position: absolute; left: 50%; top: 45%; width: .7rem; height: 1.25rem; border-right: 1.5px solid var(--fg); border-bottom: 1.5px solid var(--fg); transform: translate(-50%, -50%) rotate(45deg); }
.form-done h3 { margin-top: 1.5rem; font-size: clamp(1.4rem, 2.4vw, 2rem); line-height: 1.2; }
.form-done p { margin-top: 1rem; max-width: 38rem; color: var(--fg-2); font-size: 1.0625rem; }
.ref b { font-family: var(--display); font-weight: 400; color: var(--fg); letter-spacing: .04em; }

/* ---------- Phones and tablets ---------- */
@media (max-width: 960px) {
  /* heading, then the board, then the moves */
  .ap-grid { grid-template-columns: minmax(0, 1fr); grid-template-areas: none; }
  .ap-head, .ap-board-col { grid-area: auto; }
  .ap-head { min-height: 0; order: 1; }
  .ap-stages { display: contents; }
  .ap-stages > .sec-head { order: 2; padding-top: clamp(4rem, 14vw, 5.5rem); }
  .ap-board-col { order: 3; margin-top: 2.5rem; }
  .stages { order: 4; }
  .ap-board-stick { position: static; padding-top: 0; }
  .ap-board { margin-left: 0; }
  .ap-board-stick .drawing { top: -1.5rem; right: auto; left: 55%; width: 11rem; height: 11rem; --sq: 2.75rem; }
  .ready-grid, .form-grid { grid-template-columns: minmax(0, 1fr); }
  .form-aside { position: static; }
}
@media (max-width: 640px) {
  .form .row { grid-template-columns: minmax(0, 1fr); }
  .stage { grid-template-columns: 2.75rem minmax(0, 1fr); gap: .5rem; }
  .submit { width: 100%; }
  .ap-board .mini.fx { --s: 2.75rem; }
  .ap-board { padding: 1.25rem 1.25rem 1rem .75rem; }
}
