Files
blog/sass/_nav.scss
2024-10-26 18:13:34 +03:00

423 lines
12 KiB
SCSS

#site-nav {
position: sticky;
z-index: 999;
margin: 1rem auto;
inset-block-start: 1rem;
border-radius: 1.625rem;
max-width: 90%;
@media only screen and (max-width: 480px) {
position: relative;
inset-block-start: 0;
}
&::before {
-webkit-backdrop-filter: var(--blur);
position: absolute;
z-index: -1;
backdrop-filter: var(--blur);
inset: 0;
box-shadow: var(--edge-highlight), var(--shadow-glass);
border-radius: 1.625rem;
background-color: var(--glass-bg);
content: "";
}
nav {
padding: 0.5rem;
#main-content {
-webkit-backdrop-filter: var(--blur);
position: absolute;
left: 50%;
transform: translateX(-50%);
opacity: 0;
z-index: 999;
backdrop-filter: var(--blur);
transition: var(--transition);
inset-block-start: 0;
box-shadow: var(--edge-highlight), var(--shadow-glass);
border-radius: 999px;
background-color: var(--glass-bg);
padding: 0.625rem 0.75rem;
pointer-events: none;
line-height: 1;
text-decoration: none;
&:focus {
opacity: 1;
inset-block-start: calc(100% + 0.5rem);
}
}
ul {
display: flex;
flex-wrap: wrap;
justify-content: center;
align-items: center;
gap: 0.25rem;
margin: 0;
padding: 0;
}
li {
display: flex;
margin: 0;
padding: 0;
list-style: none;
@media only screen and (max-width: 480px) {
&:not(:has(.circle)) {
flex: 0 0 100%;
}
}
}
a,
summary {
flex: 1;
transition: var(--transition);
box-shadow: none;
border-radius: 999px;
background-color: transparent;
padding: 0.625rem 0.75rem;
font-weight: bold;
line-height: 1;
list-style: none;
text-align: center;
text-decoration: none;
}
a.active {
box-shadow: var(--edge-highlight);
background-color: var(--accent-color-alpha);
color: var(--accent-color);
&:hover {
background-color: var(--accent-color);
color: var(--contrast-color);
}
}
#home a {
color: var(--fg-muted-5);
font-weight: 800;
&:hover {
color: var(--fg-color);
}
&.active {
color: var(--accent-color);
&:hover {
color: var(--contrast-color);
}
}
.icon {
--icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16'%3E%3Cpath d='M8 .361a2.2 2.2 0 0 0-1.41.51L2.129 4.59A3.14 3.14 0 0 0 1 7v6c0 1.66 1.34 3 3 3h8c1.66 0 3-1.34 3-3V7c0-.93-.414-1.813-1.129-2.41L9.411.87A2.2 2.2 0 0 0 8 .361m0 2.002a.2.2 0 0 1 .129.047l4.46 3.719c.263.215.411.535.411.871v6c0 .547-.453 1-1 1h-2V9c0-.55-.45-1-1-1H7c-.55 0-1 .45-1 1v5H4c-.547 0-1-.453-1-1V7c0-.336.148-.656.41-.871L7.871 2.41A.2.2 0 0 1 8 2.363'/%3E%3C/svg%3E");
-webkit-mask-image: var(--icon);
vertical-align: -0.125em;
mask-image: var(--icon);
transition: var(--transition);
margin-inline-end: 0.25rem;
}
}
.divider {
align-self: stretch;
margin: 0 0.25rem;
background-color: var(--fg-muted-2);
width: max(1px, 0.0625em);
@media only screen and (max-width: 480px) {
display: none;
}
}
a,
#search button,
#language-switcher summary,
#theme-switcher summary,
#theme-switcher button,
summary {
color: var(--fg-muted-4);
&:hover {
box-shadow: var(--edge-highlight);
background-color: var(--fg-muted-1);
color: var(--fg-muted-5);
}
&:active {
transform: var(--active);
}
}
.circle {
padding: 0.625rem 0.625rem;
line-height: 0;
&::before {
display: none;
}
.icon {
vertical-align: -0.125em;
transition: var(--transition);
}
}
button {
appearance: none;
transition: var(--transition);
cursor: pointer;
border: none;
border-radius: 999px;
background-color: transparent;
font-size: var(--font-size-medium);
}
details {
display: flex;
position: relative;
flex: 1;
box-shadow: none;
border-radius: 0;
background-color: transparent;
padding: 0;
&[open] ul {
animation: dropdown-open var(--transition);
@keyframes dropdown-open {
from {
transform: scale(0.5) translate(-50%, -1rem);
opacity: 0;
}
}
}
ul {
-webkit-backdrop-filter: var(--blur);
position: absolute;
left: 50%;
flex-direction: column;
transform: translateX(-50%);
transform-origin: top left;
z-index: 1;
backdrop-filter: var(--blur);
inset-block-start: 3.25rem;
box-shadow: var(--edge-highlight), var(--shadow-glass);
border-radius: calc(var(--rounded-corner) + 0.25rem);
background-color: var(--glass-bg);
padding: 0.25rem;
li {
width: 100%;
white-space: nowrap;
a {
border-radius: var(--rounded-corner);
text-align: start;
}
}
}
@media only screen and (max-width: 480px) {
&:has(summary:not(.circle)) ul {
inset-block-start: 2.75rem;
}
}
}
#search .icon {
--icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16'%3E%3Cpath d='M6.57.063c-3.578 0-6.5 2.921-6.5 6.5 0 3.578 2.922 6.5 6.5 6.5a6.46 6.46 0 0 0 3.83-1.256l2.975 2.974c.957.938 2.363-.5 1.406-1.437l-2.96-2.961a6.46 6.46 0 0 0 1.25-3.82c0-3.579-2.923-6.5-6.5-6.5m0 2c2.5 0 4.5 2.003 4.5 4.5 0 2.5-2 4.5-4.5 4.5-2.496 0-4.5-2-4.5-4.5 0-2.497 2.004-4.5 4.5-4.5'/%3E%3C/svg%3E");
-webkit-mask-image: var(--icon);
mask-image: var(--icon);
:root[dir*="rtl"] & {
transform: scaleX(-1);
}
}
#feed .icon {
--icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16'%3E%3Cpath d='M1.988 1.988V3c.008.547.453.984 1 .988.004-.004.008-.004.012-.004v.028A8.977 8.977 0 0 1 11.988 13a.991.991 0 0 0 1 .984h1V13h-.004c0-.004 0-.004.004-.008C13.984 7.02 9.184 2.148 3.242 2.02A1.004 1.004 0 0 0 3 1.988v-.004zm0 4V7c.008.547.453.984 1 .988.004-.004.008-.004.012-.004V8a4.985 4.985 0 0 1 4.996 4.844 1.002 1.002 0 0 0 .988 1.145c.008-.005.012-.005.016-.005v.004h.984V13H10c0-3.793-3.047-6.898-6.82-6.992 0-.004-.004-.004-.004-.004A.892.892 0 0 0 3 5.988v-.004zm2 4a1.999 1.999 0 1 0-.002 3.998 1.999 1.999 0 0 0 .002-3.998m0 0'%3E%3C/path%3E%3C/svg%3E");
-webkit-mask-image: var(--icon);
mask-image: var(--icon);
:root[dir*="rtl"] & {
transform: scaleX(-1);
}
}
#repo .icon {
--icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16'%3E%3Cpath d='M8 0a1 1 0 0 0-.707.293L5.707 1.875l5.238 5.234c.176-.07.364-.109.555-.109A1.5 1.5 0 1 1 10 8.5q0-.276.102-.535L8.05 5.915v4.19a1.5 1.5 0 1 1-1-.035V4.914L4.859 2.727.293 7.293a1 1 0 0 0 0 1.414l7 7a1 1 0 0 0 1.414 0l7-7a1.007 1.007 0 0 0 0-1.414l-7-7A1 1 0 0 0 8 0m0 0'/%3E%3C/svg%3E");
-webkit-mask-image: var(--icon);
mask-image: var(--icon);
}
#language-switcher .icon {
--icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16'%3E%3Cpath d='M3.98 1v3H1v2h2.947a4.8 4.8 0 0 1-.592 1.871c-.425.758-1.101 1.488-2.062 2.45l1.414 1.413c.92-.92 1.703-1.728 2.283-2.697.38.632.844 1.196 1.377 1.768l.668-2.309a6 6 0 0 1-.41-.625A4.75 4.75 0 0 1 6.033 6h1.53l.511-2H6V1zm5.24 1L6 15h2l.781-3h4.438L14 15h2L12.781 2zm1.562 2h.438l1.5 6H9.28z'/%3E%3C/svg%3E");
-webkit-mask-image: var(--icon);
mask-image: var(--icon);
}
#theme-switcher {
ul {
flex-direction: row;
flex-wrap: nowrap;
border-radius: 999px;
}
.active {
box-shadow: var(--edge-highlight);
background-color: var(--accent-color-alpha);
color: var(--accent-color);
&:hover {
background-color: var(--accent-color);
color: var(--contrast-color);
}
}
#theme-system .icon,
.icon {
--icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16'%3E%3Cpath d='M8 0C3.594 0 0 3.594 0 8s3.594 8 8 8 8-3.594 8-8-3.594-8-8-8m0 1.941c3.36 0 6.059 2.7 6.059 6.059s-2.7 6.059-6.059 6.059zm0 0'/%3E%3C/svg%3E");
-webkit-mask-image: var(--icon);
mask-image: var(--icon);
:root[dir*="rtl"] & {
transform: scaleX(-1);
}
}
#theme-light .icon,
.icon.light {
--icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16'%3E%3Cpath d='M8.004-.008a1 1 0 0 0-1 1v1a1 1 0 1 0 2 0v-1c0-.554-.445-1-1-1M3.053 2.035a1 1 0 0 0-.26.035.994.994 0 0 0-.45 1.672l.708.707a1 1 0 1 0 1.414-1.414l-.707-.707a1 1 0 0 0-.705-.293m9.9.012a1 1 0 0 0-.707.293l-.707.707a1 1 0 1 0 1.414 1.414l.707-.707a1 1 0 0 0-.707-1.707M8 4C5.785 4 4 5.785 4 8s1.785 4 4 4 4-1.785 4-4-1.785-4-4-4m0 2c1.098 0 2 .902 2 2s-.902 2-2 2-2-.902-2-2 .902-2 2-2m-7.004.984a1 1 0 1 0 0 2h1a1 1 0 1 0 0-2zM14 7c-.55 0-1 .45-1 1s.45 1 1 1h1c.55 0 1-.45 1-1s-.45-1-1-1zM3.748 11.234a1 1 0 0 0-.705.293l-.711.707a1.007 1.007 0 0 0 0 1.414c.39.391 1.027.391 1.418 0l.707-.707a1 1 0 0 0-.709-1.707m8.49.006q-.131 0-.261.033a1.01 1.01 0 0 0-.707.711 1 1 0 0 0 .261.965l.707.707a.995.995 0 0 0 1.672-.445 1 1 0 0 0-.258-.969l-.707-.707a1 1 0 0 0-.707-.295m-4.246 1.756c-.554 0-1 .445-1 1v1a1 1 0 1 0 2 0v-1a1 1 0 0 0-1-1'/%3E%3C/svg%3E");
-webkit-mask-image: var(--icon);
mask-image: var(--icon);
}
#theme-dark .icon,
.icon.dark {
--icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16'%3E%3Cpath d='M.918 8.004a7.072 7.072 0 0 0 14.102.793 1.01 1.01 0 0 0-.457-.957 1 1 0 0 0-1.063-.004 3.9 3.9 0 0 1-2.031.578 3.89 3.89 0 0 1-3.883-3.883c0-.715.203-1.422.578-2.031a1 1 0 0 0-.004-1.062c-.207-.32-.578-.5-.957-.458A7.07 7.07 0 0 0 .918 8.004M5.586 4.53a5.877 5.877 0 0 0 8.965 5.004l-1.52-.96a5.09 5.09 0 0 1-5.035 4.507 5.09 5.09 0 0 1-5.078-5.078 5.09 5.09 0 0 1 4.508-5.035l-.961-1.52a5.9 5.9 0 0 0-.88 3.082m0 0'/%3E%3C/svg%3E");
-webkit-mask-image: var(--icon);
mask-image: var(--icon);
:root[dir*="rtl"] & {
transform: scaleX(-1);
}
}
}
}
#search-container {
transform: scale(0.5) translateY(-2.75rem);
opacity: 0;
transition: var(--transition);
padding: 0 0.5rem 0;
height: 0;
pointer-events: none;
&.active {
transform: none;
opacity: 1;
padding: 0 0.5rem 0.5rem;
height: 2.75rem;
pointer-events: all;
}
}
#search-bar {
box-shadow: var(--edge-highlight);
border: none;
border-radius: 999px;
background: var(--fg-muted-1);
padding: 0 0.75rem;
width: 100%;
height: 2.25rem;
color: inherit;
font-size: var(--font-size-medium);
&::placeholder {
opacity: 1;
color: var(--fg-muted-4);
}
}
#search-results-container {
-webkit-backdrop-filter: var(--blur);
display: flex;
position: absolute;
backdrop-filter: var(--blur);
inset-block-start: calc(100% + 0.5rem);
inset-inline-start: 0;
box-shadow: var(--edge-highlight), var(--shadow-glass);
border-radius: calc(var(--rounded-corner) + 0.5rem);
background-color: var(--glass-bg);
width: 100%;
max-height: 50vh;
}
#search-results {
--mask: linear-gradient(
to bottom,
transparent,
black 1rem,
black calc(100% - 1rem),
transparent
);
-webkit-mask-image: var(--mask);
display: none;
flex: 1;
flex-direction: column;
gap: 0.5rem;
mask-image: var(--mask);
padding: 0.5rem;
overflow: auto;
.item {
display: inline-flex;
flex-direction: column;
box-shadow: var(--edge-highlight);
border-radius: var(--rounded-corner);
background-color: var(--fg-muted-1);
padding: 0.5rem;
a {
width: fit-content;
&::after {
content: "";
:root[dir*="rtl"] & {
content: "";
}
}
}
span {
color: var(--fg-muted-5);
&:first-of-type,
&.more-matches {
margin-block-start: 0.5rem;
border-block-start: max(1px, 0.0625rem) solid
var(--fg-muted-2);
padding-block-start: 0.25rem;
}
&.more-matches {
font-size: var(--font-size-small);
}
strong {
color: var(--fg-color);
}
}
}
}
}