You are here

header-navigation.pcss.css in Drupal 10

Same filename and directory in other branches
  1. 9 core/themes/olivero/css/components/header-navigation.pcss.css

Navigation in header.

File

core/themes/olivero/css/components/header-navigation.pcss.css
View source
  1. /**
  2. * @file
  3. * Navigation in header.
  4. */
  5. @import "../base/media-queries.pcss.css";
  6. .header-nav {
  7. position: fixed;
  8. z-index: 501; /* Appear above overlay and contextual links in header. */
  9. inset-block-start: 0;
  10. inset-inline-start: 100%;
  11. visibility: hidden;
  12. overflow: auto;
  13. /* Ensure that header nav not use additional space and force system branding
  14. * block text to unnecessarily wrap. */
  15. flex-basis: max-content;
  16. width: 100%;
  17. max-width: var(--mobile-nav-width);
  18. height: 100%;
  19. padding-block: 0 var(--sp);
  20. padding-inline-start: var(--sp);
  21. padding-inline-end: var(--sp);
  22. /* Create room for the "close" button. We cannot use margin because the
  23. * mobile navigation needs to slide beneath the button, but we also cannot
  24. * use padding because that would enable the button to scroll out of the
  25. * viewport on short screens. */
  26. border-block-start: solid var(--color--white) calc(var(--sp3) + var(--drupal-displace-offset-top, 0px));
  27. background-color: var(--color--white);
  28. box-shadow: 0 0 72px rgba(0, 0, 0, 0.1);
  29. &.is-active {
  30. visibility: visible;
  31. transform: translateX(-100%); /* LTR */
  32. &:dir(rtl) {
  33. transform: translateX(100%);
  34. }
  35. }
  36. @media (--sm) {
  37. border-top-width: calc(var(--sp5) + var(--drupal-displace-offset-top, 0px));
  38. }
  39. @media (--md) {
  40. padding-block-end: var(--sp3);
  41. padding-inline-start: var(--sp3);
  42. border-top-width: calc(var(--sp7) + var(--drupal-displace-offset-top, 0px));
  43. }
  44. @media (--lg) {
  45. grid-column: 5 / 14;
  46. }
  47. /*
  48. * Ensure top border has the same color as the background when in forced colors.
  49. */
  50. @media (forced-colors: active) {
  51. border-top-color: canvas;
  52. }
  53. }
  54. /*
  55. * Only apply transition styles when JS is loaded. This
  56. * works around https://bugs.chromium.org/p/chromium/issues/detail?id=332189
  57. */
  58. html.js .header-nav {
  59. transition: visibility 0.2s, transform 0.2s;
  60. }
  61. body:not(.is-always-mobile-nav) .header-nav {
  62. @media (--nav) {
  63. position: static;
  64. display: flex;
  65. visibility: visible;
  66. overflow: visible;
  67. grid-column: 5 / 15;
  68. align-items: center;
  69. justify-content: flex-end;
  70. max-width: none;
  71. height: var(--header-height-wide-when-fixed);
  72. margin-block-start: auto;
  73. padding-block: 0;
  74. padding-inline-start: 0;
  75. padding-inline-end: 0;
  76. transition: transform 0.2s;
  77. transform: none;
  78. border-block-start: 0;
  79. box-shadow: none;
  80. }
  81. }
  82. body.is-always-mobile-nav {
  83. & .header-nav {
  84. @media (--nav) {
  85. overflow: auto;
  86. max-width: calc((7 * (var(--grid-col-width) + var(--grid-gap))));
  87. padding-inline-end: var(--sp);
  88. transition: transform 0.2s, visibility 0.2s;
  89. border-top-width: calc(var(--drupal-displace-offset-top, 0px) + var(--sp11));
  90. }
  91. @media (--grid-max) {
  92. max-width: calc(100vw - (var(--max-width) + var(--content-left)) + ((7 * (var(--grid-col-width) + var(--grid-gap)))));
  93. padding-inline-end: calc(100vw - (var(--max-width) + var(--content-left) - var(--sp)));
  94. }
  95. }
  96. }
  97. .header-nav-overlay {
  98. position: fixed;
  99. z-index: 101;
  100. inset-block-start: 0;
  101. inset-inline-start: 0;
  102. display: none;
  103. width: 100%;
  104. height: 100vh;
  105. opacity: 0.2;
  106. background: var(--color--gray-5);
  107. @media (forced-colors: active) {
  108. background: canvastext;
  109. }
  110. @nest .is-overlay-active & {
  111. display: block;
  112. }
  113. }