//// /// Copyright (c) 2016-2020 Martin Donath /// /// Permission is hereby granted, free of charge, to any person obtaining a /// copy of this software and associated documentation files (the "Software"), /// to deal in the Software without restriction, including without limitation /// the rights to use, copy, modify, merge, publish, distribute, sublicense, /// and/or sell copies of the Software, and to permit persons to whom the /// Software is furnished to do so, subject to the following conditions: /// /// The above copyright notice and this permission notice shall be included in /// all copies or substantial portions of the Software. /// /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, /// FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL /// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING /// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER /// DEALINGS //// // ---------------------------------------------------------------------------- // Rules // ---------------------------------------------------------------------------- // Application header (stays always on top) .md-header { position: sticky; top: 0; right: 0; left: 0; z-index: 2; height: px2rem(48px); color: var(--md-primary-bg-color); background-color: var(--md-primary-fg-color); // Hack: reduce jitter by adding a transparent box shadow of the same size // so the size of the layer doesn't change during animation box-shadow: 0 0 px2rem(4px) rgba(0, 0, 0, 0), 0 px2rem(4px) px2rem(8px) rgba(0, 0, 0, 0); transition: color 250ms, background-color 250ms; // Always hide shadow, in case JavaScript is not available .no-js & { box-shadow: none; transition: none; } // Show and animate shadow &[data-md-state="shadow"] { box-shadow: 0 0 px2rem(4px) rgba(0, 0, 0, 0.1), 0 px2rem(4px) px2rem(8px) rgba(0, 0, 0, 0.2); transition: color 250ms, background-color 250ms, box-shadow 250ms; } // Hide for print @media print { display: none; } } // Navigation within header .md-header-nav { display: flex; padding: 0 px2rem(4px); // Icon buttons &__button { position: relative; z-index: 1; display: block; margin: px2rem(4px); padding: px2rem(8px); cursor: pointer; transition: opacity 250ms; // Adjust for right-to-left languages [dir="rtl"] & { // Flip icon vertically svg { transform: scaleX(-1); } } // Focused or hovered icon &:focus, &:hover { opacity: 0.7; } // Logo &.md-logo { margin: px2rem(4px); padding: px2rem(8px); // Image or icon img, svg { display: block; width: px2rem(24px); height: px2rem(24px); fill: currentColor; } } // Hide search icon, if JavaScript is not available. .no-js &[for="__search"] { display: none; } // [tablet landscape +]: Hide the search button @include break-from-device(tablet landscape) { // Search button &[for="__search"] { display: none; } } // [tablet -]: Hide the logo @include break-to-device(tablet) { // Logo &.md-logo { display: none; } } // [screen +]: Hide the menu button @include break-from-device(screen) { // Menu button &[for="__drawer"] { display: none; } } } // Header topics &__topic { position: absolute; width: 100%; transition: transform 400ms cubic-bezier(0.1, 0.7, 0.1, 1), opacity 150ms; // Adjust for right-to-left languages [dir="rtl"] & { padding-right: px2rem(20px); padding-left: initial; } // Page title & + & { z-index: -1; transform: translateX(px2rem(25px)); opacity: 0; transition: transform 400ms cubic-bezier(1, 0.7, 0.1, 0.1), opacity 150ms; pointer-events: none; // Adjust for right-to-left languages [dir="rtl"] & { transform: translateX(px2rem(-25px)); } } // Induce ellipsis, if no JavaScript is available .no-js & { position: initial; } // Hide page title as it is invisible anyway and will overflow the header .no-js & + & { display: none; } } // Header title - set line height to match icon for correct alignment &__title { flex-grow: 1; padding: 0 px2rem(20px); font-size: px2rem(18px); line-height: px2rem(48px); // Show page title &[data-md-state="active"] .md-header-nav__topic { z-index: -1; transform: translateX(px2rem(-25px)); opacity: 0; transition: transform 400ms cubic-bezier(1, 0.7, 0.1, 0.1), opacity 150ms; pointer-events: none; // Adjust for right-to-left languages [dir="rtl"] & { transform: translateX(px2rem(25px)); } // Page title & + .md-header-nav__topic { z-index: 0; transform: translateX(0); opacity: 1; transition: transform 400ms cubic-bezier(0.1, 0.7, 0.1, 1), opacity 150ms; pointer-events: initial; } } // Patch ellipsis > .md-header-nav__ellipsis { position: relative; width: 100%; height: 100%; } } // Repository containing source &__source { display: none; // [tablet landscape +]: Show the reposistory from tablet @include break-from-device(tablet landscape) { display: block; width: px2rem(234px); max-width: px2rem(234px); margin-left: px2rem(20px); // Adjust for right-to-left languages [dir="rtl"] & { margin-right: px2rem(20px); margin-left: initial; } } // [screen +]: Increase spacing of search bar @include break-from-device(screen) { margin-left: px2rem(28px); // Adjust for right-to-left languages [dir="rtl"] & { margin-right: px2rem(28px); } } } }