| 1 |
/** |
| 2 |
* Frontend Styles |
| 3 |
*/ |
| 4 |
@import "./variables"; |
| 5 |
|
| 6 |
// Rows |
| 7 |
// Rows contain and clear the floats of your columns. |
| 8 |
.ghostkit-grid-inner { |
| 9 |
display: flex; |
| 10 |
flex-wrap: wrap; |
| 11 |
row-gap: var(--gkt-grid__gap-vertical); |
| 12 |
justify-content: var(--gkt-grid__justify-content); |
| 13 |
margin-left: calc(-1 * var(--gkt-grid__gap)); |
| 14 |
} |
| 15 |
|
| 16 |
// Fixes conflict with AWB backgrounds and gaps. |
| 17 |
// @thanks https://github.com/nk-crew/ghostkit/issues/104 |
| 18 |
.ghostkit-grid, |
| 19 |
.ghostkit-col { |
| 20 |
padding-top: 0.02px; |
| 21 |
} |
| 22 |
|
| 23 |
// Columns |
| 24 |
// Common styles for small and large grid columns |
| 25 |
// Common properties for all breakpoints |
| 26 |
.ghostkit-col { |
| 27 |
position: relative; |
| 28 |
display: flex; |
| 29 |
flex: var(--gkt-grid--column__flex); |
| 30 |
// Fix for previous columns implementation without .ghostkit-col-content |
| 31 |
flex-wrap: wrap; |
| 32 |
order: var(--gkt-grid--column__order); |
| 33 |
width: var(--gkt-grid--column__width); |
| 34 |
max-width: var(--gkt-grid--column__max-width); |
| 35 |
min-height: 1px; // Prevent columns from collapsing when empty |
| 36 |
margin-left: var(--gkt-grid__gap); |
| 37 |
} |
| 38 |
|
| 39 |
.ghostkit-col-content { |
| 40 |
align-self: var(--gkt-grid--column__align-self); |
| 41 |
width: 100%; |
| 42 |
} |
| 43 |
|
| 44 |
@each $breakpoint in map-keys($grid-breakpoints) { |
| 45 |
@include media-breakpoint-down($breakpoint) { |
| 46 |
/* stylelint-disable-next-line function-no-unknown */ |
| 47 |
$infix: breakpoint-infix($breakpoint, $grid-breakpoints); |
| 48 |
|
| 49 |
// Auto flexbox columns |
| 50 |
.ghostkit-col#{$infix} { |
| 51 |
--gkt-grid--column__flex: 0 0 auto; |
| 52 |
--gkt-grid--column__width: auto; |
| 53 |
--gkt-grid--column__max-width: 100%; |
| 54 |
} |
| 55 |
|
| 56 |
// Grow flexbox columns |
| 57 |
.ghostkit-col#{$infix}-grow { |
| 58 |
--gkt-grid--column__flex: 1 0 0; |
| 59 |
--gkt-grid--column__width: 100%; |
| 60 |
--gkt-grid--column__max-width: none; |
| 61 |
} |
| 62 |
|
| 63 |
// col size. |
| 64 |
@for $i from 1 through $grid-columns { |
| 65 |
.ghostkit-col#{$infix}-#{$i} { |
| 66 |
--gkt-grid--column__size: calc(100% * (#{$i} / #{$grid-columns})); |
| 67 |
--gkt-grid--column__size-with-gap: calc(var(--gkt-grid--column__size) - var(--gkt-grid__gap)); |
| 68 |
--gkt-grid--column__flex: 0 0 var(--gkt-grid--column__size-with-gap); |
| 69 |
--gkt-grid--column__width: var(--gkt-grid--column__size-with-gap); |
| 70 |
--gkt-grid--column__max-width: var(--gkt-grid--column__size-with-gap); |
| 71 |
} |
| 72 |
} |
| 73 |
|
| 74 |
// col order. |
| 75 |
.ghostkit-col-order#{$infix}-first { |
| 76 |
--gkt-grid--column__order: -1; |
| 77 |
} |
| 78 |
.ghostkit-col-order#{$infix}-last { |
| 79 |
--gkt-grid--column__order: #{$grid-columns + 1}; |
| 80 |
} |
| 81 |
|
| 82 |
@for $i from 0 through $grid-columns { |
| 83 |
.ghostkit-col-order#{$infix}-#{$i} { |
| 84 |
--gkt-grid--column__order: #{$i}; |
| 85 |
} |
| 86 |
} |
| 87 |
} |
| 88 |
} |
| 89 |
|
| 90 |
// Vertical align. |
| 91 |
.ghostkit-grid-align-items-start { |
| 92 |
--gkt-grid--column__align-self: flex-start; |
| 93 |
} |
| 94 |
|
| 95 |
.ghostkit-grid-align-items-center { |
| 96 |
--gkt-grid--column__align-self: center; |
| 97 |
} |
| 98 |
|
| 99 |
.ghostkit-grid-align-items-end { |
| 100 |
--gkt-grid--column__align-self: flex-end; |
| 101 |
} |
| 102 |
|
| 103 |
// Vertical align column. |
| 104 |
@each $breakpoint in map-keys($grid-breakpoints) { |
| 105 |
@include media-breakpoint-down($breakpoint) { |
| 106 |
/* stylelint-disable-next-line function-no-unknown */ |
| 107 |
$infix: breakpoint-infix($breakpoint, $grid-breakpoints); |
| 108 |
|
| 109 |
.ghostkit-col-align-self#{$infix}-start { |
| 110 |
--gkt-grid--column__align-self: flex-start; |
| 111 |
} |
| 112 |
.ghostkit-col-align-self#{$infix}-center { |
| 113 |
--gkt-grid--column__align-self: center; |
| 114 |
} |
| 115 |
.ghostkit-col-align-self#{$infix}-end { |
| 116 |
--gkt-grid--column__align-self: flex-end; |
| 117 |
} |
| 118 |
} |
| 119 |
} |
| 120 |
|
| 121 |
// Horizontal align. |
| 122 |
.ghostkit-grid-justify-content-center { |
| 123 |
--gkt-grid__justify-content: center; |
| 124 |
} |
| 125 |
|
| 126 |
.ghostkit-grid-justify-content-end { |
| 127 |
--gkt-grid__justify-content: flex-end; |
| 128 |
} |
| 129 |
|
| 130 |
.ghostkit-grid-justify-content-around { |
| 131 |
--gkt-grid__justify-content: space-around; |
| 132 |
} |
| 133 |
|
| 134 |
.ghostkit-grid-justify-content-between { |
| 135 |
--gkt-grid__justify-content: space-between; |
| 136 |
} |
| 137 |
|
| 138 |
// Gaps. |
| 139 |
@each $name, $size in $grid-gaps { |
| 140 |
.ghostkit-grid-gap-#{$name} { |
| 141 |
--gkt-grid__gap: #{$size}; |
| 142 |
} |
| 143 |
} |
| 144 |
|
| 145 |
// Columns Sticky. |
| 146 |
.ghostkit-col-sticky-top > .ghostkit-col-content { |
| 147 |
position: sticky; |
| 148 |
top: var(--gkt-grid--column-sticky__offset); |
| 149 |
} |
| 150 |
|
| 151 |
.ghostkit-col-sticky-bottom { |
| 152 |
display: flex; |
| 153 |
flex-direction: column; |
| 154 |
|
| 155 |
> .ghostkit-col-content { |
| 156 |
position: sticky; |
| 157 |
bottom: var(--gkt-grid--column-sticky__offset); |
| 158 |
margin-top: auto; |
| 159 |
} |
| 160 |
} |
| 161 |
|
| 162 |
// AWB backgrounds |
| 163 |
.ghostkit-grid-with-bg, |
| 164 |
.ghostkit-col-with-bg { |
| 165 |
position: relative; |
| 166 |
z-index: 0; |
| 167 |
|
| 168 |
> .nk-awb { |
| 169 |
&, |
| 170 |
.nk-awb-inner, |
| 171 |
.nk-awb-overlay, |
| 172 |
.nk-awb-wrap { |
| 173 |
position: absolute; |
| 174 |
top: 0; |
| 175 |
right: 0; |
| 176 |
bottom: 0; |
| 177 |
left: 0; |
| 178 |
z-index: -99; |
| 179 |
margin: 0; |
| 180 |
} |
| 181 |
|
| 182 |
.nk-awb-wrap { |
| 183 |
overflow: hidden; |
| 184 |
} |
| 185 |
|
| 186 |
/* Fix for Safari */ |
| 187 |
.nk-awb-overlay { |
| 188 |
z-index: 0; |
| 189 |
} |
| 190 |
|
| 191 |
/* Background sizes */ |
| 192 |
.nk-awb-inner { |
| 193 |
z-index: -100; |
| 194 |
background-repeat: no-repeat; |
| 195 |
background-position: 50% 50%; |
| 196 |
background-size: cover; |
| 197 |
} |
| 198 |
|
| 199 |
[data-awb-image-background-size="contain"]="contain""] > .nk-awb-inner { |
| 200 |
background-size: contain; |
| 201 |
} |
| 202 |
|
| 203 |
[data-awb-image-background-size="pattern"]="pattern""] > .nk-awb-inner { |
| 204 |
background-repeat: repeat; |
| 205 |
background-size: auto; |
| 206 |
} |
| 207 |
|
| 208 |
/* Image sizes */ |
| 209 |
.nk-awb-inner > .jarallax-img { |
| 210 |
position: absolute; |
| 211 |
top: 0; |
| 212 |
left: 0; |
| 213 |
z-index: -100; |
| 214 |
width: 100%; |
| 215 |
height: 100%; |
| 216 |
pointer-events: none; |
| 217 |
object-fit: cover; |
| 218 |
} |
| 219 |
|
| 220 |
[data-awb-image-background-size="contain"]="contain""] > .nk-awb-inner > .jarallax-img { |
| 221 |
object-fit: contain; |
| 222 |
} |
| 223 |
} |
| 224 |
} |
| 225 |
|