/* The device rail: one full-bleed glass band holding a single scrolling row of
   device tiles. rail.js drives the scroll and draws the grip. */

.cerf-rail {
  position: relative;
  width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-top: 1.4rem;
  margin-bottom: 2.4rem;
  padding: 1.1rem 0 1.5rem;
  background: var(--cerf-glass-bg);
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
  border-top: 1px solid var(--cerf-glass-border);
  border-bottom: 1px solid var(--cerf-glass-border);
  box-shadow: var(--cerf-glass-shadow);
}

.cerf-rail-track {
  display: flex;
  gap: 1rem;
  padding: 0 0.8rem;
  overflow-x: auto;
  overscroll-behavior-x: contain;
}

/* Without a pointer the row keeps the platform scrollbar; rail.js takes it over
   only once it can draw the grip in its place. */
.cerf-rail--js .cerf-rail-track {
  scrollbar-width: none;
  -ms-overflow-style: none;
  user-select: none;
}

.cerf-rail--js .cerf-rail-track::-webkit-scrollbar {
  display: none;
}

.cerf-rail--drag .cerf-rail-track {
  cursor: grabbing;
}

.md-typeset .cerf-rail .cerf-device {
  flex: 0 0 auto;
  width: 18.5rem;
  margin: 0;
  transition: transform 0.3s var(--cerf-ease);
}

.md-typeset .cerf-rail .cerf-device--wide {
  width: 28rem;
}

.md-typeset .cerf-rail .cerf-device:hover {
  transform: translateY(-4px);
}

/* Guest aspect ratios run from 640x240 to 240x320, so the shot is fitted into a
   fixed box: the row height stays the same whatever the tile shows. */
.md-typeset .cerf-rail .cerf-device img {
  display: block;
  width: 100%;
  height: 12.5rem;
  object-fit: contain;
  background: var(--cerf-media-bg);
  border-radius: 12px;
}

.md-typeset .cerf-rail .cerf-device figcaption {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  margin: 0;
  padding: 0.55rem 0.2rem 0;
  text-align: left;
  font-size: 0.68rem;
  font-style: normal;   /* Material italicises figcaption by default */
  line-height: 1.3;
}

.md-typeset .cerf-rail .cerf-device figcaption b {
  font-size: 0.76rem;
  font-weight: 700;
}

.md-typeset .cerf-rail .cerf-device figcaption span {
  opacity: 0.45;
}

/* The tile that ends the row and carries the reader to the full list. */
.md-typeset .cerf-rail-all {
  flex: 0 0 auto;
  width: 10rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  border: 1px dashed var(--cerf-glass-border-strong);
  border-radius: 12px;
  color: var(--cerf-text);
  text-align: center;
  line-height: 1.3;
  transition: transform 0.3s var(--cerf-ease), background 0.3s ease;
}

.md-typeset .cerf-rail-all:hover {
  transform: translateY(-4px);
  background: var(--cerf-glass-bg-hover);
}

.md-typeset .cerf-rail-all b {
  font-size: 0.82rem;
  font-weight: 700;
}

.md-typeset .cerf-rail-all span {
  font-size: 0.68rem;
  opacity: 0.45;
}

.md-typeset .cerf-rail-all .cerf-rail-all-mark {
  font-size: 1.5rem;
  line-height: 1;
  opacity: 0.4;
}

/* Grip: the row's own scrollbar, over the content along the bottom edge. */
.cerf-rail-bar {
  position: absolute;
  left: 0.8rem;
  right: 0.8rem;
  bottom: 0.45rem;
  height: 4px;
  border-radius: 2px;
  background: var(--cerf-hairline);
}

.cerf-rail-bar[hidden] {
  display: none;
}

.cerf-rail-grip {
  position: absolute;
  top: -3px;
  left: 0;
  height: 10px;
  border-radius: 5px;
  background: var(--cerf-secondary);
  opacity: 0.55;
  cursor: grab;
  touch-action: none;
  transition: opacity 0.2s ease;
}

.cerf-rail-grip:hover,
.cerf-rail--gripping .cerf-rail-grip {
  opacity: 0.9;
}

.cerf-rail--gripping .cerf-rail-grip {
  cursor: grabbing;
}

@media (max-width: 768px) {
  .cerf-rail {
    padding: 0.9rem 0 1.3rem;
  }

  .md-typeset .cerf-rail .cerf-device {
    width: 15rem;
  }

  .md-typeset .cerf-rail .cerf-device--wide {
    width: 22rem;
  }

  .md-typeset .cerf-rail .cerf-device img {
    height: 10rem;
  }

  .md-typeset .cerf-rail-all {
    width: 8rem;
  }
}
