/*
  /grade only. Loaded after the site's shared /styles.css, so the header, footer, buttons,
  cards, colors and Inter type are the same as every other promptvu.com page.
  Every rule is scoped under body.pv-grade. Other pages never load this file.
  Uses the site's own variables from styles.css (--accent, --accent-text, --text, --bg-2 and so on).

  Interaction: a guided, chat-style flow. One question at a time arrives as a message,
  the rep's tap appears as their reply, playback lines echo back, and a progress cue
  sits under the site header.
*/

body.pv-grade [hidden] { display: none !important; }

/* Intro uses the page background (white, like other pages). The question, email and
   results screens sit on the light grey --bg-2, and the header blends into it. */
body.pv-grade:has(#landing[hidden]) { background: var(--bg-2); }
body.pv-grade:has(#landing[hidden]) header:not(.scrolled):not(.menu-open) { background: transparent; }

/* ---------- Focus rings: the site's own (styles.css nav) ---------- */
body.pv-grade main .btn:focus-visible,
body.pv-grade main button:focus-visible,
body.pv-grade main a:focus-visible,
body.pv-grade main input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
body.pv-grade .btn[disabled] { opacity: .55; cursor: not-allowed; }

/* ---------- Shared ---------- */
body.pv-grade .ar-shell { max-width: 720px; margin: 0 auto; padding: 32px 20px 72px; }
body.pv-grade .ar-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: var(--shadow); padding: 28px 22px;
}

/* ---------- Intro (#landing): the site's page-head hero ---------- */
body.pv-grade #landing { padding: 72px 0 72px; }
body.pv-grade #landing h1 { margin: 14px auto 0; max-width: 900px; }
body.pv-grade #landing .ctas { margin-top: 30px; }
body.pv-grade #landing #start { min-height: 52px; padding: 0 40px; font-size: 16px; }
body.pv-grade #landing .jobs-grid { max-width: 1000px; margin: 48px auto 0; text-align: left; }
body.pv-grade #landing .job { padding: 22px 24px; flex-direction: row; align-items: center; gap: 16px; }
body.pv-grade #landing .job h3 { margin: 0; font-size: 18px; }

/* ---------- Chat flow ---------- */
/* Locked question screen (Dec 4 redesign): from Start until results the window never scrolls.
   The header stays on top, the progress row under it, and one panel fills the rest and scrolls inside itself. */
body.pv-grade { --pv-head: 75px; }
body.pv-grade.pv-lock { overflow: hidden; }
body.pv-grade.pv-lock .site-foot { display: none; }              /* the page can't scroll to it anyway */
body.pv-grade .chat {
  max-width: 720px; margin: 0 auto; padding: 0 16px;
  display: flex; flex-direction: column;
  height: calc(100vh - var(--pv-head));                           /* fallback */
  height: calc(100dvh - var(--pv-head));
  min-height: 0;
}
body.pv-grade.pv-kb .chat { height: calc(var(--pv-vvh) - var(--pv-head)); }   /* iOS keyboard open */
body.pv-grade .chat-top {
  position: static; flex: none; display: flex; align-items: center; gap: 12px;
  padding: 14px 0; background: var(--bg-2);
}
body.pv-grade .chat-scroll {
  position: relative;                                             /* offsetTop of children is measured from here */
  flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch; padding: 4px 2px 24px;       /* 2px so focus rings aren't clipped */
  display: flex; flex-direction: column;
  scroll-padding: 16px 0 24px;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 16px);
  mask-image: linear-gradient(to bottom, transparent 0, #000 16px);   /* soft fade under the progress row */
}
body.pv-grade .chat-scroll > .thread { margin-top: auto; }       /* short threads sit at the bottom, like a chat */
body.pv-grade .back {
  width: 44px; height: 44px; flex: none; border-radius: 10px; border: 1px solid var(--border-2);
  background: var(--surface); color: var(--text-2); font-size: 20px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; padding: 0; font-family: inherit;
}
body.pv-grade .back[disabled] { opacity: .4; cursor: default; }
body.pv-grade .bar { flex: 1; height: 8px; border-radius: 99px; background: var(--border-2); overflow: hidden; }
body.pv-grade .bar i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 99px; transition: width .45s ease; }
body.pv-grade .left { font-size: 14px; color: var(--text-2); font-weight: 600; white-space: nowrap; min-width: 0; }

body.pv-grade .thread { display: flex; flex-direction: column; gap: 10px; padding: 8px 0 4px; }

/* styles.css has a global .msg (form notice box). Reset it here; grade.js uses .msg for chat rows. */
body.pv-grade .msg {
  margin: 0; padding: 0; border-radius: 0; font-size: inherit; background: none; border: 0;
  max-width: 88%; animation: pv-in .32s ease both;
}
body.pv-grade .msg.bot { align-self: flex-start; }
body.pv-grade .msg.me { align-self: flex-end; }
body.pv-grade .bubble { border-radius: 18px; padding: 12px 16px; font-size: 16px; line-height: 1.5; }
body.pv-grade .bot .bubble { background: var(--surface); border: 1px solid var(--border); border-top-left-radius: 6px; box-shadow: 0 1px 2px rgba(15, 23, 42, .04); }
body.pv-grade .me .bubble { background: var(--accent); color: #fff; border-top-right-radius: 6px; }
body.pv-grade .bot .bubble.q { font-size: 20px; line-height: 1.3; font-weight: 700; letter-spacing: -.01em; }
body.pv-grade .bot .bubble.leadin { background: var(--accent-soft); color: var(--accent-text); border-color: transparent; font-weight: 600; font-size: 15px; }
body.pv-grade .bot .bubble.playback { background: var(--bg-2); color: var(--text); border-style: dashed; }
body.pv-grade .bot .bubble.q:not(.past) { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); color: var(--text); }
/* Answered questions look muted through size and weight, not opacity (contrast, F1). */
body.pv-grade .thread .past { opacity: 1; }
body.pv-grade .thread .past.q { font-size: 16px; font-weight: 600; color: var(--text-2); background: var(--surface); }

/* Typing dots (styles.css also styles .typing for the home page story; this wins here). */
body.pv-grade .bubble.typing { display: inline-flex; gap: 5px; align-items: center; padding: 14px 16px; }
body.pv-grade .bubble.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); opacity: .35; animation: pv-dot 1s infinite ease-in-out; }
body.pv-grade .bubble.typing i:nth-child(2) { animation-delay: .15s; }
body.pv-grade .bubble.typing i:nth-child(3) { animation-delay: .3s; }

/* Composer: where the rep answers. */
body.pv-grade .composer { margin-top: 14px; animation: pv-in .32s ease both; }
body.pv-grade .opts { display: grid; gap: 10px; }
body.pv-grade .opt {
  display: flex; align-items: center; width: 100%; min-height: 56px; padding: 12px 18px; text-align: left;
  border: 1.5px solid var(--border-2); border-radius: 12px; background: var(--surface); font: inherit; font-size: 16px;
  font-weight: 600; color: var(--text); cursor: pointer; transition: border-color .15s, background .15s, transform .1s;
}
body.pv-grade .opt:hover { border-color: var(--accent); }
body.pv-grade .opt:active { transform: scale(.99); }
body.pv-grade .opt[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); }
body.pv-grade .opt.cap::first-letter { text-transform: uppercase; }
body.pv-grade .composer .btn { margin-top: 14px; }
body.pv-grade .q-help { margin: 0 0 12px; font-size: 15px; line-height: 1.5; color: var(--text-2); }

/* "Other, tell us": a dashed option that opens a short text box. */
body.pv-grade .opt-other { border-style: dashed; color: var(--text-2); }
body.pv-grade .opt-other[aria-expanded="true"] { border-color: var(--accent); color: var(--accent-text); background: var(--accent-soft); }
body.pv-grade .other-box { margin-top: 12px; }
body.pv-grade .other-text {
  display: block; width: 100%; min-height: 96px; border: 1px solid var(--border-2); border-radius: 10px; background: var(--input);
  padding: 12px 14px; font: inherit; font-size: 16px; line-height: 1.5; color: var(--text); resize: vertical;
}
body.pv-grade .other-text:focus { outline: none; border-color: var(--accent-text); background: var(--surface); box-shadow: 0 0 0 3px rgba(46, 111, 255, .25); }
body.pv-grade .other-help { margin: 8px 0 0; font-size: 14px; line-height: 1.5; color: var(--text-2); }
body.pv-grade .turnstile { margin: 0 0 14px; }
body.pv-grade .turnstile:empty { display: none; }
body.pv-grade .row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
body.pv-grade .err { color: #b91c1c; font-size: 14px; margin-top: 8px; }

/* ---------- Email step (unlock): style only ---------- */
body.pv-grade .teaser { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 22px; }
body.pv-grade .teaser .tier { grid-column: 1 / -1; border-radius: 12px; background: var(--accent-soft); padding: 18px; }
body.pv-grade .teaser .k { font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-text); }
body.pv-grade .teaser .v { font-size: 28px; font-weight: 800; margin-top: 6px; }
body.pv-grade .teaser .blur { border-radius: 12px; background: var(--raised); padding: 16px; overflow: hidden; }
body.pv-grade .teaser .blur .k { color: var(--text-2); }
body.pv-grade .teaser .blur .v { font-size: 22px; white-space: nowrap; filter: blur(9px); user-select: none; }
body.pv-grade .teaser .blur.wide { grid-column: 1 / -1; }
body.pv-grade .field { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 0; }
body.pv-grade .field label { font-size: 14px; font-weight: 600; color: var(--text-2); }
body.pv-grade .field input {
  height: 50px; min-height: 50px; border: 1px solid var(--border-2); border-radius: 10px; background: var(--input);
  padding: 0 14px; font: inherit; font-size: 16px; color: var(--text); width: 100%;
}
/* The site's own input focus style (styles.css .field input:focus). */
body.pv-grade .field input:focus { outline: none; border-color: var(--accent-text); background: var(--surface); box-shadow: 0 0 0 3px rgba(46, 111, 255, .25); }
body.pv-grade .consent { font-size: 14px; line-height: 1.6; color: var(--text-2); margin: 22px 0 14px; }
body.pv-grade .consent a { text-decoration: underline; }
body.pv-grade .check { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; color: var(--text); margin-bottom: 18px; }
body.pv-grade .check input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--accent); flex: none; }
body.pv-grade .agree { width: 100%; min-height: 52px; font-size: 16px; }
body.pv-grade .agree[aria-busy="true"] { cursor: progress; opacity: .75; }

/* ---------- Results (Dec 4 redesign: one card, tighter hierarchy) ---------- */
body.pv-grade .results.ar-shell { padding: 32px 16px 56px; }
body.pv-grade .results .ar-card { padding: 24px 18px; }
body.pv-grade .results .eyebrow { margin: 0; }
body.pv-grade .score-line { margin: 8px 0 0; font-size: 15px; font-weight: 600; color: var(--text-2); }
/* Stat block (Dec 4, 2:15 PM): label in the site eyebrow style over a big bold value. Under 640px each stat is a
   full-width row, label left and value right. From 640px, 3 equal columns. Values size to their box (container
   units), capped at the site h2 sizes (30px under 640px, 44px above), so long band names like "Experimenting"
   never overflow a column. */
body.pv-grade .stats { display: grid; gap: 10px; margin: 16px 0 0; padding: 0; }
body.pv-grade .stat { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0;
  border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; container-type: inline-size; }
body.pv-grade .stat .k { margin: 0; flex: 1 1 0; min-width: 0; font-size: 13px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--accent-text); line-height: 1.35; }
body.pv-grade .stat .v { margin: 0; flex: 0 0 auto; max-width: 62%; white-space: nowrap; text-align: right; font-weight: 800; line-height: 1.1;
  letter-spacing: -.02em; color: var(--text); font-size: 24px; font-size: min(30px, 8.6cqi); overflow-wrap: normal; hyphens: none; }
body.pv-grade .nobody { margin: 16px 0 0; font-size: 16px; line-height: 1.55; color: var(--text-2); }
body.pv-grade .sec { font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--accent-text); margin: 28px 0 12px; }
body.pv-grade .tip { border: 1px solid var(--border); border-radius: 12px; padding: 16px; margin: 0 0 12px; background: var(--surface); animation: pv-in .35s ease both; }
body.pv-grade .tip b { display: block; font-size: 17px; line-height: 1.35; }
body.pv-grade .tip > p { margin: 6px 0 0; font-size: 15px; line-height: 1.55; color: var(--text-2); }
body.pv-grade .tip .meta { font-size: 13px; color: var(--text-2); margin-top: 6px; }
body.pv-grade .tip .howto { margin: 12px 0 0; color: var(--text); }
body.pv-grade .tip .howto b { display: inline; font-size: inherit; }
body.pv-grade .tip .copybox { margin-top: 12px; box-shadow: none; border-radius: 10px; }
body.pv-grade .tip .copybox-head { padding: 8px 12px; }
body.pv-grade .tip .copybox-head b { font-size: 13px; font-weight: 700; color: var(--text-2); }
body.pv-grade .tip .copybox pre { padding: 12px 14px; max-height: none; font: 14px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
body.pv-grade .copy-note { margin: 8px 0 0; font-size: 14px; color: var(--text-2); }
body.pv-grade .setup { border-radius: 12px; background: var(--bg-2); border: 1px solid var(--border); padding: 16px; }
body.pv-grade .setup p { margin: 0 0 8px; font-size: 16px; line-height: 1.5; }
body.pv-grade .setup p:last-child { margin: 0; }
body.pv-grade .next { margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--border); }
body.pv-grade .next .sec { margin-top: 0; }
body.pv-grade .next p { margin: 0 0 14px; font-size: 16px; line-height: 1.55; color: var(--text-2); }
body.pv-grade .next .btn { width: 100%; }
body.pv-grade .next .next-ai { margin: 20px 0 14px; }
body.pv-grade .retake { margin: 16px 0 0; text-align: center; font-size: 15px; font-weight: 600; color: var(--text-2); }
body.pv-grade .results { animation: pv-in .45s ease both; }
body.pv-grade .sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

@keyframes pv-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes pv-dot { 0%, 80%, 100% { opacity: .35; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
@media (prefers-reduced-motion: reduce) {
  body.pv-grade main * { animation: none !important; transition: none !important; }
}

@media (max-width: 640px) {
  body.pv-grade #landing { padding: 48px 0 56px; }
  body.pv-grade #landing .jobs-grid { margin-top: 36px; gap: 12px; }
  body.pv-grade #landing .job { padding: 18px 20px; }
}

/* Grade colors (Kayden 3:22 PM, Dec 4): Grade value only. All pass WCAG AA (4.5:1+) on the white card (#ffffff). */
body.pv-grade .stat .v.grade-aplus { color: #15803d; } /* green, 5.02:1 */
body.pv-grade .stat .v.grade-a { color: #0f766e; }     /* teal-green, 5.47:1 */
body.pv-grade .stat .v.grade-b { color: #4d7c0f; }     /* yellow-green, 4.99:1 */
body.pv-grade .stat .v.grade-c { color: #b45309; }     /* amber, 5.02:1 */
body.pv-grade .stat .v.grade-d { color: #c2410c; }     /* orange, 5.18:1 */
body.pv-grade .stat .v.grade-f { color: #b91c1c; }     /* red, 6.47:1 */

/* Marketing re-check R2 (build o): stop the label overlapping long values on narrow phones. */
@media (max-width: 639px) {
  body.pv-grade .stat .k{min-width:min-content}
}
/* Marketing re-check (grade.css n): keep long values inside the content edge on phones. */
@media (max-width:639px){ body.pv-grade .stat .v{font-size:min(30px,7.4cqi)} }
@media (max-width:359px){body.pv-grade .stat{flex-direction:column;align-items:flex-start;gap:4px} body.pv-grade .stat .v{text-align:left;max-width:none} body.pv-grade .stat .v{font-size:22px}}

@media (min-width: 640px) {
  body.pv-grade .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  body.pv-grade .stat { display: block; padding: 16px 14px; }
  body.pv-grade .stat .v { margin-top: 8px; max-width: none; text-align: left; font-size: 22px; font-size: min(44px, calc(100cqi / 7.3)); }
  /* Marketing QA D1 (build n): keep all three values on one baseline when a label wraps to 2 lines. */
  body.pv-grade .stat{display:flex;flex-direction:column;align-items:stretch;justify-content:space-between;gap:8px;}
  body.pv-grade .stat .k{flex:0 0 auto;}
  body.pv-grade .stat .v{margin-top:0;}
}

@media (min-width: 700px) {
  body.pv-grade .ar-card { padding: 40px; }
  body.pv-grade .bot .bubble.q { font-size: 24px; }
  body.pv-grade .thread .past.q { font-size: 16px; }
  body.pv-grade .teaser { grid-template-columns: 1.2fr 1fr 1fr 1.4fr; }
  body.pv-grade .teaser .tier, body.pv-grade .teaser .blur.wide { grid-column: auto; }
  body.pv-grade .results.ar-shell { padding: 48px 20px 72px; }
  body.pv-grade .results .ar-card { padding: 36px 40px; }
  body.pv-grade .nobody { font-size: 17px; }
  body.pv-grade .tip { padding: 18px 20px; }
  body.pv-grade .next .btn { width: auto; }
}
