/* ========================================
   Tofu View
======================================== */

.codex-view-toggle {
    position: absolute;
    top: 43px;
    right: max(10px, calc((100vw - 360px) / 2 + 10px));
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 1001;
}

.codex-view-button {
    appearance: none;
    border: 0;
    padding: 0;
    margin: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    border: 1px solid #24242420;
    border-radius: 3px;
    color: #242424;
    cursor: pointer;
}

.codex-view-button.is-active {
    color: #fa696969;
}

.codex-view-button:hover {
    opacity: 0.72;
}

.codex-view-button:focus-visible {
    outline: 1px solid currentColor;
    outline-offset: 2px;
}

.codex-view-fallback {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    font-family: serif;
    font-size: 18px;
    line-height: 18px;
    pointer-events: none;
}

.codex-view-button svg {
    width: 18px;
    height: 18px;
    stroke-width: 1.5;
    pointer-events: none;
}

.codex-view-button svg + .codex-view-fallback {
    display: none;
}

/* ----------------------------------------
   View switching
---------------------------------------- */

.codex-tofu,
.codex-notofu {
    width: 100%;
}

.codex-tofu.is-hidden,
.codex-notofu.is-hidden {
    display: none !important;
}

/* ----------------------------------------
   Tofu grid
---------------------------------------- */

.codex-tofu-grid {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px 12px;
    padding: 0 13px 0 5px;
    box-sizing: border-box;
}

.codex-tofu-item {
    width: 100%;
    min-width: 0;
}

.codex-tofu-item .post-image.tofu {
    width: 100%;
    height: 256px;
    overflow: visible;
    background: #24242420;
    box-sizing: border-box;
    box-shadow: 0px 1px 5px 0px #5451528c;
}

.codex-tofu-item .post-image.tofu img.post.tofu {
    width: 100%;
    height: 100%;
    padding: 0;
    object-fit: cover;
    object-position: center top;
    display: block;
}

.codex-tofu-item .tofu-title {
    display: none;
}

/* ----------------------------------------
   Dual-cover exchange
---------------------------------------- */

.codex-tofu-item .post-image.tofu {
    position: relative;
}

.codex-tofu-cover-link {
    display: block;
    width: 100%;
    height: 100%;
}

.codex-cover-swap {
    position: absolute;
    right: -8px;
    bottom: -8px;
    width: 46px;
    height: 72px;
    padding: 0;
    border: 1px solid #ffffff10;
    border-radius: 2px;
    overflow: hidden;
    background: #ffffff;
    box-shadow: 0 2px 6px #5451528c;
    cursor: pointer;
    z-index: 2;
}

.codex-cover-swap img {
    display: block;
    width: 100%;
    height: 100%;
    padding: 0;
    object-fit: cover;
    object-position: center;
}

.codex-cover-swap:hover {
    opacity: 0.78;
}
