/* ── Reset & base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* Same fonts as cascadialink.com, served from this app (the CSP allows no other font host). */
@font-face{font-family:"Bricolage Grotesque";font-style:normal;font-weight:500 800;font-display:swap;src:url(/public/fonts/BricolageGrotesque-500-800.woff2) format("woff2")}
@font-face{font-family:"Source Sans 3";font-style:italic;font-weight:400;font-display:swap;src:url(/public/fonts/SourceSans3-400-italic.woff2) format("woff2")}
@font-face{font-family:"Source Sans 3";font-style:normal;font-weight:400 700;font-display:swap;src:url(/public/fonts/SourceSans3-400.woff2) format("woff2")}

:root {
  /* CascadiaLink's site palette ("Trailhead", CascadiaLink-Site/public/site.css). */
  --blue:    #0B6FCB;
  --blue-dk: #094F92;   /* text on --blue-lt needs this one for 4.5:1 */
  --blue-lt: #E4F0FB;
  --cta:     #C24E18;   /* 4.8:1 against white text */
  --cta-dk:  #A84212;
  --green:   #1E7A46;
  --red:     #DC2626;
  --amber:   #D97706;
  --gray-50: #F5F7F4;
  --gray-100:#EAEFEC;
  --gray-200:#D4DDD8;
  --gray-400:#8A9A95;
  --gray-600:#4E6660;
  --gray-800:#12302B;
  --display: "Bricolage Grotesque", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --body:    "Source Sans 3", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --radius:  8px;
  --shadow:  0 1px 3px rgba(18,48,43,.1), 0 1px 2px rgba(18,48,43,.06);
}

body {
  font-family: var(--body);
  background: var(--gray-50);
  color: var(--gray-800);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ── Test mode banner ─────────────────────────────────────────────────────── */
#test-banner {
  background: #B45309;  /* amber-700: white text needs 4.5:1; amber-600 gave 3.2 */
  color: #fff;
  text-align: center;
  font-weight: 600;
  font-size: .875rem;
  padding: .5rem 1rem;
  letter-spacing: .02em;
}

/* ── Site header: logo, name and the way back to the main site ───────────── */
.site-header {
  background: #fff;
  border-bottom: 1px solid var(--gray-200);
}
.site-header-inner {
  max-width: 640px; margin: 0 auto; padding: .625rem 1rem;
  display: flex; align-items: center; justify-content: space-between; gap: .75rem;
}
.site-header .brand {
  display: inline-flex; align-items: center; gap: .5rem;
  font-family: var(--display); font-weight: 800; font-size: 1.25rem; letter-spacing: -.01em;
  color: var(--gray-800); text-decoration: none;
}
.site-header .brand img { width: 36px; height: 36px; border-radius: 8px; }
.site-header .back-link {
  font-size: .875rem; font-weight: 600; color: var(--blue-dk); text-decoration: none;
  padding: .625rem 0; white-space: nowrap;
}
.site-header .back-link:hover { text-decoration: underline; }
.site-header a:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; border-radius: 4px; }
@media (max-width: 420px) { .site-header .back-link span { display: none; } }
/* Inside a frame on the main site, that page already has the header. */
.embedded .site-header { display: none; }

h1, h2, .product-hero-title { font-family: var(--display); letter-spacing: -.01em; }

/* ── App shell ────────────────────────────────────────────────────────────── */
#app {
  max-width: 640px;
  margin: 0 auto;
  padding: 1rem 1rem 4rem;
}

/* ── Step indicator ───────────────────────────────────────────────────────── */
.step-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin: 1.5rem 0 2rem;
}
.step-dot {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  border: 2px solid var(--gray-200);
  background: #fff;
  color: var(--gray-400);
  font-size: .875rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .2s;
  flex-shrink: 0;
}
.step-dot.active { border-color: var(--blue); background: var(--blue); color: #fff; }
.step-dot.done   { border-color: var(--blue); background: var(--blue-lt); color: var(--blue-dk); }
.step-line {
  flex: 1;
  height: 2px;
  background: var(--gray-200);
  max-width: 4rem;
}

/* ── Cards / panels ───────────────────────────────────────────────────────── */
.step-panel {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
}
.step-panel h1,
.step-panel h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
  color: var(--gray-800);
}
.step-panel h3, .panel-heading {
  font-size: .9375rem;
  font-weight: 600;
  margin: 1.25rem 0 .75rem;
  color: var(--gray-800);
}

/* ── Forms ────────────────────────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: .375rem; margin-bottom: 1rem; }
.form-group label { font-size: .875rem; font-weight: 500; color: var(--gray-600); }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 400px) { .form-row { grid-template-columns: 1fr; } }
.form-row-3 { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: .75rem; }
@media (max-width: 440px) { .form-row-3 { grid-template-columns: 1fr 1fr; } }

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="date"] {
  width: 100%;
  padding: .625rem .75rem;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: 1rem;
  color: var(--gray-800);
  background: #fff;
  appearance: none;
  -webkit-appearance: none;
  transition: border-color .15s;
  min-height: 44px;
}
input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(11,111,203,.4); }
input::placeholder { color: var(--gray-400); }

/* ── Fulfillment toggle ───────────────────────────────────────────────────── */
.fulfillment-toggle {
  display: flex;
  gap: .5rem;
  margin-bottom: 1.25rem;
}
.toggle-option {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .625rem;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: .9375rem;
  font-weight: 500;
  transition: all .15s;
  min-height: 44px;
  position: relative;
}
/* Hidden from sight only: display:none also took the radios out of keyboard
   and screen-reader reach, so pickup could not be chosen without a mouse. */
.toggle-option input[type="radio"] { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.toggle-option:has(input:focus-visible) { outline: 3px solid var(--blue); outline-offset: 2px; }
.toggle-option.selected {
  border-color: var(--blue);
  background: var(--blue-lt);
  color: var(--blue-dk);
}

/* ── Price summary ────────────────────────────────────────────────────────── */
.price-card {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 1rem;
  margin: 1rem 0;
}
.price-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: .9375rem;
  padding: .25rem 0;
}
.price-row.total {
  border-top: 1px solid var(--gray-200);
  margin-top: .5rem;
  padding-top: .75rem;
  font-weight: 700;
  font-size: 1.0625rem;
}
.price-row .label { color: var(--gray-600); }

/* ── Accessories ──────────────────────────────────────────────────────────── */
/* Shown only on step 1: orients a first-time visitor on what they are renting,
   then gets out of the way once they are into the form. */
.product-hero {
  display: flex; align-items: center; gap: 1rem;
  padding: .875rem 1rem; margin-bottom: 1.25rem;
  background: var(--gray-100); border-radius: 12px;
}
/* A photograph, so cover-crop it square and let it fill the frame. */
.product-hero img {
  flex-shrink: 0;
  width: 96px; height: 96px;
  object-fit: cover;
  border-radius: 10px;
}
.product-hero-title { font-weight: 700; font-size: 1rem; }
.product-hero-sub { font-size: .8125rem; color: var(--gray-600); margin-top: .1875rem; line-height: 1.4; }
@media (max-width: 420px) {
  .product-hero { gap: .75rem; padding: .75rem; }
  .product-hero img { width: 68px; height: 68px; }
}

/* Approximate location shown before payment; the exact address is only sent
   in the confirmation email, once the booking is paid for. */
.pickup-area {
  font-size: .8125rem; color: var(--gray-600);
  background: var(--blue-lt); border-radius: var(--radius);
  padding: .625rem .75rem; margin-bottom: 1rem;
}

.accessory-item {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  padding: .75rem 0;
  border-bottom: 1px solid var(--gray-100);
}
.accessory-item:last-child { border-bottom: none; }
/* object-fit:contain, not cover: these are illustrations with deliberate padding,
   and cropping them to fill the box cuts the device off at the edges. */
.accessory-thumb {
  width: 64px; height: 64px; flex-shrink: 0;
  object-fit: contain; border-radius: 10px; background: var(--gray-100);
}
.accessory-checkbox { margin-top: .125rem; flex-shrink: 0; width: 18px; height: 18px; cursor: pointer; accent-color: var(--blue); }
.accessory-body { flex: 1; min-width: 0; }
.accessory-name { font-weight: 600; font-size: .9375rem; }
.accessory-desc { font-size: .8125rem; color: var(--gray-600); margin-top: .125rem; }
.accessory-price { font-size: .875rem; color: var(--gray-600); margin-top: .25rem; }
.accessory-unavail { font-size: .8125rem; color: #B45309; margin-top: .25rem; } /* amber-700: 4.5:1 on white */
.accessory-link { font-size: .8125rem; color: var(--blue); margin-top: .25rem; display: inline-block; }

.avail-badge {
  display: inline-flex;
  align-items: center;
  gap: .375rem;
  font-size: .8125rem;
  font-weight: 500;
  margin-top: .75rem;
  padding: .25rem .625rem;
  border-radius: 99px;
}
.avail-badge.ok    { background: #DCFCE7; color: #166534; }
.avail-badge.warn  { background: #FEF3C7; color: #92400E; }
.avail-badge.none  { background: #FEE2E2; color: #B91C1C; }
/* Setup video under the confirmation (success page) */
.setup-video { margin-top: 1.75rem; padding-top: 1.25rem; border-top: 1px solid var(--gray-200); }
.setup-video h2 { font-size: 1.125rem; font-weight: 700; margin-bottom: .75rem; }
.setup-video video { width: 100%; border-radius: var(--radius); background: #000; aspect-ratio: 16 / 9; }
.setup-video-more { font-size: .875rem; color: var(--gray-600); margin-top: .5rem; }

/* Step headings take focus from script when a step opens; they are not controls. */
.step-panel [tabindex="-1"]:focus { outline: none; }
.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; }

/* ── Alerts ───────────────────────────────────────────────────────────────── */
.alert {
  padding: .75rem 1rem;
  border-radius: var(--radius);
  font-size: .875rem;
  margin: .75rem 0;
  background: var(--gray-100);
}
.alert-warn  { background: #FEF3C7; color: #92400E; }
.alert-error { background: #FEE2E2; color: #991B1B; }
.alert-info  { background: #DBEAFE; color: #1E3A8A; }
.alert-success { background: #DCFCE7; color: #166534; }

/* ── Help notice (Settings → Booking Widget Text) ───────────────────────── */
.help-notice {
  background: var(--blue-lt);
  border-left: 4px solid var(--blue);
  border-radius: var(--radius);
  padding: .75rem 1rem;
  margin: 0 0 1.25rem;
  font-size: .875rem;
  color: var(--gray-800);
}
.help-notice a { color: var(--blue-dk); font-weight: 600; text-decoration: underline; white-space: nowrap; }

/* ── ToS ──────────────────────────────────────────────────────────────────── */
.tos-row {
  display: flex;
  align-items: flex-start;
  gap: .625rem;
  margin: 1.25rem 0;
  font-size: .9rem;
}
.tos-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  margin-top: .15rem;
  cursor: pointer;
  accent-color: var(--blue);
}
.tos-row a { color: var(--blue); }

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  min-height: 44px;
  padding: .625rem 1.25rem;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, opacity .15s;
  text-decoration: none;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary  { background: var(--cta); color: #fff; }
.btn-primary:hover:not(:disabled)  { background: var(--cta-dk); }
.btn-secondary { background: var(--gray-100); color: var(--gray-800); border: 1.5px solid var(--gray-200); }
.btn-secondary:hover:not(:disabled) { background: var(--gray-200); }
.btn-block { width: 100%; margin-top: 1rem; }

.btn-row {
  display: flex;
  gap: .75rem;
  margin-top: 1.25rem;
}
.btn-row .btn { flex: 1; }

/* ── Loading spinner ──────────────────────────────────────────────────────── */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 2rem 0;
  color: var(--gray-600);
}
@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
  width: 2.5rem;
  height: 2.5rem;
  border: 3px solid var(--gray-200);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

/* ── Booking summary (step 2 recap) ──────────────────────────────────────── */
.booking-summary {
  background: var(--blue-lt);
  border: 1px solid #BFD9F2;
  border-radius: var(--radius);
  padding: .875rem 1rem;
  margin-bottom: 1.25rem;
  font-size: .9rem;
}
.booking-summary .summary-row { display: flex; justify-content: space-between; padding: .125rem 0; }
.booking-summary .summary-row .label { color: var(--gray-600); }
.booking-summary .summary-total { font-weight: 700; border-top: 1px solid #BFD9F2; margin-top: .5rem; padding-top: .5rem; }

/* ── Hidden utility ───────────────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ── Success page ─────────────────────────────────────────────────────────── */
.success-icon {
  width: 3.5rem;
  height: 3.5rem;
  background: #DCFCE7;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  margin: 0 auto 1rem;
}
.detail-table { width: 100%; border-collapse: collapse; margin: 1rem 0; font-size: .9rem; }
.detail-table td { padding: .5rem 0; border-bottom: 1px solid var(--gray-100); }
.detail-table td:first-child { color: var(--gray-600); width: 45%; }
.detail-table td:last-child  { font-weight: 500; text-align: right; }
.manage-link {
  display: block;
  text-align: center;
  color: var(--blue);
  font-size: .875rem;
  margin-top: 1.25rem;
}

/* Manage page: what happens when */
.booking-timeline { list-style: none; margin: 1rem 0 0; padding: 0; border-top: 1px solid var(--gray-200); }
.booking-timeline li { display: grid; grid-template-columns: 1.25rem 1fr auto; gap: .1rem .5rem; padding: .55rem 0; border-bottom: 1px solid var(--gray-100); font-size: .9rem; }
.booking-timeline li::before { content: ''; width: .7rem; height: .7rem; margin-top: .3rem; border-radius: 50%; border: 2px solid var(--gray-300, #CBD5E1); grid-row: span 2; }
.booking-timeline li.done::before { background: #16A34A; border-color: #16A34A; }
.booking-timeline .tl-label { font-weight: 600; }
.booking-timeline .tl-date { color: var(--gray-600); text-align: right; }
.booking-timeline .tl-track { grid-column: 2 / 4; font-size: .8125rem; color: var(--gray-600); }

/* Availability by start day (C4) */
.avail-cal { margin: -.25rem 0 1rem; font-size: .875rem; }
.avail-cal summary { cursor: pointer; color: var(--blue-dk, #1D4ED8); font-weight: 500; }
#avail-cal-body { display: flex; flex-wrap: wrap; gap: 1rem 1.5rem; margin-top: .75rem; }
.cal-title { font-weight: 600; margin-bottom: .35rem; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 2.1rem); gap: 3px; }
.cal-dow { text-align: center; font-size: .75rem; color: var(--gray-500, #64748B); }
.cal-day { height: 2.1rem; border: 1px solid transparent; border-radius: 6px; font: inherit; font-size: .8125rem; cursor: pointer; background: #fff; }
.cal-day:disabled { cursor: default; }
.d-open { background: #DCFCE7; color: #14532D; }
.d-low { background: #FEF3C7; color: #78350F; }
.d-request { background: #DBEAFE; color: #1E3A8A; }
.d-full { background: #F1F5F9; color: #94A3B8; text-decoration: line-through; }
.d-away { background: #F1F5F9; color: #94A3B8; }
.d-past { background: transparent; color: #CBD5E1; }
.cal-day:not(:disabled):hover { border-color: #0F172A; }
.avail-cal-key { display: flex; flex-wrap: wrap; gap: .35rem; margin: .75rem 0 0; }
.avail-cal-key span { padding: .1rem .5rem; border-radius: 4px; font-size: .75rem; }
.next-open { display: block; margin-top: .5rem; }

/* Waitlist (C6) */
.waitlist-form { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin-top: .75rem; }
.waitlist-title { flex-basis: 100%; font-weight: 500; }
.waitlist-form input { padding: .4rem .55rem; border: 1px solid var(--gray-300, #CBD5E1); border-radius: 6px; font: inherit; min-width: 0; flex: 1 1 9rem; }
.waitlist-msg { flex-basis: 100%; font-size: .875rem; }

/* round-trip shipping options (step 2) */
#shipping-section { margin-top: 1rem; }
.shipping-status { font-size: .875rem; color: var(--gray-600); margin: .25rem 0 .5rem; min-height: 1.25rem; }
.shipping-hint { font-size: .8125rem; color: var(--gray-600); margin: .5rem 0 0; }
.ship-option {
  display: flex; align-items: center; gap: .75rem; padding: .75rem 1rem; margin-bottom: .5rem;
  border: 1px solid var(--gray-300, #d1d5db); border-radius: 8px; cursor: pointer; background: #fff;
}
.ship-option.selected { border-color: var(--primary, #1d4ed8); box-shadow: 0 0 0 1px var(--primary, #1d4ed8); }
.ship-option.disabled { opacity: .55; cursor: not-allowed; }
.ship-option input { margin: 0; flex: none; }
.ship-label { flex: 1; font-weight: 600; }
.ship-label small { display: block; font-weight: 400; font-size: .8125rem; color: var(--gray-600); }
.ship-price { font-weight: 600; white-space: nowrap; }

/* Contact checks (book.js, public/validate.js) */
.field-error { color: #B91C1C; font-size: .875rem; margin: .25rem 0 0; }
.field-hint { color: var(--gray-600); font-size: .8125rem; margin: .25rem 0 0; }
.form-group input[aria-invalid="true"] { border-color: var(--red); }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--blue-dk); text-decoration: underline; cursor: pointer; }
