hamburger.css 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  1. :root {
  2. --hamburger-size: 20px;
  3. --hamburger-padding: 10px;
  4. --hamburger-margin: 10px;
  5. --hamburger-bgcolor: rgba(0, 0, 0, .1);
  6. }
  7. /* Basic styles */
  8. #mobile-header {
  9. display: -webkit-box;
  10. display: -ms-flexbox;
  11. display: flex;
  12. -webkit-box-align: start;
  13. -ms-flex-align: start;
  14. align-items: flex-start;
  15. -webkit-box-orient: horizontal;
  16. -webkit-box-direction: reverse;
  17. -ms-flex-direction: row-reverse;
  18. flex-direction: row-reverse;
  19. right: 0;
  20. position: relative;
  21. margin: var(--tile-margin) var(--tile-margin) 0 var(--tile-margin);
  22. }
  23. /* Toggle functionality */
  24. #toggle {
  25. position: absolute;
  26. left: -100%;
  27. top: -100%;
  28. }
  29. #toggle:focus~.toggle-container .button-toggle, #toggle:checked~.toggle-container .button-toggle {
  30. -webkit-box-shadow: 0 0 0 var(--hamburger-padding) var(--hamburger-bgcolor), inset 0 0 0 var(--hamburger-padding) var(--hamburger-bgcolor);
  31. box-shadow: 0 0 0 var(--hamburger-padding) var(--hamburger-bgcolor), inset 0 0 0 var(--hamburger-padding) var(--hamburger-bgcolor);
  32. }
  33. #toggle:checked~.toggle-container .button-toggle:hover, #toggle:checked:focus~.toggle-container .button-toggle {
  34. -webkit-box-shadow: 0 0 0 var(--hamburger-padding) var(--hamburger-bgcolor), inset 0 0 0 var(--hamburger-padding) var(--hamburger-bgcolor), 0 0 0 var(--hamburger-padding) var(--hamburger-bgcolor), inset 0 0 0 var(--hamburger-padding) var(--hamburger-bgcolor);
  35. box-shadow: 0 0 0 var(--hamburger-padding) var(--hamburger-bgcolor), inset 0 0 0 var(--hamburger-padding) var(--hamburger-bgcolor), 0 0 0 var(--hamburger-padding) var(--hamburger-bgcolor), inset 0 0 0 var(--hamburger-padding) var(--hamburger-bgcolor);
  36. }
  37. #toggle:checked~.toggle-container .button-toggle::before {
  38. -webkit-transform: rotate(45deg) scale(1);
  39. transform: rotate(45deg) scale(1);
  40. }
  41. #toggle:checked~.toggle-container .button-toggle::after {
  42. -webkit-transform: rotate(-45deg) scale(1);
  43. transform: rotate(-45deg) scale(1);
  44. }
  45. #toggle:checked~.nav {
  46. margin-top: 0;
  47. margin-bottom: calc(var(--hamburger-size) + 2*var(--hamburger-padding) + 3*var(--hamburger-margin));
  48. width: 25%;
  49. pointer-events: auto;
  50. -webkit-transform: translate(calc(var(--hamburger-padding) + var(--hamburger-size)), calc(var(--hamburger-size) + 2*(var(--hamburger-padding) + var(--hamburger-margin))));
  51. transform: translate(calc(var(--hamburger-padding) + var(--hamburger-size)), calc(var(--hamburger-size) + 2*(var(--hamburger-padding) + var(--hamburger-margin))));
  52. }
  53. #toggle:checked~.nav .nav-item, #toggle:checked~.nav .nav-subitem {
  54. font-family: 'akrobat-regular';
  55. color: black;
  56. width: auto;
  57. height: 2.5em;
  58. line-height: 3em;
  59. text-align: right;
  60. margin: 0;
  61. opacity: 1;
  62. -webkit-transform: scaleY(1);
  63. transform: scaleY(1);
  64. -webkit-transition: .5s, opacity .1s;
  65. transition: .5s, opacity .1s;
  66. }
  67. #toggle:checked~.nav .nav-item:nth-child(1), #toggle:checked~.nav .nav-item:nth-child(1)::before {
  68. -webkit-transition-delay: .15s;
  69. transition-delay: .15s;
  70. }
  71. #toggle:checked~.nav .nav-subitem, #toggle:checked~.nav .nav-subitem::before {
  72. -webkit-transition-delay: .01s;
  73. transition-delay: .01s;
  74. right: 1em;
  75. }
  76. #toggle:checked~.nav .nav-item:nth-child(3), #toggle:checked~.nav .nav-item:nth-child(3)::before {
  77. -webkit-transition-delay: .05s;
  78. transition-delay: .05s;
  79. }
  80. #toggle:checked~.nav .nav-item:nth-child(4), #toggle:checked~.nav .nav-item:nth-child(4)::before {
  81. -webkit-transition-delay: 0s;
  82. transition-delay: 0s;
  83. }
  84. #toggle:checked~.nav .nav-item::before, #toggle:checked~.nav .nav-subitem::before {
  85. opacity: 0;
  86. }
  87. /* Toggle button */
  88. .button-toggle {
  89. position: relative;
  90. display: inline-block;
  91. right: 0;
  92. width: var(--hamburger-size);
  93. height: var(--hamburger-size);
  94. margin: calc(var(--hamburger-margin) + var(--hamburger-padding)) var(--hamburger-padding);
  95. -webkit-box-shadow: 0 0 0 var(--hamburger-padding) var(--hamburger-bgcolor), inset 0 0 0 var(--hamburger-padding) var(--hamburger-bgcolor);
  96. box-shadow: 0 0 0 var(--hamburger-padding) var(--hamburger-bgcolor), inset 0 0 0 var(--hamburger-padding) var(--hamburger-bgcolor);
  97. border: none;
  98. cursor: pointer;
  99. border-radius: 100%;
  100. -webkit-transition: .6s;
  101. transition: .6s;
  102. }
  103. /* button X container (toggled) */
  104. .button-toggle::before, .button-toggle::after {
  105. position: absolute;
  106. content: '';
  107. top: 50%;
  108. /* left: 0; */
  109. right: 0;
  110. width: 100%;
  111. height: 2px;
  112. background-color: black;
  113. border-radius: 5px;
  114. -webkit-transition: .5s;
  115. transition: .5s;
  116. }
  117. /* button \ container */
  118. .button-toggle::before {
  119. -webkit-transform: rotate(45deg) scale(0);
  120. transform: rotate(45deg) scale(0);
  121. }
  122. /* button / container */
  123. .button-toggle::after {
  124. -webkit-transform: rotate(-45deg) scale(0);
  125. transform: rotate(-45deg) scale(0);
  126. }
  127. /* Menu */
  128. .nav {
  129. display: block;
  130. -webkit-transform: translateX(calc(var(--hamburger-size) + var(--hamburger-padding)));
  131. transform: translateX(calc(var(--hamburger-size) + var(--hamburger-padding)));
  132. margin: calc(var(--hamburger-margin) + var(--hamburger-padding)) 0;
  133. width: var(--hamburger-size);
  134. pointer-events: none;
  135. -webkit-transition: .5s;
  136. transition: .5s;
  137. }
  138. .nav .itemize {
  139. display: -webkit-box;
  140. display: -ms-flexbox;
  141. display: flex;
  142. -webkit-box-align: end;
  143. -ms-flex-align: end;
  144. align-items: flex-end;
  145. -webkit-box-orient: vertical;
  146. -webkit-box-direction: normal;
  147. -ms-flex-direction: column;
  148. flex-direction: column;
  149. padding: 0;
  150. margin: 0;
  151. }
  152. /* menu entries initial state */
  153. .nav-item, .nav-subitem {
  154. display: -webkit-box;
  155. display: -ms-flexbox;
  156. display: flex;
  157. -webkit-box-orient: horizontal;
  158. -webkit-box-direction: reverse;
  159. -ms-flex-direction: row-reverse;
  160. flex-direction: row-reverse;
  161. -webkit-box-align: end;
  162. -ms-flex-align: end;
  163. align-items: flex-end;
  164. margin: 0;
  165. width: 100%;
  166. position: relative;
  167. clear: both;
  168. color: transparent;
  169. height: 7px;
  170. line-height: 7px;
  171. white-space: nowrap;
  172. -webkit-transform: scaleY(.2);
  173. transform: scaleY(.2);
  174. -webkit-transition: .5s, opacity .1s;
  175. transition: .5s, opacity .1s;
  176. }
  177. .nav-item:nth-child(1), .nav-item:nth-child(1)::before {
  178. -webkit-transition-delay: 0s;
  179. transition-delay: 0s;
  180. }
  181. .nav-subitem, .nav-subitem::before {
  182. opacity: 0;
  183. height: 0;
  184. -webkit-transition-delay: .05s;
  185. transition-delay: .05s;
  186. }
  187. .nav-item:nth-child(3), .nav-item:nth-child(3)::before {
  188. -webkit-transition-delay: .1s;
  189. transition-delay: .1s;
  190. }
  191. .nav-item:nth-child(4), .nav-item:nth-child(4)::before {
  192. -webkit-transition-delay: .15s;
  193. transition-delay: .15s;
  194. }
  195. .nav-item::before, .nav-subitem::before {
  196. position: absolute;
  197. content: '';
  198. top: 50%;
  199. width: 100%;
  200. border-radius: 5px;
  201. height: 2px;
  202. background-color: black;
  203. -webkit-transform: scaleY(5);
  204. transform: scaleY(5);
  205. -webkit-transition: .5s;
  206. transition: .5s;
  207. }