Masthead
Navigation bar that lies over the next section: capitals links on the left, the script wordmark with a signal mark in the middle, account, bag and a white filled button on the right. Blended as a difference so it inverts over white. On phones it becomes a menu button, the wordmark and two icons, with a black full-screen menu.
Part of the style
Night Chart Console
7 parts that belong together, with their tokens, type and rules.
https://kitbash.me/components/night-chart-console/masthead/figma.html?palette=4daa500f166e94e0
Use the Figma MCP server (https://mcp.figma.com/mcp). Download https://kitbash.me/components/night-chart-console/masthead/figma.html?palette=4daa500f166e94e0 and pass that whole HTML document to the html_to_figma tool, so the part "Masthead" lands as editable layers in my open Figma file. Fonts come from Google Fonts: if a face is missing in Figma, pick the closest one.
Code
<style>
/* Goes after the pack's base.css */
:root {
--night: #dadada;
--paper: #1c1c1c;
--paper-dim: rgba(28, 28, 28, 0.6);
--paper-faint: rgba(28, 28, 28, 0.36);
--night-dim: rgba(218, 218, 218, 0.6);
--night-faint: rgba(218, 218, 218, 0.4);
--smoke: #979797;
--fog: #222222;
--wordmark-shade: #333333;
--map-ghost: #515151;
--retro-face: #3b3b3b;
--retro-chip: #232323;
--retro-edge: #6c6c6c;
--scene-sky: #c66c48;
--scene-sea: #b17c66;
--retro-bar: #ef641f;
--retro-bar-end: #feb396;
--map-line: #fec7b2;
--scene-glow: #bb6136;
--map-live: #924b2a;
--scene-lamp: #903b09;
--scene-amber: #913d15;
}
</style>
<header class="masthead">
<div class="masthead__bar">
<button class="masthead__toggle" type="button" aria-expanded="false" aria-label="Open menu">
<span class="masthead__toggle-line"></span>
<span class="masthead__toggle-line"></span>
</button>
<nav class="masthead__nav" aria-label="Main">
<a class="masthead__link" href="#">Shop</a>
<a class="masthead__link" href="#">The Boat</a>
<a class="masthead__link" href="#">Night Schedule</a>
</nav>
<a class="masthead__logo" href="#" aria-label="Small Hours, home">
<svg class="masthead__signal" viewBox="0 0 48 26" aria-hidden="true" focusable="false">
<path d="M4 24a20 20 0 0 1 40 0M12 24a12 12 0 0 1 24 0M19 24a5 5 0 0 1 10 0" />
</svg>
<span class="masthead__wordmark">Small Hours</span>
</a>
<div class="masthead__actions">
<a class="masthead__link masthead__link--icon" href="#">
<span class="masthead__link-text">Account</span>
<svg class="masthead__icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false">
<circle cx="12" cy="8" r="4" />
<path d="M4 21c0-4.4 3.6-7 8-7s8 2.6 8 7" />
</svg>
</a>
<a class="masthead__link masthead__link--icon" href="#">
<span class="masthead__link-text">Bag</span>
<svg class="masthead__icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false">
<rect x="4" y="8" width="16" height="13" rx="3" />
<path d="M8.5 8V7a3.5 3.5 0 0 1 7 0v1" />
</svg>
</a>
<a class="masthead__button" href="#">Tune in</a>
</div>
</div>
<div class="masthead__menu" inert>
<ul class="masthead__menu-list">
<li style="--i: 0"><a class="masthead__menu-link" href="#">Shop</a></li>
<li style="--i: 1"><a class="masthead__menu-link" href="#">The Boat</a></li>
<li style="--i: 2"><a class="masthead__menu-link" href="#">Night Schedule</a></li>
<li style="--i: 3"><a class="masthead__button masthead__button--menu" href="#">Tune in</a></li>
</ul>
<p class="masthead__menu-note">87.9 MHz <span class="masthead__menu-sub">On air from dusk, off at first light</span></p>
</div>
</header>
<style>
/* The root takes no room: the bar lies over whatever section comes next. */
.masthead {
height: var(--bar-height);
margin-bottom: calc(-1 * var(--bar-height));
}
/* Everything in the bar is white and blended as a difference, so it turns black by itself over a white section. */
.masthead__bar {
position: relative;
z-index: 10;
display: grid;
grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
align-items: center;
gap: var(--space-s);
height: var(--bar-height);
padding: 0 var(--gutter);
color: var(--paper);
mix-blend-mode: difference;
}
.masthead__nav,
.masthead__actions {
display: flex;
align-items: center;
gap: var(--space-m);
}
.masthead__actions {
justify-content: flex-end;
}
.masthead__link {
position: relative;
display: inline-flex;
align-items: center;
min-height: var(--tap);
color: inherit;
text-decoration: underline var(--frame) transparent;
text-transform: uppercase;
text-underline-offset: 0.4em;
white-space: nowrap;
transition: color var(--time-nav) var(--ease-out), text-decoration-color var(--time-fast) var(--ease-fast);
}
.masthead__link:focus-visible {
text-decoration-color: currentColor;
}
/* Hovering one link dims the others in its group. */
.masthead__nav:has(.masthead__link:hover) .masthead__link:not(:hover),
.masthead__actions:has(.masthead__link:hover) .masthead__link:not(:hover) {
color: var(--paper-dim);
}
.masthead__link::before {
content: "";
position: absolute;
top: 0;
left: 50%;
width: max(100%, var(--tap));
height: 100%;
translate: -50% 0;
}
.masthead__icon {
display: none;
width: 1.75rem;
height: 1.75rem;
fill: none;
stroke: currentColor;
stroke-width: 1.5;
}
.masthead__button {
display: inline-flex;
align-items: center;
min-height: var(--tap);
padding: 0 var(--space-l);
margin-left: calc(var(--space-xs) * -1);
background: var(--paper);
color: var(--night);
text-decoration: none;
text-transform: uppercase;
white-space: nowrap;
transition: background-color var(--time-slow) ease, color var(--time-slow) ease;
}
.masthead__button:hover,
.masthead__button:focus-visible {
background: var(--smoke);
color: var(--paper);
}
.masthead__logo {
position: relative;
display: grid;
justify-items: center;
padding-top: 0.55em;
color: inherit;
font-size: clamp(2.25rem, 1.6rem + 2.2vw, 3.625rem);
text-decoration: none;
}
.masthead__wordmark {
font-family: var(--font-script);
font-style: italic;
font-weight: 700;
line-height: 1;
white-space: nowrap;
}
.masthead__signal {
position: absolute;
top: 0;
left: 50%;
width: 0.78em;
translate: -62% 0;
fill: none;
stroke: currentColor;
stroke-linecap: round;
stroke-width: 2.6;
}
.masthead__toggle {
display: none;
position: relative;
width: var(--tap);
height: var(--tap);
margin-left: -0.5rem;
padding: 0;
border: 0;
background: none;
color: inherit;
cursor: pointer;
}
.masthead__toggle-line {
position: absolute;
left: 0.5rem;
right: 0.875rem;
top: 50%;
height: var(--frame);
background: currentColor;
translate: 0 -4px;
transition: translate var(--time) var(--ease-out), rotate var(--time) var(--ease-out);
}
.masthead__toggle-line + .masthead__toggle-line {
translate: 0 4px;
}
.masthead.is-open .masthead__toggle-line {
translate: 0 0;
rotate: 45deg;
}
.masthead.is-open .masthead__toggle-line + .masthead__toggle-line {
rotate: -45deg;
}
.masthead__menu {
position: fixed;
inset: 0;
z-index: 9;
display: flex;
flex-direction: column;
justify-content: space-between;
gap: var(--space-xl);
padding: calc(var(--bar-height) + var(--space-s)) var(--gutter) var(--space-l);
overflow-y: auto;
overscroll-behavior: contain;
background: var(--night);
color: var(--paper);
opacity: 0;
visibility: hidden;
transition: opacity var(--time) ease, visibility 0s var(--time);
}
.masthead.is-open .masthead__menu {
opacity: 1;
visibility: visible;
transition-delay: 0s;
}
.masthead__menu-list {
display: grid;
justify-items: start;
gap: var(--space-xs);
margin: 0;
padding: 0;
list-style: none;
}
.masthead__menu-link {
display: inline-flex;
align-items: center;
min-height: var(--tap);
color: inherit;
font-size: var(--text-xl);
letter-spacing: var(--tracking-tight);
line-height: 1.1;
text-decoration: none;
text-transform: uppercase;
}
.masthead__button--menu {
margin: var(--space-m) 0 0;
}
.masthead.is-open .masthead__menu-list li {
animation: masthead-rise var(--time-slow) var(--ease-out) both;
animation-delay: calc(var(--i) * var(--stagger-step));
}
@keyframes masthead-rise {
from {
opacity: 0;
translate: 0 0.75rem;
}
}
.masthead__menu-note {
margin: 0;
font-size: var(--text-l);
letter-spacing: var(--tracking-tight);
text-transform: uppercase;
}
.masthead__menu-sub {
display: block;
color: var(--paper-dim);
font-size: var(--text-xs);
letter-spacing: var(--tracking-wide);
}
.masthead :focus-visible {
outline: var(--frame) solid currentColor;
outline-offset: 4px;
}
@media (max-width: 56rem) {
.masthead__nav,
.masthead__actions .masthead__button,
.masthead__link-text {
display: none;
}
.masthead__toggle {
display: block;
}
.masthead__actions {
gap: 0;
margin-right: -0.5rem;
}
.masthead__link--icon {
justify-content: center;
min-width: var(--tap);
}
.masthead__icon {
display: block;
}
}
@media (prefers-reduced-motion: reduce) {
.masthead__toggle-line,
.masthead__menu,
.masthead__button,
.masthead__link {
transition-duration: 0s;
}
.masthead.is-open .masthead__menu-list li {
animation: none;
}
}
</style>
<script>
(() => {
const OPEN = "is-open";
const setUpMenu = (root) => {
const toggle = root.querySelector(".masthead__toggle");
const menu = root.querySelector(".masthead__menu");
const setOpen = (open) => {
root.classList.toggle(OPEN, open);
menu.inert = !open;
toggle.setAttribute("aria-expanded", String(open));
toggle.setAttribute("aria-label", open ? "Close menu" : "Open menu");
};
toggle.addEventListener("click", () => setOpen(!root.classList.contains(OPEN)));
menu.addEventListener("click", (event) => {
if (event.target.closest("a")) setOpen(false);
});
root.addEventListener("keydown", (event) => {
if (event.key !== "Escape" || !root.classList.contains(OPEN)) return;
setOpen(false);
toggle.focus();
});
};
document.querySelectorAll(".masthead").forEach(setUpMenu);
})();
</script>