/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; }
body { margin: 0; overflow-x: clip; overflow-wrap: break-word; background: var(--bg); color: var(--text); font: 16px/1.6 var(--sans); -webkit-font-smoothing: antialiased; transition: background-color .3s ease, color .3s ease; }
a { color: var(--text); text-decoration: none; }
a:hover { color: var(--strong); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
::selection { background: var(--line-3); }
h1, h2, h3, p { margin: 0; }
img { max-width: 100%; display: block; }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 32px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.stars {
  background-image:
    radial-gradient(1px 1px at 31px 57px, var(--star), transparent 60%),
    radial-gradient(1px 1px at 173px 121px, var(--star), transparent 60%),
    radial-gradient(1px 1px at 97px 263px, var(--star), transparent 60%),
    radial-gradient(1.4px 1.4px at 229px 331px, var(--star), transparent 60%),
    radial-gradient(1px 1px at 41px 419px, var(--star), transparent 60%),
    radial-gradient(1px 1px at 151px 19px, var(--star), transparent 60%);
  background-size: 260px 460px;
}
.iso {
  background-image:
    repeating-linear-gradient(30deg, var(--grid) 0 1px, transparent 1px 56px),
    repeating-linear-gradient(150deg, var(--grid) 0 1px, transparent 1px 56px);
}
.glow { filter: drop-shadow(0 0 6px var(--glow)) drop-shadow(0 0 18px var(--glow-2)); }
.mono { font-family: var(--mono); }
.label { font-family: var(--mono); font-size: 12px; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; gap: 10px; height: 48px; padding: 0 22px; border-radius: 8px; font: 600 15px var(--sans); border: 1px solid transparent; cursor: pointer; transition: transform .2s ease, box-shadow .2s ease, background-color .2s ease; }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { color: var(--on-accent); box-shadow: 0 0 18px var(--glow-2); }
.btn-ghost { border-color: var(--line-3); color: var(--strong); font-weight: 500; background: transparent; }
.btn-ghost:hover { border-color: var(--accent); }
.btn-sm { height: 40px; padding: 0 16px; font-size: 14px; }

/* ---------- Header ---------- */
.site-header { position: sticky; top: 0; z-index: 20; border-bottom: 1px solid var(--line); background: var(--header); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.site-header .wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 24px; padding-top: 14px; padding-bottom: 14px; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--strong); font: 13px var(--mono); letter-spacing: .14em; text-transform: uppercase; }
.mark { color: var(--strong); display: block; }
.site-nav { display: flex; flex-wrap: wrap; gap: 6px 26px; margin-left: auto; font-size: 14px; }
.header-actions { display: flex; align-items: center; gap: 14px; }

/* the one theme switch */
.theme-switch { position: relative; width: 58px; height: 30px; padding: 0; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface-2); color: var(--muted); cursor: pointer; }
.theme-switch svg { position: absolute; top: 7px; width: 14px; height: 14px; }
.theme-switch .i-moon { left: 8px; }
.theme-switch .i-sun { right: 8px; }
.theme-switch .knob { position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--glow); transition: transform .3s cubic-bezier(.3,.7,.2,1); }
:root[data-theme="light"] .theme-switch .knob { transform: translateX(28px); }
.theme-switch:hover { border-color: var(--line-3); }

/* ---------- Hero ---------- */
.hero { position: relative; overflow: hidden; border-bottom: 1px solid var(--line); }
.hero .iso { position: absolute; inset: 0; }
.hero-inner { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 56px; padding-top: 104px; padding-bottom: 104px; }
.hero-copy { flex: 999 1 560px; min-width: 0; }
.hero-art { flex: 1 1 260px; display: flex; justify-content: center; }
.hero-id { display: flex; align-items: center; gap: 16px; margin-bottom: 28px; }
.id-mark { display: none; }
.hero-socials { display: inline-flex; flex-wrap: wrap; gap: 12px; }
.avatar { flex: 0 0 auto; width: 56px; height: 56px; border-radius: 50%; overflow: hidden; display: flex; align-items: center; justify-content: center; background: var(--surface-2); color: var(--strong); font: 600 20px var(--serif); animation: ring 4s ease-in-out infinite; }
.avatar img { width: 100%; height: 100%; object-fit: cover; filter: grayscale(1) contrast(1.05); }
.hero h1 { font: 600 44px/1.08 var(--serif); letter-spacing: -.02em; color: var(--strong); }
.hero h1 .headline { display: block; margin-top: 28px; }
.hero .intro { margin-top: 32px; max-width: 620px; font-size: 19px; }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 40px; }
.divider { width: 1px; height: 28px; margin: 0 8px; background: var(--line-2); }
.soc-icon { width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line-2); border-radius: 50%; color: var(--text); transition: border-color .2s ease, color .2s ease, box-shadow .2s ease; }
.soc-row > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.soc-row > svg { flex: 0 0 auto; }
.soc-icon:hover, .soc-row:hover { border-color: var(--accent); color: var(--strong); box-shadow: 0 0 14px var(--glow-2); }

/* the stream: a wave of light runs along the dashes into the bracket */
@keyframes ping { 28% { opacity: 1; } }
.flow rect { animation: ping 2.8s ease-in-out infinite; }
.flow rect:nth-child(2) { animation-delay: .18s; } .flow rect:nth-child(3) { animation-delay: .36s; }
.flow rect:nth-child(4) { animation-delay: .54s; } .flow rect:nth-child(5) { animation-delay: .72s; }
.flow rect:nth-child(6) { animation-delay: .9s; } .flow rect:nth-child(7) { animation-delay: 1.08s; }
@keyframes breathe { 0%, 100% { filter: drop-shadow(0 0 4px var(--glow-2)); } 45%, 60% { filter: drop-shadow(0 0 10px var(--glow)) drop-shadow(0 0 24px var(--glow-2)); } }
.bracket { animation: breathe 2.8s ease-in-out 1.2s infinite; }
@keyframes ring { 0%, 100% { box-shadow: 0 0 0 1px var(--line-3), 0 0 0 6px transparent; } 50% { box-shadow: 0 0 0 1px var(--accent), 0 0 0 6px var(--glow-2); } }

/* ---------- Sections ---------- */
.section { padding-top: 112px; padding-bottom: 16px; }
.section-head { margin-bottom: 44px; }
.section-head .label { margin-bottom: 16px; }
.section h2 { font: 600 44px/1.1 var(--serif); letter-spacing: -.01em; color: var(--strong); }
.panel { border: 1px solid var(--line-2); border-radius: 12px; background: var(--surface); }
.tag { display: block; font: 12px var(--mono); color: var(--muted); margin-bottom: 8px; }

/* experience: gantt */
.timeline-box { overflow-x: auto; }
.timeline { min-width: 880px; padding: 24px 28px; }
.t-axis { display: flex; padding: 0 0 14px 300px; font: 12px var(--mono); color: var(--muted); }
.t-axis span { flex: 1; }
.t-axis span:last-child { color: var(--strong); }
.t-row { display: flex; align-items: center; padding: 16px 0; border-top: 1px dashed var(--line-2); }
.t-who { flex: 0 0 300px; padding-right: 16px; }
.t-who strong { display: block; color: var(--strong); font-weight: 600; }
.t-who span { display: block; margin-top: 4px; font: 12px var(--mono); color: var(--muted); }
.t-track { flex: 1; position: relative; height: 26px; }
.bar { position: absolute; top: 10px; height: 6px; border-radius: 3px; background: var(--accent); transform-origin: left center; }
.bar.live { background: repeating-linear-gradient(90deg, var(--accent) 0 18px, transparent 18px 26px); }
.cap { position: absolute; top: 0; width: 8px; height: 26px; border: 2px solid var(--accent); border-left: 0; border-radius: 0 3px 3px 0; animation: blink 1.8s ease-in-out infinite; }
@keyframes grow { from { transform: scaleX(0); } }
@keyframes march { to { background-position: 26px 0; } }
@keyframes blink { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }
.js .timeline:not(.in) .bar { transform: scaleX(0); }
.timeline.in .bar { animation: grow 1.1s cubic-bezier(.2,.7,.2,1) both; animation-delay: var(--d, 0s); }
.timeline.in .bar.live { animation: grow 1.1s cubic-bezier(.2,.7,.2,1) var(--d, 0s) both, march .9s linear calc(var(--d, 0s) + 1.1s) infinite; }
.summaries { margin-top: 20px; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: 16px; font-size: 15px; }
.summaries p { padding: 20px; border-color: var(--line); }

/* selected work */
/* tiles wrap and the last row stretches, so there are never empty cells */
.grid-tiles { display: flex; flex-wrap: wrap; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.grid-tiles > * { flex: 1 1 var(--tile, 260px); min-width: 0; background: var(--surface-2); transition: background-color .2s ease; }
.grid-tiles > *:hover { background: var(--surface-3); }
.work { --tile: 300px; }
.work > div { padding: 28px; }
.work h3 { margin-bottom: 10px; font-size: 18px; font-weight: 600; color: var(--strong); }
.work p { font-size: 15px; }
/* stack: boxes of pills */
.stack { --tile: 250px; }
.stack > div { padding: 24px; }
.stack .tag { margin-bottom: 14px; letter-spacing: .08em; text-transform: uppercase; }
.pills { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.pills li { padding: 6px 12px; border: 1px solid var(--line-2); border-radius: 999px; background: var(--surface); font-size: 13.5px; color: var(--strong); transition: border-color .2s ease, box-shadow .2s ease; }
.pills li:hover { border-color: var(--accent); box-shadow: 0 0 12px var(--glow-2); }

/* lift on hover */
.lift { transition: transform .25s ease, border-color .25s ease, box-shadow .25s ease; }
.lift:hover { transform: translateY(-3px); border-color: var(--line-3); box-shadow: var(--shadow); }

/* education + languages */
.edu-row { display: flex; flex-wrap: wrap; gap: 16px; }
.edu { flex: 999 1 520px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.edu-card { display: flex; flex-wrap: wrap; align-items: center; gap: 20px 28px; padding: 28px; }
.edu-icon { flex: 0 0 auto; width: 52px; height: 52px; border-radius: 12px; border: 1px solid var(--line-2); display: flex; align-items: center; justify-content: center; color: var(--strong); }
.edu-card h3 { font-size: 20px; font-weight: 600; color: var(--strong); }
.edu-card .grow { flex: 1 1 280px; min-width: 0; }
.edu-card p { margin-top: 6px; color: var(--muted); }
.langs { flex: 1 1 260px; display: flex; flex-direction: column; gap: 16px; padding: 28px; }
.langs ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 14px; }
.flag { width: 44px; height: 44px; border-radius: 50%; overflow: hidden; display: flex; align-items: center; justify-content: center; box-shadow: 0 0 0 1px var(--line-3); filter: grayscale(1); font: 600 13px var(--mono); color: var(--strong); background: var(--surface-3); transition: filter .3s ease, transform .3s ease; }
.flag:hover, .flag:focus-visible { filter: none; transform: scale(1.08); }

/* projects */
.projects { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); gap: 20px; }
.project { display: flex; flex-direction: column; overflow: hidden; color: var(--text); }
.project-bar { display: flex; justify-content: space-between; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--line); font: 12px var(--mono); color: var(--muted); }
.status { display: inline-flex; align-items: center; gap: 6px; color: var(--strong); }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); animation: blink 1.8s ease-in-out infinite; }
.shot { height: 170px; display: flex; align-items: center; justify-content: center; padding: 14px; background-color: var(--bg); border-bottom: 1px solid var(--line); overflow: hidden; transition: background-position 6s linear; }
/* the whole image always fits the banner; small images keep their size instead of being blown up */
.shot img { width: auto; height: auto; max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; transition: transform .6s cubic-bezier(.2,.7,.2,1); }
.project:hover .shot { background-position: 0 -120px; }
.project:hover .shot img { transform: scale(1.03); }
.project-body { padding: 22px; display: flex; flex-direction: column; gap: 10px; }
.project-body strong { font: 600 26px var(--serif); color: var(--strong); }
.project-body span { font-size: 15px; }

/* certifications */
.certs { --tile: 230px; font-family: var(--mono); }
.certs > * { display: flex; flex-direction: column; color: var(--text); }
.cert-body { display: block; padding: 22px; }
.certs strong { display: block; font-size: 22px; font-weight: 600; color: var(--strong); }
.cert-body > span { display: block; margin-top: 6px; font-size: 13px; color: var(--muted); }
/* badges: same fit rules as project images: whole image, centred, never enlarged */
.badge-shot { height: 120px; display: flex; align-items: center; justify-content: center; padding: 14px; background-color: var(--bg); border-bottom: 1px solid var(--line); overflow: hidden; transition: background-position 6s linear; }
.badge-shot img { width: auto; height: auto; max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; transition: transform .6s cubic-bezier(.2,.7,.2,1); }
.cert:hover .badge-shot { background-position: 0 -120px; }
.cert:hover .badge-shot img { transform: scale(1.04); }
.has-badges { --tile: 210px; }

/* custom sections */
.prose { max-width: 760px; font-size: 17px; line-height: 1.7; }
.prose > * + * { margin-top: 1em; }
.prose h2, .prose h3 { font: 600 26px var(--serif); color: var(--strong); margin-top: 1.6em; }
.prose a { color: var(--strong); text-decoration: underline; text-decoration-color: var(--line-3); text-underline-offset: 3px; }
.prose code { font: 14px var(--mono); padding: 2px 6px; border-radius: 4px; background: var(--surface-3); }
.prose ul, .prose ol { padding-left: 22px; }

/* contact */
.contact { margin-top: 112px; border-top: 1px solid var(--line); }
.contact-inner { display: flex; flex-wrap: wrap; gap: 64px; padding-top: 96px; padding-bottom: 96px; }
.contact-copy { flex: 1 1 380px; min-width: 0; }
.contact-copy h2 { margin-bottom: 20px; }
.contact-copy > p { margin-bottom: 32px; font-size: 17px; }
.soc-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 28px; }
.soc-row { min-width: 0; display: flex; align-items: center; gap: 14px; height: 48px; padding: 0 16px; border: 1px solid var(--line-2); border-radius: 8px; font: 14px var(--mono); transition: border-color .2s ease, color .2s ease, box-shadow .2s ease; }
/* QR contact card */
.qr-card { display: flex; flex-wrap: wrap; align-items: center; gap: 20px 24px; margin-bottom: 28px; padding: 18px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--surface); }
.qr-tile { position: relative; flex: 0 0 auto; max-width: 100%; padding: 8px; border-radius: 10px; overflow: hidden; transition: box-shadow .3s ease; }
.qr-tile svg { display: block; max-width: 100%; height: auto; }
.qr-classic { --qr-bg: #ffffff; color: #0b0c10; background: #ffffff; }
.qr-theme { --qr-bg: var(--surface); color: var(--strong); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line-2); }
.qr-tile::after { content: ""; position: absolute; left: 0; right: 0; top: -30%; height: 30%; background: linear-gradient(180deg, transparent, var(--glow-2), transparent); opacity: 0; pointer-events: none; }
.qr-card:hover .qr-tile { box-shadow: 0 0 0 1px var(--line-3), 0 0 24px var(--glow-2); }
.qr-card:hover .qr-tile::after { opacity: 1; animation: scan 1.6s ease-in-out infinite; }
@keyframes scan { to { top: 100%; } }
.qr-meta { flex: 1 1 150px; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.qr-meta .label { margin-bottom: 4px; }
.qr-name { font: 600 22px var(--serif); color: var(--strong); }
.qr-role { color: var(--muted); font-size: 14px; margin-bottom: 10px; }
.contact-form { align-self: flex-start; flex: 1 1 420px; min-width: 0; display: flex; flex-direction: column; gap: 18px; padding: 32px; }
.contact-form label { display: flex; flex-direction: column; gap: 8px; font-size: 13px; color: var(--muted); }
.contact-form input, .contact-form textarea { font: 15px var(--sans); padding: 0 14px; height: 44px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--bg); color: var(--strong); transition: border-color .2s ease; }
.contact-form textarea { height: auto; padding: 12px 14px; resize: vertical; }
.contact-form input:focus, .contact-form textarea:focus { outline: none; border-color: var(--accent); }
::placeholder { color: var(--placeholder); }
.contact-form .btn { justify-content: center; }
.field-error { color: var(--strong); font-size: 13px; }
.trap { position: absolute; left: -10000px; }
.notice { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border: 1px solid var(--line-3); border-radius: 8px; color: var(--strong); }

/* footer */
.site-footer { border-top: 1px solid var(--line); }
.site-footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; padding-top: 28px; padding-bottom: 28px; font: 12px var(--mono); color: var(--muted); }

/* ---------- Small screens ---------- */
@media (max-width: 720px) {
  .wrap { padding: 0 20px; }
  .site-nav { order: 3; width: 100%; margin-left: 0; gap: 6px 18px; }
  .header-actions { margin-left: auto; }
  .hero-inner { padding-top: 48px; padding-bottom: 64px; gap: 0; }
  .hero-art { display: none; }
  .hero-id { flex-wrap: wrap; gap: 14px 16px; }
  .hero-eyebrow { order: 3; flex-basis: 100%; }
  .id-mark { display: block; margin-left: auto; }
  .hero h1 { font-size: 32px; }
  .hero h1 .headline { margin-top: 18px; }
  .hero .intro { font-size: 17px; }
  .divider { display: none; }
  .hero-actions .btn { flex: 1 1 140px; justify-content: center; }
  .hero-socials { flex-basis: 100%; margin-top: 4px; }

  /* timeline: stacked rows, full-width tracks, no sideways scrolling */
  .timeline-box { overflow: visible; }
  .timeline { min-width: 0; padding: 18px 16px 8px; }
  .t-axis { padding: 0 0 12px; font-size: 10px; letter-spacing: -.02em; }
  .t-axis span { text-align: left; }
  .t-axis span:not(:first-child):not(:last-child):nth-child(even) { visibility: hidden; }
  .t-row { flex-direction: column; align-items: stretch; gap: 12px; padding: 16px 0; }
  .t-who { flex: none; padding-right: 0; }
  .t-track { height: 26px; }
  .t-track::before { content: ""; position: absolute; left: 0; right: 0; top: 12px; border-top: 1px dashed var(--line-2); }
  .t-row { padding: 18px 0 14px; }
  .section { padding-top: 80px; }
  .section h2 { font-size: 34px; }
  .projects { grid-template-columns: 1fr; }
  .grid-tiles > * { flex-basis: 100%; }
  .certs > * { flex-basis: calc(50% - 1px); }
  .certs .badge-shot { height: 92px; padding: 12px; }
  .cert-body { padding: 16px; }
  .certs strong { font-size: 18px; }
  .contact-inner { gap: 40px; padding-top: 72px; padding-bottom: 72px; }
  .contact-form { padding: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .js .timeline:not(.in) .bar { transform: none; }
}
