:root {
    --cotr-bg: #F7F7F5;
    --cotr-surface: #FFFFFF;
    --cotr-text: #171717;
    --cotr-muted: #666666;
    --cotr-border: #E7E7E7;
    --cotr-red: #A22B24;
    --cotr-red-dark: #86231E;
}

body.cotr-category-page,
body.cotr-category-page #page,
body.cotr-category-page .site,
body.cotr-category-page .site-content,
body.cotr-category-page .content-area,
body.cotr-category-page .site-main,
body.cotr-category-page .wp-site-blocks,
body.cotr-category-page main {
    background: var(--cotr-bg) !important;
    color: var(--cotr-text) !important;
}

/*
 * Sitewide Shell integration.
 * The shell uses a two-column desktop grid (left rail + page content). The
 * category archive must remain a normal grid child rather than trying to span
 * the viewport, otherwise the archive can sit underneath the left rail.
 */
body.cotr-category-page .cotr-page-frame {
    width: 100%;
}

body.cotr-category-page .cotr-category-shell-content,
body.cotr-category-page .cotr-page-content {
    min-width: 0;
    width: 100%;
    max-width: 100%;
}

body.cotr-category-page .cotr-category-shell-content {
    overflow-x: clip;
}

body.cotr-category-page .cotr-category {
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    margin: 0;
}

body.cotr-category-page .cotr-category__inner,
body.cotr-category-page .cotr-category__grid,
body.cotr-category-page .cotr-category-card {
    min-width: 0;
    max-width: 100%;
}

/* Hide archive/pagination elements injected by a theme so this archive stays consistent. */
body.cotr-category-page .archive-header,
body.cotr-category-page .page-header:not(.cotr-category__header),
body.cotr-category-page .navigation.pagination,
body.cotr-category-page nav.pagination,
body.cotr-category-page .posts-navigation,
body.cotr-category-page .nav-links,
body.cotr-category-page .pagination {
    display: none !important;
}

.cotr-category {
    min-height: 72vh;
    padding: 42px 22px 96px;
    background: var(--cotr-bg) !important;
}

.cotr-category__inner {
    width: min(1380px, 100%);
    margin: 0 auto;
}

.cotr-category__header {
    position: relative;
    max-width: 860px;
    margin: 0 0 34px;
    padding: 0 0 24px;
    border-bottom: 1px solid var(--cotr-border);
}

.cotr-category__header::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -1px;
    width: 72px;
    height: 3px;
    border-radius: 999px;
    background: var(--cotr-red);
}

.cotr-category__eyebrow {
    display: block;
    margin: 0 0 9px;
    color: var(--cotr-red);
    font: 800 12px/1.1 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.cotr-category__title {
    margin: 0 !important;
    color: var(--cotr-text) !important;
    font-family: "Inter Tight", "Avenir Next", "Helvetica Neue", Arial, sans-serif !important;
    font-size: clamp(42px, 4.4vw, 68px) !important;
    font-weight: 800 !important;
    line-height: .98 !important;
    letter-spacing: -.045em !important;
}

.cotr-category__description {
    max-width: 720px;
    margin: 14px 0 0 !important;
    color: var(--cotr-muted) !important;
    font: 500 16px/1.55 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif !important;
}

.cotr-category__description p {
    margin: 0;
}

.cotr-category__grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 26px;
}

.cotr-category-card {
    min-width: 0;
}

.cotr-category-card__surface {
    height: 100%;
    overflow: hidden;
    border: 1px solid var(--cotr-border);
    border-radius: 18px;
    background: var(--cotr-surface);
    box-shadow: 0 8px 28px rgba(23, 23, 23, .055);
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}

.cotr-category-card:hover .cotr-category-card__surface {
    transform: translateY(-3px);
    border-color: #DCDCDC;
    box-shadow: 0 16px 38px rgba(23, 23, 23, .09);
}

.cotr-category-card__story-link {
    display: block;
    color: var(--cotr-text) !important;
    text-decoration: none !important;
}

.cotr-category-card__media {
    position: relative;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background: #ECECE8;
}

.cotr-category-card__image,
.cotr-category-card__placeholder {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.cotr-category-card__image {
    object-fit: cover;
    transition: transform .3s ease;
}

.cotr-category-card:hover .cotr-category-card__image {
    transform: scale(1.018);
}

.cotr-category-card__placeholder {
    display: grid;
    place-items: center;
    background: linear-gradient(145deg, #F5F5F2, #E9E9E5);
    color: var(--cotr-red);
}

.cotr-category-card__placeholder span {
    font: 900 32px/1 "Inter Tight", "Avenir Next", "Helvetica Neue", Arial, sans-serif;
    letter-spacing: -.06em;
}

.cotr-category-card__content {
    padding: 19px 20px 15px;
}

.cotr-category-card__title {
    margin: 0 !important;
    color: var(--cotr-text) !important;
    font-family: "Inter Tight", "Avenir Next", "Helvetica Neue", Arial, sans-serif !important;
    font-size: clamp(22px, 1.65vw, 29px) !important;
    font-weight: 800 !important;
    line-height: 1.03 !important;
    letter-spacing: -.035em !important;
    text-decoration: none !important;
}

.cotr-category-card__excerpt {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    overflow: hidden;
    margin: 10px 0 0 !important;
    color: var(--cotr-muted) !important;
    font: 500 14px/1.48 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif !important;
}

.cotr-category-card__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin: 0 20px;
    padding: 14px 0 17px;
    border-top: 1px solid var(--cotr-border);
    color: var(--cotr-muted);
    font: 700 12px/1 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    letter-spacing: .01em;
}

.cotr-category-card__actions {
    display: flex;
    align-items: center;
    gap: 7px;
}

.cotr-category-card__action {
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 1px solid var(--cotr-border);
    border-radius: 50%;
    background: #fff;
    color: #383838 !important;
    text-decoration: none !important;
    cursor: pointer;
    transition: border-color .18s ease, color .18s ease, background .18s ease, transform .18s ease;
}

.cotr-category-card__action svg {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.cotr-category-card__action:hover,
.cotr-category-card__action:focus-visible {
    border-color: var(--cotr-red);
    background: #FFF8F7;
    color: var(--cotr-red) !important;
    transform: translateY(-1px);
}

.cotr-category-card__action.is-copied {
    border-color: var(--cotr-red);
    background: var(--cotr-red);
    color: #fff !important;
}

.cotr-category__load-wrap {
    display: grid;
    justify-items: center;
    gap: 12px;
    margin-top: 44px;
}

.cotr-category__load-more {
    min-width: min(300px, 100%);
    min-height: 52px;
    padding: 13px 24px;
    border: 1px solid var(--cotr-red);
    border-radius: 12px;
    background: var(--cotr-red);
    color: #fff;
    cursor: pointer;
    font: 800 16px/1 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    box-shadow: 0 5px 14px rgba(162, 43, 36, .16);
    transition: transform .18s ease, background .18s ease, box-shadow .18s ease;
}

.cotr-category__load-more:hover,
.cotr-category__load-more:focus-visible {
    transform: translateY(-1px);
    background: var(--cotr-red-dark);
    box-shadow: 0 8px 20px rgba(162, 43, 36, .22);
}

.cotr-category__load-more:disabled {
    opacity: .7;
    cursor: wait;
}

.cotr-category__load-more.is-loading span::after {
    content: "";
    display: inline-block;
    width: 15px;
    height: 15px;
    margin-left: 9px;
    border: 2px solid rgba(255, 255, 255, .38);
    border-top-color: #fff;
    border-radius: 50%;
    vertical-align: -3px;
    animation: cotr-category-spin .75s linear infinite;
}

.cotr-category__status {
    min-height: 22px;
    margin: 0;
    color: var(--cotr-muted);
    font: 600 13px/1.4 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.cotr-category__empty {
    padding: 58px 28px;
    border: 1px solid var(--cotr-border);
    border-radius: 18px;
    background: #fff;
    text-align: center;
    box-shadow: 0 8px 28px rgba(23, 23, 23, .045);
}

.cotr-category__empty h2 {
    margin: 0 0 8px;
    color: var(--cotr-text);
    font-family: "Inter Tight", "Avenir Next", "Helvetica Neue", Arial, sans-serif;
    font-weight: 800;
}

.cotr-category__empty p {
    margin: 0;
    color: var(--cotr-muted);
}

@keyframes cotr-category-spin {
    to { transform: rotate(360deg); }
}

@media (max-width: 980px) {
    .cotr-category {
        padding-inline: 16px;
    }

    .cotr-category__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 620px) {
    .cotr-category {
        padding: 30px 13px 72px;
    }

    .cotr-category__header {
        margin-bottom: 26px;
        padding-bottom: 20px;
    }

    .cotr-category__title {
        font-size: 42px !important;
    }

    .cotr-category__description {
        font-size: 15px !important;
    }

    .cotr-category__grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .cotr-category-card__title {
        font-size: 24px !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    .cotr-category-card__surface,
    .cotr-category-card__image,
    .cotr-category-card__action,
    .cotr-category__load-more {
        transition: none;
    }
}

/* v2.1.0: Shorts can be regular posts or a categorized custom post type. */
.cotr-category-card__media { position:relative; }
.cotr-category-card__play {
    position:absolute;
    z-index:3;
    left:50%;
    top:50%;
    transform:translate(-50%,-50%);
    width:54px;
    height:54px;
    display:grid;
    place-items:center;
    border-radius:50%;
    background:rgba(162,43,36,.94);
    color:#fff;
    box-shadow:0 10px 28px rgba(0,0,0,.24);
    pointer-events:none;
}
.cotr-category-card__play svg { width:26px;height:26px;fill:currentColor;stroke:none;transform:translateX(1px); }
.cotr-category-card--short .cotr-category-card__media { aspect-ratio:16/10; }
