_site-featured-image.scss 5.7 KB

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