/* booking.css  Prices, the trip strip and the checkout.

   Loaded after site.css on every page that shows a price for a trip (home,
   /fleet, a vehicle page, /checkout) and on /booking-confirmed. It uses
   site.css's tokens and adds one: the green a discount is tagged in.

   Three parts:
     1. the deal price on a card: the struck rate, the rate charged, the tag
     2. the trip strip with its "Where" field
     3. the checkout form, its summary, and the confirmation page */

:root {
  --deal:    #5FBF85;                   /* 7.9:1 on ground, 7.5:1 on card */
  --deal-bg: rgba(95, 191, 133, 0.14);
  --danger:  #F08A80;                   /* 7.0:1 on card */
}

/* ── 1. The deal price ──────────────────────────────────────── */

.car-deal {
  order: 0;
  justify-self: start;
  padding: 0.2rem 0.5rem;
  border-radius: var(--r);
  background: var(--deal-bg);
  color: var(--deal);
  font-family: var(--mono);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1.4;
}
.car-deal[hidden], .car-price[hidden], .feat-big[hidden] { display: none; }
.car-price-deal s, .co-lines s {
  color: var(--ink-mute);
  font-size: 0.9375rem;
  font-weight: 400;
  text-decoration-thickness: 1px;
}
.car-price-deal b { color: var(--deal); }
.feat-big.car-price-deal s { font-size: 1.125rem; margin-right: 0.15rem; }
/* The total is the number a customer with dates is deciding on, so once it
   is there it leads and the daily rate steps back. */
.car-pay .car-total { order: 3; }
.car-pay .car-quote-note { order: 4; }
[data-quote-state='ready'] .car-total b { font-size: 1.25rem; }
[data-quote-state='booked'] .car-quote-note,
[data-quote-state='short'] .car-quote-note { color: var(--accent); }
/* A card that cannot be had for these dates steps back; it is still a link
   to the car, so it is dimmed, not disabled. */
.fleet-grid [data-quote-state='booked'] .car-media { opacity: 0.55; }
.fleet-grid [data-quote-state='booked'] .car-price { color: var(--ink-mute); }
.quote-lines .is-saving dt, .quote-lines .is-saving dd,
.co-lines .is-saving dt, .co-lines .is-saving dd { color: var(--deal); }
.feat-price.car-pay { display: grid; gap: 0.3rem; }
.vehicle-book .car-deal { margin-bottom: 0.15rem; }

/* ── 2. The trip strip ──────────────────────────────────────── */

.booking.booking-strip { grid-template-columns: minmax(11rem, 0.8fr) 1fr 1fr auto; }
.booking-where select { font-weight: 500; }
@media (max-width: 1100px) {
  .booking.booking-strip { grid-template-columns: 1fr 1fr; }
  .booking-strip .booking-where { grid-column: 1 / -1; border-right: 0; border-bottom: 1px solid var(--line); }
  /* Return ends the row now, so its divider would sit against the box's
     own edge as a doubled line. The button takes the fields' inset, not a
     narrower one of its own: 12px beside fields at 18px read as a misfit. */
  .booking-strip .booking-where ~ .booking-field ~ .booking-field { border-right: 0; }
  .booking.booking-strip .btn { grid-column: 1 / -1; margin: 0 1.15rem 1.15rem; min-height: 52px; }
}
@media (max-width: 760px) {
  .booking.booking-strip { grid-template-columns: 1fr; }
  .booking.booking-strip .btn { margin-top: 1.15rem; }
}

/* ── 3. Checkout ────────────────────────────────────────────── */

.co-book[hidden] { display: none; }
.co-car [data-co-picker] { display: none; }

.co-book .co-layout { grid-template-columns: minmax(0, 1fr); gap: clamp(1.25rem, 3vw, 2.5rem); }
@media (min-width: 1000px) {
  .co-book .co-layout { grid-template-columns: minmax(0, 1fr) minmax(320px, 380px); }
  /* Sticky only on a screen tall enough to show all of it. On a shorter one
     a sticky box would hide its own last rows (the deposit) until the form
     ended, so it scrolls with the page instead. */
  .co-book .co-sum-img { aspect-ratio: 16 / 7; }
}
@media (min-width: 1000px) and (min-height: 860px) {
  .co-book .co-summary { position: sticky; top: calc(var(--nav-h) + 1rem); }
}
@media (max-width: 999px) {
  /* On a phone the summary comes first, without the photo: the price is on
     screen before the form asks for anything. */
  .co-book .co-summary { order: -1; }
  .co-book .co-sum-car { display: block; }
}

.co-form { display: grid; gap: clamp(1rem, 2vw, 1.5rem); min-width: 0; }
.co-step {
  display: grid;
  gap: 1rem;
  min-width: 0;
  padding: clamp(1.1rem, 2.5vw, 1.75rem);
  /* A step is a panel, told from the page by its fill. No outline: a
     hairline around a fieldset is rated as a control edge, and at 1.36:1 a
     hairline is not one. */
  border: 0;
  border-radius: var(--r-card);
  background: var(--panel);
}
.co-step legend {
  float: left;            /* a legend that takes part in the fieldset's grid */
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--serif);
  font-size: clamp(1.5rem, 2.4vw, 1.875rem);
  line-height: 1.1;
}
.co-step legend + * { clear: both; }
.co-num {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 1.75rem;
  height: 1.75rem;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  font-family: var(--mono);
  font-size: 0.8125rem;
  color: var(--ink-mute);
}

.co-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.9rem 1rem; }
.co-grid[hidden], .co-field[hidden], .co-hint[hidden], [data-co-insurance][hidden] { display: none; }
@media (max-width: 560px) { .co-grid { grid-template-columns: 1fr; } }

.co-field { display: grid; gap: 0.35rem; min-width: 0; align-content: start; }
.co-field label, .co-file-label { font-size: 0.875rem; font-weight: 500; color: var(--ink); }
.co-opt { color: var(--ink-mute); font-weight: 400; }
.co-field input, .co-field select, .co-field textarea {
  width: 100%;
  min-width: 0;
  min-height: 48px;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  background: var(--ground);
  color: var(--ink);
  font: inherit;
  font-size: 1rem;      /* 16px: iOS zooms the page for anything smaller */
}
.co-field textarea { min-height: 76px; resize: vertical; }
.co-field input::placeholder, .co-field textarea::placeholder { color: #8E9095; }
.co-field input:focus-visible, .co-field select:focus-visible, .co-field textarea:focus-visible,
.co-file input:focus-visible, .co-check input:focus-visible, .co-mode input:focus-visible + span {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}
.co-hint, .co-fine, .co-file-hint, .co-price-note { color: var(--ink-mute); font-size: 0.875rem; }
/* The cover-and-minimum note under "I will pick it up" and "Bring it to me".
   Set apart from the grey hints because a guest who misses it is refused
   later, at the documents step or at the counter. */
.co-cover { margin-top: 0.75rem; padding: 0.75rem 0.875rem; border: 1px solid var(--line-strong); border-left: 3px solid var(--accent, #e9d27a); border-radius: 8px; font-size: 0.875rem; line-height: 1.5; }
.co-cover b { display: block; margin-bottom: 0.25rem; }
.co-cover[hidden] { display: none; }
/* Where the booking will be listed. A rule on the left, like a notice, so
   it is read before the fields it is about. */
.co-account { margin-bottom: 1rem; padding: 0.7rem 0.9rem; border-left: 2px solid var(--accent); background: var(--ground); color: var(--ink-mute); font-size: 0.875rem; overflow-wrap: anywhere; }
.co-account[data-co-account-state='other'] { border-left-color: var(--rr-danger); color: var(--ink); }
.bc-account { margin-top: 0.75rem; }
.co-fine { max-width: 68ch; }

/* Where: three choices, each a whole tappable card. */
.co-modes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.6rem; }
@media (max-width: 720px) { .co-modes { grid-template-columns: 1fr; } }
.co-mode { position: relative; display: block; cursor: pointer; }
.co-mode input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.co-mode span {
  display: grid;
  gap: 0.2rem;
  height: 100%;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  background: var(--ground);
}
.co-mode b { font-weight: 500; }
.co-mode small { color: var(--ink-mute); font-size: 0.8125rem; }
.co-mode input:checked + span { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); background: var(--card); }

/* Uploads. */
.co-files { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.75rem; }
@media (max-width: 860px) { .co-files { grid-template-columns: 1fr; } }
.co-file {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  height: 100%;
  padding: 0.9rem 1rem;
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-card);
  background: var(--ground);
}
.co-file input[type='file'] { width: 100%; min-width: 0; margin-top: auto; padding-top: 0.6rem; color: var(--ink-mute); font: inherit; font-size: 0.875rem; }
/* Three tiles side by side, each label, hint, picker, state. A hint that
   wrapped to two lines put its tile's Choose file 23px below its
   neighbours'. The tiles are one height (the grid's row), so each picker
   is pushed to its tile's foot and the three line up whatever the hints
   say. The picker's button sits on its own line because beside it the
   browser's "No file chosen" was cut to "No fil...". */
.co-file input[type='file']::file-selector-button {
  display: block;
  margin: 0 0 0.45rem;
  padding: 0.5rem 0.8rem;
  min-height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  background: transparent;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}
.co-file-state { font-size: 0.875rem; min-height: 1.3em; color: var(--ink-mute); overflow-wrap: anywhere; }
.co-file[data-state='done'] { border-style: solid; border-color: var(--deal); }
.co-file[data-state='done'] .co-file-state { color: var(--deal); }
.co-file[data-state='failed'] { border-color: var(--danger); }
.co-file[data-state='failed'] .co-file-state { color: var(--danger); }

.co-check { display: grid; grid-template-columns: auto 1fr; gap: 0.75rem; align-items: start; cursor: pointer; font-size: 0.9375rem; }
.co-check input { width: 1.25rem; height: 1.25rem; margin-top: 0.15rem; accent-color: var(--ink); }

.co-error {
  padding: 0.8rem 1rem;
  border-left: 2px solid var(--danger);
  background: var(--card);
  color: var(--ink);
  font-size: 0.9375rem;
  border-radius: 0 var(--r-card) var(--r-card) 0;
}
.co-error[hidden] { display: none; }
.co-error:focus { outline: none; }
.co-submit { min-height: 56px; font-size: 1.0625rem; }

/* Read by people never: the honeypot. Off screen rather than display:none,
   which some form-filling scripts skip. */
.co-trap { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* The summary's price. */
.co-book .co-summary { gap: 0.75rem; padding: clamp(1rem, 2vw, 1.5rem); }
.co-sum-img[hidden] { display: none; }
.co-sum-trip .is-wide { grid-column: 1 / -1; }
.co-price { display: grid; gap: 0.5rem; }
.co-lines { font-size: 0.9375rem; }
.co-lines[hidden], .co-total[hidden] { display: none; }
.co-lines > div { display: flex; justify-content: space-between; gap: 1rem; padding: 0.45rem 0; border-bottom: 1px solid var(--line); }
.co-lines dt { color: var(--ink-mute); }
.co-lines dd { color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.co-lines .is-aside dd { color: var(--ink-mute); white-space: normal; text-align: right; }
.co-total { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; padding-top: 0.25rem; }
.co-total span { font-weight: 500; }
.co-total b { font-family: var(--serif); font-weight: 400; font-size: 2.25rem; line-height: 1; font-variant-numeric: tabular-nums; }
.co-sum-terms[hidden] { display: none; }
.co-book .co-sum-terms { grid-template-columns: 1fr; border-top: 1px solid var(--line); }

/* ── /booking-confirmed ─────────────────────────────────────── */

.bc-card {
  display: grid;
  gap: 1rem;
  max-width: 720px;
  padding: clamp(1.1rem, 2.5vw, 1.75rem);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-card);
  background: var(--card);
}
.bc-card[hidden], .bc-steps[hidden], .actions[hidden], [data-bc-pay][hidden] { display: none; }
.bc-ref { font-family: var(--mono); font-size: clamp(1.5rem, 4vw, 2rem); letter-spacing: 0.06em; }
.bc-rows:empty { display: none; }
.bc-steps { list-style: none; display: grid; gap: 0; }
.bc-steps li { position: relative; display: grid; gap: 0.15rem; padding: 0 0 1.1rem 2rem; }
.bc-steps li:last-child { padding-bottom: 0; }
.bc-steps li::before {
  content: '';
  position: absolute;
  left: 0.3rem;
  top: 0.3rem;
  width: 0.7rem;
  height: 0.7rem;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--card);
}
.bc-steps li::after { content: ''; position: absolute; left: 0.62rem; top: 1.15rem; bottom: 0; width: 1px; background: var(--line); }
.bc-steps li:last-child::after { display: none; }
.bc-steps span { color: var(--ink-mute); font-size: 0.9375rem; }
.bc-steps b { font-weight: 500; color: var(--ink-mute); }
.bc-steps [data-state='done'] b, .bc-steps [data-state='current'] b { color: var(--ink); }
.bc-steps [data-state='done']::before { background: var(--deal); border-color: var(--deal); }
.bc-steps [data-state='current']::before { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(207, 168, 94, 0.25); }

@media (prefers-reduced-motion: no-preference) {
  .co-file, .co-mode span { transition: border-color 160ms var(--ease), background-color 160ms var(--ease); }
}

/* The (i) beside the preparation fee and the words it opens. */
.co-why-btn { display: inline-grid; place-items: center; width: 1.1rem; height: 1.1rem; margin-left: 0.2rem; border: 1px solid var(--line-strong); border-radius: 50%; background: none; color: inherit; font: italic 600 0.7rem/1 Georgia, serif; cursor: help; vertical-align: 0.1em; }
dt { position: relative; }
.co-why { display: none; position: absolute; left: 0; top: calc(100% + 0.35rem); z-index: 5; width: min(18rem, 70vw); padding: 0.6rem 0.75rem; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--card, #15171a); color: var(--ink, #f4f3ef); font-size: 0.8125rem; font-weight: 400; line-height: 1.45; }
.co-why-btn:hover + .co-why, .co-why-btn:focus-visible + .co-why, .co-why-btn[aria-expanded="true"] + .co-why { display: block; }
