/*
  Header rail carousel module.
  Extracted from the former modules/40-rails-bases-home.css; keep after 40-rails-bases-home.css.
*/

/* Carousel / scroller styles for header rails */
/*
  Р В Р ВµР В°Р В»Р С‘Р В·Р В°РЎвЂ Р С‘РЎРЏ РЎвЂЎР ВµРЎР‚Р ВµР В· scroll-snap + auto-scroll (JS scrollBy), РЎвЂЎРЎвЂљР С•Р В±РЎвЂ№:
  - Р Р† Р В»Р ВµР Р…РЎвЂљР Вµ Р В±Р В°Р В· Р В±РЎвЂ№Р В»Р С• Р Р†Р С‘Р Т‘Р Р…Р С• 3 Р С”Р В°РЎР‚РЎвЂљР С•РЎвЂЎР С”Р С‘ Р С•Р Т‘Р Р…Р С•Р Р†РЎР‚Р ВµР СР ВµР Р…Р Р…Р С•;
  - Р С—РЎР‚Р С•Р СР С• Р С—Р С•Р С”Р В°Р В·РЎвЂ№Р Р†Р В°Р В»Р С• 1 Р С”Р В°РЎР‚РЎвЂљР С•РЎвЂЎР С”РЎС“;
  - Р С—РЎР‚Р С‘ РЎРЊРЎвЂљР С•Р С Р С—Р С•Р В»РЎРЉР В·Р С•Р Р†Р В°РЎвЂљР ВµР В»РЎРЉ Р СР С•Р С– РЎРѓР С”РЎР‚Р С•Р В»Р В»Р С‘РЎвЂљРЎРЉ/РЎРѓР Р†Р В°Р в„–Р С—Р В°РЎвЂљРЎРЉ Р Р†РЎР‚РЎС“РЎвЂЎР Р…РЎС“РЎР‹.
*/
.railScroller{
  position: relative;
  width: 100%;
  height: 100%;
  /* Center content vertically inside the rail box (prevents cards "sinking") */
  display: flex;
  align-items: center;
  overflow-x: auto;
  overflow-y: hidden;
  /* Bases rail uses proximity snap (or none in loop mode). Promo uses mandatory. */
  scroll-snap-type: x proximity;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}
.railScroller::-webkit-scrollbar{ display:none; }
.railScroller{ scrollbar-width: none; }

.railTrack{
  align-items: center;
  height: 100%;
  display:flex;
  gap: 10px;
  /* Track width is tied to the scroller viewport so % flex-basis works predictably.
     Scroll width still grows from child items. */
  width: 100%;
  min-width: 100%;
}
.railTrack .railSlide{
  flex: 0 0 100%;
  max-width: 100%;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 8px;
  scroll-snap-align: start;
}

/* Bases: adaptive per-viewport sizing.
   IMPORTANT:
   - We keep the "3 per view" intent on wide screens.
   - On narrower viewports (and also browser zoom), cards should NOT get squashed into tiny squares.
     Instead, we enforce a reasonable minimum width and let the rail scroll horizontally.
*/
.railScroller--bases .railSlide{
  /* default (desktop): ~3 cards per view when space allows */
  /* NOTE: keep a softer minimum so 3 cards can still fit in the header on 1920px
     even when the profile/promo blocks are wide. */
  flex-basis: clamp(216px, calc((100% - 20px) / 3), 520px);
  max-width: clamp(216px, calc((100% - 20px) / 3), 520px);
}
/* When there is only ONE real base this month we add 2 placeholders to keep
   the rail visually consistent (3 slots). In this case the previous min-width
   (240px) often made the 3rd card partially clipped on common desktop widths.
   Reduce the minimum so 3 cards fit more often without requiring a horizontal swipe. */
.railScroller--bases[data-count="1"] .railSlide,
.railScroller--bases[data-count="3"] .railSlide{
  flex-basis: clamp(180px, calc((100% - 20px) / 3), 520px);
  max-width: clamp(180px, calc((100% - 20px) / 3), 520px);
}
/* exactly 2 items: still adaptive, but keep them comfortably wide */
.railScroller--bases[data-count="2"] .railSlide{
  flex-basis: clamp(234px, calc((100% - 10px) / 2), 680px);
  max-width: clamp(234px, calc((100% - 10px) / 2), 680px);
}
/* medium screens: prefer 2 per view, but keep a minimum width */
@media (max-width: 1200px){
  .railScroller--bases .railSlide{
    flex-basis: clamp(198px, calc((100% - 10px) / 2), 520px);
    max-width: clamp(198px, calc((100% - 10px) / 2), 520px);
  }
  .railScroller--bases[data-count="2"] .railSlide{
    flex-basis: clamp(216px, calc((100% - 10px) / 2), 680px);
    max-width: clamp(216px, calc((100% - 10px) / 2), 680px);
  }
}
@media (max-width: 560px){
  /* Override any data-count specific widths on small screens */
  .railScroller--bases .railSlide,
  .railScroller--bases[data-count="1"] .railSlide,
  .railScroller--bases[data-count="2"] .railSlide,
  .railScroller--bases[data-count="3"] .railSlide{
    flex-basis: 100%;
    max-width: 100%;
  }
}

/* Container-query responsive behavior for РІР‚СљР вЂР В°Р В·РЎвЂ№ Р СР ВµРЎРѓРЎРЏРЎвЂ Р В°РІР‚Сњ.
   Goal: when the available rail width shrinks (including browser zoom), switch from 3РІвЂ вЂ™2РІвЂ вЂ™1 visible cards,
   instead of clipping the 3rd card.
   Fallback: media queries above already cover many cases; container queries make it correct even on wide screens
   where the header rail itself becomes narrow due to promo/profile widths. */
@supports (container-type: inline-size){
  .headerRailBases{ container-type: inline-size; }

  /* 2-up when the rail container is not wide enough for 3 comfortable cards */
  @container (max-width: 760px){
    .headerRailBases .railScroller--bases .railSlide,
    .headerRailBases .railScroller--bases[data-count="1"] .railSlide,
    .headerRailBases .railScroller--bases[data-count="3"] .railSlide{
      flex-basis: clamp(198px, calc((100% - 10px) / 2), 520px);
      max-width: clamp(198px, calc((100% - 10px) / 2), 520px);
    }
    .headerRailBases .railScroller--bases[data-count="2"] .railSlide{
      flex-basis: clamp(216px, calc((100% - 10px) / 2), 680px);
      max-width: clamp(216px, calc((100% - 10px) / 2), 680px);
    }
  }

  /* 1-up on very narrow rail widths */
  @container (max-width: 520px){
    .headerRailBases .railScroller--bases .railSlide,
    .headerRailBases .railScroller--bases[data-count="1"] .railSlide,
    .headerRailBases .railScroller--bases[data-count="2"] .railSlide,
    .headerRailBases .railScroller--bases[data-count="3"] .railSlide{
      flex-basis: 100%;
      max-width: 100%;
    }
  }
}
.railSlide {
  background: rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-2);
  padding: 9px 11px;
  overflow: hidden;
  min-height: 78px;
  border: 1px solid rgba(255,255,255,.10);
}

/* Bases rail: add a bit of inner padding so card shadows/edges are not clipped by the rail body */
.railScroller--bases{ padding: 4px 4px; }

/* Promo rail remains truly full-bleed */
.railScroller--promo{ padding: 0; scroll-snap-type: x mandatory; }

/* Disable snapping while infinite loop is active to avoid "fighting" auto-scroll */
.railScroller--bases[data-loop="1"]{ scroll-snap-type: none; }

/* Base slides: richer meta layout (title + owner + stats)
   IMPORTANT: keep the frame consistent with the site cards/panels.
   Previous bevel+inner-frame made it look like there is an extra "card" layered on top.
*/
.railScroller--bases .railSlide{
  position: relative;
  display:flex;
  align-items:center;
  gap: 9px;
  cursor: pointer;
  user-select: none;
  transition: transform var(--transition-fast), border-color var(--transition-fast), background var(--transition-fast), box-shadow var(--transition-fast);

  border-radius: var(--radius-2);
  background: var(--surface);
  border: 1px solid rgba(255,255,255,.10);

  /* Softer, single-layer shadow (no "double frame" look). */
  box-shadow:
    0 12px 26px rgba(0,0,0,.32),
    inset 0 1px 0 rgba(255,255,255,.07);
}

/* Subtle facet lighting: only a gentle top highlight + bottom shade.
   No inner pseudo-border (that was read as a second card). */
.railScroller--bases .railSlide:not(.railSlide--skeleton)::before{
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(255,255,255,.10) 0%, rgba(255,255,255,0) 56%),
    linear-gradient(0deg, rgba(0,0,0,.26) 0%, rgba(0,0,0,0) 62%);
  opacity: .9;
}

.railScroller--bases .railSlide:hover{
  transform: translateY(-1px);
  border-color: rgba(240,140,40,.28);
  box-shadow:
    0 14px 30px rgba(0,0,0,.36),
    inset 0 1px 0 rgba(255,255,255,.08);
}
.railScroller--bases .railSlide:active{ transform: translateY(0px) scale(.995); }
.railScroller--bases .railSlide:focus-visible{
  outline: 2px solid rgba(240,140,40,.60);
  outline-offset: 3px;
}

.headerRailBasesStage .railScroller--bases{
  padding: 0;
  scroll-snap-type: x mandatory;
  height: 100%;
}
.headerRailBasesStage .railTrack{
  gap: 0;
  height: 100%;
}
.headerRailBasesStage .railScroller--bases .railSlide{
  flex-basis: 100%;
  max-width: 100%;
  min-height: 112px;
  padding: 10px;
  gap: 12px;
  border-radius: 14px;
}
.headerRailBasesStage .railScroller--bases .railSlide--empty[data-pad="1"]{
  display: none !important;
}
.headerRailBasesStage .railScroller--bases .baseCover{
  width: clamp(112px, 29%, 142px);
  height: 92px;
  border-radius: 12px;
  object-fit: cover;
  flex: 0 0 auto;
}
.headerRailBasesStage .railScroller--bases .baseInfo{
  gap: 6px;
}
.headerRailBasesStage .railScroller--bases .railTitle{
  font-size: 14px;
  -webkit-line-clamp: 2;
}
.headerRailBasesStage .railScroller--bases .baseOwnerAva{
  width: 22px;
  height: 22px;
}
.headerRailBasesStage .railScroller--bases .railSub{
  font-size: 12px;
}
.headerRailBasesStage .railScroller--bases .baseCounts{
  gap: 8px 12px;
  font-size: 12px;
}
.headerRailBasesStage .railScroller--bases .baseCounts i{
  font-size: 13px;
}

@supports (container-type: inline-size){
  @container (max-width: 720px){
    .headerRailBasesShell{
      grid-template-columns: 1fr;
    }
  }
}

.railScroller--bases .baseInfo{ display:flex; flex-direction:column; min-width:0; gap: 4px; }
.railScroller--bases .railTitle{
  font-weight: 700;
  font-size: 12px;
  line-height: 1.15;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: normal;
}
.railScroller--bases .railSub{ font-size: 11px; opacity: .88; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.railScroller--bases .baseOwnerRow{ display:flex; align-items:center; gap: 8px; min-width:0; }
.railScroller--bases .baseOwnerAva{ width: 18px; height: 18px; border-radius: 999px; object-fit: cover; flex: 0 0 auto; border: 1px solid rgba(255,255,255,.12); }
.railScroller--bases .baseCounts{ display:flex; align-items:center; flex-wrap: wrap; gap: 6px 10px; font-size: 11px; opacity: .86; }
.railScroller--bases .baseCounts .c{ display:inline-flex; align-items:center; gap: 4px; }
.railScroller--bases .baseCounts i{ font-size: 12px; opacity: .9; }

/* Subtle highlighting for top-3 */
.railScroller--bases .railSlide[data-rank="1"]{ border-color: rgba(var(--top1-rgb), .32); box-shadow: 0 12px 26px rgba(0,0,0,.32), 0 0 0 1px rgba(var(--top1-rgb), .12), inset 0 1px 0 rgba(255,255,255,.07); }
.railScroller--bases .railSlide[data-rank="2"]{ border-color: rgba(var(--top2-rgb), .22); box-shadow: 0 12px 26px rgba(0,0,0,.32), 0 0 0 1px rgba(var(--top2-rgb), .10), inset 0 1px 0 rgba(255,255,255,.07); }
.railScroller--bases .railSlide[data-rank="3"]{ border-color: rgba(var(--top3-rgb), .20); box-shadow: 0 12px 26px rgba(0,0,0,.32), 0 0 0 1px rgba(var(--top3-rgb), .10), inset 0 1px 0 rgba(255,255,255,.07); }

.railSlide img.baseCover {
  width: clamp(83px, 10vw, 99px);
  height: auto;
  aspect-ratio: 110 / 78;
  object-fit: cover;
  border-radius: 8px;
  flex: 0 0 auto;
  /* Keep it crisp without heavy shadow (shadows got clipped and looked like an extra layer). */
  border: 1px solid rgba(255,255,255,.14);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08);
}

/* Bases rail: placeholders for sparse months (1 base only).
   We render 2 "empty" slides to keep the rail layout stable (no sudden stretch/flicker). */
.railScroller--bases .railSlide--empty{
  cursor: default;
  user-select: none;
  opacity: .75;
  background: rgba(255,255,255,.035);
  border: 1px dashed rgba(255,255,255,.16);
  box-shadow: none;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 6px;
}
.railScroller--bases .railSlide--empty::before{ content: none !important; }
.railScroller--bases .railSlide--empty:hover,
.railScroller--bases .railSlide--empty:active{ transform: none; border-color: rgba(255,255,255,.18); }
.railScroller--bases .railSlide--empty .emptySlide__icon{ font-size: 18px; line-height: 1; opacity: .9; }
.railScroller--bases .railSlide--empty .emptySlide__title{ font-weight: 700; font-size: 12px; }
.railScroller--bases .railSlide--empty .emptySlide__hint{ font-size: 11px; opacity: .8; }
.railSlide img.promoImage{
  width: 96px;
  height: 60px;
  object-fit: cover;
  border-radius: 8px;
  flex: 0 0 auto;
}

/* Promo slides: full-bleed image with text directly on the image (no "frame"). */
.railScroller--promo .railTrack{ height: 100%; align-items: stretch; }
.railScroller--promo .railSlide--promo{
  height: 100%;
  min-height: 0;
  border-radius: 12px;
  overflow: hidden;
  padding: 0;
  /* Smart frame: boxed by default (black borders ~10-15%).
     Wide banners switch to full-bleed. */
  border: 1px solid rgba(0,0,0,.70);
  background-color: rgba(0,0,0,.78);
  position: relative;
  display: block;
  color: #fff;
  text-decoration: none;
  transition: transform var(--transition-fast), filter var(--transition-fast);
  box-shadow:
    0 10px 24px rgba(0,0,0,.25),
    inset 0 1px 0 rgba(255,255,255,.06);
}
.railScroller--promo .railSlide--promo .promoMedia{
  position:absolute;
  inset:0;
  z-index: 0;
  background: rgba(0,0,0,.78);
  /* Side black borders are overlays (do not affect layout, do not shrink media). */
  --media-frame: 12%;
  display:block;
}
.railScroller--promo .railSlide--promo .promoImg{
  width: 100%;
  height: 100%;
  object-fit: cover;
  display:block;
  position: relative;
  z-index: 0;
  filter: saturate(1.05) contrast(1.03);
}
.railScroller--promo .railSlide--promo.is-wide .promoMedia{ background: rgba(0,0,0,.78); }
.railScroller--promo .railSlide--promo.is-boxed .promoMedia{ background: rgba(0,0,0,.78); }

/* Side borders overlays for boxed promos. */
.railScroller--promo .railSlide--promo.is-boxed .promoMedia::before,
.railScroller--promo .railSlide--promo.is-boxed .promoMedia::after{
  content:"";
  position:absolute;
  top:0; bottom:0;
  width: var(--media-frame);
  z-index: 1;
  pointer-events:none;
}
.railScroller--promo .railSlide--promo.is-boxed .promoMedia::before{
  left:0;
  background: linear-gradient(to right, rgba(0,0,0,.90), rgba(0,0,0,.90) 70%, rgba(0,0,0,0));
}
.railScroller--promo .railSlide--promo.is-boxed .promoMedia::after{
  right:0;
  background: linear-gradient(to left, rgba(0,0,0,.90), rgba(0,0,0,.90) 70%, rgba(0,0,0,0));
}
.railScroller--promo .railSlide--promo::before{
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    linear-gradient(0deg, rgba(0,0,0,.72) 0%, rgba(0,0,0,0) 58%),
    linear-gradient(90deg, rgba(0,0,0,.55) 0%, rgba(0,0,0,.16) 55%, rgba(0,0,0,.42) 100%);
  pointer-events: none;
}
.railScroller--promo .railSlide--promo:hover{ transform: translateY(-1px); filter: brightness(1.06); }
.railScroller--promo .railSlide--promo:active{ transform: translateY(0px) scale(.996); }
.railScroller--promo .railSlide--promo:focus-visible{
  outline: 2px solid rgba(240,140,40,.55);
  outline-offset: 3px;
}

.railScroller--promo .promoOverlay{
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 14px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-shadow: 0 2px 10px rgba(0,0,0,.65);
}
.railScroller--promo .promoTitle{
  font-weight: 900;
  font-size: 14px;
  line-height: 1.2;
  letter-spacing: .2px;
}
.railScroller--promo .promoSub{
  font-size: 12px;
  opacity: .92;
  line-height: 1.25;
  max-width: 42ch;
}
.railScroller--promo .promoHint{
  margin-top: 2px;
  font-size: 12px;
  font-weight: 800;
  opacity: .92;
}

/* Promo placeholder (when there are no promos yet) */
.railSlide--promoEmpty{
  /* Whole promo block reserved for content: no labels/buttons.
     Keep a subtle decorative placeholder so the rail doesn't look broken. */
  display:block;
  width: 100%;
  height: 100%;
  min-height: 0;
  border-radius: 18px;
  border: 1px dashed rgba(255,255,255,.14);
  background:
    radial-gradient(120% 120% at 20% 0%, rgba(240,140,40,.18), rgba(0,0,0,0) 55%),
    radial-gradient(120% 120% at 100% 100%, rgba(120,160,255,.14), rgba(0,0,0,0) 60%),
    rgba(0,0,0,.18);
}
.railSlide--promoEmpty::before{ content: none !important; }
.railSlide--promoEmpty .promoEmpty__icon{
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display:flex;
  align-items:center;
  justify-content:center;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.12);
  font-size: 22px;
  flex: 0 0 auto;
}
.railSlide--promoEmpty .promoEmpty__manage{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(240,140,40,.24);
  background: rgba(0,0,0,.22);
  backdrop-filter: blur(8px);
  color: var(--text900);
  text-decoration: none;
  font-weight: 800;
  font-size: 12px;
  width: fit-content;
}
.railSlide--promoEmpty .promoEmpty__manage:hover{ border-color: rgba(240,140,40,.36); background: rgba(0,0,0,.28); }
.railSlide--promoEmpty .promoEmpty__manage:active{ transform: translateY(1px); }
.railSlide .baseInfo {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.railSlide .baseOwnerRow{
  display:flex;
  align-items:center;
  gap: 8px;
  min-width: 0;
}
.railSlide .baseOwnerAva{
  width: 18px;
  height: 18px;
  border-radius: 999px;
  object-fit: cover;
  flex: 0 0 auto;
  border: 1px solid rgba(255,255,255,.12);
}
.railSlide .baseCounts{
  display:flex;
  align-items:center;
  gap: 10px;
  font-size: 11px;
  opacity: .86;
}
.railSlide .baseCounts .c{
  display:inline-flex;
  align-items:center;
  gap: 4px;
}
.railSlide .baseCounts i{ font-size: 12px; opacity: .9; }
.railSlide .baseOwner {
  font-size: 12px;
  line-height: 1.2;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.railSlide .baseScore {
  font-size: 11px;
  opacity: 0.8;
}
/* Rank badge (header bases rail): single badge layer (avoid nested frames) */
.railScroller--bases .railBadge .rankBadge{
  font-size: 11px;
  font-weight: 1000;
  letter-spacing: .2px;
  background: none;
  border: 0;
  color: rgba(255,255,255,.92);
  padding: 0;
  margin: 0;
}
.railScroller--bases .railSlide[data-rank="1"] .railBadge{ border-color: rgba(var(--top1-rgb), .22); }
.railScroller--bases .railSlide[data-rank="2"] .railBadge{ border-color: rgba(var(--top2-rgb), .18); }
.railScroller--bases .railSlide[data-rank="3"] .railBadge{ border-color: rgba(var(--top3-rgb), .18); }
.railScroller--bases .railSlide[data-rank="1"] .railBadge .rankBadge{ color: rgb(var(--top1-rgb)); }
.railScroller--bases .railSlide[data-rank="2"] .railBadge .rankBadge{ color: rgb(var(--top2-rgb)); }
.railScroller--bases .railSlide[data-rank="3"] .railBadge .rankBadge{ color: rgb(var(--top3-rgb)); }

/* Skeleton: keep it lightweight and avoid bevel pseudo-elements */
.railScroller--bases .railSlide--skeleton{
  background: rgba(255,255,255,.04) !important;
  border-style: dashed !important;
  box-shadow: none !important;
}
.railScroller--bases .railSlide--skeleton::before,
.railScroller--bases .railSlide--skeleton::after{ content: none !important; }

/* Lightweight skeleton placeholders for the bases rail */
.railSlide--skeleton{ background: rgba(255,255,255,.04); border-style: dashed; }
.railSlide--skeleton .sk{ background: rgba(255,255,255,.08); border-radius: 8px; }
.railSlide--skeleton .sk--cover{ width:110px; height:78px; border-radius: 6px; }
.railSlide--skeleton .sk--ava{ width:18px; height:18px; border-radius: 999px; }
.railSlide--skeleton .sk--line{ height: 10px; border-radius: 999px; }
.railSlide--skeleton .sk--pill{ height: 12px; border-radius: 999px; }
.railSlide--skeleton .sk--w80{ width: 80%; }
.railSlide--skeleton .sk--w55{ width: 55%; }
.railSlide--skeleton .sk--w30{ width: 30px; }
.railSlide--skeleton .sk--w25{ width: 25px; }
.railControl {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.4);
  border: none;
  color: #fff;
  padding: 4px 6px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}
.railControl:hover {
  background: rgba(0, 0, 0, 0.6);
}
.railPrev {
  left: 4px;
}
.railNext {
  right: 4px;
}

