/* Lead Response Grader.
   Sober and legible on purpose. The buyer is a mortgage professional deciding
   whether the person behind this is competent, not whether the page is clever. */

:root {
  color-scheme: light dark;
  --bg: #fbfbfa;
  --card: #ffffff;
  --ink: #16181d;
  --muted: #5c6270;
  --line: #e3e4e8;
  --accent: #1c4e80;
  --accent-ink: #ffffff;
  --ok: #14713d;
  --bad: #9a2622;
  --code-bg: #f4f4f3;
  --radius: 0.5rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161a;
    --card: #1b1e24;
    --ink: #e8e9ec;
    --muted: #9aa1ae;
    --line: #2b2f38;
    --accent: #5b9bd5;
    --accent-ink: #0d1014;
    --ok: #5fc98a;
    --bad: #e88b86;
    --code-bg: #22262e;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 0 0 4rem;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: 44rem;
  margin: 0 auto;
  padding: 0 1.25rem;
}

header.wrap { padding-top: 3rem; }

.eyebrow {
  margin: 0 0 0.5rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}

h1 {
  margin: 0 0 0.75rem;
  font-size: clamp(1.6rem, 4.5vw, 2.3rem);
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.lede {
  margin: 0 0 2.5rem;
  font-size: 1.05rem;
  color: var(--muted);
}

h2 { font-size: 1.05rem; margin: 0 0 1rem; }
h3 { font-size: 1rem; margin: 0 0 0.5rem; }
h4 { font-size: 0.95rem; margin: 1.5rem 0 0.4rem; }

.opt {
  font-weight: 400;
  font-size: 0.8rem;
  color: var(--muted);
}

/* --- cards and form ------------------------------------------------------- */

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
}

details.card > summary {
  cursor: pointer;
  list-style: none;
}
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary h2 {
  display: inline;
  margin: 0;
}
details.card > summary::before {
  content: "+ ";
  color: var(--accent);
  font-weight: 700;
}
details.card[open] > summary::before { content: "\2212  "; }
details.card[open] > summary { margin-bottom: 1rem; }

.field { margin-bottom: 1rem; }
.field:last-child { margin-bottom: 0; }

label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.9rem;
  font-weight: 600;
}

input[type="datetime-local"],
input[type="number"],
input[type="text"],
input[type="url"],
input[type="email"],
textarea {
  width: 100%;
  padding: 0.55rem 0.65rem;
  font: inherit;
  font-size: 0.95rem;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 0.35rem;
}

input:focus, textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

textarea { resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.85rem; }

.check {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-top: 0.6rem;
  font-weight: 400;
  font-size: 0.9rem;
  color: var(--muted);
}
.check input { width: auto; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  gap: 1rem;
}

.note {
  margin: 0.6rem 0 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.muted { color: var(--muted); }

.error {
  margin: 0.75rem 0 0;
  padding: 0.6rem 0.75rem;
  border-left: 3px solid var(--bad);
  background: var(--card);
  color: var(--bad);
  font-size: 0.9rem;
}

/* --- buttons -------------------------------------------------------------- */

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
  margin: 1.25rem 0 0;
}

button, .primary {
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.6rem 1.1rem;
  border-radius: 0.35rem;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}

.primary {
  background: var(--accent);
  color: var(--accent-ink);
}
.primary:hover { filter: brightness(1.1); }

.ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}
.ghost:hover { border-color: var(--accent); color: var(--accent); }

/* --- report --------------------------------------------------------------- */

.report {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 2px solid var(--line);
}

.report > h2 {
  font-size: 1.5rem;
  letter-spacing: -0.01em;
}

.scorecard {
  display: flex;
  gap: 1.25rem;
  align-items: center;
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 4px solid var(--muted);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.scorecard .letter {
  font-size: 3.5rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.04em;
  min-width: 3rem;
  text-align: center;
}

.scorecard .time {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
}
.scorecard .headline { margin: 0.15rem 0; font-weight: 600; }
.scorecard p:last-child { margin-bottom: 0; }
.score-detail p { margin: 0.25rem 0; }

.grade-A { border-left-color: var(--ok); }
.grade-A .letter { color: var(--ok); }
.grade-B { border-left-color: #6a9b3e; }
.grade-B .letter { color: #6a9b3e; }
.grade-C { border-left-color: #b8860b; }
.grade-C .letter { color: #b8860b; }
.grade-D { border-left-color: #c05621; }
.grade-D .letter { color: #c05621; }
.grade-F { border-left-color: var(--bad); }
.grade-F .letter { color: var(--bad); }

.block {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.block p { margin: 0 0 0.75rem; }
.block p:last-child { margin-bottom: 0; }

table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.75rem 0;
  font-size: 0.92rem;
}
th, td {
  text-align: left;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
th { font-weight: 500; color: var(--muted); padding-right: 1rem; }
td { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
tr.highlight th, tr.highlight td {
  border-bottom: none;
  padding-top: 0.9rem;
  color: var(--ink);
  font-size: 1rem;
}
tr.highlight td { font-size: 1.15rem; }

pre {
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: 0.35rem;
  padding: 1rem;
  margin: 0.75rem 0 0;
  white-space: pre-wrap;
  word-wrap: break-word;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.85rem;
  line-height: 1.55;
  overflow-x: auto;
}

.study {
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--line);
}
.study:last-of-type { border-bottom: none; }
.study p { margin: 0 0 0.3rem; }
.study-title { font-weight: 600; }
.study-title a { color: var(--accent); }

.cta { border-color: var(--accent); }

.capture { margin-top: 1.25rem; }
.inline {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.inline input { flex: 1 1 14rem; }

.status { margin: 0.6rem 0 0; font-size: 0.88rem; font-weight: 600; }
.status.ok { color: var(--ok); }
.status.bad { color: var(--bad); }

footer.wrap { margin-top: 3rem; }
.fine {
  font-size: 0.78rem;
  color: var(--muted);
  border-top: 1px solid var(--line);
  padding-top: 1rem;
}

@media print {
  form, .capture, .actions, footer { display: none; }
  .report { border: none; margin: 0; }
  body { background: #fff; color: #000; }
}
