/* =========================================================================
   DESIGN SYSTEM
   Refined and quiet: a warm near-white ground with a faint grid, one
   accent color used consistently instead of a rotating palette, near-
   black text, and a single typeface (IBM Plex Sans) for everything —
   headings, labels, nav, body. "--amber"/"--teal" var names kept for
   minimal diff — both now point at the same single accent.
   ========================================================================= */

:root {
  --bg:            #ffffff;
  --bg-elevated:   #ffffff;
  --bg-card:       #ffffff;
  --border:        #e2e2e2;
  --border-soft:   #eeeeee;
  --border-faint:  #f4f4f4;

  --text:          #000000;   /* was #0e0d16 */
  --text-muted:    #000000;   /* was #1a1a1a / #3d3b4a */
  --text-faint:    #000000;   /* was #454545 / #6b6878 */

  --amber:         #2f5fd8;
  --amber-soft:    rgba(47, 95, 216, 0.10);
  --amber-line:    rgba(47, 95, 216, 0.35);
  --teal:          #2f5fd8;
  --teal-soft:     rgba(47, 95, 216, 0.10);

  --green:         #2f5fd8;
  --green-soft:    rgba(47, 95, 216, 0.10);
  --yellow:        #2f5fd8;
  --yellow-soft:   rgba(47, 95, 216, 0.10);
  --pink:          #2f5fd8;
  --pink-soft:     rgba(47, 95, 216, 0.10);

  --ink:           #0e0d16;

  --font-display: "IBM Plex Sans", "Helvetica Neue", Arial, sans-serif;
  --font-body:    "IBM Plex Sans", "Helvetica Neue", Arial, sans-serif;
  --font-mono:    "IBM Plex Sans", "Helvetica Neue", Arial, sans-serif;
  --font-serif:   "IBM Plex Sans", "Helvetica Neue", Arial, sans-serif;
  --font-serif:   "Fraunces", Georgia, "Times New Roman", serif;

  --container: 880px;
  --radius: 10px;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
}

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

body {
  margin: 0;
  background:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px),
    linear-gradient(var(--border-faint) 1px, transparent 1px),
    linear-gradient(90deg, var(--border-faint) 1px, transparent 1px),
    var(--bg);
  background-size: 64px 64px, 64px 64px, 8px 8px, 8px 8px, auto;
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

::selection { background: var(--amber-soft); color: var(--amber); }

:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 3px;
  border-radius: 4px;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.15;
  margin: 0;
  letter-spacing: -0.01em;
}

p { margin: 0 0 1em; }

.wrap {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
}

/* --------------------------------------------------------------------
   Gentle float keyframe — used by the small pixel-sun accent only.
   -------------------------------------------------------------------- */

@keyframes blob-float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(0, -48px) scale(1.06); }
}

/* --------------------------------------------------------------------
   Nav
   -------------------------------------------------------------------- */

.site-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(250, 248, 243, 0.82);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-soft);
}

.site-nav .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.brand {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 17px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 0 3px var(--amber-soft), 0 0 10px 2px var(--amber-line);
}

.nav-links {
  display: flex;
  gap: 28px;
  list-style: none;
  margin: 0;
  padding: 0;
  font-family: var(--font-mono);
  font-size: 13px;
}

.nav-links a {
  color: var(--text-muted);
  transition: color 0.15s ease;
  position: relative;
  padding: 4px 0;
}

.nav-links a:hover, .nav-links a.active {
  color: var(--text);
}

.nav-links a.active::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -3px;
  height: 2px;
  background: var(--amber);
}

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  width: 36px;
  height: 36px;
  font-family: var(--font-mono);
  cursor: pointer;
}

@media (max-width: 640px) {
  .nav-toggle { display: block; }
  .nav-links {
    position: absolute;
    top: 64px;
    left: 0; right: 0;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    gap: 0;
    padding: 8px 24px 16px;
    display: none;
  }
  .nav-links.open { display: flex; }
  .nav-links a { display: block; padding: 12px 0; border-bottom: 1px solid var(--border-soft); }
}

/* --------------------------------------------------------------------
   Hero
   -------------------------------------------------------------------- */

.hero {
  position: relative;
  padding: 96px 0 72px;
  overflow: hidden;
  border-bottom: 1px solid var(--border-soft);
}

.hero .wrap { position: relative; z-index: 1; }

.hero-pixel-sun {
  position: absolute;
  top: 40px;
  left: 6%;
  width: 44px;
  height: 44px;
  z-index: 1;
  opacity: 0.85;
  animation: blob-float 8s ease-in-out infinite;
  image-rendering: pixelated;
}

@media (max-width: 760px) {
  .hero-toasts { display: none; }
  .hero-pixel-sun { display: none; }
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--amber);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}

.eyebrow::before {
  content: "";
  width: 20px;
  height: 1px;
  background: var(--amber-line);
}

.hero h1 {
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  max-width: 16ch;
}

.hero h1 .accent { color: var(--amber); }

.hero .lede {
  margin-top: 22px;
  max-width: 58ch;
  color: var(--text-muted);
  font-size: 1.05rem;
}


.tag {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--bg-elevated);
}


.hero-actions {
  margin-top: 36px;
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.btn {
  font-family: var(--font-mono);
  font-size: 13.5px;
  padding: 11px 20px;
  border-radius: 8px;
  border: 1px solid var(--border);
  transition: border-color 0.15s ease, transform 0.15s ease, background 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn:hover { transform: translateY(-1px); }

.btn-primary {
  background: var(--ink);
  color: #fdfcf8;
  border-color: var(--ink);
  font-weight: 600;
  box-shadow: 0 0 0px 0px transparent;
}
.btn-primary:hover { background: #2a2838; box-shadow: 0 8px 20px -8px rgba(22, 21, 31, 0.5); }

.btn-ghost {
  color: var(--text);
  background: var(--bg-elevated);
}
.btn-ghost:hover {
  border-color: var(--teal);
  color: var(--teal);
  box-shadow: 0 0 0 3px var(--teal-soft);
}

.live-stats {
  margin-top: 28px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-muted);
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px var(--green-soft);
  animation: live-pulse 1.8s ease-in-out infinite;
  flex-shrink: 0;
}

@keyframes live-pulse {
  0%, 100% { box-shadow: 0 0 0 3px var(--green-soft); }
  50% { box-shadow: 0 0 0 6px var(--green-soft); }
}

.live-stats-num {
  color: var(--text);
  font-weight: 600;
}

.live-stats-sep { color: var(--text-faint); }

/* --------------------------------------------------------------------
   Sections / eyebrow labels (code-comment style, matches the subject)
   -------------------------------------------------------------------- */

section { padding: 72px 0; }
section + section { border-top: 1px solid var(--border-soft); }

.section-label {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--teal);
  margin-bottom: 28px;
  display: block;
}

.section-label::before { content: "// "; color: var(--text-faint); }

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 36px;
  gap: 20px;
  flex-wrap: wrap;
}

.section-head h2 {
  font-size: clamp(1.5rem, 3vw, 2rem);
}

.section-head .view-all {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
}
.section-head .view-all:hover { color: var(--amber); }

/* --------------------------------------------------------------------
   About / focus chips
   -------------------------------------------------------------------- */

.focus-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
  margin-top: 28px;
}

.focus-item {
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: 14px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 10px;
}

.focus-item::before {
  content: "";
  width: 6px;
  height: 6px;
  background: var(--teal);
  flex-shrink: 0;
}

/* --------------------------------------------------------------------
   About (photo + bio + social links)
   -------------------------------------------------------------------- */

.about-grid {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 40px;
  align-items: start;
}

.about-photo img,
.about-photo-fallback {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--amber-line);
  box-shadow: 0 0 0 6px var(--amber-soft), 0 0 30px -4px var(--teal-soft);
}

.about-photo-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 3rem;
  font-weight: 700;
  color: var(--amber);
  background: var(--bg-elevated);
}

.about-copy p {
  font-size: 1.02rem;
  color: var(--text-muted);
  max-width: 62ch;
}

.about-socials {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.social-link {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text);
  border: 1px solid var(--border);
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--bg-elevated);
  transition: border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.social-link:hover {
  border-color: var(--amber);
  color: var(--amber);
  box-shadow: 0 0 14px -4px var(--amber-line);
}

@media (max-width: 560px) {
  .about-grid { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .about-socials { justify-content: center; }
}

/* --------------------------------------------------------------------
   Experience / education
   A vertical "pipe" runs through every entry, LinkedIn-style, with a
   glowing node marking each one.
   -------------------------------------------------------------------- */

.timeline {
  display: flex;
  flex-direction: column;
  position: relative;
  padding-left: 28px;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: linear-gradient(180deg, var(--amber), var(--teal));
  opacity: 0.55;
}

.timeline-item {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 24px;
  padding: 24px 0;
  position: relative;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: -28px;
  top: 30px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 0 3px var(--bg), 0 0 12px 2px var(--amber-line);
}

.timeline-period {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text-faint);
  padding-top: 3px;
}

.timeline-role { font-family: var(--font-display); font-size: 1.05rem; font-weight: 600; }
.timeline-org { color: var(--amber); font-size: 0.95rem; margin-top: 2px; }
.timeline-location { color: var(--text-faint); font-size: 0.85rem; margin-top: 2px; }

.timeline-points {
  margin: 12px 0 0;
  padding-left: 18px;
  color: var(--text-muted);
  font-size: 14.5px;
}
.timeline-points li { margin-bottom: 6px; }

@media (max-width: 560px) {
  .timeline-item { grid-template-columns: 1fr; gap: 6px; }
}

/* --------------------------------------------------------------------
   Certifications — reuses .timeline/.timeline-item; this is the only
   bit specific to it: the optional "View credential" inline link.
   -------------------------------------------------------------------- */

.timeline-link {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--amber);
  margin-left: 10px;
  white-space: nowrap;
}
.timeline-link:hover { text-decoration: underline; }


/* --------------------------------------------------------------------
   Card grids — research & blog
   -------------------------------------------------------------------- */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.card {
  border: 1px solid var(--border);
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  flex-direction: column;
  transition: border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
  position: relative;
  overflow: visible;
  box-shadow: 0 4px 16px -10px rgba(22, 21, 31, 0.12);
}

.card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transform: rotate(-2.5deg) translateY(4px);
  z-index: -1;
  transition: transform 0.18s ease;
}

.card:hover::before { transform: rotate(-4deg) translateY(7px); }

.card:hover {
  border-color: var(--amber-line);
  transform: translateY(-3px);
  box-shadow: 0 12px 30px -18px rgba(22,21,31,0.18), 0 0 0 3px var(--amber-soft);
}

.card .card-date {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-faint);
  margin-bottom: 10px;
}

.card h3 {
  font-size: 1.15rem;
  margin-bottom: 10px;
}

.card p.excerpt {
  color: var(--text-muted);
  font-size: 14.5px;
  flex: 1;
  margin-bottom: 16px;
}

.card .card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}

.card .card-tags span {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--teal);
  background: var(--teal-soft);
  padding: 3px 8px;
  border-radius: 4px;
}


.card .card-arrow {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--amber);
  margin-top: auto;
}

/* --------------------------------------------------------------------
   List rows — blog index style
   -------------------------------------------------------------------- */

.post-list { display: flex; flex-direction: column; }

.post-row {
  display: grid;
  grid-template-columns: 120px 1fr auto;
  align-items: baseline;
  gap: 20px;
  padding: 20px 0;
  border-top: 1px solid var(--border-soft);
  transition: padding-left 0.15s ease;
}
.post-row:first-child { border-top: none; }
.post-row:hover { padding-left: 6px; }

.post-row .post-date {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text-faint);
}

.post-row h3 {
  font-size: 1.05rem;
  font-weight: 600;
}
.post-row:hover h3 { color: var(--amber); }

.post-row .post-arrow {
  font-family: var(--font-mono);
  color: var(--text-faint);
  font-size: 14px;
}

@media (max-width: 560px) {
  .post-row { grid-template-columns: 1fr; gap: 4px; }
}

/* --------------------------------------------------------------------
   Single post (research + blog)
   -------------------------------------------------------------------- */

.post-header { padding: 72px 0 40px; border-bottom: 1px solid var(--border-soft); }

.post-header .post-meta {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text-faint);
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.post-header h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); max-width: 22ch; }

.post-header .post-summary {
  margin-top: 18px;
  color: var(--text-muted);
  font-size: 1.05rem;
  max-width: 60ch;
}

.post-body {
  padding: 48px 0 80px;
  font-size: 17px;
  color: #000000;
  max-width: 72ch;
}

.post-body h2 {
  font-size: 1.4rem;
  margin: 2.2em 0 0.7em;
}
.post-body h3 {
  font-size: 1.15rem;
  margin: 1.8em 0 0.6em;
}
.post-body p { margin-bottom: 1.3em; }
.post-body ul, .post-body ol { margin-bottom: 1.3em; padding-left: 22px; }
.post-body li { margin-bottom: 0.5em; }
.post-body a { color: var(--amber); border-bottom: 1px solid var(--amber-line); }
.post-body a:hover { border-color: var(--amber); }

.post-body img {
  max-width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin: 1.5em 0;
}

.post-body blockquote {
  border-left: 2px solid var(--amber);
  margin: 1.6em 0;
  padding: 0.2em 0 0.2em 20px;
  color: var(--text-muted);
  font-style: italic;
}

.post-body code {
  font-family: var(--font-mono);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.9em;
}

.post-body pre {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  overflow-x: auto;
  margin-bottom: 1.5em;
}
.post-body pre code {
  background: none;
  border: none;
  padding: 0;
}

.post-body hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2.5em 0;
}

/* --------------------------------------------------------------------
   Essay body — research posts only.
   Modeled after colah.github.io: a narrow, calm reading column with
   figures/images allowed to bleed wider than the text for diagrams.
   -------------------------------------------------------------------- */

.essay-body {
  padding: 48px 0 80px;
  font-size: 18px;
  line-height: 1.75;
  color: #000000;
  max-width: 640px;
}

.essay-body h2 {
  font-size: 1.5rem;
  margin: 2.4em 0 0.8em;
  padding-bottom: 0.3em;
  border-bottom: 1px solid var(--border-soft);
}
.essay-body h3 {
  font-size: 1.2rem;
  margin: 1.9em 0 0.6em;
}
.essay-body p { margin-bottom: 1.4em; }
.essay-body ul, .essay-body ol { margin-bottom: 1.4em; padding-left: 22px; }
.essay-body li { margin-bottom: 0.5em; }
.essay-body a { color: var(--amber); border-bottom: 1px solid var(--amber-line); }
.essay-body a:hover { border-color: var(--amber); }

/* Figures bleed wider than the text column, colah-style */
.essay-body img {
  display: block;
  max-width: min(920px, 94vw);
  width: calc(100% + 100px);
  margin: 2em 0 0.6em;
  margin-left: 50%;
  transform: translateX(-50%);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: 0 0 30px -10px var(--teal-soft);
}

/* If an image is immediately followed by emphasis/italic text, treat it as a caption */
.essay-body img + em {
  display: block;
  text-align: center;
  font-size: 13.5px;
  color: var(--text-faint);
  margin: -0.2em 0 1.8em;
}

.essay-body blockquote {
  border-left: 2px solid var(--teal);
  margin: 1.8em 0;
  padding: 0.2em 0 0.2em 20px;
  color: var(--text-muted);
  font-style: italic;
}

.essay-body code {
  font-family: var(--font-mono);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.88em;
}

.essay-body pre {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  overflow-x: auto;
  margin-bottom: 1.6em;
  max-width: min(920px, 94vw);
  width: calc(100% + 100px);
  margin-left: 50%;
  transform: translateX(-50%);
}
.essay-body pre code { background: none; border: none; padding: 0; }

.essay-body hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2.6em 0;
}

@media (max-width: 760px) {
  .essay-body img, .essay-body pre {
    width: 100%;
    margin-left: 0;
    transform: none;
  }
}

.post-footer {
  padding: 32px 0 80px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--border-soft);
  flex-wrap: wrap;
  gap: 16px;
}

.tag-list { display: flex; gap: 8px; flex-wrap: wrap; }
.tag-list span {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--teal);
  background: var(--teal-soft);
  padding: 4px 10px;
  border-radius: 4px;
}


/* --------------------------------------------------------------------
   Contact / footer
   -------------------------------------------------------------------- */

.contact-links {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 24px;
}

.site-footer {
  border-top: 1px solid var(--border-soft);
  padding: 40px 0;
}

.site-footer .wrap {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.footer-note {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text-faint);
}

/* --------------------------------------------------------------------
   Scroll reveal
   -------------------------------------------------------------------- */

.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.reveal.in-view {
  opacity: 1;
  transform: translateY(0);
}

/* Empty states */
.empty-state {
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 40px 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14.5px;
}
.empty-state code {
  font-family: var(--font-mono);
  background: var(--bg-elevated);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--amber);
}
