:root {
  --q-bg:        #f6f5f1;
  --q-surface:   #ffffff;
  --q-text:      #1f2933;
  --q-muted:     #6b7280;
  --q-border:    #e5e7eb;
  --q-primary:   #5AB51E;
  --q-primary-d: color-mix(in srgb, var(--q-primary) 75%, black);
  --q-focus:     color-mix(in srgb, var(--q-primary) 20%, white);
  --q-warn-bg:   #fff8e6;
  --q-warn-bd:   #f0c674;
  --q-radius:    10px;
  --q-shadow:    0 6px 24px rgba(15, 23, 42, 0.08);
  --q-bg:                 transparent;
  --q-dim-future-opacity: 0.18;
  --q-dim-past-opacity:   0.55;
  --q-thumb-bg:           transparent;
}

* {
  box-sizing: border-box;
}

/* The theme sets body { overflow-x: hidden } which implicitly sets overflow-y: auto,
   making body the scroll container and breaking position: sticky. clip does the same
   visual job without creating a scroll container. */
body {
  overflow-x: clip;
}

.q-shell {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 1rem 6rem;
}

/* ───── Header: bike summary (sticky only in desktop sidebar) ───── */
.q-header {
  background: var(--q-bg);
  padding-top: 0.75rem;
}

.q-bike {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.6rem 0.9rem;
  background: var(--q-surface);
  border: 1px solid var(--q-border);
  border-radius: var(--q-radius);
  margin-bottom: 0.6rem;
}

.q-bike__thumb {
  flex: 0 0 56px;
  width: 56px;
  height: 56px;
  border-radius: 6px;
  background: var(--q-thumb-bg);
}

.q-bike__thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  padding: 4px;
}

.q-bike__title {
  font-weight: 600;
  line-height: 1.2;
}

.q-bike__meta {
  font-size: 0.85rem;
  color: var(--q-muted);
  margin-top: 0.15rem;
}

.q-bike__meta span:not(:last-child)::after {
  content: " · ";
}

.q-bike__options {
  display: none;
}



/* ───── Wide layout: sidebar card ───── */
@media (min-width: 900px) {
  .q-shell {
    max-width: 980px;
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 1.75rem;
    align-items: start;
  }

  #questionnaire-form {
    grid-column: 1;
    grid-row: 1;
  }

  .q-header {
    grid-column: 2;
    grid-row: 1;
    position: sticky;
    top: 7rem; /* clear the sticky-top navbar + breathing room */
    margin-top: 1.25rem; /* align with first .q-page card */
    padding-top: 0;
    background: none;
    z-index: 5; /* sit above form column so zoomed bike thumb isn't clipped */
    /* Sidebar card styling */
    border: 1px solid var(--q-border);
    border-radius: var(--q-radius);
    box-shadow: var(--q-shadow);
    background: var(--q-surface);
  }

  /* Extras dl sits inside .q-bike__info; use its padding, just add top separator */
  .q-bike__options {
    display: block;
    border-top: 1px solid var(--q-border);
    margin-top: 0.5rem;
    padding-top: 0.4rem;
  }

  /* Sidebar extras: compact key→value rows, no dashed borders */
  .q-bike__options div {
    grid-template-columns: auto 1fr;
    gap: 0.35rem;
    padding: 0.15rem 0;
    border-bottom: none;
    font-size: 0.85rem;
  }

  .q-bike__options .q-summary__key {
    color: var(--q-muted);
    white-space: nowrap;
  }

  .q-bike__options .q-summary__value {
    text-align: left;
    font-weight: normal;
    color: var(--q-text);
  }

  /* Bike card becomes vertical: image on top, info below */
  .q-bike {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 0;
    border: none;
    border-radius: 0;
    margin-bottom: 0;
    background: none;
  }

  .q-bike__thumb {
    flex: none;
    width: 100%;
    height: auto;
    aspect-ratio: 4 / 3;
    border-radius: 0;
    background: var(--q-thumb-bg);
    padding: 0.5rem;
    cursor: zoom-in;
    position: relative;
    z-index: 1;
  }

  .q-bike__thumb img {
    transition: transform 160ms ease, box-shadow 160ms ease;
  }

  .q-bike__thumb:hover {
    z-index: 100;
  }

  .q-bike__thumb:hover img {
    transform: scale(1.8);
    transform-origin: top center;
    box-shadow: var(--q-shadow);
    border-radius: var(--q-radius);
    background: #fff;
  }

  .q-bike__info {
    padding: 0.75rem 1rem 0.5rem;
  }

  .q-bike__title {
    font-size: 1rem;
  }

  .q-bike__meta {
    margin-top: 0.2rem;
  }

  /* Pages only need to clear the site navbar; sidebar doesn't overlap them */
  .q-page.card {
    scroll-margin-top: 5rem; /* ~navbar height + breathing room; JS refines if needed */
  }
}

/* ───── Pages ───── */
.q-page.card {
  border-color: var(--q-border);
  border-radius: var(--q-radius);
  margin: 1.25rem 0;
  scroll-margin-top: 7rem;
  transition: opacity 320ms ease, filter 320ms ease, transform 320ms ease, box-shadow 320ms ease;
}

.q-page .card-body {
  padding: 1.75rem 1.75rem 1.5rem;
}

.q-page .card-footer {
  background: none;
  border-top: none;
  padding: 0 1.75rem 1.5rem;
  margin-top: 0;
}

.q-page--future {
  opacity: var(--q-dim-future-opacity);
  filter: blur(1.5px);
  pointer-events: none;
  user-select: none;
  transform: scale(0.985);
}

.q-page--past {
  opacity: var(--q-dim-past-opacity);
  cursor: pointer;
}

.q-page--past:hover,
.q-page--past:focus-within {
  opacity: 0.9;
}

.q-page--active {
  opacity: 1;
  box-shadow: var(--q-shadow);
}

.q-page__step {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--q-primary);
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.q-page__title {
  margin: 0 0 0.25rem;
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.q-page__lede {
  color: var(--q-muted);
  margin: 0 0 1.25rem;
  font-size: 0.95rem;
}

.q-intro-panel {
  color: var(--q-muted);
  font-size: 0.95rem;
  padding-bottom: 1rem;
  margin: 0 0 1.25rem;
  border-bottom: 1px solid var(--bs-border-color, #dee2e6);
}

/* ───── Fields ───── */
.q-field {
  margin: 0.9rem 0;
}

.q-field__label {
  display: block;
  font-weight: 500;
  margin-bottom: 0.35rem;
  font-size: 0.95rem;
}

.form-control:focus {
  border-color: var(--q-primary);
  box-shadow: 0 0 0 0.2rem color-mix(in srgb, var(--q-primary) 25%, transparent);
}

.q-field textarea {
  min-height: 4.5rem;
  resize: vertical;
}

.q-field__hint {
  font-size: 0.825rem;
  color: var(--q-muted);
  margin-top: 0.3rem;
}

/* ───── Option tiles ───── */
.q-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.6rem;
  margin: 0.4rem 0;
}

.q-options--stacked {
  grid-template-columns: 1fr;
}

.q-option {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--q-border);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  transition: border-color 120ms, background 120ms, box-shadow 120ms;
}

.q-option:hover {
  border-color: var(--q-primary);
}

.q-option input {
  accent-color: var(--q-primary);
  flex: 0 0 auto;
}

.q-option__title {
  font-weight: 500;
  display: block;
}

.q-option__sub {
  display: block;
  font-size: 0.825rem;
  color: var(--q-muted);
  margin-top: 0.15rem;
}

.q-option:has(.q-option__badge) .q-option__price { display: none; }

.q-option__price {
  font-size: 0.85rem;
  color: var(--q-muted);
  margin-left: auto;
  padding-left: 0.5rem;
  white-space: nowrap;
}

.q-option__badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--q-primary-d);
  background: color-mix(in srgb, var(--q-primary) 12%, white);
  border-radius: 3px;
  padding: 0.1em 0.45em;
  margin-top: 0.15rem;
}

.q-option__body {
  min-width: 0;
  overflow-wrap: break-word;
}

.q-option:has(input:checked) {
  border-color: var(--q-primary);
  background: color-mix(in srgb, var(--q-primary) 8%, white);
  box-shadow: inset 0 0 0 1px var(--q-primary);
}

/* ───── Swatch options (used when every option has a swatch field) ───── */
.q-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 0.4rem 0;
}

.q-swatch {
  position: relative;
  cursor: pointer;
  width: 80px;
  text-align: center;
}

.q-swatch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.q-swatch__chip {
  display: inline-block;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 2px solid transparent;
  background-clip: padding-box;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.1);
  transition: border-color 120ms, transform 120ms;
}

.q-swatch:hover .q-swatch__chip {
  transform: scale(1.05);
}

.q-swatch:has(input:checked) .q-swatch__chip {
  border-color: var(--q-primary);
}

.q-swatch__label {
  display: block;
  font-size: 0.78rem;
  margin-top: 0.25rem;
  color: var(--q-text);
}

/* ───── Buttons ───── */
.q-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1.25rem;
  gap: 0.5rem;
}

/* ───── Summary on review page ───── */
.q-summary {
  margin: 0 0 1rem;
  padding: 0;
}

.q-summary div {
  padding: 0.5rem 0;
  border-bottom: 1px dashed var(--q-border);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.q-summary div:last-child {
  border-bottom: none;
}

.q-summary__key {
  color: var(--q-muted);
  margin: 0;
}

.q-summary__value {
  font-weight: 500;
  text-align: right;
  margin: 0;
}

/* ───── Frame-size component ───── */
.q-fsp {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.q-fsp__measure {
  display: flex;
  gap: 0.6rem;
  align-items: center;
}

.q-fsp__measure input {
  max-width: 7rem;
}

.q-fsp__rec {
  background: #f1f7ff;
  border: 1px solid #cfe2ff;
  padding: 0.7rem 0.9rem;
  border-radius: 8px;
  font-size: 0.95rem;
}

.q-fsp__rec--warn {
  background: var(--q-warn-bg);
  border-color: var(--q-warn-bd);
}

.q-fsp__rec strong {
  display: inline-block;
}

.q-fsp__sizes {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.q-fsp__size {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
  border: 1px solid var(--q-border);
  background: #fff;
  border-radius: 6px;
  padding: 0.45rem 0.85rem;
  cursor: pointer;
  font: inherit;
  min-width: 5rem;
  line-height: 1.2;
}

.q-fsp__size-cm {
  font-weight: 600;
}

.q-fsp__size-range {
  font-size: 0.72rem;
  color: var(--q-muted);
}

.q-fsp__size--selected .q-fsp__size-range,
.q-fsp__size--rec .q-fsp__size-range {
  color: var(--q-text);
}

.q-fsp__size--selected {
  border-color: var(--q-primary);
  background: color-mix(in srgb, var(--q-primary) 8%, white);
  box-shadow: inset 0 0 0 1px var(--q-primary);
}

.q-fsp__size--rec {
  box-shadow: 0 0 0 2px var(--q-focus);
}

/* Inline images on option tiles (mode tiles, accessories). */
.q-option__image {
  flex: 0 0 56px;
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  overflow: hidden;
  position: relative;
  cursor: zoom-in;
}

.q-option__image img,
.q-option__image svg {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.q-option__image:hover {
  overflow: visible;
  z-index: 100;
}

.q-option__image:hover img,
.q-option__image:hover svg {
  transform: scale(4);
  transform-origin: center;
  box-shadow: var(--q-shadow);
  border-radius: var(--q-radius);
  background: #fff;
}

.q-fsp__expander {
  font-size: 0.85rem;
  color: var(--q-muted);
}

.q-fsp__expander summary {
  cursor: pointer;
  user-select: none;
}

.q-fsp__expander[open] summary {
  margin-bottom: 0.4rem;
}

/* ───── Misc ───── */
.q-empty {
  color: var(--q-muted);
  font-style: italic;
}

.q-debug {
  font-family: ui-monospace, monospace;
  font-size: 0.8rem;
  color: var(--q-muted);
  margin-top: 1rem;
  white-space: pre-wrap;
}

/* Bootstrap only shows .invalid-feedback for .form-control.is-invalid siblings.
   Extend it to tile/swatch/picker containers and plain inputs that lack form-control. */
.is-invalid ~ .invalid-feedback {
  display: block;
}

/* Tile/swatch/picker containers get a light red tint; padding reveals it around the tiles. */
.q-options.is-invalid,
.q-swatches.is-invalid,
.q-fsp.is-invalid,
.q-options.is-invalid .q-option {
  background-color: color-mix(in srgb, #dc3545 7%, white);
}

/* Red outline around the tile group makes the error state obvious. */
.q-options.is-invalid,
.q-swatches.is-invalid,
.q-fsp.is-invalid {
  outline: 2px solid #dc3545;
  border-radius: var(--bs-border-radius, 0.375rem);
}

/* Same tint for text/textarea inputs. */
.form-control.is-invalid {
  background-color: color-mix(in srgb, #dc3545 7%, white);
}

/* ───── Page media block (optional image + video link) ───── */
.q-page__media {
  margin: 0.75rem 0 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.q-page__media-image {
  max-width: 100%;
  max-height: 220px;
  object-fit: contain;
  border-radius: 4px;
}

.q-page__media-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  font-size: 0.9rem;
  color: var(--q-primary, #2563eb);
  text-decoration: none;
}

.q-page__media-link:hover {
  text-decoration: underline;
}

/* ───── Thank-you screen ───── */
.q-thankyou {
  scroll-margin-top: 7rem;
  padding: 2rem 0;
}
