/* =========================================================================
   Stinger Sim Racing — online booking styles
   The booking widget (js/book.js), the /booked confirmation, the paid
   booking view on /booking, and the agreement page. Builds on the tokens
   and form styles in styles.css; load it after that file.
   ========================================================================= */

.book .visually-hidden, .visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.book [hidden] { display: none !important; }
/* The page-level swaps js/book.js makes (e.g. the inquiry form on /parties
   while booking is on). .form-wrap sets display:grid, so [hidden] needs help. */
[data-booking-fallback][hidden], [data-booking-online][hidden], [data-book-widget][hidden] { display: none !important; }
.book-hp { position: absolute !important; left: -9999px; width: 1px; height: 1px; opacity: 0; }

/* ---- Step progress ------------------------------------------------------ */
.book-steps {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 0.4rem;
  margin: 0 0 1.1rem; counter-reset: none;
}
.book-steps li {
  display: flex; flex-direction: column; gap: 0.35rem; align-items: flex-start;
  font-size: 0.75rem; color: var(--muted-2); min-width: 0;
}
.book-steps li::before {
  content: ""; display: block; width: 100%; height: 3px; border-radius: 2px; background: var(--border-strong);
}
.book-steps li.is-done::before, .book-steps li.is-current::before { background: var(--accent); }
.book-steps li.is-current { color: var(--text); }
.book-steps__n { display: none; }
.book-steps__t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; font-family: var(--font-head); }

/* ---- Steps ---------------------------------------------------------------- */
.book-form { position: relative; }
.book-step__title { font-size: 1.25rem; margin-bottom: 1rem; }
.book-step__title:focus { outline: none; }
.book-step__title:focus-visible { outline: 2px solid var(--text); outline-offset: 4px; }
.book-step__count { display: block; font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent-bright); margin-bottom: 0.35rem; }
.book-hint { display: block; color: var(--muted); font-size: 0.86rem; margin-top: 0.35rem; }
.book-blurb { color: var(--muted); margin: 0 0 1rem; }
.book-addon, .book-guests { margin-top: 0.4rem; }
.book-guests input { max-width: 9rem; }
.book-notice {
  margin-bottom: 1rem; padding: 0.85rem 1rem; border-radius: var(--radius-sm);
  border: 1px solid var(--accent-deep); background: rgba(243,196,50,0.08); color: var(--text);
}
.book-other { margin-top: 0.5rem; color: var(--text); font-size: 0.9rem; background: var(--bg-2); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 0.7rem 0.85rem; }
.book a:not(.btn), .book-other a, .booked a:not(.btn) { color: var(--text); text-decoration: underline; text-decoration-color: var(--accent-deep); text-underline-offset: 2px; }

.book-nav { display: flex; gap: 0.8rem; justify-content: space-between; align-items: center; margin-top: 1.4rem; }
.book-nav .book-next { margin-left: auto; }
.book-nav .btn[disabled] { opacity: 0.6; cursor: progress; }

/* ---- Calendar ------------------------------------------------------------- */
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.6rem; }
.cal-month { font-family: var(--font-head); font-weight: 600; font-size: 1.05rem; margin: 0; text-align: center; flex: 1; }
.cal-nav {
  width: 2.6rem; height: 2.6rem; border-radius: var(--radius-sm);
  border: 1px solid var(--field-border); background: var(--surface); color: var(--text); font-size: 1.3rem; line-height: 1;
}
.cal-nav:hover:not([disabled]) { border-color: var(--text); background: var(--surface-2); }
.cal-nav[disabled] { opacity: 0.35; cursor: default; }
.cal { width: 100%; border-collapse: separate; border-spacing: 4px; table-layout: fixed; }
.cal th { font-family: var(--font-head); font-size: 0.75rem; color: var(--muted-2); font-weight: 600; padding-bottom: 0.2rem; }
.cal td { padding: 0; text-align: center; }
.cal-day {
  width: 100%; aspect-ratio: 1 / 1; min-height: 2.25rem; max-height: 3.2rem;
  border-radius: 8px; border: 1px solid var(--border); background: var(--bg-2);
  color: var(--muted-2); font-family: var(--font-head); font-size: 0.92rem; padding: 0;
}
/* Daylight: closed days are flat warm gray, open days white with a
   control border, the picked day Savannah Yellow with an ink outline. */
.cal-day.is-open { border-color: var(--field-border); background: var(--surface); color: var(--text); }
.cal-day.is-open:hover { border-color: var(--text); background: var(--surface-2); }
.cal-day.is-picked { background: var(--accent); border-color: var(--text); color: var(--text); font-weight: 700; }
.cal-day.is-booked { color: var(--muted-2); text-decoration: line-through; background: repeating-linear-gradient(135deg, var(--bg-2), var(--bg-2) 4px, #DDD7CB 4px, #DDD7CB 8px); }
.cal-day.is-off { opacity: 0.45; }
.cal-day[aria-disabled="true"] { cursor: not-allowed; }
.cal-day:focus-visible { outline: 2px solid var(--text); outline-offset: 1px; }

.cal-legend { display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; margin: 0.7rem 0 0; font-size: 0.78rem; color: var(--muted); }
.cal-legend li { display: inline-flex; align-items: center; gap: 0.4rem; }
.cal-swatch { width: 0.9rem; height: 0.9rem; border-radius: 3px; border: 1px solid var(--border-strong); background: var(--bg-2); flex: none; }
.cal-swatch.is-open { background: var(--surface); border-color: var(--field-border); }
.cal-swatch.is-picked { background: var(--accent); border-color: var(--text); }
.cal-swatch.is-booked { background: repeating-linear-gradient(135deg, var(--bg-2), var(--bg-2) 2px, #C9C2B4 2px, #C9C2B4 4px); }
.cal-swatch.is-off { opacity: 0.45; }
.book-daymsg { min-height: 1.2em; margin: 0.5rem 0 0; color: var(--accent-ink); font-size: 0.88rem; }
.book-window { margin-top: 1rem; max-width: 22rem; }
.book-pickup { margin: 0.7rem 0 0; font-weight: 600; color: var(--text); }
.book-pickup:empty { display: none; }

/* ---- Agreement ------------------------------------------------------------ */
.book-agreement {
  max-height: 22rem; overflow-y: auto; margin: 0.8rem 0 1.1rem;
  background: var(--bg-2); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 1rem 1.1rem; font-size: 0.88rem; color: var(--muted); line-height: 1.55;
}
.book-agreement:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.book-agreement h4 { font-size: 1.05rem; color: var(--text); margin: 0.4rem 0 0.5rem; }
.book-agreement h5 { font-size: 0.95rem; color: var(--text); margin: 1rem 0 0.4rem; }
.book-agreement h6 { font-size: 0.88rem; color: var(--text); margin: 0.8rem 0 0.3rem; }
.book-agreement p { margin: 0 0 0.6rem; }
.book-agreement ul { list-style: disc; padding-left: 1.2rem; margin: 0 0 0.6rem; }
.book-agreement li { margin-bottom: 0.25rem; }
.book-agreement .legal-doc { margin-top: 0; }
.book-sign { font-family: var(--font-head); font-size: 1.1rem !important; letter-spacing: 0.02em; }

/* ---- Review --------------------------------------------------------------- */
.book-summary, .booking-facts {
  display: grid; grid-template-columns: max-content 1fr; gap: 0.55rem 1.1rem; margin: 0 0 1rem;
}
.book-summary dt, .booking-facts dt { color: var(--muted); font-size: 0.86rem; font-family: var(--font-head); }
.book-summary dd, .booking-facts dd { margin: 0; color: var(--text); overflow-wrap: anywhere; }
.book-total {
  display: flex; align-items: baseline; gap: 0.7rem; flex-wrap: wrap;
  border-top: 1px solid var(--border); padding-top: 0.9rem; margin: 0 0 1rem;
}
.book-total span:first-child { font-family: var(--font-head); color: var(--muted); }
.book-total strong { font-family: var(--font-head); font-size: 1.9rem; color: var(--text); }
.book-total__note { color: var(--muted-2); font-size: 0.85rem; }
.book-hold, .booked-hold {
  border: 1px solid var(--border); border-left: 3px solid var(--accent); background: var(--bg-2);
  border-radius: var(--radius-sm); padding: 0.85rem 1rem; color: var(--muted); font-size: 0.92rem; margin: 0 0 0.9rem;
}
.book-hold strong, .booked-hold strong { color: var(--text); }
/* The $20 deposit: due today vs at drop-off, and the balance + hold note
   on /booked and /booking (DECISIONS D1). */
.book-split { color: var(--muted); font-size: 0.95rem; margin: -0.4rem 0 1rem; }
.book-split strong { color: var(--text); }
.booked-balance-note {
  border: 1px solid var(--border); border-left: 3px solid var(--accent); background: var(--bg-2);
  border-radius: var(--radius-sm); padding: 0.85rem 1rem; color: var(--text); font-size: 0.95rem; margin: 0 0 0.9rem;
}
.book-turnstile { margin: 0.9rem 0 0.4rem; min-height: 65px; }
/* The card-on-file consent line, directly above Pay (js/book.js). */
.book-consent {
  color: var(--text); font-size: 0.88rem; line-height: 1.5; margin: 0.4rem 0 0.9rem;
  padding: 0.75rem 0.95rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-2);
}
.book-consent a { color: var(--text); text-decoration: underline; }

/* ---- Disabled / coming soon ---------------------------------------------- */
.book-off h3 { font-size: 1.2rem; margin-bottom: 0.6rem; }
.book-off p { color: var(--muted); margin-bottom: 1.1rem; }
.book-off a:not(.btn) { color: var(--text); text-decoration: underline; }
.book-nojs, .book-loading { color: var(--muted); }

/* ---- /booked --------------------------------------------------------------- */
.booked { max-width: 720px; }
.booked-code {
  font-family: var(--font-head); font-weight: 700; letter-spacing: 0.1em;
  font-size: clamp(2.2rem, 9vw, 3.4rem); color: var(--accent-bright); margin: 0.3rem 0 0.2rem;
}
.booked-code-label { font-family: var(--font-head); text-transform: uppercase; letter-spacing: 0.14em; font-size: 0.75rem; color: var(--muted); }
.booked .form-card + .form-card { margin-top: 1.2rem; }
.booked .booking-facts { margin-top: 1.2rem; }
.booked-actions { display: flex; flex-wrap: wrap; gap: 0.8rem; margin-top: 1.2rem; }
.booked-spinner {
  width: 1.4rem; height: 1.4rem; border-radius: 50%; border: 3px solid var(--border-strong); border-top-color: var(--accent);
  display: inline-block; vertical-align: middle; margin-right: 0.6rem; animation: booked-spin 0.9s linear infinite;
}
@keyframes booked-spin { to { transform: rotate(360deg); } }

/* ---- Paid booking on /booking -------------------------------------------- */
.booking-status-pill {
  display: inline-block; font-family: var(--font-head); font-size: 0.72rem; font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; padding: 0.3rem 0.65rem; border-radius: 999px; background: rgba(243,196,50,0.14); color: var(--accent-bright);
}
.booking-status-pill.is-cancelled { background: rgba(163, 52, 28, 0.1); color: var(--error); }
.booking-change textarea { min-height: 90px; }
.booking-paid-actions { display: grid; gap: 0.8rem; margin-top: 1rem; }

/* ---- Agreement page (/legal/rental-agreement-v1) ------------------------- */
.legal-page { max-width: 820px; }
.legal-back { color: var(--muted); font-size: 0.9rem; }
.legal-doc { margin-top: 1.2rem; color: var(--muted); }
.legal-doc h1 { font-size: clamp(1.7rem, 5vw, 2.4rem); color: var(--text); margin: 0.6rem 0 0.4rem; }
.legal-doc h2 { font-size: 1.2rem; color: var(--text); margin: 1.8rem 0 0.6rem; }
.legal-doc h3 { font-size: 1rem; color: var(--text); margin: 1.1rem 0 0.4rem; }
.legal-doc p { margin: 0 0 0.8rem; }
.legal-doc ul { list-style: disc; padding-left: 1.3rem; margin: 0 0 0.8rem; }
.legal-doc li { margin-bottom: 0.35rem; }
.legal-meta { font-size: 0.85rem; color: var(--muted-2); }
.legal-placeholder, .book-agreement .legal-placeholder {
  border: 1px dashed var(--accent); background: rgba(243,196,50,0.08); color: var(--accent-bright);
  border-radius: var(--radius-sm); padding: 0.6rem 0.8rem; font-size: 0.85rem;
}

/* ---- Phones ---------------------------------------------------------------- */
@media (max-width: 560px) {
  .book .form-card, .booked .form-card { padding: 1.15rem; }
  .book-steps__t { display: none; }
  .book-steps li { font-size: 0; }
  .book-nav { flex-wrap: wrap; }
  .book-nav .book-next { width: 100%; order: -1; margin-left: 0; white-space: normal; }
  .book-nav .book-back { width: 100%; }
  .cal { border-spacing: 3px; }
  .cal-day { font-size: 0.85rem; border-radius: 6px; }
  .book-summary, .booking-facts { grid-template-columns: 1fr; gap: 0.15rem; }
  .book-summary dd, .booking-facts dd { margin-bottom: 0.55rem; }
}

@media (prefers-reduced-motion: reduce) {
  .booked-spinner { animation: none; }
}

/* The draft-3 agreement rendered for the booking (agreements/html.js):
   numbered clauses, sub-items and Schedule A's table, inside the box. */
.book-agreement ol.agreement-doc__list { list-style: decimal; padding-left: 1.4rem; margin: 0 0 0.6rem; }
.book-agreement ul.agreement-doc__sub { list-style: disc; padding-left: 1.1rem; margin: 0.3rem 0; }
.book-agreement .agreement-doc__table { overflow-x: auto; }
.book-agreement table { border-collapse: collapse; width: 100%; font-size: 0.85rem; }
.book-agreement th, .book-agreement td { border-bottom: 1px solid var(--border); padding: 0.3rem 0.4rem; text-align: left; vertical-align: top; color: var(--text); }
.book-consents { gap: 0.6rem; }
.book-consents label.checkbox-inline { font-size: 0.92rem; }
