1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-04-27 13:56:22 -04:00
jarv.is/components/page-header/Header.module.css
Jake Jarvis 58c82a1715
cumulative layout shift fixes
- inject theme toggle placeholder instead of loading dynamically
- explicitly set sticky header height
- set `font-display: fallback`
2022-01-14 17:10:35 -05:00

169 lines
2.3 KiB
CSS

.header {
position: sticky;
top: 0;
width: 100%;
height: 4.5em;
padding: 0.7em 1.5em;
border-bottom: 1px solid var(--kinda-light);
background-color: var(--background-header);
backdrop-filter: saturate(180%) blur(5px);
z-index: 1000;
}
.nav {
display: flex;
align-items: center;
justify-content: space-between;
width: 100%;
max-width: 865px;
margin: 0 auto;
}
.nav > div {
line-height: 0;
}
/*** left side: photo/name ***/
.left {
flex: 1;
}
.name {
display: inline-flex;
align-items: center;
color: var(--medium-dark);
background: none;
padding-bottom: 0;
}
.name .selfie {
width: 50px;
height: 50px;
line-height: 0;
padding: 0;
}
.name .selfie img {
border: 1px solid var(--light) !important;
border-radius: 50%;
}
.name:hover {
color: var(--link);
}
.name:hover .selfie {
opacity: 0.9;
}
.name span:last-of-type {
margin: 0 0.6em;
font-size: 1.2em;
font-weight: 500;
line-height: 1;
}
/*** right side: menu ***/
.menu {
display: inline-flex;
padding: 0;
margin: 0;
}
.menu li {
list-style: none;
display: inline-flex;
margin-left: 1.8em;
}
.menu li .link {
display: inline-flex;
align-items: center;
color: var(--medium-dark);
background: none;
padding-bottom: 0;
}
.menu li .link:hover {
color: var(--link);
}
.menu li .icon {
width: 1.6em;
height: 1.6em;
}
.menu li span {
font-size: 0.95em;
font-weight: 500;
margin-left: 0.8em;
line-height: 1;
}
.menu li.theme_toggle {
margin-left: 1.25em;
}
@media screen and (max-width: 768px) {
.header {
padding: 0.75em 1.25em;
height: 5.9em;
}
.left {
flex: 0;
}
.name .selfie {
width: 70px;
height: 70px;
}
.name span:last-of-type {
display: none;
}
.right {
flex: 1;
max-width: 325px;
margin-left: 2.5em;
}
.menu {
width: 100%;
justify-content: space-between;
}
.menu li {
margin-left: 0;
}
.menu li .icon {
width: 1.8em;
height: 1.8em;
}
/* hide text next to emojis on mobile */
.menu li span {
display: none;
}
.menu li.theme_toggle {
margin-left: -0.3em;
}
}
/* the home icon is redundant when space is SUPER tight */
@media screen and (max-width: 380px) {
.right {
max-width: 225px;
margin-left: 1.6em;
}
.menu li:first-of-type {
display: none;
}
}