/* ============================================================
   Billericay Carriages — quote form
   Hand-written. No framework. Palette is placeholder until we
   match the main site's branding.
   ============================================================ */

:root {
  --navy:      #1b3a5c;
  --navy-dk:   #12293f;
  --navy-lt:   #2e5480;
  --amber:     #d99a2b;

  --bg:        #f4f6f8;
  --surface:   #ffffff;
  --ink:       #16232f;
  --ink-soft:  #5a6b7a;
  --line:      #d9e0e7;
  --line-soft: #e9eef2;
  --danger:    #b3261e;
  --ok:        #1c7a4a;

  --radius:    10px;
  --radius-sm: 7px;
  --shadow:    0 1px 2px rgba(22,35,47,.06), 0 6px 20px rgba(22,35,47,.05);

  --gap:       1.15rem;
  --measure:   46rem;

  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:        #0e1a29;
    --surface:   #16273a;
    --ink:       #e6edf4;
    --ink-soft:  #9db0c2;
    --line:      #2b435e;
    --line-soft: #223449;
    --navy:      #4b86c4;
    --navy-dk:   #3d74ad;
    --navy-lt:   #6ba0d8;
    --danger:    #ff8a80;
    --ok:        #6ddb9f;
    --shadow:    0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.25);
  }
}

*, *::before, *::after { box-sizing: border-box; }

[hidden] { display: none !important; }

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

body {
  margin: 0;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--navy); }
@media (prefers-color-scheme: dark) { a { color: var(--navy-lt); } }

.wrap {
  max-width: var(--measure);
  margin-inline: auto;
  padding-inline: 1.1rem;
}

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

.skip {
  position: absolute; left: -999px; top: 0; z-index: 50;
  background: var(--navy); color: #fff; padding: .7rem 1rem;
}
.skip:focus { left: .5rem; top: .5rem; }

/* ── Masthead ───────────────────────────────── */

.masthead {
  background: var(--navy);
  color: #fff;
  padding-block: .85rem;
}
.masthead__inner {
  display: flex; flex-wrap: wrap; gap: .5rem 1rem;
  align-items: baseline; justify-content: space-between;
}
.masthead__name {
  display: block;
  font-size: 1.12rem; font-weight: 650; letter-spacing: .012em;
  color: #fff; text-decoration: none;
}
a.masthead__name:hover { text-decoration: underline; text-underline-offset: 3px; }
.masthead__tag {
  display: block;
  font-size: .8rem; color: rgba(255,255,255,.72);
}
.masthead__contact { display: flex; gap: .95rem; flex-wrap: wrap; }
.masthead__contact a {
  color: #fff; text-decoration: none;
  font-weight: 600; font-size: .93rem;
  border-bottom: 1px solid rgba(255,255,255,.35);
}
.masthead__contact a:hover { border-bottom-color: #fff; }

/* ── Intro ──────────────────────────────────── */

main { padding-block: 1.9rem 3rem; }

.intro { margin-bottom: 1.5rem; }
.intro h1 {
  margin: 0 0 .3rem;
  font-size: clamp(1.6rem, 5vw, 2rem);
  line-height: 1.2; letter-spacing: -.015em;
}
.intro p { margin: 0; color: var(--ink-soft); max-width: 34rem; }

/* ── Cards ──────────────────────────────────── */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem 1.1rem 1.35rem;
  margin: 0 0 1.05rem;
}
.card__legend {
  display: flex; align-items: center; gap: .6rem;
  font-size: 1.06rem; font-weight: 650;
  padding: 0; margin-bottom: 1rem;
  letter-spacing: -.005em;
}
.card__step {
  display: grid; place-items: center;
  width: 1.6rem; height: 1.6rem; flex: none;
  border-radius: 50%;
  background: var(--navy); color: #fff;
  font-size: .82rem; font-weight: 700;
}
@media (prefers-color-scheme: dark) { .card__step { color: #0e1a29; } }

.card--submit { text-align: left; }

fieldset { border: 0; min-width: 0; }

/* ── Fields ─────────────────────────────────── */

.field { margin-bottom: var(--gap); position: relative; }
.field:last-child { margin-bottom: 0; }

.row {
  display: grid; gap: 0 .9rem;
  grid-template-columns: 1fr;
}
@media (min-width: 34rem) { .row { grid-template-columns: 1fr 1fr; } }

label {
  display: flex; align-items: center; gap: .38rem;
  font-weight: 600; font-size: .93rem;
  margin-bottom: .34rem;
}

input[type=text], input[type=email], input[type=tel], input[type=number],
input[type=date], input[type=time], select, textarea {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: .68rem .72rem;
  min-height: 2.85rem;
}
textarea { min-height: 5.5rem; resize: vertical; }

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' fill='none' stroke='%235a6b7a' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .8rem center;
  background-size: .72rem;
  padding-right: 2.2rem;
}

input:focus-visible, select:focus-visible, textarea:focus-visible,
button:focus-visible, a:focus-visible {
  outline: 3px solid var(--amber);
  outline-offset: 1px;
}

input:hover:not(:focus), select:hover:not(:focus), textarea:hover:not(:focus) {
  border-color: var(--navy-lt);
}

.note { margin: .34rem 0 0; font-size: .82rem; color: var(--ink-soft); }
.note--centre { text-align: center; }

.err {
  margin: .36rem 0 0;
  font-size: .84rem; font-weight: 600;
  color: var(--danger);
}
.err--form {
  margin-top: .8rem; padding: .65rem .8rem;
  border: 1.5px solid var(--danger); border-radius: var(--radius-sm);
}
.field--invalid input, .field--invalid select, .field--invalid textarea {
  border-color: var(--danger);
}

.field__head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: .75rem; flex-wrap: wrap;
}
.field__head label { margin-bottom: .34rem; }
.field__head .linkish {
  margin-top: 0;
  text-decoration: none;
  padding: .26rem .62rem;
  border: 1.5px solid var(--amber);
  border-radius: 999px;
  background: color-mix(in srgb, var(--amber) 16%, transparent);
  color: var(--ink);
  font-size: .8rem; font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
}
.field__head .linkish::before {
  content: "\21A9";           /* ↩ — "bring the other one down here" */
  margin-right: .32rem; opacity: .75;
}
.field__head .linkish:hover {
  background: var(--amber);
  border-color: var(--amber);
  color: #16232f;
}

.linkish {
  margin-top: .4rem;
  background: none; border: 0; padding: 0;
  font: inherit; font-size: .84rem; font-weight: 600;
  color: var(--navy); cursor: pointer;
  text-decoration: underline; text-underline-offset: 2px;
}
@media (prefers-color-scheme: dark) { .linkish { color: var(--navy-lt); } }

/* ── Hints ──────────────────────────────────── */

.hint {
  display: grid; place-items: center;
  width: 1.15rem; height: 1.15rem; flex: none;
  padding: 0; border: 0; border-radius: 50%;
  background: var(--line); color: var(--ink-soft);
  font-size: .72rem; font-weight: 700; font-family: Georgia, serif;
  font-style: italic; cursor: pointer;
  line-height: 1;
}
.hint:hover, .hint[aria-expanded=true] { background: var(--navy); color: #fff; }
@media (prefers-color-scheme: dark) {
  .hint[aria-expanded=true], .hint:hover { color: #0e1a29; }
}

.hint__text {
  margin: .4rem 0 0;
  padding: .55rem .7rem;
  font-size: .855rem;
  color: var(--ink-soft);
  background: var(--line-soft);
  border-left: 3px solid var(--amber);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* ── Toggle ─────────────────────────────────── */

.toggle { display: flex; align-items: flex-start; gap: .75rem; }
.toggle input {
  appearance: none; flex: none; cursor: pointer;
  width: 3rem; height: 1.7rem; margin: .1rem 0 0;
  border-radius: 1rem;
  background: var(--line); border: 1.5px solid var(--line);
  position: relative; transition: background .15s;
}
.toggle input::after {
  content: ""; position: absolute; top: .13rem; left: .16rem;
  width: 1.2rem; height: 1.2rem; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25);
  transition: transform .15s;
}
.toggle input:checked { background: var(--navy); border-color: var(--navy); }
.toggle input:checked::after { transform: translateX(1.28rem); }
.toggle label { margin: 0; display: block; cursor: pointer; }
.toggle__label { display: block; font-weight: 600; }
.toggle__sub { display: block; font-weight: 400; font-size: .855rem; color: var(--ink-soft); }

.panel { margin-top: 1.2rem; padding-top: 1.15rem; border-top: 1px solid var(--line-soft); }

/* ── Checkboxes ─────────────────────────────── */

.check {
  display: flex; align-items: flex-start; gap: .6rem;
  font-weight: 400; font-size: .93rem; margin-bottom: 0;
  cursor: pointer;
}
.check input {
  appearance: none; flex: none; cursor: pointer;
  width: 1.3rem; height: 1.3rem; margin: .12rem 0 0;
  border: 1.5px solid var(--line); border-radius: 5px;
  background: var(--surface);
}
.check input:checked {
  background: var(--navy) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 8.5l3 3 6-6.5' fill='none' stroke='white' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/.95rem no-repeat;
  border-color: var(--navy);
}

/* ── Stops (via) ────────────────────────────── */

.stops {
  margin-bottom: var(--gap);
  padding: .85rem .8rem .9rem;
  border: 1.5px dashed var(--line);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--line-soft) 45%, transparent);
}
.stops__head {
  display: flex; align-items: center; justify-content: space-between;
  gap: .6rem; flex-wrap: wrap;
}
.stops__title {
  display: flex; align-items: center; gap: .38rem;
  font-weight: 600; font-size: .93rem;
}
.stops__count { font-size: .82rem; color: var(--ink-soft); }

.stops__list { list-style: none; margin: .8rem 0 0; padding: 0; }
.stops__list:empty { margin: 0; }

.stop {
  display: grid;
  grid-template-columns: 1.55rem 1fr auto;
  align-items: start; gap: .5rem;
  margin-bottom: .55rem;
}
.stop__num {
  display: grid; place-items: center;
  height: 2.85rem;
  font-size: .84rem; font-weight: 700; color: var(--ink-soft);
}
.stop__actions { display: flex; gap: .2rem; height: 2.85rem; align-items: center; }
.stop__btn {
  display: grid; place-items: center;
  width: 2rem; height: 2rem; padding: 0;
  border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink-soft);
  cursor: pointer; font-size: .9rem; line-height: 1;
}
.stop__btn:hover:not(:disabled) { border-color: var(--navy); color: var(--navy); }
.stop__btn:disabled { opacity: .32; cursor: default; }
.stop__btn--del:hover { border-color: var(--danger); color: var(--danger); }

.stops__add { width: 100%; margin-top: .3rem; }
.stops__add:disabled { opacity: .45; cursor: default; }

/* ── Autocomplete ───────────────────────────── */

.ac {
  position: absolute; z-index: 20; left: 0; right: 0;
  margin-top: .22rem;
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.ac__list { list-style: none; margin: 0; padding: .22rem; }
.ac__opt {
  padding: .55rem .6rem;
  border-radius: 5px;
  cursor: pointer;
  font-size: .93rem;
}
.ac__opt[aria-selected=true], .ac__opt:hover {
  background: var(--navy); color: #fff;
}
.ac__opt small { display: block; font-size: .78rem; opacity: .72; }
.ac__none { padding: .7rem; font-size: .875rem; color: var(--ink-soft); }

/* Ghost loader */
.ac__skel { padding: .4rem; }
.ac__skel span {
  display: block; height: .82rem; margin: .42rem .2rem;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--line-soft) 25%, var(--line) 37%, var(--line-soft) 63%);
  background-size: 320% 100%;
  animation: shimmer 1.3s linear infinite;
}
.ac__skel span:nth-child(1) { width: 78%; }
.ac__skel span:nth-child(2) { width: 92%; }
.ac__skel span:nth-child(3) { width: 62%; }

@keyframes shimmer { to { background-position: -320% 0; } }

/* ── Buttons ────────────────────────────────── */

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: .5rem;
  font: inherit; font-weight: 650;
  padding: .72rem 1.15rem;
  min-height: 2.85rem;
  border-radius: var(--radius-sm);
  border: 1.5px solid transparent;
  cursor: pointer;
}
.btn--primary { background: var(--navy); color: #fff; }
.btn--primary:hover:not(:disabled) { background: var(--navy-dk); }
@media (prefers-color-scheme: dark) { .btn--primary { color: #0e1a29; } }

.btn--ghost {
  background: transparent; color: var(--navy);
  border-color: var(--line);
}
.btn--ghost:hover:not(:disabled) { border-color: var(--navy); background: var(--line-soft); }
@media (prefers-color-scheme: dark) { .btn--ghost { color: var(--navy-lt); } }

.btn--lg { width: 100%; font-size: 1.03rem; min-height: 3.25rem; margin-top: 1rem; }
.btn:disabled { cursor: default; opacity: .8; }

.btn.is-busy .btn__label { opacity: .55; }
.btn.is-busy::before {
  content: ""; width: 1.05rem; height: 1.05rem; flex: none;
  border-radius: 50%;
  border: 2.5px solid currentColor; border-top-color: transparent;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Clear form ─────────────────────────────── */

.clear { margin-top: 1.1rem; text-align: center; }

.btn--quiet {
  background: none; border: 0;
  color: var(--ink-soft);
  font-size: .875rem; font-weight: 600;
  min-height: 2.4rem; padding: .4rem .7rem;
  text-decoration: underline; text-underline-offset: 3px;
}
.btn--quiet:hover { color: var(--ink); }
.btn--warn { color: var(--danger); }

.clear__confirm {
  display: flex; flex-wrap: wrap; gap: .5rem .8rem;
  align-items: center; justify-content: center;
  padding: .7rem .8rem;
  font-size: .875rem;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--line-soft);
}
.clear__actions { display: flex; gap: .3rem; }

/* ── Confirmation ───────────────────────────── */

.done {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.9rem 1.25rem 1.6rem;
  text-align: center;
}
.done:focus { outline: none; }
.done__tick {
  display: grid; place-items: center;
  width: 3.3rem; height: 3.3rem; margin: 0 auto .9rem;
  border-radius: 50%;
  background: color-mix(in srgb, var(--ok) 15%, transparent);
  color: var(--ok);
}
.done h2 {
  margin: 0 0 .35rem;
  font-size: clamp(1.25rem, 4.2vw, 1.5rem); line-height: 1.28;
  letter-spacing: -.01em;
}
.done__ref { margin: 0 0 1.3rem; color: var(--ink-soft); font-size: .93rem; }
.done__ref strong {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 1.02rem; color: var(--ink); letter-spacing: .04em;
}
.done__lead { font-size: 1.02rem; }
.done .btn--ghost { margin-top: 1.1rem; }

.progress { margin: 0 0 1.3rem; }
.progress__bar {
  height: .42rem; border-radius: 1rem;
  background: var(--line-soft); overflow: hidden;
}
.progress__fill {
  display: block; height: 100%; width: 0%;
  border-radius: 1rem;
  background: linear-gradient(90deg, var(--navy), var(--amber));
  transition: width .9s ease;
}
.progress__bar--done .progress__fill { background: var(--ok); }
.progress__msg--ok {
  color: var(--ok); font-weight: 650;
  display: flex; align-items: center; justify-content: center; gap: .4rem;
}
.progress__msg--ok::before {
  content: "✓"; display: grid; place-items: center;
  width: 1.15rem; height: 1.15rem; border-radius: 50%;
  background: var(--ok); color: var(--surface);
  font-size: .78rem; font-weight: 700;
}
.progress__msg { margin: .55rem 0 0; font-size: .875rem; color: var(--ink-soft); }
.progress__msg--warn {
  color: var(--ink); font-weight: 500; text-align: left;
  background: color-mix(in srgb, var(--amber) 13%, transparent);
  border-left: 3px solid var(--amber);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: .7rem .85rem; margin-top: .8rem;
}

.alert {
  text-align: left;
  margin: 1.2rem 0;
  padding: .8rem .9rem;
  font-size: .9rem;
  background: color-mix(in srgb, var(--amber) 13%, transparent);
  border-left: 3px solid var(--amber);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* ── Long-form pages (privacy, terms) ───────── */

.prose { max-width: 42rem; }
.prose h2 {
  margin: 2rem 0 .6rem; font-size: 1.12rem; letter-spacing: -.005em;
  padding-bottom: .35rem; border-bottom: 1px solid var(--line-soft);
}
.prose h3 { margin: 1.4rem 0 .4rem; font-size: .98rem; }
.prose p, .prose li { margin: 0 0 .8rem; }
.prose ul { padding-left: 1.15rem; }
.prose li { margin-bottom: .45rem; }
.prose table { width: 100%; border-collapse: collapse; margin: .8rem 0 1.2rem; font-size: .92rem; }
.prose th, .prose td {
  text-align: left; padding: .55rem .6rem;
  border-bottom: 1px solid var(--line-soft); vertical-align: top;
}
.prose th { font-weight: 650; background: var(--line-soft); }
.prose__meta { color: var(--ink-soft); font-size: .875rem; margin-bottom: 1.4rem; }
.prose__key {
  background: var(--line-soft); border-left: 3px solid var(--amber);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: .8rem .9rem; margin: 0 0 1.2rem;
}
.prose__key p:last-child { margin-bottom: 0; }

/* ── Footer ─────────────────────────────────── */

.foot {
  border-top: 1px solid var(--line);
  padding-block: 1.5rem 2.4rem;
  font-size: .855rem; color: var(--ink-soft);
}
.foot p { margin: 0 0 .35rem; }
.foot__ai { margin-top: .8rem; max-width: 40rem; font-size: .8rem; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
