/* Fonts: self-hosted, Latin subset */
@font-face { font-family: "Lora"; src: url("fonts/lora-var.woff") format("woff"); font-weight: 400 700; font-display: swap; }
@font-face { font-family: "Inter"; src: url("fonts/inter-regular.woff") format("woff"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Inter"; src: url("fonts/inter-medium.woff") format("woff"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Inter"; src: url("fonts/inter-semibold.woff") format("woff"); font-weight: 600; font-display: swap; }

/* Tokens */
:root {
  --bg: #f2f5f7;
  --surface: #ffffff;
  --ink: #15222e;
  --muted: #55677a;
  --line: #d6dee5;
  --trace: #0b8a7f;
  --trace-soft: rgba(11, 138, 127, 0.1);
  --serif: "Lora", Georgia, "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --step-0: 1.0625rem;
  --step-1: 1.25rem;
  --step-2: 1.625rem;
  --step-3: 2.25rem;
  --step-4: clamp(2.75rem, 6vw, 4.5rem);
  --wrap: 68rem;
  --gutter: clamp(1rem, 4vw, 2.5rem);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e151c;
    --surface: #15202a;
    --ink: #e4ebf1;
    --muted: #94a5b5;
    --line: #26343f;
    --trace: #3cc6b6;
    --trace-soft: rgba(60, 198, 182, 0.12);
    color-scheme: dark;
  }
}

/* Base */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 var(--step-0)/1.6 var(--sans);
  font-feature-settings: "ss01", "calt";
}
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration-color: var(--trace); text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
a:hover { color: var(--trace); }
:focus-visible { outline: 2px solid var(--trace); outline-offset: 3px; border-radius: 4px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.15; margin: 0; letter-spacing: -0.01em; }
h2 { font-size: var(--step-3); }
h3 { font-size: var(--step-1); }
p { margin: 0 0 1em; max-width: 65ch; }
.wrap { width: min(100% - 2 * var(--gutter), var(--wrap)); margin-inline: auto; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 1rem; top: 1rem; background: var(--surface); padding: 0.5rem 1rem; z-index: 10; }

/* Header */
.site-header { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding-block: 1.25rem; }
.wordmark { font-family: var(--serif); font-weight: 600; font-size: var(--step-1); text-decoration: none; }
.site-header nav { display: flex; gap: clamp(0.75rem, 2.5vw, 1.75rem); font-size: 0.95rem; }
.site-header nav a { text-decoration: none; color: var(--muted); }
.site-header nav a:hover { color: var(--ink); }

/* Hero */
.hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(12rem, 19rem); gap: clamp(2rem, 6vw, 5rem); align-items: end; padding-block: clamp(2.5rem, 8vw, 6rem) 2rem; }
.hero h1 { font-size: var(--step-4); font-weight: 650; letter-spacing: -0.02em; margin-bottom: 1.25rem; }
.lead { font-size: var(--step-1); line-height: 1.5; max-width: 34em; }
.now { color: var(--muted); max-width: 40em; }
.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1.75rem; }
.btn { display: inline-block; padding: 0.6rem 1.1rem; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); text-decoration: none; font-weight: 500; font-size: 0.95rem; }
.btn:hover { border-color: var(--trace); color: var(--ink); }
.btn-primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn-primary:hover { background: var(--trace); border-color: var(--trace); color: #fff; }
.portrait { margin: 0; }
.portrait img { border-radius: 14px; border: 1px solid var(--line); background: #fff; }

/* Signature: the power trace, drawn once on load */
.trace { margin: 0 0 clamp(3rem, 8vw, 5rem); }
.trace svg { display: block; width: 100%; height: clamp(70px, 9vw, 120px); }
.trace path { fill: none; stroke: var(--trace); stroke-width: 1.4; vector-effect: non-scaling-stroke; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 2.4s cubic-bezier(.45, 0, .2, 1) .2s forwards; }
.trace figcaption { font-size: 0.85rem; color: var(--muted); margin-top: 0.25rem; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@media (prefers-reduced-motion: reduce) { .trace path { animation: none; stroke-dashoffset: 0; } html { scroll-behavior: auto; } }

@media (max-width: 760px) {
  .site-header { flex-wrap: wrap; row-gap: 0; padding-block: 0.75rem 0; }
  .site-header nav { gap: 1.25rem; }
  .site-header nav a { padding-block: 0.6rem; } /* thumb-sized tap targets */
  .hero { grid-template-columns: 1fr; align-items: start; gap: 1.5rem; padding-top: 1.5rem; }
  /* A smaller portrait keeps the name and buttons on the first screen */
  .portrait { order: -1; width: min(8.5rem, 38vw); }
  .actions { display: grid; grid-template-columns: 1fr 1fr; }
  .btn { text-align: center; padding-block: 0.75rem; }
}

/* Sections: heading left, content right */
.section { display: grid; grid-template-columns: 13rem minmax(0, 1fr); gap: 1.5rem clamp(2rem, 6vw, 4rem); padding-block: clamp(2.5rem, 6vw, 4rem); border-top: 1px solid var(--line); }
.section h2 { font-size: var(--step-2); }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); gap: 1rem 2rem; margin: 1.5rem 0 0; }
.facts dt { font-size: 0.85rem; color: var(--muted); }
.facts dd { margin: 0; font-weight: 500; }

/* Experience timeline: a real sequence, newest first */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline > li { position: relative; padding: 0 0 2.25rem 1.75rem; border-left: 1.5px solid var(--line); }
.timeline > li:last-child { padding-bottom: 0; border-left-color: transparent; }
.timeline > li::before { content: ""; position: absolute; left: -6px; top: 0.45rem; width: 10px; height: 10px; border-radius: 50%; background: var(--bg); border: 2px solid var(--trace); }
.timeline > li:first-child::before { background: var(--trace); }
.role-head h3 { font-family: var(--sans); font-size: var(--step-1); font-weight: 600; letter-spacing: 0; }
.org { color: var(--trace); }
.when { color: var(--muted); font-size: 0.92rem; margin: 0.15rem 0 0.75rem; }
.timeline ul { margin: 0; padding-left: 1.1rem; }
.timeline ul li { margin-bottom: 0.4rem; max-width: 65ch; }
.timeline ul li::marker { color: var(--muted); }
.stack { font-size: 0.88rem; color: var(--muted); margin: 0.75rem 0 0; }

@media (max-width: 760px) {
  .section { grid-template-columns: 1fr; }
}

/* Research: the paper gets the most room on the page */
.paper { background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--trace); border-radius: 12px; padding: clamp(1.25rem, 3vw, 2.25rem); }
.venue { color: var(--muted); font-size: 0.92rem; margin-bottom: 0.5rem; }
.paper-title { font-size: var(--step-2); line-height: 1.25; max-width: 30ch; margin-bottom: 0.5rem; }
.authors { color: var(--muted); margin-bottom: 1.25rem; }
.findings { margin: 0.5rem 0 1.5rem; padding: 0; list-style: none; display: grid; gap: 0.6rem; }
.findings li { padding-left: 1.25rem; position: relative; max-width: 60ch; }
.findings li::before { content: ""; position: absolute; left: 0; top: 0.65em; width: 0.6rem; height: 2px; background: var(--trace); }
.links { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; font-weight: 500; }
@media (max-width: 760px) { .links a { display: inline-block; padding-block: 0.4rem; } }
.note { color: var(--muted); font-size: 0.92rem; margin: 0; }

/* Projects: rows with the context on the left */
.projects { display: grid; gap: 0; }
.project { display: grid; grid-template-columns: 10rem minmax(0, 1fr); gap: 0.25rem 1.5rem; padding-block: 1.5rem; border-bottom: 1px solid var(--line); }
.project:first-child { padding-top: 0; }
.project:last-child { border-bottom: 0; padding-bottom: 0; }
.project-meta { color: var(--muted); font-size: 0.9rem; margin: 0.2rem 0 0; }
.project h3 { font-size: var(--step-1); margin-bottom: 0.5rem; }
.project p { margin-bottom: 0.5rem; }
.project a { font-weight: 500; }
@media (max-width: 760px) {
  .project { grid-template-columns: 1fr; }
  .project a { display: inline-block; padding-block: 0.4rem; }
}

/* Education */
.degrees, .certs { list-style: none; margin: 0; padding: 0; }
.degrees li { padding-bottom: 1rem; }
.degrees h3 { font-family: var(--sans); font-size: var(--step-0); font-weight: 600; letter-spacing: 0; }
.degrees p { color: var(--muted); margin: 0.1rem 0 0; }
.sub { font-family: var(--sans); font-size: var(--step-0); font-weight: 600; letter-spacing: 0; margin: 1.25rem 0 0.5rem; }
.certs { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.certs li { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 0.3rem 0.85rem; font-size: 0.92rem; }

/* Contact and footer */
.contact-line { font-size: var(--step-1); }
.contact-mail { font-family: var(--serif); font-size: var(--step-3); font-weight: 600; text-decoration-thickness: 2px; overflow-wrap: anywhere; }
/* Keep the address on one line down to 320px wide screens */
@media (max-width: 760px) { .contact-mail { font-size: clamp(1.4rem, 7vw, var(--step-3)); } }
.site-footer { border-top: 1px solid var(--line); padding-block: 2rem 3rem; color: var(--muted); font-size: 0.9rem; }
