.raw-files-modal {
    --raw-files-visible-items: 3;
    position: fixed;
    z-index: 100100;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgb(29 29 29 / 48%);
}

.raw-files-modal[aria-hidden='true'] {
    display: none;
}

.raw-files-modal__card {
    position: relative;
    display: flex;
    flex-direction: column;
    width: min(692px, 100%);
    max-height: calc(100dvh - 32px);
    overflow: hidden;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 1px 2px rgb(29 29 29 / 24%), 0 4px 8px 2px rgb(29 29 29 / 16%);
}

.raw-files-modal__card.is-transitioning {
    overflow: hidden;
}

.raw-files-modal__body {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    overflow: hidden;
}

.raw-files-modal__card.is-transitioning .raw-files-modal__body,
.raw-files-modal__card.is-detail-view .raw-files-modal__body {
    overflow: hidden;
}

.raw-files-modal__view {
    display: flex;
    box-sizing: border-box;
    min-height: 0;
    max-height: calc(100dvh - 32px);
    flex-direction: column;
    padding: 32px 32px 0;
}

.raw-files-modal__view[hidden] {
    display: none;
}

.raw-files-modal__view.is-transition-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
}

.raw-files-modal__view > * {
    transition: opacity 160ms ease;
}

.raw-files-modal__view.is-transitioning-in > *,
.raw-files-modal__view.is-transitioning-out > * {
    opacity: 0;
    pointer-events: none;
}

.raw-files-modal__transition-media {
    position: fixed;
    z-index: 100102;
    display: block;
    margin: 0;
    object-fit: cover;
    pointer-events: none;
    transform-origin: top left;
    will-change: transform, opacity, border-radius;
    background: #ededed;
}

.raw-files-modal__item.is-transition-target .raw-files-modal__thumbnail {
    visibility: hidden;
}

.raw-files-modal__header {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: space-between;
    min-height: 40px;
    margin-bottom: 24px;
}

.raw-files-modal__view:not(.raw-files-modal__detail) > .raw-files-modal__header {
    margin-bottom: 24px;
}

.raw-files-modal__title,
.raw-files-modal__detail-title {
    margin: 0;
    color: #1d1d1d;
    font-size: 36px;
    font-weight: 500;
    line-height: 40px;
    letter-spacing: -0.16px;
}

.raw-files-modal__icon-button,
.raw-files-modal__download-icon,
.raw-files-modal__item-main,
.raw-files-modal__download-button {
    border: 0;
    font: inherit;
    cursor: pointer;
}

.raw-files-modal__icon-button {
    display: grid;
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    place-items: center;
    padding: 0;
    border-radius: 8px;
    color: #858585;
    background: transparent;
    transition: background-color 180ms ease;
}

.raw-files-modal__icon-button:hover {
    background: #f6f6f6;
}

.raw-files-modal__icon {
    width: 24px;
    height: 24px;
}

.raw-files-modal__list {
    box-sizing: border-box;
    max-height: 484px;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
    border-top: 1px solid #ededed;
    padding-bottom: 16px;
}

.raw-files-modal__item {
    position: relative;
    display: flex;
    box-sizing: border-box;
    align-items: center;
    height: auto;
    gap: 24px;
    border-bottom: 1px solid #ededed;
    padding: 16px 0;
}

.raw-files-modal__item:last-child {
    border-bottom: unset;
    padding-bottom: 0;
}

.raw-files-modal__item-main {
    display: flex;
    min-width: 0;
    flex: 1 1 auto;
    align-items: center;
    gap: 24px;
    /* padding-bottom: 16px; */
    color: inherit;
    text-align: left;
    background: transparent;
}

.raw-files-modal__thumbnail {
    position: relative;
    display: block;
    width: 228px;
    aspect-ratio: 16 / 9;
    flex: 0 0 228px;
    overflow: hidden;
    border-radius: 8px;
    background: #ededed;
}

.raw-files-modal__thumbnail img,
.raw-files-modal__thumbnail-placeholder {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.raw-files-modal__thumbnail-placeholder {
    background: linear-gradient(135deg, #ededed, #d9d9d9);
}

.raw-files-modal__duration {
    position: absolute;
    right: 8px;
    bottom: 8px;
    padding: 3px 5px;
    border-radius: 4px;
    color: #fff;
    background: rgb(29 29 29 / 72%);
    font-size: 12px;
    line-height: 14px;
}

.raw-files-modal__item-copy {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 4px;
}

.raw-files-modal__item-title {
    overflow: hidden;
    color: #1d1d1d;
    font-size: 16px;
    font-weight: 400;
    line-height: 18px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.raw-files-modal__metadata {
    color: #858585;
    font-size: 14px;
    font-weight: 400;
    line-height: 16px;
}

.raw-files-modal__download-icon {
    display: grid;
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    place-items: center;
    padding: 0;
    border-radius: 8px;
    color: #1d1d1d;
    background: transparent;
    transition: background-color 180ms ease;
}

.raw-files-modal__download-icon:hover,
.raw-files-modal__download-icon.is-loading {
    background: #ededed;
}

.raw-files-modal__download-icon.is-loading,
.raw-files-modal__download-button.is-loading {
    cursor: wait;
    opacity: 0.55;
}

.raw-files-modal__download-svg {
    width: 24px;
    height: 24px;
}

.raw-files-modal__notice {
    flex: 0 0 auto;
    margin: 0px 32px 32px;
    padding-top: 24px;
    color: #858585;
    font-size: 14px;
    line-height: 20px;
    border-top: 1px solid #ededed;
}

.raw-files-modal__empty {
    display: grid;
    min-height: 200px;
    place-items: center;
    color: #858585;
    font-size: 16px;
}

.raw-files-modal__detail-heading {
    display: flex;
    min-width: 0;
    flex: 1 1 auto;
    align-items: center;
    gap: 8px;
    margin-right: 16px;
}

.raw-files-modal__detail-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.raw-files-modal__back {
    display: grid;
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    cursor: pointer;
    transition: background-color 180ms ease;
}

.raw-files-modal__back:hover {
    background: #f6f6f6;
}

.raw-files-modal__back-icon {
    width: 40px;
    height: 40px;
    padding: 8px;
    color: #858585;
    transition: color 180ms ease;
}

.raw-files-modal__back:hover .raw-files-modal__back-icon {
    color: #000000;
}

.raw-files-modal__player-wrap {
    width: 100%;
    overflow: hidden;
    aspect-ratio: 628 / 353;
    border-radius: 8px;
    background: #1d1d1d;
}

.raw-files-modal__detail-scroll {
    display: flex;
    min-height: 0;
    flex-direction: column;
}

.raw-files-modal__player {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    --media-object-fit: contain;
    --media-preview-thumbnail-max-width: 180px;
    --media-preview-thumbnail-max-height: 101px;
    --media-preview-thumbnail-min-width: 0;
    --media-preview-thumbnail-min-height: 0;
}

.raw-files-modal__detail-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    margin: 16px 0;
}

.raw-files-modal__download-button {
    display: flex;
    min-width: 96px;
    height: 40px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 16px;
    border: 1px solid #858585;
    border-radius: 8px;
    color: #858585;
    background: #fff;
    font-size: 14px;
    font-weight: 500;
    line-height: 16px;
    transition: border-color 180ms ease, background-color 180ms ease;
}

.raw-files-modal__download-button:hover {
    border-color: #1d1d1d;
    background: #f6f6f6;
}

.raw-files-modal__detail-divider {
    width: 100%;
    height: 1px;
    flex: 0 0 1px;
    background: #ededed;
}

.raw-files-modal.is-opening {
    animation: raw-files-modal-fade-in 300ms ease-out both;
}

.raw-files-modal.is-closing {
    animation: raw-files-modal-fade-out 240ms ease-in both;
}

.raw-files-modal.is-opening .raw-files-modal__card {
    animation: raw-files-modal-card-in 300ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.raw-files-modal.is-closing .raw-files-modal__card {
    animation: raw-files-modal-card-out 240ms ease-in both;
}

@keyframes raw-files-modal-fade-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes raw-files-modal-fade-out {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}

@keyframes raw-files-modal-card-in {
    from {
        opacity: 0;
        transform: scale(0.96);
    }

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

@keyframes raw-files-modal-card-out {
    from {
        opacity: 1;
        transform: scale(1);
    }

    to {
        opacity: 0;
        transform: scale(0.96);
    }
}

@media (prefers-reduced-motion: reduce) {
    .raw-files-modal__view > * {
        transition: none;
    }

    .raw-files-modal.is-opening,
    .raw-files-modal.is-closing,
    .raw-files-modal.is-opening .raw-files-modal__card,
    .raw-files-modal.is-closing .raw-files-modal__card {
        animation: none;
    }
}

@media (min-width: 768px) and (max-height: 679px) {
    .raw-files-modal__list {
        max-height: calc(100dvh - 224px);
        scrollbar-gutter: stable;
    }

    .raw-files-modal__detail-scroll {
        max-height: calc(100dvh - 224px);
        overflow-y: auto;
        overscroll-behavior: contain;
    }

    .raw-files-modal__player-wrap {
        width: 100%;
        height: clamp(180px, 100dvh - 340px, 300px);
        flex: 0 0 auto;
    }
}

@media (max-width: 767px) {
    .raw-files-modal {
        align-items: center;
        padding: 16rem;
    }

    .raw-files-modal__card {
        max-height: calc(100dvh - 24rem);
        border-radius: 16rem;
    }

    .raw-files-modal__view {
        max-height: calc(100dvh - 24rem);
        padding: 32rem 32rem 0;
    }

    .raw-files-modal__header {
        min-height: 32rem;
        margin-bottom: 0rem;
    }

    .raw-files-modal__view:not(.raw-files-modal__detail) > .raw-files-modal__header {
        margin-bottom: 12rem;
        padding-bottom: 12rem;
        /* border-bottom: 1px solid #ededed; */
    }

    .raw-files-modal__title,
    .raw-files-modal__detail-title {
        font-size: 26rem;
        line-height: 32rem;
        letter-spacing: -0.52rem;
    }

    .raw-files-modal__detail-heading {
        gap: 6rem;
        margin-right: 12rem;
    }

    .raw-files-modal__back {
        width: 32rem;
        height: 32rem;
        flex: 0 0 32rem;
        border-radius: 6rem;
    }

    .raw-files-modal__back-icon {
        width: 32rem;
        height: 32rem;
        padding: 4rem;
    }
    .raw-files-modal__detail-scroll  {
        margin-top: 18rem;
    }
    .raw-files-modal__list {
        max-height: calc(100dvh - 208rem);
        scrollbar-gutter: auto;
        padding-bottom: 12rem;
    }

    .raw-files-modal__item {
        height: auto;
        min-height: 80rem;
        gap: 10rem;
        padding: 12rem 0;
    }

    .raw-files-modal__item-main {
        gap: 12rem;
    }

    .raw-files-modal__thumbnail {
        width: 128rem;
        flex-basis: 128rem;
        border-radius: 6rem;
    }

    .raw-files-modal__item-copy {
        gap: 6rem;
    }

    .raw-files-modal__item-title {
        font-size: 15rem;
        line-height: 18rem;
    }

    .raw-files-modal__metadata {
        font-size: 12rem;
        line-height: 15rem;
    }

    .raw-files-modal__download-icon {
        width: 36rem;
        height: 36rem;
        flex-basis: 36rem;
    }

    .raw-files-modal__notice {
        margin: 0rem 32rem 32rem;
        padding-top: 24rem;
        border-top: 1px solid #ededed;
        font-size: 12rem;
        line-height: 16rem;
    }

    .raw-files-modal__detail-actions {
        /* align-items: stretch;
        flex-direction: column; */
        gap: 16rem;
        margin: 12rem 0 12rem;
    }

    .raw-files-modal__download-button {
        width: auto;
        height: 40rem;
        padding: 10rem 16rem;
    }
}

@media (max-width: 767px) and (max-height: 679px) {
    .raw-files-modal__detail-scroll {
        max-height: calc(100dvh - 180rem);
        overflow-y: auto;
        overscroll-behavior: contain;
    }

    .raw-files-modal__player-wrap {
        width: 100%;
        height: clamp(160rem, 100dvh - 280rem, 300rem);
        flex: 0 0 auto;
    }
}
