/* ============================================================
   Personal website — vanilla CSS, no frameworks, no JS.
   Modern, high-polish. System fonts. Fluid typography.
   Note: no inline styles anywhere — strict CSP compatibility.
   ============================================================ */

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; tab-size: 4; }
img, svg { display: block; max-width: 100%; }
button, input, textarea, select { font: inherit; color: inherit; }
button { background: none; border: none; cursor: pointer; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
body { min-height: 100vh; }

/* ---------- Theme tokens (light, default) ---------- */
:root {
    --bg: #f6f4ee;
    --bg-elevated: #fbfaf6;
    --bg-blur: rgba(251, 250, 246, 0.72);
    --bg-card: rgba(251, 250, 246, 0.72);

    --text: #1c1a17;
    --text-muted: #6b6760;
    --text-subtle: #6f6a61;

    --border: rgba(28, 26, 23, 0.08);
    --border-strong: rgba(28, 26, 23, 0.14);

    --accent-1: #4f46e5;
    --accent-2: #06b6d4;
    --accent-text: #4f46e5;
    --accent-soft: rgba(79, 70, 229, 0.08);
    --accent-softer: rgba(79, 70, 229, 0.04);
    --accent-ring: rgba(79, 70, 229, 0.35);
    /* Darkened stops keep gradient TEXT readable (AA) while buttons stay fine */
    --gradient: linear-gradient(135deg, #4338ca 0%, #0e7490 100%);
    --gradient-soft: linear-gradient(135deg, rgba(79,70,229,0.10), rgba(6,182,212,0.10));

    --shadow-sm: 0 1px 2px rgba(28, 26, 23, 0.04);
    --shadow-md: 0 4px 16px -2px rgba(28, 26, 23, 0.08), 0 2px 4px -1px rgba(28, 26, 23, 0.04);
    --shadow-lg: 0 12px 40px -8px rgba(28, 26, 23, 0.14), 0 4px 8px -2px rgba(28, 26, 23, 0.06);
    --shadow-glow: 0 0 0 1px rgba(79, 70, 229, 0.14), 0 8px 32px -8px rgba(79, 70, 229, 0.22);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-pill: 999px;

    --container: 1140px;
    --container-narrow: 820px;
    --toc-width: 220px;

    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    --font-mono: ui-monospace, "SF Mono", "Menlo", "Consolas", "Liberation Mono", monospace;

    --ease: cubic-bezier(0.32, 0.72, 0, 1);
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

    color-scheme: light;
}

[data-theme="dark"] {
    --bg: #0a0a0c;
    --bg-elevated: #121316;
    --bg-blur: rgba(18, 19, 22, 0.68);
    --bg-card: rgba(20, 21, 25, 0.6);

    --text: #ececed;
    --text-muted: #a0a0a3;
    --text-subtle: #8b8b90;

    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.14);

    --accent-1: #818cf8;
    --accent-2: #22d3ee;
    --accent-text: #a5b4fc;
    --accent-soft: rgba(129, 140, 248, 0.10);
    --accent-softer: rgba(129, 140, 248, 0.05);
    --accent-ring: rgba(129, 140, 248, 0.40);
    --gradient: linear-gradient(135deg, #818cf8 0%, #22d3ee 100%);
    --gradient-soft: linear-gradient(135deg, rgba(129,140,248,0.14), rgba(34,211,238,0.14));

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px -2px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 12px 40px -8px rgba(0, 0, 0, 0.6), 0 4px 8px -2px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 0 1px rgba(129, 140, 248, 0.22), 0 8px 32px -8px rgba(129, 140, 248, 0.28);

    color-scheme: dark;
}

/* ---------- Body & ambient ---------- */
body {
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    font-size: clamp(1rem, 0.95rem + 0.25vw, 1.0625rem);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    position: relative;
    overflow-x: hidden;
}
body::before, body::after {
    content: '';
    position: fixed;
    pointer-events: none;
    z-index: 0;
    border-radius: 50%;
    filter: blur(2px);
}
body::before {
    top: -300px; left: 50%;
    transform: translateX(-50%);
    width: 1100px; height: 750px;
    max-width: 95vw;
    background: radial-gradient(ellipse at center, var(--accent-soft) 0%, transparent 60%);
    opacity: 0.9;
}
body::after {
    bottom: -400px; right: -200px;
    width: 750px; height: 750px;
    max-width: 70vw;
    background: radial-gradient(circle at center, rgba(6, 182, 212, 0.05) 0%, transparent 60%);
}
[data-theme="dark"] body::after {
    background: radial-gradient(circle at center, rgba(34, 211, 238, 0.06) 0%, transparent 60%);
}

main, .site-header, .site-footer { position: relative; z-index: 1; }

/* ---------- Headings ---------- */
h1, h2, h3, h4 {
    font-weight: 600;
    line-height: 1.15;
    letter-spacing: -0.02em;
    color: var(--text);
}
h1 { font-size: clamp(2.5rem, 1.5rem + 4vw, 4.5rem); font-weight: 700; letter-spacing: -0.045em; }
h2 { font-size: clamp(1.875rem, 1.5rem + 1.5vw, 2.75rem); letter-spacing: -0.03em; margin-bottom: 0.5em; }
h3 { font-size: clamp(1.25rem, 1.1rem + 0.5vw, 1.5rem); letter-spacing: -0.02em; }
h4 { font-size: 1.0625rem; font-weight: 600; }

p { color: var(--text-muted); }
p.lead { font-size: clamp(1.125rem, 1rem + 0.5vw, 1.375rem); line-height: 1.55; color: var(--text-muted); }
strong { color: var(--text); font-weight: 600; }

code, kbd, samp {
    font-family: var(--font-mono);
    font-size: 0.875em;
    background: var(--accent-softer);
    color: var(--accent-text);
    padding: 0.15em 0.4em;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

/* ---------- Links ---------- */
.link {
    color: var(--accent-text);
    text-decoration: underline;
    text-underline-offset: 0.18em;
    text-decoration-thickness: 1px;
    text-decoration-color: var(--accent-ring);
    transition: color 0.18s var(--ease), text-decoration-color 0.18s var(--ease);
}
.link:hover { text-decoration-color: currentColor; }

/* ---------- Layout ---------- */
.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 1.5rem; }
.container-narrow { max-width: var(--container-narrow); }

.section { padding: clamp(3rem, 2rem + 4vw, 6rem) 0; }
.section + .section { padding-top: 0; }
.page-top { padding-top: clamp(2rem, 1rem + 3vw, 4rem); }

.section-header { margin-bottom: clamp(2rem, 1.5rem + 1vw, 3rem); max-width: 70ch; }
.section-header-tight { margin-bottom: 2rem; }
.section-header-cv { margin-bottom: 2.5rem; }
.section-eyebrow {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--accent-text);
    padding: 0.3em 0.85em;
    background: var(--accent-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    margin-bottom: 1rem;
}
.section-intro { margin-top: 0.75rem; max-width: 65ch; }

/* ---------- Small layout utilities (used instead of inline styles) ---------- */
.mt-2   { margin-top: 2rem; }
.mt-15  { margin-top: 1.5rem; }
.mb-05  { margin-bottom: 0.5rem; }
.mb-125 { margin-bottom: 1.25rem; }
.card-narrow    { max-width: 720px; }
.card-wide      { max-width: 880px; }
.lead-block     { max-width: 65ch; margin-bottom: 1.5rem; }
.card-emphasis  { border-color: var(--accent-ring); box-shadow: var(--shadow-glow); }

/* ---------- Skip link ---------- */
.skip-link {
    position: absolute;
    top: -100px; left: 1rem;
    background: var(--bg-elevated);
    color: var(--text);
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-strong);
    box-shadow: var(--shadow-md);
    z-index: 1000;
    transition: top 0.2s var(--ease);
    font-weight: 600;
    font-size: 0.9375rem;
}
.skip-link:focus { top: 1rem; }

/* ---------- Header / Navigation ---------- */
.site-header {
    position: sticky; top: 0; z-index: 100;
    background: var(--bg-blur);
    backdrop-filter: saturate(180%) blur(16px);
    -webkit-backdrop-filter: saturate(180%) blur(16px);
    border-bottom: 1px solid var(--border);
}
.nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    max-width: var(--container);
    margin: 0 auto;
    padding: 0.85rem 1.5rem;
    flex-wrap: wrap;
}
.nav-brand {
    font-weight: 700;
    font-size: 0.9375rem;
    letter-spacing: -0.02em;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 0.55rem;
}
.nav-brand-dot {
    width: 9px; height: 9px;
    border-radius: 50%;
    background: var(--gradient);
    box-shadow: 0 0 14px var(--accent-ring);
}
.nav-links {
    display: flex;
    align-items: center;
    gap: 0.2rem;
    padding: 0.25rem;
    background: var(--accent-softer);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
}
.nav-link {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
    border-radius: var(--radius-pill);
    transition: color 0.18s var(--ease), background 0.18s var(--ease);
}
.nav-link:hover { color: var(--text); }
.nav-link[aria-current="page"] {
    color: var(--text);
    background: var(--bg-elevated);
    box-shadow: var(--shadow-sm);
}
.nav-controls { display: flex; align-items: center; gap: 0.5rem; }

/* ---------- Pill toggle group ---------- */
.toggle-group {
    display: inline-flex;
    padding: 0.2rem;
    background: var(--accent-softer);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
}
.toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    padding: 0.4rem 0.7rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    border-radius: var(--radius-pill);
    transition: color 0.18s var(--ease), background 0.18s var(--ease), box-shadow 0.18s var(--ease);
    letter-spacing: 0.02em;
}
.toggle-btn:hover { color: var(--text); }
.toggle-btn[aria-current="true"] {
    color: var(--text);
    background: var(--bg-elevated);
    box-shadow: var(--shadow-sm);
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.85rem 1.5rem;
    font-size: 0.9375rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    border-radius: var(--radius-pill);
    border: 1px solid transparent;
    transition: transform 0.22s var(--ease-out), box-shadow 0.22s var(--ease-out),
                background 0.22s var(--ease), border-color 0.22s var(--ease), color 0.22s var(--ease);
    will-change: transform;
    text-align: center;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }
.btn svg { width: 1.05em; height: 1.05em; }

.btn-primary {
    color: #fff;
    background: var(--gradient);
    box-shadow: 0 4px 12px -2px rgba(67, 56, 202, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}
[data-theme="dark"] .btn-primary {
    color: #0a0a0c;
    box-shadow: 0 4px 12px -2px rgba(129, 140, 248, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}
.btn-primary:hover {
    box-shadow: 0 8px 24px -4px rgba(67, 56, 202, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}
[data-theme="dark"] .btn-primary:hover {
    box-shadow: 0 8px 24px -4px rgba(129, 140, 248, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.btn-secondary {
    color: var(--text);
    background: var(--bg-elevated);
    border-color: var(--border-strong);
    box-shadow: var(--shadow-sm);
}
.btn-secondary:hover {
    border-color: var(--accent-ring);
    box-shadow: var(--shadow-glow);
}
.btn-ghost {
    color: var(--text-muted);
    background: transparent;
    border-color: var(--border);
}
.btn-ghost:hover {
    color: var(--text);
    background: var(--bg-elevated);
    border-color: var(--border-strong);
}
.btn-lg { padding: 1rem 1.75rem; font-size: 1rem; }

/* ---------- Cards ---------- */
.card {
    position: relative;
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    transition: transform 0.28s var(--ease-out), box-shadow 0.28s var(--ease-out), border-color 0.28s var(--ease);
}
.card:hover {
    transform: translateY(-4px);
    border-color: var(--accent-ring);
    box-shadow: var(--shadow-md), 0 0 0 1px var(--accent-ring);
}
.card-icon {
    width: 40px; height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    background: var(--gradient-soft);
    color: var(--accent-text);
    margin-bottom: 1rem;
    border: 1px solid var(--border);
}
.card-icon svg { width: 22px; height: 22px; }
.card-eyebrow {
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-subtle);
    margin-bottom: 0.5rem;
}
.card-title {
    font-size: 1.0625rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.5rem;
    letter-spacing: -0.01em;
}
.card-body {
    font-size: 0.9375rem;
    line-height: 1.55;
    color: var(--text-muted);
    margin: 0;
}

/* ---------- Grids ---------- */
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-auto { grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); }
.grid-tight { gap: 0.75rem; }

/* ---------- Hero ---------- */
.hero {
    padding: clamp(4rem, 3rem + 5vw, 7rem) 0 clamp(3rem, 2rem + 2vw, 5rem);
    position: relative;
}
.hero-content { max-width: 880px; }

/* Availability badge — solid green, clearly visible, AA contrast */
.hero-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: #ffffff;
    padding: 0.45rem 1rem;
    border: 1px solid rgba(21, 128, 61, 0.9);
    border-radius: var(--radius-pill);
    background: #15803d;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 12px -2px rgba(21, 128, 61, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}
.hero-eyebrow-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.28), 0 0 10px rgba(255, 255, 255, 0.7);
}
[data-theme="dark"] .hero-eyebrow {
    background: #22c55e;
    border-color: rgba(34, 197, 94, 0.65);
    color: #052e16;
    box-shadow: 0 2px 14px -2px rgba(34, 197, 94, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
[data-theme="dark"] .hero-eyebrow-dot {
    background: #052e16;
    box-shadow: 0 0 0 3px rgba(5, 46, 22, 0.22), 0 0 10px rgba(5, 46, 22, 0.5);
}

.hero-name {
    font-size: clamp(2.5rem, 1.5rem + 4.5vw, 5rem);
    line-height: 1.05;
    font-weight: 700;
    letter-spacing: -0.045em;
    margin-bottom: 0.5rem;
}
.hero-role {
    font-size: clamp(1.125rem, 1rem + 0.6vw, 1.625rem);
    font-weight: 500;
    background: var(--gradient);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.02em;
    margin-bottom: 1rem;
    display: block;
}
.hero-location {
    color: var(--text-muted);
    font-size: 1.0625rem;
    margin-bottom: 1.5rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}
.hero-location svg { width: 1.05em; height: 1.05em; color: var(--text-subtle); }
.hero-intro {
    font-size: clamp(1.0625rem, 1rem + 0.3vw, 1.25rem);
    line-height: 1.55;
    color: var(--text-muted);
    max-width: 60ch;
    margin-bottom: 1.25rem;
}
.hero-availability {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 1.75rem;
    max-width: 60ch;
}
.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}
.trust-line {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.875rem;
    color: var(--text-subtle);
    margin-top: 0.9rem;
}
.trust-line svg { width: 1em; height: 1em; flex-shrink: 0; }
.hero-contact {
    margin-top: 1.25rem;
    font-size: 0.9375rem;
    color: var(--text-subtle);
}
.hero-contact .link { font-weight: 500; }

/* ---------- Tag chips ---------- */
.chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}
.chip {
    display: inline-flex;
    align-items: center;
    padding: 0.4rem 0.85rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    font-family: var(--font-mono);
    letter-spacing: -0.01em;
    transition: border-color 0.18s var(--ease), transform 0.18s var(--ease), box-shadow 0.18s var(--ease);
}
.chip:hover {
    border-color: var(--accent-ring);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}
.chip[aria-current="true"] {
    background: var(--gradient);
    border-color: transparent;
    color: #fff;
    font-weight: 600;
    box-shadow: 0 2px 8px -2px rgba(67, 56, 202, 0.35);
}
[data-theme="dark"] .chip[aria-current="true"] { color: #0a0a0c; }
.chip[aria-current="true"]:hover { border-color: transparent; transform: none; }

/* ---------- Two-column split ---------- */
.split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2.5rem;
    align-items: center;
}
.split-content > * + * { margin-top: 1rem; }

/* ---------- Visual: Emacs org-agenda placeholder ---------- */
.agenda {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    box-shadow: var(--shadow-md);
    overflow: hidden;
}
.agenda-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 0.75rem;
    color: var(--text-subtle);
    font-size: 0.75rem;
    letter-spacing: 0.02em;
}
.agenda-header strong { color: var(--text); font-weight: 600; }
.agenda-day {
    color: var(--accent-text);
    margin: 0.75rem 0 0.35rem;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.agenda-day:first-child { margin-top: 0; }
.agenda-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 0.4rem 0;
    color: var(--text-muted);
    border-bottom: 1px dashed var(--border);
}
.agenda-item:last-child { border-bottom: none; }
.agenda-time { color: var(--text-subtle); font-size: 0.75rem; }
.agenda-tag {
    font-size: 0.625rem;
    padding: 0.15rem 0.45rem;
    border-radius: var(--radius-sm);
    background: var(--accent-soft);
    color: var(--accent-text);
    border: 1px solid var(--border);
    font-weight: 600;
    letter-spacing: 0.04em;
}
.agenda-visual-note {
    margin-top: 1rem;
    font-size: 0.75rem;
    color: var(--text-subtle);
    text-align: center;
    font-style: italic;
}

/* ---------- Forms ---------- */
.form-group { margin-bottom: 1.4rem; }
.form-fieldset {
    border: 0;
    padding: 0;
    margin: 0 0 1.4rem;
    min-width: 0;
}
.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.45rem;
}
.form-label .req { color: var(--accent-text); margin-left: 0.15em; }
.form-hint {
    font-size: 0.8125rem;
    color: var(--text-subtle);
    margin-top: 0.4rem;
}
.form-control {
    width: 100%;
    padding: 0.78rem 0.95rem;
    font-size: 0.9375rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    color: var(--text);
    transition: border-color 0.18s var(--ease), box-shadow 0.18s var(--ease);
}
.form-control::placeholder { color: var(--text-subtle); opacity: 1; }
.form-control:hover { border-color: var(--text-subtle); }
.form-control:focus {
    outline: none;
    border-color: var(--accent-1);
    box-shadow: 0 0 0 3px var(--accent-ring);
}
.form-control[aria-invalid="true"] {
    border-color: #b91c1c;
}
[data-theme="dark"] .form-control[aria-invalid="true"] { border-color: #f87171; }
textarea.form-control {
    min-height: 150px;
    resize: vertical;
    font-family: inherit;
    line-height: 1.5;
}
.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.field-error {
    font-size: 0.8125rem;
    font-weight: 500;
    color: #b91c1c;
    margin-top: 0.4rem;
}
[data-theme="dark"] .field-error { color: #f87171; }

.form-privacy {
    display: flex;
    align-items: flex-start;
    gap: 0.45rem;
    font-size: 0.8125rem;
    color: var(--text-subtle);
    margin: 0 0 1.25rem;
}
.form-privacy svg { width: 1em; height: 1em; flex-shrink: 0; margin-top: 0.15em; }

/* Honeypot — present in DOM, invisible to humans */
.hp-field {
    position: absolute;
    left: -9999px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* ---------- Radio chip group (purpose selector) ---------- */
.radio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.5rem;
}
.radio-wrap {
    position: relative;
    display: block;
}
.radio-chip-input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    margin: 0;
    pointer-events: none;
}
.radio-chip {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 0.6rem 0.9rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
    background: var(--bg-elevated);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-pill);
    cursor: pointer;
    user-select: none;
    text-align: center;
    transition: color 0.18s var(--ease), border-color 0.18s var(--ease),
                background 0.22s var(--ease), box-shadow 0.22s var(--ease), transform 0.18s var(--ease);
}
.radio-wrap:hover .radio-chip {
    border-color: var(--text-subtle);
    color: var(--text);
    transform: translateY(-1px);
}
.radio-chip-input:checked + .radio-chip {
    background: var(--gradient);
    color: #fff;
    border-color: transparent;
    font-weight: 600;
    box-shadow: 0 3px 10px -2px rgba(67, 56, 202, 0.4);
}
[data-theme="dark"] .radio-chip-input:checked + .radio-chip {
    color: #0a0a0c;
}
.radio-chip-input:focus-visible + .radio-chip {
    outline: 2px solid var(--accent-1);
    outline-offset: 2px;
}

/* ---------- Alerts ---------- */
.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-strong);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    font-size: 0.9375rem;
    line-height: 1.5;
}
.alert-success {
    background: rgba(34, 197, 94, 0.08);
    border-color: rgba(34, 197, 94, 0.30);
    color: var(--text);
}
.alert-error {
    background: rgba(239, 68, 68, 0.06);
    border-color: rgba(239, 68, 68, 0.30);
    color: var(--text);
}
.alert-icon { flex-shrink: 0; margin-top: 0.1em; color: currentColor; }
.alert-success .alert-icon { color: #16a34a; }
.alert-error .alert-icon { color: #dc2626; }
[data-theme="dark"] .alert-success .alert-icon { color: #4ade80; }
[data-theme="dark"] .alert-error .alert-icon { color: #f87171; }
.alert-body { flex: 1; }
.alert-body strong { display: block; margin-bottom: 0.2em; }
.alert-body p { color: inherit; }
.alert-body a { color: inherit; text-decoration: underline; text-underline-offset: 0.18em; }

.error-list {
    margin: 0;
    padding-left: 1.25rem;
    list-style: disc;
}
.error-list li { color: var(--text); margin-bottom: 0.2em; }

/* ---------- Two-option layout (contact) ---------- */
.options-2 {
    display: grid;
    grid-template-columns: 1fr 1.3fr;
    gap: 1.25rem;
    align-items: start;
}
.option-card { padding: 2rem; }
.option-card h3 { margin-bottom: 0.5rem; }
.option-card p { margin-bottom: 1.25rem; }
.option-card .btn { width: 100%; }

/* ============================================================
   CV page — content column uses the SAME centered container as
   Home (perfect alignment). The TOC is out of the flow:
   on wide screens (>= 1680px) it docks into the left margin,
   hugging the content column from the left; below that it
   stacks above the content.
   ============================================================ */
.cv-page {
    position: relative;
    padding-top: clamp(2rem, 1rem + 3vw, 4rem);
}

/* Anchor targets: keep headings clear of the sticky header */
section[id] { scroll-margin-top: 5.5rem; }

/* --- Default (viewports < 1680px): TOC stacked above content --- */
.cv-toc {
    max-width: var(--container);
    margin: 0 auto 2.5rem;
    padding: 0 1.5rem;
}
.cv-toc-title {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text);
    margin-bottom: 0.85rem;
}
.cv-toc-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    border-top: 1px solid var(--border);
    padding-top: 0.85rem;
}
.cv-toc-group {
    flex-basis: 100%;
    font-size: 0.8125rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text);
    padding: 0.65rem 0 0.25rem;
}
.cv-toc-group:first-child { padding-top: 0; }
.cv-toc-link {
    display: inline-block;
    padding: 0.42rem 0.85rem;
    font-size: 0.875rem;
    font-weight: 400;
    color: var(--text-muted);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    transition: color 0.18s var(--ease), border-color 0.18s var(--ease), transform 0.18s var(--ease);
    line-height: 1.4;
}
.cv-toc-link:hover {
    color: var(--text);
    border-color: var(--accent-ring);
    transform: translateY(-1px);
}

/* --- Wide screens: dock the TOC into the left margin --- */
@media (min-width: 1680px) {
    .cv-toc {
        position: absolute;
        top: clamp(2rem, 1rem + 3vw, 4rem);
        bottom: 0;
        right: calc(50% + (var(--container) / 2) + 2.5rem);
        left: auto;
        width: var(--toc-width);
        max-width: none;
        margin: 0;
        padding: 0;
    }
    .cv-toc-inner { position: sticky; top: 6rem; }
    .cv-toc-list {
        flex-direction: column;
        flex-wrap: nowrap;
        gap: 0.05rem;
        border-top: none;
        border-left: 1px solid var(--border);
        padding-top: 0;
    }
    .cv-toc-group {
        padding: 1.1rem 0.85rem 0.35rem;
        border-top: 1px solid var(--border-strong);
        margin-top: 0.5rem;
    }
    .cv-toc-group:first-child {
        padding-top: 0;
        margin-top: 0;
        border-top: none;
    }
    .cv-toc-link {
        background: transparent;
        border: none;
        border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
        padding-left: 0.85rem;
    }
    .cv-toc-link:hover {
        background: var(--accent-softer);
        border-color: transparent;
        padding-left: 1rem;
        transform: none;
    }
}

/* --- CV section rhythm --- */
.cv-sections .section {
    padding-top: 0;
    padding-bottom: 0;
}
.cv-sections .section + .section {
    margin-top: clamp(2.5rem, 2rem + 2vw, 4rem);
}
.cv-sections .cta-band { margin-top: 0; }

/* ---------- List styles ---------- */
.bullet-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.bullet-list li {
    position: relative;
    padding-left: 1.65rem;
    color: var(--text-muted);
    line-height: 1.55;
}
.bullet-list li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.55em;
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--gradient);
    opacity: 0.85;
}
.bullet-list strong { color: var(--text); }

.numbered-list {
    counter-reset: list;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}
.numbered-list li {
    counter-increment: list;
    position: relative;
    padding-left: 2.5rem;
    color: var(--text-muted);
    line-height: 1.55;
}
.numbered-list li::before {
    content: counter(list, decimal-leading-zero);
    position: absolute;
    left: 0; top: 0;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent-text);
    background: var(--accent-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.18rem 0.45rem;
    line-height: 1;
}

/* ---------- Section hline ---------- */
.hline {
    border: none;
    height: 2px;
    margin: 3.5rem calc(-50vw + 50%);
    width: 100vw;
    background: linear-gradient(90deg, transparent 0%, var(--border-strong) 15%, var(--accent-1) 40%, var(--accent-2) 60%, var(--border-strong) 85%, transparent 100%);
    opacity: 0.5;
}

/* ---------- Definition list ---------- */
.dl-grid {
    display: grid;
    grid-template-columns: minmax(140px, 200px) 1fr;
    gap: 0.85rem 1.5rem;
    align-items: baseline;
}
.dl-grid dt {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text);
}
.dl-grid dd {
    font-size: 0.9375rem;
    color: var(--text-muted);
    margin: 0;
}

/* ---------- Final CTA band ---------- */
.cta-band {
    margin-top: clamp(3rem, 2rem + 3vw, 5rem);
    padding: clamp(2.5rem, 2rem + 3vw, 4rem) 0;
    border-radius: var(--radius-xl);
    background: var(--bg-card);
    border: 1px solid var(--border);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
    text-align: center;
}
.cta-band::before {
    content: '';
    position: absolute;
    top: -50%; left: 50%;
    transform: translateX(-50%);
    width: 700px; height: 300px;
    background: radial-gradient(ellipse at center, var(--accent-soft), transparent 65%);
    pointer-events: none;
}
.cta-band-inner {
    position: relative;
    max-width: 600px;
    margin: 0 auto;
    padding: 0 1.5rem;
}
.cta-band h2 { margin-bottom: 0.6rem; }
.cta-band p { margin-bottom: 1.75rem; }

/* ---------- Footer ---------- */
.site-footer {
    border-top: 1px solid var(--border);
    padding: 2.5rem 0;
    margin-top: clamp(3rem, 2rem + 3vw, 5rem);
    background: var(--bg-blur);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
.footer-inner {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    color: var(--text-subtle);
    font-size: 0.8125rem;
    line-height: 1.5;
}
.footer-inner p { color: inherit; margin: 0; max-width: 60ch; }
.footer-links { display: flex; gap: 1.25rem; flex-wrap: wrap; }
.footer-links a { color: var(--text-muted); }
.footer-links a:hover { color: var(--text); }

/* ============================================================
   Articles
   ============================================================ */

/* Filter bar */
.filters {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: clamp(1.75rem, 1.25rem + 1.5vw, 3rem);
}
.filter-label {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-subtle);
    margin-bottom: 0.55rem;
}
.filter-chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }

/* Article cards */
.article-card { display: flex; flex-direction: column; }
.article-link { color: var(--text); }
.article-link:hover { color: var(--accent-text); }
.eyebrow-link { color: inherit; }
.eyebrow-link:hover { color: var(--accent-text); }
.article-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    font-size: 0.8125rem;
    color: var(--text-subtle);
    margin-bottom: 0.85rem;
}
.article-tags { margin-top: auto; padding-top: 0.75rem; }

/* Single article page */
.back-link { margin-bottom: 1.75rem; }
.back-link a {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
    transition: color 0.18s var(--ease);
}
.back-link a:hover { color: var(--accent-text); }
.back-link svg { width: 1em; height: 1em; }

.article-header { margin-bottom: 2.25rem; }
.article-title {
    font-size: clamp(1.875rem, 1.3rem + 2.5vw, 3.25rem);
    letter-spacing: -0.035em;
    margin-bottom: 0.75rem;
}
.lang-note {
    font-size: 0.8125rem;
    font-style: italic;
    color: var(--text-subtle);
    border-left: 2px solid var(--border-strong);
    padding-left: 0.75rem;
    margin-top: 1rem;
}

/* Article body — Markdown output */
.article-body { max-width: 72ch; }
.article-body p { margin: 0 0 1.1em; }
.article-body h2 {
    font-size: clamp(1.375rem, 1.2rem + 0.8vw, 1.75rem);
    margin: 2em 0 0.6em;
}
.article-body h3 {
    font-size: clamp(1.125rem, 1.05rem + 0.4vw, 1.3125rem);
    margin: 1.6em 0 0.5em;
}
.article-body h4 {
    font-size: 1.0625rem;
    margin: 1.4em 0 0.4em;
}

/* Lists — flat and nested; tight vs. loose items */
.article-body ul { list-style: disc; margin: 0 0 1.1em; padding-left: 1.5rem; }
.article-body ol { list-style: decimal; margin: 0 0 1.1em; padding-left: 1.5rem; }
.article-body li { margin-bottom: 0.4em; color: var(--text-muted); }
.article-body li:last-child { margin-bottom: 0; }
.article-body li > ul,
.article-body li > ol { margin: 0.4em 0 0.2em; }
.article-body li > p { margin: 0 0 0.5em; }
.article-body li > p:last-child { margin-bottom: 0; }

.article-body del { color: var(--text-muted); }

/* Blockquotes — single- or multi-paragraph, nestable */
.article-body blockquote {
    border-left: 3px solid var(--accent-ring);
    padding: 0.2rem 0 0.2rem 1.1rem;
    margin: 0 0 1.25em;
    color: var(--text-muted);
}
.article-body blockquote p { margin-bottom: 1em; }
.article-body blockquote p:last-child { margin-bottom: 0; }
.article-body blockquote > :last-child { margin-bottom: 0; }

.article-body hr {
    border: none;
    border-top: 1px solid var(--border-strong);
    margin: 2em 0;
}

/* Code blocks */
.article-body pre {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
    overflow-x: auto;
    margin: 0 0 1.25em;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    line-height: 1.5;
    box-shadow: var(--shadow-sm);
}
.article-body pre code {
    background: none;
    border: none;
    padding: 0;
    color: var(--text);
    font-size: inherit;
}

/* Images and figures — local images only */
.article-body img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}
.article-body figure { margin: 0 0 1.5em; }
.article-body figure img { margin-inline: auto; }
.article-body figcaption {
    font-size: 0.8125rem;
    color: var(--text-subtle);
    text-align: center;
    margin-top: 0.55em;
}

/* Tables */
.article-body .table-wrap { overflow-x: auto; margin: 0 0 1.25em; }
.article-body table {
    border-collapse: collapse;
    width: 100%;
    font-size: 0.9375rem;
}
.article-body th,
.article-body td {
    border: 1px solid var(--border-strong);
    padding: 0.5rem 0.85rem;
    text-align: left;
    vertical-align: top;
}
.article-body td { color: var(--text-muted); }
.article-body thead th {
    background: var(--accent-softer);
    font-weight: 600;
    color: var(--text);
}
.article-body tbody tr:nth-child(even) { background: var(--accent-softer); }
.article-body th.ta-left,  .article-body td.ta-left  { text-align: left; }
.article-body th.ta-center, .article-body td.ta-center { text-align: center; }
.article-body th.ta-right, .article-body td.ta-right { text-align: right; }

.article-body > :last-child { margin-bottom: 0; }

.article-tags-block {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.75rem;
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}
.article-tags-block .chip-list { margin-top: 0; }
.article-tags-label {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-subtle);
}

/* Prev / next navigation */
.article-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 2.5rem;
}
.article-nav-card {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    padding: 1.25rem 1.5rem;
}
.article-nav-card.next { align-items: flex-end; text-align: right; }
.article-nav-label {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-subtle);
}
.article-nav-label svg { width: 1em; height: 1em; }
.article-nav-title { font-size: 0.9375rem; font-weight: 600; color: var(--text); }
.article-nav-card:hover .article-nav-title { color: var(--accent-text); }

/* Empty state */
.empty-state {
    text-align: center;
    padding: clamp(2.5rem, 2rem + 2vw, 4rem) 1.5rem;
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-lg);
    color: var(--text-muted);
}
.empty-state p + p { margin-top: 0.5rem; }

@media (max-width: 640px) {
    .article-nav { grid-template-columns: 1fr; }
    .article-nav-card.next { align-items: flex-start; text-align: left; }
}

/* ---------- Focus ---------- */
:focus-visible { outline: 2px solid var(--accent-1); outline-offset: 2px; border-radius: 4px; }
.btn:focus-visible { outline: 2px solid var(--accent-1); outline-offset: 3px; }
.toggle-btn:focus-visible, .nav-link:focus-visible, .nav-brand:focus-visible {
    outline: 2px solid var(--accent-1);
    outline-offset: 2px;
}
.cv-toc-link:focus-visible, .chip:focus-visible, .link:focus-visible {
    outline: 2px solid var(--accent-1);
    outline-offset: 2px;
}

/* ---------- Entrance animations (CSS-only) ---------- */
@keyframes fade-up {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}
.fade-up { animation: fade-up 0.7s var(--ease-out) both; }
.delay-1 { animation-delay: 0.05s; }
.delay-2 { animation-delay: 0.12s; }
.delay-3 { animation-delay: 0.20s; }
.delay-4 { animation-delay: 0.28s; }
.delay-5 { animation-delay: 0.36s; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
    .options-2 { grid-template-columns: 1fr; }
    .split { grid-template-columns: 1fr; }
    .split-visual { order: -1; }
}
@media (max-width: 760px) {
    .nav { padding: 0.65rem 1rem; gap: 0.65rem; }
    .nav-links { order: 3; width: 100%; justify-content: center; }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .grid-auto { grid-template-columns: 1fr; }
    .dl-grid { grid-template-columns: 1fr; gap: 0.25rem 0; }
    .dl-grid dt { margin-top: 0.5rem; }
    .radio-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
}
@media (max-width: 540px) {
    .nav-controls { gap: 0.35rem; }
    .toggle-btn { padding: 0.35rem 0.55rem; min-width: 32px; }
    .hero-actions { flex-direction: column; align-items: stretch; }
    .hero-actions .btn { width: 100%; }
    .container { padding: 0 1rem; }
    .cv-toc { padding: 0 1rem; }
    .radio-grid { grid-template-columns: 1fr 1fr; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    .btn:hover, .card:hover, .chip:hover, .cv-toc-link:hover,
    .radio-wrap:hover .radio-chip { transform: none; }
}

/* ---------- Print ---------- */
@media print {
    .site-header, .site-footer, .nav-controls, .hero-actions, .cta-band,
    .skip-link, .cv-toc, .hp-field, .form-actions,
    .filters, .article-nav, .back-link { display: none !important; }
    body::before, body::after { display: none; }
    .card, .cta-band { box-shadow: none; }
    a { color: #000; }
    .card, .agenda, .option-card,
    .article-body pre, .article-body blockquote,
    .article-body figure, .article-body .table-wrap { break-inside: avoid; }
    h1, h2, h3 { break-after: avoid; }
}
