:root {
    --bg: #1F1E1D;
    --bg-hover: #282725;
    --strip: #2A2927;
    --panel: #181716;
    --rule: #3A3836;
    --text: #F5F4F0;
    --soft: #C9C7C1;
    --muted: #8E8C87;
    --dim: #55534F;
    --arrow: #E0A458;
  }
  * { box-sizing: border-box; }
  html { scroll-behavior: smooth; }
  body { margin: 0; background: var(--bg); color: var(--text); font: 17px/1.6 "IBM Plex Sans", "Helvetica Neue", Helvetica, sans-serif; overflow-x: hidden; }
  a { color: var(--text); }
  a:hover { color: #FFC730; }
  a:focus-visible, button:focus-visible, input:focus-visible { outline: 2px solid #FFC730; outline-offset: 3px; }
  .mono { font-family: "IBM Plex Mono", Menlo, monospace; }
  .display { font-family: "Archivo", sans-serif; }
  .pad { padding-left: 40px; padding-right: 40px; }
  @media (max-width: 640px) { .pad { padding-left: 20px; padding-right: 20px; } }

  /* Ticker tape */
  .tapewrap { overflow: hidden; background: var(--strip); border-bottom: 1px solid var(--rule); font-size: 14px; padding: 11px 0; }
  .tape { display: flex; width: max-content; animation: tape 70s linear infinite; }
  .tapewrap:hover .tape { animation-play-state: paused; }
  .tape span.item { display: inline-flex; align-items: center; gap: 10px; padding: 0 28px; white-space: nowrap; }
  .tape span.arrow { color: var(--arrow); }
  @keyframes tape { from { transform: translateX(0); } to { transform: translateX(-50%); } }

  header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px 16px; padding-top: 18px; padding-bottom: 18px; font-size: 14px; }
  header a { text-decoration: none; }
  header nav { display: flex; flex-wrap: wrap; gap: 0 24px; }
  header nav a { padding: 12px 0; }
  header nav a.resume { color: #FFC730; }
  @media (max-width: 640px) { header nav a.wide { display: none; } }

  /* Hero */
  #top { padding-top: 16px; padding-bottom: 18px; }
  h1.name { margin: 0; font-stretch: 75%; font-weight: 900; font-size: clamp(32px, 5.5vw, 72px); line-height: .95; letter-spacing: -.01em; display: flex; flex-wrap: wrap; column-gap: .18em; }
  h1.name .word { display: inline-flex; column-gap: .02em; }
  h1.name .word span { display: inline-block; }
  .hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px 48px; align-items: center; }
  .herotext { display: flex; flex-direction: column; gap: 28px; min-width: 0; }
  .surface { position: relative; height: clamp(240px, 38vh, 320px); border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
  @media (max-width: 900px) { .hero { grid-template-columns: 1fr; } .surface { height: clamp(220px, 34vh, 280px); } }
  @media (max-width: 640px) { .controls span { display: none; } }
  .surface canvas { display: block; width: 100%; height: 100%; cursor: grab; touch-action: pan-y; }
  .surface canvas.dragging { cursor: grabbing; }
  .readout { position: absolute; top: 14px; right: 0; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; font-size: 13px; color: var(--muted); pointer-events: none; }
  .readout strong { font-family: "Archivo", sans-serif; font-weight: 800; font-size: 26px; line-height: 1; color: var(--text); font-variant-numeric: tabular-nums; }
  .controls { position: absolute; left: 0; top: 14px; display: flex; align-items: center; gap: 14px; font-size: 12px; color: var(--muted); }
  .pill { display: inline-flex; align-items: center; min-height: 44px; padding: 0 18px; border: 1px solid var(--dim); border-radius: 999px; background: var(--bg); color: var(--text); font: inherit; text-decoration: none; cursor: pointer; transition: border-color .2s, color .2s, background .2s; }
  .pill:hover { border-color: #FF8F42; color: #FF8F42; }
  .pill.solid { background: var(--text); color: var(--bg); border-color: var(--text); }
  .pill.solid:hover { background: #FFC730; border-color: #FFC730; color: var(--bg); }
  .herofoot { display: flex; flex-direction: column; gap: 20px; align-items: flex-start; }
  .pitch { margin: 0; font-weight: 500; font-size: clamp(17px, 1.8vw, 22px); line-height: 1.35; max-width: 30ch; }
  .cta { display: flex; flex-direction: column; gap: 16px; align-items: flex-start; }
  .cta .buttons { display: flex; flex-wrap: wrap; gap: 12px; font-size: 15px; }
  .cta .links { display: flex; flex-wrap: wrap; gap: 4px 20px; font-size: 13px; color: var(--muted); }
  .cta .links a, .cta .links button { color: var(--soft); background: none; border: 0; padding: 10px 0; font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--dim); }
  .cta .links a:hover, .cta .links button:hover { color: #FFC730; }

  /* Section headings */
  .sechead { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 10px 40px; margin-bottom: 24px; }
  .secnum { margin: 0 0 10px; font-size: 13px; color: var(--muted); }
  .sechead h1, .sechead h2 { margin: 0; font-stretch: 125%; font-weight: 800; font-size: clamp(24px, 3.2vw, 40px); line-height: 1.1; }
  .backlink { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 28px; font-size: 14px; color: var(--muted); text-decoration: none; }
  .backlink:hover { color: var(--text); }
  .legend { margin: 0; font-size: 13px; color: var(--muted); }
  section.block { padding-top: 44px; padding-bottom: 32px; }

  /* Projects */
  .list { border-top: 1px solid var(--text); }
  .item { border-bottom: 1px solid var(--rule); }
  .prow { display: grid; grid-template-columns: 90px minmax(0, 1fr) auto; gap: 20px; align-items: center; width: 100%; min-height: 76px; padding: 16px 8px; border: 0; background: transparent; font: inherit; color: var(--text); text-align: left; cursor: pointer; }
  .prow:hover { background: var(--bg-hover); }
  .prow .code { display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
  .prow .count { color: var(--muted); }
  .ptitle { display: block; font-stretch: 75%; font-weight: 800; font-size: clamp(18px, 2.4vw, 28px); line-height: 1.15; transition: transform .35s cubic-bezier(.2,.7,.2,1), color .2s; }
  .prow:hover .ptitle, .prow[aria-expanded="true"] .ptitle { color: var(--c); }
  .prow:hover .ptitle { transform: translateX(18px); }
  .status { font-size: 13px; border-radius: 999px; padding: 4px 14px; white-space: nowrap; }
  .detail { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 24px 48px; padding: 4px 8px 28px 118px; }
  .detail[hidden] { display: none; }
  .detail .q { margin: 0 0 12px; font-weight: 600; font-size: 17px; line-height: 1.35; }
  .detail .a { margin: 0; color: var(--soft); }
  .facts { display: flex; flex-direction: column; font-size: 15px; }
  .facts div { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 16px; padding: 12px 0; border-top: 1px solid var(--rule); }
  .facts div:last-child { border-bottom: 1px solid var(--rule); }
  .facts .k { font-size: 13px; color: var(--muted); }
  @media (max-width: 640px) {
    .prow { grid-template-columns: 1fr auto; gap: 8px 16px; }
    .prow .code { grid-column: 1 / -1; flex-direction: row; gap: 12px; }
    .detail { padding-left: 8px; }
  }

  /* Pitches */
  .pstats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 20px 32px; margin: 4px 0 28px; }
  .pstat { display: flex; flex-direction: column; }
  .pstat .k { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
  .pstat .v { display: block; font-family: "Archivo", sans-serif; font-weight: 700; font-size: 22px; font-variant-numeric: tabular-nums; }
  .pstat .v.dim { color: var(--muted); font-family: inherit; font-weight: 400; font-size: 15px; }
  .pdelta { display: block; margin-top: 4px; font-size: 13px; font-family: "IBM Plex Mono", Menlo, monospace; }
  .pdelta.up { color: #3CD6A0; }
  .pdelta.down { color: #FF6B6B; }
  .ptimeline { margin: 4px 0 32px; }
  .ptimeline .bar { position: relative; height: 6px; background: var(--rule); border-radius: 999px; margin: 12px 0 8px; }
  .ptimeline .fill { position: absolute; left: 0; top: 0; height: 100%; border-radius: 999px; }
  .ptimeline .dot { position: absolute; top: 50%; width: 12px; height: 12px; border-radius: 50%; background: var(--text); transform: translate(-50%, -50%); border: 2px solid var(--bg); }
  .ptimeline .labels { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
  .pchart { border-top: 1px solid var(--rule); padding-top: 24px; margin-top: 8px; }
  .pchart .tv { height: 340px; border-radius: 6px; overflow: hidden; background: var(--strip); }
  .pchartnote { margin: 12px 0 0; font-size: 12px; color: var(--muted); }
  .pmissing { color: var(--muted); font-size: 13px; }

  /* About and stats */
  .statement { margin: 0; font-weight: 500; font-size: clamp(18px, 2.2vw, 28px); line-height: 1.3; max-width: 28ch; }
  .stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 20px; margin-top: 28px; border-top: 1px solid var(--rule); padding-top: 20px; }
  .stat strong { display: block; font-family: "Archivo", sans-serif; font-stretch: 75%; font-weight: 900; font-size: clamp(28px, 3.4vw, 42px); line-height: 1; font-variant-numeric: tabular-nums; }
  .stat span { display: block; margin-top: 8px; font-size: 15px; color: var(--soft); max-width: 24ch; }

  /* Experience */
  .jobs { border-top: 1px solid var(--text); }
  .job { display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: 12px 32px; padding: 16px 0; border-bottom: 1px solid var(--rule); }
  .job .when { font-size: 13px; color: var(--muted); padding-top: 6px; }
  .job .org { margin: 0; font-size: 15px; color: var(--soft); }
  .job h3 { margin: 2px 0 0; font-family: "Archivo", sans-serif; font-stretch: 100%; font-weight: 700; font-size: 18px; line-height: 1.3; }
  .job ul { margin: 16px 0 0; padding-left: 20px; color: var(--soft); max-width: 72ch; }
  .job li { margin: 6px 0; }
  .job li::marker { color: var(--dim); }
  .tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
  .tags span { font-size: 12px; color: var(--soft); border: 1px solid var(--rule); border-radius: 999px; padding: 3px 12px; }
  @media (max-width: 700px) { .job { grid-template-columns: 1fr; gap: 4px; } }

  /* Toolbox */
  .toolbox { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 40px 64px; align-items: center; }
  .sphere { position: relative; height: 380px; touch-action: pan-y; cursor: grab; user-select: none; }
  .sphere.dragging { cursor: grabbing; }
  .sphere .tag { position: absolute; left: 50%; top: 50%; white-space: nowrap; font-size: 15px; will-change: transform, opacity; }
  .sphere .hint { position: absolute; left: 0; bottom: 0; font-size: 13px; color: var(--muted); }
  .groups { display: flex; flex-direction: column; }
  .group { padding: 18px 0; border-top: 1px solid var(--rule); }
  .group:last-child { border-bottom: 1px solid var(--rule); }
  .group h3 { display: flex; align-items: center; gap: 10px; margin: 0 0 6px; font-size: 15px; font-weight: 600; }
  .group h3 i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
  .group p { margin: 0; color: var(--soft); font-size: 15px; }

  /* Contact */
  #contact { padding-top: 44px; padding-bottom: 32px; }
  .bigtape { overflow: hidden; margin-top: 8px; }
  .bigtape div { display: flex; width: max-content; font-stretch: 125%; font-weight: 900; font-size: clamp(32px, 5.5vw, 72px); line-height: 1.05; white-space: nowrap; animation: tapeRev 40s linear infinite; }
  .bigtape span { padding-right: .4em; }
  .outline { color: transparent; -webkit-text-stroke: 1.5px var(--text); }
  @keyframes tapeRev { from { transform: translateX(-50%); } to { transform: translateX(0); } }
  .contactrow { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 16px 40px; padding-top: 32px; }
  .contactrow p { margin: 0; color: var(--soft); max-width: 44ch; }
  .contactrow .links { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 28px; font-size: 15px; }
  footer { padding-top: 16px; padding-bottom: 36px; font-size: 13px; color: var(--muted); }

  /* Terminal */
  .termfab { position: fixed; right: 20px; bottom: 20px; z-index: 50; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; border: 1px solid var(--rule); border-radius: 999px; background: var(--strip); color: var(--text); font-size: 13px; cursor: pointer; }
  .termfab:hover { border-color: #3CD6A0; color: #3CD6A0; }
  .termfab kbd { font: inherit; color: var(--muted); }
  @media (max-width: 640px) { .termfab kbd { display: none; } .termfab { right: 12px; bottom: 12px; } }
  .term { position: fixed; right: 20px; bottom: 76px; z-index: 60; width: min(460px, calc(100vw - 40px)); height: min(380px, calc(100vh - 120px)); display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--rule); border-radius: 10px; box-shadow: 0 24px 60px rgba(0, 0, 0, .45); font-size: 13px; }
  .term[hidden] { display: none; }
  .termbar { display: flex; justify-content: space-between; align-items: center; padding: 4px 6px 4px 16px; border-bottom: 1px solid var(--rule); color: var(--muted); }
  .termbar button { width: 44px; height: 36px; border: 0; background: none; color: var(--muted); font: inherit; font-size: 16px; cursor: pointer; }
  .termbar button:hover { color: var(--text); }
  .termout { flex: 1; overflow-y: auto; padding: 14px 16px 4px; line-height: 1.55; }
  .termout div { white-space: pre-wrap; word-break: break-word; }
  .termout .echo { color: var(--muted); margin-top: 8px; }
  .termout .dim { color: var(--muted); }
  .termin { display: flex; align-items: center; gap: 10px; padding: 10px 16px 14px; }
  .termin label { color: #3CD6A0; }
  .termin input { flex: 1; min-width: 0; background: transparent; border: 0; color: var(--text); font: inherit; outline: none; }
  .termin input:focus-visible { outline: none; }
  .term:focus-within { border-color: var(--dim); }

  /* Reveal on scroll */
  .reveal { opacity: 0; transform: translateY(28px); transition: opacity .6s ease, transform .8s cubic-bezier(.2,.7,.2,1); transition-delay: var(--d, 0ms); }
  .reveal.in { opacity: 1; transform: none; }

  @media (prefers-reduced-motion: reduce) {
    .tape, .bigtape div { animation: none; }
    .ptitle { transition: none; }
    .reveal { opacity: 1; transform: none; transition: none; }
    html { scroll-behavior: auto; }
  }
