/* Atlas Preview Portal — one stylesheet, mobile-first, no build step.
   Look: field work-order. Paper ground, ink chrome, surveyor-orange accent.
   System type only so it loads instantly on iPhone Safari. */

:root {
  --ink: #1c242e;
  --ink-2: #2b3644;
  --paper: #f4f2ec;
  --card: #ffffff;
  --line: #d9d4c7;
  --muted: #6b7280;
  --accent: #d4551f;
  --accent-deep: #a33e14;
  --ok: #2e7d4f;
  --bad: #b3261e;
  --radius: 10px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--paper);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.45;
  min-height: 100dvh;
}

/* ---------- chrome ---------- */

.topbar {
  background: var(--ink);
  color: #f2efe8;
  padding: max(10px, env(safe-area-inset-top)) 16px 12px;
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.topbar a { color: inherit; text-decoration: none; }
.wordmark {
  font-weight: 800;
  letter-spacing: 0.18em;
  font-size: 15px;
}
.wordmark .amp { color: var(--accent); }
.topbar .sub {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #9aa4b1;
}

main {
  max-width: 640px;
  margin: 0 auto;
  padding: 16px 16px calc(96px + env(safe-area-inset-bottom));
}

.eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent-deep);
  margin: 0 0 4px;
}
h1 {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.01em;
  margin: 0 0 6px;
}
h2 { font-size: 20px; font-weight: 800; margin: 20px 0 8px; }
.hint { color: var(--muted); font-size: 14px; margin: 0 0 14px; }

/* ---------- controls (44px+ touch targets) ---------- */

.btn {
  appearance: none;
  border: 0;
  border-radius: var(--radius);
  min-height: 48px;
  padding: 12px 20px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn-primary { background: var(--accent); color: #fff; width: 100%; font-size: 17px; }
.btn-primary:active { background: var(--accent-deep); }
.btn-primary:disabled { background: #c9c3b6; cursor: default; }
.btn-ghost {
  background: transparent;
  color: var(--ink);
  border: 1.5px solid var(--line);
}
.btn-small { min-height: 44px; padding: 8px 14px; font-size: 14px; width: auto; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

label.field { display: block; margin: 0 0 14px; }
label.field > span {
  display: block;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  margin-bottom: 5px;
}
label.field .opt { color: var(--muted); font-weight: 400; }
input[type="text"], input[type="tel"], input[type="email"], input[type="url"],
input[type="search"], select, textarea {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  font: inherit;
  color: var(--ink);
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
}
textarea { min-height: 110px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; }

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

.new-site { margin: 18px 0 26px; }
.prospect-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.prospect-card {
  background: var(--card);
  border: 1.5px solid var(--line);
  border-left: 5px solid var(--ink);
  border-radius: var(--radius);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.prospect-card.previewed { border-left-color: var(--ok); }
.prospect-card .grow { flex: 1; min-width: 0; }
.prospect-card .name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prospect-card .meta { font-size: 12.5px; color: var(--muted); }
.state-pill {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 8px;
  border-radius: 99px;
  background: var(--paper);
  border: 1px solid var(--line);
  white-space: nowrap;
}
.state-pill.previewed { color: var(--ok); border-color: var(--ok); }
.prospect-card a.open {
  color: var(--accent-deep);
  font-weight: 700;
  text-decoration: none;
  padding: 10px 4px; /* keeps target >=44px tall */
}
.empty { color: var(--muted); text-align: center; padding: 32px 0; }

/* ---------- wizard frame ---------- */

.steps {
  display: flex;
  gap: 6px;
  margin: 14px 0 18px;
}
.steps .seg {
  flex: 1;
  height: 5px;
  border-radius: 3px;
  background: var(--line);
}
.steps .seg.done { background: var(--ink); }
.steps .seg.now { background: var(--accent); }
.stepnum {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.1em;
}

.wizard-nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(6px);
  border-top: 1.5px solid var(--line);
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
}
.wizard-nav .row {
  max-width: 640px;
  margin: 0 auto;
  display: flex;
  gap: 10px;
}
.wizard-nav .btn-primary { flex: 1; }
.savenote { font-size: 12px; color: var(--muted); text-align: center; margin-top: 6px; min-height: 15px; }

/* ---------- step 1: feel picker + template carousel ---------- */

.feelbar {
  display: flex;
  gap: 6px;
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 4px;
  margin: 0 0 14px;
}
.feelbtn {
  flex: 1;
  min-height: 44px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
}
.feelbtn.selected { background: var(--ink); color: #f2efe8; }


.carousel-wrap { position: relative; margin: 0 -16px; }
.carousel {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding: 4px 16px 12px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.carousel::-webkit-scrollbar { display: none; }
.tcard {
  scroll-snap-align: center;
  flex: 0 0 82%;
  max-width: 420px;
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  padding: 0 0 12px;
  text-align: left;
  font: inherit;
  color: inherit;
}
.tcard img { display: block; width: 100%; aspect-ratio: 8/5; object-fit: cover; background: #e8e4da; }
.tcard .tname { font-weight: 800; padding: 10px 14px 0; display: flex; align-items: center; gap: 8px; }
.tcard .tdesc { color: var(--muted); font-size: 13.5px; padding: 2px 14px 0; }
.tcard.selected { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 30%, transparent); }
.tcard.selected .tname::after {
  content: "SELECTED";
  font-size: 10px;
  letter-spacing: 0.12em;
  color: #fff;
  background: var(--accent);
  border-radius: 4px;
  padding: 2px 6px;
}
.car-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 1.5px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font-size: 20px;
  cursor: pointer;
  display: none;
}
.car-arrow.prev { left: 8px; }
.car-arrow.next { right: 8px; }
@media (min-width: 700px) { .car-arrow { display: block; } }

/* ---------- step 2: search ---------- */

.search-box { position: relative; margin-bottom: 8px; }
.search-results {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  overflow: hidden;
}
.search-results:empty { display: none; }
.search-results li button {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 12px 14px;
  font: inherit;
  cursor: pointer;
  min-height: 48px;
}
.search-results li:last-child button { border-bottom: 0; }
.search-results .r-name { font-weight: 700; }
.search-results .r-addr { font-size: 13px; color: var(--muted); }
.notice {
  background: #fdf6ec;
  border: 1.5px solid #ecd9b0;
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: 14px;
  margin: 8px 0 14px;
}
.notice.err { background: #fdeeec; border-color: #e8b6b1; }

/* ---------- chips (services & towns) ---------- */

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 6px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 8px 8px 8px 14px;
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: 99px;
  font-size: 14.5px;
  font-weight: 600;
}
.chip .x {
  border: 0;
  background: none;
  font-size: 17px;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  padding: 8px 10px;
  margin: -8px 0;
}
.chip.suggested { border-style: dashed; color: var(--accent-deep); background: transparent; cursor: pointer; }
.addrow { display: flex; gap: 8px; margin: 8px 0 4px; }
.addrow input { flex: 1; }
.svc-blurbs { margin-top: 12px; display: grid; gap: 8px; }
.svc-blurb {
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
}
.svc-blurb b { display: block; font-size: 14px; margin-bottom: 4px; }
.svc-blurb input { min-height: 44px; }

/* ---------- step 5: branding ---------- */

.swatch-row { display: flex; flex-wrap: wrap; gap: 10px; margin: 8px 0 16px; }
.swatch {
  width: 48px; height: 48px;
  border-radius: 10px;
  border: 2px solid var(--line);
  cursor: pointer;
  padding: 0;
}
.swatch.selected { border-color: var(--ink); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 45%, transparent); }
.upload-row { display: flex; align-items: center; gap: 12px; margin: 6px 0 16px; }
.upload-thumb {
  width: 56px; height: 56px;
  border-radius: 10px;
  border: 1.5px dashed var(--line);
  background: var(--card) center/cover no-repeat;
  flex: none;
}
.upload-row .fname { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }

.type-options { display: grid; gap: 10px; }
.type-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  cursor: pointer;
}
.type-card input { width: 22px; height: 22px; accent-color: var(--accent); flex: none; }
.type-card.selected { border-color: var(--accent); }
.type-card .tt { font-size: 21px; line-height: 1.1; }
.type-card small { display: block; color: var(--muted); }
.tt-rugged { font-weight: 800; letter-spacing: -0.02em; text-transform: uppercase; font-stretch: condensed; }
.tt-classic { font-family: Georgia, "Times New Roman", serif; font-weight: 700; }
.tt-modern { font-weight: 600; letter-spacing: 0.01em; }
.tt-warm { font-weight: 700; border-radius: 8px; }

/* ---------- generate screen ---------- */

.gen-states { list-style: none; margin: 18px 0; padding: 0; display: grid; gap: 10px; }
.gen-states li {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  color: var(--muted);
  font-weight: 600;
}
.gen-states li .dot {
  width: 14px; height: 14px;
  border-radius: 50%;
  border: 2.5px solid var(--line);
  flex: none;
}
.gen-states li.now { color: var(--ink); border-color: var(--accent); }
.gen-states li.now .dot { border-color: var(--accent); animation: pulse 1.2s ease-in-out infinite; }
.gen-states li.done { color: var(--ink); }
.gen-states li.done .dot { background: var(--ok); border-color: var(--ok); }
@keyframes pulse { 50% { transform: scale(1.35); } }
@media (prefers-reduced-motion: reduce) {
  .gen-states li.now .dot { animation: none; }
}

/* the "site tag" result card */
.site-tag {
  background: linear-gradient(160deg, var(--ink) 0%, var(--ink-2) 100%);
  color: #f2efe8;
  border-radius: 14px;
  padding: 18px 18px 20px;
  margin: 18px 0;
  border: 1px solid #3a4656;
}
.site-tag .eyebrow { color: var(--accent); }
.site-tag .qr {
  background: #fff;
  border-radius: 10px;
  padding: 10px;
  width: min(220px, 60vw);
  margin: 14px auto;
}
.site-tag .qr svg { display: block; width: 100%; height: auto; }
.site-tag .url {
  font-family: var(--mono);
  font-size: 13.5px;
  overflow-wrap: anywhere;
  background: rgba(255,255,255,0.08);
  border-radius: 8px;
  padding: 10px 12px;
  margin: 0 0 12px;
}
.site-tag .row { display: flex; gap: 10px; }
.site-tag .btn-ghost { color: #f2efe8; border-color: #4a5666; flex: 1; }

/* ---------- dev key dialog ---------- */

.keywall {
  position: fixed;
  inset: 0;
  background: rgba(28, 36, 46, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 50;
}
.keywall form {
  background: var(--card);
  border-radius: 14px;
  padding: 20px;
  width: 100%;
  max-width: 380px;
}

@media (min-width: 700px) {
  h1 { font-size: 32px; }
  main { padding-top: 28px; }
  .tcard { flex-basis: 46%; }
}
