@mixin --center {
display: flex;
align-items: center;
justify-content: center;
}
.card { @apply --center; }
@view-transition {
navigation: auto;
}
::view-transition-old(root) {
animation: fade-out 0.3s;
}
::view-transition-new(root) {
animation: fade-in 0.3s;
}
.grid {
display: grid;
grid-template-columns: 1fr 1fr 1fr;
gap: 20px;
column-rule: 1px solid #ccc;
row-rule: 1px dashed #eee;
}
.flex-nav {
display: flex;
flex-direction: row-reverse;
reading-flow: flex-visual;
}
.grid-layout {
display: grid;
reading-flow: grid-rows;
}
.reveal {
animation: fade-in linear;
animation-timeline: view();
animation-range: entry 0% entry 100%;
}
@keyframes fade-in {
from { opacity: 0; transform: translateY(20px); }
to { opacity: 1; transform: translateY(0); }
}
.gallery {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
grid-template-rows: masonry;
gap: 16px;
}
:root { --brand: oklch(65% 0.25 260); }
.lighter {
color: oklch(from var(--brand) calc(l + 0.2) c h);
}
.muted {
color: oklch(from var(--brand) l calc(c * 0.5) h);
}
dialog[open] {
opacity: 1;
transform: scale(1);
transition: opacity 0.3s, transform 0.3s;
}
@starting-style {
dialog[open] {
opacity: 0;
transform: scale(0.95);
}
}
/* JavaScript: create ranges */
const range = new Range();
range.setStart(node, 0);
range.setEnd(node, 5);
CSS.highlights.set('search', new Highlight(range));
/* CSS: style the highlight */
::highlight(search) {
background: oklch(85% 0.15 90);
color: black;
}
.badge {
background: var(--bg);
color: contrast-color(var(--bg));
}
/* vs: manually hardcoding per variant */
.badge-blue { color: white; }
.badge-yellow { color: black; }
@scope (.card) to (.card-content) {
:scope {
border: 1px solid #ddd;
border-radius: 12px;
}
h2 { font-size: 1.2rem; }
p { color: gray; }
}