table {
    width: 100%;
    border-collapse: collapse;

    p { margin: 0; }

    th {
        padding: 1rem;
        background-color: black;
        text-transform: uppercase;
        text-align: left;
        font-weight: lighter;
    }

    tr {
        height: 3rem;
        background-color: var(--color-table-even);

        &:nth-child(odd) { background: var(--color-table-odd); }

        &:hover { background-color: var(--color-table-hover); }

        td {
            height: inherit;
            padding: 0 0.5rem;

            .cell__grid {
                display: grid;
                place-content: center;
            }
            .cell__flex {
                display: flex;
                justify-content: flex-end;
                align-items: center;
                gap: 0.5rem;
            }
        }
    }

    .table__caption {
        display: flex;
        flex-direction: row;
        justify-content: space-between;
        padding: 0.5rem;
    }

    .table--stacked {
        display: flex;
        flex-direction: column;
        justify-content: center;
    }

    .cell__actions {
        grid-area: actions;
        padding: 0.25rem 1rem;

        svg { height: 1rem; }
    }

    .table__country {
        padding: 0.25rem;
        display: grid;
        place-items: center;

        > img { height: 1.5rem; }
    }

    .table__character {
        overflow: hidden;
        position: relative;
        width: 18ch;
        isolation: isolate;
        padding: 0;

        > .character__image {
            pointer-events: none;
            max-width: 100%;
            position: absolute;
            opacity: 0.4;
            z-index: -1;
            top: -50%;
        }

        .character {
            padding: 1rem;
            display: flex;
            justify-content: space-between;
            margin: 0;
        }
    }

    @container (max-width: 60em) {
        border-collapse: separate;

        thead {
            border: none;
            clip: rect(0 0 0 0);
            height: 1px;
            margin: -1px;
            overflow: hidden;
            padding: 0;
            position: absolute;
            width: 1px;
        }

        tbody {
            display: flex;
            flex-direction: column;
            gap: 1rem;
        }

        tr {
            height: inherit;
            border: 1px solid #888;

            td {
                padding: 0.25rem;
                display: flex;
                justify-content: space-between;
                gap: 1rem;
            }
        }

        td:last-child::before, th:last-child::before {
            flex-grow: 1;
            letter-spacing: 0.1em;
            color: var(--light-gray);
        }

        .table__character {
            width: inherit;

            > .character__image {
                top: 0;
                height: 100%;
                object-fit: cover;
            }

            .character {
                margin: 0;
                padding: 0 0.5rem;
                gap: 0.5rem;
            }
        }

        .cell__actions {
            padding: 0 0.5rem;
            height: 1.5rem;
        }

        .table__caption--left { float: none; }
        .table__caption--right { float: none; }

        .table--stacked {
            flex-direction: row;
            gap: 1rem;
        }
    }
}
