/* ─────────────────────────────────────────────────────────────────────────────
   Trade Pilot public pages, editorial direction.
   Shared by the quote page and the invoice page. Deliberately no framework:
   a customer on 4G should have this rendered before they notice it loading.

   The tradesperson's brand colour arrives from their profile and is injected
   onto :root as --brand, so this page belongs to them, not to us.
   ──────────────────────────────────────────────────────────────────────────── */

:root {
  --paper:      #FBF9F6;
  --ink:        #1A1A1A;
  --ink-2:      #6B6660;
  --ink-3:      #8C867E;
  --rule:       #E6E2DC;
  --brand:      #14395F;   /* overridden at runtime from the trader's profile */
  --brand-ink:  #FFFFFF;
  --amber:      #8A5A00;
  --amber-bg:   #FBF3E4;
  --go:         #0B6337;
  --max:        520px;
}

* { box-sizing: border-box; -webkit-text-size-adjust: 100%; }

/* A display rule on a class must never beat the hidden attribute. */
[hidden] { display: none !important; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  font-feature-settings: "cv05" 1;
  -webkit-font-smoothing: antialiased;
}

.serif { font-family: "Instrument Serif", Georgia, "Times New Roman", serif; font-weight: 400; }

.shell { max-width: var(--max); margin: 0 auto; }

/* ── Type ──────────────────────────────────────────────────────────────── */
.label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 0 0 14px;
}
.lede { font-size: 17px; color: var(--ink-2); margin: 0; }
h2.sec {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -.02em;
  margin: 0 0 18px;
}

/* ── Hero ──────────────────────────────────────────────────────────────── */
.hero {
  position: relative;
  min-height: 60vh;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 24px;
  color: #fff;
  overflow: hidden;
  background: #23303D;
}
.hero-img {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  /* Fallback texture when the trader has attached no photo. Warm light across
     slate, so an empty hero still reads as intentional rather than broken. */
  background-image:
    radial-gradient(120% 80% at 18% 12%, rgba(226,206,178,.42) 0%, rgba(226,206,178,0) 58%),
    radial-gradient(90% 70% at 88% 30%, rgba(126,150,175,.38) 0%, rgba(126,150,175,0) 62%),
    linear-gradient(158deg, #46586B 0%, #313E4C 46%, #1E2732 100%);
}
.hero-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(16,22,28,.55) 0%, rgba(16,22,28,.12) 34%, rgba(16,22,28,.82) 100%);
}
.hero-top {
  position: absolute;
  top: 0; left: 0; right: 0;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 24px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: rgba(255,255,255,.86);
}
.hero-body { position: relative; }
.hero-logo {
  width: 56px; height: 56px;
  border-radius: 10px;
  background: #fff;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 18px;
  overflow: hidden;
}
.hero-logo img { width: 100%; height: 100%; object-fit: contain; }
.hero-logo span { font-weight: 700; font-size: 19px; color: var(--brand); letter-spacing: -.02em; }
.hero h1 {
  font-size: 46px;
  line-height: 1.02;
  letter-spacing: -.01em;
  margin: 0 0 14px;
}
.hero .job { font-size: 17px; margin: 0; color: rgba(255,255,255,.94); }
.hero .addr { font-size: 15px; margin: 3px 0 0; color: rgba(255,255,255,.78); }
.hero .by { font-size: 14px; margin: 16px 0 0; color: rgba(255,255,255,.72); }

/* ── Sections ──────────────────────────────────────────────────────────── */
main { padding: 0 24px 140px; }
section { padding: 44px 0 0; }
section + section { border-top: 1px solid var(--rule); margin-top: 44px; }

/* ── Price ─────────────────────────────────────────────────────────────── */
.price-fig {
  font-size: 68px;
  line-height: 1;
  letter-spacing: -.02em;
  margin: 0;
  font-variant-numeric: tabular-nums;
}
.price-rule { border: 0; border-top: 1px solid var(--ink); margin: 22px 0 14px; }
.price-meta {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-size: 14px;
  color: var(--ink-2);
}
.expiry-soon { color: var(--amber); font-weight: 600; }

/* ── Line items ────────────────────────────────────────────────────────── */
.items { margin: 0; }
.row {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 15px 0;
  border-top: 1px solid var(--rule);
}
.row:first-child { border-top: 0; padding-top: 0; }
.row .d { font-size: 16px; margin: 0; }
.row .m { font-size: 14px; color: var(--ink-2); margin: 3px 0 0; }
.row .a {
  font-size: 16px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.row.credit .a, .row.credit .d { color: var(--go); }
.totals { margin-top: 6px; border-top: 1px solid var(--ink); padding-top: 16px; }
.trow {
  display: flex;
  justify-content: space-between;
  font-size: 15px;
  color: var(--ink-2);
  padding: 5px 0;
}
.trow span:last-child { font-variant-numeric: tabular-nums; }
.trow.grand { color: var(--ink); font-size: 19px; font-weight: 600; padding-top: 14px; }

/* ── Note from the trader, the one deliberate container ────────────────── */
.note {
  background: var(--brand);
  color: var(--brand-ink);
  border-radius: 12px;
  padding: 26px 24px;
}
.note .label { color: rgba(255,255,255,.72); }
.note p { font-size: 18px; line-height: 1.5; margin: 0; }
.note .sig { font-size: 14px; margin: 16px 0 0; color: rgba(255,255,255,.75); }

/* ── Photos ────────────────────────────────────────────────────────────── */
figure { margin: 0 0 22px; }
figure:last-child { margin-bottom: 0; }
.shot {
  aspect-ratio: 4 / 3;
  border-radius: 10px;
  background-size: cover;
  background-position: center;
  background-color: #3B4A5A;
  background-image:
    radial-gradient(110% 80% at 22% 16%, rgba(226,206,178,.34) 0%, rgba(226,206,178,0) 60%),
    linear-gradient(155deg, #4C5D70 0%, #35424F 52%, #232C36 100%);
}
figcaption { font-size: 14px; color: var(--ink-2); margin-top: 9px; }

/* ── Terms ─────────────────────────────────────────────────────────────── */
details { border-top: 1px solid var(--rule); }
details:last-of-type { border-bottom: 1px solid var(--rule); }
summary {
  list-style: none;
  cursor: pointer;
  padding: 17px 0;
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
summary::-webkit-details-marker { display: none; }
summary svg { flex: 0 0 auto; transition: transform .22s ease; color: var(--ink-3); }
details[open] summary svg { transform: rotate(180deg); }
.terms-body { padding: 0 0 20px; font-size: 15px; color: var(--ink-2); }
.terms-body p { margin: 0 0 12px; }
.terms-body p:last-child { margin: 0; }
.terms-body strong { color: var(--ink); font-weight: 600; }

/* ── Credentials ───────────────────────────────────────────────────────── */
.creds { display: grid; gap: 0; }
.cred {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 0;
  border-top: 1px solid var(--rule);
  font-size: 15px;
}
.cred:first-child { border-top: 0; padding-top: 0; }
.cred .k { color: var(--ink-2); }
.cred .v { font-weight: 600; font-variant-numeric: tabular-nums; }

/* ── Form and actions ──────────────────────────────────────────────────── */
label.fl {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-2);
  margin: 0 0 8px;
}
input[type=text] {
  width: 100%;
  padding: 15px 16px;
  font: inherit;
  font-size: 17px;
  color: var(--ink);
  background: #fff;
  border: 1px solid #D9D4CC;
  border-radius: 10px;
}
input[type=text]:focus-visible,
button:focus-visible,
a:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}
.sig-wrap { position: relative; margin-top: 22px; }
canvas.sig {
  display: block;
  width: 100%;
  height: 156px;
  background: #fff;
  border: 1px solid #D9D4CC;
  border-radius: 10px;
  touch-action: none;
}
.sig-hint {
  position: absolute;
  left: 0; right: 0; bottom: 30px;
  text-align: center;
  font-size: 15px;
  color: var(--ink-3);
  pointer-events: none;
}
.sig-base {
  position: absolute;
  left: 22px; right: 22px; bottom: 46px;
  border-top: 1px solid #E2DDD5;
  pointer-events: none;
}
.sig-clear {
  background: none;
  border: 0;
  padding: 10px 0 0;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--brand);
  cursor: pointer;
}
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 18px;
  margin: 22px 0 0;
  border: 0;
  border-radius: 10px;
  font: inherit;
  font-size: 17px;
  font-weight: 600;
  color: #fff;
  background: var(--go);
  cursor: pointer;
}
.btn:active { transform: scale(.99); }
.btn[disabled] { background: #DCD8D1; color: #8C867E; cursor: default; }
.btn.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid #D9D4CC;
}
.btn.brand { background: var(--brand); }
.hint { font-size: 14px; color: var(--ink-2); margin: 12px 0 0; text-align: center; }
.err { font-size: 14px; color: #A3231A; margin: 10px 0 0; }

.linkrow { display: flex; gap: 12px; margin-top: 14px; }
.linkrow a {
  flex: 1;
  text-align: center;
  padding: 15px;
  border-radius: 10px;
  border: 1px solid #D9D4CC;
  text-decoration: none;
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
  background: transparent;
}

/* ── Sticky total bar ──────────────────────────────────────────────────── */
.stickybar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: rgba(251,249,246,.94);
  backdrop-filter: saturate(1.6) blur(12px);
  border-top: 1px solid var(--rule);
  transform: translateY(120%);
  transition: transform .28s cubic-bezier(.22,.61,.36,1);
  z-index: 40;
  padding-bottom: env(safe-area-inset-bottom);
}
.stickybar.on { transform: translateY(0); }
.stickybar .inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.stickybar .lab { font-size: 11px; letter-spacing: .13em; text-transform: uppercase; color: var(--ink-3); margin: 0; font-weight: 700; }
.stickybar .val { font-size: 21px; font-weight: 600; margin: 0; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.stickybar button {
  border: 0;
  border-radius: 9px;
  padding: 14px 26px;
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  background: var(--go);
  cursor: pointer;
}

/* ── Accepted view ─────────────────────────────────────────────────────── */
.tick {
  width: 62px; height: 62px;
  border-radius: 50%;
  background: var(--go);
  display: flex; align-items: center; justify-content: center;
  margin: 0 0 26px;
}
.steps { margin: 0; }
.step { display: flex; gap: 16px; padding: 16px 0; border-top: 1px solid var(--rule); }
.step:first-child { border-top: 0; padding-top: 0; }
.step .n {
  flex: 0 0 24px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  padding-top: 2px;
}
.step h4 { margin: 0; font-size: 16px; font-weight: 600; }
.step p { margin: 3px 0 0; font-size: 15px; color: var(--ink-2); }
.fraud {
  margin-top: 22px;
  padding: 16px 18px;
  border-radius: 10px;
  background: var(--amber-bg);
  color: var(--amber);
  font-size: 14.5px;
  line-height: 1.55;
}
.fraud strong { font-weight: 700; }

/* ── Footer ────────────────────────────────────────────────────────────── */
footer { padding: 44px 24px 40px; border-top: 1px solid var(--rule); margin-top: 44px; }
footer p { margin: 0; font-size: 13.5px; color: var(--ink-3); line-height: 1.7; }
footer .powered { margin-top: 18px; font-size: 12px; color: #A9A29A; }

/* ── States ────────────────────────────────────────────────────────────── */
.centre {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 28px;
}
.centre h1 { font-size: 30px; letter-spacing: -.02em; margin: 0 0 12px; }
.centre p { font-size: 16px; color: var(--ink-2); margin: 0 0 26px; max-width: 34ch; }
.spinner {
  width: 26px; height: 26px;
  border: 2px solid var(--rule);
  border-top-color: var(--ink-3);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Scroll reveal ─────────────────────────────────────────────────────── */
.rise { opacity: 0; transform: translateY(14px); transition: opacity .5s ease, transform .5s cubic-bezier(.22,.61,.36,1); }
.rise.in { opacity: 1; transform: none; }

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

@media (min-width: 560px) {
  .hero { min-height: 56vh; padding: 32px; }
  .hero h1 { font-size: 54px; }
  .price-fig { font-size: 78px; }
  main { padding: 0 32px 140px; }
  footer { padding: 48px 32px 44px; }
}
