@use 'sass:map'; @use 'sass:meta'; @use 'sass:string'; @use 'iro-sass/src/iro-sass' as iro; @use '../props'; @forward 'lightbox.vars'; @use 'lightbox.vars' as vars; @mixin styles { @include props.materialize(meta.module-variables('vars')); @include iro.bem-object('lightbox') { box-sizing: border-box; display: grid; flex: 1 1 auto; grid-template-areas: 'header header header' 'prev content next' 'thumbnails thumbnails thumbnails' 'footer footer footer'; grid-template-rows: auto minmax(0, 1fr) auto auto; grid-template-columns: auto minmax(0, 1fr) auto; min-block-size: 0; @include iro.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 iro.bem-elem('img') { box-sizing: border-box; display: none; grid-area: content; place-self: center; max-inline-size: 100%; max-block-size: 100%; padding: props.get(vars.$pad); @include iro.bem-sibling-elem('img') { @include iro.bem-modifier('default') { display: block; @include iro.bem-next-elem('nav-btn') { display: block; @include iro.bem-next-elem('nav-btn') { display: block; } } } } @include iro.bem-multi('&:target', 'is' 'visible') { display: block; @include iro.bem-next-elem('nav-btn') { display: block; @include iro.bem-next-elem('nav-btn') { display: block; } } @include iro.bem-sibling-elem('img') { @include iro.bem-modifier('default') { display: none; @include iro.bem-next-elem('nav-btn') { display: none; @include iro.bem-next-elem('nav-btn') { display: none; } } } } } } @include iro.bem-elem('thumbnails') { display: flex; 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 iro.bem-elem('footer') { display: flex; grid-area: footer; align-items: flex-start; padding-block: 0 props.get(vars.$pad); padding-inline: props.get(vars.$pad); } @include iro.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 iro.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 iro.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 iro.bem-elem('thumbnail-icon') { position: absolute; inset-block-start: 50%; inset-inline-start: 50%; transform: translate(-50%, -50%); } @include iro.bem-elem('close-btn') { 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 iro.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 iro.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 iro.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; } } } @each $theme in map.keys(props.get(vars.$static-themes)) { @include iro.bem-modifier(string.slice($theme, 3)) { color: props.get(vars.$static-themes, $theme, --text); @include iro.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 iro.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); } } } } } }