*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #faf6ee;
  --surface: #ffffff;
  --border: #e6ddca;
  --accent: #2f7a6b;
  --accent-light: #3f9382;
  --text: #2a2620;
  --muted: #756c5c;
  --green: #2f8f5a;
  --red: #b23f3f;
  --radius: 12px;
}
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  line-height: 1.6;
  padding-bottom: 3rem;
}
a { color: var(--accent); }
header.site {
  padding: 1.25rem 1rem;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  max-width: 640px; margin: 0 auto;
}
.logo { font-weight: 700; font-size: 1.15rem; color: var(--text); text-decoration: none; }
main { max-width: 640px; margin: 0 auto; padding: 2rem 1.25rem 3rem; }
h1 { font-size: 1.9rem; line-height: 1.3; margin-bottom: .75rem; font-weight: 700; }
h2 { font-size: 1.25rem; margin: 2rem 0 .75rem; font-weight: 700; }
h3 { font-size: 1.05rem; font-weight: 700; }
p.lede { color: var(--muted); font-size: 1.05rem; margin-bottom: 1.5rem; }

/* ---------------------------------------------------------------------
   Landing
--------------------------------------------------------------------- */
#landing { text-align: center; padding: 1rem 0 .5rem; }
#landing .lede { max-width: 46ch; margin-left: auto; margin-right: auto; }

.arm-illustration {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 2rem auto;
  padding: 2.5rem 1rem;
}
.arm-illustration-shape {
  position: relative;
  width: 100%;
  max-width: 340px;
  height: 60px;
  background: linear-gradient(180deg, #efe7d6, #e3d9c2);
  border: 1px solid var(--border);
  border-radius: 999px 999px 30px 30px;
}
.arm-illustration-highlight {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: var(--surface);
  border: 1.5px dashed var(--accent);
  border-radius: 6px;
  padding: .3rem .6rem;
  font-family: ui-monospace, monospace;
  font-size: .78rem;
  color: var(--accent);
  white-space: nowrap;
}

.reassurance { color: var(--muted); font-size: .85rem; margin-top: .75rem; }

/* ---------------------------------------------------------------------
   Progress
--------------------------------------------------------------------- */
.scan-progress {
  display: flex;
  list-style: none;
  gap: .5rem;
  margin: 1.5rem 0;
  font-size: .78rem;
  color: var(--muted);
}
.scan-progress .step {
  flex: 1;
  text-align: center;
  padding: .5rem .3rem;
  border-bottom: 3px solid var(--border);
}
.scan-progress .step.active { color: var(--text); border-color: var(--accent); font-weight: 700; }
.scan-progress .step.done { color: var(--green); border-color: var(--green); }

/* ---------------------------------------------------------------------
   Scan steps (capture panels + results)
--------------------------------------------------------------------- */
.scan-step {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 1px 2px rgba(42,38,32,.04);
}
.scan-step h2 { margin-top: 0; }
.scan-step .hint { font-size: .88rem; color: var(--muted); margin-bottom: .85rem; }

/* Guided flow: only show capture controls before a photo exists, and only
   show post-capture controls (Retake/Continue/Adjust) once a photo
   exists — toggled via the .has-photo class set by scan-glasses-ui.js. */
.scan-step .after-photo-only { display: none; }
.scan-step.has-photo .after-photo-only { display: block; }
.scan-step.has-photo .before-photo-only { display: none; }

.upload-row { display: flex; flex-wrap: wrap; gap: .6rem; margin-bottom: .75rem; }
.primary-actions { margin-bottom: .5rem; }

button, .btn {
  font-family: inherit;
  font-size: .92rem;
  font-weight: 600;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: .65rem 1.1rem;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
button:hover, .btn:hover { border-color: var(--accent); }
button:focus-visible, .btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover { background: var(--accent-light); }
button.primary:disabled, button:disabled { opacity: .4; cursor: not-allowed; }
button.ghost { background: transparent; border-color: var(--border); }
button.big-cta {
  display: block;
  width: 100%;
  font-size: 1.05rem;
  padding: 1rem;
  margin-bottom: .5rem;
}
.arm-adjust-panel { margin-top: .75rem; }
input[type="file"] { display: none; }

.canvas-wrap {
  position: relative;
  background: #1c1a16;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: .75rem;
  max-width: 100%;
  display: none;
}
.canvas-wrap.visible { display: block; }
canvas.preview { display: block; max-width: 100%; height: auto; touch-action: none; }

.quality-msgs { list-style: none; margin: .5rem 0; display: flex; flex-direction: column; gap: .35rem; }
.quality-msgs li {
  font-size: .84rem;
  padding: .5rem .65rem;
  border-radius: 6px;
  background: rgba(178,63,63,.08);
  color: var(--red);
  border: 1px solid rgba(178,63,63,.25);
}
.quality-override { display: flex; align-items: center; gap: .5rem; font-size: .84rem; color: var(--muted); margin-top: .5rem; }
.quality-override[hidden] { display: none; }

.status { font-size: .85rem; margin-top: .5rem; color: var(--muted); }
.status[data-state="ok"] { color: var(--green); }
.status[data-state="error"] { color: var(--red); }

/* ---------------------------------------------------------------------
   Results
--------------------------------------------------------------------- */
.results-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; margin-bottom: 1.5rem; }
@media (min-width: 560px) { .results-grid { grid-template-columns: 1fr 1fr; } }
.result-panel { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; }
.result-panel img { max-width: 100%; border-radius: 6px; margin-bottom: .6rem; }

.size-heading { margin-top: 1.5rem; margin-bottom: .25rem; }

.field-group { margin: 1rem 0; }
.field-group label { display: block; font-size: .84rem; color: var(--muted); margin-bottom: .35rem; font-weight: 600; }
.field-group input,
.field-group textarea,
.field-group select {
  width: 100%; background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); font-family: inherit; font-size: 1rem; padding: .65rem .8rem;
}
.field-group textarea { min-height: 9rem; resize: vertical; }

/* Netlify Forms honeypot — off-screen rather than display:none, so the field
   stays in the submitted payload while remaining invisible to people. */
.honeypot { position: absolute; left: -9999px; }

.ambiguous-chip-row { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .3rem; }
.ambiguous-chip {
  font-size: .78rem; padding: .3rem .6rem; border-radius: 20px;
  background: rgba(47,122,107,.08); border: 1px solid rgba(47,122,107,.3); color: var(--accent);
  cursor: pointer;
}
.ambiguous-chip[aria-pressed="true"] { background: var(--accent); color: #fff; }

/* De-emphasized: the original transcription is reference material, not
   the primary thing the user is meant to look at (the editable fields
   above are). Small and quiet on purpose — not a code/terminal block. */
.original-text-note { margin: 1.25rem 0; }
.raw-text-small {
  font-family: ui-monospace, monospace;
  font-size: .78rem;
  color: var(--muted);
  word-break: break-word;
}

.retake-banner {
  background: rgba(178,63,63,.08); border: 1px solid rgba(178,63,63,.3); border-radius: var(--radius);
  padding: .9rem 1.1rem; margin: 1rem 0; font-size: .92rem;
}
.warnings-list { margin: .75rem 0; padding-left: 1.1rem; font-size: .86rem; color: var(--muted); }
.warnings-list li { margin-bottom: .3rem; }

.confirm-row { display: flex; align-items: center; gap: .75rem; margin-top: 1.5rem; flex-wrap: wrap; }
.confirmed-banner {
  background: rgba(47,143,90,.08); border: 1px solid rgba(47,143,90,.3); border-radius: var(--radius);
  padding: 1rem; margin-top: 1rem; font-size: .92rem;
}
.frame-disclaimer { font-size: .84rem; color: var(--muted); margin-top: .5rem; }

footer.site { max-width: 640px; margin: 2rem auto 0; padding: 1rem; border-top: 1px solid var(--border); color: var(--muted); font-size: .82rem; text-align: center; }
footer.site a { color: var(--muted); }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
