:root {
    --story-progress: 50%;
}

.stories {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 33.3%));
    /* Adjust min-width as needed */
    gap: 8px;
}

.story {
    position: relative;
    display: flex;
    align-items: end;
    border-radius: 8px;
    overflow: hidden;
    background-color: #cccccc;
    background-position: center;
    background-size: cover;
    z-index: 0;
    min-height: 100%;
}

.story::after {
    position: absolute;
    content: '';
    display: block;
    width: 100%;
    height: 100%;
    background: linear-gradient(0deg, rgba(0, 0, 0, .75) 0%, rgba(255, 255, 255, 0) 100%);
    z-index: 1;
}

.story-9x16 {
    width: 100%;
    min-height: 555px;
}

.story-9x16--border {
    border-bottom-style: solid;
    border-bottom-width: 4px;
    border-bottom-color: #1382BF;
}

.story-4x3 {
    width: 100%;
    min-height: 260px;
    cursor: pointer;
}

.story-4x3 .story--title {
    font-size: 20px;
    padding: 0px 32px 32px 32px;
}

.story--9x16-separation {
    margin-bottom: 32px;
}

.story--texts {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 0px 32px 32px 32px;
}

.story--title,
.story--lead {
    display: block;
    width: 100%;

    font-family: Roboto;
    font-weight: 900;
    letter-spacing: 0px;
    color: #FFFFFF;

    z-index: 3;
}

.story--title {
    font-size: 40px;
    line-height: 123%;
}

.story--lead {
    font-size: 20px;
    line-height: 153%;
}

.story--icon {
    position: absolute;
    top: 16px;
    right: 16px;
}

.story--lead-animated {
    max-height: 0px;
    overflow: hidden;
    opacity: 0;
    transition: all 0.3s ease-in-out;
}

.story:hover .story--lead-animated {
    max-height: 555px;
    opacity: 1;
}

.story--loadmore {
    width: 100%;
    padding: 9px;
    border: 1px solid #E5E5E5;
    background-color: transparent;
    font-family: Roboto;
    font-weight: 900;
    font-size: 15px;
    line-height: 153%;
    letter-spacing: 0px;
    text-align: center;
    vertical-align: middle;
}

.story-swiper-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    gap: 32px;
    height: 100vh;
    aspect-ratio: 9/16;
    margin-left: auto;
    margin-right: auto;
}

.story-swiper-button-next,
.story-swiper-button-prev {
    cursor: pointer;
}

.story-swiper-button-next.swiper-button-disabled,
.story-swiper-button-prev.swiper-button-disabled {
    cursor: default;
    opacity: 0.5;
}

.story-swiper {
    width: 100%;
    height: 100%;
    aspect-ratio: 9/16;
    object-fit: cover;
}

.story-swiper .swiper-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px 0px 16px;
    gap: 8px;
    width: calc(100% - 32px);
    top: 0;
    bottom: unset;
}

.story-swiper .swiper-pagination-bullet {
    width: 100%;
    margin: 0px !important;
    border-radius: 8px;
    overflow: hidden;
    opacity: 1.0;
    background-color: rgba(255, 255, 255, 0.4);
    box-shadow: 0px 0px 16px rgba(0, 0, 0, .2);
}

.story-swiper .swiper-pagination-bullet.swiper-pagination-bullet-active {
    position: relative;
}

.story-swiper .swiper-pagination-bullet.swiper-pagination-bullet-active::before {
    position: absolute;
    content: '';
    display: block;
    width: var(--story-progress);
    height: 100%;
    background-color: rgba(255, 255, 255, 1);
    border-radius: 8px;
}

.story-swiper .swiper-pagination-bullet.swiper-pagination-bullet-completed {
    position: relative;
}

.story-swiper .swiper-pagination-bullet.swiper-pagination-bullet-completed::before {
    position: absolute;
    content: '';
    display: block;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 1);
    border-radius: 8px;
}

.story-swiper .story {
    border-radius: 16px;
}

.swiper-header {
    position: absolute;
    justify-content: space-between;
    width: calc(100% - 32px);
    z-index: 2;
    display: flex;
    top: calc(32px + 24px);
    left: 16px;
}

.story-swiper-header--buttons {
    display: flex;
    align-items: center;
    gap: 16px;
}

.story-swiper-pause,
.story-swiper-share {
    cursor: pointer;
}

.story-swiper-share > * {
    pointer-events: none;
}

dialog {
    border: none;
    background: transparent;
    margin-top: 0px;
    margin-bottom: 0px;
    animation: fadeIn 0.3s ease-out;
    min-height: 100vh;
    padding: 0px;
    margin: 0px auto;
}

dialog:focus-visible {
    outline: none;
    box-shadow: none;
}

/* Backdrop styling (only works for modal dialogs) */
dialog::backdrop {
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(2px);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.webstories-component {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.webstories-component--title {
    font-family: Roboto;
    font-weight: 400;
    font-size: 24px;
    line-height: 100%;
    letter-spacing: 0px;
    color: #444444;

    border-left: solid 4px #1382BF;
    padding-left: 15px;
}

.webstories-component--controllers {
    display: flex;
    align-items: center;
    gap: 16px;
}

.webstories-component--controllers span {
    font-family: Roboto;
    font-weight: 700;
    font-size: 16px;
    line-height: 100%;
    letter-spacing: 0px;
    vertical-align: middle;
    color: #1382BF;
}

.webstories-component--prev,
.webstories-component--next {
    display: block;
    width: 40px;
    height: 40px;
    cursor: pointer;
}

.webstories-component--prev.swiper-button-disabled,
.webstories-component--next.swiper-button-disabled {
    opacity: 0.5;
    cursor: default;
}

.swiper-slide-template {
    display: none;
}