/* =========================================================
   TrackCycling.org long-read article layout
   Article + Velodrome.Shop product rail + Related Reading
   ========================================================= */

.tcn-article-page{
  display: grid;
  grid-template-columns: minmax(0, 1fr) 285px;
  grid-template-areas:
    "article products"
    "related related";
  column-gap: 54px;
  row-gap: 44px;
  align-items: start;
}

.tcn-main-article{
  grid-area: article;
  min-width: 0;
}

.tcn-product-rail{
  grid-area: products;
  min-width: 0;
}

.tcn-related{
  grid-area: related;
}
/* ---------------------------------------------------------
   VELODROME.SHOP PRODUCT RAIL
   --------------------------------------------------------- */

.tcn-product-rail{
  grid-area: products;
  min-width: 0;
}


.tcn-product-rail-inner{
  position: static;
}


.vs-rail-heading{
  margin-bottom: 14px;
}


.vs-rail-heading h2{
  margin: 0 0 5px;

  font-family: var(--serif);

  font-size: 19px;
  line-height: 1.12;

  color: #111;
}


.vs-rail-heading h2 a{
  color: inherit;
  text-decoration: none;
}


.vs-rail-heading h2 a:hover{
  text-decoration: underline;
}


.vs-rail-heading p{
  margin: 0;

  color: #555;

  font-size: 12.5px;
  line-height: 1.45;
}



/* ---------------------------------------------------------
   SIDEBAR PRODUCT CARDS
   --------------------------------------------------------- */

.vs-products-sidebar{
  display: flex;
  flex-direction: column;

  gap: 14px;
}


.vs-products-sidebar .card{
  width: 100%;

  margin: 0;
  padding: 0;

  background: transparent;

  border: 1px solid #ddd;
  border-radius: 8px;

  box-shadow: none;

  overflow: hidden;
}


.vs-products-sidebar .card:hover{
  background: transparent;
  border-color: #bbb;
}


.vs-products-sidebar .card-link{
  display: block;
  height: 100%;

  color: inherit;

  text-decoration: none;
}


.vs-products-sidebar .card-media{
  margin: 0;

  padding: 9px 10px 2px;

  background: #fff;
}

.vs-products-sidebar .card-media img{
  display: block;

  width: 100%;
  height: 120px;

  object-fit: contain;

  background: #fff;
}

.vs-products-sidebar .card-media img{
  display: block;

  width: 100%;
  height: 120px;

  object-fit: contain;
}


.vs-products-sidebar .card-body{
  padding: 7px 12px 13px;
}


.vs-products-sidebar .card-title{
  margin: 0 0 6px;

  font-size: 15px;
  line-height: 1.18;
}


.vs-products-sidebar .card-excerpt{
  margin: 0;

  color: #333;

  font-size: 12.5px;
  line-height: 1.45;

  display: -webkit-box;

  -webkit-box-orient: vertical;

  -webkit-line-clamp: 2;
  line-clamp: 2;

  overflow: hidden;
}



/* ---------------------------------------------------------
   STICKY SIDEBAR
   Only when the viewport is tall enough for it to work
   naturally without an internal scrollbar.
   --------------------------------------------------------- */

@media (min-width: 1051px) and (min-height: 820px){

  .tcn-product-rail-inner{
    position: sticky;
    top: 82px;
  }

}

/* Related Reading */
.tcn-related{
  margin: 2px 0 12px;
}

.tcn-related[hidden]{
  display: none;
}

.tcn-related-rule{
  position: relative;
  height: 4px;
  margin-bottom: 12px;
  background: #222;
}

.tcn-related-rule::before{
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 64px;
  height: 4px;
  background: var(--red);
}

.tcn-related-header{
  display: flex;
  align-items: baseline;
  gap: 20px;
  margin-bottom: 18px;
}

.tcn-related-header h2{
  margin: 0;
  flex: 0 0 auto;
  font-family: var(--serif);
  font-size: 28px;
  line-height: 1.08;
  letter-spacing: -0.2px;
  color: #111;
}

.tcn-related-header p{
  margin: 0;
  color: #555;
  font-size: 13px;
  line-height: 1.5;
}

.tcn-related-grid{
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.tcn-related-card{
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 270px;
  padding: 22px 22px 20px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 3px 10px rgba(0,0,0,0.025);
}

.tcn-related-card:hover{
  background: #fafafa;
  border-color: #d6d6d6;
}

.tcn-related-section{
  margin: 0 0 7px;
  color: var(--red);
  font-size: 12px;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: 0.035em;
  text-transform: uppercase;
}

.tcn-related-section a{
  color: inherit;
  text-decoration: none;
}

.tcn-related-section a:hover{
  text-decoration: underline;
}

.tcn-related-card h3{
  margin: 0 0 10px;
  font-family: var(--serif);
  font-size: 22px;
  line-height: 1.08;
  letter-spacing: -0.1px;
}

.tcn-related-card h3 a{
  color: #111;
  text-decoration: none;
}

.tcn-related-card h3 a:hover{
  text-decoration: underline;
}

.tcn-related-standfirst{
  margin: 0 0 14px;
  color: #333;
  font-size: 14.5px;
  line-height: 1.55;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  line-clamp: 4;
  overflow: hidden;
}

.tcn-related-read{
  display: inline-block;
  margin-top: auto;
  padding-top: 12px;
  color: #111;
  font-size: 13px;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Tablet: Article -> Related Reading -> 2 x 2 products */
@media (max-width: 1050px){
  .tcn-article-page{
    grid-template-columns: 1fr;
    grid-template-areas:
      "article"
      "related"
      "products";
    row-gap: 36px;
  }

  .tcn-product-rail-inner{
    position: static;
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }

  .vs-rail-heading{
    margin-bottom: 16px;
  }

  .vs-rail-heading h2{
    font-size: 22px;
  }

  .vs-products-sidebar{
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
  }

  .vs-products-sidebar .card-media img{
    height: 190px;
  }

  .vs-products-sidebar .card-title{
    font-size: 16px;
  }

  .vs-products-sidebar .card-excerpt{
    font-size: 13px;
    -webkit-line-clamp: 4;
    line-clamp: 4;
  }

  .tcn-related-grid{
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Phone: Article -> Related Reading -> swipeable products */
@media (max-width: 620px){
  .tcn-article-page{
    row-gap: 32px;
  }

  .tcn-related{
    margin: 0;
  }

  .tcn-related-header{
    display: block;
  }

  .tcn-related-header h2{
    margin-bottom: 6px;
    font-size: 25px;
  }

  .tcn-related-grid{
    grid-template-columns: 1fr;
  }

  .tcn-related-card{
    min-height: auto;
    padding: 18px;
  }

  .vs-rail-heading{
    margin-bottom: 12px;
  }

  .vs-rail-heading h2{
    font-size: 21px;
  }

  .vs-products-sidebar{
    display: grid;
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: 82%;
    gap: 14px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    overscroll-behavior-inline: contain;
    padding: 0 1px 10px;
    -webkit-overflow-scrolling: touch;
  }

  .vs-products-sidebar .card{
    scroll-snap-align: start;
  }

  .vs-products-sidebar .card-media img{
    height: 170px;
  }

  .vs-products-sidebar .card-excerpt{
    -webkit-line-clamp: 3;
    line-clamp: 3;
  }
}
