/* ---------- Design tokens (day view only) ---------- */
:root {
  color-scheme: light;
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-2: #eef2f7;
  --text: #0f172a;
  --muted: #475569;
  --border: #dbe3ee;
  --accent: #0f766e;
  --accent-2: #0369a1;
  --accent-contrast: #ffffff;
  --accent-soft: rgb(15 118 110 / .1);
  --grid-line: rgb(15 23 42 / .06);
  --warn-bg: #fef3c7; --warn-text: #78350f;
  --ok-bg: #dcfce7; --ok-text: #14532d;
  --err-bg: #fee2e2; --err-text: #7f1d1d;
  --radius: 14px;
  --shadow: 0 1px 2px rgb(15 23 42 / .06), 0 8px 24px rgb(15 23 42 / .06);
  --display: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "SF Mono", "Segoe UI Mono", Consolas, monospace;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body { margin: 0; font-family: var(--font); background: var(--bg); color: var(--text); line-height: 1.65; font-size: 1rem; }

h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; }
h1, h2 { font-family: var(--display); font-weight: 700; letter-spacing: -.01em; }
h1 { font-size: clamp(2.4rem, 5vw + 1rem, 4.2rem); }
/* The hero name stays on one line at every width: size follows the viewport and the column. */
.hero h1 { font-size: clamp(1.7rem, 4.6vw, 3.4rem); white-space: nowrap; letter-spacing: -.02em; }
@media (min-width: 900px) { .hero h1 { font-size: clamp(2.2rem, 3.9vw, 3.4rem); } }
h2 { font-size: clamp(1.6rem, 2vw + 1rem, 2.2rem); }
h3 { font-size: 1.1rem; font-weight: 650; }
p { margin: 0 0 1rem; }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
/* Blazor moves focus to the h1 after navigation for screen readers; it is not interactive, so no ring. */
h1:focus, h1:focus-visible { outline: none; }

.container { width: 100%; max-width: 120rem; margin-inline: auto; padding-inline: clamp(1.25rem, 3.5vw, 4.5rem); }
main.container { padding-block: 0 4rem; min-height: 70vh; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--accent); color: var(--accent-contrast); padding: .5rem 1rem; border-radius: 8px; z-index: 100; }
.skip-link:focus { left: 8px; }

.mono-label { font-family: var(--mono); font-size: .74rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin: 0; }
.mono-label.accent { color: var(--accent); }
.mono-label.green { color: var(--accent); font-size: .68rem; }
h3.mono-label { font-weight: 500; margin-bottom: .75rem; }

/* ---------- Header / nav ---------- */
.site-header { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); }
.header-inner { display: flex; align-items: center; gap: 1rem; padding-block: .7rem; flex-wrap: wrap; }
.brand { text-decoration: none; font-family: var(--mono); font-size: .82rem; letter-spacing: .08em; }
.brand-name { color: var(--accent); font-weight: 700; }
.brand-role { color: var(--muted); }
.nav { display: flex; flex-wrap: wrap; gap: .1rem; margin-left: auto; font-family: var(--mono); font-size: .82rem; }
.nav a { padding: .4rem .65rem; border-radius: 8px; text-decoration: none; color: var(--muted); }
.nav a .num { color: var(--muted); opacity: .7; margin-right: .2rem; }
.nav a:hover { color: var(--text); background: var(--accent-soft); }
.nav a.active { color: var(--accent); background: var(--accent-soft); }
.nav a.active .num { color: var(--accent); opacity: 1; }
@media (max-width: 719px) {
  .header-inner { gap: .5rem; }
  .brand { order: 1; }
  .kbd-btn { order: 2; margin-left: auto; }
  .nav { order: 3; width: 100%; margin-left: 0; }
}

/* ---------- Hero ---------- */
.hero { position: relative; display: grid; gap: 2rem; align-items: center; padding-block: 3.5rem 3rem; }
.hero::before { content: ""; position: absolute; inset: 0 calc(50% - 50vw); z-index: -1; pointer-events: none;
  background-image: linear-gradient(var(--grid-line) 1px, transparent 1px), linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 64px 64px;
  -webkit-mask-image: linear-gradient(to bottom, #000 40%, transparent);
  mask-image: linear-gradient(to bottom, #000 40%, transparent); }
@media (min-width: 900px) { .hero { grid-template-columns: 1.1fr .9fr; } }
.hero-photo { width: 6.5rem; height: 6.5rem; border-radius: 50%; object-fit: cover; object-position: 50% 22%; border: 3px solid var(--accent); padding: 3px; background: var(--bg); margin-bottom: 1.5rem; }
.kicker { display: flex; align-items: center; gap: .75rem; margin-bottom: .75rem; }
.kicker::before { content: ""; width: 2rem; height: 1px; background: var(--accent); }
.pillars { list-style: none; padding: 0; font-size: 1.15rem; font-weight: 600; margin: .25rem 0 1rem; display: grid; gap: .15rem; }
.pillars li { display: flex; align-items: center; gap: .6rem; }
.pillars li::before { content: ""; width: .45rem; height: .45rem; border-radius: 50%; background: var(--accent); flex: none; }
.lead { font-size: 1.08rem; color: var(--muted); max-width: 46rem; }
.chips { list-style: none; margin: 1.25rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: .5rem; }
.chips li { border: 1px solid var(--border); border-radius: 999px; padding: .25rem .8rem; font-family: var(--mono); font-size: .78rem; background: var(--surface); color: var(--muted); }
.chips a { color: var(--muted); text-decoration: none; }
.chips a:hover { color: var(--accent); }
.actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.5rem; }

/* Hero diagram */
.hero-diagram { width: 100%; max-width: 30rem; height: auto; justify-self: center; }
.d-link { stroke: var(--accent); stroke-opacity: .45; stroke-width: 1.2; stroke-dasharray: 5 6; animation: dash 14s linear infinite; }
.d-node { fill: var(--surface-2); stroke: var(--border); stroke-width: 1.2; }
.d-label { fill: var(--muted); font-family: var(--mono); font-size: 11px; }
.d-hub { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 1.6; }
.d-hub-text { fill: var(--accent); font-family: var(--mono); font-size: 17px; font-weight: 700; }
.d-hub-sub { fill: var(--accent); font-family: var(--mono); font-size: 8.5px; letter-spacing: .14em; }
@keyframes dash { to { stroke-dashoffset: -220; } }
@media (prefers-reduced-motion: reduce) { .d-link { animation: none; } }

/* ---------- Buttons ---------- */
.btn { display: inline-block; padding: .65rem 1.1rem; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; }
.btn:hover { border-color: var(--accent); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost { background: transparent; }
.btn[disabled] { opacity: .6; cursor: progress; }

/* ---------- Sections ---------- */
.band { padding-block: 3rem; border-top: 1px solid var(--border); scroll-margin-top: 4.5rem; }
.band-sub { margin-top: 2.5rem; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.section-head h2 { margin: 0; }
.page-head { padding-block: 3rem 1.5rem; }

/* Impact */
.impact { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 13.5rem), 1fr)); }
.impact li { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; display: flex; flex-direction: column; gap: .35rem; }
.impact strong { font-family: var(--display); font-size: 2.4rem; line-height: 1; color: var(--accent); }
.impact-label { font-weight: 650; }
.impact-detail { color: var(--muted); font-size: .9rem; }

/* Profile */
.profile { display: grid; gap: 2rem; }
@media (min-width: 900px) { .profile { grid-template-columns: 1.2fr 1fr; align-items: start; } }
.profile-text { font-size: 1.05rem; max-width: none; }

/* Cards / grid */
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr)); }
.card { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; color: inherit; text-decoration: none; }
.card h3 { margin: .35rem 0 .5rem; font-size: 1.15rem; }
.card p { color: var(--muted); }
.card .tags { margin-bottom: .5rem; }
.project-card { transition: transform .15s ease, border-color .15s ease; }
.project-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.card-link { color: var(--accent); font-weight: 600; font-size: .92rem; }
@media (prefers-reduced-motion: reduce) { .project-card { transition: none; } .project-card:hover { transform: none; } }
h3.mono-label { margin-top: 0; }

/* Rows (more across the stack) */
.rows { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; gap: 0 2rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr)); }
.rows li { display: flex; justify-content: space-between; gap: 1rem; padding: .8rem 0; border-bottom: 1px solid var(--border); align-items: baseline; }

/* ---------- Tags ---------- */
.tags { list-style: none; margin: .5rem 0 .75rem; padding: 0; display: flex; flex-wrap: wrap; gap: .4rem; }
.tags li { background: var(--accent-soft); color: var(--text); border: 1px solid var(--border); border-radius: 999px; padding: .12rem .65rem; font-family: var(--mono); font-size: .74rem; }

/* ---------- Lists & prose ---------- */
.prose { max-width: 62rem; }
.bullets { padding-left: 1.2rem; margin: 0 0 1rem; }
.bullets li { margin-bottom: .35rem; }
.check-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .6rem; }
.check-list li { position: relative; padding-left: 1.6rem; }
.check-list li::before { content: "→"; position: absolute; left: 0; color: var(--accent); font-weight: 700; }
.plain-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .75rem; }
.plain-list li span { display: block; color: var(--muted); }
.repo-list { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; gap: .6rem; }
.repo-list li { display: grid; gap: .1rem; padding: .85rem 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.repo-list span { color: var(--muted); }

/* ---------- Timeline ---------- */
.timeline { border-left: 1px solid var(--border); padding-left: 1.5rem; display: grid; gap: 2rem; }
.timeline-item { position: relative; }
.timeline-item::before { content: ""; position: absolute; left: calc(-1.5rem - 5px); top: .5rem; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.timeline-item h3 { margin-bottom: .1rem; font-size: 1.2rem; }
.meta { color: var(--muted); margin-bottom: .1rem; }
.period { color: var(--accent); font-family: var(--mono); font-size: .8rem; letter-spacing: .06em; margin-bottom: .6rem; }

/* ---------- CTA ---------- */
.cta { margin-top: 3rem; padding: 3rem 1.5rem; text-align: center; border: 1px solid var(--border); border-radius: calc(var(--radius) + 6px); background: radial-gradient(60% 120% at 50% 0%, var(--accent-soft), transparent), var(--surface); scroll-margin-top: 4.5rem; }
.cta p { color: var(--muted); max-width: 34rem; margin-inline: auto; }
.cta .actions { justify-content: center; }

/* ---------- Forms ---------- */
.form { display: grid; gap: .4rem; max-width: 36rem; margin-top: 1rem; }
.form label { font-weight: 600; margin-top: .5rem; }
.form input, .form textarea { width: 100%; padding: .65rem .8rem; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); font: inherit; }
.form input:focus, .form textarea:focus { border-color: var(--accent); }
.form .btn { justify-self: start; margin-top: .75rem; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.validation-message { color: var(--err-text); font-size: .9rem; }
.notice { padding: .85rem 1rem; border-radius: 10px; margin-block: 1rem; max-width: 36rem; }
.notice a { color: inherit; }
.notice-ok { background: var(--ok-bg); color: var(--ok-text); }
.notice-warn { background: var(--warn-bg); color: var(--warn-text); }
.notice-error { background: var(--err-bg); color: var(--err-text); }
main > h1, main > article > h1 { margin-top: 3rem; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); padding-block: 1.25rem; color: var(--muted); font-family: var(--mono); font-size: .8rem; }
.footer-inner { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.footer-links { display: flex; gap: 1rem; flex-wrap: wrap; }
.footer-links a { color: var(--muted); }
.footer-links a:hover { color: var(--accent); }

/* ---------- CV page ---------- */
.cv-actions { margin-block: 3rem 1rem; }
.cv { max-width: 50rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; }
.cv h1 { font-size: 2rem; }
.cv h2 { font-family: var(--mono); font-size: .85rem; text-transform: uppercase; letter-spacing: .12em; color: var(--accent); border-bottom: 1px solid var(--border); padding-bottom: .25rem; margin-top: 1.5rem; }
.cv .headline { color: var(--muted); font-weight: 600; }
.cv-job { margin-bottom: 1rem; }
.cv-job-head { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }

/* ---------- Blazor framework UI ---------- */
#blazor-error-ui { color-scheme: light only; background: #fef3c7; color: #1f2937; bottom: 0; box-shadow: 0 -1px 2px rgb(0 0 0 / .2); display: none; left: 0; padding: .6rem 1.25rem .7rem 1.25rem; position: fixed; width: 100%; z-index: 1000; }
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: .75rem; top: .5rem; }
.blazor-error-boundary { background: #b32121; padding: 1rem; color: white; }
.blazor-error-boundary::after { content: "An error has occurred."; }

/* ---------- Print: always a clean light CV ---------- */
@media print {
  :root { --bg: #fff; --surface: #fff; --text: #000; --muted: #333; --border: #bbb; --accent: #000; }
  .site-header, .site-footer, .no-print, .skip-link { display: none !important; }
  body { background: #fff; color: #000; font-size: 11pt; }
  main.container { padding: 0; max-width: none; min-height: 0; }
  .cv { border: 0; padding: 0; background: #fff; max-width: none; }
  .cv-actions { display: none; }
  a { color: #000; text-decoration: none; }
  h2 { break-after: avoid; }
  .cv-job { break-inside: avoid; }
}
