@use '@/core' as *;
.card {
$b: &;
--card-shadow: 0 0.25rem 0.5rem rgb(0 0 0 / 0.1);
--card-shadow-hover: 0 0.75rem 1.5rem rgb(0 0 0 / 0.12);
background-color: #ffffff;
border-radius: 1rem;
box-shadow: var(--card-shadow);
display: flex;
flex-direction: column-reverse;
isolation: isolate;
justify-content: flex-end;
overflow: hidden;
max-width: 100%;
position: relative;
transition: box-shadow var(--root-ease-out-moderate);
// The title link stretches over the whole card with ::after, so the card
// has a single link whose accessible name is the title.
&__link {
color: inherit;
display: inline;
transition: color var(--root-ease-out-fast);
&::after {
content: '';
inset: 0;
position: absolute;
z-index: 1;
}
&:hover {
color: inherit;
}
&:focus-visible {
outline: none;
}
}
// Any other interactive elements need to sit above the stretched link.
a:not(#{$b}__link),
button {
position: relative;
z-index: 2;
}
&:has(#{$b}__link:focus-visible) {
outline: 2px solid var(--link-color, var(--color-blue));
outline-offset: 4px;
}
&:has(#{$b}__link:hover),
&:has(#{$b}__link:focus-visible) {
box-shadow: var(--card-shadow-hover);
#{$b}__link,
#{$b}__cta {
color: var(--accent-color);
}
#{$b}__ctaIcon {
translate: 0.25rem 0;
}
#{$b}__button {
background-color: var(--accent-color-700);
border-color: var(--accent-color-700);
}
#{$b}__image {
scale: 1.03;
}
}
&__imageWrapper {
aspect-ratio: 1.78;
overflow: hidden;
}
&__image {
@include image-fit(cover);
transition: scale var(--root-ease-out-slow);
}
&__tagList {
list-style-type: none;
padding: 0;
display: flex;
flex-wrap: wrap;
gap: 1rem;
margin-top: 0;
}
&__cta {
margin-top: auto;
display: flex;
width: 100%;
font-weight: 700;
}
&__ctaIcon {
transition: translate var(--root-ease-out-fast);
}
&__meta {
color: var(--color-gray-500);
line-height: 1.5;
margin: 0;
}
&__metaLink {
text-underline-offset: 4px;
font-weight: 700;
}
&__metaIcon {
display: inline-block;
height: 1.25em;
width: 1.25em;
margin-right: 0.5em;
aspect-ratio: 1;
vertical-align: text-bottom;
}
.tag {
margin: 0;
}
&__title {
font-size: fluid-rems(1.5, 2);
margin: 0.5rem 0;
}
&__description {
color: var(--color-gray-600);
line-height: 1.5;
margin: 0;
}
&__content {
display: flex;
flex-direction: column;
align-items: flex-start;
padding: 1.5rem;
gap: 1rem;
height: 100%;
}
&__iconWrapper {
block-size: 6rem;
aspect-ratio: 1;
}
&__icon {
height: 100%;
}
&.-condensed {
#{$b}__description {
line-height: 1.5;
}
}
&.-flipped {
flex-direction: column;
}
&.-horizontal {
--card-shadow: 0 1rem 4rem rgb(0 0 0 / 0.05);
--card-shadow-hover: 0 1rem 4rem rgb(0 0 0 / 0.12);
background: var(--root-background-color);
display: grid;
gap: 1.5rem;
grid-template-columns: 1fr;
overflow: visible;
padding: 1.5rem 2rem;
@include at(md) {
align-items: start;
grid-template-columns: 300px 1fr;
}
#{$b}__title {
margin: 0;
min-width: 0;
}
#{$b}__body {
display: flex;
flex-direction: column;
gap: 1.5rem;
min-width: 0;
}
#{$b}__intro {
font-size: var(--root-font-size-sm);
margin: 0;
}
}
}