/* Palette lifted from web/src/App.jsx so this page reads as MERLIN rather than as
   a third-party checkout. Same tokens, same light/dark split. */
:root {
  --bg:#E9EBEF; --panel:#FFFFFF; --ink:#15181C; --muted:#5E6772; --faint:#98A1AC;
  --line:#E4E7EB; --line-2:#EEF0F3;
  --accent:#4239E0; --accent-soft:#ECEBFD; --accent-ink:#FFFFFF;
  --pos:#0E8A5F; --neg:#D23B3B; --warn:#B06D12;
  --radius:10px;
  --shadow:0 1px 2px rgba(21,24,28,.05), 0 8px 24px -16px rgba(21,24,28,.25);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg:#0E1320; --panel:#141b28; --ink:#dbe6ff; --muted:#93a0bd; --faint:#6b7690;
    --line:#243049; --line-2:#1b2434;
    --accent:#a9b2ff; --accent-soft:rgba(169,178,255,.15); --accent-ink:#141b28;
    --pos:#7ee0b8; --neg:#ff6b7a; --warn:#ffbe5c;
    --shadow:0 1px 2px rgba(0,0,0,.45), 0 8px 24px -16px rgba(0,0,0,.8);
  }
}

* { box-sizing: border-box; }

/* `hidden` must win. Both .card and form set `display`, and a class selector beats
   the [hidden] attribute's UA rule — so the success panel rendered under the form
   it was supposed to replace, and hiding the form on submit would have done
   nothing either. Caught in a render check; it is invisible when reading the CSS. */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}

.shell {
  max-width: 46rem;
  margin: 0 auto;
  padding-inline: 20px;
}

/* --- masthead --- */
.masthead {
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.masthead .shell {
  display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap;
  padding-block: 14px;
}
.wordmark { font-weight: 700; letter-spacing: .06em; font-size: .95rem; }
.masthead-note { color: var(--muted); font-size: .85rem; }

/* --- intro --- */
main { padding-block: 28px 56px; display: block; }
.intro { margin-bottom: 22px; }
h1 { font-size: clamp(1.6rem, 5.5vw, 2.1rem); margin: 0 0 8px; text-wrap: balance; }
.lede { margin: 0; color: var(--muted); max-width: 38rem; }

/* --- cards --- */
form { display: flex; flex-direction: column; gap: 18px; }
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  display: flex; flex-direction: column; gap: 18px;
}
.card-head { display: flex; flex-direction: column; gap: 3px; }
.step {
  font-size: .68rem; font-weight: 600; letter-spacing: .1em;
  text-transform: uppercase; color: var(--faint);
}
h2 { font-size: 1.15rem; margin: 0; }

/* --- fields --- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
fieldset.field { border: 0; padding: 0; margin: 0; }
legend { padding: 0; font-weight: 600; font-size: .9rem; margin-bottom: 6px; }
label, .label-as-text { font-weight: 600; font-size: .9rem; }
.optional { font-weight: 400; color: var(--faint); font-size: .82rem; }

input[type=text], input[type=email], input[type=tel], input[type=number] {
  font: inherit;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 9px 11px;
  width: 100%;
  min-width: 0;
}
input:focus-visible, button:focus-visible, summary:focus-visible,
.choice:focus-within, .addon:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
input[aria-invalid="true"] { border-color: var(--neg); }

.hint { margin: 0; font-size: .82rem; color: var(--muted); }
.hint.centred { text-align: center; }
.error { margin: 0; font-size: .82rem; color: var(--neg); font-weight: 500; }
.status { margin: 0; font-size: .82rem; color: var(--muted); min-height: 1.3em; }
.status.ok  { color: var(--pos); font-weight: 500; }
.status.bad { color: var(--neg); font-weight: 500; }

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

/* --- slug --- */
.slug-row { display: flex; align-items: stretch; gap: 0; min-width: 0; }
.slug-row input { border-radius: 7px 0 0 7px; border-right: 0; }
.slug-suffix {
  display: flex; align-items: center;
  padding: 0 10px;
  background: var(--line-2);
  border: 1px solid var(--line);
  border-radius: 0 7px 7px 0;
  color: var(--muted);
  font-size: .8rem;
  white-space: nowrap;
}
@media (max-width: 430px) {
  .slug-row { flex-direction: column; }
  .slug-row input { border-radius: 7px; border-right: 1px solid var(--line); }
  .slug-suffix { border-radius: 7px; margin-top: 6px; justify-content: center; }
}

/* --- choices and add-ons --- */
.choice, .addon {
  display: flex; gap: 11px; align-items: flex-start;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  margin-bottom: 8px;
  background: var(--panel);
}
.choice:last-child, .addon:last-child { margin-bottom: 0; }
.choice input, .addon input { margin: 3px 0 0; flex: none; }
.choice span, .addon span { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.choice em, .addon em { font-style: normal; font-size: .84rem; color: var(--muted); }
.choice:has(input:checked), .addon:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.core-list {
  display: flex; flex-wrap: wrap; gap: 6px;
  list-style: none; margin: 0; padding: 0;
}
.core-list li {
  font-size: .8rem; color: var(--muted);
  background: var(--line-2);
  border-radius: 999px;
  padding: 3px 10px;
}

/* --- contact grid --- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-2 .span-2 { grid-column: 1 / -1; }
@media (max-width: 560px) { .grid-2 { grid-template-columns: 1fr; } }

.billing summary {
  cursor: pointer; font-weight: 600; font-size: .9rem;
  padding: 10px 0; border-top: 1px solid var(--line-2);
}
.billing[open] summary { margin-bottom: 12px; }

/* --- summary --- */
.summary { margin: 0; display: flex; flex-direction: column; gap: 9px; }
.summary > div {
  display: flex; justify-content: space-between; gap: 16px;
  padding-bottom: 9px; border-bottom: 1px solid var(--line-2);
}
.summary > div:last-child { border-bottom: 0; padding-bottom: 0; }
.summary dt { color: var(--muted); font-size: .88rem; flex: none; }
.summary dd {
  margin: 0; font-weight: 600; text-align: right;
  overflow-wrap: anywhere; min-width: 0;
}

.estimate {
  background: var(--accent-soft);
  border-radius: 8px;
  padding: 14px 15px;
  display: flex; flex-direction: column; gap: 6px;
}
.estimate-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.estimate-row > span { font-weight: 600; font-size: .92rem; }
.estimate-total { font-size: 1.5rem; font-variant-numeric: tabular-nums; }

.form-error { padding: 10px 12px; background: var(--panel); border: 1px solid var(--neg); border-radius: 7px; }

.submit {
  font: inherit; font-weight: 600;
  background: var(--accent); color: var(--accent-ink);
  border: 0; border-radius: 8px;
  padding: 13px 18px;
  cursor: pointer;
  width: 100%;
}
.submit:hover { filter: brightness(1.08); }
.submit[disabled] { opacity: .55; cursor: not-allowed; filter: none; }

.done p { margin: 0; }
.done code { background: var(--line-2); padding: .1em .4em; border-radius: 4px; font-size: .88em; }

.foot { padding-block: 0 40px; color: var(--faint); font-size: .84rem; }
.foot a { color: inherit; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
