/* Border Automotive Solutions — photo-to-quote.
 *
 * BRAND SWAP: every colour, radius and typeface the client will want changed
 * is a custom property in the :root block below and nowhere else. We have not
 * seen their brand yet, so this is a deliberately restrained workshop palette —
 * graphite, off-white, one amber signal accent. Replacing it is an edit to
 * about eight lines, not a re-skin. See README.
 *
 * Look: instrument-panel rather than web-form. Hairline rules, wide tracked
 * micro-labels, generous space, one accent used only where the eye must go.
 */

:root {
  /* --- brand tokens: THE SWAP POINT ------------------------------------ */
  --ink:        #0A0C0E;   /* page base            */
  --panel:      #12161A;   /* raised surface       */
  --panel-2:    #171C21;   /* input / inner        */
  --line:       #242C34;   /* hairline rules       */
  --line-soft:  #1B2229;
  --text:       #ECEFF2;
  --muted:      #8D99A6;
  --accent:     #F2A33C;   /* indicator amber      */
  --accent-ink: #1A1206;   /* text on accent       */
  --glass:      #8FBACD;   /* laminate tint, AI chips */

  --ok:    #63C88B;
  --warn:  #E8B23C;
  --alert: #E8734A;

  --radius:    14px;
  --radius-sm: 9px;

  --font-display: 'Archivo', 'Arial Narrow', 'Helvetica Neue', system-ui, sans-serif;
  --font-body:    'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

  /* --- layout ---------------------------------------------------------- */
  --wrap: 760px;
  --pad: clamp(20px, 5vw, 44px);
}

* { box-sizing: border-box; }

/* The JS hides things with the `hidden` attribute. The browser's own
 * [hidden]{display:none} is a USER-AGENT rule, so any author rule that sets
 * display — .capture does — silently beats it and the element stays on screen.
 * This puts the attribute back in charge. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--ink);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

/* A faint diagonal sheen, the way light sits on laminated glass. Purely
 * atmosphere — it is behind everything and never affects legibility. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(120% 80% at 78% -10%, rgba(143, 186, 205, 0.09), transparent 60%),
    radial-gradient(90% 60% at 8% 108%, rgba(242, 163, 60, 0.06), transparent 62%);
}

.wrap {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 var(--pad) 96px;
}

/* --- type ------------------------------------------------------------- */

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.08;
  margin: 0 0 12px;
}

h1 { font-size: clamp(2.1rem, 7vw, 3.4rem); font-variation-settings: 'wdth' 108; }
h2 { font-size: clamp(1.5rem, 4.6vw, 2.1rem); }
h3 { font-size: 1.06rem; letter-spacing: 0; }

p { margin: 0 0 14px; color: var(--muted); }
p.lead { color: var(--text); font-size: 1.06rem; }
strong { color: var(--text); font-weight: 600; }

/* The wide, tracked micro-label — the main piece of instrument-panel
 * character in the design. Used for step numbers, field labels, statuses. */
.eyebrow {
  font-family: var(--font-display);
  font-variation-settings: 'wdth' 118;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 10px;
  display: block;
}
.eyebrow .num { color: var(--accent); }

/* --- masthead --------------------------------------------------------- */

.masthead {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 22px var(--pad) 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  font-family: var(--font-display);
  font-variation-settings: 'wdth' 112;
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* The mark: the Border badge (assets/img/bas-mark.svg). It carries the name, so the
   text beside it is kept for screen readers and the config fill but not shown. */
.brand .mark {
  width: 118px;
  height: 36px;
  flex: none;
  background: url('/assets/img/bas-mark.svg') center / contain no-repeat;
}

.mark ~ span{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}

.masthead .phone {
  font-size: 0.85rem;
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px solid var(--line);
  padding-bottom: 2px;
}
.masthead .phone:hover { color: var(--text); }

/* --- progress rail ---------------------------------------------------- */

.rail {
  display: flex;
  gap: 6px;
  max-width: var(--wrap);
  margin: 0 auto 34px;
  padding: 0 var(--pad);
  position: relative;
  z-index: 1;
}
.rail span {
  flex: 1;
  height: 2px;
  background: var(--line-soft);
  border-radius: 2px;
  transition: background 0.35s ease;
}
.rail span.done { background: var(--accent); }
.rail span.here { background: linear-gradient(90deg, var(--accent) 50%, var(--line-soft) 50%); }

/* --- steps ------------------------------------------------------------ */

.step { display: none; animation: rise 0.34s cubic-bezier(0.2, 0.7, 0.3, 1) both; }
.step.active { display: block; }

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

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

/* --- panels ----------------------------------------------------------- */

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(18px, 4vw, 26px);
  margin: 0 0 16px;
}
.panel.tight { padding: 16px 18px; }

.hairline { height: 1px; background: var(--line); margin: 22px 0; border: 0; }

/* --- the capture card: the one call to action ------------------------- */

.capture {
  display: block;
  position: relative;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(242, 163, 60, 0.05), rgba(242, 163, 60, 0));
  padding: clamp(30px, 8vw, 52px) 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, transform 0.15s;
}
.capture:hover,
.capture:focus-within { border-color: var(--accent); transform: translateY(-1px); }

/* Dragging a photo over the card. Solid border and a lift, so it is obvious
   the page will take the drop - the old build had no drop handling at all and
   simply ignored the file. */
.capture.dragging {
  border-style: solid;
  border-color: var(--accent);
  background: linear-gradient(180deg, rgba(242, 163, 60, 0.16), rgba(242, 163, 60, 0.04));
  transform: translateY(-2px);
}
.capture.dragging * { pointer-events: none; }

/* The drag hint is desktop-only advice. Hide it on touch devices, where 90% of
   these customers are and where there is nothing to drag. */
.drop-hint { display: none; }
@media (hover: hover) and (pointer: fine) {
  .drop-hint { display: inline; }
}

/* Consent is a hard gate - if it cannot be ticked the customer cannot submit at
   all - so it gets a finger-sized box, not a 17px one. The label is already
   large and bound to the input, but people aim at the box. */
.consent input[type='checkbox'] {
  width: 22px;
  height: 22px;
  min-width: 22px;
  accent-color: var(--accent);
  cursor: pointer;
}
.capture input[type='file'] {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  inset: 0;
  cursor: pointer;
}
/* display:block is load-bearing, not tidiness. This is a <span>, so it is
 * inline by default, and width/height do not apply to inline boxes — the
 * windscreen shape collapsed to the width of its own 2px borders and rendered
 * as a bare orange line in the middle of the card. Caught by rendering it;
 * nothing in the markup or the rule looks wrong on the page. */
.capture .icon {
  display: block;
  width: 46px;
  height: 34px;
  margin: 0 auto 16px;
  border: 2px solid var(--accent);
  border-radius: 12px 12px 4px 4px;
  position: relative;
}
.capture .icon::after {
  content: '';
  position: absolute;
  inset: 6px 8px auto 8px;
  height: 2px;
  background: var(--accent);
  opacity: 0.5;
}
.capture .big {
  font-family: var(--font-display);
  font-size: 1.22rem;
  font-weight: 600;
  display: block;
  margin-bottom: 6px;
}
.capture .sub { color: var(--muted); font-size: 0.9rem; }

/* Secondary, smaller capture used for the damage and mirror photos. */
.capture.mini { padding: 20px 18px; text-align: left; display: flex; gap: 14px; align-items: center; }
.capture.mini .icon { display: block; margin: 0; width: 34px; height: 25px; flex: none; }
.capture.mini .big { font-size: 0.98rem; margin: 0; }

.preview {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
  margin-bottom: 14px;
}
.preview img { display: block; width: 100%; height: auto; }
.preview .retake {
  position: absolute;
  right: 10px;
  bottom: 10px;
  background: rgba(10, 12, 14, 0.82);
  backdrop-filter: blur(6px);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 999px;
  padding: 7px 15px;
  font-size: 0.8rem;
  cursor: pointer;
}

/* --- consent ---------------------------------------------------------- */

/* The material facts, above the tick and at readable size.
   Not inside the label and not behind an expander: a consent to sending
   someone's number plate overseas has to be informed, and nobody reads a
   sixty-word tick label. Slightly brighter than the tick itself so the eye
   lands here first. */
.consent-notice {
  margin-top: 20px;
  padding: 16px 18px;
  background: var(--panel-2);
  border: 1px solid var(--line-soft);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
}
.consent-notice h3 {
  margin: 0 0 8px;
  font-size: 0.92rem;
  color: var(--text);
  letter-spacing: 0.01em;
}
.consent-notice p {
  margin: 0;
  font-size: 0.87rem;
  line-height: 1.6;
  color: var(--muted);
}

/* The quieter half - true, but not what the decision turns on. */
.consent-fine {
  margin: 10px 2px 0;
  font-size: 0.78rem;
  line-height: 1.55;
  color: var(--muted);
  opacity: 0.85;
}

.consent {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-top: 12px;
  padding: 15px 16px;
  background: var(--panel-2);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
}
.consent input { margin-top: 3px; flex: none; width: 17px; height: 17px; accent-color: var(--accent); }
.consent label { font-size: 0.84rem; color: var(--muted); line-height: 1.5; }
.consent a { color: var(--glass); }

/* --- forms ------------------------------------------------------------ */

.field { margin-bottom: 15px; }
.field > label {
  font-family: var(--font-display);
  font-variation-settings: 'wdth' 116;
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  display: block;
  margin-bottom: 7px;
}

input[type='text'],
input[type='tel'],
input[type='email'],
input[type='number'],
textarea,
select {
  width: 100%;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text);
  font: inherit;
  padding: 12px 14px;
  transition: border-color 0.15s;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
}
textarea { resize: vertical; min-height: 96px; }
::placeholder { color: #5C6873; }

.row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 560px) { .row { grid-template-columns: 1fr; gap: 0; } }

/* Plate goes uppercase and monospaced — it is a reference code, and it reads
 * as one. Also stops "0 vs O" ambiguity when staff read it back. */
.plate-input {
  font-family: ui-monospace, 'SFMono-Regular', 'Cascadia Mono', Consolas, monospace;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 1.1rem;
}

/* --- buttons ---------------------------------------------------------- */

.btn {
  font-family: var(--font-display);
  font-variation-settings: 'wdth' 110;
  font-weight: 600;
  font-size: 0.92rem;
  letter-spacing: 0.04em;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 14px 26px;
  cursor: pointer;
  transition: filter 0.15s, border-color 0.15s, background 0.15s;
}
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--muted); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; filter: none; }
.btn-block { width: 100%; }

.actions { display: flex; gap: 10px; margin-top: 22px; }
.actions .btn-primary { flex: 1; }

/* --- AI result chips -------------------------------------------------- */

.found { display: grid; gap: 1px; background: var(--line-soft); border-radius: var(--radius-sm); overflow: hidden; }
.found .cell {
  background: var(--panel-2);
  padding: 12px 14px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.found .k {
  font-family: var(--font-display);
  font-variation-settings: 'wdth' 116;
  font-size: 0.64rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}
.found .v { font-weight: 500; }
.found .v.none { color: var(--muted); font-style: italic; font-weight: 400; }

.conf {
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid;
  white-space: nowrap;
}
.conf.high   { color: var(--ok);    border-color: rgba(99, 200, 139, 0.35); }
.conf.medium { color: var(--warn);  border-color: rgba(232, 178, 60, 0.35); }
.conf.low,
.conf.none   { color: var(--alert); border-color: rgba(232, 115, 74, 0.4); }

/* --- variant questions ------------------------------------------------ */

.q { border-top: 1px solid var(--line); padding: 20px 0; }
.q:first-of-type { border-top: 0; padding-top: 4px; }
.q .qtext { font-weight: 500; color: var(--text); margin: 0 0 6px; }
.q .qhelp { font-size: 0.85rem; color: var(--muted); margin: 0 0 13px; }

.opts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.opts label {
  position: relative;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 11px 6px;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--muted);
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  user-select: none;
}
.opts input { position: absolute; opacity: 0; pointer-events: none; }
.opts label:hover { border-color: var(--muted); }
.opts input:checked + span { color: var(--accent-ink); }
.opts label:has(input:checked) { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
/* "Not sure" is styled as a legitimate equal answer, not a lesser one —
 * a customer who feels judged for it will guess, and a guess is what puts
 * the wrong windscreen on the van. */
.opts input:focus-visible + span { outline: 2px solid var(--glass); outline-offset: 3px; }

/* --- notices ---------------------------------------------------------- */

.notice {
  border-left: 2px solid var(--glass);
  background: rgba(143, 186, 205, 0.06);
  padding: 13px 16px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.88rem;
  color: var(--muted);
  margin: 0 0 16px;
}
.notice.warn { border-color: var(--warn); background: rgba(232, 178, 60, 0.06); }
.notice.bad  { border-color: var(--alert); background: rgba(232, 115, 74, 0.07); color: #F0C0AC; }
.notice strong { color: var(--text); }

/* --- working / spinner ------------------------------------------------ */

.working { text-align: center; padding: 60px 0; }
.scan {
  width: 84px;
  height: 60px;
  margin: 0 auto 26px;
  border: 2px solid var(--line);
  border-radius: 16px 16px 5px 5px;
  position: relative;
  overflow: hidden;
}
.scan::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent);
  box-shadow: 0 0 14px 2px var(--accent);
  animation: sweep 1.5s ease-in-out infinite;
}
@keyframes sweep {
  0%, 100% { top: 8%; }
  50%      { top: 88%; }
}

/* --- confirmation ----------------------------------------------------- */

.done-mark {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  display: grid;
  place-items: center;
  margin: 0 0 24px;
}
.done-mark::after {
  content: '';
  width: 18px;
  height: 9px;
  border-left: 2px solid var(--accent);
  border-bottom: 2px solid var(--accent);
  transform: rotate(-45deg) translate(1px, -2px);
}

.refbox {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
  background: var(--panel);
  margin: 22px 0;
}
.refbox .num {
  font-family: ui-monospace, 'SFMono-Regular', Consolas, monospace;
  font-size: 1.65rem;
  letter-spacing: 0.1em;
  color: var(--accent);
  display: block;
  margin-top: 4px;
}

.foot {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 26px var(--pad) 46px;
  border-top: 1px solid var(--line-soft);
  color: #5C6873;
  font-size: 0.78rem;
  position: relative;
  z-index: 1;
}
.foot a { color: #6E7C88; }

.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;
}

/* ---- provisional price notice ------------------------------------------ */
/* Deliberately loud. An estimate that reads like a firm quote is the one way
   this flow could hurt the customer or the shop. */
.provisional {
  margin: 14px 0 18px;
  padding: 14px 16px;
  border: 1px solid rgba(242, 163, 60, .5);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(242,163,60,.12), rgba(242,163,60,.03));
  font-size: .92rem;
  line-height: 1.6;
}
.provisional strong { color: var(--text); }

/* ---- shared toast + modal confirm (T-BAS-037, assets/ui.js) ------------
 * Fully namespaced (ui-*) on purpose: console.css redefines a bare `.btn`
 * for its own gate form, so anything shared has to avoid that name entirely
 * rather than rely on cascade order. Every colour below is one of the
 * custom properties at the top of this file - a rebrand stays one edit there.
 * No @keyframes here deliberately: enter/exit uses `transition`, which the
 * prefers-reduced-motion rule near the top of this file already switches
 * off site-wide, so this component inherits that for free.
 */

.ui-toast-host {
  position: fixed;
  left: 50%;
  bottom: max(18px, env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  flex-direction: column-reverse;
  gap: 10px;
  width: min(420px, calc(100vw - 32px));
  pointer-events: none;
}

.ui-toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 3px solid var(--muted);
  border-radius: var(--radius-sm);
  padding: 13px 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  color: var(--text);
  font-size: 0.92rem;
  line-height: 1.45;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.ui-toast.is-in { opacity: 1; transform: none; }
.ui-toast.is-out { opacity: 0; transform: translateY(4px); }
.ui-toast--error { border-left-color: var(--alert); }
.ui-toast--ok { border-left-color: var(--ok); }

.ui-toast__msg { flex: 1; }

.ui-toast__close {
  flex: none;
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  padding: 2px 5px;
  margin: -2px -4px 0 0;
  border-radius: 4px;
}
.ui-toast__close:hover { color: var(--text); }
.ui-toast__close:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

@media (max-width: 480px) {
  .ui-toast-host { width: calc(100vw - 24px); }
}

.ui-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--pad);
  background: rgba(6, 8, 10, 0.72);
  opacity: 0;
  transition: opacity 0.18s ease;
}
.ui-modal-overlay.is-in { opacity: 1; }

.ui-modal {
  width: 100%;
  max-width: 420px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(20px, 5vw, 28px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  transform: translateY(10px);
  transition: transform 0.18s ease;
}
.ui-modal-overlay.is-in .ui-modal { transform: none; }

.ui-modal__body {
  color: var(--text);
  margin: 0;
  white-space: pre-line; /* the old confirm()'s \n\n still reads as two lines */
}

.ui-modal__actions {
  display: flex;
  gap: 10px;
  margin-top: 22px;
}

.ui-modal__btn {
  flex: 1;
  font-family: var(--font-display);
  font-variation-settings: 'wdth' 110;
  font-weight: 600;
  font-size: 0.92rem;
  letter-spacing: 0.04em;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 13px 20px;
  cursor: pointer;
  transition: filter 0.15s, border-color 0.15s, background 0.15s;
}
.ui-modal__btn--ghost { background: transparent; color: var(--text); border-color: var(--line); }
.ui-modal__btn--ghost:hover { border-color: var(--muted); }
.ui-modal__btn--primary { background: var(--accent); color: var(--accent-ink); }
.ui-modal__btn--primary:hover { filter: brightness(1.08); }
.ui-modal__btn--danger { background: var(--alert); color: var(--accent-ink); }
.ui-modal__btn--danger:hover { filter: brightness(1.08); }
.ui-modal__btn:focus-visible { outline: 2px solid var(--glass); outline-offset: 2px; }

@media (max-width: 380px) {
  .ui-modal__actions { flex-direction: column-reverse; }
}
