/* ==========================================================================
   Design tokens
   ========================================================================== */

@font-face {
  font-family: "Archivo Var";
  src: local("Archivo");
}

:root {
  --paper: #eef1f6;
  --paper-2: #e3e8f0;
  --panel: #ffffff;
  --ink: #121824;
  --ink-dim: #4a5568;
  --muted: #6b7686;
  --line: #c7d0dc;
  --line-strong: #9aa8ba;
  --accent: #a8551f;
  --accent-2: #7e3d16;
  --accent-soft: #f2e2d3;
  --good: #3f7a4e;

  --font-display: "Archivo", "Arial Narrow", sans-serif;
  --font-body: "Public Sans", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;

  --sheet-margin: clamp(1rem, 3vw, 2.75rem);
  --radius: 3px;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0a1220;
    --paper-2: #0e1a2c;
    --panel: #101c2e;
    --ink: #e3ecf7;
    --ink-dim: #aebccd;
    --muted: #7c8ea3;
    --line: #223349;
    --line-strong: #344962;
    --accent: #e0904c;
    --accent-2: #f2b073;
    --accent-soft: #26201a;
    --good: #6fbf80;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --paper: #0a1220;
  --paper-2: #0e1a2c;
  --panel: #101c2e;
  --ink: #e3ecf7;
  --ink-dim: #aebccd;
  --muted: #7c8ea3;
  --line: #223349;
  --line-strong: #344962;
  --accent: #e0904c;
  --accent-2: #f2b073;
  --accent-soft: #26201a;
  --good: #6fbf80;
  color-scheme: dark;
}

:root[data-theme="light"] {
  --paper: #eef1f6;
  --paper-2: #e3e8f0;
  --panel: #ffffff;
  --ink: #121824;
  --ink-dim: #4a5568;
  --muted: #6b7686;
  --line: #c7d0dc;
  --line-strong: #9aa8ba;
  --accent: #a8551f;
  --accent-2: #7e3d16;
  --accent-soft: #f2e2d3;
  --good: #3f7a4e;
  color-scheme: light;
}

/* ==========================================================================
   Reset & base
   ========================================================================== */

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background:
    repeating-linear-gradient(0deg, transparent, transparent 27px, var(--line) 27px, var(--line) 28px),
    repeating-linear-gradient(90deg, transparent, transparent 27px, var(--line) 27px, var(--line) 28px),
    var(--paper);
  background-size: 28px 28px, 28px 28px, 100% 100%;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  transition: background-color .25s ease, color .25s ease;
}

h1, h2, h3 { text-wrap: balance; margin: 0; }

a { color: inherit; }

button { font: inherit; }

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

/* ==========================================================================
   Sheet frame
   ========================================================================== */

.sheet {
  position: relative;
  max-width: 920px;
  margin: var(--sheet-margin) auto;
  background: var(--panel);
  border: 1px solid var(--line-strong);
  box-shadow: 0 1px 0 var(--line), 0 30px 60px -40px rgba(0,0,0,.35);
}

.crop {
  position: absolute;
  width: 18px;
  height: 18px;
  pointer-events: none;
  z-index: 5;
}
.crop::before, .crop::after {
  content: "";
  position: absolute;
  background: var(--line-strong);
}
.crop::before { width: 100%; height: 1px; top: 50%; }
.crop::after { height: 100%; width: 1px; left: 50%; }
.crop.tl { top: -9px; left: -9px; }
.crop.tr { top: -9px; right: -9px; }
.crop.bl { bottom: -9px; left: -9px; }
.crop.br { bottom: -9px; right: -9px; }

/* ==========================================================================
   Utility bar (theme toggle, doc controls)
   ========================================================================== */

.utility-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .6rem clamp(1.25rem, 4vw, 2.75rem);
  border-bottom: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: .7rem;
  letter-spacing: .06em;
  color: var(--muted);
  text-transform: uppercase;
}

.utility-bar .path { display: flex; gap: .4em; align-items: center; }
.utility-bar .path .sep { color: var(--line-strong); }

.theme-toggle {
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--ink-dim);
  border-radius: var(--radius);
  padding: .3rem .6rem;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: .68rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: .4em;
  transition: border-color .2s, color .2s;
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }
.theme-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ==========================================================================
   Title block (header)
   ========================================================================== */

.titleblock {
  padding: clamp(1.75rem, 5vw, 3rem) clamp(1.25rem, 4vw, 2.75rem) clamp(1.5rem, 4vw, 2.25rem);
  border-bottom: 2px solid var(--ink);
  position: relative;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: .72rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: .9rem;
  display: flex;
  align-items: center;
  gap: .6em;
}
.eyebrow .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--good);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--good) 20%, transparent);
  flex: none;
}

.name {
  font-family: var(--font-display);
  font-weight: 800;
  font-stretch: expanded;
  text-transform: uppercase;
  font-size: clamp(1.9rem, 5.2vw, 3.1rem);
  letter-spacing: -.01em;
  line-height: 1.02;
}
.name .cn {
  font-family: var(--font-body);
  font-weight: 500;
  text-transform: none;
  font-size: .55em;
  color: var(--muted);
  margin-left: .45em;
  letter-spacing: 0;
}

.role {
  margin-top: .55rem;
  font-family: var(--font-mono);
  font-size: clamp(.82rem, 1.6vw, .98rem);
  color: var(--ink-dim);
  letter-spacing: .02em;
}
.role .pipe { color: var(--line-strong); margin: 0 .55em; }

.trace-wrap { margin: 1.4rem 0 .4rem; }
.trace-wrap svg { display: block; width: 100%; height: 34px; }
.trace-path {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.contact-row {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem 1.4rem;
  margin-top: 1.1rem;
  font-size: .88rem;
  color: var(--ink-dim);
}
.contact-row a { text-decoration: none; border-bottom: 1px solid var(--line-strong); }
.contact-row a:hover { color: var(--accent); border-color: var(--accent); }

.tb-grid {
  margin-top: 1.6rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  border: 1px solid var(--line-strong);
  font-family: var(--font-mono);
}
.tb-cell {
  padding: .5rem .75rem;
  border-right: 1px solid var(--line-strong);
  border-top: 1px solid var(--line-strong);
}
.tb-cell:nth-child(-n+4) { border-top: none; }
.tb-cell:last-child { border-right: none; }
.tb-label {
  display: block;
  font-size: .62rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: .2rem;
}
.tb-value { font-size: .82rem; color: var(--ink); }
.tb-value.accent { color: var(--accent); font-weight: 600; }

.cta-row {
  display: flex;
  gap: .7rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}
.btn {
  font-family: var(--font-mono);
  font-size: .78rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  text-decoration: none;
  padding: .65rem 1.1rem;
  border-radius: var(--radius);
  border: 1px solid var(--line-strong);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  gap: .5em;
  transition: transform .15s ease, border-color .15s ease, background .15s ease, color .15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn.primary {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}
.btn.primary:hover { background: var(--accent); border-color: var(--accent); }
.btn.ghost:hover { border-color: var(--accent); color: var(--accent); }

@media (prefers-color-scheme: dark) {
  .btn.primary { background: var(--accent-2); border-color: var(--accent-2); color: #10151d; }
  .btn.primary:hover { background: var(--accent); border-color: var(--accent); }
}
:root[data-theme="dark"] .btn.primary { background: var(--accent-2); border-color: var(--accent-2); color: #10151d; }
:root[data-theme="dark"] .btn.primary:hover { background: var(--accent); border-color: var(--accent); }
:root[data-theme="light"] .btn.primary { background: var(--ink); border-color: var(--ink); color: var(--paper); }

/* ==========================================================================
   Sections
   ========================================================================== */

.section {
  padding: clamp(1.75rem, 4.5vw, 2.5rem) clamp(1.25rem, 4vw, 2.75rem);
  border-bottom: 1px solid var(--line);
  opacity: 0;
  transform: translateY(14px);
  transition: opacity .6s ease, transform .6s ease;
}
.section.in-view { opacity: 1; transform: translateY(0); }
.section:last-of-type { border-bottom: none; }

.section-head {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.section-num {
  font-family: var(--font-mono);
  font-size: .8rem;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 50%;
  width: 1.9em;
  height: 1.9em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.section-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-stretch: expanded;
  text-transform: uppercase;
  letter-spacing: .04em;
  font-size: 1.05rem;
}
.section-rule {
  flex: 1;
  height: 1px;
  background:
    repeating-linear-gradient(90deg, var(--line-strong), var(--line-strong) 4px, transparent 4px, transparent 8px);
}

.summary-text { max-width: 68ch; color: var(--ink-dim); font-size: 1rem; }
.summary-text p + p { margin-top: .9rem; }
.summary-text strong { color: var(--ink); font-weight: 700; }

/* Features / skills grid */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}
@media (max-width: 560px) {
  .feature-grid { grid-template-columns: 1fr; }
}
.feature-card {
  background: var(--panel);
  padding: 1.1rem 1.2rem;
}
.feature-card h3 {
  font-family: var(--font-mono);
  font-size: .74rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: .55rem;
}
.feature-card p {
  margin: 0;
  font-size: .88rem;
  color: var(--ink-dim);
  line-height: 1.6;
}

/* Experience timeline */
.timeline { display: flex; flex-direction: column; gap: 1.9rem; }
.job {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 1.2rem;
}
@media (max-width: 620px) {
  .job { grid-template-columns: 1fr; gap: .5rem; }
}
.job-date {
  font-family: var(--font-mono);
  font-size: .74rem;
  color: var(--muted);
  line-height: 1.5;
  padding-top: .15rem;
}
.job-date .current {
  display: block;
  margin-top: .4rem;
  color: var(--good);
  font-size: .68rem;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.job-title {
  font-weight: 700;
  font-size: 1.02rem;
  color: var(--ink);
}
.job-org { color: var(--muted); font-size: .88rem; margin-top: .15rem; }
.job-bullets {
  margin: .7rem 0 0;
  padding-left: 1.1rem;
  color: var(--ink-dim);
  font-size: .9rem;
  line-height: 1.65;
}
.job-bullets li { margin-bottom: .4rem; }
.job-bullets li::marker { color: var(--accent); }

.early-career {
  margin-top: .3rem;
  padding-top: 1.1rem;
  border-top: 1px dashed var(--line-strong);
  font-size: .85rem;
  color: var(--muted);
}
.early-career strong { color: var(--ink-dim); }

/* Education */
.edu-grid { display: flex; flex-direction: column; gap: 1.1rem; }
.edu-item { display: grid; grid-template-columns: 130px 1fr; gap: 1.2rem; }
@media (max-width: 620px) { .edu-item { grid-template-columns: 1fr; gap: .3rem; } }
.edu-date { font-family: var(--font-mono); font-size: .74rem; color: var(--muted); }
.edu-name { font-weight: 700; }
.edu-degree { color: var(--ink-dim); font-size: .9rem; margin-top: .1rem; }
.edu-thesis { margin-top: .4rem; font-size: .84rem; color: var(--muted); font-style: italic; }

/* Notes / honors table */
.notes-table { width: 100%; border-collapse: collapse; font-size: .87rem; }
.notes-table tr { border-bottom: 1px solid var(--line); }
.notes-table tr:last-child { border-bottom: none; }
.notes-table td { padding: .55rem .2rem; vertical-align: top; }
.notes-table td:first-child {
  font-family: var(--font-mono);
  color: var(--muted);
  white-space: nowrap;
  padding-right: 1.2rem;
  font-size: .74rem;
}
.notes-table td:last-child { color: var(--ink-dim); }

/* Footer */
.sheet-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 1.1rem clamp(1.25rem, 4vw, 2.75rem);
  font-family: var(--font-mono);
  font-size: .68rem;
  letter-spacing: .04em;
  color: var(--muted);
  text-transform: uppercase;
}
.sheet-footer a { color: var(--muted); text-decoration: none; border-bottom: 1px solid var(--line-strong); }
.sheet-footer a:hover { color: var(--accent); border-color: var(--accent); }

@media (prefers-reduced-motion: reduce) {
  .section, .trace-path { transition: none !important; animation: none !important; }
}
