_structure.scss 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  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. margin-top: map-deep-get($config-global, "spacing", "unit");
  107. margin-bottom: map-deep-get($config-global, "spacing", "unit");
  108. &:first-child {
  109. margin-top: 0;
  110. }
  111. &:last-child {
  112. margin-bottom: 0;
  113. }
  114. }
  115. /*
  116. * .entry-content children specific controls
  117. * - Adds special margin overrides for alignment utility classes
  118. */
  119. .entry-content > * {
  120. &.alignleft,
  121. &.alignright,
  122. &.alignleft:first-child + *,
  123. &.alignright:first-child + *,
  124. &.alignfull {
  125. margin-top: 0;
  126. }
  127. &:last-child,
  128. &.alignfull {
  129. margin-bottom: 0;
  130. }
  131. /* Reset alignleft and alignright margins after alignfull */
  132. &.alignfull + .alignleft,
  133. &.alignfull + .alignright {
  134. margin-top: map-deep-get($config-global, "spacing", "vertical");
  135. }
  136. }