/* Careers portal. "Application paper and pencil": cool paper, navy ink,
   pencil yellow only for "you are here" and focus. */

:root {
  --paper: #eef1f4;
  --sheet: #ffffff;
  --ink: #14213d;
  --graphite: #5b6577;
  --rule: #d5dbe3;
  --pencil: #f2b705;
  --pencil-soft: #fdf3cf;
  --done: #1e7f5c;
  --error: #b42318;
  --error-soft: #fdecea;

  --font-display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --font-body: "Atkinson Hyperlegible", "Segoe UI", system-ui, sans-serif;

  /* 1.25 scale on a 17px body */
  --step--1: 0.875rem;
  --step-0: 1.0625rem;
  --step-1: 1.3125rem;
  --step-2: 1.625rem;
  --step-3: 2.0625rem;
  --step-4: clamp(2.25rem, 5vw + 1rem, 3.5rem);

  --radius-control: 6px;
  --radius-sheet: 14px;
  --measure: 68ch;
}

*, *::before, *::after { box-sizing: border-box; }

/* The hidden attribute must win over component display rules. */
[hidden] { display: none !important; }

html { background: var(--paper); }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0 0 0.5em;
  text-wrap: balance;
}
h1 { font-size: var(--step-4); letter-spacing: -0.025em; }
h2 { font-size: var(--step-2); }
h3 { font-size: var(--step-1); }
p { margin: 0 0 1em; max-width: var(--measure); }

a { color: var(--ink); text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 2px;
  box-shadow: 0 0 0 6px var(--pencil);
  border-radius: 2px;
}

/* Headings receive focus on navigation for screen readers; that focus is
   programmatic, so it shouldn't draw a ring. */
[tabindex="-1"]:focus { outline: none; box-shadow: none; }

.skip-link {
  position: absolute;
  left: 1rem;
  top: -3rem;
  background: var(--ink);
  color: var(--sheet);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-control);
  z-index: 10;
}
.skip-link:focus { top: 1rem; }

.site-header, main, .site-footer {
  width: min(1120px, 100% - 2rem);
  margin-inline: auto;
}
.site-header { padding: 1.5rem 0 0; }
.wordmark {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--step-1);
  text-decoration: none;
}
main { flex: 1; padding: 2.5rem 0 4rem; outline: none; }
.site-footer {
  border-top: 1px solid var(--rule);
  padding: 1.5rem 0 2rem;
  color: var(--graphite);
  font-size: var(--step--1);
}

.loading, .muted { color: var(--graphite); }
.back-link { display: inline-block; margin-bottom: 1.5rem; color: var(--graphite); }

/* ---- buttons & fields ---------------------------------------------- */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 48px;
  padding: 0.75rem 1.4rem;
  border: 2px solid var(--ink);
  border-radius: var(--radius-control);
  background: var(--ink);
  color: var(--sheet);
  font: 700 var(--step-0) / 1.2 var(--font-body);
  text-decoration: none;
  cursor: pointer;
}
.button:hover { background: #22325a; border-color: #22325a; }
.button[disabled] { opacity: 0.55; cursor: not-allowed; }
.button.secondary { background: transparent; color: var(--ink); }
.button.secondary:hover { background: var(--sheet); }
.button.wide { width: 100%; }

input[type="search"], textarea {
  width: 100%;
  border: 2px solid var(--rule);
  border-radius: var(--radius-control);
  background: var(--sheet);
  color: var(--ink);
  font: inherit;
  padding: 0.75rem 0.9rem;
}
input[type="search"]:focus-visible, textarea:focus-visible {
  border-color: var(--ink);
  box-shadow: 0 0 0 4px var(--pencil);
  outline: none;
}
label { font-weight: 700; }

.alert {
  border-left: 4px solid var(--error);
  background: var(--error-soft);
  padding: 0.85rem 1rem;
  border-radius: 0 var(--radius-control) var(--radius-control) 0;
  margin: 1rem 0;
  max-width: var(--measure);
}

/* ---- jobs list ----------------------------------------------------- */

.intro { max-width: 46rem; margin-bottom: 2.5rem; }
.intro p { font-size: var(--step-1); color: var(--graphite); line-height: 1.5; }

.search { max-width: 28rem; margin-bottom: 1.5rem; }
.search label { display: block; margin-bottom: 0.35rem; }

.job-list {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--sheet);
  border-radius: var(--radius-sheet);
  border: 1px solid var(--rule);
}
.job-list li + li { border-top: 1px solid var(--rule); }
.job-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.35rem 2rem;
  align-items: baseline;
  padding: 1.4rem 1.6rem;
  text-decoration: none;
}
.job-row:hover { background: #f8f9fb; }
.job-row:hover .job-title { text-decoration: underline; text-underline-offset: 0.15em; }
.job-title { font-family: var(--font-display); font-size: var(--step-2); font-weight: 700; line-height: 1.2; }
.job-meta { display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; color: var(--graphite); }
.job-summary {
  grid-column: 1 / -1;
  color: var(--graphite);
  margin: 0.25rem 0 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---- job detail ---------------------------------------------------- */

.job-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 22rem;
  gap: 3rem;
  align-items: start;
}
.job-header .job-meta { margin: 0.5rem 0 0.25rem; }
.job-header { margin-bottom: 2rem; }
.prose h3 { margin-top: 2rem; }
.prose ul { padding-left: 1.2rem; max-width: var(--measure); }
.prose li { margin-bottom: 0.4rem; }

/* The one bold element: an honest account of what happens when you apply. */
.process {
  position: sticky;
  top: 1.5rem;
  background: var(--sheet);
  border: 2px solid var(--ink);
  border-radius: var(--radius-sheet);
  padding: 1.5rem;
}
.process h2 { font-size: var(--step-1); }
.process ol { list-style: none; margin: 0 0 1.5rem; padding: 0; counter-reset: step; }
.process li {
  counter-increment: step;
  position: relative;
  padding: 0 0 1.1rem 2.75rem;
}
.process li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  width: 1.9rem;
  height: 1.9rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 2px solid var(--ink);
  font: 700 var(--step--1) / 1 var(--font-body);
}
.process li:first-child::before { background: var(--pencil); }
.process li:not(:last-child)::after {
  content: "";
  position: absolute;
  left: calc(0.95rem - 1px);
  top: 2.1rem;
  bottom: 0.2rem;
  border-left: 2px dotted var(--graphite);
}
.process strong { display: block; }
.process .time { display: block; color: var(--graphite); font-size: var(--step--1); line-height: 1.45; margin-top: 0.15rem; }
.ai-note {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
  font-size: var(--step--1);
  color: var(--graphite);
}
.ai-note summary { cursor: pointer; font-weight: 700; color: var(--ink); }
.ai-note p { margin: 0.6rem 0 0; }

/* ---- application flow ---------------------------------------------- */

.flow { max-width: 46rem; }

.stepper {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  list-style: none;
  margin: 0 0 2.5rem;
  padding: 0;
  font-size: var(--step--1);
}
.stepper li { border-top: 4px solid var(--rule); padding-top: 0.5rem; color: var(--graphite); }
.stepper li.done { border-color: var(--ink); color: var(--ink); }
.stepper li[aria-current="step"] { border-color: var(--pencil); color: var(--ink); font-weight: 700; }

.sheet {
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sheet);
  padding: clamp(1.25rem, 3vw, 2.25rem);
}

.dropzone {
  display: block;
  border: 2px dashed var(--graphite);
  border-radius: var(--radius-sheet);
  padding: 2rem 1.5rem;
  text-align: center;
  cursor: pointer;
  background: var(--paper);
  margin-bottom: 1.75rem;
}
.dropzone.dragging { border-color: var(--ink); background: var(--pencil-soft); }
.dropzone.has-file { border-style: solid; border-color: var(--done); background: #eaf5f0; }
.dropzone span { font-weight: 400; color: var(--graphite); }
.dropzone strong { display: block; font-size: var(--step-1); font-family: var(--font-display); }
.dropzone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.dropzone:focus-within { outline: 3px solid var(--ink); outline-offset: 2px; box-shadow: 0 0 0 6px var(--pencil); }

fieldset { border: 0; margin: 0 0 1.75rem; padding: 0; }
legend { font-weight: 700; margin-bottom: 0.75rem; font-size: var(--step-1); font-family: var(--font-display); }
.choice {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.75rem;
  padding: 1rem;
  border: 2px solid var(--rule);
  border-radius: var(--radius-control);
  margin-bottom: 0.75rem;
  cursor: pointer;
  font-weight: 400;
}
.choice:has(input:checked) { border-color: var(--ink); background: #f8f9fb; }
.choice input { width: 1.25rem; height: 1.25rem; margin: 0.15rem 0 0; accent-color: var(--ink); }
.choice strong { display: block; }
.choice > span > span { color: var(--graphite); }

/* preparing */
.stage-list { list-style: none; margin: 1.5rem 0; padding: 0; }
.stage-list li {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.55rem 0;
  color: var(--graphite);
}
.stage-list .mark {
  flex: none;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  border: 2px solid var(--rule);
}
.stage-list li.done { color: var(--ink); }
.stage-list li.done .mark {
  border-color: var(--done);
  background: var(--done) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 8.5l3 3 6-7' fill='none' stroke='white' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 80% no-repeat;
}
.stage-list li.active { color: var(--ink); font-weight: 700; }
.stage-list li.active .mark {
  border-color: var(--pencil);
  border-top-color: var(--ink);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* answering */
.q-progress { display: flex; gap: 0.35rem; margin-bottom: 0.75rem; }
.q-progress span { flex: 1; height: 6px; border-radius: 3px; background: var(--rule); }
.q-progress span.answered { background: var(--ink); }
.q-progress span.current { background: var(--pencil); }
.q-count { color: var(--graphite); margin-bottom: 1.5rem; }
.q-topic { color: var(--graphite); font-size: var(--step--1); margin-bottom: 0.4rem; }
.question {
  font-family: var(--font-display);
  font-size: var(--step-2);
  font-weight: 500;
  line-height: 1.3;
  margin-bottom: 1.5rem;
  max-width: 40ch;
}
textarea { min-height: 16rem; resize: vertical; line-height: 1.6; }
.answer-meta {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin: 0.5rem 0 1.75rem;
  color: var(--graphite);
  font-size: var(--step--1);
}
.answer-status { display: flex; gap: 1rem; white-space: nowrap; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.nav-row { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }

.review-list { list-style: none; margin: 0 0 2rem; padding: 0; counter-reset: q; }
.review-list li { padding: 1.25rem 0; border-bottom: 1px solid var(--rule); }
.review-list h3 { font-size: var(--step-0); font-family: var(--font-body); margin-bottom: 0.4rem; }
.review-list p { color: var(--graphite); white-space: pre-line; margin-bottom: 0.5rem; }
.review-list .empty { color: var(--error); }

.done-mark {
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 50%;
  background: var(--done) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 8.5l3 3 6-7' fill='none' stroke='white' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 70% no-repeat;
  margin-bottom: 1.25rem;
}

.mobile-apply { display: none; }

@media (max-width: 860px) {
  .mobile-apply { display: inline-flex; width: 100%; }
  .job-layout { grid-template-columns: 1fr; gap: 2rem; }
  .process { position: static; }
  .job-row { grid-template-columns: 1fr; padding: 1.2rem; }
}

@media (prefers-reduced-motion: reduce) {
  .stage-list li.active .mark { animation: none; border-color: var(--pencil); }
}

/* ---- chat interview ---------------------------------------------------- */

.chat-flow { max-width: 50rem; }
.chat-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 0.5rem 1rem; }
.chat-head h1 { font-size: var(--step-3); margin-bottom: 0.25rem; }
.chat-log {
  min-height: 12rem;
  max-height: min(60vh, 36rem);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  padding: 1.25rem;
  margin: 1rem 0;
  scroll-behavior: smooth;
}
.intro {
  max-width: none;
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-top: 3px solid var(--ink);
  border-radius: 6px 6px var(--radius-sheet) var(--radius-sheet);
  padding: 1rem 1.4rem;
  margin-top: 1rem;
}
.intro summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  cursor: pointer;
  list-style: none;
}
.intro summary::-webkit-details-marker { display: none; }
.intro summary::after {
  content: "";
  width: 0.55rem;
  height: 0.55rem;
  border-right: 2px solid var(--graphite);
  border-bottom: 2px solid var(--graphite);
  transform: rotate(45deg);
  margin-top: -0.3rem;
  flex: none;
}
.intro details[open] summary::after { transform: rotate(-135deg); margin-top: 0.2rem; }
.intro summary:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--pencil); border-radius: 4px; }
.intro h2 { font-family: var(--font-display); font-size: var(--step-1); margin: 0; }
.intro .intro-lead { margin: 0.6rem 0 1rem; font-size: var(--step-0); line-height: 1.55; color: var(--ink); max-width: var(--measure); }
.intro-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0 0 1rem;
  background: var(--paper);
  border-radius: 8px;
}
.intro-facts div { padding: 0.6rem 0.9rem; }
.intro-facts div + div { border-left: 1px solid var(--sheet); }
.intro-facts dt { font-size: var(--step--1); color: var(--graphite); }
.intro-facts dd { margin: 0.1rem 0 0; font-family: var(--font-display); font-size: var(--step-1); font-weight: 600; }
.intro-tips { margin: 0 0 1rem; padding-left: 1.2rem; line-height: 1.55; }
.intro-tips li + li { margin-top: 0.3rem; }

.msg { max-width: 85%; display: flex; flex-direction: column; gap: 0.2rem; }
.msg-who { font-size: var(--step--1); color: var(--graphite); font-weight: 700; }
.msg-text {
  padding: 0.75rem 1rem;
  border-radius: 14px;
  white-space: pre-line;
  line-height: 1.55;
  overflow-wrap: anywhere;
}
.msg-ai { align-self: flex-start; }
.msg-ai .msg-text { background: var(--paper); border-top-left-radius: 4px; }
.msg-me { align-self: flex-end; text-align: left; }
.msg-me .msg-who { align-self: flex-end; }
.msg-me .msg-text { background: var(--ink); color: var(--sheet); border-top-right-radius: 4px; }
.msg-muted .msg-text { background: transparent; color: var(--graphite); border: 1.5px dashed var(--rule); }

.typing .msg-text { display: inline-flex; gap: 0.3rem; padding: 0.9rem 1rem; width: fit-content; }
.typing .msg-text span {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: var(--graphite);
  animation: blink 1.2s infinite ease-in-out;
}
.typing .msg-text span:nth-child(2) { animation-delay: 0.2s; }
.typing .msg-text span:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }

.chat-input {
  background: var(--sheet);
  border: 2px solid var(--ink);
  border-radius: var(--radius-sheet);
  padding: 0.75rem;
}
.chat-input textarea {
  border: 0;
  min-height: 5rem;
  padding: 0.5rem;
  resize: vertical;
}
.chat-input textarea:focus-visible { box-shadow: none; }
.chat-input:focus-within { box-shadow: 0 0 0 4px var(--pencil); }
.chat-actions { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; padding: 0.25rem 0.25rem 0; }
.chat-tools { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-top: 0.9rem; font-size: var(--step--1); }
#chat-done { margin-top: 1rem; }

@media (max-width: 560px) {
  .msg { max-width: 94%; }
  .chat-log { max-height: 55vh; padding: 0.9rem; }
  .intro { padding: 1rem; }
  .intro-facts div { padding: 0.5rem 0.6rem; }
}
@media (prefers-reduced-motion: reduce) {
  .typing .msg-text span { animation: none; opacity: 0.6; }
  .chat-log { scroll-behavior: auto; }
}
