:root {
    color-scheme: light;
    --bg: #f9f6f1;
    --surface: #fffdf9;
    --panel: #f1e9f5;
    --text: #231e26;
    --muted: #625866;
    --border: #d9cfdc;
    --accent: #663a84;
    --accent-ink: #fffafc;
    --footer: #281d31;
    --footer-ink: #faf2fc;
    --display: Georgia, "Times New Roman", serif;
    font-family: "Segoe UI", system-ui, sans-serif;
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #1b1720;
    --surface: #251f2b;
    --panel: #32263c;
    --text: #faf0f8;
    --muted: #c8bac9;
    --border: #514358;
    --accent: #ddb4f2;
    --accent-ink: #2c1639;
    --footer: #211727;
    --footer-ink: #faf2fc;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: 6.5rem; }
body { margin: 0; background: var(--bg); color: var(--text); }
p, h1, h2, h3, dl, dd { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 0.28rem; }
.wrap { width: min(69rem, calc(100% - 3rem)); margin-inline: auto; }
.skip-link { position: fixed; z-index: 5; top: 1rem; left: 1rem; padding: .7rem 1rem; background: var(--surface); transform: translateY(-200%); }
.skip-link:focus { transform: none; }

.site-header {
    position: sticky;
    top: 0;
    z-index: 2;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
}
.topbar, .brand, .header-actions, nav { display: flex; align-items: center; }
.topbar { min-height: 4.6rem; justify-content: space-between; gap: 1rem; }
.brand { gap: .65rem; width: max-content; font-weight: 740; white-space: nowrap; }
.mark { display: grid; place-items: center; width: 2.05rem; height: 2.05rem; border-radius: .45rem; background: var(--accent); color: var(--accent-ink); font: italic 1.1rem var(--display); }
nav { gap: clamp(.65rem, 2vw, 1.85rem); color: var(--muted); font-size: .89rem; font-weight: 600; }
nav a { padding-block: .75rem; }
nav a:hover, .brand:hover, .viewer-actions a:hover { color: var(--accent); }
.nav-cv { padding: .46rem .65rem; border: 1px solid var(--border); border-radius: .4rem; color: var(--accent); }
.header-actions { gap: .55rem; }
.icon-button { display: grid; place-items: center; min-width: 2.65rem; min-height: 2.65rem; padding-inline: .55rem; border: 1px solid var(--border); border-radius: .5rem; background: var(--surface); color: var(--text); cursor: pointer; }
.icon-button span { font-size: 1.4rem; line-height: 1; }
.icon-button:hover { border-color: var(--accent); color: var(--accent); }
.menu-toggle { display: none; }

.hero { display: grid; grid-template-columns: minmax(0, 1.54fr) minmax(0, 1fr); gap: clamp(2rem, 7vw, 7rem); align-items: center; padding-block: clamp(3rem, 8vw, 7.15rem) clamp(2.6rem, 6vw, 5rem); }
.eyebrow, .issuer, .period { color: var(--accent); font-size: .72rem; font-weight: 750; letter-spacing: .11em; text-transform: uppercase; line-height: 1.55; }
.hero h1 { margin-block: .65rem 1.2rem; font: 400 clamp(3.6rem, 9vw, 8.1rem)/.88 var(--display); letter-spacing: -.075em; }
h1 em, h2 em { color: var(--accent); font-weight: inherit; }
.hero-copy { max-width: 35rem; color: var(--muted); font-size: clamp(1rem, 1.7vw, 1.22rem); line-height: 1.63; }
.actions { display: flex; flex-wrap: wrap; gap: .7rem; margin-top: 1.65rem; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: .7rem; min-height: 2.95rem; padding: .55rem 1rem; border: 1px solid transparent; border-radius: .48rem; font-size: .9rem; font-weight: 700; }
.primary { background: var(--accent); color: var(--accent-ink); }
.primary:hover { filter: brightness(1.13); }
.secondary { border-color: var(--border); background: var(--surface); }
.secondary:hover { color: var(--accent); border-color: var(--accent); }

.current { position: relative; isolation: isolate; overflow: hidden; min-width: 0; padding: clamp(1.45rem, 4vw, 2.6rem); border: 1px solid var(--border); border-radius: 1rem; background: var(--panel); }
.current::before, .current::after { content: ""; position: absolute; z-index: -1; width: 17rem; height: 17rem; top: -10rem; right: -8rem; border: 1px solid var(--border); border-radius: 50%; pointer-events: none; }
.current::after { width: 21rem; height: 21rem; top: -11rem; right: -9rem; }
.current-label { display: flex; align-items: center; gap: .55rem; }
.current-label span { width: .45rem; height: .45rem; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 .25rem color-mix(in srgb, var(--accent) 16%, transparent); }
.current h2 { margin-top: 1rem; font: 400 clamp(2.45rem, 5vw, 4.4rem)/1 var(--display); letter-spacing: -.06em; }
.current p { margin-block: .65rem 1.45rem; color: var(--muted); line-height: 1.45; }
.current dl > div { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .35rem 1rem; border-top: 1px solid var(--border); padding-block: .7rem; font-size: .89rem; }
.current dt { color: var(--muted); }
.current dd { font-weight: 650; }

.facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--border); border-radius: .75rem; background: var(--surface); }
.facts a { position: relative; display: grid; gap: .4rem; padding: clamp(.8rem, 2.7vw, 1.9rem); }
.facts a + a { border-left: 1px solid var(--border); }
.facts a:hover { background: var(--panel); }
.facts a:first-child { border-radius: .75rem 0 0 .75rem; }
.facts a:last-child { border-radius: 0 .75rem .75rem 0; }
.facts strong { color: var(--accent); font: 400 clamp(2rem, 5vw, 3.65rem)/1 var(--display); letter-spacing: -.07em; }
.facts span { color: var(--muted); font-size: clamp(.72rem, 1.7vw, .93rem); }
.facts .fact-arrow { position: absolute; top: .8rem; right: .9rem; color: var(--accent); }

.chapter { padding-block: clamp(2.8rem, 7vw, 5.25rem); border-bottom: 1px solid var(--border); }
.chapter h2, .contact h2 { font: 400 clamp(2.05rem, 5vw, 4rem)/1.05 var(--display); letter-spacing: -.055em; }
.chapter h2 { margin-bottom: clamp(1.4rem, 4vw, 2.4rem); }
.about { display: grid; grid-template-columns: 1.12fr 1fr; gap: 1.5rem clamp(1.5rem, 6vw, 5rem); align-items: start; }
.about > p { color: var(--muted); font-size: 1.08rem; line-height: 1.75; }
.about h3, .languages h3 { font-size: 1.06rem; }
.tags, .timeline, .credential-grid, .social-links { margin: 0; padding: 0; list-style: none; }
.tags { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: .7rem; }
.tags li { padding: .35rem .64rem; border: 1px solid var(--border); border-radius: 2rem; background: var(--surface); color: var(--muted); font-size: .81rem; }

.timeline { border-left: 1px solid var(--border); margin-left: .25rem; padding-left: clamp(1rem, 3vw, 2.2rem); }
.timeline > li { position: relative; }
.timeline > li::before { content: ""; position: absolute; top: 1.4rem; left: calc(-1 * clamp(1rem, 3vw, 2.2rem) - .29rem); width: .53rem; height: .53rem; border: 2px solid var(--accent); border-radius: 50%; background: var(--bg); }
.timeline > li:first-child::before { background: var(--accent); }
.timeline > li + li { margin-top: .75rem; }
.job { display: grid; grid-template-columns: minmax(7rem, .38fr) minmax(0, 1.62fr); gap: .55rem 1.1rem; padding: 1.1rem clamp(1rem, 3vw, 1.7rem); border: 1px solid var(--border); border-radius: .6rem; background: var(--surface); }
.organization { color: var(--accent); font-size: .85rem; font-weight: 650; }
.job h3, .education h3 { margin-block: .25rem .55rem; font-size: clamp(1.05rem, 2vw, 1.29rem); line-height: 1.3; }
.job ul { margin: 0; padding-left: 1.15rem; }
.job li + li { margin-top: .25rem; }
.job ul, .job h3 + p, .education h3 + p { color: var(--muted); line-height: 1.55; }

.credential-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .85rem; }
.credential-grid > li { min-width: 0; }
.credential, .credential-other { display: flex; flex-direction: column; min-height: 100%; padding: clamp(1rem, 2.5vw, 1.4rem); border: 1px solid var(--border); border-radius: .65rem; background: var(--surface); }
.credential:hover { border-color: var(--accent); background: var(--panel); transform: translateY(-.16rem); }
.credential h3 { margin-block: .5rem .38rem; font: 400 1.8rem/1.02 var(--display); letter-spacing: -.045em; }
.credential p, .credential-other p { color: var(--muted); font-size: .91rem; line-height: 1.42; }
.credential .proof { margin-top: auto; padding-top: 1.2rem; color: var(--accent); font-size: .8rem; font-weight: 680; }
.credential-other { background: var(--panel); }
.credential-other h3 { margin-bottom: .65rem; font-size: 1.04rem; }
.credential-other p + p { margin-top: .35rem; }

.education { display: grid; grid-template-columns: 1fr 1fr; gap: .85rem; }
.education article { padding: 1rem; border: 1px solid var(--border); border-radius: .6rem; background: var(--surface); }
.languages { margin-top: 1.3rem; }
.languages dl { display: flex; flex-wrap: wrap; gap: .65rem 2rem; margin-top: .6rem; }
.languages dt { font-weight: 650; }
.languages dd { margin-top: .16rem; color: var(--muted); font-size: .9rem; }

footer { margin-top: clamp(2.65rem, 6vw, 5rem); background: var(--footer); color: var(--footer-ink); }
footer :focus-visible { outline-color: #e1b8ee; }
.contact { display: grid; grid-template-columns: 1fr 1.12fr; gap: 1.65rem clamp(2rem, 7vw, 7rem); align-items: start; padding-block: clamp(2.1rem, 6vw, 4.6rem); }
.contact .eyebrow, .contact h2 em { color: #e1b8ee; }
.contact h2 { margin-top: .45rem; }
.social-links li { border-bottom: 1px solid #5b4865; }
.social-links a { display: grid; grid-template-columns: 4.4rem minmax(0, 1fr) auto; align-items: center; gap: .4rem .7rem; min-height: 3rem; font-size: .9rem; }
.social-links a > span { color: #e4d2e9; overflow-wrap: anywhere; }
.social-links a:hover { color: #edc6f5; }
.footer-end { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .65rem; padding-block: 1rem; border-top: 1px solid #5b4865; color: #e4d2e9; font-size: .83rem; }
.footer-end a:hover { text-decoration: underline; }

#document-viewer { width: min(64rem, calc(100% - 1.5rem)); height: min(54rem, calc(100% - 1.5rem)); max-height: none; margin: auto; padding: 0; border: 1px solid var(--border); border-radius: .65rem; background: var(--surface); color: var(--text); }
#document-viewer[open] { display: grid; grid-template-rows: auto auto minmax(0, 1fr); }
#document-viewer::backdrop { background: #170e20c2; }
body:has(dialog[open]) { overflow: hidden; }
.viewer-header, .viewer-actions { display: flex; align-items: center; gap: .65rem; padding: .7rem 1rem; }
.viewer-header { justify-content: space-between; border-bottom: 1px solid var(--border); }
.viewer-header h2 { font-size: clamp(.98rem, 2.5vw, 1.25rem); }
.viewer-header button { font-size: 1.35rem; }
.viewer-actions { flex-wrap: wrap; color: var(--accent); font-size: .87rem; font-weight: 650; }
.viewer-actions a { padding: .2rem .45rem; text-decoration: underline; text-underline-offset: .2em; }
#document-frame { width: 100%; height: 100%; border: 0; background: var(--panel); }
#document-fallback { padding: 1rem 1.4rem; color: var(--muted); }

@media (prefers-reduced-motion: no-preference) {
    html { scroll-behavior: smooth; }
    .credential { transition: background .18s, border-color .18s, transform .18s; }
    .entered { animation: enter .44s ease-out both; }
    @keyframes enter {
        from { opacity: .35; translate: 0 .6rem; }
        to { opacity: 1; translate: 0 0; }
    }
}

@media (max-width: 52rem) {
    .wrap { width: calc(100% - 2.25rem); }
    .topbar { flex-wrap: wrap; min-height: 3.8rem; padding-block: .5rem; gap: .5rem; }
    .topbar nav { order: 3; width: 100%; flex-wrap: wrap; }
    .js .menu-toggle { display: grid; }
    .js .topbar nav:not(.menu-open) { display: none; }
    .hero { grid-template-columns: 1fr; gap: 1.6rem; }
    .hero h1 { font-size: clamp(3.65rem, 13vw, 6.3rem); }
    .current { max-width: 33rem; }
    .credential-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .about, .contact { grid-template-columns: 1fr; }
}

@media (max-width: 32rem) {
    .credential-grid, .education, .job { grid-template-columns: 1fr; }
    .facts .fact-arrow { display: none; }
    .facts span { overflow-wrap: anywhere; }
    .job { padding-block: .85rem; }
}
