_mixins-master.scss 5.6 KB

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