body {
  background-color: black;
}

ul.background_controls {
  list-style-type: none;
  margin: 0 auto;
  padding: 20px 0;
  display: flex;
  gap: 5px;
  justify-content: space-around;
  max-width: 25vw;
}

ul.background_controls li:first-of-type, ul.background_controls li:last-of-type {
  background: #01b3fe;
  height: 50px;
  width: 50px;
  border-radius: 50%;
  fill: white;
}
ul.background_controls li:not(first-of-type), ul.background_controls li:not(last-of-type) {
  width: 15%;
  height: 30px;
  background: #01b3fe;
  align-self: center;
}
ul.background_controls li svg { pointer-events: none; }
ul.background_controls li { border: 5px solid transparent; cursor: pointer; }
ul.background_controls li:hover { border: 5px solid white; }
ul.background_controls li.active { background: white; }


ul.background_controls:has(+ main.marketplace) {
  margin-top: 20%;
}

ul.background_controls + main.marketplace {
  margin-top: 0;
}

main,
aside {
  display: block;
  backdrop-filter: blur(50px);
  border: 5px solid #949394;
  background-color: #46464691;
  border: 5px solid #949394;
  width: 60vw;
  margin: 0 auto;
  padding: 0 1rem;
  color: white;
  font-size: 150%;
  line-height: 2rem;
  scroll-margin-top: 4em;
}

aside:not(.sponsor_pimax) {
  margin: 10% auto 1rem;
  border-color: #FFD300B5;
}

aside p {
  text-align: center;
  padding: 0.5rem;
}

main + main,
aside.sponsor_pimax + main,
aside.sponsor_pimax,
script + main:last-of-type {
  margin-top: 1rem;
  padding: 1rem;
}

main:last-of-type {
  margin-bottom: 5rem;
}

.marketplace svg {
  max-width: 30px;
  fill: currentColor;
}

h1, h2 {
  text-transform: uppercase;
  margin: 1rem 0 0 0;
  padding: 0;
}

h2 {
  font-size: 1.8rem;
}

hr {
  border-top: 2px solid #949394;
}

a[href="#changelog"] { color: white; }

.marketplace_details {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 1rem;
}

.marketplace_details a:any-link { color: white; }

.marketplace_tag {
  display: inline-block;
  font-size: 1.2rem;
  background: gray;
  border: 1px solid lightgray;
  margin: 1rem 5px 0 0;
  padding: 5px;
  vertical-align: text-bottom;
}

.marketplace_details .price_store {
  margin-top: 1rem;
}

.marketplace_details .price_date {
  font-size: 85%;
}

.marketplace_details .details_price {
  font-size: 130%;
}

.marketplace_details > ul {
  list-style-type: none;
  margin: 1rem 0 0 0;
  padding: 0;
}

.marketplace_details ul:not(.details_price) > li:not(.price_store, .price_date) {
  margin: 1rem 0 0 0;
  padding: 0;
}

.marketplace_details .price_fsac {
  text-align: center;
  margin: 10px 1rem 10px 0;
  font-size: 85%;
}
.marketplace_details .price_fsac a:any-link {
  color: white;
  text-decoration-color: var(--yellow);
}

.marketplace_ratings {
  margin-top: 1rem;
}

.marketplace_ratings button {
  background: #01b3fe;
  border: 5px solid transparent;
  color: white;
  text-transform: uppercase;
  padding: 5px 10px;
  margin-left: 1rem;
  position: relative;
  font-size: inherit;
  font-family: inherit;
}

.marketplace_ratings button:hover,
.scroller_button:hover {
  border: 5px solid white;
  cursor: pointer;
}

.marketplace_ratings button:hover .marketplace_ratings_detail,
.marketplace_ratings_detail-helper:hover .marketplace_ratings_detail {
  display: block;
}

.marketplace_ratings_detail:after {
  position: absolute;
  content: '';
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 30px 50px 0 50px;
  border-color: #fff transparent transparent transparent;
  left: 150px;
}

.marketplace_ratings_detail-helper {
  width: 100%;
  height: 50px;
  position: absolute;
  left: 0;
  bottom: -50;
}

.marketplace_ratings_detail {
  display: none;
  width: 400px;
  padding: .5rem 1rem;
  background: white;
  color: black;
  position: absolute;
  left: -50%;
  bottom: 80px;
  text-align: left;
  z-index: 1;
}

.marketplace_ratings_detail svg { max-width: 20px; }

.marketplace_ratings_detail h1 {
  font-size: 2rem;
  font-weight: 300;
  padding-bottom: 1rem;
  border-bottom: 2px solid grey;
}

.marketplace_ratings_detail p {
  fill: black;
  font-size: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid grey;
}

.marketplace_ratings_detail p span {
  font-size: 2rem
}

.marketplace_ratings_detail ul {
  list-style: none;
  padding: 0;
  padding-left: 25px;
}

.marketplace_ratings_detail li {
  position: relative;
  margin-bottom: 0.5rem;
  display: flex;
  gap: 10px;
  font-variant-numeric: tabular-nums;
}
.marketplace_ratings_detail li:before {
  position: absolute;
  content: '';
  width: 20px;
  height: 20px;
  top: 20%;
  left: -25px;
  background-image: url(/assets/icons/star.svg);
  background-repeat: no-repeat;
}

progress::-moz-progress-bar,
progress::-webkit-progress-bar {
  background: black;
}
progress {
  background: #d3d3d3;
  fill: #000;
  border: 0;
  width: 230px;
}

.marketplace_description p { margin-top: 1rem; }
.marketplace_description ul { list-style-type: '- ' }

.sponsor_pimax img {
  width: 100%;
}

.sponsor_pimax a { color: inherit; }

.marketplace_specs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}

.marketplace_specs table { border-spacing: 0; }
.marketplace_specs td { padding: .5rem; }

.marketplace_specs tr td:last-of-type {
  text-align: right;
}

.md ul {
  list-style-type: disc;
}

.md a {
  color: white;
}

.marketplace_scroller {
  overflow-x: scroll;
  white-space: nowrap;
  scrollbar-color: var(--blue) white;
}

.marketplace_scroller::-webkit-scrollbar {
  width: 8px;
  height: 8px;
  background-color: white;
}

.marketplace_scroller::-webkit-scrollbar-thumb {
  background: var(--blue);
}

.marketplace_scroller figure {
  cursor: grab;
  display: inline;
  position: relative;
  margin: 0 1rem 0 0;
}

.marketplace_scroller.scroller_primary {
  position: relative;
}

main .scroller_button {
  position: absolute;
  z-index: 1;
  width: 50px;
  height: 50px;
  top: 50%;
  background: var(--blue);
  border-radius: 50%;
  border: 5px solid transparent;
  vertical-align: middle;
  fill: white;
}

main .scroller_button[data-btn="prev"] { left: 2rem; }

main .scroller_button[data-btn="next"] { right: 2rem; }

.marketplace_scroller.scroller_primary img {
  width: 100%;
  scroll-snap-align: center;
}

.marketplace_scroller:not(.scroller_primary) figure img {
  max-width: 600px;
}

.marketplace_scroller figure span {
  display: block;
  position: absolute;
  bottom: 20px;
  right: 15px;
  width: 100px;
  height: 100px;
  background: white;
}

.marketplace_scroller figure span:before {
  content: '';
  position: absolute;
  bottom: 4px;
  left: 4px;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 88px 0 0 88px;
  border-color: transparent transparent transparent var(--liveryPrimary);
}

.marketplace_scroller figure span:after {
  content: '';
  position: absolute;
  top: 4px;
  right: 4px;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 0 88px 88px 0;
  border-color: transparent var(--liverySecondary) transparent transparent;
}

.detail_map {
  min-height: 60vh;
}

/* TODO: minmax or clamp this instead */
@media screen and (max-width: 2500px) {
  .catalog_details nav,
  main, aside { width: 75vw; }
}

@media screen and (max-width: 1600px) {
  ul.background_controls { max-width: 90vw; }
  .catalog_details nav,
  main, aside { width: 95vw; }
  .md ul { padding-inline-start: 1rem; }
}

@media screen and (max-width: 700px) {
  .marketplace_ratings button {
    width: 100%;
    margin: 1rem auto 0;
  }

  .marketplace_ratings .marketplace_ratings_detail {
    left: -10%;
    width: 100vw;
  }

  .marketplace_details,
  .marketplace_specs {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .marketplace_scroller figure img {
    max-width: 100%;
  }
    
  .marketplace_scroller:not(.scroller_primary) figure img {
    max-width: 80%;
  }

  .marketplace_scroller.scroller_liveries figure img {
    max-width: 52%;
  }

  .marketplace_scroller figure span {
    bottom: 10px;
    right: 5px;
    width: 50px;
    height: 50px;
  }
  
  .marketplace_scroller figure span:before {
    bottom: 2px;
    left: 2px;
    border-width: 44px 0 0 44px;
  }
  
  .marketplace_scroller figure span:after {
    top: 2px;
    right: 2px;
    border-width: 0 44px 44px 0;
  }

  .marketplace_specs table:first-of-type tr:nth-child(odd),
  .marketplace_specs table:last-of-type tr:nth-child(even) { background: #646464; }

  ul.background_controls li:first-of-type, ul.background_controls li:last-of-type {
    width: 35px;
    height: 35px;
  }
  ul.background_controls { gap: 10px; margin-top: 80%; }
}

@media screen and (max-width: 500px) {
  ul.background_controls { margin-top: 80%; }
}