theme.json shipped a palette entry with the slug "text", so WordPress
generated `.has-text-color { color: var(--wp--preset--color--text)
!important }`. The block editor puts that same class on any block given a
custom text colour, so the rule overrode every one of them site-wide with
the dark-theme foreground, unreadable in either theme. An !important
declaration beats an inline style, which is why the colour set on the
block never had a chance.
Rename the slug to "foreground". No published content used the class, for
the obvious reason that it never worked, so nothing has to be migrated.
A smoke test now rejects any palette slug that shadows an editor utility
class.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
203 lines
5.8 KiB
CSS
203 lines
5.8 KiB
CSS
.chrnx-related-posts {
|
|
--chrnx-related-gap: var(--wp--preset--spacing--40, 1.5rem);
|
|
--chrnx-related-control-background: var(--wp--preset--color--panel);
|
|
--chrnx-related-control-border: var(--wp--preset--color--muted);
|
|
--chrnx-related-control-text: var(--wp--preset--color--foreground);
|
|
--chrnx-related-focus-ring: var(--wp--preset--color--green);
|
|
|
|
max-width: 100%;
|
|
min-width: 0;
|
|
}
|
|
|
|
html[data-theme="dark"] .chrnx-related-posts {
|
|
--chrnx-related-focus-ring: var(--wp--preset--color--green);
|
|
}
|
|
|
|
html[data-theme="light"] .chrnx-related-posts {
|
|
--chrnx-related-control-background: var(--wp--preset--color--surface);
|
|
--chrnx-related-control-border: var(--wp--preset--color--border);
|
|
--chrnx-related-control-text: var(--wp--preset--color--ink);
|
|
--chrnx-related-focus-ring: var(--wp--preset--color--light-green);
|
|
}
|
|
|
|
@media (prefers-color-scheme: light) {
|
|
|
|
:root:not([data-theme]) .chrnx-related-posts {
|
|
--chrnx-related-control-background: var(--wp--preset--color--surface);
|
|
--chrnx-related-control-border: var(--wp--preset--color--border);
|
|
--chrnx-related-control-text: var(--wp--preset--color--ink);
|
|
--chrnx-related-focus-ring: var(--wp--preset--color--light-green);
|
|
}
|
|
}
|
|
|
|
.chrnx-related-posts__items {
|
|
width: 100%;
|
|
max-width: 100%;
|
|
min-width: 0;
|
|
align-items: stretch;
|
|
gap: var(--chrnx-related-gap);
|
|
}
|
|
|
|
.chrnx-related-card,
|
|
.chrnx-related-card__link,
|
|
.chrnx-related-card__content {
|
|
min-width: 0;
|
|
}
|
|
|
|
.chrnx-related-posts .chrnx-related-card:focus-within {
|
|
box-shadow: inset 0 0 0 3px var(--chrnx-related-focus-ring);
|
|
}
|
|
|
|
.chrnx-related-posts.is-layout-grid .chrnx-related-posts__items {
|
|
display: grid;
|
|
grid-template-columns: minmax(0, 1fr);
|
|
}
|
|
|
|
.chrnx-related-posts.is-layout-carousel .chrnx-related-posts__items {
|
|
display: flex;
|
|
overflow-x: auto;
|
|
overscroll-behavior-inline: contain;
|
|
scroll-snap-type: x mandatory;
|
|
scrollbar-gutter: stable;
|
|
}
|
|
|
|
.chrnx-related-posts.is-layout-carousel .chrnx-related-card {
|
|
flex: 0 0 calc((100% - var(--chrnx-related-gap) - var(--chrnx-related-gap)) / 3);
|
|
scroll-snap-align: start;
|
|
}
|
|
|
|
.chrnx-related-card__link {
|
|
display: flex;
|
|
height: 100%;
|
|
flex-direction: column;
|
|
}
|
|
|
|
.chrnx-related-card__content {
|
|
overflow-wrap: anywhere;
|
|
}
|
|
|
|
.chrnx-related-posts__controls {
|
|
display: flex;
|
|
justify-content: flex-end;
|
|
gap: var(--wp--preset--spacing--20, 0.75rem);
|
|
margin-top: var(--wp--preset--spacing--30, 1rem);
|
|
}
|
|
|
|
.chrnx-related-posts__controls[hidden] {
|
|
display: none !important;
|
|
}
|
|
|
|
.chrnx-related-posts__controls button {
|
|
display: inline-flex;
|
|
min-width: 45px;
|
|
min-height: 45px;
|
|
align-items: center;
|
|
justify-content: center;
|
|
padding: 0.5rem 0.875rem;
|
|
border: 1px solid var(--chrnx-related-control-border);
|
|
border-radius: 999px;
|
|
background: var(--chrnx-related-control-background);
|
|
color: var(--chrnx-related-control-text);
|
|
cursor: pointer;
|
|
}
|
|
|
|
.chrnx-related-posts__controls button:disabled {
|
|
opacity: 0.55;
|
|
cursor: default;
|
|
}
|
|
|
|
.chrnx-related-posts__controls button:focus-visible {
|
|
outline: 2px solid transparent;
|
|
outline-offset: 3px;
|
|
box-shadow: 0 0 0 3px var(--chrnx-related-focus-ring);
|
|
}
|
|
|
|
.chrnx-related-posts__controls button:not(:disabled):hover {
|
|
border-color: var(--chrnx-related-focus-ring);
|
|
background: color-mix(in srgb, var(--chrnx-related-control-background) 88%, var(--chrnx-related-control-text));
|
|
}
|
|
|
|
.chrnx-related-posts__controls button:not(:disabled):active {
|
|
background: color-mix(in srgb, var(--chrnx-related-control-background) 74%, var(--chrnx-related-control-text));
|
|
}
|
|
|
|
@media (hover: hover) {
|
|
|
|
.chrnx-related-posts.is-layout-carousel .chrnx-related-card:hover {
|
|
transform: none;
|
|
}
|
|
|
|
.chrnx-related-posts.is-layout-carousel .chrnx-related-card:hover:not(:focus-within) {
|
|
box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--chrnx-green) 62%, transparent);
|
|
}
|
|
}
|
|
|
|
@media (max-width: 900px) {
|
|
|
|
.chrnx-related-posts.is-layout-adaptive .chrnx-related-posts__items {
|
|
display: flex;
|
|
overflow-x: auto;
|
|
overscroll-behavior-inline: contain;
|
|
scroll-snap-type: x mandatory;
|
|
scrollbar-gutter: stable;
|
|
}
|
|
|
|
.chrnx-related-posts.is-layout-adaptive .chrnx-related-card,
|
|
.chrnx-related-posts.is-layout-carousel .chrnx-related-card {
|
|
flex: 0 0 calc(100% - clamp(3rem, 12vw, 7rem));
|
|
scroll-snap-align: start;
|
|
}
|
|
|
|
@media (hover: hover) {
|
|
|
|
.chrnx-related-posts.is-layout-adaptive .chrnx-related-card:hover {
|
|
transform: none;
|
|
}
|
|
|
|
.chrnx-related-posts.is-layout-adaptive .chrnx-related-card:hover:not(:focus-within) {
|
|
box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--chrnx-green) 62%, transparent);
|
|
}
|
|
}
|
|
}
|
|
|
|
@media (min-width: 901px) {
|
|
|
|
.chrnx-related-posts.is-layout-adaptive .chrnx-related-posts__items,
|
|
.chrnx-related-posts.is-layout-grid .chrnx-related-posts__items {
|
|
display: grid;
|
|
grid-template-columns: repeat(3, minmax(0, 1fr));
|
|
}
|
|
|
|
.chrnx-related-posts:is(.is-layout-adaptive, .is-layout-grid) .chrnx-related-posts__items:not(:has(> .chrnx-related-card:nth-child(2))) {
|
|
grid-template-columns: minmax(0, 1fr);
|
|
}
|
|
|
|
.chrnx-related-posts:is(.is-layout-adaptive, .is-layout-grid) .chrnx-related-posts__items:has(> .chrnx-related-card:nth-child(2)):not(:has(> .chrnx-related-card:nth-child(3))) {
|
|
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
}
|
|
}
|
|
|
|
@media (prefers-reduced-motion: reduce) {
|
|
|
|
.chrnx-related-posts.is-layout-adaptive .chrnx-related-posts__items,
|
|
.chrnx-related-posts.is-layout-carousel .chrnx-related-posts__items {
|
|
scroll-behavior: auto;
|
|
}
|
|
}
|
|
|
|
.chrnx-related-card__image,
|
|
.chrnx-related-card__fallback {
|
|
aspect-ratio: 3 / 2;
|
|
display: block;
|
|
object-fit: cover;
|
|
width: 100%;
|
|
}
|
|
|
|
.chrnx-related-card__fallback {
|
|
background-color: var(--wp--preset--color--panel);
|
|
background-image:
|
|
linear-gradient(30deg, transparent 35%, color-mix(in srgb, var(--wp--preset--color--green) 65%, transparent) 36% 40%, transparent 41%),
|
|
linear-gradient(135deg, var(--wp--preset--color--violet), var(--wp--preset--color--night));
|
|
min-height: 10rem;
|
|
}
|