:root {
  color-scheme: light;
  --bg: #f6f7f8;
  --surface: #ffffff;
  --text: #17212b;
  --muted: #5c6874;
  --line: #d9dfe4;
  --accent: #155eef;
  --accent-soft: #eaf0ff;
  --focus: #155eef;
  --max: 1120px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111820;
  --surface: #18222d;
  --text: #edf2f6;
  --muted: #a6b2bf;
  --line: #34414e;
  --accent: #83aaff;
  --accent-soft: #202f48;
  --focus: #a9c2ff;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #111820;
    --surface: #18222d;
    --text: #edf2f6;
    --muted: #a6b2bf;
    --line: #34414e;
    --accent: #83aaff;
    --accent-soft: #202f48;
    --focus: #a9c2ff;
  }
}

* { box-sizing: border-box; }
html { scrollbar-color: var(--accent) var(--bg); scrollbar-width: thin; }
::-webkit-scrollbar { width: 11px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { border: 3px solid var(--bg); border-radius: 0; background: var(--accent); }
::-webkit-scrollbar-thumb:hover { background: var(--text); }
html { scroll-behavior: smooth; scroll-padding-top: 5rem; }
body { margin: 0; background: var(--bg); color: var(--text); font-size: 16px; line-height: 1.55; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: .2em; }
a:hover { color: var(--accent); }
button, a, summary { -webkit-tap-highlight-color: transparent; }
button, summary { cursor: pointer; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; }
.page-wrap { width: min(var(--max), calc(100% - 40px)); margin-inline: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; z-index: 10; top: 8px; left: 8px; padding: .65rem 1rem; transform: translateY(-160%); background: var(--text); color: var(--bg); }
.skip-link:focus { transform: translateY(0); }

.site-header { position: relative; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 16px; width: min(var(--max), calc(100% - 40px)); min-height: 76px; margin-inline: auto; border-bottom: 1px solid var(--line); }
.wordmark { position: relative; display: inline-flex; align-items: center; font-size: 1.45rem; font-weight: 800; letter-spacing: -.08em; text-decoration: none; }
.wordmark-l { color: var(--text); }
.wordmark-k { align-self: flex-start; margin: 1px 0 0 3px; color: var(--accent); font-size: .52rem; font-weight: 650; letter-spacing: .02em; }
.site-nav { display: flex; order: 3; gap: 17px; width: 100%; overflow-x: auto; padding: 0 0 12px; scrollbar-width: none; }
.site-nav::-webkit-scrollbar { display: none; }
.site-nav a { flex: none; color: var(--muted); font-size: .78rem; text-decoration: none; }
.site-nav a:hover { color: var(--text); }
.header-clock { margin-left: auto; color: var(--muted); font-size: .78rem; font-variant-numeric: tabular-nums; letter-spacing: .04em; }
.theme-toggle { display: grid; flex: none; place-items: center; width: 40px; height: 40px; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: transparent; color: var(--text); cursor: pointer; }
.theme-toggle:hover { border-color: var(--accent); }
::view-transition-old(root) { animation: none; z-index: 1; }
::view-transition-new(root) { z-index: 2; animation: theme-reveal 520ms cubic-bezier(.2,.75,.25,1) both; }
@keyframes theme-reveal { from { clip-path: circle(0 at calc(100% - 36px) 36px); } to { clip-path: circle(150vmax at calc(100% - 36px) 36px); } }
.theme-icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; }
:root:not([data-theme="dark"]) .theme-icon--dark { display: none; }
:root[data-theme="dark"] .theme-icon--light { display: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .theme-icon--light { display: none; } :root:not([data-theme="light"]) .theme-icon--dark { display: block; } }

.hero { position: relative; display: flex; min-height: 620px; flex-direction: column; justify-content: center; padding-block: 76px 110px; }
.hero-copy { position: relative; z-index: 1; max-width: 760px; animation: hero-rise 480ms ease-out both; }
@keyframes hero-rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
.hero-kicker, .section-index { margin: 0 0 24px; color: var(--muted); font-size: .78rem; font-weight: 650; letter-spacing: .03em; }
.hero-kicker span, .section-index span { color: var(--accent); }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 22px; font-size: clamp(3.5rem, 14vw, 7.4rem); font-weight: 720; letter-spacing: -.085em; line-height: .91; }
.hero-lastname { color: var(--muted); }
.hero-initial { display: inline-block; color: var(--muted); font-size: .29em; font-weight: 450; letter-spacing: -.02em; vertical-align: .9em; }
.name-initial { color: var(--muted); font-size: .86em; font-weight: 500; }
.hero-role { margin-bottom: 30px; font-size: clamp(1rem, 3vw, 1.3rem); color: var(--muted); }
.hero-role span { color: var(--accent); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.button { position: relative; display: inline-flex; min-height: 48px; align-items: center; justify-content: center; gap: 12px; padding: 0 18px; border: 1px solid var(--line); border-radius: 2px; font-size: .9rem; font-weight: 650; text-decoration: none; cursor: pointer; }
.button-primary { border-color: var(--accent); background: var(--accent); color: #fff; }
.button-primary:hover { color: #fff; }
.button-secondary { background: var(--surface); }
.button-disabled { opacity: .82; cursor: not-allowed; }
.hero-note { margin: 12px 0 0; color: var(--muted); font-size: .76rem; }
.hero-note code { font-family: inherit; }
.hero-mark { position: absolute; top: 76px; right: 6%; display: flex; flex-direction: column; align-items: center; gap: 16px; color: var(--accent); }
.hero-mark-label { font-size: 1rem; font-weight: 800; letter-spacing: .12em; }
.hero-mark-line { width: 1px; height: 100px; background: var(--accent); }
.hero-mark-index { color: var(--muted); font-size: .7rem; writing-mode: vertical-rl; }
.hero-scroll { position: absolute; bottom: 32px; left: 0; display: flex; align-items: center; gap: 16px; color: var(--muted); font-size: .8rem; text-decoration: none; }
.hero-scroll span:last-child { display: grid; width: 40px; height: 40px; place-items: center; border: 1px solid var(--accent); border-radius: 50%; background: transparent; color: var(--accent); font-size: 1.15rem; }
@media (prefers-reduced-motion: no-preference) {
  .hero-scroll span:last-child { animation: scroll-arrow-bob 1.7s ease-in-out infinite; }
  @keyframes scroll-arrow-bob { 50% { transform: translateY(5px); } }
}

.section { padding-block: 82px; border-top: 1px solid var(--line); }
.section-heading { max-width: 740px; margin-bottom: 42px; }
.section-index { margin-bottom: 16px; }
h2 { margin-bottom: 18px; font-size: clamp(2.1rem, 8vw, 4.2rem); font-weight: 680; letter-spacing: -.07em; line-height: 1.02; }
.section-intro, .body-copy { max-width: 550px; margin-bottom: 0; color: var(--muted); }
.section-intro { font-size: 1rem; }
.project-list { border-top: 1px solid var(--line); }
.public-project-list { display: grid; gap: 0; border-top: 1px solid var(--line); }
.public-project { display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 8px 24px; padding: 18px 0; border-bottom: 1px solid var(--line); }
.public-project h3 { margin: 0; font-size: 1.1rem; }
.public-project p { grid-column: 1; margin: 0; color: var(--muted); font-size: .86rem; }
.public-project a { grid-column: 2; grid-row: 1 / span 2; color: var(--accent); font-size: .85rem; }
.project-card { display: grid; grid-template-columns: 1fr; gap: 16px; padding: 25px 0; border-bottom: 1px solid var(--line); }
.project-card-featured { position: relative; padding-block: 30px; }
.project-meta { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .72rem; }
.project-meta .project-featured-label { color: var(--accent); font-weight: 700; }
.project-card h3 { margin: 8px 0 7px; font-size: 1.35rem; letter-spacing: -.04em; }
.project-card-featured h3 { font-size: 1.75rem; }
.project-description { max-width: 650px; margin: 0; color: var(--muted); }
.project-stack { display: flex; flex-wrap: wrap; gap: 7px; margin: 14px 0 0; padding: 0; list-style: none; }
.project-stack li { padding: 3px 8px; border: 1px solid var(--line); color: var(--muted); font-size: .72rem; }
.project-details { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; color: var(--muted); font-size: .75rem; }
.project-details a { color: var(--accent); }
.todo-note { color: var(--muted); font-size: .75rem; }
.loading-note { color: var(--muted); }

.section-homelab { background: var(--surface); }
.homelab-layout { display: grid; gap: 40px; align-items: center; }
.homelab-layout h2 { margin-bottom: 22px; }
.body-copy + .body-copy { margin-top: 14px; }
.body-copy-muted { font-size: .82rem; }
.architecture { margin: 0; padding: 18px 10px 12px; border: 1px solid var(--line); background: var(--bg); }
.architecture svg { display: block; width: 100%; height: auto; }
.architecture figcaption { padding: 8px 8px 0; color: var(--muted); font-size: .7rem; }
.diagram-line { fill: none; stroke: var(--line); stroke-width: 1.5; }
.diagram-node { fill: var(--surface); stroke: var(--line); stroke-width: 1.5; }
.diagram-node-main { stroke: var(--accent); }
.diagram-node-accent { fill: var(--accent-soft); stroke: var(--accent); }
.diagram-text { fill: var(--text); font: 600 16px ui-sans-serif, system-ui, sans-serif; }
.diagram-text-small { font-size: 14px; }
.diagram-dot { fill: var(--accent); }

.section-heading-inline { display: flex; flex-direction: column; gap: 12px; justify-content: space-between; }
.section-heading-inline .section-intro { padding-bottom: 6px; }
.skill-grid { display: grid; border-top: 1px solid var(--line); }
.skill-item { position: relative; min-height: 145px; padding: 22px 0; border-bottom: 1px solid var(--line); }
.skill-number { color: var(--accent); font-size: .72rem; }
.skill-item h3 { margin: 16px 0 5px; font-size: 1.2rem; letter-spacing: -.03em; }
.skill-item p { margin: 0; color: var(--muted); font-size: .9rem; }
.education-layout, .contact-layout { display: grid; gap: 36px; }
.section-education { background: var(--surface); }
.education-list { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.education-list li { display: grid; grid-template-columns: 105px 1fr; gap: 14px; padding: 20px 0; border-bottom: 1px solid var(--line); }
.education-type { padding-top: 4px; color: var(--muted); font-size: .74rem; }
.education-list h3 { margin: 0 0 4px; font-size: 1.05rem; }
.education-list p { margin: 0; color: var(--muted); font-size: .88rem; }
.section-contact { padding-block: 90px; }
.contact-layout h2 { margin-bottom: 12px; }
.contact-list { display: grid; grid-template-columns: 1fr 1fr; gap: 22px 16px; font-style: normal; }
.contact-list > div { min-width: 0; }
.contact-list span, .contact-list > div > span { color: var(--muted); font-size: .74rem; }
.contact-list p { overflow-wrap: anywhere; margin: 6px 0 0; font-size: .9rem; }
.contact-list a { color: var(--text); }
.contact-list a span { color: var(--accent); }
.contact-form { display: grid; grid-column: 1 / -1; gap: 10px; max-width: 720px; padding-top: 22px; border-top: 1px solid var(--line); }
.contact-form h3 { margin: 0 0 6px; font-size: 1.25rem; }
.contact-form label:not(.contact-honeypot) { margin-top: 6px; color: var(--muted); font-size: .8rem; }
.contact-form input, .contact-form textarea { width: 100%; min-height: 46px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 0; background: var(--surface); color: var(--text); font: inherit; }
.contact-form textarea { resize: vertical; }
.contact-form button { justify-self: start; margin-top: 6px; }
.contact-form p, .contact-form small { margin: 0; color: var(--muted); font-size: .78rem; }
.contact-honeypot { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.contact-action { position: relative; display: inline-flex; min-height: 44px; align-items: center; gap: 8px; padding: 9px 13px; border: 1px solid var(--line); color: var(--text); font-size: .86rem; text-decoration: none; }
.contact-action::after { position: absolute; inset: 3px; border: 1px solid var(--accent); content: ""; opacity: 0; pointer-events: none; transform: rotate(-4deg) scale(.96); transition: transform 260ms ease, opacity 180ms ease; }
.contact-action.todo-note { color: var(--muted); cursor: default; }
.contact-action.todo-note::after { display: none; }
.private-reveal { min-height: 42px; padding: 8px 12px; border: 1px solid var(--line); background: transparent; color: var(--muted); font: inherit; cursor: pointer; }
.private-reveal:hover, .private-reveal:focus-visible { border-color: var(--accent); color: var(--text); }
.private-value { display: inline-block; margin-left: 8px; color: var(--text); font-size: .86rem; overflow-wrap: anywhere; }
.private-value[hidden] { display: none; }
.site-footer { border-top: 1px solid var(--line); color: var(--muted); font-size: .76rem; }
.site-footer .page-wrap { display: flex; justify-content: space-between; gap: 20px; padding-block: 22px; }
.site-footer a { text-decoration: none; }
.language-nav { display: inline-flex; gap: 8px; margin-left: 4px; }
.language-nav a { font-size: .7rem; }
.language-nav [aria-current="page"] { color: var(--accent); }
.technical-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 20px; margin: 0; }
.technical-grid > div { min-width: 0; padding: 15px 0; border-bottom: 1px solid var(--line); }
.technical-grid span { margin-bottom: 5px; color: var(--muted); font-size: .74rem; }
.technical-note { margin: 18px 0 0; color: var(--muted); font-size: .8rem; }
.technical-grid strong { display: block; overflow-wrap: anywhere; font-size: .9rem; font-weight: 620; }
.consent-banner { position: fixed; z-index: 30; right: 16px; bottom: 16px; left: 16px; display: flex; max-width: 840px; align-items: end; justify-content: space-between; gap: 24px; margin-inline: auto; padding: 20px; border: 1px solid var(--line); background: var(--surface); box-shadow: 0 8px 32px rgb(0 0 0 / .16); }
.consent-banner[hidden] { display: none; }
.consent-banner h2 { margin-bottom: 8px; font-size: 1.2rem; letter-spacing: -.04em; }
.consent-banner p { max-width: 540px; margin: 0; color: var(--muted); font-size: .82rem; }
.consent-banner p a { color: var(--accent); }
.consent-actions { display: flex; flex: none; gap: 8px; }
.consent-actions .button { min-height: 42px; padding-inline: 12px; font-size: .78rem; }
.footer-links { display: flex; flex-wrap: wrap; justify-content: end; gap: 18px; }
.footer-links button { padding: 0; border: 0; background: none; color: inherit; font: inherit; cursor: pointer; }
.footer-links button:hover { color: var(--accent); }
.viewer-data { padding-block: 24px 50px; }
.viewer-data details { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.viewer-data summary { display: flex; min-height: 54px; align-items: center; justify-content: space-between; gap: 18px; color: var(--text); font-size: .94rem; font-weight: 650; list-style: none; }
.viewer-data summary::-webkit-details-marker { display: none; }
.viewer-data summary::after { color: var(--accent); content: "+"; font-size: 1.25rem; }
.viewer-data details[open] summary::after { content: "−"; }
.viewer-data-note { max-width: 680px; margin-bottom: 18px; color: var(--muted); font-size: .8rem; }
.viewer-data-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; margin: 0 0 20px; background: var(--line); border: 1px solid var(--line); }
.viewer-data-grid div { min-width: 0; padding: 12px; background: var(--bg); }
.viewer-data-grid dt { color: var(--muted); font-size: .72rem; }
.viewer-data-grid dd { overflow-wrap: anywhere; margin: 5px 0 0; font-size: .82rem; font-variant-numeric: tabular-nums; }
.reading-progress { position: fixed; z-index: 30; inset: 0 0 auto; height: 3px; pointer-events: none; }
.reading-progress span { display: block; width: 100%; height: 100%; background: var(--accent); transform: scaleX(0); transform-origin: left center; }
@supports (animation-timeline: scroll()) {
  .reading-progress span { animation: reading-progress linear both; animation-timeline: scroll(root block); }
  @keyframes reading-progress { to { transform: scaleX(1); } }
}
.cv-dialog { width: min(520px, calc(100% - 32px)); padding: 32px; border: 1px solid var(--line); background: var(--surface); color: var(--text); }
.cv-dialog::backdrop { background: rgb(8 15 23 / .7); }
.cv-dialog h2 { font-size: 2rem; }
.cv-dialog p { color: var(--muted); font-size: .9rem; }
.cv-dialog form { display: flex; flex-wrap: wrap; gap: 12px; }
.cv-dialog form:first-child { justify-content: end; }
.cv-dialog label { flex-basis: 100%; font-size: .84rem; }
.cv-dialog input { flex: 1 1 180px; min-height: 48px; padding: 8px 10px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font: inherit; }
.dialog-close { border: 0; background: transparent; color: var(--muted); font-size: 1.7rem; cursor: pointer; }
.cv-dialog .cv-message { min-height: 1.5em; margin: 14px 0 4px; }
.cv-dialog .cv-updated { margin: 4px 0 0; font-size: .76rem; }
.mobile-break { display: initial; }

@media (min-width: 700px) {
  .page-wrap, .site-header { width: min(var(--max), calc(100% - 64px)); }
  .site-header { min-height: 88px; }
  .site-nav { order: initial; width: auto; gap: 24px; padding: 0; }
  .site-nav a { font-size: .82rem; }
  .hero { min-height: min(760px, calc(100svh - 88px)); padding-block: 100px 120px; }
  .hero-mark { top: 110px; right: 10%; }
  .hero-mark-line { height: 150px; }
  .section { padding-block: 112px; }
  .section-heading { margin-bottom: 56px; }
  .mobile-break { display: none; }
  .project-card { grid-template-columns: minmax(0, 1fr) 180px; gap: 28px; padding-block: 29px; }
  .project-details { justify-content: flex-end; align-content: center; }
  .homelab-layout { grid-template-columns: .85fr 1.15fr; gap: 70px; }
  .architecture { padding: 24px 18px 14px; }
  .section-heading-inline { flex-direction: row; align-items: end; }
  .skill-grid { grid-template-columns: repeat(3, 1fr); }
  .skill-item { min-height: 180px; padding: 24px; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); }
  .skill-item:first-child { padding-left: 0; }
  .skill-item:last-child { border-right: 0; }
  .education-layout, .contact-layout { grid-template-columns: .85fr 1.15fr; gap: 70px; }
  .contact-list { gap: 28px 32px; }
  .viewer-data-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .technical-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0 28px; }
}

@media (max-width: 620px) {
  .consent-banner { flex-direction: column; align-items: stretch; gap: 16px; }
  .consent-actions { justify-content: end; }
  .footer-links { justify-content: start; }
  .site-footer .page-wrap { flex-direction: column; }
}

@media (min-width: 1000px) {
  .hero-mark { right: 16%; }
  .hero-scroll { bottom: 48px; }
  .project-card-featured { grid-template-columns: minmax(0, 1fr) 180px; padding-block: 38px; }
  .project-card-featured h3 { font-size: 2rem; }
}

@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  .button:not(.button-disabled) { transition: transform 160ms ease-out; }
  .button:not(.button-disabled):hover { transform: translateY(-2px); }
  .button-secondary:hover { border-color: var(--text); background: var(--text); color: var(--bg); }
  .project-card { transition: transform 180ms ease-out; }
  .project-card:hover { transform: translateX(4px); }
  .contact-action:not(.todo-note):hover { border-color: var(--text); background: var(--text); color: var(--bg); }
  .contact-action:not(.todo-note):hover::after { opacity: .75; transform: rotate(180deg) scale(1.04); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; }
  .hero-copy { animation: none; }
  .contact-action::after { transition: none; }
  .hero-scroll span:last-child { animation: none; }
  ::view-transition-old(root), ::view-transition-new(root) { animation: none; }
}
