_structure.scss 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. /**
  2. * Site Structure
  3. *
  4. * - Set vertical margins and responsive widths on
  5. * top-level wrappers and content wrappers
  6. * - `--global--width-content` is a responsive veriable
  7. * - See: globals/_global-width-responsive.scss
  8. */
  9. /**
  10. * Top Level Wrappers (header, main, footer)
  11. * - Set vertical padding and horizontal margins
  12. */
  13. .site-header,
  14. .site-main,
  15. .site-footer {
  16. padding: map-deep-get($config-global, "spacing", "unit") map-deep-get($config-global, "spacing", "horizontal");
  17. margin-left: auto;
  18. margin-right: auto;
  19. @include media(mobile) {
  20. padding-top: map-deep-get($config-global, "spacing", "vertical");
  21. padding-right: 0;
  22. padding-bottom: map-deep-get($config-global, "spacing", "vertical");
  23. padding-left: 0;
  24. }
  25. }
  26. /**
  27. * Site-main children wrappers
  28. * - Add double vertical margins here for clearer heirarchy
  29. */
  30. .site-main > * {
  31. margin-top: calc(3 * #{map-deep-get($config-global, "spacing", "vertical")});
  32. margin-bottom: calc(3 * #{map-deep-get($config-global, "spacing", "vertical")});
  33. &:first-child {
  34. margin-top: 0;
  35. }
  36. &:last-child {
  37. margin-bottom: 0;
  38. }
  39. }
  40. /**
  41. * Major content sections (article, author-bio, pagination, comments, etc.)
  42. * - Set a maximum responsive content-width
  43. *
  44. * .responsive-max-width is a group selector replacing the following:
  45. * .site-header,
  46. * .site-main,
  47. * .site-footer
  48. * .entry-header,
  49. * .post-thumbnail,
  50. * .entry-content,
  51. * .entry-footer,
  52. * .author-bio,
  53. * .widget-area
  54. */
  55. .responsive-max-width {
  56. @extend %responsive-aligndefault;
  57. }
  58. /*
  59. * Block & non-gutenberg content wrappers
  60. * - Set margins
  61. */
  62. .entry-header,
  63. .post-thumbnail,
  64. .entry-content,
  65. .entry-footer,
  66. .author-bio,
  67. .widget-area {
  68. margin-top: map-deep-get($config-global, "spacing", "vertical");
  69. margin-right: auto;
  70. margin-bottom: map-deep-get($config-global, "spacing", "vertical");
  71. margin-left: auto;
  72. }
  73. /*
  74. * Block & non-gutenberg content wrapper children
  75. * - Sets spacing-vertical margin logic
  76. */
  77. .site-footer > *,
  78. .site-main > article > *, // apply vertical margins to article level
  79. .site-main > .not-found > *, // apply vertical margins to article level
  80. .entry-content > *,
  81. [class*="inner-container"] > *,
  82. .widget-area > * {
  83. margin-top: #{ 0.666 * map-deep-get($config-global, "spacing", "vertical") };
  84. margin-bottom: #{ 0.666 * map-deep-get($config-global, "spacing", "vertical") };
  85. @include media(mobile) {
  86. margin-top: map-deep-get($config-global, "spacing", "vertical");
  87. margin-bottom: map-deep-get($config-global, "spacing", "vertical");
  88. }
  89. &:first-child {
  90. margin-top: 0;
  91. }
  92. &:last-child {
  93. margin-bottom: 0;
  94. }
  95. }
  96. /*
  97. * Block & non-gutenberg content wrapper children
  98. * - Sets spacing-unit margins
  99. */
  100. .site-header > *,
  101. .entry-header > *,
  102. .post-thumbnail > *,
  103. .page-content > *,
  104. .comment-content > *,
  105. .author-bio > *,
  106. .widget-area > .widget > * {
  107. margin-top: map-deep-get($config-global, "spacing", "unit");
  108. margin-bottom: map-deep-get($config-global, "spacing", "unit");
  109. &:first-child {
  110. margin-top: 0;
  111. }
  112. &:last-child {
  113. margin-bottom: 0;
  114. }
  115. }
  116. /*
  117. * .entry-content children specific controls
  118. * - Adds special margin overrides for alignment utility classes
  119. */
  120. .entry-content > * {
  121. &.alignleft,
  122. &.alignright,
  123. &.alignleft:first-child + *,
  124. &.alignright:first-child + *,
  125. &.alignfull {
  126. margin-top: 0;
  127. }
  128. &:last-child,
  129. &.alignfull {
  130. margin-bottom: 0;
  131. }
  132. /* Reset alignleft and alignright margins after alignfull */
  133. &.alignfull + .alignleft {
  134. float: left;
  135. margin-top: map-deep-get($config-global, "spacing", "vertical");
  136. margin-left: #{map-deep-get($config-global, "spacing", "horizontal")};
  137. margin-right: #{map-deep-get($config-global, "spacing", "horizontal")};
  138. }
  139. &.alignfull + .alignright {
  140. float: right;
  141. margin-top: map-deep-get($config-global, "spacing", "vertical");
  142. margin-left: #{map-deep-get($config-global, "spacing", "horizontal")};
  143. margin-right: #{map-deep-get($config-global, "spacing", "horizontal")};
  144. }
  145. }