.index-page > .carousel-header:first-child h2 {
    margin-top: 0;
}

.carousel-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.carousel-scroll-button {
    padding: 0;
    width: var(--button-size);
    height: var(--button-size);
}

body.mobile .carousel-scroll-button {
    display: none;
}

.carousel-scroll-button svg {
    width: 16px;
    height: 16px;
}

.title-carousel {
    display: flex;
    flex-direction: row;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    grid-template-columns: none;
    gap: var(--spacing-md);
    margin: var(--spacing-md) calc(-1 * var(--spacing-lg)); /* Ignore the body's padding on the sides */
    padding: 0 var(--spacing-lg); /* Add padding to the sides so the end of the carousel looks affected by the body's padding */
}

body:not(.mobile) .title-carousel {
    scroll-snap-type: x mandatory;
    scroll-padding-inline: var(--spacing-lg); /* Snap stops line up with the body-padding edge, not the content box edge */
}

body.mobile .title-carousel {
    gap: var(--spacing-lg);
}

.title-carousel::-webkit-scrollbar {
    display: none;
}

.title-grid { /* For the search results page */
    display: grid;
    grid-template-columns: repeat(auto-fit, var(--title-card-width));
    gap: var(--spacing-md);
    justify-content: start;
}

body.mobile .title-grid {
    /* Have only 2 columns on mobile */
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--spacing-lg);
}

.title-card {
    width: var(--title-card-width);
    flex: 0 0 auto;
    scroll-snap-align: start;
}

body.mobile .title-grid .title-card {
    width: 100%;
}

body.mobile .title-card {
    margin-bottom: var(--spacing-lg);
}

.title-card-clickable {
    text-decoration: none;
    color: var(--color-text);
    display: flex;
    flex-direction: column;
}

.title-card-poster-wrap {
    width: var(--title-card-width);
    border-radius: var(--radius-sm);
    aspect-ratio: 2 / 3;
    background-color: var(--color-button-light);
    position: relative; /* Anchor for the outline */
    overflow: hidden;
    box-shadow: 0 0 0px rgba(0, 0, 0, 0.0);
    transition: box-shadow var(--transition-medium) ease, background-color var(--transition-medium) ease;
}

body.mobile .title-grid .title-card-poster-wrap {
    width: 100%;
}

/*
body.desktop .title-card-clickable:hover .title-card-poster-wrap {
    box-shadow: 0 0 16px rgba(0, 0, 0, 1.0);
    background-color: var(--color-button-light-hover);
}

body.desktop .title-card-clickable:active .title-card-poster-wrap {
    background-color: var(--color-button-light-active);
}
*/

.title-card-clickable img {
    width: 100%;
    height: 100%;
    aspect-ratio: 2 / 3;
    object-fit: cover;
    display: block;
    -webkit-user-drag: none;
    -khtml-user-drag: none;
    -moz-user-drag: none;
    -o-user-drag: none;
    transition: filter var(--transition-medium) ease, transform var(--transition-medium) ease;
}

body.desktop .title-card-clickable:hover img {
    transform: scale(1.02);
}

body.desktop .title-card-clickable:active img {
    filter: brightness(0.8);
}

.title-card-name {
    margin-top: var(--spacing-sm);
    font-size: var(--font-size-md);
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.title-card-subtitle {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: var(--spacing-xs);
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    margin-top: var(--spacing-xs);
    white-space: nowrap;
    overflow: hidden;
}

.title-card-subtitle > div:nth-child(even) {
    user-select: none; /* Make bullets unselectable */
}

.continue-watching-carousel {
    display: flex;
    flex-direction: row;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: var(--spacing-lg); /* Snap stops line up with the body-padding edge, not the content box edge */
    grid-template-columns: none;
    gap: var(--spacing-md);
    margin: var(--spacing-md) calc(-1 * var(--spacing-lg)); /* Ignore the body's padding on the sides */
    padding: 0 var(--spacing-lg); /* Add padding to the sides so the end of the carousel looks affected by the body's padding */
}

body.mobile .continue-watching-carousel {
    gap: var(--spacing-lg);
}

.continue-watching-carousel::-webkit-scrollbar {
    display: none;
}

.continue-watching-card {
    width: var(--continue-watching-card-width);
    flex: 0 0 auto;
    scroll-snap-align: start;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background-color: var(--color-topbar);
}

.continue-watching-card-image {
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    display: block;
}

.continue-watching-card-image img {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    display: block;
    -webkit-user-drag: none;
    -khtml-user-drag: none;
    -moz-user-drag: none;
    -o-user-drag: none;
    transition: filter var(--transition-medium) ease, transform var(--transition-medium) ease;
}

body.desktop .continue-watching-card-image:hover img {
    transform: scale(1.02);
}

body.desktop .continue-watching-card-image:active img {
    filter: brightness(0.8);
}

.continue-watching-card-progress {
    width: 100%;
    height: var(--spacing-xs);
    background-color: var(--color-button-light);
}

.continue-watching-card-progress-bar {
    height: 100%;
    background-color: var(--color-video-progress);
    transition: width var(--transition-medium) ease;
}

.continue-watching-card-content {
    display: flex;
    flex-direction: column;
    padding: var(--spacing-md);
    gap: var(--spacing-sm);
}

.continue-watching-card-name {
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
}

.continue-watching-card-content * {
    margin: 0;
}

.continue-watching-card-play {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.continue-watching-card-play-button {
    display: flex;
    align-items: center;
    justify-content: center;
    height: var(--button-size);
    width: var(--button-size);
    background: var(--color-button-light-focus);
    border-radius: 50%;
    transition: background var(--transition-medium) ease;
}

.continue-watching-card-play-button:active {
    background: var(--color-button-light-focus-active);
}

.continue-watching-card-play-button svg {
    height: 16px;
    width: 16px;
    color: var(--color-text-primary-dark);
}