/* Welp design system. Tokens first, then primitives, then components. */

:root {
  --paper: #f6f3eb;
  --card: #ffffff;
  --ink: #17191c;
  --muted: #676c74;
  --line: #e3dfd4;
  --accent: #0d8a5e;
  --accent-ink: #0a6b49;
  --accent-soft: #dcf2e7;
  --warn: #a8690f;
  --warn-soft: #fbeed3;
  --bad: #b8401c;
  --bad-soft: #fbe3da;
  --shadow: 0 1px 2px rgba(23, 25, 28, 0.06), 0 8px 24px rgba(23, 25, 28, 0.06);
  --radius: 14px;
  --font-display: 'Bricolage Grotesque', 'Inter', system-ui, sans-serif;
  --font-body: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, monospace;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --paper: #121417;
    --card: #1b1e23;
    --ink: #eceae3;
    --muted: #9aa0a8;
    --line: #2b3038;
    --accent: #34c98c;
    --accent-ink: #7fe0b6;
    --accent-soft: #163526;
    --warn: #e0a84a;
    --warn-soft: #3a2c12;
    --bad: #f07a55;
    --bad-soft: #3d1f16;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);
  }
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.5;
}

a {
  color: inherit;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin: 0 0 0.4em;
}

h1 {
  font-size: clamp(2rem, 6vw, 3.4rem);
}

h2 {
  font-size: clamp(1.4rem, 3.5vw, 2rem);
}

h3 {
  font-size: 1.15rem;
}

p {
  margin: 0 0 1em;
}

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

.small {
  font-size: 0.9rem;
}

.mono {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

.num {
  font-variant-numeric: tabular-nums;
}

.wrap {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 16px;
}

.narrow {
  max-width: 720px;
}

/* ---------- nav ---------- */

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 0;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.5rem;
  letter-spacing: -0.03em;
}

.logo svg {
  width: 28px;
  height: 28px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-links a:not(.btn) {
  text-decoration: none;
  color: var(--muted);
  padding: 8px 10px;
  border-radius: 8px;
}

.nav-links a:not(.btn):hover {
  color: var(--ink);
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.btn:hover {
  box-shadow: var(--shadow);
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-ink);
  border-color: var(--accent-ink);
}

.btn-lg {
  padding: 16px 28px;
  font-size: 1.1rem;
}

.btn[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ---------- cards & pills ---------- */

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
}

.stack > .card + .card,
#stage-result > .card + .card {
  margin-top: 16px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  background: var(--line);
}

.pill-ok {
  background: var(--accent-soft);
  color: var(--accent-ink);
}

.pill-warn {
  background: var(--warn-soft);
  color: var(--warn);
}

.pill-bad {
  background: var(--bad-soft);
  color: var(--bad);
}

/* ---------- landing ---------- */

.hero {
  padding: 56px 0 32px;
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 40px;
  align-items: center;
}

.hero p.lead {
  font-size: 1.2rem;
  color: var(--muted);
  max-width: 34ch;
}

.hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.badge-demo {
  justify-self: center;
  width: 100%;
  max-width: 380px;
}

.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin: 24px 0;
}

.step .n {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-weight: 700;
  margin-bottom: 10px;
}

.section {
  padding: 32px 0;
}

.spot-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.spot-tile {
  text-decoration: none;
  display: block;
}

.spot-tile:hover {
  box-shadow: var(--shadow);
}

.spot-tile .big {
  font-family: var(--font-display);
  font-size: 1.9rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

footer {
  padding: 40px 0;
  color: var(--muted);
  font-size: 0.9rem;
  border-top: 1px solid var(--line);
  margin-top: 40px;
}

/* ---------- test page ---------- */

.stage {
  display: none;
}

.stage.active {
  display: block;
}

.checklist {
  list-style: none;
  padding: 0;
  margin: 0 0 20px;
}

.checklist li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 8px 0;
}

.checklist svg {
  flex: none;
  width: 22px;
  height: 22px;
  margin-top: 2px;
}

.phases {
  display: flex;
  gap: 6px;
  list-style: none;
  padding: 0;
  margin: 0 0 24px;
  flex-wrap: wrap;
}

.phases li {
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  background: var(--line);
}

.phases li.active {
  background: var(--accent);
  color: #fff;
}

.phases li.done {
  background: var(--accent-soft);
  color: var(--accent-ink);
}

.gauge {
  text-align: center;
  padding: 24px 0 8px;
}

.gauge-value {
  font-family: var(--font-display);
  font-size: clamp(3.5rem, 14vw, 6.5rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.gauge-unit {
  font-size: 1.2rem;
  color: var(--muted);
  font-weight: 600;
}

.gauge-label {
  margin-top: 8px;
  color: var(--muted);
}

.bar {
  height: 8px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
  margin: 20px 0 8px;
}

.bar > i {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.15s linear;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.stat {
  background: var(--paper);
  border-radius: 12px;
  padding: 14px 16px;
}

.stat .v {
  font-family: var(--font-display);
  font-size: 1.9rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 6px;
}

.stat .v small {
  font-size: 0.9rem;
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
}

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.stat .k {
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 4px;
}

.hero-stats {
  grid-template-columns: 1.4fr 1.4fr 1fr 1fr;
}

.hero-stats .stat.primary .v {
  font-size: 2.8rem;
}

.caps {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px 20px;
}

.caps li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.caps svg {
  flex: none;
  width: 22px;
  height: 22px;
  margin-top: 2px;
}

.caps .d {
  color: var(--muted);
  font-size: 0.9rem;
}

.kv {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 6px 18px;
  margin: 0;
}

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

.kv dd {
  margin: 0;
}

.field {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.field input {
  flex: 1 1 220px;
  font: inherit;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
}

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

.linkbox {
  display: flex;
  gap: 8px;
  align-items: center;
  background: var(--paper);
  border-radius: 10px;
  padding: 8px 8px 8px 14px;
  margin: 6px 0 14px;
}

.linkbox code {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

.linkbox .btn {
  padding: 8px 14px;
  font-size: 0.85rem;
}

.share-grid {
  display: grid;
  grid-template-columns: 1fr 180px;
  gap: 20px;
  align-items: start;
}

.share-grid img {
  width: 100%;
  height: auto;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
}

.callout {
  border-left: 4px solid var(--warn);
  background: var(--warn-soft);
  padding: 12px 16px;
  border-radius: 8px;
  margin: 14px 0;
}

.callout.ok {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.callout.bad {
  border-color: var(--bad);
  background: var(--bad-soft);
}

pre.embed {
  background: var(--paper);
  padding: 12px 14px;
  border-radius: 10px;
  overflow-x: auto;
  font-size: 0.8rem;
  white-space: pre-wrap;
  word-break: break-all;
}

/* ---------- spot page ---------- */

.spot-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  flex-wrap: wrap;
  margin: 24px 0 16px;
}

.spot-head h1 {
  margin-bottom: 4px;
}

.two-col {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 16px;
  align-items: start;
}

.two-col > .col {
  min-width: 0;
}

.two-col > .col > .card + .card {
  margin-top: 16px;
}

.card,
.kv dd,
.share-grid > div {
  min-width: 0;
  overflow-wrap: anywhere;
}

#map {
  height: 260px;
  border-radius: 10px;
  background: var(--line);
}

.history {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.history th,
.history td {
  text-align: left;
  padding: 8px 6px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  white-space: nowrap;
}

.history td:last-child {
  white-space: normal;
  min-width: 160px;
}

.share-grid.wide {
  grid-template-columns: 1fr 340px;
}

.history th {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.history td.r,
.history th.r {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.spark {
  display: flex;
  gap: 3px;
  align-items: flex-end;
  height: 56px;
  margin: 8px 0 4px;
}

.spark i {
  flex: 1;
  background: var(--accent);
  border-radius: 3px 3px 0 0;
  min-width: 6px;
  opacity: 0.85;
}

.spark i.guest {
  background: var(--warn);
}

.legend {
  display: flex;
  gap: 14px;
  font-size: 0.85rem;
  color: var(--muted);
}

.legend i {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: var(--accent);
  margin-right: 5px;
}

.legend i.guest {
  background: var(--warn);
}

.grade {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.1rem;
}

.prose h2 {
  margin-top: 1.6em;
}

.prose ul {
  padding-left: 1.2em;
}

/* ---------- responsive ---------- */

@media (max-width: 800px) {
  .hero {
    grid-template-columns: 1fr;
    padding-top: 32px;
  }
  .steps,
  .spot-list {
    grid-template-columns: 1fr;
  }
  .stats,
  .hero-stats {
    grid-template-columns: repeat(2, 1fr);
  }
  .caps {
    grid-template-columns: 1fr;
  }
  .two-col {
    grid-template-columns: 1fr;
  }
  .share-grid {
    grid-template-columns: 1fr;
  }
  .nav-links a:not(.btn) {
    display: none;
  }
}

/* ---------- feedback ---------- */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.feedback-fab {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.08s ease, border-color 0.15s ease;
}

.feedback-fab svg {
  width: 18px;
  height: 18px;
  color: var(--accent);
}

.feedback-fab:hover {
  border-color: var(--accent);
}

.feedback-fab:active {
  transform: translateY(1px);
}

.feedback-fab[disabled] {
  opacity: 0.6;
  cursor: default;
}

.feedback-dialog {
  width: min(480px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--ink);
  box-shadow: var(--shadow);
}

.feedback-dialog::backdrop {
  background: rgba(15, 17, 20, 0.5);
}

.feedback-dialog h3 {
  font-size: 1.4rem;
}

.feedback-kinds {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 16px;
  padding: 0;
  border: 0;
}

.feedback-kinds label {
  cursor: pointer;
}

.feedback-kinds input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.feedback-kinds span {
  display: inline-block;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--paper);
  font-size: 0.92rem;
  font-weight: 600;
}

.feedback-kinds input:checked + span {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-ink);
}

.feedback-kinds input:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.feedback-label {
  display: block;
  margin: 12px 0 6px;
  font-size: 0.92rem;
  font-weight: 600;
}

.feedback-dialog textarea,
.feedback-dialog input[type='email'] {
  display: block;
  width: 100%;
  font: inherit;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
}

.feedback-dialog textarea {
  resize: vertical;
  min-height: 110px;
}

.feedback-dialog textarea:focus,
.feedback-dialog input[type='email']:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* Honeypot: off-screen rather than display:none, which some bots skip. */
.feedback-hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.feedback-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

footer {
  padding-bottom: 84px;
}

/* ---- remote hiring: checks, applicant page, result page ---- */

.stack > label + input,
.stack input[type='text'],
.stack input[type='number'],
#stage-idle input[type='text'] {
  display: block;
  width: 100%;
  box-sizing: border-box;
  font: inherit;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
}

.stack input:focus,
#stage-idle input[type='text']:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.stack .feedback-label:first-child {
  margin-top: 0;
}

.stack > .btn {
  margin-top: 16px;
}

.card.verdict-pass {
  border-color: var(--accent);
}

.card.verdict-fail {
  border-color: var(--bad);
}

table.results td.r,
table.results th.r {
  white-space: nowrap;
}

table.results td:first-child {
  white-space: normal;
  min-width: 120px;
}

details summary {
  cursor: pointer;
}

/* Pricing (D27) */
.plans {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin: 24px 0;
}
.plan h3 { margin: 0; }
.plan .price { font-size: 1.6rem; font-weight: 700; margin: 8px 0 2px; }
.plan ul { padding-left: 18px; margin: 12px 0 0; }
.plan-free { border-color: var(--accent); }
.meter { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; margin: 8px 0; }
.meter > span { display: block; height: 100%; background: var(--accent); }
.price-q { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
@media (max-width: 900px) {
  .plans { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .plans { grid-template-columns: 1fr; }
}
.nav .applicant-of { font-size: 1.25rem; }
.feedback-fab[hidden] { display: none; }
