/*
 * gram-grubo: mobile carousel for post grids + enriched post cards.
 * Loaded only when the "Karuzela wpisów (mobile)" option is on (inc/mobile-carousel.php).
 * Base html font-size is 62.5%, so 1rem = 10px.
 */

/* ---- Card extras (all widths) ------------------------------------------ */

.news__image img {
  display: block;
  width: 100%;
  height: auto;
}

.news__category {
  position: absolute;
  left: 1.2rem;
  bottom: 1.2rem;
  z-index: 2;
  background-color: #ffcf03;
  color: #151515;
  font-size: 1.3rem;
  font-weight: 600;
  line-height: 1;
  padding: 0.6rem 1rem;
  border-radius: 0.6rem;
}

.news__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 1.2rem;
  margin-bottom: 0.8rem;
  font-size: 1.4rem;
  color: #686868;
}

[data-theme="dark"] .news__meta {
  color: var(--color-text, #f4f4f4);
  opacity: 0.75;
}

.news__meta .news__date {
  display: inline;
  margin: 0;
}

.news__author {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 500;
  color: inherit;
}

.news__avatar {
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 50%;
  object-fit: cover;
}

.gg-carousel-progress {
  display: none;
}

/* ---- Carousel (phones only; from 768px the grid has 2+ columns) -------- */

@media (max-width: 767px) {
  .grid.gg-carousel {
    display: flex;
    gap: 1.2rem;
    /* keep the track from widening a 1fr grid parent (container-three-column) */
    contain: inline-size;
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    margin-left: -1.5rem;
    margin-right: -1.5rem;
    padding: 0.2rem 1.5rem 0.4rem;
    scroll-padding-left: 1.5rem;
  }

  .grid.gg-carousel::-webkit-scrollbar {
    display: none;
  }

  .grid.gg-carousel > .news__item {
    flex: 0 0 88%;
    min-width: 0;
    max-width: 40rem;
    scroll-snap-align: start;
    box-shadow: none;
    border-radius: 1.2rem;
  }

  .grid.gg-carousel--rows2 {
    display: grid;
    grid-auto-flow: column;
    grid-template-rows: 1fr 1fr;
    grid-auto-columns: 88%;
    gap: 1.2rem;
  }

  .grid.gg-carousel--rows2 > .news__item {
    max-width: none;
  }

  .grid.gg-carousel .news__info {
    padding: 1.8rem 1.8rem 2.2rem;
  }

  .grid.gg-carousel .news__meta {
    font-size: 1.4rem;
    margin-bottom: 1rem;
  }

  .grid.gg-carousel .news__avatar {
    width: 2.6rem;
    height: 2.6rem;
  }

  .grid.gg-carousel .news__category {
    font-size: 1.4rem;
    padding: 0.7rem 1.2rem;
  }

  .grid.gg-carousel .news__title {
    font-size: 2.1rem;
    line-height: 1.2;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .gg-carousel-progress {
    display: block;
    width: min(50%, 16rem);
    height: 0.4rem;
    margin: 1.4rem auto 0;
    border-radius: 0.4rem;
    background-color: #ebebeb;
    overflow: hidden;
  }

  [data-theme="dark"] .gg-carousel-progress {
    background-color: var(--color-surface-strong, #262626);
  }

  .gg-carousel-progress__bar {
    height: 100%;
    width: 30%;
    border-radius: inherit;
    background-color: #ffcf03;
    transform: translateX(0);
    transition: transform 0.12s linear;
  }
}

@media (prefers-reduced-motion: reduce) {
  .gg-carousel-progress__bar {
    transition: none;
  }
}
