@use 'sass:map'; @use 'sass:meta'; @use 'sass:string'; @use 'iro-sass/src/bem'; @use 'iro-sass/src/props'; @use '../props' as *; @forward 'lightbox.vars'; @use 'lightbox.vars' as vars; @mixin styles { @include materialize-at-root(meta.module-variables('vars')); @include bem.object('lightbox') { flex: 1 1 auto; min-block-size: 0; @include bem.elem('header') { display: flex; grid-area: header; align-items: flex-start; padding-block-start: props.get(vars.$pad); padding-inline: props.get(vars.$pad); } @include bem.elem('img') { box-sizing: border-box; display: block; grid-area: content; place-self: center; max-inline-size: 100%; max-block-size: 80vh; padding: props.get(vars.$pad); margin-inline: auto; } @include bem.elem('thumbnails') { display: none; grid-area: thumbnails; gap: props.get(vars.$thumbnail--spacing); padding: props.get(vars.$pad); margin-block-start: calc(-1 * props.get(vars.$pad)); overflow: auto; } @include bem.elem('thumbnail') { position: relative; flex: 0 0 auto; inline-size: props.get(vars.$thumbnail--size); block-size: props.get(vars.$thumbnail--size); overflow: hidden; border-radius: props.get(vars.$thumbnail--rounding); outline: props.get(vars.$thumbnail--border-color) solid props.get(vars.$thumbnail--border-width); outline-offset: calc(-1 * props.get(vars.$thumbnail--border-width)); opacity: .75; &:hover, &:active, &:focus-visible { outline-color: props.get(vars.$thumbnail--hover--border-color); opacity: 1; } @include bem.is('selected') { $focus-border-offset: calc(-1 * props.get(vars.$thumbnail--selected--border-width)); margin: $focus-border-offset; border: props.get(vars.$thumbnail--selected--border-width) solid props.get(vars.$thumbnail--selected--border-color); border-radius: calc(props.get(vars.$thumbnail--rounding) - $focus-border-offset); outline: none; opacity: 1; } &:focus-visible { $focus-border-offset: calc(-1 * props.get(vars.$thumbnail--key-focus--border-offset)); margin: $focus-border-offset; border: props.get(vars.$thumbnail--key-focus--border-offset) solid transparent; border-radius: calc(props.get(vars.$thumbnail--rounding) - $focus-border-offset); outline: props.get(vars.$thumbnail--key-focus--border-color) solid props.get(vars.$thumbnail--key-focus--border-width); outline-offset: 0; box-shadow: 0 0 0 calc(props.get(vars.$thumbnail--key-focus--outline-width) + props.get(vars.$thumbnail--key-focus--border-width)) props.get(vars.$thumbnail--key-focus--outline-color); } } @include bem.elem('thumbnail-img') { position: absolute; inset-block-start: 0; inset-inline-start: 0; display: block; inline-size: 100%; block-size: 100%; object-fit: cover; object-position: center center; } @include bem.elem('thumbnail-icon') { position: absolute; inset-block-start: 50%; inset-inline-start: 50%; transform: translate(-50%, -50%); } @include bem.elem('close-btn') { display: none; flex: 0 0 auto; margin-block-start: calc(-.5 * props.get(vars.$pad)); margin-inline: auto calc(-.5 * props.get(vars.$pad)); font-size: props.get(vars.$close-button--font-size); } @include bem.elem('nav-btn') { position: relative; display: none; align-self: center; overflow: visible; font-size: props.get(vars.$nav-button--font-size); &::before { position: absolute; inset-block-start: 50%; display: block; inline-size: props.get(vars.$nav-button--inline-size); block-size: props.get(vars.$nav-button--block-size); content: ''; transform: translateY(-50%); } @include bem.modifier('prev') { grid-area: prev; margin-inline: calc(.5 * props.get(vars.$pad)) calc(-1 * props.get(vars.$pad)); &::before { inset-inline-start: 0; } } @include bem.modifier('next') { grid-area: next; margin-inline: calc(-1 * props.get(vars.$pad)) calc(.5 * props.get(vars.$pad)); &::before { inset-inline-end: 0; } } } @include bem.modifier('interactive') { display: grid; grid-template-areas: 'header header header' 'prev content next' 'thumbnails thumbnails thumbnails'; grid-template-rows: auto minmax(0, 1fr) auto auto; grid-template-columns: auto minmax(0, 1fr) auto; @include bem.elem('img') { display: none; max-block-size: 100%; margin-inline: 0; @include bem.multi('&:target', 'is' 'visible') { display: block; } } @include bem.elem('thumbnails') { display: flex; } @include bem.elem('close-btn') { display: block; } @include bem.elem('nav-btn') { display: block; } } @each $theme in map.keys(props.get(vars.$static-themes)) { @include bem.modifier(string.slice($theme, 3)) { color: props.get(vars.$static-themes, $theme, --text); @include bem.elem('thumbnail') { outline-color: props.get(vars.$static-themes, $theme, --thumbnail, --border); &:hover, &:active, &:focus-visible { outline-color: props.get(vars.$static-themes, $theme, --thumbnail, --hover, --border); } @include bem.is('selected') { border-color: props.get(vars.$static-themes, $theme, --thumbnail, --selected, --border); } &:focus-visible { border-color: transparent; outline-color: props.get(vars.$static-themes, $theme, --thumbnail, --key-focus, --border); box-shadow: 0 0 0 calc(props.get(vars.$thumbnail--key-focus--outline-width) + props.get(vars.$thumbnail--key-focus--border-width)) props.get(vars.$static-themes, $theme, --thumbnail, --key-focus, --outline); } } } } } }