:root {
    --bg: #0e0d0b;
    --bg-elev: #16140f;
    --bg-elev-2: #1c1a14;
    --ink: #f4ecd8;
    --ink-dim: #a89e85;
    --ink-faint: #5e574a;
    --accent: #e6a23c;
    --accent-soft: rgba(230, 162, 60, 0.18);
    --rule: rgba(244, 236, 216, 0.08);
    --rule-strong: rgba(244, 236, 216, 0.14);
    --mono: "JetBrains Mono", ui-monospace, monospace;
    --serif: "Fraunces", "Times New Roman", serif;
    --container: 880px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 5rem;
}

html, body {
    background: var(--bg);
    color: var(--ink);
    font-family: var(--serif);
    font-size: 18px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    background-image:
        radial-gradient(circle at 15% 10%, rgba(230, 162, 60, 0.06), transparent 40%),
        radial-gradient(circle at 85% 90%, rgba(230, 162, 60, 0.04), transparent 50%);
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/><feColorMatrix values='0 0 0 0 0.95 0 0 0 0 0.93 0 0 0 0 0.85 0 0 0 0.05 0'/></filter><rect width='200' height='200' filter='url(%23n)'/></svg>");
    opacity: 0.4;
    mix-blend-mode: overlay;
    z-index: 0;
}

/* --- accessibility --- */
.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    background: var(--accent);
    color: var(--bg);
    padding: 0.5rem 0.9rem;
    font-family: var(--mono);
    font-size: 0.8rem;
    z-index: 100;
}

.skip-link:focus {
    left: 1rem;
    top: 1rem;
}

/* --- topbar --- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    background: rgba(14, 13, 11, 0.7);
    border-bottom: 1px solid var(--rule);
}

.topbar-inner {
    max-width: var(--container);
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
    color: var(--ink);
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: 1px solid var(--rule-strong);
    border-radius: 6px;
    color: var(--accent);
    font-family: var(--serif);
    font-style: italic;
    font-size: 1.1rem;
    line-height: 1;
    background: var(--bg-elev);
}

.brand-name {
    color: var(--ink-dim);
    font-size: 0.72rem;
}

.nav {
    display: flex;
    gap: 1.5rem;
}

.nav a {
    color: var(--ink-dim);
    text-decoration: none;
    font-size: 0.72rem;
    transition: color 0.2s;
}

.nav a:hover {
    color: var(--accent);
}

/* --- main / sections --- */
main {
    position: relative;
    z-index: 1;
}

.hero,
.section {
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 2rem;
}

.hero {
    padding-top: 7rem;
    padding-bottom: 6rem;
    min-height: calc(100vh - 4rem);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.section {
    padding-top: 5rem;
    padding-bottom: 5rem;
    border-top: 1px solid var(--rule);
}

.section-head {
    display: flex;
    align-items: baseline;
    gap: 1rem;
    margin-bottom: 2.5rem;
}

.section-num {
    color: var(--ink-faint);
}

.section-label {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--ink);
}

.section-body {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* --- typography --- */
.mono {
    font-family: var(--mono);
    font-size: 0.78rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--ink-dim);
}

h1 {
    font-family: var(--serif);
    font-weight: 500;
    font-size: clamp(3.5rem, 9vw, 6.5rem);
    line-height: 0.95;
    letter-spacing: -0.03em;
    margin-bottom: 2.5rem;
    font-variation-settings: "opsz" 144;
}

h1 em {
    font-style: italic;
    font-weight: 400;
    color: var(--accent);
    font-variation-settings: "opsz" 144;
}

h2 {
    font-family: var(--serif);
    font-weight: 500;
    font-size: 1.5rem;
    letter-spacing: -0.01em;
}

h3 {
    font-family: var(--serif);
    font-weight: 500;
    font-size: 1.25rem;
    letter-spacing: -0.01em;
    margin-bottom: 0.5rem;
    color: var(--ink);
}

.lede {
    font-size: 1.3rem;
    line-height: 1.55;
    color: var(--ink);
    max-width: 56ch;
    margin-bottom: 2.5rem;
}

.prose {
    font-size: 1.05rem;
    line-height: 1.7;
    color: var(--ink);
    max-width: 64ch;
}

.prose + .prose {
    margin-top: 0.25rem;
}

/* small mono "credentials" line — sits below About prose, links to /work */
.prose-meta {
    margin-top: 1.25rem;
    color: var(--ink-dim);
}

.prose-meta a {
    color: var(--ink-dim);
    text-decoration: none;
    transition: color 0.2s;
}

.prose-meta a:hover {
    color: var(--accent);
}

/* --- meta chip --- */
.meta {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 3rem;
    padding: 0.4rem 0.9rem;
    border: 1px solid var(--rule);
    border-radius: 999px;
    background: var(--bg-elev);
    width: fit-content;
}

.dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 12px var(--accent);
    animation: pulse 2.4s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* --- CTAs --- */
.cta-row {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.7rem 1.2rem;
    font-family: var(--mono);
    font-size: 0.78rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    text-decoration: none;
    border-radius: 6px;
    border: 1px solid transparent;
    transition: background-color 0.2s, border-color 0.2s, color 0.2s, transform 0.15s;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary {
    background: var(--accent);
    color: var(--bg);
}

.btn-primary:hover {
    background: #f0b04c;
}

.btn-ghost {
    background: transparent;
    color: var(--ink);
    border-color: var(--rule-strong);
}

.btn-ghost:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* --- focus grid --- */
.grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.card {
    padding: 1.5rem;
    border: 1px solid var(--rule);
    border-radius: 8px;
    background: var(--bg-elev);
    transition: border-color 0.2s, background-color 0.2s;
}

.card:hover {
    border-color: var(--rule-strong);
    background: var(--bg-elev-2);
}

.card p {
    color: var(--ink-dim);
    font-size: 1rem;
    line-height: 1.6;
}

.card-stack .stack {
    margin-top: 0.25rem;
    margin-bottom: 0;
}

/* --- tags --- */
.stack {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag {
    font-family: var(--mono);
    font-size: 0.72rem;
    padding: 0.3rem 0.7rem;
    border: 1px solid var(--rule);
    border-radius: 4px;
    color: var(--ink-dim);
    background: var(--bg);
    transition: color 0.2s, border-color 0.2s;
}

.tag:hover {
    color: var(--accent);
    border-color: var(--accent);
}

/* --- work --- */
.work {
    padding: 1.75rem;
    border: 1px solid var(--rule);
    border-radius: 8px;
    background: var(--bg-elev);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    transition: border-color 0.2s, background-color 0.2s;
}

.work:hover {
    border-color: var(--rule-strong);
    background: var(--bg-elev-2);
}

.work-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.work-head h3 {
    margin-bottom: 0;
}

.work-meta {
    color: var(--ink-faint);
}

.work-domain {
    color: var(--ink-dim);
    margin-top: -0.4rem;
}

/* /work — shorter hero (full-viewport hero would push every section off-screen) */
.hero-sm {
    padding-top: 6rem;
    padding-bottom: 3.5rem;
    min-height: auto;
    display: block;
}

.hero-sm h1 {
    font-size: clamp(2.6rem, 7vw, 4.5rem);
    margin-bottom: 1.5rem;
}

/* /work — list of case-study cards within a theme group */
.work-list {
    gap: 1rem;
}

/* /work — Problem / Approach / Outcome blocks inside a case-study card */
.case-body {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.case-block {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.case-label {
    color: var(--accent);
}

.case-block p {
    color: var(--ink);
    font-size: 1rem;
    line-height: 1.6;
    max-width: 64ch;
}

/* --- experience timeline --- */
.timeline {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.role {
    display: grid;
    grid-template-columns: 12rem 1fr;
    gap: 1.5rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--rule);
}

.role:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.role-time {
    color: var(--ink-faint);
    padding-top: 0.35rem;
    white-space: nowrap;
}

.role-org {
    color: var(--ink-dim);
    font-size: 0.95rem;
    margin-bottom: 0.75rem;
}

/* --- contact --- */
.contact {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 0.5rem;
}

.link {
    color: var(--ink);
    text-decoration: none;
    border-bottom: 1px solid var(--accent);
    padding-bottom: 1px;
    transition: color 0.2s;
}

.link:hover {
    color: var(--accent);
}

.sep {
    color: var(--ink-faint);
}

/* --- footer --- */
footer {
    position: relative;
    z-index: 1;
    border-top: 1px solid var(--rule);
    margin-top: 2rem;
}

.footer-inner {
    max-width: var(--container);
    margin: 0 auto;
    padding: 2rem;
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.footer-loc {
    color: var(--ink-faint);
}

/* --- responsive --- */
@media (max-width: 720px) {
    .topbar-inner { padding: 0.85rem 1.25rem; }
    .brand-name { display: none; }
    .nav { gap: 1rem; }

    .hero,
    .section { padding-left: 1.25rem; padding-right: 1.25rem; }
    .hero { padding-top: 5rem; padding-bottom: 4rem; }
    .section { padding-top: 4rem; padding-bottom: 4rem; }

    .lede { font-size: 1.15rem; }

    .grid { grid-template-columns: 1fr; }

    .role { grid-template-columns: 1fr; gap: 0.5rem; }
    .role-time { padding-top: 0; }

    .footer-inner { padding: 1.5rem 1.25rem; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .dot { animation: none; }
    .btn:hover { transform: none; }
}

/* ===========================================================================
   CV page (/cv) — a clean, light, professional "sheet" laid on the dark site.
   Conventional two-column résumé: photo + identity header, a narrow sidebar
   (education / certs / skills / languages / hobbies) and a wide main column
   (about me / work experience) split by a vertical rule. Prints to a crisp,
   ink-friendly A4 page. Self-contained light palette — does not use the site's
   dark tokens, so it reads the same on screen and on paper.
   =========================================================================== */
:root {
    --cv-navy: #1f3a5f;
    --cv-blue: #2f6db0;
    --cv-ink: #2b2b2b;
    --cv-muted: #5c6470;
    --cv-faint: #8a929c;
    --cv-rule: #e3e7ec;
    --cv-sans: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
}

.cv-actions {
    max-width: 860px;
    margin: 5.5rem auto 1.25rem;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    position: relative;
    z-index: 1;
}

.cv-back {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-family: var(--cv-sans);
    font-size: 0.9rem;
    font-weight: 500;
    letter-spacing: 0.01em;
    color: var(--ink-dim);
    text-decoration: none;
    transition: color 0.15s ease;
}
.cv-back svg { width: 16px; height: 16px; transition: transform 0.15s ease; }
.cv-back:hover { color: var(--ink); }
.cv-back:hover svg { transform: translateX(-3px); }

.cv-print {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--cv-sans);
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    color: #fff;
    background: var(--cv-navy);
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 0.6rem 1.15rem;
    cursor: pointer;
    box-shadow: 0 2px 12px -4px rgba(0, 0, 0, 0.6);
    transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.cv-print svg { width: 16px; height: 16px; }
.cv-print:hover {
    background: #284c73;
    transform: translateY(-1px);
    box-shadow: 0 6px 18px -6px rgba(47, 109, 176, 0.7);
}
.cv-print:active { transform: translateY(0); box-shadow: 0 2px 8px -4px rgba(0, 0, 0, 0.6); }
.cv-print:focus-visible { outline: 2px solid var(--cv-blue); outline-offset: 2px; }

.cv-sheet {
    max-width: 860px;
    margin: 0 auto 5rem;
    padding: 3.2rem 3rem 3.4rem;
    background: #fff;
    color: var(--cv-ink);
    font-family: var(--cv-sans);
    line-height: 1.5;
    border-radius: 4px;
    box-shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.55);
    position: relative;
    z-index: 1;
}

/* On screen the print-margin table is invisible plumbing: collapse it to plain
   blocks and hide the spacer rows. It only becomes a real table when printing
   (see the print block), where thead/tfoot repeat a margin band per page. */
.cv-frame,
.cv-frame > tbody,
.cv-frame > tbody > tr,
.cv-frame > tbody > tr > td { display: block; }
.cv-frame > thead,
.cv-frame > tfoot { display: none; }

.cv-header {
    display: flex;
    align-items: center;
    gap: 1.8rem;
    padding-bottom: 1.8rem;
    margin-bottom: 2rem;
    border-bottom: 2px solid var(--cv-navy);
}

.cv-photo {
    flex: none;
    position: relative;
    width: 104px;
    height: 104px;
    border-radius: 50%;
    background: #eef3f9;
    box-shadow: 0 0 0 4px #fff, 0 0 0 7px var(--cv-blue);
}

/* initials shown when there's no photo (or it fails to load) */
.cv-photo-fallback {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--cv-navy);
    font-weight: 600;
    font-size: 2.1rem;
    letter-spacing: 0.02em;
}

/* real headshot, layered over the initials and clipped to the circle */
.cv-photo-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.cv-name {
    font-family: var(--cv-sans);
    font-weight: 700;
    font-size: clamp(1.8rem, 4vw, 2.4rem);
    line-height: 1.05;
    letter-spacing: -0.01em;
    color: var(--cv-navy);
    margin: 0;
}

.cv-role {
    margin: 0.35rem 0 0;
    font-size: 1.02rem;
    font-weight: 500;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--cv-blue);
}

.cv-contact {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem 1.4rem;
    margin: 0.85rem 0 0;
    padding: 0;
    font-size: 0.9rem;
    color: var(--cv-muted);
}

.cv-contact a { color: var(--cv-muted); text-decoration: none; }
.cv-contact a:hover { color: var(--cv-blue); }

.cv-grid {
    display: grid;
    grid-template-columns: 1fr 2.05fr;
    gap: 2.4rem;
}

.cv-side { padding-right: 0.4rem; }
.cv-main { padding-left: 2.4rem; border-left: 1px solid var(--cv-rule); }

.cv-block { margin-bottom: 1.7rem; }
.cv-block:last-child { margin-bottom: 0; }

.cv-block-title {
    font-family: var(--cv-sans);
    font-weight: 700;
    font-size: 0.82rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--cv-navy);
    padding-bottom: 0.4rem;
    margin: 0 0 0.9rem;
    border-bottom: 1px solid var(--cv-rule);
}

.cv-summary {
    margin: 0;
    font-size: 0.96rem;
    line-height: 1.6;
    color: var(--cv-ink);
}

.cv-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.45rem; }
.cv-list li { color: var(--cv-ink); font-size: 0.9rem; line-height: 1.4; }
.cv-list a { color: var(--cv-blue); text-decoration: none; }
.cv-list a:hover { text-decoration: underline; }

/* skills / hobbies: small dot bullets */
.cv-dotted li { position: relative; padding-left: 0.95rem; }
.cv-dotted li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.5em;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--cv-blue);
}

.cv-langs li { display: flex; justify-content: space-between; gap: 1rem; }
.cv-lang-level { color: var(--cv-faint); font-size: 0.82rem; }

.cv-edu { display: flex; flex-direction: column; gap: 0.1rem; margin-bottom: 0.85rem; }
.cv-edu:last-child { margin-bottom: 0; }
.cv-edu-degree { color: var(--cv-ink); font-weight: 600; font-size: 0.92rem; }
.cv-edu-inst { color: var(--cv-muted); font-size: 0.85rem; }

.cv-exp { margin-bottom: 1.4rem; }
.cv-exp:last-child { margin-bottom: 0; }

.cv-exp-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
}

.cv-exp-role { font-family: var(--cv-sans); font-size: 1.04rem; font-weight: 700; color: var(--cv-navy); margin: 0; }
.cv-exp-period { color: var(--cv-faint); font-size: 0.84rem; white-space: nowrap; }
.cv-exp-company {
    display: block;
    color: var(--cv-blue);
    font-weight: 600;
    font-size: 0.9rem;
    margin: 0.1rem 0 0.55rem;
}

.cv-exp-points { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.4rem; }
.cv-exp-points li {
    position: relative;
    padding-left: 1.1rem;
    color: var(--cv-ink);
    font-size: 0.92rem;
    line-height: 1.5;
}
.cv-exp-points li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.62em;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--cv-blue);
}

@media (max-width: 720px) {
    .cv-actions { margin-top: 4.5rem; padding: 0 1rem; }
    .cv-sheet { margin: 0 0.75rem 3rem; padding: 2rem 1.4rem 2.4rem; border-radius: 0; }
    .cv-header { flex-direction: column; align-items: flex-start; gap: 1.1rem; text-align: left; }
    .cv-grid { grid-template-columns: 1fr; gap: 1.6rem; }
    .cv-main { padding-left: 0; border-left: none; padding-top: 1.6rem; border-top: 1px solid var(--cv-rule); }
}

/* --- print: the sheet becomes the page; drop chrome, shadow and margins --- */
@media print {
    html, body {
        background: #fff !important;
        background-image: none !important;
        color: var(--cv-ink) !important;
        font-size: 10pt;
    }
    body::before { display: none !important; }
    .topbar, footer, .skip-link, .cv-actions { display: none !important; }

    /* Zero the @page margin so the browser stops drawing its own date/title
       header + URL/page-number footer in the print margins. Horizontal page
       margins come from the sheet padding; vertical margins come from the
       repeating thead/tfoot spacer rows of .cv-frame (below) so every page —
       not just the first — gets a top and bottom margin. */
    .cv-sheet {
        max-width: none;
        margin: 0;
        padding: 0 1.4cm;
        border-radius: 0;
        box-shadow: none;
    }

    .cv-frame { display: table; width: 100%; }
    .cv-frame > thead { display: table-header-group; }
    .cv-frame > tfoot { display: table-footer-group; }
    .cv-frame > tbody { display: table-row-group; }
    .cv-frame > tbody > tr { display: table-row; }
    .cv-frame > tbody > tr > td { display: table-cell; }
    .cv-frame-pad { height: 1.3cm; }

    /* Keep individual roles + edu entries intact, but let the long Work
       Experience section itself flow across the page break — otherwise the
       whole block jumps to page 2 and leaves page 1 two-thirds empty. */
    .cv-exp, .cv-edu { break-inside: avoid; }
    .cv-block-title { break-after: avoid; }
    .cv-photo { box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--cv-blue); }
    .cv-list a { color: var(--cv-ink); }

    a { text-decoration: none; }
    @page { margin: 0; }
}
