/* Kuper Plumbing — customer side.
   Minimalist by mandate: paper ground, one blue accent, one question at a time.
   Emergency red appears only on the emergency path. */

:root {
  --bg: #f7f7f5;
  --surface: #ffffff;
  --surface-2: #f1f1ee;
  --ink: #17181c;
  --ink-2: #3f4249;
  --muted: #6f7480;
  --faint: #9ba0ab;
  --line: #e6e6e1;
  --line-2: #d5d5cf;
  --accent: #2563eb;
  --accent-ink: #1d4ed8;
  --accent-soft: #eef3fe;
  --danger: #dc2626;
  --danger-deep: #b91c1c;
  --ok: #0d9463;
  --shadow: 0 1px 2px rgb(23 24 28 / .05), 0 4px 16px -8px rgb(23 24 28 / .06);
  --radius: 14px;
  --radius-sm: 10px;
  --vh: 100vh;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}
@supports (height: 100dvh) { :root { --vh: 100dvh; } }

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #10141c;
    --surface: #191f2a;
    --surface-2: #141922;
    --ink: #f0f2f5;
    --ink-2: #c8cdd6;
    --muted: #8f97a6;
    --faint: #646c7b;
    --line: rgba(255, 255, 255, 0.09);
    --line-2: rgba(255, 255, 255, 0.16);
    --accent: #6fa0f7;
    --accent-ink: #93b8fa;
    --accent-soft: rgba(59, 130, 246, 0.14);
    --danger: #ef4444;
    --danger-deep: #dc2626;
    --ok: #34d399;
    --shadow: none;
  }
}

* { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; scrollbar-gutter: stable; touch-action: manipulation; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  min-height: var(--vh);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent-ink); text-decoration: none; }
img { max-width: 100%; }

.shell {
  max-width: 480px;
  margin: 0 auto;
  padding: calc(12px + var(--safe-top)) 20px calc(24px + var(--safe-bottom));
  min-height: var(--vh);
  display: flex;
  flex-direction: column;
}

/* ---- header ---- */
.top {
  display: flex; align-items: center; justify-content: space-between;
  min-height: 48px; gap: 12px;
}
.wordmark { display: inline-flex; align-items: baseline; gap: 6px; color: var(--ink); }
.wordmark b { font-weight: 700; letter-spacing: -0.01em; }
.wordmark span { color: var(--muted); font-weight: 400; }
.wordmark img { height: 120px; width: auto; display: block; }
.top .link {
  font-size: 15px; color: var(--muted); background: none; border: 0; cursor: pointer;
  min-height: 44px; display: inline-flex; align-items: center;
}
.top .link:active { color: var(--ink); }
.back {
  background: none; border: 0; cursor: pointer; color: var(--muted);
  min-width: 44px; min-height: 44px; margin-left: -12px;
  display: inline-flex; align-items: center; justify-content: flex-start;
  font-size: 15px; gap: 2px;
}
.back svg { width: 20px; height: 20px; }

/* ---- landing ---- */
.hero { flex: 1; display: grid; align-content: center; padding-bottom: 6vh; }
.hero h1 {
  font-size: clamp(30px, 8.5vw, 38px);
  line-height: 1.14;
  font-weight: 700;
  letter-spacing: -0.022em;
  text-wrap: balance;
  max-width: 16ch;
}
.hero p { color: var(--muted); margin-top: 14px; max-width: 34ch; font-size: 17px; }
.hero .cta-stack { margin-top: 34px; display: flex; flex-direction: column; gap: 14px; }
.cta-note { color: var(--faint); font-size: 14px; margin-top: 14px; }
.foot { color: var(--faint); font-size: 13px; padding-top: 28px; }
.foot a { color: inherit; text-decoration: underline; }

/* ---- buttons ---- */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; min-height: 54px; padding: 14px 18px;
  border-radius: var(--radius-sm); border: 0; cursor: pointer;
  font-size: 17px; font-weight: 600;
  transition: transform 0.1s ease-out, background 0.2s ease;
}
.btn:active { transform: scale(0.985); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:active { background: var(--accent-ink); }
.btn-quiet { background: var(--surface); color: var(--ink); border: 1px solid var(--line-2); }
.btn-danger { background: var(--danger); color: #fff; }
.btn[disabled] { opacity: 0.5; pointer-events: none; }
.btn-inline { width: auto; }

/* ---- wizard screens ---- */
.screen { flex: 1; display: flex; flex-direction: column; padding-top: 10px; }
.progress { font-size: 13px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--faint); margin-bottom: 10px; }
.q {
  font-size: clamp(23px, 6.4vw, 27px);
  font-weight: 700; line-height: 1.2; letter-spacing: -0.018em;
  text-wrap: balance;
  margin-bottom: 6px;
}
.q-sub { color: var(--muted); margin-bottom: 18px; font-size: 15px; }
.opts { display: grid; gap: 10px; padding-bottom: 16px; }
.opt {
  text-align: left; width: 100%; min-height: 60px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 15px 16px; cursor: pointer; box-shadow: var(--shadow);
  display: flex; flex-direction: column; justify-content: center; gap: 2px;
  transition: transform 0.1s ease-out, border-color 0.15s ease, background 0.15s ease;
}
.opt:active { transform: scale(0.985); }
.opt .t { font-size: 16.5px; font-weight: 600; line-height: 1.3; }
.opt .s { font-size: 13.5px; color: var(--muted); }
.opt.picked { border: 2px solid var(--accent); background: var(--accent-soft); padding: 14px 15px; }
.opt.picked .t { color: var(--accent-ink); }
.opt.opt-danger { background: var(--danger); border-color: var(--danger); }
.opt.opt-danger .t, .opt.opt-danger .s { color: #fff; }
.opt.opt-danger .s { opacity: 0.85; }
.opt-more, .opt-escape {
  background: none; border: 1px dashed var(--line-2); box-shadow: none;
  min-height: 52px;
}
.opt-more .t, .opt-escape .t { color: var(--muted); font-weight: 500; font-size: 15px; }

/* chips (multi-select, best times) */
.chips { display: flex; flex-wrap: wrap; gap: 9px; padding-bottom: 8px; }
.chip {
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-2);
  border-radius: 999px; padding: 11px 16px; min-height: 44px; cursor: pointer;
  font-size: 15px; font-weight: 500;
  transition: transform 0.1s ease-out, border-color 0.15s, background 0.15s, color 0.15s;
}
.chip:active { transform: scale(0.96); }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }

/* ---- forms ---- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.input, textarea.input {
  width: 100%; min-height: 52px; padding: 13px 14px;
  font-size: 16px; /* never smaller — iOS zoom */
  background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  outline: none;
}
textarea.input { min-height: 120px; resize: vertical; line-height: 1.5; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input::placeholder { color: var(--faint); }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row-3 { display: grid; grid-template-columns: 2fr 1fr 1.2fr; gap: 10px; }
.err { color: var(--danger); font-size: 14px; margin: 4px 0 10px; display: none; }
.err.show { display: block; }
.hint { color: var(--faint); font-size: 13.5px; }

/* ---- photos ---- */
.photo-zone {
  border: 1.5px dashed var(--line-2); border-radius: var(--radius);
  padding: 22px 16px; text-align: center; color: var(--muted); cursor: pointer;
  background: var(--surface);
}
.photo-zone strong { color: var(--accent-ink); font-weight: 600; }
.thumbs { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.thumb { position: relative; width: 76px; height: 76px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .x {
  position: absolute; top: 2px; right: 2px; width: 24px; height: 24px; border-radius: 50%;
  background: rgba(0,0,0,0.55); color: #fff; border: 0; cursor: pointer; font-size: 14px; line-height: 1;
}
.thumb.uploading::after {
  content: ""; position: absolute; inset: 0; background: rgba(255,255,255,0.55);
}

/* ---- review ---- */
.review-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow); margin-bottom: 16px;
  font-size: 17px; line-height: 1.5;
}
.review-rows { display: grid; gap: 2px; padding-bottom: 16px; }
.rrow {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 11px 2px; border-bottom: 1px solid var(--line); min-height: 48px;
}
.rrow .k { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--faint); }
.rrow .v { font-size: 15px; color: var(--ink-2); text-align: right; flex: 1; }
.rrow .edit { background: none; border: 0; color: var(--accent-ink); font-size: 14px; cursor: pointer; min-height: 44px; padding: 0 0 0 10px; }

/* ---- notices ---- */
.note {
  background: var(--accent-soft); border: 1px solid transparent; border-radius: var(--radius-sm);
  padding: 13px 15px; font-size: 14.5px; color: var(--ink-2); margin-bottom: 16px;
}
.note-danger { background: var(--danger); color: #fff; }
.note-danger a { color: #fff; text-decoration: underline; }
details.guide { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); padding: 0 15px; margin-bottom: 16px; }
details.guide summary { min-height: 50px; display: flex; align-items: center; font-weight: 600; font-size: 15px; cursor: pointer; list-style: none; }
details.guide summary::after { content: "+"; margin-left: auto; color: var(--muted); font-size: 20px; }
details.guide[open] summary::after { content: "–"; }
details.guide .body { padding: 0 0 14px; color: var(--ink-2); font-size: 15px; display: grid; gap: 8px; }

/* full-screen interrupt (gas) */
.interrupt {
  position: fixed; inset: 0; z-index: 60; background: var(--danger-deep); color: #fff;
  display: flex; flex-direction: column; justify-content: center; padding: 32px 24px calc(32px + var(--safe-bottom));
  text-align: left;
}
.interrupt h2 { font-size: 30px; line-height: 1.15; letter-spacing: -0.02em; margin-bottom: 14px; }
.interrupt p { font-size: 17px; opacity: 0.95; margin-bottom: 10px; max-width: 34ch; }
.interrupt .btn { margin-top: 18px; background: #fff; color: var(--danger-deep); }
.interrupt .quiet { margin-top: 16px; background: none; border: 0; color: rgba(255,255,255,0.8); font-size: 15px; min-height: 44px; cursor: pointer; }

/* ---- bottom bar ---- */
.bar {
  position: sticky; bottom: 0; margin-top: auto;
  padding: 12px 0 calc(2px + var(--safe-bottom));
  background: linear-gradient(to top, var(--bg) 75%, transparent);
  display: none;
}
.bar.show { display: block; }
html.kb-open .bar { position: static; }

/* ---- status page ---- */
.status-wrap { padding-top: 6vh; }
.status-kicker { font-size: 13px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent-ink); margin-bottom: 8px; }
.status-kicker.em { color: var(--danger); }
.status-title { font-size: 32px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; }
.status-detail { color: var(--muted); font-size: 17px; margin-top: 10px; max-width: 36ch; }
.status-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-top: 26px; }
.status-card .k { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--faint); margin-bottom: 6px; }
.status-card p { font-size: 16px; }
.timeline { list-style: none; padding: 0; margin-top: 26px; display: grid; gap: 0; }
.timeline li { display: flex; gap: 12px; padding: 9px 0; color: var(--muted); font-size: 15px; align-items: baseline; }
.timeline li::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--line-2); flex: none; transform: translateY(-1px); }
.timeline li.done { color: var(--ink-2); }
.timeline li.done::before { background: var(--ok); }
.timeline li time { margin-left: auto; font-size: 13px; color: var(--faint); font-variant-numeric: tabular-nums; }

/* ---- confirmation ---- */
.confirm-icon { width: 56px; height: 56px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-ink); display: flex; align-items: center; justify-content: center; margin-bottom: 18px; }
.confirm-icon svg { width: 28px; height: 28px; }

/* ---- dev tree ---- */
.tree { font-size: 15px; padding: 8px 0 40px; }
.tree details { margin: 2px 0; }
.tree summary { cursor: pointer; min-height: 40px; display: flex; align-items: center; gap: 8px; }
.tree .lvl1 > summary { font-weight: 700; font-size: 17px; }
.tree .lvl2 { margin-left: 18px; }
.tree .leaf { margin-left: 36px; padding: 5px 0; color: var(--ink-2); display: flex; gap: 8px; align-items: center; }
.tree .lvl2 > .leaf, .tree .leaf.fixture-leaf { margin-left: 18px; }
.badge { font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; border-radius: 999px; padding: 2px 8px; }
.badge-em { background: var(--danger); color: #fff; }
.badge-pri { background: #f59e0b; color: #451a03; }
.badge-q { background: var(--accent-soft); color: var(--accent-ink); }
.badge-prop { background: var(--surface-2); color: var(--muted); }

/* ---- misc ---- */
.fade-in { animation: fadeUp 0.22s ease-out both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
noscript .note { display: block; }

/* ---- desktop ---- */
.hero-mark { display: none; }

@media (min-width: 860px) {
  /* Wizard, status, and review pages become a centered card — a designed
     desktop object, not a stretched phone column. */
  .shell:not(.landing) {
    max-width: 600px;
    min-height: 0;
    margin: 7vh auto;
    padding: 28px 44px 36px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 20px;
    box-shadow: var(--shadow);
  }
  .shell:not(.landing) .screen { padding-top: 18px; }
  .bar { background: linear-gradient(to top, var(--surface) 75%, transparent); border-radius: 0 0 20px 20px; }
  .q { font-size: 29px; }
  .opt { min-height: 62px; }
  .opt .t { font-size: 17px; }
  .status-wrap { padding-top: 10px; }

  /* Landing gets the full canvas back. */
  .shell.landing {
    max-width: 1060px;
    margin: 0 auto;
    padding-left: 48px;
    padding-right: 48px;
    background: none;
    border: 0;
    box-shadow: none;
    min-height: var(--vh);
  }
  .hero { grid-template-columns: 1.2fr 0.8fr; align-items: center; gap: 40px; padding-bottom: 4vh; }
  .hero h1 { font-size: 56px; max-width: 14ch; }
  .hero p { font-size: 19px; max-width: 42ch; margin-top: 18px; }
  .hero .cta-stack { flex-direction: row; margin-top: 38px; }
  .hero .cta-stack .btn { width: auto; padding-left: 30px; padding-right: 30px; }
  .hero-mark {
    display: block; justify-self: center; width: min(300px, 24vw);
    color: var(--accent); opacity: 0.1;
  }
  .hero-mark.badge { opacity: 1; width: min(340px, 26vw); filter: drop-shadow(0 12px 28px rgb(23 24 28 / .12)); }
  .hero-mark svg, .hero-mark img { width: 100%; height: auto; display: block; }
  .wordmark { font-size: 19px; }
  .wordmark img { height: 52px; }
  /* The hero badge carries the brand on the desktop landing — no corner logo. */
  .shell.landing .wordmark { display: none; }
}
