_mixins-master.scss 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. // Rem output with px fallback
  2. @mixin font-size($sizeValue: 1) {
  3. font-size: ($sizeValue * 16) * 1px;
  4. font-size: $sizeValue * 1rem;
  5. }
  6. // Center block
  7. @mixin center-block {
  8. display: block;
  9. margin-left: auto;
  10. margin-right: auto;
  11. }
  12. // Clearfix
  13. @mixin clearfix() {
  14. content: "";
  15. display: table;
  16. table-layout: fixed;
  17. }
  18. // Clear after (not all clearfix need this also)
  19. @mixin clearfix-after() {
  20. clear: both;
  21. }
  22. // Column width with margin
  23. @mixin column-width($numberColumns: 3) {
  24. width: map-get($columns, $numberColumns) - (($columns__margin * ($numberColumns - 1)) / $numberColumns);
  25. }
  26. @mixin filter-duotone {
  27. &:before {
  28. background: $color__link;
  29. mix-blend-mode: screen;
  30. opacity: 0.1;
  31. z-index: 2;
  32. }
  33. &:after {
  34. background: $color__link;
  35. mix-blend-mode: multiply;
  36. opacity: .8;
  37. z-index: 3;
  38. /* Browsers supporting mix-blend-mode don't need opacity < 1 */
  39. @supports (mix-blend-mode: multiply) {
  40. opacity: 1;
  41. }
  42. }
  43. }
  44. @mixin filter-grayscale {
  45. position: relative;
  46. filter: grayscale(100%);
  47. z-index: 1;
  48. &:after {
  49. display: block;
  50. width: 100%;
  51. height: 100%;
  52. z-index: 10;
  53. }
  54. }
  55. @mixin post-section-dash {
  56. &:before {
  57. background: $color__text-light;
  58. content: "\020";
  59. display: block;
  60. height: 2px;
  61. margin: $size__spacing-unit 0;
  62. width: 1em;
  63. }
  64. }
  65. /* If we add the border using a regular CSS border, it won't look good on non-retina devices,
  66. * since its edges can look jagged due to lack of antialiasing. In this case, we are several
  67. * layers of box-shadow to add the border visually, which will render the border smoother. */
  68. @mixin box-shadow( $size ) {
  69. box-shadow:
  70. 0 0 0 $size $color__text-light inset, // Original border.
  71. 0 0 0 ($size + 1px) $color__text-light inset, // Antialiasing, inner edge.
  72. 0 0 1px 0 rgba( $color__text-light, 0.7 ); // Antialiasing, outer edge.
  73. }
  74. /* Fallback for non-latin fonts */
  75. @mixin non-latin-fonts( $wrapper_classname: '.site' ) {
  76. /* Arabic */
  77. html[lang="ar"] #{$wrapper_classname} *,
  78. html[lang="ary"] #{$wrapper_classname} *,
  79. html[lang="azb"] #{$wrapper_classname} *,
  80. html[lang="ckb"] #{$wrapper_classname} *,
  81. html[lang="fa-IR"] #{$wrapper_classname} *,
  82. html[lang="haz"] #{$wrapper_classname} *,
  83. html[lang="ps"] #{$wrapper_classname} * {
  84. font-family: Tahoma, Arial, sans-serif !important;
  85. }
  86. /* Cyrillic */
  87. html[lang="be"] #{$wrapper_classname} *,
  88. html[lang="bg-BG"] #{$wrapper_classname} *,
  89. html[lang="kk"] #{$wrapper_classname} *,
  90. html[lang="mk-MK"] #{$wrapper_classname} *,
  91. html[lang="mn"] #{$wrapper_classname} *,
  92. html[lang="ru-RU"] #{$wrapper_classname} *,
  93. html[lang="sah"] #{$wrapper_classname} *,
  94. html[lang="sr-RS"] #{$wrapper_classname} *,
  95. html[lang="tt-RU"] #{$wrapper_classname} *,
  96. html[lang="uk"] #{$wrapper_classname} * {
  97. font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, sans-serif !important;
  98. }
  99. /* Chinese (Hong Kong) */
  100. html[lang="zh-HK"] #{$wrapper_classname} * {
  101. font-family: -apple-system, BlinkMacSystemFont, 'PingFang HK', 'Helvetica Neue', "Microsoft YaHei New", STHeiti Light, sans-serif !important;
  102. }
  103. /* Chinese (Taiwan) */
  104. html[lang="zh-TW"] #{$wrapper_classname} * {
  105. font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Helvetica Neue', "Microsoft YaHei New", STHeiti Light, sans-serif !important;
  106. }
  107. /* Chinese (China) */
  108. html[lang="zh-CN"] #{$wrapper_classname} * {
  109. font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Helvetica Neue', "Microsoft YaHei New", STHeiti Light, sans-serif !important;
  110. }
  111. /* Devanagari */
  112. html[lang="bn-BD"] #{$wrapper_classname} *,
  113. html[lang="hi-IN"] #{$wrapper_classname} *,
  114. html[lang="mr"] #{$wrapper_classname} *,
  115. html[lang="ne-NP"] #{$wrapper_classname} * {
  116. font-family: Arial, sans-serif !important;
  117. }
  118. /* Greek */
  119. html[lang="el"] #{$wrapper_classname} * {
  120. font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif !important;
  121. }
  122. /* Gujarati */
  123. html[lang="gu"] #{$wrapper_classname} * {
  124. font-family: Arial, sans-serif !important;
  125. }
  126. /* Hebrew */
  127. html[lang="he-IL"] #{$wrapper_classname} * {
  128. font-family: 'Arial Hebrew', Arial, sans-serif !important;
  129. }
  130. /* Japanese */
  131. html[lang="ja"] #{$wrapper_classname} * {
  132. font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", Meiryo, "Helvetica Neue", sans-serif !important;
  133. }
  134. /* Korean */
  135. html[lang="ko-KR"] #{$wrapper_classname} * {
  136. font-family: 'Apple SD Gothic Neo', 'Malgun Gothic', 'Nanum Gothic', Dotum, sans-serif !important;
  137. }
  138. /* Thai */
  139. html[lang="th"] #{$wrapper_classname} * {
  140. font-family: 'Sukhumvit Set', 'Helvetica Neue', helvetica, arial, sans-serif !important;
  141. }
  142. /* Vietnamese */
  143. html[lang="vi"] #{$wrapper_classname} * {
  144. font-family: 'Libre Franklin', sans-serif !important;
  145. }
  146. }
  147. /* Calculates maximum width for post content */
  148. @mixin postContentMaxWidth() {
  149. @include media(tablet) {
  150. max-width: $size__site-tablet-content;
  151. }
  152. @include media(desktop) {
  153. max-width: $size__site-desktop-content;
  154. }
  155. }
  156. /* Nested sub-menu padding: 10 levels deep */
  157. @mixin nestedSubMenuPadding() {
  158. ul {
  159. counter-reset: submenu;
  160. }
  161. ul > li > a::before {
  162. font-family: $font__body;
  163. font-weight: normal;
  164. content: "\2013\00a0" counters(submenu, "\2013\00a0", none);
  165. counter-increment: submenu
  166. }
  167. }
  168. @import "utilities";