/* ==========================================================================
   Code-built promo banners (views/partials/promo-banner.ejs, promo-slot.ejs)
   Live stock, official per-colour cutouts on a stage tinted by the finish colour.
   Layouts: .tb-promo--hero (split, carousel slide) and .tb-promo--slim (one compact strip).
   Theme hook: .tb-promo--bf / [data-theme="blackfriday"] (Black Friday mode restyles any banner type).
   ========================================================================== */

.tb-promo, .tb-promo *, .tb-promo *::before, .tb-promo *::after { box-sizing: border-box; }
.tb-promo {
  --tb-tint: var(--tb-brand);
  --promo-pad: 20px;
  position: relative; isolation: isolate; overflow: hidden;
  display: grid; gap: 16px;
  padding: var(--promo-pad);
  border-radius: var(--tb-r-xl);
  background: var(--tb-surface);
  border: 1px solid var(--tb-line);
  color: var(--tb-ink);
}
.tb-promo__bg {
  position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(60% 85% at 78% 62%, color-mix(in srgb, var(--tb-tint) 30%, transparent) 0%, transparent 72%),
    linear-gradient(120deg, var(--tb-surface) 0%, var(--tb-surface) 42%, color-mix(in srgb, var(--tb-tint) 10%, var(--tb-surface)) 100%);
}
/* One quiet shape behind the products: a soft glow with no hard edge (a hairline ring crossing the banner's
   top border read as a rendering glitch, and a flat disc turned into a grey slab in dark mode) */
.tb-promo__bg::before {
  content: ""; position: absolute; border-radius: 50%;
  width: 640px; height: 640px; right: -160px; bottom: -300px;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--tb-tint) 20%, transparent) 0%, color-mix(in srgb, var(--tb-tint) 8%, transparent) 55%, transparent 100%);
}
.tb-promo__bg::after { content: none; }

/* ---------- Copy ---------- */
.tb-promo__copy { display: grid; gap: 10px; align-content: center; justify-items: start; min-width: 0; }
.tb-promo__kicker {
  display: inline-flex; align-items: center; gap: 10px; margin: 0;
  font-size: var(--tb-fs-sm); font-weight: 600; letter-spacing: 0.01em; color: var(--tb-ink-2);
}
.tb-promo__logo { display: inline-flex; align-items: center; height: 40px; padding-right: 12px; margin-right: 2px; border-right: 1px solid var(--tb-line-strong); color: var(--tb-ink); }
@media (max-width: 639px) { .tb-promo__logo { height: 30px; padding-right: 10px; } }
.tb-promo__logo svg, .tb-promo__logo img { height: 100%; width: auto; display: block; }
.tb-promo__title {
  margin: 0; font-family: var(--tb-font-display); font-weight: 700;
  font-size: clamp(1.6rem, 1.05rem + 2vw, 2.75rem); line-height: 1.06; letter-spacing: -0.02em;
  color: var(--tb-ink); background: none; -webkit-text-fill-color: currentColor; text-wrap: balance;
}
.tb-promo__title::after { content: none; }
.tb-promo__lead { margin: 0; font-size: var(--tb-fs-md); line-height: 1.5; color: var(--tb-ink-2); max-width: 46ch; }
.tb-promo__price { display: inline-flex; align-items: baseline; gap: 6px; margin: 2px 0 0; font-variant-numeric: proportional-nums; color: var(--tb-ink-2); font-size: var(--tb-fs-sm); }
.tb-promo__price strong { font-family: var(--tb-font-display); font-size: var(--tb-fs-2xl); font-weight: 700; letter-spacing: -0.01em; color: var(--tb-ink); }
.tb-promo__meta { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0; padding: 0; list-style: none; font-size: var(--tb-fs-sm); color: var(--tb-ink-2); }
.tb-promo__meta li { display: inline-flex; align-items: center; gap: 6px; }
.tb-promo__meta li::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: color-mix(in srgb, var(--tb-tint) 70%, var(--tb-ink-3)); }
.tb-promo__ends { margin: 0; font-size: var(--tb-fs-sm); color: var(--tb-ink-2); }
.tb-promo__ends time { font-weight: 700; color: var(--tb-ink); font-variant-numeric: tabular-nums; }
.tb-promo__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; margin-top: 6px; }
.tb-promo__actions .tb-btn { text-decoration: none; }
.tb-promo__link {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px;
  font-size: var(--tb-fs-sm); font-weight: 600; color: var(--tb-ink); text-decoration: none;
}
.tb-promo__link:hover { color: var(--tb-ink); text-decoration: underline; text-underline-offset: 3px; }
.tb-promo__link i { font-size: 12px; }

/* ---------- Product composition (cutouts fanned left to right, the first in front) ---------- */
.tb-promo__media {
  --h: 150px;
  position: relative; display: flex; align-items: flex-end; justify-content: center;
  height: var(--h); min-width: 0;
}
.tb-promo__cutout {
  position: relative; height: 100%; width: auto; max-width: none; object-fit: contain;
  z-index: calc(1 + var(--i, 0));
  filter: drop-shadow(0 14px 18px rgba(15, 23, 42, 0.18));
  transform-origin: 50% 100%;
}
/* Each later finish sits in front of the previous one: the earlier ones show their back (the colour),
   the last one shows back and screen. Official cutouts are back + front side by side. */
.tb-promo__media[data-count="2"] .tb-promo__cutout + .tb-promo__cutout { margin-left: calc(var(--h) * -0.36); }
.tb-promo__media[data-count="3"] .tb-promo__cutout + .tb-promo__cutout,
.tb-promo__media[data-count="4"] .tb-promo__cutout + .tb-promo__cutout { margin-left: calc(var(--h) * -0.44); }
.tb-promo__media[data-count="3"] .tb-promo__cutout,
.tb-promo__media[data-count="4"] .tb-promo__cutout { transform: scale(calc(0.9 + var(--i) * 0.035)); }
.tb-promo__media[data-count="2"] .tb-promo__cutout:first-child { transform: scale(0.94); }
.tb-promo__photo {
  height: 100%; width: auto; aspect-ratio: 1 / 1; object-fit: cover;
  border-radius: var(--tb-r-lg); border: 1px solid var(--tb-line); box-shadow: var(--tb-shadow-2);
}
.tb-promo__badge {
  position: absolute; z-index: 20; right: 8%; bottom: 10%;
  display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%;
  background: var(--tb-surface); color: var(--tb-ink); border: 1px solid var(--tb-line); box-shadow: var(--tb-shadow-2);
  font-size: 20px;
}
.tb-promo__media--icon { align-items: center; font-size: 56px; color: color-mix(in srgb, var(--tb-tint) 70%, var(--tb-ink)); }

/* ---------- Tiles (deals, categories) ---------- */
.tb-promo__tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0; padding: 0; list-style: none; align-self: center; }
.tb-promo__tiles[data-count="1"] { grid-template-columns: minmax(0, 220px); justify-content: center; }
.tb-promo__tiles[data-count="2"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tb-promo__tile { display: grid; gap: 8px; color: var(--tb-ink); text-decoration: none; }
.tb-promo__tile:hover { color: var(--tb-ink); text-decoration: none; }
.tb-promo__tile-stage {
  --tb-tint: var(--tb-stage);
  position: relative; display: grid; place-items: center; aspect-ratio: 1 / 1; overflow: hidden;
  border-radius: var(--tb-r-lg); border: 1px solid var(--tb-line);
  background: radial-gradient(120% 90% at 50% 100%, color-mix(in srgb, var(--tb-tint) 28%, transparent) 0%, transparent 70%), var(--tb-surface);
}
.tb-promo__tile-stage > img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; padding: 12%;
  filter: drop-shadow(0 10px 14px rgba(15, 23, 42, 0.16)); transition: transform .3s var(--tb-ease);
}
.tb-promo__tile-stage--photo > img { padding: 0; object-fit: cover; filter: none; }
.tb-promo__tile:hover .tb-promo__tile-stage > img { transform: translateY(-3px); }
.tb-promo__tile-text { display: grid; gap: 2px; padding: 0 2px; min-width: 0; }
.tb-promo__tile-text strong { font-size: var(--tb-fs-xs); font-weight: 600; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tb-promo__tile-sub, .tb-promo__tile-price { font-size: var(--tb-fs-xs); color: var(--tb-ink-3); font-variant-numeric: proportional-nums; }
.tb-promo__tile-price { display: flex; flex-wrap: wrap; gap: 0 6px; align-items: baseline; }
.tb-promo__tile-price b { color: var(--tb-ink); font-weight: 700; }
.tb-promo__tile-price s { color: var(--tb-ink-3); }
.tb-promo__off {
  position: absolute; left: 8px; top: 8px; z-index: 2;
  display: inline-flex; align-items: center; height: 24px; padding: 0 8px; border-radius: 999px;
  font-size: var(--tb-fs-xs); font-weight: 700; color: #fff; background: #e11d48; font-variant-numeric: tabular-nums;
}

/* ---------- Hero layout ---------- */
.tb-promo--hero { min-height: 0; }
.tb-promo--hero .tb-promo__lead {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
@media (max-width: 639px) {
  .tb-promo--hero { --promo-pad: 18px; gap: 12px; border-radius: var(--tb-r-lg); }
  .tb-promo--hero .tb-promo__copy { gap: 6px; }
  .tb-promo--hero .tb-promo__title { font-size: 1.5rem; }
  .tb-promo--hero .tb-promo__lead { font-size: var(--tb-fs-sm); }
  .tb-promo--hero .tb-promo__meta { display: none; }
  .tb-promo--hero .tb-promo__price strong { font-size: var(--tb-fs-xl); }
  .tb-promo--hero .tb-promo__actions { margin-top: 4px; gap: 4px 16px; }
  .tb-promo--hero .tb-promo__actions .tb-btn { min-height: 44px; padding: 0 16px; font-size: var(--tb-fs-sm); }
  .tb-promo--hero .tb-promo__media { --h: 132px; order: -1; }
  .tb-promo--hero.tb-promo--tiles .tb-promo__tiles { order: 2; }
  .tb-promo__bg::before { width: 320px; height: 320px; right: -80px; top: -120px; bottom: auto; }
  .tb-promo__bg::after { display: none; }
}
@media (min-width: 640px) and (max-width: 899px) {
  .tb-promo--hero { --promo-pad: 28px; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: center; gap: 20px; }
  .tb-promo--hero .tb-promo__media { --h: 210px; }
}
@media (min-width: 900px) {
  .tb-promo--hero {
    --promo-pad: 40px 48px;
    grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); align-items: center; gap: 32px;
    min-height: 340px;
  }
  .tb-promo--hero .tb-promo__media { --h: 270px; }
  .tb-promo--hero .tb-promo__tiles { gap: 14px; }
  .tb-promo__tile-text strong { font-size: var(--tb-fs-sm); }
  .tb-promo__tile-sub, .tb-promo__tile-price { font-size: var(--tb-fs-sm); }
}
@media (min-width: 1200px) {
  .tb-promo--hero { --promo-pad: 44px 64px; min-height: 360px; }
  .tb-promo--hero .tb-promo__media { --h: 290px; }
}
.tb-promo--hero.tb-promo--nomedia { grid-template-columns: 1fr; }

/* ---------- Slim layout (listing, product page, cart) ---------- */
.tb-promo--slim {
  --promo-pad: 10px 14px 10px 10px;
  grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 14px;
  border-radius: var(--tb-r-lg);
}
.tb-promo--slim .tb-promo__media { --h: 76px; order: -1; width: 112px; justify-content: center; }
.tb-promo--slim .tb-promo__media[data-count="1"] { width: 76px; }
.tb-promo--slim .tb-promo__media--icon { font-size: 30px; }
.tb-promo--slim .tb-promo__badge { width: 32px; height: 32px; font-size: 13px; right: -4px; bottom: 0; }
.tb-promo--slim .tb-promo__photo { border-radius: var(--tb-r-md); box-shadow: none; }
.tb-promo--slim .tb-promo__copy { gap: 2px; }
.tb-promo--slim .tb-promo__kicker { font-size: var(--tb-fs-xs); }
.tb-promo--slim .tb-promo__title { font-size: var(--tb-fs-lg); line-height: 1.2; letter-spacing: -0.01em; }
.tb-promo--slim .tb-promo__lead { font-size: var(--tb-fs-sm); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tb-promo--slim .tb-promo__price { margin: 0; font-size: var(--tb-fs-xs); }
.tb-promo--slim .tb-promo__price strong { font-size: var(--tb-fs-md); }
.tb-promo--slim .tb-promo__ends { font-size: var(--tb-fs-xs); }
/* Slim: price and stock facts share one line on wide screens; the facts drop on narrow ones */
.tb-promo--slim .tb-promo__copy { grid-template-columns: auto 1fr; column-gap: 16px; align-items: baseline; }
.tb-promo--slim .tb-promo__copy > * { grid-column: 1 / -1; }
.tb-promo--slim .tb-promo__copy > .tb-promo__price { grid-column: 1; }
.tb-promo--slim .tb-promo__copy > .tb-promo__meta { grid-column: 2; font-size: var(--tb-fs-xs); color: var(--tb-ink-3); }
@media (max-width: 1023px) { .tb-promo--slim .tb-promo__meta { display: none; } }
.tb-promo--slim .tb-promo__bg {
  background:
    radial-gradient(40% 140% at 6% 50%, color-mix(in srgb, var(--tb-tint) 26%, transparent) 0%, transparent 72%),
    var(--tb-surface);
}
.tb-promo--slim .tb-promo__bg::before, .tb-promo--slim .tb-promo__bg::after { display: none; }
.tb-promo__cta--slim {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: var(--tb-r-md);
  font-size: var(--tb-fs-sm); font-weight: 600; white-space: nowrap; text-decoration: none;
  color: var(--tb-ink); background: var(--tb-surface); border: 1px solid var(--tb-line-strong);
  transition: border-color .15s var(--tb-ease);
}
.tb-promo__cta--slim i { font-size: 12px; }
/* The whole strip is the link target */
.tb-promo__cta--slim::after { content: ""; position: absolute; inset: 0; z-index: 30; border-radius: inherit; }
.tb-promo--slim:hover .tb-promo__cta--slim { border-color: var(--tb-ink-3); color: var(--tb-ink); text-decoration: none; }
.tb-promo--slim:has(.tb-promo__cta--slim:focus-visible) { outline: 2px solid var(--tb-brand); outline-offset: 2px; }
@media (max-width: 767px) {
  .tb-promo--slim .tb-promo__lead { display: none; }
}
@media (max-width: 639px) {
  .tb-promo--slim { --promo-pad: 8px 10px 8px 8px; gap: 10px; }
  .tb-promo--slim .tb-promo__media { --h: 60px; width: 84px; }
  .tb-promo--slim .tb-promo__media[data-count="1"] { width: 60px; }
  .tb-promo--slim .tb-promo__title { font-size: var(--tb-fs-md); }
  .tb-promo__cta--slim { width: 40px; height: 40px; min-height: 40px; padding: 0; justify-content: center; border-radius: 50%; }
  .tb-promo__cta--slim span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}

/* ---------- Slots (placement on pages) ---------- */
.tb-promo-slot { color: var(--tb-ink); }
.tb-promo-slot--homepage { padding: 8px 0 8px; }
.tb-promo-slot--products.tb-promo-slot--slim { margin: 0 0 16px; }
.tb-promo-slot--product-detail { margin: 32px 0 8px; }
.tb-promo-slot--cart { margin: 24px 0 8px; }
.tb-promo-slot--contact, .tb-promo-slot--buyback, .tb-promo-slot--service, .tb-promo-slot--accessories { margin: 24px 0 32px; }
.tb-promo-slot + .tb-promo-slot { margin-top: 0; }
.tb-promo-slot--slim .tb-promo + .tb-promo, .tb-promo-slot--hero .tb-promo + .tb-promo { margin-top: 12px; }

/* ---------- Carousel ---------- */
.tb-carousel { position: relative; }
.tb-carousel__track {
  display: grid; grid-auto-flow: column; grid-auto-columns: 100%;
  overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory; overscroll-behavior-x: contain;
  scrollbar-width: none; border-radius: var(--tb-r-xl);
}
.tb-carousel__track::-webkit-scrollbar { display: none; }
.tb-carousel__track:focus { outline: none; }
.tb-carousel__slide { display: flex; min-width: 0; scroll-snap-align: start; scroll-snap-stop: always; }
.tb-carousel__slide > .tb-promo { flex: 1 1 auto; width: 100%; }
.tb-carousel__controls { display: flex; align-items: center; justify-content: center; gap: 4px; margin-top: 10px; }
.tb-carousel__btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; padding: 0; border-radius: 50%;
  background: transparent; color: var(--tb-ink-2); border: 1px solid var(--tb-line-strong); cursor: pointer;
  font-size: 13px; transition: border-color .15s var(--tb-ease), color .15s var(--tb-ease);
}
.tb-carousel__btn:hover { color: var(--tb-ink); border-color: var(--tb-ink-3); }
.tb-carousel__btn--toggle { border-color: transparent; margin-left: 2px; }
.tb-carousel__dots { display: flex; align-items: center; gap: 0; margin: 0 6px; }
.tb-carousel__dot {
  position: relative; width: 22px; height: 40px; padding: 0; border: 0; background: transparent; cursor: pointer;
}
.tb-carousel__dot::before {
  content: ""; position: absolute; left: 50%; top: 50%; width: 8px; height: 8px; border-radius: 999px;
  transform: translate(-50%, -50%); background: var(--tb-line-strong); transition: width .2s var(--tb-ease), background-color .2s var(--tb-ease);
}
.tb-carousel__dot:hover::before { background: var(--tb-ink-3); }
.tb-carousel__dot[aria-current="true"]::before { width: 20px; background: var(--tb-ink); }
@media (prefers-reduced-motion: reduce) {
  .tb-carousel__track { scroll-behavior: auto; }
  .tb-promo__tile-stage > img, .tb-carousel__dot::before { transition: none; }
}

/* ---------- Black Friday theme (any banner type; the Black Friday mode refines tokens in black-friday.css) ---------- */
.tb-promo--bf {
  --tb-tint: var(--tb-bf-accent, #ffd400);
  --tb-ink: #fff; --tb-ink-2: #cfcfd6; --tb-ink-3: #9d9da6;
  --tb-surface: #141416; --tb-stage: #1b1b1f;
  --tb-line: rgba(255, 255, 255, 0.10); --tb-line-strong: rgba(255, 255, 255, 0.18);
  background: var(--tb-bf-bg, #0a0a0b); border-color: rgba(255, 255, 255, 0.08); color: #fff;
}
.tb-promo--bf .tb-promo__bg {
  background:
    radial-gradient(55% 80% at 80% 65%, rgba(255, 212, 0, 0.16) 0%, transparent 70%),
    var(--tb-bf-bg, #0a0a0b);
}
.tb-promo--bf .tb-promo__bg::before { background: radial-gradient(closest-side, rgba(255, 212, 0, 0.09) 0%, transparent 100%); }
.tb-promo--bf .tb-promo__kicker { color: #fff; }
.tb-promo--bf .tb-promo__kicker-text {
  font-family: var(--tb-font-display); font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--tb-bf-accent, #ffd400);
}
.tb-promo--bf .tb-btn--primary { background: var(--tb-bf-accent, #ffd400); color: #0a0a0b; }
.tb-promo--bf .tb-btn--primary:hover { background: color-mix(in srgb, var(--tb-bf-accent, #ffd400) 88%, #fff); }
.tb-promo--bf .tb-promo__off { background: var(--tb-bf-hot-fill, #e11d48); }
.tb-promo--bf .tb-promo__cutout, .tb-promo--bf .tb-promo__tile-stage > img { filter: drop-shadow(0 16px 22px rgba(0, 0, 0, 0.55)); }
.tb-promo--bf .tb-promo__meta li::before { background: var(--tb-bf-accent, #ffd400); }
.tb-promo--bf.tb-promo--slim .tb-promo__bg { background: radial-gradient(40% 140% at 6% 50%, rgba(255, 212, 0, 0.16) 0%, transparent 72%), var(--tb-bf-bg, #0a0a0b); }
.tb-promo--bf .tb-promo__cta--slim { background: var(--tb-bf-accent, #ffd400); color: #0a0a0b; border-color: transparent; }
.tb-promo--bf .tb-promo__logo { color: #fff; }
.tb-promo--bf :focus-visible { outline-color: var(--tb-bf-accent, #ffd400); }

@media (max-width: 639px) {
  .tb-promo__off { left: 6px; top: 6px; height: 20px; padding: 0 6px; font-size: 11px; }
}
