/* AnswerScan — light, trustworthy, friendly-professional design system */
:root {
  --bg: #f8fafc;
  --card: #ffffff;
  --fg: #0f172a;
  --secondary: #475569;
  --border: #e4e5e7;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --ok: #16a34a;
  --bad: #dc2626;
  --muted-bg: #f1f5f9;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 10px 24px -14px rgba(15, 23, 42, .18);
  --shadow-lift: 0 2px 4px rgba(15, 23, 42, .05), 0 18px 40px -18px rgba(37, 99, 235, .3);
  --ink: #0f172a;   /* legacy alias */
  --muted: #475569; /* legacy alias */
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: "Open Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.65;
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: "Poppins", system-ui, -apple-system, sans-serif;
  font-weight: 700;
  line-height: 1.2;
  color: var(--fg);
}

h1 { font-size: 2.75rem; letter-spacing: -.02em; }
h2 { font-size: 2rem; letter-spacing: -.01em; }
h3 { font-size: 1.5rem; }

p { margin: .6rem 0 1rem; }

a { color: var(--accent); }
a:hover { color: var(--accent-hover); }

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---- Layout shell ---- */
nav, main, footer { max-width: 820px; margin: 0 auto; padding: 0 1.25rem; }

nav {
  display: flex;
  gap: 1.1rem;
  align-items: baseline;
  padding-top: 1.25rem;
  padding-bottom: .25rem;
  flex-wrap: wrap;
}
nav .brand {
  font-family: "Poppins", system-ui, sans-serif;
  font-weight: 700;
  font-size: 1.3rem;
  text-decoration: none;
  color: var(--fg);
}
nav .by { color: var(--secondary); font-size: .875rem; margin-right: auto; }
nav a { color: var(--accent); text-decoration: none; font-weight: 600; font-size: .95rem; }
nav a:hover { text-decoration: underline; }

main { padding-top: 1rem; padding-bottom: 3.5rem; }

/* contextual back link at the top of a scan result page */
.backtop { display: inline-block; margin-bottom: .85rem; font-weight: 600; font-size: .95rem; color: var(--accent); text-decoration: none; }
.backtop:hover { text-decoration: underline; }

footer {
  border-top: 1px solid var(--border);
  padding-top: 1.75rem;
  padding-bottom: 3rem;
  margin-top: 3rem;
  color: var(--secondary);
  font-size: .95rem;
}
footer a { color: var(--accent); }

/* ---- Buttons ---- */
.btn, .btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: .7rem 1.4rem;
  font-family: "Open Sans", system-ui, sans-serif;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
  border: 2px solid transparent;
}
.btn {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }
.btn:disabled { opacity: .65; cursor: default; }
.btn-secondary {
  background: var(--card);
  color: var(--fg);
  border-color: var(--border);
  margin-left: .5rem;
}
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }

/* ---- Hero ---- */
.hero { padding: 2.5rem 0 1.5rem; }
.hero h1 { margin: 0 0 1rem; max-width: 18ch; }
.hero > p { font-size: 1.2rem; color: var(--secondary); max-width: 62ch; }

#scanform, .gate {
  display: flex;
  gap: .6rem;
  margin: 1.5rem 0 .75rem;
  flex-wrap: wrap;
}
#scanform input, .gate input {
  flex: 1;
  min-width: 240px;
  min-height: 48px;
  padding: .75rem 1rem;
  font-size: 1rem;
  color: var(--fg);
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
}
#scanform input::placeholder, .gate input::placeholder { color: #94a3b8; }
#scanform input:focus, .gate input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .18);
}

.muted { color: var(--secondary); font-size: .95rem; }

/* ---- Section rhythm ---- */
main > section { margin-top: 2.75rem; }
main > section > h2 { margin-bottom: 1.25rem; }

/* ---- How it works: numbered step cards (list semantics kept) ---- */
.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
  counter-reset: step;
}
.steps li {
  counter-increment: step;
  position: relative;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 3rem 1.35rem 1.35rem;
  box-shadow: var(--shadow);
  color: var(--secondary);
}
.steps li::before {
  content: counter(step);
  position: absolute;
  top: 1.35rem;
  left: 1.35rem;
  width: 2rem;
  height: 2rem;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius-sm);
  font-family: "Poppins", sans-serif;
  font-weight: 700;
  font-size: 1rem;
}
.steps li strong {
  display: block;
  margin-bottom: .25rem;
  font-family: "Poppins", sans-serif;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--fg);
}

/* ---- FAQ accordion (details/summary, no JS) ---- */
.faq { display: grid; gap: .75rem; }
.faq-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0 1.35rem;
  box-shadow: var(--shadow);
}
.faq-item summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.15rem 0;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary h3 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
  flex: 1;
}
.faq-item summary::after {
  content: "";
  flex: none;
  width: .7rem;
  height: .7rem;
  border-right: 2px solid var(--secondary);
  border-bottom: 2px solid var(--secondary);
  transform: rotate(45deg);
  transform-origin: center;
  margin-top: -.25rem;
}
.faq-item[open] summary::after { transform: rotate(-135deg); margin-top: .1rem; }
.faq-item > p {
  margin: 0 0 1.2rem;
  color: var(--secondary);
}

/* ---- Pricing strip ---- */
.plans {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
}
.plan {
  position: relative;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 1.35rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}
.plan.highlight {
  border-color: var(--accent);
  border-width: 2px;
  box-shadow: var(--shadow-lift);
}
.plan .badge-pill {
  position: absolute;
  top: -.75rem;
  left: 1.35rem;
  background: var(--accent);
  color: #fff;
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: uppercase;
  padding: .25rem .6rem;
  border-radius: 999px;
}
.plan-name {
  font-family: "Poppins", sans-serif;
  font-weight: 600;
  font-size: 1.2rem;
}
.plan-price {
  font-family: "Poppins", sans-serif;
  font-weight: 700;
  font-size: 2rem;
  margin: .25rem 0 .75rem;
}
.plan-price span { font-size: .95rem; font-weight: 600; color: var(--secondary); }
.plan p { color: var(--secondary); margin: 0; flex: 1; }
.pricing > p { margin-top: 1.25rem; }

/* ---- Scan result: score ring ---- */
.score-head { text-align: center; padding: 2.5rem 0 1rem; }
.score-ring {
  --score: 0;
  position: relative;
  width: 184px;
  height: 184px;
  margin: 0 auto 1.25rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: conic-gradient(var(--accent) calc(var(--score) * 3.6deg), var(--muted-bg) 0deg);
}
.score-ring::before {
  content: "";
  position: absolute;
  inset: 16px;
  background: var(--card);
  border-radius: 50%;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, .05);
}
.score-big {
  position: relative;
  font-family: "Poppins", sans-serif;
  font-weight: 700;
  font-size: 3.25rem;
  line-height: 1;
  color: var(--fg);
}
.grade { font-size: 1.15rem; color: var(--secondary); }
.delta { color: var(--ok); font-weight: 700; margin-top: .6rem; }

/* ---- Scan result sections ---- */
.check, .fixpack, .badge {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.4rem 1.5rem;
  margin: 1rem 0;
}
.check h2, .fixpack h2, .badge h2 { margin-top: 0; font-size: 1.4rem; }
.pts {
  color: var(--accent);
  font-weight: 700;
  font-size: .95rem;
}
.item { display: flex; gap: .75rem; padding: .6rem 0; border-top: 1px solid var(--border); }
.item:first-of-type { border-top: 0; }
.item .icon {
  font-weight: 800;
  width: 1.5rem;
  height: 1.5rem;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: .9rem;
}
.item.pass .icon { color: var(--ok); background: rgba(22, 163, 74, .12); }
.item.fail .icon { color: var(--bad); background: rgba(220, 38, 38, .1); }
.item.na .icon { color: var(--secondary); background: var(--muted-bg); }
.item p { margin: .2rem 0; }
.item strong { font-family: "Poppins", sans-serif; font-weight: 600; }
.fix { color: var(--accent); font-weight: 600; }
.training {
  background: var(--muted-bg);
  border-radius: var(--radius-sm);
  padding: 1rem 1.15rem;
  margin-top: 1rem;
}
.training h3 { margin-top: 0; font-size: 1.1rem; }

pre {
  background: var(--muted-bg);
  border: 1px solid var(--border);
  padding: 1rem;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  font-size: .82rem;
  line-height: 1.55;
}
textarea {
  font-family: inherit;
  font-size: .95rem;
  padding: .75rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--fg);
}

/* ---- Tables (benchmarks, etc.) ---- */
table { border-collapse: collapse; width: 100%; }
td, th { text-align: left; padding: .5rem .7rem; border-bottom: 1px solid var(--border); }
th { font-family: "Poppins", sans-serif; }

svg { max-width: 100%; height: auto; }

/* ---- Generic content lists (benchmarks, docs) ---- */
main ul:not(.steps):not(.plans) { padding-left: 1.25rem; }
main ul:not(.steps):not(.plans) li { margin: .4rem 0; }

/* ---- Machine's-eye view (terminal frame) ---- */
.machine .terminal {
  border: 1px solid #1e293b;
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin: 1rem 0;
}
.term-bar { display: flex; align-items: center; gap: .4rem; background: #1e293b; padding: .55rem .8rem; }
.term-dot { width: .7rem; height: .7rem; border-radius: 50%; background: #475569; flex: none; }
.term-title {
  color: #94a3b8; font-size: .8rem; margin-left: .5rem;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
.term-body {
  margin: 0; padding: 1rem 1.1rem; border: 0; border-radius: 0;
  background: #0f172a; color: #e2e8f0;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: .82rem; line-height: 1.6;
  max-height: 18rem; overflow: auto;
  white-space: pre-wrap; word-break: break-word;
}
.compare { display: flex; gap: 1rem; flex-wrap: wrap; margin-top: 1rem; }
.compare-stat {
  flex: 1; min-width: 150px;
  background: var(--muted-bg); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: .9rem 1.1rem;
}
.compare-num {
  font-family: "Poppins", sans-serif; font-weight: 700;
  font-size: 1.9rem; line-height: 1; color: var(--fg);
  font-variant-numeric: tabular-nums;
}
.compare-label { color: var(--secondary); font-size: .85rem; margin-top: .3rem; }

/* ---- Score tiles ---- */
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: .8rem; }
.tile {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 1.1rem 1.2rem;
}
.tile-num {
  font-family: "Poppins", sans-serif; font-weight: 700;
  font-size: 1.9rem; line-height: 1; color: var(--fg);
  font-variant-numeric: tabular-nums;
}
.tile-label { font-family: "Poppins", sans-serif; font-weight: 600; margin-top: .35rem; }
.tile-sub { color: var(--secondary); font-size: .85rem; }
.meter { height: 6px; background: var(--muted-bg); border-radius: 999px; margin-top: .7rem; overflow: hidden; }
.meter-fill { height: 100%; background: var(--accent); border-radius: 999px; }

/* ---- Benchmark position strip ---- */
.bench-track { position: relative; height: 12px; margin: 1.25rem 0 .5rem; background: var(--muted-bg); border-radius: 999px; }
.bench-median { position: absolute; top: -4px; width: 2px; height: 20px; background: var(--secondary); border-radius: 1px; transform: translateX(-50%); }
.bench-you {
  position: absolute; top: 50%; width: 16px; height: 16px;
  background: var(--accent); border: 2px solid var(--card); border-radius: 50%;
  transform: translate(-50%, -50%); box-shadow: 0 1px 3px rgba(15, 23, 42, .25);
}
.bench-cap { margin-top: .75rem; }

/* ---- Landing proof bar (reuses .tiles/.tile) ---- */
.proofbar { margin-top: 2.25rem; }
.proofbar .tiles { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }

/* ---- Fix-pack proof ---- */
.more { color: var(--accent); font-weight: 600; margin: .4rem 0 1.1rem; }

/* ---- Motion (opt-in, respects reduced motion) ---- */
@media (prefers-reduced-motion: no-preference) {
  .btn, .btn-secondary,
  #scanform input, .gate input,
  .steps li, .plan, .faq-item,
  .faq-item summary::after {
    transition: transform .2s ease-out, box-shadow .2s ease-out,
      border-color .2s ease-out, background-color .2s ease-out;
  }
  .steps li:hover, .plan:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); }
  .btn:hover { transform: translateY(-1px); }
}

/* ---- Responsive ---- */
@media (min-width: 620px) {
  .steps { grid-template-columns: 1fr 1fr; }
  .plans { grid-template-columns: repeat(3, 1fr); }
  .tiles { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 480px) {
  h1, .hero h1 { font-size: 2rem; }
  h2 { font-size: 1.6rem; }
  .hero > p { font-size: 1.05rem; }
  .btn-secondary { margin-left: 0; }
}

.scan-error {
  margin-top: 0.75rem;
  padding: 0.75rem 1rem;
  background: #FEF2F2;
  border: 1px solid #FECACA;
  border-radius: 8px;
  color: #991B1B;
  font-size: 0.95rem;
  max-width: 34rem;
}
