_site-featured-image.scss 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285
  1. // Featured image styles
  2. .site-header.featured-image {
  3. /* Hide overflow for overflowing featured image */
  4. overflow: hidden;
  5. /* Need relative positioning to properly align layers. */
  6. position: relative;
  7. /* Add text shadow to text, to increase readability. */
  8. text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  9. /* Set white text color when featured image is set. */
  10. .site-branding .site-title,
  11. .site-branding .site-description,
  12. .main-navigation a:after,
  13. .main-navigation .main-menu > li.menu-item-has-children:after,
  14. .main-navigation li,
  15. .social-navigation li,
  16. .entry-meta,
  17. .entry-title {
  18. color: $color__background-body;
  19. }
  20. .main-navigation a,
  21. .main-navigation a + svg,
  22. .social-navigation a,
  23. .site-title a,
  24. .site-featured-image a {
  25. color: $color__background-body;
  26. transition: opacity $link_transition ease-in-out;
  27. &:hover,
  28. &:active,
  29. &:hover + svg,
  30. &:active + svg {
  31. color: $color__background-body;
  32. opacity: 0.6;
  33. }
  34. &:focus,
  35. &:focus + svg {
  36. color: $color__background-body;
  37. }
  38. }
  39. /* add focus state to social media icons */
  40. .social-navigation a {
  41. &:focus {
  42. color: $color__background-body;
  43. opacity: 1;
  44. border-bottom: 1px solid $color__background-body;
  45. }
  46. }
  47. .social-navigation svg,
  48. .site-featured-image svg {
  49. /* Use -webkit- only if supporting: Chrome < 54, iOS < 9.3, Android < 4.4.4 */
  50. -webkit-filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.35) );
  51. filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.35) );
  52. }
  53. /* Entry header */
  54. .site-featured-image {
  55. /* First layer: grayscale. */
  56. .post-thumbnail img {
  57. height: auto;
  58. left: 50%;
  59. max-width: 1000%;
  60. min-height: 100%;
  61. min-width: 100vw;
  62. position: absolute;
  63. top: 50%;
  64. transform: translateX(-50%) translateY(-50%);
  65. width: auto;
  66. z-index: 1;
  67. @supports ( object-fit: cover ) {
  68. height: 100%;
  69. left: 0;
  70. object-fit: cover;
  71. top: 0;
  72. transform: none;
  73. width: 100%;
  74. }
  75. /* When image filters are active, make it grayscale to colorize it blue. */
  76. .image-filters-enabled & {
  77. filter: grayscale(100%);
  78. }
  79. }
  80. .entry-header {
  81. @include postContentMaxWidth()
  82. margin-top: calc( 4 * #{$size__spacing-unit});
  83. margin-bottom: 0;
  84. margin-left: 0;
  85. margin-right: 0;
  86. @include media (tablet) {
  87. margin-left: auto;
  88. margin-right: auto;
  89. }
  90. .entry-title {
  91. &:before {
  92. background: $color__background-body;
  93. }
  94. }
  95. /* Entry meta */
  96. .entry-meta {
  97. font-weight: 500;
  98. > span {
  99. margin-right: $size__spacing-unit;
  100. display: inline-block;
  101. &:last-child {
  102. margin-right: 0;
  103. }
  104. }
  105. a {
  106. @include link-transition;
  107. color: currentColor;
  108. &:hover {
  109. text-decoration: none;
  110. }
  111. }
  112. .svg-icon {
  113. position: relative;
  114. display: inline-block;
  115. vertical-align: middle;
  116. margin-right: 0.5em;
  117. }
  118. .discussion-avatar-list {
  119. display: none;
  120. }
  121. }
  122. &.has-discussion {
  123. @include media (tablet) {
  124. .entry-meta {
  125. display: flex;
  126. position: relative;
  127. }
  128. .entry-title {
  129. padding-right: calc(1 * (100vw / 12) + #{$size__spacing-unit});
  130. }
  131. .entry-meta .comment-count {
  132. position: absolute;
  133. right: 0;
  134. }
  135. .entry-meta .discussion-avatar-list {
  136. display: block;
  137. position: absolute;
  138. bottom: 100%;
  139. }
  140. }
  141. }
  142. }
  143. }
  144. /* Make sure important elements are above pseudo elements used for effects. */
  145. .site-branding {
  146. position: relative;
  147. z-index: 10;
  148. }
  149. .site-featured-image .entry-header {
  150. position: relative;
  151. z-index: 9;
  152. }
  153. /* Set up image filter layer positioning */
  154. .site-branding-container:after,
  155. .site-featured-image:before,
  156. .site-featured-image:after,
  157. &:after {
  158. display: block;
  159. position: absolute;
  160. top: 0; left: 0;
  161. content: "\020";
  162. width: 100%;
  163. height: 100%;
  164. }
  165. /* Background & Effects */
  166. /* Shared background settings between pseudo elements. */
  167. background-position: center;
  168. background-repeat: no-repeat;
  169. background-size: cover;
  170. /* The intensity of each blend mode is controlled via layer opacity. */
  171. /* Second layer: screen. */
  172. .image-filters-enabled & .site-featured-image:before {
  173. background: $color__link;
  174. mix-blend-mode: screen;
  175. opacity: 0.1;
  176. }
  177. /* Third layer: multiply. */
  178. /* When image filters are inactive, a black overlay is added. */
  179. .site-featured-image:after {
  180. background: #000;
  181. mix-blend-mode: multiply;
  182. opacity: .7;
  183. /* When image filters are active, a blue overlay is added. */
  184. .image-filters-enabled & {
  185. background: $color__link;
  186. opacity: .8;
  187. z-index: 3;
  188. /* Browsers supporting mix-blend-mode don't need opacity < 1 */
  189. @supports (mix-blend-mode: multiply) {
  190. opacity: 1;
  191. }
  192. }
  193. }
  194. /* Fourth layer: overlay. */
  195. .image-filters-enabled & .site-branding-container:after {
  196. background: rgba(0, 0, 0, 0.35);
  197. mix-blend-mode: overlay;
  198. opacity: 0.5;
  199. z-index: 4;
  200. /* Browsers supporting mix-blend-mode can have a light overlay */
  201. @supports (mix-blend-mode: overlay) {
  202. background: rgba($color__background-body, 0.35);
  203. }
  204. }
  205. /* Fifth layer: readability overlay */
  206. &:after {
  207. background: #000;
  208. /**
  209. * Add a transition to the readability overlay, to add a subtle
  210. * but smooth effect when resizing the screen.
  211. */
  212. transition: opacity 1200ms ease-in-out;
  213. opacity: 0.7;
  214. z-index: 5;
  215. /* When image filters are active, a blue overlay is added. */
  216. .image-filters-enabled & {
  217. background: mix($color__link, black, 12%);
  218. opacity: 0.38;
  219. @include media(tablet) {
  220. opacity: 0.18;
  221. }
  222. }
  223. }
  224. ::-moz-selection {
  225. background: rgba($color__background-body, 0.17);
  226. }
  227. ::selection {
  228. background: rgba($color__background-body, 0.17);
  229. }
  230. }