/* GOMORAA Combo Express: sticky bottom bullet train. Pure CSS, no libraries.
   Train pictures: img/b-head.webp (1829x331), img/b-coach.webp (1274x331), img/b-rail.webp (AI-made, no text).
   Products + logo: real photos; the original logo is never recoloured, it always sits on a cream plate.

   Website knobs (set on :root or on .ct):
     --ct-bottom  distance from the bottom of the screen (e.g. height of a mobile bottom nav + floating buttons). Default 0.
     --ct-z       stacking order. Default 30; keep it BELOW popups, cart drawer, WhatsApp/cart floating buttons.
     --h          car height. Default 104px desktop, 76px phone (bar is about 115px / 84px tall). */
.ct {
  --h: 104px;
  --u: calc(var(--h) / 331);                    /* 1 source pixel */
  position: fixed; left: 0; right: 0;
  bottom: calc(var(--ct-bottom, 0px) + env(safe-area-inset-bottom, 0px));
  height: calc(var(--h) + var(--u) * 36);
  z-index: var(--ct-z, 30);
  pointer-events: none;                         /* page under the empty parts stays clickable */
  overflow-x: clip; overflow-y: visible;
  -webkit-tap-highlight-color: transparent; user-select: none;
}
@media (max-width: 640px) { .ct { --h: 76px; } }
.ct *, .ct *::before, .ct *::after { box-sizing: border-box; }
.ct.is-hidden { display: none; }

/* the only background: a clean rail track */
.ct-track {
  position: absolute; left: 0; right: 0; bottom: 0; height: calc(var(--u) * 36);
  background: url("img/b-rail.webp") repeat-x left top / auto 100%;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 3%, #000 97%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 3%, #000 97%, transparent);
}
.ct-stage { position: absolute; inset: 0; overflow: visible; }
.ct-train {
  position: absolute; left: 0; bottom: calc(var(--u) * 35);
  display: flex; flex-direction: row-reverse; align-items: flex-end;
  pointer-events: auto; will-change: transform; transform: translate3d(-99999px, 0, 0);
}
.ct-train::before {             /* soft shadow on the track */
  content: ""; position: absolute; left: 1%; right: 1%; bottom: calc(var(--u) * -12); height: calc(var(--u) * 26);
  background: radial-gradient(50% 50% at 50% 50%, rgba(30,15,5,.38), rgba(30,15,5,0)); filter: blur(calc(var(--u) * 4));
  pointer-events: none; z-index: -1;
}

/* logo plate (on every car) */
.ct-logo {
  position: absolute; display: flex; align-items: center; justify-content: center;
  border-radius: calc(var(--u) * 12);
  background: linear-gradient(180deg, #fffdf8 0%, #f8efdf 100%);
  box-shadow: 0 0 0 calc(var(--u) * 2.5) #c9a04a, inset 0 calc(var(--u) * 2) calc(var(--u) * 4) rgba(255,255,255,.8), inset 0 calc(var(--u) * -3) calc(var(--u) * 6) rgba(120,80,20,.18);
}
.ct-logo img { width: 86%; height: auto; display: block; }

/* lead car (nose right) and tail car (same picture mirrored) */
.ct-engine { position: relative; flex: none; height: var(--h); aspect-ratio: 1829 / 331; }
.ct-engine > img { display: block; width: 100%; height: 100%; }
.ct-tail > img { transform: scaleX(-1); }
.ct-engine .ct-logo.a { left: 60.4%; top: 23%; width: 10.9%; height: 25.4%; }
.ct-engine .ct-logo.b { left: 24%; top: 55%; width: 14.5%; height: 17.5%; }
.ct-tail .ct-logo.a { left: 28.7%; }
.ct-tail .ct-logo.b { left: 61.5%; }

/* middle cars (source 1274 x 331) */
.ct-coach {
  position: relative; flex: none; display: block; height: var(--h); aspect-ratio: 1274 / 331;
  margin-right: calc(var(--u) * -2);
  background: url("img/b-coach.webp") center / 100% 100% no-repeat;
  container-type: inline-size; text-decoration: none; color: #3a1206; outline: none;
}
.ct-coach .ct-logo { top: 55%; width: 16%; height: 17.5%; }
.ct-coach .ct-logo.a { left: 10.5%; } .ct-coach .ct-logo.b { right: 10.5%; }
.ct-goods {
  position: absolute; left: 37%; right: 37%; top: 15.4%; bottom: 44.4%;
  display: flex; align-items: flex-end; justify-content: center; gap: 1.5%;
}
.ct-goods img { color: transparent; font-size: 0; display: block; width: auto; flex: none; filter: drop-shadow(0 calc(var(--u) * 4) calc(var(--u) * 3) rgba(60,30,5,.35)); }
.ct-name {                      /* LED-style board inside the showcase */
  position: absolute; left: 37.8%; right: 37.8%; top: 58.6%; height: 11%;
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  background-color: #120805;
  background-image: radial-gradient(rgba(255,214,140,.10) 35%, transparent 38%);
  background-size: calc(var(--u) * 3.2) calc(var(--u) * 3.2);
  border-radius: calc(var(--u) * 4); padding: 0 2%;
  box-shadow: 0 0 0 calc(var(--u) * 1.6) #c9a04a, inset 0 0 calc(var(--u) * 8) rgba(0,0,0,.8);
  color: #ffd27a; text-shadow: 0 0 calc(var(--u) * 3) rgba(255,184,70,.9);
  font-family: "Segoe UI", Roboto, Arial, sans-serif; line-height: 1.05; overflow: hidden;
}
.ct-name b { font-weight: 700; font-size: clamp(5px, 1.42cqw, 15px); letter-spacing: .03em; white-space: nowrap; }
.ct-name.long b { font-size: clamp(5px, 1.12cqw, 12px); white-space: normal; }
.ct-name small { font-size: clamp(4px, 0.98cqw, 10px); font-weight: 600; opacity: .85; white-space: nowrap; }
@media (max-width: 640px) {      /* tiny board on phones: one neat line; the big card shows the full name */
  .ct-name.long b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; font-size: clamp(4px, 1.15cqw, 12px); }
  .ct-name small { display: none; }
}

/* big card that pops up above a coach at the station / on hover / when stopped:
   the real product photos, large enough to see at a glance, plus the combo name */
.ct-card {
  --img: 66px;
  position: absolute; left: 50%; bottom: calc(100% + 6px);
  transform: translate(-50%, 14px) scale(.9); transform-origin: 50% 100%;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  width: max-content; max-width: min(94vw, 110%);
  padding: 6px 10px 5px; border-radius: 12px; border: 1.5px solid #c9a04a;
  background: linear-gradient(180deg, #fffdf8 0%, #f7ecd8 100%);
  box-shadow: 0 10px 26px rgba(40,15,5,.30), 0 0 0 4px rgba(201,160,74,.18);
  font-family: "Segoe UI", Roboto, Arial, sans-serif; color: #3a1206; text-align: center;
  opacity: 0; visibility: hidden; transition: opacity .3s, transform .3s, visibility 0s .3s; pointer-events: none;
}
.ct-card::after {               /* little pointer down to the coach */
  content: ""; position: absolute; left: 50%; bottom: -7px; width: 12px; height: 12px; margin-left: -6px;
  background: #f7ecd8; border-right: 1.5px solid #c9a04a; border-bottom: 1.5px solid #c9a04a; transform: rotate(45deg);
}
.ct-card-imgs { display: flex; align-items: flex-end; justify-content: center; gap: 6px; height: var(--img); margin-bottom: 1px; }
.ct-card-imgs img { display: block; width: auto; flex: none; filter: drop-shadow(0 5px 5px rgba(60,30,5,.28)); }
.ct-card b { font-size: 12.5px; font-weight: 700; line-height: 1.2; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ct-card small { font-size: 10px; font-weight: 600; color: #7a4a22; white-space: nowrap; }
.ct-card i { font-style: normal; font-size: 10px; font-weight: 700; color: #fff; background: #6b2414; border-radius: 999px; padding: 1px 9px; margin-top: 2px; }
@media (max-width: 640px) {
  .ct-card { --img: 54px; padding: 5px 9px 4px; }
  .ct-card b { font-size: 11.5px; }
}
.ct.at-station .ct-card, .ct.is-paused .ct-card, .ct-coach:focus-visible .ct-card {
  opacity: 1; visibility: visible; transform: translate(-50%, 0) scale(1); pointer-events: auto; transition: opacity .3s, transform .3s, visibility 0s;
}
.ct-coach:focus-visible .ct-name { box-shadow: 0 0 0 calc(var(--u) * 1.6) #f3dc98, 0 0 0 calc(var(--u) * 5) rgba(247,227,166,.6); }

/* close + reopen */
.ct-x {
  position: absolute; left: 8px; top: -6px; z-index: 2; pointer-events: auto;
  width: 24px; height: 24px; border-radius: 50%; border: 1px solid #c9a04a; padding: 0;
  background: rgba(42,14,5,.85); color: #fff3d6; font: 700 12px/22px Arial, sans-serif; text-align: center; cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,.25);
}
.ct-x:hover, .ct-x:focus-visible { background: #6b2414; outline: none; }
.ct-open {
  position: fixed; left: 10px; bottom: calc(var(--ct-bottom, 0px) + env(safe-area-inset-bottom, 0px) + 10px); z-index: var(--ct-z, 30);
  display: none; width: 42px; height: 42px; border-radius: 50%; border: 1.5px solid #c9a04a; padding: 0;
  background: #fffaf0; font-size: 22px; line-height: 40px; text-align: center; cursor: pointer; box-shadow: 0 3px 10px rgba(0,0,0,.25);
}
.ct-open.is-on { display: block; }

/* reduced motion: nothing moves, the row of all coaches can be swiped */
.ct.is-static .ct-stage { overflow-x: auto; overflow-y: hidden; pointer-events: auto; scrollbar-width: none; }
.ct.is-static .ct-stage::-webkit-scrollbar { display: none; }
.ct.is-static .ct-train { position: absolute; transform: none !important; }
.ct.is-static .ct-card { display: none; }
@media (prefers-reduced-motion: reduce) { .ct *, .ct-card { transition: none !important; } }
