/* ---------------------------------------------------------------
   Reset
--------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; }
img, svg, canvas { display: block; max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; background: none; border: 0; padding: 0; }
ul { list-style: none; margin: 0; padding: 0; }
a { color: inherit; }

/* ---------------------------------------------------------------
   Tokens (light mode is the default)
--------------------------------------------------------------- */
:root {
  --bg:           #fafaf8;
  --bg-elev:      #f3f3ee;
  --text:         #0d0d0c;
  --text-muted:   #59595a;
  --text-faint:   #93938e;
  --border:       #e4e3dd;
  --border-strong:#cdccc4;

  --accent:       #a8632d;
  --accent-soft:  rgba(168, 99, 45, 0.10);

  --font-sans: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
               "Segoe UI Variable", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Mono", "JetBrains Mono",
               Menlo, Consolas, monospace;

  --max-w: 920px;
  --gutter: clamp(20px, 5vw, 48px);
  --rail: 80px;

  --ease: cubic-bezier(.2, .7, .2, 1);
}

/* Dark mode, applied via [data-theme="dark"] OR by system pref when no override */
[data-theme="dark"] {
  --bg:           #0a0a09;
  --bg-elev:      #14140f;
  --text:         #f0efe9;
  --text-muted:   #9c9b94;
  --text-faint:   #5d5c56;
  --border:       #232220;
  --border-strong:#33322f;
  --accent:       #e0915a;
  --accent-soft:  rgba(224, 145, 90, 0.14);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:           #0a0a09;
    --bg-elev:      #14140f;
    --text:         #f0efe9;
    --text-muted:   #9c9b94;
    --text-faint:   #5d5c56;
    --border:       #232220;
    --border-strong:#33322f;
    --accent:       #e0915a;
    --accent-soft:  rgba(224, 145, 90, 0.14);
  }
}

/* ---------------------------------------------------------------
   Base
--------------------------------------------------------------- */
html, body { background: var(--bg); }

body {
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "ss01", "cv11";
}

/* Smooth theme transitions, but only after first paint to avoid initial flash */
body.themed {
  transition: background-color .35s var(--ease), color .35s var(--ease);
}

::selection { background: var(--accent); color: var(--bg); }

a { text-decoration: none; }
a:focus-visible, button:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 3px;
  border-radius: 2px;
}

/* ---------------------------------------------------------------
   Layout containers
--------------------------------------------------------------- */
.site-header,
main > section,
.site-footer {
  max-width: var(--max-w);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* ---------------------------------------------------------------
   Header
--------------------------------------------------------------- */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 28px;
  padding-bottom: 28px;
}

.brand {
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.005em;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 28px;
}

.nav-list {
  display: flex;
  gap: 28px;
}
.nav-list a {
  font-size: 14px;
  color: var(--text-muted);
  transition: color .2s var(--ease);
}
.nav-list a:hover { color: var(--accent); }

.theme-toggle {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  border: 0.5px solid var(--border);
  border-radius: 999px;
  transition: color .2s var(--ease), border-color .2s var(--ease), transform .2s var(--ease);
}
.theme-toggle:hover {
  color: var(--text);
  border-color: var(--border-strong);
}
.theme-toggle:active { transform: scale(0.96); }

.theme-toggle .icon-sun  { display: none; }
.theme-toggle .icon-moon { display: block; }
[data-theme="dark"] .theme-toggle .icon-sun  { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none;  }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun  { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: none;  }
}

/* ---------------------------------------------------------------
   Hero
--------------------------------------------------------------- */
.hero {
  position: relative;
  isolation: isolate;
  padding-block: clamp(80px, 14vh, 160px);
  margin-top: 8px;
  overflow: hidden;
}

#particle-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  color: var(--text);
  z-index: 0;
}

.hero-content {
  position: relative;
  z-index: 1;
  pointer-events: none;
}

.hero h1 {
  font-size: clamp(44px, 8.4vw, 96px);
  line-height: 0.98;
  font-weight: 500;
  letter-spacing: -0.03em;
  margin: 0 0 28px;
  max-width: 14ch;
}

.hero p {
  font-size: clamp(16px, 1.6vw, 19px);
  color: var(--text-muted);
  max-width: 44ch;
  margin: 0;
  line-height: 1.55;
}

/* ---------------------------------------------------------------
   Sections
--------------------------------------------------------------- */
.section {
  padding-block: clamp(56px, 9vh, 96px);
  border-top: 0.5px solid var(--border);
}

.section-header { margin-bottom: 36px; }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--accent);
  text-transform: lowercase;
}

/* ---------------------------------------------------------------
   Work list
--------------------------------------------------------------- */
.work-row {
  display: grid;
  grid-template-columns: minmax(120px, auto) 1fr auto;
  align-items: baseline;
  gap: 32px;
  padding: 22px 0;
  border-top: 0.5px solid var(--border);
  transition: padding-left .25s var(--ease);
}
.work-list li:last-child .work-row { border-bottom: 0.5px solid var(--border); }
.work-row:hover { padding-left: 10px; }

.work-title { font-size: 19px; font-weight: 500; letter-spacing: -0.005em; }
.work-desc  { font-size: 15px; color: var(--text-muted); }
.work-year  {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}

@media (max-width: 600px) {
  .work-row {
    grid-template-columns: 1fr auto;
    gap: 4px 16px;
    padding: 18px 0;
  }
  .work-title { grid-row: 1; grid-column: 1; }
  .work-year  { grid-row: 1; grid-column: 2; }
  .work-desc  { grid-row: 2; grid-column: 1 / -1; }
  .work-row:hover { padding-left: 6px; }
}

/* ---------------------------------------------------------------
   About prose
--------------------------------------------------------------- */
.prose { max-width: 60ch; }
.prose p { margin: 0 0 18px; }
.prose p:last-child { margin-bottom: 0; }
.prose a {
  text-decoration: underline;
  text-decoration-thickness: 0.5px;
  text-underline-offset: 4px;
  text-decoration-color: var(--border-strong);
  transition: text-decoration-color .2s var(--ease);
}
.prose a:hover { color: var(--accent); text-decoration-color: var(--accent); }

/* ---------------------------------------------------------------
   Contact
--------------------------------------------------------------- */
.contact-list {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 28px;
}
.contact-list a {
  font-size: 16px;
  border-bottom: 0.5px solid var(--border-strong);
  padding-bottom: 2px;
  transition: border-color .2s var(--ease);
}
.contact-list a:hover { color: var(--accent); border-bottom-color: var(--accent); }

/* ---------------------------------------------------------------
   Footer
--------------------------------------------------------------- */
.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  padding-block: 48px;
  margin-top: 24px;
  font-size: 13px;
  color: var(--text-faint);
  border-top: 0.5px solid var(--border);
}
.footer-meta { font-family: var(--font-mono); font-size: 12px; }

/* ---------------------------------------------------------------
   Active nav item
--------------------------------------------------------------- */
.nav-list a[aria-current="page"] {
  color: var(--accent);
}
.nav-list a[aria-current="page"]::after {
  content: "";
  display: block;
  height: 0.5px;
  background: var(--accent);
  margin-top: 2px;
}

/* ---------------------------------------------------------------
   Resume page
--------------------------------------------------------------- */
.resume-header {
  max-width: var(--max-w);
  margin-inline: auto;
  padding-inline: var(--gutter);
  padding-block: clamp(48px, 9vh, 88px);
}
.resume-header .eyebrow { display: block; margin-bottom: 18px; }
.resume-header h1 {
  font-size: clamp(38px, 6.4vw, 64px);
  line-height: 1.04;
  font-weight: 500;
  letter-spacing: -0.025em;
  margin: 0 0 22px;
  max-width: 16ch;
}
.resume-contact {
  font-size: 16px;
  color: var(--text-muted);
  margin: 0 0 6px;
}
.resume-contact a { color: inherit; text-decoration: underline; text-decoration-thickness: 0.5px; text-underline-offset: 3px; text-decoration-color: var(--border-strong); }
.resume-contact a:hover { color: var(--accent); text-decoration-color: var(--accent); }
.resume-credentials {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-faint);
  letter-spacing: 0.04em;
  margin: 0;
}

/* Two-column entries: dates left, content right */
.resume-entry {
  display: grid;
  grid-template-columns: minmax(160px, auto) 1fr;
  gap: 32px;
  padding: 28px 0;
  border-top: 0.5px solid var(--border);
}
.resume-entry:last-child { border-bottom: 0.5px solid var(--border); }
.entry-meta {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-faint);
  padding-top: 4px;
}
.entry-role {
  font-size: 19px;
  font-weight: 500;
  letter-spacing: -0.005em;
  margin: 0 0 4px;
}
.entry-org {
  font-size: 15px;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.entry-detail {
  font-size: 15px;
  color: var(--text-muted);
  margin: 12px 0 0;
}
.entry-subhead {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-faint);
  letter-spacing: 0.04em;
  margin: 26px 0 12px;
}

.entry-bullets,
.practice-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.entry-bullets li,
.practice-list li {
  position: relative;
  padding-left: 22px;
  margin-bottom: 12px;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
}
.entry-bullets li:last-child,
.practice-list li:last-child { margin-bottom: 0; }
.entry-bullets li::before,
.practice-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 12px;
  width: 10px;
  height: 0.5px;
  background: var(--accent);
}

/* Skills: two-column definition list */
.skills-list { margin: 0; }
.skills-row {
  display: grid;
  grid-template-columns: minmax(160px, auto) 1fr;
  gap: 32px;
  padding: 18px 0;
  border-top: 0.5px solid var(--border);
}
.skills-row:last-child { border-bottom: 0.5px solid var(--border); }
.skills-row dt {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-faint);
  letter-spacing: 0.04em;
  padding-top: 4px;
  text-transform: lowercase;
}
.skills-row dd {
  margin: 0;
  font-size: 15px;
  line-height: 1.6;
}

/* Certifications */
.cert-list { list-style: none; margin: 0; padding: 0; }
.cert-item {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  gap: 24px;
  padding: 18px 0;
  border-top: 0.5px solid var(--border);
}
.cert-list li:last-child { border-bottom: 0.5px solid var(--border); }
.cert-name { font-size: 16px; font-weight: 500; }
.cert-date {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}

/* Publications */
.publication-list {
  list-style: decimal-leading-zero;
  margin: 0;
  padding-left: 32px;
  counter-reset: pubs;
}
.publication-list li {
  padding: 22px 0;
  border-top: 0.5px solid var(--border);
  font-size: 15px;
  line-height: 1.6;
}
.publication-list li:last-child { border-bottom: 0.5px solid var(--border); }
.publication-list li::marker {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-faint);
}
.publication-title { font-weight: 500; color: var(--text); display: inline; margin-right: 4px; }
.publication-authors { color: var(--text-muted); display: inline; }
.publication-venue {
  display: block;
  margin-top: 6px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-faint);
  letter-spacing: 0.04em;
}

/* Mobile: collapse two-column entries to single column */
@media (max-width: 700px) {
  .resume-entry,
  .skills-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .entry-meta { padding-top: 0; margin-bottom: 4px; }
  .skills-row dt { padding-top: 0; }
  .cert-item {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}

/* ---------------------------------------------------------------
   Print styles: clean printable resume
--------------------------------------------------------------- */
@media print {
  :root {
    --bg: white;
    --text: #000;
    --text-muted: #333;
    --text-faint: #666;
    --border: #ccc;
    --border-strong: #999;
    --accent: #000;
  }
  body { background: white; color: #000; font-size: 10pt; line-height: 1.4; }
  .site-header, .site-footer, .theme-toggle, #particle-canvas { display: none !important; }
  .section, .resume-header { padding-block: 14pt; border-top: none; }
  .resume-entry { padding: 10pt 0; break-inside: avoid; }
  a { color: #000; text-decoration: none; }
  h1 { font-size: 24pt; }
  .entry-role { font-size: 12pt; }
  .resume-contact, .entry-org, .entry-detail { font-size: 10pt; }
}


@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}