/* Scroll rail ---------------------------------------------------- */

.rail-wrap {
  position: relative;
}

/* Arrows float over the rail edges, like the reference mockup */

.rail-btn {
  position: absolute;
  top: 50%;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 50%;
  background: rgba(8, 6, 12, 0.75);
  color: #fff;
  cursor: pointer;
  transform: translateY(-50%);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  transition:
    background 0.18s ease,
    border-color 0.18s ease,
    opacity 0.18s ease;
}

.rail-btn[data-dir="prev"] {
  left: -8px;
}

.rail-btn[data-dir="next"] {
  right: -8px;
}

.rail-btn svg {
  width: 13px;
  height: 13px;
  fill: currentColor;
}

.rail-btn:hover:not(:disabled),
.rail-btn:focus-visible:not(:disabled) {
  border-color: #e9720a;
  background: #e9720a;
}

.rail-btn:disabled {
  opacity: 0;
  pointer-events: none;
}

.rail-btn:focus-visible {
  outline: 2px solid #e9720a;
  outline-offset: 3px;
}

.rail {
  display: flex;
  gap: 0.9rem;
  padding: 0.2rem 0 0.75rem;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x proximity;
  /* no visible scrollbar — arrows, drag, trackpad and touch still scroll */
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.rail::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

.rail.is-dragging,
.rail.is-dragging * {
  cursor: grabbing;
  -webkit-user-select: none;
  user-select: none;
}

.rail.is-dragging .card {
  pointer-events: none;
}

.rail:focus-visible {
  outline: 2px solid #e9720a;
  outline-offset: 4px;
}

/* Cards ---------------------------------------------------------- */

.card {
  position: relative;
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  background: #0b0b10;
  color: #fff;
  text-decoration: none;
  scroll-snap-align: start;
  transition:
    transform 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease;
}

.card:hover,
.card:focus-within {
  color: #fff;
  text-decoration: none;
  transform: translateY(-3px);
  border-color: var(--accent, #e9720a);
  /* inset ring: the rail clips its overflow, so an outside ring would be cut
     off on the first/last card now that the rail has no side padding */
  box-shadow:
    inset 0 0 0 1px var(--accent, #e9720a),
    0 16px 30px rgba(0, 0, 0, 0.55);
}

.card-media {
  position: relative;
  display: block;
  width: 100%;
  overflow: hidden;
  background: #14141a;
}

.card-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--art-pos, center);
  /* a mouse drag on the rail must not start a native image drag */
  -webkit-user-drag: none;
  user-select: none;
}

.card-media iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

.card-caption {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  margin-top: auto;
  padding: 0.5rem 0.7rem 0.6rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(5, 5, 8, 0.96);
}

.card-title {
  display: -webkit-box;
  overflow: hidden;
  /* Bootstrap's stylesheet also defines .card-title with a .75rem bottom
     margin — reset it so caption spacing stays ours */
  margin: 0;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  color: #fff;
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1.3;
}

a.card-title {
  text-decoration: none;
}

a.card-title:hover,
a.card-title:focus-visible {
  color: #fff;
  text-decoration: none;
}

.card-sub {
  color: rgba(255, 255, 255, 0.66);
  font-size: 0.69rem;
  font-weight: 300;
  line-height: 1.35;
}

/* Supported games ------------------------------------------------- */

.rail--games .card {
  width: clamp(148px, 13.5vw, 184px);
}

/* Art keeps a fixed 1:1 height on every card */
.rail--games .card-media {
  flex: 0 0 auto;
  aspect-ratio: 1 / 1;
}

/* Caption reserves two title rows so one- and two-line names align */
.rail--games .card-title {
  /* 2 lines at line-height 1.3 */
  min-height: 2.6em;
  font-size: 0.9rem;
}

/* "and more" tile — height comes from the stretched rail row */
.card--more {
  width: clamp(148px, 13.5vw, 184px);
  align-items: center;
  justify-content: center;
  border-style: dashed;
  border-color: rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.03);
  text-align: center;
}

.card--more:hover,
.card--more:focus {
  border-color: #e9720a;
  background: rgba(233, 114, 10, 0.1);
  box-shadow: 0 0 0 1px #e9720a, 0 16px 30px rgba(0, 0, 0, 0.45);
}

.card-more-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  padding: 1rem 0.7rem;
}

.card-more-plus {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 50%;
  color: #fff;
  font-size: 1.05rem;
  line-height: 1;
}

.card-more-title {
  color: #fff;
  font-size: 0.86rem;
  font-weight: 700;
}

.card-more-sub {
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.68rem;
  font-weight: 300;
  line-height: 1.35;
}

/* Featured projects -----------------------------------------------
   Portfolio-style cards: the thumbnail is a preview inset inside the card,
   not the top half of it. Smaller, lighter, tighter metadata — deliberately
   different from the full-bleed Supported games covers. */

.rail--projects {
  gap: 14px;
  /* extra room for the hover lift and its shadow */
  padding-top: 0.35rem;
  padding-bottom: 1.2rem;
}

.rail--projects .card {
  width: clamp(196px, 15.5vw, 210px);
  padding: 8px;
  border-radius: 12px;
  border-color: rgba(255, 255, 255, 0.12);
  /* black card surface (inherited from .card) */
}

/* Inset, rounded 16:9 preview on a subtle dark backdrop */
.rail--projects .card-media {
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  background: #14141a;
}

/* Compact caption: no separate bar, text aligned with the thumbnail edge */
.rail--projects .card-caption {
  gap: 0.12rem;
  padding: 0.45rem 0 0;
  border-top: 0;
  background: transparent;
}

.rail--projects .card-title {
  margin: 0;
  -webkit-line-clamp: 2;
  /* two title rows on every card so the authors line up */
  min-height: 2.6em;
  /* Rubik Light — the loaded weights are only 300/400/700, so the title
     stays quiet and hierarchy comes from size and colour */
  font-weight: 300;
  font-size: 0.8rem;
  line-height: 1.3;
}

.rail--projects .card-sub {
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.66rem;
}

/* Lite YouTube facade (thumbnail that swaps for the player on click) */

.card-media .yt-facade {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  border-radius: inherit;
  background: #000;
  cursor: pointer;
}

.card-media .yt-thumb {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-media .yt-play {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 2;
  display: block;
  width: 52px;
  height: 36px;
  border-radius: 9px;
  background: rgba(8, 8, 12, 0.9);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
  transform: translate(-50%, -50%);
  transition: background 0.18s ease;
}

.card-media .yt-play::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  border-style: solid;
  border-width: 9px 0 9px 15px;
  border-color: transparent transparent transparent #fff;
  transform: translate(-50%, -50%);
}

.card-media .yt-facade:hover .yt-play,
.card-media .yt-facade:focus-visible .yt-play {
  background: #e9720a;
}

.card-media .yt-facade:focus-visible {
  outline: 2px solid #e9720a;
  outline-offset: -2px;
}

@media (max-width: 575.98px) {
  .rail {
    gap: 0.65rem;
  }

  .rail--projects .card {
    width: min(72vw, 210px);
  }

  /* swipe instead of arrows */
  .rail-btn {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .card,
  .rail-btn,
  .card-media .yt-play {
    transition: none;
  }

  .card:hover,
  .card:focus-within {
    transform: none;
  }
}
