_mixins-master.scss 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  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. /*
  57. &:before {
  58. background: $color__text-light;
  59. content: "\020";
  60. display: block;
  61. height: 2px;
  62. margin: $size__spacing-unit 0;
  63. width: 1em;
  64. }
  65. */
  66. }
  67. /* If we add the border using a regular CSS border, it won't look good on non-retina devices,
  68. * since its edges can look jagged due to lack of antialiasing. In this case, we are several
  69. * layers of box-shadow to add the border visually, which will render the border smoother. */
  70. @mixin box-shadow( $size ) {
  71. box-shadow:
  72. 0 0 0 $size $color__text-light inset, // Original border.
  73. 0 0 0 ($size + 1px) $color__text-light inset, // Antialiasing, inner edge.
  74. 0 0 1px 0 rgba( $color__text-light, 0.7 ); // Antialiasing, outer edge.
  75. }
  76. /* Fallback for non-latin fonts */
  77. @mixin non-latin-fonts( $wrapper_classname: '.site' ) {
  78. /* Arabic */
  79. html[lang="ar"] #{$wrapper_classname} *,
  80. html[lang="ary"] #{$wrapper_classname} *,
  81. html[lang="azb"] #{$wrapper_classname} *,
  82. html[lang="ckb"] #{$wrapper_classname} *,
  83. html[lang="fa-IR"] #{$wrapper_classname} *,
  84. html[lang="haz"] #{$wrapper_classname} *,
  85. html[lang="ps"] #{$wrapper_classname} * {
  86. font-family: Tahoma, Arial, sans-serif !important;
  87. }
  88. /* Cyrillic */
  89. html[lang="be"] #{$wrapper_classname} *,
  90. html[lang="bg-BG"] #{$wrapper_classname} *,
  91. html[lang="kk"] #{$wrapper_classname} *,
  92. html[lang="mk-MK"] #{$wrapper_classname} *,
  93. html[lang="mn"] #{$wrapper_classname} *,
  94. html[lang="ru-RU"] #{$wrapper_classname} *,
  95. html[lang="sah"] #{$wrapper_classname} *,
  96. html[lang="sr-RS"] #{$wrapper_classname} *,
  97. html[lang="tt-RU"] #{$wrapper_classname} *,
  98. html[lang="uk"] #{$wrapper_classname} * {
  99. font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, sans-serif !important;
  100. }
  101. /* Chinese (Hong Kong) */
  102. html[lang="zh-HK"] #{$wrapper_classname} * {
  103. font-family: -apple-system, BlinkMacSystemFont, 'PingFang HK', 'Helvetica Neue', "Microsoft YaHei New", STHeiti Light, sans-serif !important;
  104. }
  105. /* Chinese (Taiwan) */
  106. html[lang="zh-TW"] #{$wrapper_classname} * {
  107. font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Helvetica Neue', "Microsoft YaHei New", STHeiti Light, sans-serif !important;
  108. }
  109. /* Chinese (China) */
  110. html[lang="zh-CN"] #{$wrapper_classname} * {
  111. font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Helvetica Neue', "Microsoft YaHei New", STHeiti Light, sans-serif !important;
  112. }
  113. /* Devanagari */
  114. html[lang="bn-BD"] #{$wrapper_classname} *,
  115. html[lang="hi-IN"] #{$wrapper_classname} *,
  116. html[lang="mr"] #{$wrapper_classname} *,
  117. html[lang="ne-NP"] #{$wrapper_classname} * {
  118. font-family: Arial, sans-serif !important;
  119. }
  120. /* Greek */
  121. html[lang="el"] #{$wrapper_classname} * {
  122. font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif !important;
  123. }
  124. /* Gujarati */
  125. html[lang="gu"] #{$wrapper_classname} * {
  126. font-family: Arial, sans-serif !important;
  127. }
  128. /* Hebrew */
  129. html[lang="he-IL"] #{$wrapper_classname} * {
  130. font-family: 'Arial Hebrew', Arial, sans-serif !important;
  131. }
  132. /* Japanese */
  133. html[lang="ja"] #{$wrapper_classname} * {
  134. font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", Meiryo, "Helvetica Neue", sans-serif !important;
  135. }
  136. /* Korean */
  137. html[lang="ko-KR"] #{$wrapper_classname} * {
  138. font-family: 'Apple SD Gothic Neo', 'Malgun Gothic', 'Nanum Gothic', Dotum, sans-serif !important;
  139. }
  140. /* Thai */
  141. html[lang="th"] #{$wrapper_classname} * {
  142. font-family: 'Sukhumvit Set', 'Helvetica Neue', helvetica, arial, sans-serif !important;
  143. }
  144. /* Vietnamese */
  145. html[lang="vi"] #{$wrapper_classname} * {
  146. font-family: 'Libre Franklin', sans-serif !important;
  147. }
  148. }
  149. /* Calculates maximum width for post content */
  150. @mixin postContentMaxWidth() {
  151. @include media(tablet) {
  152. max-width: $size__site-tablet-content;
  153. }
  154. @include media(desktop) {
  155. max-width: $size__site-desktop-content;
  156. }
  157. }
  158. /* Nested sub-menu padding: 10 levels deep */
  159. @mixin nestedSubMenuPadding() {
  160. ul {
  161. counter-reset: submenu;
  162. }
  163. ul > li > a::before {
  164. font-family: $font__body;
  165. font-weight: normal;
  166. content: "\2013\00a0" counters(submenu, "\2013\00a0", none);
  167. counter-increment: submenu
  168. }
  169. }
  170. @import "utilities";