/* The site header, as one file, for the pages that do not carry the homepage's own styles
   (context engineering, the papers, the 404). Same markup, rules and tokens as index.html,
   updates.html and fit.html, so the navbar looks and behaves the same everywhere.
   Tokens are set on .site-header itself, so a page's own palette cannot change the header.
   Load with menu.css (the abacus menu and the language beads) and header.js. */
@font-face { font-family: "Vahid Sora"; src: url("../fonts/VahidSora-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Vahid Sora"; src: url("../fonts/VahidSora-SemiBold.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Vahid Sora"; src: url("../fonts/VahidSora-Bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Geist Mono"; src: url("../fonts/GeistMono-Variable.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
.site-header {
    --font: "Vahid Sora", "Sora", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
    --font-mono: "Geist Mono", ui-monospace, "SF Mono", monospace;
    --ink: #1c1c1e; --rust: #e0301e; --rust-deep: #b4200f; --paper: #fff6f4; --accent: #e0301e;
    --bg: #ffffff; --border: #dddddd; --text-primary: #1c1c1e; --text-secondary: #555555; --text-muted: #6e6e73;
    --ctl-radius: 8px; --ctl-h: 40px; --ctl-h-sm: 32px; --ctl-ease: 160ms cubic-bezier(0.4, 0, 0.2, 1);
    --bg-subtle: #f8f8f8; --blue: #c8261a; --dur-fast: 140ms;
    --ctl-line: rgba(28,28,30,0.14); --ctl-line-hover: rgba(28,28,30,0.32); --ctl-tint: rgba(28,28,30,0.035);
    --dur-base: 220ms; --dur-slow: 420ms; --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
    --ease-move: cubic-bezier(0.4, 0, 0.2, 1); --ease-spring: cubic-bezier(0.22, 1, 0.36, 1);
    --transition: var(--dur-base) var(--ease-move);
    font-family: var(--font); font-size: 15px; line-height: 1.7; color: var(--ink); text-align: left;
    -webkit-font-smoothing: antialiased;
}
.site-header *, .site-header *::before, .site-header *::after { margin: 0; padding: 0; box-sizing: border-box; }
.site-header ul { list-style: none; }
.site-header a, .site-header a:hover { text-decoration: none; }
/* a page's own list, link and svg rules must not reach the header (the papers style ul and li) */
.site-header ul { flex-direction: row; }
.site-header li { display: block; font-size: inherit; color: inherit; line-height: inherit; gap: 0; }
.site-header li::before { content: none !important; display: none !important; }
.site-header .container { max-width: 1120px; margin: 0 auto; padding: 0 1.5rem; }
@media (max-width: 640px) { .site-header .container { padding: 0 1.25rem; } }
.site-header {
    position: -webkit-sticky; position: sticky; top: 0; z-index: 50;
    background: rgba(255,255,255,0);
    border-bottom: 1px solid transparent;
    transition: background var(--dur-slow) var(--ease-out), border-color var(--dur-slow) var(--ease-out),
                box-shadow var(--dur-slow) var(--ease-out), backdrop-filter var(--dur-slow) var(--ease-out);
}
.site-header.is-scrolled {
    background: rgba(255,255,255,0.82);
    backdrop-filter: saturate(180%) blur(14px); -webkit-backdrop-filter: saturate(180%) blur(14px);
    border-bottom-color: rgba(28,28,30,0.08);
    
}
.site-nav {
    display: flex; align-items: center; justify-content: space-between; gap: 1.5rem;
    height: 64px; transition: height var(--dur-slow) var(--ease-out);
}
.site-header.is-scrolled .site-nav { height: 52px; }

.brand {
    display: inline-flex; align-items: center; gap: 0.625rem; flex: none;
    color: var(--ink); text-decoration: none;
}
.brand:hover { text-decoration: none; }
.brand-mark { width: 22px; height: 22px; flex: none; }
.brand-mark .bead { transition: transform var(--dur-slow) var(--ease-spring); transform-box: view-box; }
.brand:hover .brand-mark .b-1 { transform: translateX(9px); }
.brand:hover .brand-mark .b-2 { transform: translateX(-5px); }
.brand:hover .brand-mark .b-3 { transform: translateX(7px); }
.brand-name { font-size: 0.875rem; font-weight: 650; letter-spacing: -0.015em; white-space: nowrap; }

.nav-links {
    position: relative; display: flex; align-items: center; gap: 0.25rem;
    margin: 0 auto 0 0.5rem; list-style: none;
}
.nav-links a {
    display: block; padding: 0.4rem 0.625rem; border-radius: 8px;
    font-size: 0.8125rem; font-weight: 500; letter-spacing: -0.005em;
    color: var(--text-secondary); text-decoration: none;
    transition: color var(--dur-fast) var(--ease-move), background var(--dur-fast) var(--ease-move);
}
.nav-links a:hover { color: var(--ink); background: rgba(28,28,30,0.04); text-decoration: none; }
.nav-links a.is-active { color: var(--ink); }
.nav-indicator {
    position: absolute; left: 0; bottom: -2px; height: 2px; width: 0; border-radius: 2px;
    background: var(--rust); opacity: 0; pointer-events: none;
    transition: transform var(--dur-slow) var(--ease-out), width var(--dur-slow) var(--ease-out), opacity var(--dur-base) var(--ease-move);
}

.nav-actions { display: flex; align-items: center; gap: 0.5rem; flex: none; }
.nav-btn-ghost, .nav-btn-solid {
    display: inline-flex; align-items: center; gap: 0.375rem; height: var(--ctl-h-sm); padding: 0 0.875rem;
    border-radius: var(--ctl-radius); font-size: 0.8125rem; font-weight: 600; letter-spacing: -0.005em;
    text-decoration: none; white-space: nowrap;
    transition: background var(--dur-fast) var(--ease-move), border-color var(--dur-fast) var(--ease-move),
                color var(--dur-fast) var(--ease-move), box-shadow var(--dur-fast) var(--ease-move);
}
.nav-btn-ghost { color: var(--ink); border: 1px solid var(--ctl-line); background: var(--bg); }
.nav-btn-ghost:hover { border-color: var(--ctl-line-hover); background: var(--ctl-tint); text-decoration: none; }
.nav-btn-ghost svg { width: 12px; height: 12px; opacity: 0.6; }
.nav-btn-solid { color: #fff; background: var(--ink); border: 1px solid var(--ink);  }
.nav-btn-solid:hover { background: #000; text-decoration: none;  }
.nav-links a:focus-visible, .brand:focus-visible, .nav-btn-ghost:focus-visible,
.nav-btn-solid:focus-visible, .nav-toggle:focus-visible {
    outline: 2px solid var(--blue); outline-offset: 2px;
}

.nav-toggle {
    display: none; width: 36px; height: 36px; border-radius: var(--ctl-radius); border: 1px solid var(--ctl-line);
    background: var(--bg); cursor: pointer; position: relative; flex: none;
}
.nav-toggle span {
    position: absolute; left: 10px; right: 10px; height: 1.5px; background: var(--ink); border-radius: 2px;
    transition: transform var(--dur-base) var(--ease-out), top var(--dur-base) var(--ease-out);
}
.nav-toggle span:nth-child(1) { top: 14px; }
.nav-toggle span:nth-child(2) { top: 20px; }
.site-header.menu-open .nav-toggle span:nth-child(1) { top: 17px; transform: rotate(45deg); }
.site-header.menu-open .nav-toggle span:nth-child(2) { top: 17px; transform: rotate(-45deg); }
.nav-sheet {
    display: none; border-top: 1px solid rgba(28,28,30,0.08); background: rgba(255,255,255,0.97);
    backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.nav-sheet a {
    display: flex; justify-content: space-between; align-items: center; padding: 0.875rem 0;
    border-bottom: 1px solid rgba(28,28,30,0.06); color: var(--ink); text-decoration: none;
    font-size: 1rem; font-weight: 600; letter-spacing: -0.01em;
}
.nav-sheet a span { color: var(--text-muted); font-weight: 500; font-size: 0.8125rem; }
.nav-sheet .container { padding-top: 0.25rem; padding-bottom: 1rem; }

@media (max-width: 1000px) {
    .nav-links { display: none; }
    .nav-toggle { display: inline-block; }
    .site-header.menu-open { background: rgba(255,255,255,0.97); border-bottom-color: rgba(28,28,30,0.08); }
    .site-header.menu-open .nav-sheet { display: block; animation: sheet-in var(--dur-base) var(--ease-out); }
    @keyframes sheet-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
}
@media (max-width: 640px) { .nav-btn-solid { display: none; } }
@media (prefers-reduced-motion: reduce) {
    .brand:hover .brand-mark .bead { transform: none; }
}

.name-bead {
    display: inline-block; width: 0.36em; height: 0.36em; margin-left: 0.12em;
    border-radius: 50%; background-color: var(--rust); vertical-align: baseline;
    
}
.live-bead {
    display: inline-block; width: 0; height: 7px; margin-right: 0; border-radius: 50%;
    background-color: var(--rust); opacity: 0;
    transition: width var(--dur-slow) var(--ease-spring), margin var(--dur-slow) var(--ease-spring), opacity var(--ctl-ease);
}
.nav-btn-solid:hover .live-bead { width: 7px; margin-right: 0.45rem; opacity: 1; }
.site-header .container { max-width: 1120px; }
.nav-links a[aria-current="page"] { color: var(--ink);  border-radius: 8px 8px 0 0; }

/* --- Site footer -------------------------------------------------- */


/* "Fit check": the hiring chip. A job description whose rows are scored
   with beads, and a check; the beads slide along their rods on hover. */
.nav-fit {
    display: inline-flex; align-items: center; gap: 0.4rem; height: var(--ctl-h-sm); padding: 0 0.8rem 0 0.5rem;
    border-radius: var(--ctl-radius, 8px); border: 1px solid rgba(224,48,30,0.45); background: var(--paper, #fff6f4);
    color: var(--ink, #1c1c1e); font-size: 0.8125rem; font-weight: 650; letter-spacing: -0.005em; white-space: nowrap; text-decoration: none;
    transition: background var(--dur-fast) var(--ease-move), border-color var(--dur-fast) var(--ease-move), box-shadow var(--dur-fast) var(--ease-move);
}
.nav-fit:hover { background: #ffece8; border-color: var(--rust, #e0301e); text-decoration: none;  }
.nav-fit:focus-visible { outline: 2px solid var(--blue, #c8261a); outline-offset: 2px; }
.nav-fit[aria-current="page"] { background: #ffece8; border-color: var(--rust, #e0301e); }
.nav-fit .nf-long { color: var(--rust-deep, #b4200f); }
.fit-ic { width: 20px; height: 20px; flex: none; }
.fit-ic .fb { transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1); transform-box: view-box; }
.nav-fit:hover .fb-1, .hero-fit:hover .fb-1 { transform: translateX(4.5px); }
.nav-fit:hover .fb-2, .hero-fit:hover .fb-2 { transform: translateX(2.5px); }
.nav-sheet a.sheet-fit { color: var(--rust-deep, #b4200f); }
.nav-sheet a.sheet-fit span { color: var(--rust, #e0301e); }
@media (max-width: 460px) { .nav-fit { padding: 0 0.55rem 0 0.4rem; gap: 0.3rem; font-size: 0.75rem; } .nav-fit .fit-ic { width: 18px; height: 18px; } }
@media (prefers-reduced-motion: reduce) { .fit-ic .fb { transition: none; } }
/* small phones: tighter bar, CV without its arrow; the name yields to the logo below 340px */
@media (max-width: 420px) { .site-nav { gap: 0.75rem; } .nav-actions { gap: 0.3rem; } .nav-btn-ghost { padding: 0 0.55rem; } .nav-btn-ghost svg { display: none; } }
