/* public/driver.css
 *
 * The "Wallet" direction: the screen behaves like a payment sheet, because
 * the pattern a driver already trusts for paying on a phone is Apple Pay's
 * sheet, not a web page. Context sits on the ground above; everything they
 * act on is in the white sheet below.
 *
 * Deliberately single-theme. This is a page people open outdoors, at a
 * charger, once — a light sheet on a cool ground is legible in daylight and
 * at night, and following the phone's dark mode would mean two palettes to
 * keep contrast-checked on a money path for no gain to the driver.
 */

:root {
  --ground: #dbe5e8;
  --ground-2: #e4ebed;
  --sheet: #ffffff;
  --sub: #f3f7f8;
  --line: #dee7ea;
  --line-2: #eaf0f2;

  --ink: #0e1b21;
  --muted: #5d7178;
  --faint: #93a7ae;

  /* Brand cyan is #6BC5D2. It carries the identity but fails contrast as a
   * text or button colour on white, so the interactive colour is the same
   * hue darkened to hold AA, and the light cyan is kept for fills and rings. */
  --brand: #0f7c8b;
  --brand-press: #0b636f;
  --brand-soft: #6bc5d2;
  --brand-wash: #edf7f9;

  --live: #0e9f6e;
  --warn: #b4740a;
  --bad: #c4453f;

  --f-dis: "Familjen Grotesk", ui-sans-serif, system-ui, sans-serif;
  --f-body: "Public Sans", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --f-num: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --sheet-radius: 26px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
}

body {
  background: var(--ground);
  color: var(--ink);
  font: 400 16px/1.55 var(--f-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* The sheet is pinned to the bottom of the viewport on a phone, so the
   * page itself must never bounce-scroll behind it. */
  overscroll-behavior-y: none;
}

.app {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  max-width: 480px;
  margin: 0 auto;
  background: var(--ground);
}

/* ---------------------------------------------------------------- context */

.context {
  flex: none;
  padding: calc(18px + env(safe-area-inset-top)) 24px 22px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.context .logo {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 12px;
}
.context .logo img { width: 18px; height: 18px; object-fit: contain; }
.context .logo b {
  font: 600 12.5px/1 var(--f-dis);
  letter-spacing: -0.02em;
  color: var(--muted);
}

.context h1 {
  margin: 0;
  font: 600 17px/1.25 var(--f-dis);
  letter-spacing: -0.02em;
  text-wrap: balance;
}
.context .sub {
  margin: 0;
  font: 400 12px/1.4 var(--f-num);
  color: var(--muted);
}

/* ------------------------------------------------------------------ sheet */

.sheet {
  flex: 1 1 auto;
  min-height: 0;
  background: var(--sheet);
  border-radius: var(--sheet-radius) var(--sheet-radius) 0 0;
  box-shadow: 0 -8px 28px -14px rgba(14, 27, 33, 0.34);
  display: flex;
  flex-direction: column;
  padding: 0 24px calc(22px + env(safe-area-inset-bottom));
}

.grabber {
  width: 38px;
  height: 4px;
  border-radius: 99px;
  background: var(--line);
  margin: 11px auto 18px;
  flex: none;
}

.scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  -webkit-overflow-scrolling: touch;
}

/* In a scrolling flex column, children must not shrink.
 *
 * flex-shrink defaults to 1, so when a screen's content is taller than the
 * sheet the items compress instead of the container scrolling. Most elements
 * here have text in them and stop at their own min-content height, which
 * hides the problem. The Stripe Payment Element does not: its height comes
 * from an iframe with no intrinsic content height, so it collapsed to zero
 * and produced a payment form that was present in the DOM, raised no error,
 * and could not be typed into. */
.scroll > * {
  flex-shrink: 0;
}

.actions {
  flex: none;
  padding-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

h2 {
  margin: 0 0 5px;
  font: 700 25px/1.15 var(--f-dis);
  letter-spacing: -0.03em;
  text-wrap: balance;
}
.lede {
  margin: 0 0 20px;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--muted);
}
.lede b, .lede strong { color: var(--ink); font-weight: 600; }

.eyebrow {
  font: 500 10px/1 var(--f-num);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--faint);
}

/* ------------------------------------------------------------ amount block */

.amount {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 16px 18px;
  border-radius: 16px;
  background: var(--sub);
  border: 1px solid var(--line);
  margin-bottom: 16px;
}
.amount b {
  font: 700 38px/0.92 var(--f-dis);
  letter-spacing: -0.035em;
  font-variant-numeric: tabular-nums;
}
.amount span { font: 400 13px/1 var(--f-num); color: var(--muted); }
.amount.center { justify-content: center; }
.amount.paid b { color: var(--brand); }

/* -------------------------------------------------------------------- rows */

.rows { display: flex; flex-direction: column; }
.row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13.5px;
}
.row:last-child { border-bottom: 0; }
.row .k { color: var(--muted); flex: none; }
.row .v {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.row .v.mono { font-family: var(--f-num); font-size: 13px; }

/* ----------------------------------------------------------------- fields */

.field-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 7px;
}
.field {
  display: flex;
  align-items: stretch;
  border-radius: 13px;
  overflow: hidden;
  background: var(--sub);
  border: 1px solid var(--line);
  transition: border-color 0.15s;
}
.field .cc {
  display: flex;
  align-items: center;
  padding: 0 13px;
  border-right: 1px solid var(--line);
  font: 500 14px/1 var(--f-num);
  color: var(--muted);
  white-space: nowrap;
}
.field input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: 0;
  outline: 0;
  padding: 15px 14px;
  font: 400 15px/1 var(--f-num);
  color: var(--ink);
  letter-spacing: 0.02em;
}
.field input::placeholder { color: var(--faint); }
.field:focus-within { border-color: var(--brand); }
.field.invalid { border-color: var(--bad); }

.hint { margin: 8px 0 0; font-size: 12px; color: var(--faint); }
.hint.error { color: var(--bad); }

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

.btn {
  appearance: none;
  cursor: pointer;
  width: 100%;
  border: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  font-family: var(--f-body);
  transition: filter 0.16s, background 0.16s, opacity 0.16s;
}
.btn:hover:not([disabled]) { filter: brightness(1.06); }
.btn:active:not([disabled]) { filter: brightness(0.96); }

.btn-primary {
  background: var(--brand);
  color: #fff;
  padding: 17px 20px;
  border-radius: 14px;
  font-size: 15.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.btn-ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  padding: 14px 20px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
}
.btn-ghost:hover:not([disabled]) { color: var(--ink); }
.btn[disabled] { cursor: default; opacity: 0.55; filter: none; }

:where(button, a, input, summary):focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: 8px;
}

/* --------------------------------------------------------------- callouts */

.callout {
  padding: 12px 14px;
  border-radius: 11px;
  font-size: 12.5px;
  line-height: 1.55;
  background: var(--brand-wash);
  border: 1px solid #cfe8ed;
  color: var(--muted);
  margin-bottom: 14px;
}
.callout b { color: var(--ink); font-weight: 600; }
.callout.warn { background: #fdf6e9; border-color: #f0e0bd; }
.callout.bad { background: #fdf0ef; border-color: #f3d5d3; }

/* ------------------------------------------------------------------ ring */

.ring {
  display: grid;
  place-items: center;
  position: relative;
  margin: 4px auto 18px;
  width: 132px;
  height: 132px;
}
.ring svg { transform: rotate(-90deg); display: block; }
.ring .mid { position: absolute; text-align: center; }
.ring .mid b {
  display: block;
  font: 700 33px/1 var(--f-dis);
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.ring .mid span {
  font: 400 11px/1 var(--f-num);
  color: var(--muted);
  letter-spacing: 0.08em;
}
.ring circle.track { stroke: var(--line); }
.ring circle.fill {
  stroke: var(--brand-soft);
  transition: stroke-dashoffset 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}
.pair div {
  padding: 13px 15px;
  border-radius: 13px;
  background: var(--sub);
  border: 1px solid var(--line);
}
.pair b {
  display: block;
  font: 500 19px/1 var(--f-num);
  margin-bottom: 5px;
  font-variant-numeric: tabular-nums;
}
.pair span {
  font: 400 10px/1 var(--f-body);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
}

/* ----------------------------------------------------------------- glyphs */

.glyph {
  width: 66px;
  height: 66px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex: none;
  border: 1.5px solid currentColor;
  margin: 6px 0 16px;
}
.glyph.good { color: var(--brand); background: var(--brand-wash); }
.glyph.bad { color: var(--bad); background: #fdf0ef; }

.centred { align-items: center; text-align: center; }
.centred .rows { width: 100%; text-align: left; }
.centred .amount { width: 100%; }

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

.steps { display: flex; flex-direction: column; gap: 13px; margin: 4px 0 20px; }
.stp { display: flex; align-items: center; gap: 11px; font-size: 13.5px; color: var(--faint); }
.stp .mk {
  width: 19px;
  height: 19px;
  border-radius: 50%;
  flex: none;
  display: grid;
  place-items: center;
  border: 1.5px solid var(--line);
  font: 500 10px/1 var(--f-num);
}
.stp.done { color: var(--muted); }
.stp.done .mk { background: var(--brand); border-color: var(--brand); color: #fff; }
.stp.now { color: var(--ink); font-weight: 500; }
.stp.now .mk {
  border-color: var(--brand);
  border-right-color: transparent;
  animation: spin 0.85s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.track {
  height: 5px;
  border-radius: 99px;
  background: var(--sub);
  overflow: hidden;
  border: 1px solid var(--line);
}
.track > i { display: block; height: 100%; background: var(--brand-soft); border-radius: 99px; }
.track.indet > i { width: 38%; animation: slide 1.5s cubic-bezier(0.62, 0.06, 0.36, 0.96) infinite; }
@keyframes slide {
  0% { transform: translateX(-105%); }
  100% { transform: translateX(300%); }
}

/* ------------------------------------------------------------------- misc */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 999px;
  font: 500 10.5px/1 var(--f-num);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  align-self: flex-start;
}
.pill i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.pill.ok { color: var(--brand); background: var(--brand-wash); border: 1px solid #cfe8ed; }
.pill.go { color: var(--live); background: #e9f8f2; border: 1px solid #c6ecdd; }
.pill.go i { animation: breathe 2.4s ease-in-out infinite; }
.pill.no { color: var(--bad); background: #fdf0ef; border: 1px solid #f3d5d3; }
@keyframes breathe { 0%, 100% { opacity: 1; } 50% { opacity: 0.28; } }

.fineprint {
  margin: 14px 0 0;
  font: 400 11px/1.65 var(--f-num);
  color: var(--faint);
  text-align: center;
}
.fineprint a { color: var(--muted); }

#stripe-payment, #stripe-express { margin-bottom: 14px; }

.sep {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 4px 0 16px;
  font: 500 11px/1 var(--f-num);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
}
.sep::before, .sep::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

[hidden] { display: none !important; }

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