_structure.scss 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  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. .entry-content-child,
  82. [class*="inner-container"] > *,
  83. .widget-area > * {
  84. margin-top: #{ 0.666 * map-deep-get($config-global, "spacing", "vertical") };
  85. margin-bottom: #{ 0.666 * map-deep-get($config-global, "spacing", "vertical") };
  86. @include media(mobile) {
  87. margin-top: map-deep-get($config-global, "spacing", "vertical");
  88. margin-bottom: map-deep-get($config-global, "spacing", "vertical");
  89. }
  90. &:first-child {
  91. margin-top: 0;
  92. }
  93. &:last-child {
  94. margin-bottom: 0;
  95. }
  96. }
  97. /*
  98. * Block & non-gutenberg content wrapper children
  99. * - Sets spacing-unit margins
  100. */
  101. .site-header > *,
  102. .entry-header > *,
  103. .post-thumbnail > *,
  104. .page-content > *,
  105. .comment-content > *,
  106. .author-bio > *,
  107. .widget-area > .widget > * {
  108. margin-top: map-deep-get($config-global, "spacing", "unit");
  109. margin-bottom: map-deep-get($config-global, "spacing", "unit");
  110. &:first-child {
  111. margin-top: 0;
  112. }
  113. &:last-child {
  114. margin-bottom: 0;
  115. }
  116. }
  117. /*
  118. * .entry-content children specific controls
  119. * - Adds special margin overrides for alignment utility classes
  120. */
  121. .entry-content > * {
  122. &.alignleft,
  123. &.alignright,
  124. &.alignleft:first-child + *,
  125. &.alignright:first-child + *,
  126. &.alignfull {
  127. margin-top: 0;
  128. }
  129. &:last-child,
  130. &.alignfull {
  131. margin-bottom: 0;
  132. }
  133. /* Reset alignleft and alignright margins after alignfull */
  134. &.alignfull + .alignleft {
  135. float: left;
  136. margin-top: map-deep-get($config-global, "spacing", "vertical");
  137. margin-left: #{map-deep-get($config-global, "spacing", "horizontal")};
  138. margin-right: #{map-deep-get($config-global, "spacing", "horizontal")};
  139. }
  140. &.alignfull + .alignright {
  141. float: right;
  142. margin-top: map-deep-get($config-global, "spacing", "vertical");
  143. margin-left: #{map-deep-get($config-global, "spacing", "horizontal")};
  144. margin-right: #{map-deep-get($config-global, "spacing", "horizontal")};
  145. }
  146. }