/* MOTA Garage — The Showroom (360°): real production bikes in a lit studio, part cards, finishes, blueprint.
   Desktop: title and the current machine on top, the stage under them with the view bar on it, the lineup under the stage,
   finish and parts in the right column. Below 1025px everything stacks under the stage.
   Also styles the engine's own overlay (hotspots, loading bar) wherever a showroom mounts (home teaser, studio). */

.mx-view { background: var(--dial); }

.mx {
  --stage-light: #6c8a7c;
  --stage-mid: #3c5b4e;
  --stage-edge: #1b3529;
  position: relative;
  box-sizing: border-box;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 330px);
  grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-areas:
    "head  now"
    "stage panel"
    "lineup panel";
  column-gap: clamp(28px, 3vw, 48px);
  row-gap: 18px;
  min-height: calc(100svh - 72px - env(safe-area-inset-top, 0px));
  margin-top: calc(72px + env(safe-area-inset-top, 0px));
  padding: 26px max(var(--gutter), env(safe-area-inset-right, 0px)) 36px max(var(--gutter), env(safe-area-inset-left, 0px));
  max-width: calc(1480px + 2 * var(--gutter));
  margin-inline: auto;
}
.mx > * { min-width: 0; }

/* ---------- title and the machine on stage ---------- */
.mx-head { grid-area: head; align-self: end; }
.mx-head h1 { margin-top: 10px; }
.mx-head__line { margin-top: 12px; max-width: 62ch; color: var(--steel-300); }
.mx-now { grid-area: now; align-self: end; padding-bottom: 2px; }
.mx-now__brand { color: var(--signal); }
.mx-now__model { margin-top: 6px; font-family: var(--f-display); font-stretch: 125%; font-weight: 300; font-size: clamp(1.35rem, 1.9vw, 1.85rem); line-height: 1.08; text-transform: uppercase; letter-spacing: 0.01em; color: var(--bone); text-wrap: balance; }

/* ---------- stage: a lit studio pool on the green ground ---------- */
.mx-stagewrap { grid-area: stage; position: relative; display: flex; flex-direction: column; min-height: 0; }
.mx-stage {
  position: relative; flex: 1 1 auto; min-height: clamp(440px, 61svh, 760px); overflow: hidden; isolation: isolate;
  background:
    radial-gradient(62% 46% at 50% 76%, rgba(214, 228, 220, 0.26) 0%, rgba(214, 228, 220, 0) 100%),
    radial-gradient(120% 92% at 50% 46%, var(--stage-light) 0%, var(--stage-mid) 42%, var(--stage-edge) 82%, #152b22 100%);
  transition: background 0.5s var(--ease);
}
.mx-stage.is-blueprint { background: none; }
.mx-stage.is-blueprint::before { content: ""; position: absolute; inset: 0; z-index: -1; background-color: #0d1f2a;
  background-image: linear-gradient(rgba(143, 200, 216, 0.16) 1px, transparent 1px), linear-gradient(90deg, rgba(143, 200, 216, 0.16) 1px, transparent 1px),
    linear-gradient(rgba(143, 200, 216, 0.07) 1px, transparent 1px), linear-gradient(90deg, rgba(143, 200, 216, 0.07) 1px, transparent 1px);
  background-size: 80px 80px, 80px 80px, 16px 16px, 16px 16px; }
.mx-canvas { position: absolute; inset: 0; }
.mx-canvas canvas { cursor: grab; }
.mx-canvas canvas:active { cursor: grabbing; }
.mx-fallback { position: absolute; inset: 0; margin: 0; }
.mx-fallback img { width: 100%; height: 100%; object-fit: cover; }
.mx-fallback__note { position: absolute; left: 16px; bottom: 16px; right: 16px; max-width: 46ch; margin: 0; padding: 12px 14px; background: var(--ink); color: var(--steel-100); font-size: var(--t-small); line-height: 1.5; }

.mx-viewbar { position: absolute; top: 14px; right: 14px; z-index: 3; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; max-width: calc(100% - 28px); }
.mx-seg { display: inline-flex; background: var(--ink); border: 1px solid var(--line-strong); border-radius: var(--radius); }
.mx-seg button {
  min-height: 44px; min-width: 48px; padding: 0 14px; background: none; border: 0; border-left: 1px solid var(--line); border-radius: 0;
  font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--steel-100); cursor: pointer;
  transition: background 0.25s var(--ease), color 0.25s var(--ease);
}
.mx-seg button:first-child { border-left: 0; }
.mx-seg button:hover { background: var(--dial-2); }
.mx-seg button[aria-pressed="true"] { background: var(--bone); color: var(--paper-ink); }
.mx-seg--views button[data-mx-view="threequarter"] { font-family: var(--f-display); font-size: 1rem; letter-spacing: 0; }

.mx-under { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 6px 24px; padding-top: 12px; }
.mx-credit { margin: 0; font-size: var(--t-small); line-height: 1.5; color: var(--steel-300); min-width: 0; }
.mx-credit a { color: var(--steel-100); }
.mx-hint { margin: 0; color: var(--steel-300); }
.mx-hint__coarse { display: none; }
@media (pointer: coarse) { .mx-hint__fine { display: none; } .mx-hint__coarse { display: inline; } }

/* ---------- the lineup ---------- */
.mx-lineupbar { grid-area: lineup; min-width: 0; }
.mx-label { margin: 0 0 10px; }
.mx-lineup { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(124px, 1fr); gap: 8px; overflow-x: auto; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; padding-bottom: 4px; }
.mx-model {
  display: grid; align-content: start; gap: 3px; min-height: 64px; box-sizing: border-box; padding: 10px 12px; text-align: left;
  background: transparent; border: 1px solid var(--line-strong); border-radius: var(--radius); color: var(--steel-100); cursor: pointer;
  font: inherit; transition: border-color 0.25s var(--ease), background 0.25s var(--ease);
}
.mx-model:hover { border-color: var(--steel-300); background: rgba(237, 231, 217, 0.04); }
.mx-model[aria-pressed="true"] { background: var(--bone); border-color: var(--bone); color: var(--paper-ink); }
.mx-model__brand { font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--steel-300); }
.mx-model[aria-pressed="true"] .mx-model__brand { color: #3d4a44; }
.mx-model__name { font-size: 0.875rem; line-height: 1.3; }

/* ---------- right column: finish and parts ---------- */
.mx-panel { grid-area: panel; display: grid; align-content: start; gap: 22px; }
.mx-group { min-width: 0; }
.mx-swatches { display: flex; flex-wrap: wrap; gap: 9px; }
.mx-swatch { width: 44px; height: 44px; padding: 0; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--sw, #444); cursor: pointer; outline: 1px solid transparent; outline-offset: 3px; transition: outline-color 0.25s var(--ease); }
.mx-swatch--original { position: relative; background: var(--sw, var(--dial-2)); }
.mx-swatch--original::after { content: ""; position: absolute; inset: 5px; border: 1px solid rgba(13, 28, 22, 0.55); border-radius: 50%; box-shadow: 0 0 0 1px rgba(237, 231, 217, 0.5); }
.mx-swatch:hover { outline-color: var(--line-strong); }
.mx-swatch[aria-pressed="true"] { outline-color: var(--bone); }
.mx-swatch:focus-visible { outline: 2px solid var(--orange); }
.mx-swatch--metal { background: linear-gradient(135deg, rgba(255, 255, 255, 0.55) 0%, rgba(255, 255, 255, 0) 46%, rgba(0, 0, 0, 0.28) 100%), var(--sw, #888); }
.mx-note { margin: 10px 0 0; font-size: var(--t-small); line-height: 1.5; color: var(--steel-300); max-width: 40ch; }

/* finish rows: label and current choice on one line, swatches under it */
.mx-frows { display: grid; gap: 12px; }
.mx-frow { min-width: 0; }
.mx-frow__head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin: 0 0 6px; }
.mx-frow__label { color: var(--steel-300); }
.mx-frow__val { color: var(--steel-100); text-align: right; }
.mx-frow .mx-swatches { gap: 6px; }
.mx-frow__none { margin: 0; font-size: var(--t-small); line-height: 1.45; color: var(--steel-300); }
.mx-card__finish:empty { display: none; }
.mx-card__finish { padding-top: 8px; border-top: 1px solid var(--line); margin-top: 4px; }

.mx-parts__list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 18px; border-top: 1px solid var(--line); }
.mx-part {
  position: relative; display: flex; align-items: center; width: 100%; min-height: 44px; box-sizing: border-box; padding: 8px 0 8px 20px;
  background: none; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; color: var(--steel-100); text-align: left; cursor: pointer;
  font-family: var(--f-display); font-stretch: 125%; font-weight: 300; font-size: 0.92rem; letter-spacing: 0.04em; text-transform: uppercase;
}
.mx-part::before { content: ""; position: absolute; left: 0; top: 50%; width: 8px; height: 1px; background: var(--line-strong); transition: width 0.3s var(--ease), background 0.3s var(--ease); }
.mx-part:hover { color: var(--bone); }
.mx-part:hover::before { width: 12px; background: var(--steel-300); }
.mx-part[aria-pressed="true"] { color: var(--bone); }
.mx-part[aria-pressed="true"]::before { width: 14px; background: var(--signal); }
.mx-part.is-seen:not([aria-pressed="true"])::after { content: ""; position: absolute; right: 4px; top: 50%; width: 5px; height: 5px; margin-top: -2px; border-radius: 50%; background: var(--steel-500); }

.mx-sendwrap { padding-top: 2px; }
.mx-send { width: 100%; }

/* ---------- part card: on the stage, solid ground ---------- */
.mx-cards { grid-area: stage; align-self: end; justify-self: start; z-index: 4; position: relative; margin: 0 0 66px 14px; width: min(360px, calc(100% - 28px)); }
.mx-cards:not(:has(.mx-card:not([hidden]))) { display: none; }
.mx-card { display: grid; gap: 8px; padding: 18px 48px 10px 20px; background: var(--ink); border: 1px solid var(--line-strong); border-radius: var(--radius); box-shadow: 0 18px 40px rgba(4, 10, 8, 0.35); }
.mx-card[hidden] { display: none; }
.mx-card__title { font-family: var(--f-display); font-stretch: 125%; font-weight: 300; font-size: 1.3rem; letter-spacing: 0.02em; text-transform: uppercase; color: var(--bone); }
.mx-card__disc { color: var(--signal); line-height: 1.55; }
.mx-card__copy { font-size: 0.95rem; line-height: 1.55; color: var(--steel-300); }
.mx-card__note { font-size: var(--t-small); color: var(--steel-300); }
.mx-card .link-arrow { justify-self: start; padding: 0; background: none; border: 0; cursor: pointer; }
.mx-card__close { position: absolute; top: 4px; right: 4px; width: 44px; height: 44px; display: grid; place-items: center; background: none; border: 0; color: var(--steel-100); cursor: pointer; }
.mx-card__close:hover { color: var(--bone); }

/* ---------- engine overlay (any showroom host: this view, the home teaser, the studio) ---------- */
.sr-host { overflow: hidden; }
.sr-hotspots { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.sr-hotspot {
  position: absolute; left: -22px; top: -22px; width: 44px; height: 44px; padding: 0; margin: 0; border: 0; background: none; cursor: pointer;
  pointer-events: auto; transition: opacity 0.25s var(--ease); will-change: transform;
}
.sr-hotspot.is-off { visibility: hidden; opacity: 0; }
.sr-hotspot__dot { position: absolute; left: 50%; top: 50%; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; background: var(--bone); box-shadow: 0 0 0 4px rgba(13, 28, 22, 0.78), 0 2px 10px rgba(4, 10, 8, 0.5); transition: transform 0.3s var(--ease), background 0.3s var(--ease); }
.sr-hotspot__dot::after { content: ""; position: absolute; inset: -9px; border-radius: 50%; border: 1px solid rgba(237, 231, 217, 0.7); }
.sr-hotspot:hover .sr-hotspot__dot, .sr-hotspot:focus-visible .sr-hotspot__dot { transform: scale(1.25); }
.sr-hotspot.is-active .sr-hotspot__dot { background: var(--signal); }
.sr-hotspot.is-active .sr-hotspot__dot::after { border-color: var(--signal); }
.sr-hotspot__label {
  position: absolute; top: 50%; left: 40px; transform: translateY(-50%); padding: 5px 8px; white-space: nowrap;
  background: var(--ink); color: var(--steel-100); font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; line-height: 1.2;
  opacity: 0; transition: opacity 0.2s var(--ease); pointer-events: none;
}
.sr-hotspot[data-side="left"] .sr-hotspot__label { left: auto; right: 40px; }
.sr-hotspot:hover .sr-hotspot__label, .sr-hotspot:focus-visible .sr-hotspot__label, .sr-hotspot.is-active .sr-hotspot__label { opacity: 1; }
.sr-hotspot:focus-visible { outline: none; }
.sr-hotspot:focus-visible .sr-hotspot__dot { outline: 2px solid var(--orange); outline-offset: 6px; }
/* Small stages (the home teaser on a phone): a plain dot, no ring. */
.sr-host { container-type: inline-size; }
@container (max-width: 520px) {
  .sr-hotspot__dot { width: 10px; height: 10px; margin: -5px 0 0 -5px; box-shadow: 0 0 0 3px rgba(13, 28, 22, 0.78), 0 1px 6px rgba(4, 10, 8, 0.5); }
  .sr-hotspot__dot::after { display: none; }
}
.is-blueprint .sr-hotspot__dot { background: var(--signal); }

.sr-progress {
  position: absolute; left: 50%; top: 50%; z-index: 3; transform: translate(-50%, -50%); display: grid; justify-items: center; gap: 10px;
  padding: 12px 16px; background: var(--ink); color: var(--steel-100); font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase;
  white-space: nowrap; pointer-events: none; max-width: calc(100% - 32px); box-sizing: border-box;
}
.sr-progress__text { overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.sr-progress__bar { position: relative; display: block; width: 160px; height: 1px; background: var(--line-strong); }
.sr-progress__bar i { position: absolute; left: 0; top: 0; bottom: 0; width: 4%; background: var(--signal); transition: width 0.3s var(--ease); }
.sr-progress.is-error .sr-progress__bar { display: none; }

/* ---------- how the live version works ---------- */
.mx-live { background: var(--dial-2); }
.mx-live__head { grid-column: 1 / span 4; align-self: start; }
.mx-live__head .ticks { max-width: 240px; margin-bottom: 30px; background:
    linear-gradient(var(--dial-2), var(--dial-2)) 0 0 / 100% 6px no-repeat,
    repeating-linear-gradient(90deg, var(--orange) 0 2px, transparent 2px calc(100% / 12)) 0 0 / 100% 14px no-repeat,
    repeating-linear-gradient(90deg, var(--line-strong) 0 1px, transparent 1px calc(100% / 60)) 0 6px / 100% 8px no-repeat; }
.mx-live__points { grid-column: 6 / -1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 40px 32px; }
.mx-live__point { min-width: 0; padding-top: 18px; border-top: 1px solid var(--line-strong); }
.mx-live__point h3 { font-stretch: 100%; font-weight: 500; font-size: 1.05rem; line-height: 1.35; margin-bottom: 10px; }
.mx-live__point p { font-size: var(--t-small); line-height: 1.6; color: var(--steel-300); }
.mx-live__cta { grid-column: 1 / -1; }

/* ---------- shorter laptop screens ---------- */
@media (min-width: 1025px) and (max-height: 820px) {
  .mx { row-gap: 14px; padding-top: 18px; }
  .mx-head__line { margin-top: 8px; }
  .mx-panel { gap: 18px; }
  .mx-stage { min-height: clamp(400px, 58svh, 600px); }
}

/* ---------- tablet and phone: one column, stage first after the title ---------- */
@media (max-width: 1024px) {
  .mx { display: flex; flex-direction: column; gap: 20px; min-height: 0; padding-top: 24px; padding-bottom: 48px; }
  /* The panel's pieces join the column so the open part card sits right under the parts. */
  .mx-panel { display: contents; }
  .mx-head { order: 0; } .mx-now { order: 1; } .mx-stagewrap { order: 2; } .mx-lineupbar { order: 3; }
  .mx-parts { order: 4; } .mx-cards { order: 5; } .mx-panel > .mx-group { order: 6; } .mx-sendwrap { order: 7; }
  .mx-now { padding: 0; }
  .mx-stagewrap { margin-inline: calc(-1 * max(var(--gutter), env(safe-area-inset-left, 0px))); }
  .mx-stage { flex: none; min-height: 0; aspect-ratio: 16 / 10; }
  .mx-under { padding: 10px max(var(--gutter), env(safe-area-inset-left, 0px)) 0; }
  .mx-viewbar { position: static; justify-content: flex-start; max-width: none; padding: 12px max(var(--gutter), env(safe-area-inset-left, 0px)) 0; }
  .mx-lineup { grid-auto-columns: minmax(150px, 34%); margin-inline: calc(-1 * var(--gutter)); padding: 0 var(--gutter) 6px; scroll-padding-inline: var(--gutter); scroll-snap-type: x proximity; }
  .mx-model { scroll-snap-align: start; }
  .mx-panel { gap: 22px; }
  .mx-parts__list { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .mx-cards { margin: 0; width: auto; }
  .mx-card { box-shadow: none; }
  .mx-live__head, .mx-live__points { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  .mx-stage { aspect-ratio: 5 / 4; max-height: 70svh; }
  .mx-seg button { padding: 0 11px; min-width: 44px; }
  .mx-lineup { grid-auto-columns: minmax(148px, 46%); }
  .mx-parts__list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mx-live__points { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .sr-hotspot__label { display: none; }
  .sr-hotspot.is-active .sr-hotspot__label { display: block; }
}
