.yfm table td {
    &.cell-align-top-left,
    &.cell-align-bottom-left {
        text-align: start;
    }

    &.cell-align-top-center,
    &.cell-align-center {
        text-align: center;
    }

    &.cell-align-top-right,
    &.cell-align-bottom-right {
        text-align: end;
    }

    &.cell-align-top-left,
    &.cell-align-top-center,
    &.cell-align-top-right {
        vertical-align: top;
    }

    &.cell-align-center {
        vertical-align: middle;
    }

    &.cell-align-bottom-left,
    &.cell-align-bottom-right {
        vertical-align: bottom;
    }
}

@mixin yfm-sticky-header-row {
    position: sticky;
    top: 0;
    z-index: 2;

    td,
    th {
        position: relative;
        z-index: 0;
    }

    td::before,
    th::before {
        content: '';
        background: var(--yfm-color-table-background);
        position: absolute;
        inset: 0;
        z-index: -2;
    }

    td::after,
    th::after {
        content: '';
        background: var(--yfm-color-table-head-background);
        position: absolute;
        inset: 0;
        z-index: -1;
    }
}

.yfm table[sticky-header] {
    position: relative;

    thead {
        @include yfm-sticky-header-row;
    }

    &:not(:has(thead)) {
        tbody > tr:first-child,
        > tr:first-child {
            @include yfm-sticky-header-row;
        }
    }

    max-height: 70vh;
}
