@use 'sass:meta'; @use 'iro-sass/src/bem'; @use 'iro-sass/src/props'; @use '../props' as *; @use 'avatar.vars' as avatar; @forward 'card.vars'; @use 'card.vars' as vars; @mixin styles { @include materialize-at-root(meta.module-variables('vars')); @include bem.object('card') { position: relative; display: flex; flex-direction: column; margin-inline: calc(-1 * props.get(vars.$key-focus--border-width)); background-color: props.get(vars.$bg-color); background-clip: content-box; border: props.get(vars.$key-focus--border-offset) solid transparent; border-radius: calc(props.get(vars.$rounding) + props.get(vars.$key-focus--border-offset)); transition: transform .2s; @include bem.multi('&:link, &:visited, &:enabled', 'modifier' 'interactive') { &:hover, &:active, &:focus-visible { transform: translateY(props.get(vars.$hover--offset-b)); @include bem.elem('body') { @include bem.modifier('hidden') { visibility: visible; opacity: 1; transition: opacity .2s ease, visibility .2s linear; } } } &:focus-visible { outline: props.get(vars.$key-focus--border-color) solid props.get(vars.$key-focus--border-width); box-shadow: 0 0 0 calc(props.get(vars.$key-focus--border-width) + props.get(vars.$key-focus--outline-width)) props.get(vars.$key-focus--outline-color); } } @include bem.elem('avatar') { margin-block-start: props.get(vars.$pad-b); margin-inline-start: props.get(vars.$pad-i); } @include bem.elem('image') { position: relative; display: block; flex: 0 0 auto; inline-size: 100%; overflow: hidden; object-fit: cover; transition: transform .2s, opacity .2s; &:first-child { border-start-start-radius: props.get(vars.$rounding); border-start-end-radius: props.get(vars.$rounding); } &:last-child { border-end-start-radius: props.get(vars.$rounding); border-end-end-radius: props.get(vars.$rounding); } @include bem.next-elem('avatar') { margin-block-start: calc(-.7 * props.get(avatar.$size--xl)); } } @include bem.elem('image-img') { display: block; inline-size: 100%; object-fit: cover; } @include bem.elem('image-overlay') { position: absolute; inset-block-end: 0; inset-inline: 0; z-index: 10; padding-block: props.get(vars.$image-overlay--pad-b); padding-inline: props.get(vars.$image-overlay--pad-i); } @include bem.elem('body') { flex: 1 0 auto; padding-block: props.get(vars.$pad-b); padding-inline: props.get(vars.$pad-i); &::before { display: block; margin-block: -100em 100em; content: ''; } @include bem.modifier('hidden') { position: absolute; inset-block-end: 0; inset-inline: 0; z-index: 10; visibility: hidden; background-color: props.get(vars.$bg-color); //border-end-start-radius: props.get(vars.$rounding); //border-end-end-radius: props.get(vars.$rounding); opacity: 0; transition: opacity .2s ease, visibility 0s .2s linear; @include bem.next-elem('image') { border-start-start-radius: props.get(vars.$rounding); border-start-end-radius: props.get(vars.$rounding); } } } @include bem.elem('content') { margin-block-start: props.get(vars.$spacing); } @include bem.elem('footer') { flex: 0 0 auto; padding-block: 0 props.get(vars.$pad-b); padding-inline: props.get(vars.$pad-i); margin-block-start: calc(-1 * props.get(vars.$pad-b)); &::before { display: block; block-size: props.get(vars.$divider-width); margin-block: props.get(vars.$spacing); content: ''; background-color: props.get(vars.$divider-width); } } @include bem.modifier('quiet') { position: relative; margin-inline: 0; background-color: transparent; border: 0; @include bem.multi('&:link, &:visited, &:enabled', 'modifier' 'interactive') { &:hover, &:active, &:focus-visible { transform: none; @include bem.elem('image') { background-color: props.get(vars.$quiet--hover--image-color); opacity: .75; transform: translateY(props.get(vars.$hover--offset-b)); } } &:focus-visible { outline: none; box-shadow: none; @include bem.elem('image') { background-color: props.get(vars.$quiet--hover--image-color); outline: props.get(vars.$key-focus--border-color) solid props.get(vars.$key-focus--border-width); box-shadow: 0 0 0 calc(props.get(vars.$key-focus--border-width) + props.get(vars.$key-focus--outline-width)) props.get(vars.$key-focus--outline-color); opacity: 1; } } } @include bem.elem('image') { position: relative; margin: calc(-1 * props.get(vars.$key-focus--border-width)); background-color: props.get(vars.$quiet--image-color); background-clip: padding-box; border: props.get(vars.$key-focus--border-offset) solid transparent; border-radius: calc(props.get(vars.$rounding) + props.get(vars.$key-focus--border-offset)); } @include bem.elem('body') { padding: 0; padding-block-start: props.get(vars.$spacing); } @include bem.elem('footer') { padding-inline: 0; } } @include bem.modifier('horizontal') { flex-direction: row; align-items: center; @include bem.elem('body') { flex: 0 0 auto; @include bem.modifier('main') { flex-shrink: 1; inline-size: 100%; min-inline-size: 0; } } } } }