/* =====================================================================
   The ATS tester. Loaded only by /cv-ats/, on top of gallery.css, which
   supplies the tokens, the header, the bands and the footer.

   Cards, spacing and type deliberately mirror the gallery pages: this is
   the same site, and a result panel that looked like a different product
   would read as a widget bolted on.
   ===================================================================== */

/* ---- "do you even need one" ----
   Sits under the h1, above the tool. Quiet, but it is the first thing a
   visitor reads, and for many of them it is the whole answer. */
.ats-depends {
  max-width: 46rem;
  margin-top: 1.75rem;
}

.ats-depends h2 {
  margin-bottom: 0.6rem !important;
  font-size: clamp(21px, 2.6vw, 26px);
}

/* The line breaks in this block are deliberate: short lines, one idea each,
   not a wall of prose. Slightly open leading so they read as a list of
   statements rather than a wrapped paragraph. */
.ats-depends p:last-child {
  margin-bottom: 0;
  font-size: 16.5px;
  line-height: 1.75;
  color: #4a5768;
}

/* ---- drop zone ---- */
.ats-tool {
  padding: 2.25rem 0 3rem;
}

.ats-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 2.75rem 1.5rem;
  border: 2px dashed #b9c6d6;
  border-radius: 18px;
  background: #fbfdff;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.ats-drop:hover,
.ats-drop[data-over='true'] {
  border-color: var(--teal);
  background: #f3faf9;
  box-shadow: 0 6px 22px rgba(18, 48, 74, 0.09);
}

.ats-drop-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  background: var(--teal);
  color: #fff;
  font-size: 20px;
  line-height: 1;
}

.ats-drop-main {
  font-size: 17px;
  font-weight: 600;
  color: var(--navy);
}

.ats-drop-sub {
  font-size: 13.5px;
  color: #6b7a8c;
}

.ats-status {
  margin: 0.9rem 0 0;
  text-align: center;
  font-size: 14px;
  color: var(--navy);
}

.ats-status[data-busy='true']::before {
  content: '';
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: 0.5rem;
  vertical-align: -1px;
  border: 2px solid #cbd5e1;
  border-top-color: var(--teal);
  border-radius: 999px;
  animation: ats-spin 0.7s linear infinite;
}

@keyframes ats-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .ats-status[data-busy='true']::before {
    animation: none;
  }
}

/* ---- results ---- */
.ats-results {
  margin-top: 2.5rem;
}

/* The page as drawn, next to the text a parser gets out of it. */
/* Both panes share one row height. The canvas sets it, from the page's own
   ratio; the text box stretches to match. Comparing the two only works if the
   eye can travel straight across, and a short text box beside a tall page
   reads as if the extraction stopped early. */
.ats-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.4rem;
  align-items: stretch;
}

.ats-pane {
  margin: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.ats-pane figcaption {
  margin-bottom: 0.55rem;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: #8b98a8;
}

.ats-pane canvas {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--rule);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(18, 48, 74, 0.04), 0 8px 24px rgba(18, 48, 74, 0.07);
}

/* flex-basis 0, so the extracted text never drives the row height: it takes
   the space the page preview defines, and scrolls inside it. */
.ats-pane pre {
  margin: 0;
  flex: 1 1 0;
  min-height: 0;
  overflow: auto;
  border: 1px solid var(--rule);
  border-radius: 14px;
  background: #f8fafc;
  color: #3c4959;
  padding: 1.15rem 1.25rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* ---- the verdict ----
   The answer, and it has to read as one. A white card with a hairline blended
   into a page already made of white cards, so the state carries a tinted
   surface, its own border and a filled glyph. It is the only element on the
   page allowed to be loud. */
.ats-verdict {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 1.1rem;
  margin-top: 2.5rem;
  border: 1.5px solid #cbd5e1;
  border-radius: 18px;
  background: #f8fafc;
  padding: 1.8rem 1.9rem;
  box-shadow: 0 10px 30px rgba(18, 48, 74, 0.1);
}

.ats-verdict::before {
  content: '';
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border-radius: 999px;
  background: #94a3b8;
  color: #fff;
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
}

.ats-verdict[data-state='pass'] {
  border-color: #86efac;
  background: linear-gradient(180deg, #f0fdf4 0%, #ffffff 100%);
}
.ats-verdict[data-state='pass']::before {
  content: '✓';
  background: #16a34a;
}

.ats-verdict[data-state='risky'] {
  border-color: #fcd34d;
  background: linear-gradient(180deg, #fffbeb 0%, #ffffff 100%);
}
.ats-verdict[data-state='risky']::before {
  content: '!';
  background: #d97706;
}

.ats-verdict[data-state='blocked'] {
  border-color: #fca5a5;
  background: linear-gradient(180deg, #fef2f2 0%, #ffffff 100%);
}
.ats-verdict[data-state='blocked']::before {
  content: '✕';
  background: #dc2626;
}

.ats-verdict-body {
  min-width: 0;
}

.ats-verdict-title {
  margin: 0 0 0.45rem !important;
  font-family: var(--serif);
  font-size: clamp(25px, 3.4vw, 34px);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--navy);
}

.ats-verdict-line {
  margin: 0 !important;
  font-size: 16.5px;
  line-height: 1.6;
  color: #46566a;
}

/* ---- the checks, always visible ---- */
.ats-detail-block {
  margin-top: 2rem;
}

.ats-detail-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.6rem;
  margin: 0 0 0.85rem !important;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: #8b98a8;
}

.ats-summary {
  font-weight: 500;
  font-size: 12px;
  letter-spacing: 0.02em;
  text-transform: none;
  color: #9aa7b5;
}

/* ---- check list ----
   Same card as .gl-qa on the gallery pages: 1px rule, 14px radius, white. */
/* Six tracks so a card can be a third of a row (span 2) or a half (span 3).
   The last two carry the longest text, so they get the wider slot and close
   the grid without leaving a hole. */
.ats-list {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.8rem;
  /* Cards take their own height instead of stretching to the tallest in the
     row: one long remediation note would otherwise blow its two neighbours
     up into large empty boxes. */
  align-items: start;
  margin: 0.5rem 0 0;
  padding: 0;
  list-style: none;
}

.ats-check {
  grid-column: span 2;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--rule);
  border-radius: 14px;
  background: #fff;
  padding: 1.1rem 1.2rem;
}

/* Three per row, and the last two widen to close a ragged row — but only when
   the count actually leaves two over. `:nth-child(10):nth-last-child(2)`
   matches nothing unless there are exactly eleven cards; at twelve the grid
   divides evenly into four rows, and firing the rule anyway would push the
   twelfth card onto a line of its own. */
.ats-check:nth-child(10):nth-last-child(2),
.ats-check:nth-child(10):nth-last-child(2) ~ .ats-check {
  grid-column: span 3;
}

/* A lone card — a PDF with no text layer reports one check — fills the row
   rather than sitting as an orphan half. */
.ats-check:only-child {
  grid-column: 1 / -1;
}

.ats-check-head {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0 0 0.45rem !important;
}

.ats-dot {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #cbd5e1;
}

.ats-check[data-level='ok'] .ats-dot {
  background: #16a34a;
}
.ats-check[data-level='warn'] .ats-dot {
  background: #d97706;
}
.ats-check[data-level='fail'] .ats-dot {
  background: #dc2626;
}

.ats-check-head b {
  flex: 1 1 auto;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--navy);
}

/* The status is what the eye scans down the column, so it is coloured and
   legible — kept to the right of the title, never as a left-hand label. */
.ats-badge {
  flex: 0 0 auto;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: #eef2f6;
  color: #64748b;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.ats-check[data-level='ok'] .ats-badge {
  background: #dcfce7;
  color: #15803d;
}
.ats-check[data-level='warn'] .ats-badge {
  background: #fef3c7;
  color: #b45309;
}
.ats-check[data-level='fail'] .ats-badge {
  background: #fee2e2;
  color: #b91c1c;
}

.ats-detail {
  margin: 0 !important;
  font-size: 14px;
  line-height: 1.55;
  color: #4a5768;
}

/* Only present on warn and fail. Fixed text, written in advance. */
.ats-fix {
  margin: 0.7rem 0 0 !important;
  padding-top: 0.7rem;
  border-top: 1px solid var(--rule);
  font-size: 13.5px;
  line-height: 1.55;
  color: #3c4959;
}

/* ---- call to action ---- */
.ats-cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.85rem;
  margin-top: 2rem;
}

.ats-cta-btn,
.ats-again {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  min-height: 50px;
  padding: 0 1.6rem;
  border-radius: 12px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.005em;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease,
    border-color 0.15s ease;
}

.ats-cta-btn {
  border: 1px solid transparent;
  background: linear-gradient(180deg, #1b4363 0%, var(--navy) 100%);
  color: #fff !important;
  box-shadow: 0 6px 18px rgba(18, 48, 74, 0.28);
}

/* The arrow lives in CSS so the button's text stays a plain, translatable
   string in the markup. */
.ats-cta-btn::after {
  content: '→';
  font-size: 17px;
  transition: transform 0.15s ease;
}

.ats-cta-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 26px rgba(18, 48, 74, 0.34);
}

.ats-cta-btn:hover::after {
  transform: translateX(3px);
}

.ats-again {
  border: 1.5px solid #d5dee8;
  background: #fff;
  color: var(--navy);
}

.ats-again:hover {
  transform: translateY(-2px);
  border-color: var(--teal);
  box-shadow: 0 8px 20px rgba(18, 48, 74, 0.12);
}

.ats-cta-btn:active,
.ats-again:active {
  transform: translateY(0);
}

.ats-cta-btn:focus-visible,
.ats-again:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  .ats-cta-btn,
  .ats-again,
  .ats-cta-btn::after {
    transition: none;
  }
  .ats-cta-btn:hover,
  .ats-again:hover {
    transform: none;
  }
}

/* Two per row on a tablet, one on a phone: three cards side by side stop
   holding a sentence somewhere around 900px. */
@media (max-width: 1040px) {
  .ats-check,
  .ats-check:nth-child(10):nth-last-child(2),
  .ats-check:nth-child(10):nth-last-child(2) ~ .ats-check {
    grid-column: span 3;
  }
}

@media (max-width: 700px) {
  .ats-check,
  .ats-check:nth-child(10):nth-last-child(2),
  .ats-check:nth-child(10):nth-last-child(2) ~ .ats-check {
    grid-column: 1 / -1;
  }
}

@media (max-width: 820px) {
  .ats-split {
    grid-template-columns: 1fr;
  }

  /* Stacked, there is no neighbour to match, so the text box goes back to a
     fixed height instead of collapsing onto its zero basis. */
  .ats-pane pre {
    flex: 0 0 auto;
    height: 20rem;
  }

  .ats-verdict {
    gap: 0.85rem;
    padding: 1.4rem 1.25rem;
  }

  .ats-verdict::before {
    width: 38px;
    height: 38px;
    font-size: 20px;
  }

  .ats-cta-btn,
  .ats-again {
    flex: 1 1 100%;
  }
}
