larpaso-website/src/components/Nav.astro
Lara f8763ed6f5 Switch the site to the light "Papier & Gold" palette
Requested: make the site lighter, the way the colours were originally.
Taken from the house palette "Papier & Gold" (warm off-white, gold as
the only accent): papier #FCFAF6, papier-2 #F4EFE4, card #FFFDF8, ink
#1C1813, quiet #6B6154.

Gold needs more than one hex value. The old dark theme used a single
light gold for both text and fills, which works on a dark ground but
breaks on paper: #C9A461 as text scores 2.25:1. So primary and accent
are now the dark gold #7A5D1F, which carries fill *and* type (5.90:1 on
paper, and takes cream text on top), with #FFFDF8 as its contrast.
googleBlue became Google's actual link blue so the search mock stays
readable on a light ground. Fonts untouched.

Fixed a pre-existing bug this exposed: ".nav-links a" also matched the
header CTA and overrode .btn-primary's colour, so the button rendered
muted text on the primary fill - 1.01:1, effectively invisible. It just
never showed on the dark theme, where both tones were light. Narrowed
to ".nav-links ul a", matching the :hover rule right below it.

Rebuilt the logo as a transparent PNG: logo.jpg had the old dark
background baked in and sat on the page as a black box, with its
"WEBDESIGN" label in light grey that disappears on paper. The pill is
preserved pixel for pixel (row-wise fill so the dark lettering inside
stays opaque, then eroded 1px to drop the old anti-aliasing halo); the
label is recoloured to ink. logo.jpg is kept.

Verified in the browser across all three pages: 228 rendered text
elements measured, 0 WCAG AA failures, tightest pair 5.82 - which is
exactly the documented figure for "quiet on paper". No horizontal
scroll, no console errors.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-10-04 13:19:51 +02:00

184 lines
3.7 KiB
Text

---
import { site } from '../lib/content';
const nav = site.nav;
---
<header class="nav">
<div class="container nav-inner">
<a href="/" class="nav-logo">
<img src={nav.logo} alt={nav.logoAlt} width="320" height="60" class="nav-logo-img" />
</a>
<button
type="button"
class="nav-toggle"
id="nav-toggle"
aria-expanded="false"
aria-controls="nav-links"
aria-label="Menü öffnen"
>
<span></span>
<span></span>
<span></span>
</button>
<nav class="nav-links" id="nav-links" aria-label="Hauptnavigation">
<ul>
{nav.links.map((item) => (
<li>
<a href={`#${item.anchor}`}>{item.label}</a>
</li>
))}
</ul>
<a class="btn btn-primary nav-cta" href="#kontakt">{nav.ctaLabel}</a>
</nav>
</div>
</header>
<style>
.nav {
background: var(--color-bg);
border-bottom: 1px solid var(--color-border);
position: sticky;
top: 0;
z-index: 50;
}
.nav-inner {
display: flex;
align-items: center;
justify-content: space-between;
padding-block: var(--space-4);
}
.nav-logo {
display: flex;
align-items: center;
gap: var(--space-3);
text-decoration: none;
}
.nav-logo-img {
height: 3.5rem;
width: auto;
}
.nav-links {
display: flex;
align-items: center;
gap: var(--space-6);
}
.nav-links ul {
display: flex;
align-items: center;
gap: var(--space-6);
list-style: none;
}
.nav-links ul a {
color: var(--color-text-muted);
font-weight: var(--font-weight-medium);
font-size: var(--font-size-sm);
text-decoration: none;
}
.nav-links ul a:hover {
color: var(--color-primary);
}
.nav-cta {
font-size: var(--font-size-sm);
letter-spacing: 0.04em;
text-transform: uppercase;
padding: var(--space-3) var(--space-5);
}
.nav-toggle {
display: none;
flex-direction: column;
justify-content: center;
gap: 5px;
width: 28px;
height: 22px;
padding: 0;
background: none;
border: none;
cursor: pointer;
}
.nav-toggle span {
display: block;
height: 2px;
background: var(--color-text);
border-radius: 1px;
}
@media (max-width: 900px) {
.nav-toggle {
display: flex;
}
.nav-links {
display: none;
position: absolute;
top: 100%;
left: 0;
right: 0;
background: var(--color-bg);
border-bottom: 1px solid var(--color-border);
box-shadow: var(--shadow-md);
}
.nav-links {
flex-direction: column;
align-items: flex-start;
gap: var(--space-4);
padding: var(--space-4) var(--container-padding) var(--space-5);
}
.nav-links ul {
flex-direction: column;
align-items: flex-start;
gap: 0;
width: 100%;
}
.nav-links li {
width: 100%;
padding-block: var(--space-3);
border-bottom: 1px solid var(--color-border);
}
.nav-links.is-open {
display: flex;
}
}
</style>
<script>
const toggle = document.getElementById('nav-toggle');
const links = document.getElementById('nav-links');
function setOpen(open) {
links?.classList.toggle('is-open', open);
toggle?.setAttribute('aria-expanded', String(open));
toggle?.setAttribute('aria-label', open ? 'Menü schließen' : 'Menü öffnen');
}
toggle?.addEventListener('click', () => {
setOpen(!links?.classList.contains('is-open'));
});
links?.addEventListener('click', (event) => {
const target = event.target;
if (target instanceof HTMLElement && target.tagName === 'A') {
setOpen(false);
}
});
document.addEventListener('keydown', (event) => {
if (event.key === 'Escape') setOpen(false);
});
</script>