/* ============================================================
   Home - warm beige, modern-academic redesign (v2)
   Self-contained: only index.html links this file.
   Fonts (Inter / IBM Plex Mono / Fraunces / Instrument Serif)
   are imported here so the page is independent of style.css.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Newsreader:opsz,wght@6..72,400;6..72,500;6..72,600;6..72,700&display=swap');

:root {
  /* Clean white academic canvas */
  --paper:        #ffffff;
  --paper-card:   #ffffff;
  --paper-sink:   #f5f5f6;
  --paper-glass:  rgba(255, 255, 255, 0.82);

  /* Neutral ink */
  --ink:        #18181b;
  --ink-soft:   #3f3f4633;  /* not used directly */
  --body:       #3f3f46;
  --muted:      #71717a;
  --faint:      #a1a1aa;

  /* Hairlines */
  --line:        rgba(0, 0, 0, 0.11);
  --line-soft:   rgba(0, 0, 0, 0.06);
  --line-strong: rgba(0, 0, 0, 0.18);

  /* Tasteful, muted colour (not 90s-vivid) */
  --clay:    #38618f;   /* primary accent - muted academic blue (research-lab) */
  --clay-deep:#284c72;
  --sage:    #4f7d6f;   /* secondary accent */
  --link:    #2f5d9e;   /* readable muted blue for links */
  --link-hover: #284c72;

  --shadow-soft: 0 1px 2px rgba(15,15,20,0.04), 0 6px 22px rgba(15,15,20,0.05);
  --shadow-lift: 0 2px 6px rgba(15,15,20,0.07), 0 14px 34px rgba(15,15,20,0.09);

  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --sans:  "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono:  "IBM Plex Mono", "Menlo", "Consolas", monospace;

  --wrap: 1180px;
}

* { box-sizing: border-box; }

/* No overscroll-behavior-y here: it kills the iOS rubber-band bounce on
   the home and blog pages. The dock sits on its own compositing layer,
   so the bounce doesn't jitter it. */
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  /* clip (not hidden): kills any stray horizontal pan on small phones
     without creating a scroll container, so the vertical rubber-band
     bounce stays intact. */
  overflow-x: clip;
  background: var(--paper);
  background-repeat: no-repeat;
  color: var(--body);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.65;
  padding-bottom: 96px;   /* clearance for the floating bottom dock */
  overflow-x: hidden;     /* no horizontal scroll on mobile */
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, svg { max-width: 100%; }
a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); }

::selection { background: rgba(56, 97, 143, 0.16); }

/* Keyboard accessibility: a visible focus ring on every interactive element,
   and a skip-to-content link that appears only when focused. */
:focus-visible {
  outline: 2px solid var(--clay);
  outline-offset: 2px;
  border-radius: 4px;
}
.skip-link {
  position: absolute; left: 12px; top: -48px; z-index: 99999;
  padding: 10px 16px; border-radius: 10px;
  background: var(--ink); color: #fff;
  font-family: var(--mono); font-size: 0.8rem;
  transition: top 0.18s ease;
}
.skip-link:focus { top: 12px; color: #fff; }

/* ---- layout container ------------------------------------- */
.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: clamp(20px, 5vw, 64px); }

/* ============================================================
   Top navigation - no name, centered section links
   ============================================================ */
.topbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  display: flex; justify-content: center;
  padding: 0 16px;
  padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  background: transparent;
  pointer-events: none;   /* clicks pass through the empty gutter; pill re-enables */
  transform: translateZ(0);   /* own compositing layer, stops overscroll jitter */
  will-change: transform;
  backface-visibility: hidden;
}
.topnav {
  pointer-events: auto;
  display: inline-flex; align-items: center; justify-content: center;
  gap: clamp(14px, 3vw, 36px);
  padding: 9px clamp(18px, 3vw, 28px);
  border-radius: 999px;
  flex-wrap: wrap;
  /* liquid glass */
  background: linear-gradient(180deg, rgba(255,253,247,0.74) 0%, rgba(244,239,226,0.52) 100%);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border: 1px solid rgba(255,255,255,0.55);
  box-shadow:
    0 10px 34px rgba(15,15,20,0.12),
    0 2px 8px rgba(15,15,20,0.07),
    inset 0 1px 0 rgba(255,255,255,0.75),
    inset 0 -1px 0 rgba(15,15,20,0.04);
}
.topnav a {
  font-family: var(--mono);
  font-size: 0.73rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 7px 13px;
  border-radius: 999px;
  white-space: nowrap;
  transition: color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}
.topnav a:hover { color: var(--ink); background: rgba(0,0,0,0.05); }
.topnav a.is-active {
  color: #fbfdff;
  background: var(--clay);
  box-shadow: 0 1px 3px rgba(0,0,0,0.18);
}

/* ============================================================
   Hero
   ============================================================ */
.hero { padding: clamp(30px, 4vw, 56px) 0 clamp(22px, 3vw, 36px); }
.hero-inner {
  display: flex; align-items: center; justify-content: space-between; gap: clamp(30px, 5vw, 64px);
  width: 100%;
}
.hero-text { flex: 0 1 580px; max-width: 580px; min-width: 0; }

/* Hero entrance - each block fades up in sequence on load. */
@keyframes hero-rise {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: none; }
}
.hero-text > *, .hero-portrait {
  animation: hero-rise 0.7s cubic-bezier(0.22, 0.61, 0.36, 1) both;
}
.hero h1            { animation-delay: 0.05s; }
.hero .subtitle     { animation-delay: 0.13s; }
.hero .bio          { animation-delay: 0.21s; }
.hero .links        { animation-delay: 0.29s; }
.hero-portrait      { animation-delay: 0.12s; }
@media (prefers-reduced-motion: reduce) {
  .hero-text > *, .hero-portrait { animation: none; }
}
.hero h1 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(1.85rem, 3.8vw, 2.6rem);
  line-height: 1.05;
  letter-spacing: -0.015em;
  color: var(--ink);
  margin: 0 0 0.5rem;
}
.hero .subtitle {
  font-family: var(--mono);
  font-size: clamp(0.66rem, 1.1vw, 0.74rem);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--clay-deep);
  margin: 0 0 1rem;
}
.hero .bio {
  font-size: clamp(0.96rem, 1.25vw, 1.06rem);
  line-height: 1.62;
  color: var(--body);
  max-width: 38em;
  margin: 0 0 1.35rem;
}
.hero .bio strong { color: var(--ink); font-weight: 600; }
.hero .bio a { color: var(--ink); text-decoration: underline; text-decoration-color: rgba(56,97,143,0.45); text-underline-offset: 3px; }
.hero .bio a:hover { color: var(--clay-deep); }
.hero .bio .xbio { font-style: italic; color: var(--clay-deep); white-space: nowrap; }

.hero-portrait {
  flex: 0 0 auto;
  align-self: center;
  width: clamp(160px, 17vw, 208px);
  aspect-ratio: 4 / 5;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lift);
  background: var(--paper-sink);
  transition: transform 0.4s var(--ease-spring, cubic-bezier(0.22,0.61,0.36,1)), box-shadow 0.4s ease;
}
.hero-portrait:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 22px rgba(15,15,20,0.10), 0 22px 48px rgba(15,15,20,0.10);
}
.hero-portrait img {
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: 50% 16%;   /* frame the face, not the full seated shot */
  display: block;
}

/* social + pill links row */
.links { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 0.4rem; }
.icon-link {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 11px;
  color: var(--ink);
  border: 1px solid var(--line);
  background: var(--paper-card);
  transition: transform 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}
.icon-link svg { width: 20px; height: 20px; }
.icon-link:hover { transform: translateY(-2px); border-color: currentColor; box-shadow: var(--shadow-soft); }
/* brand colour per icon */
.icon-link.ic-mail    { color: #c2502f; }
.icon-link.ic-gh      { color: #1c2128; }
.icon-link.ic-li      { color: #0a66c2; }
.icon-link.ic-scholar { color: #3a7bf0; }
.icon-link.ic-orcid   { color: #8fb733; }
.icon-link.ic-x       { color: #18181b; }

.pill {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--mono); font-size: 0.78rem; letter-spacing: 0.02em;
  padding: 9px 15px; border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--paper-card);
  color: var(--ink);
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease, color 0.16s ease;
}
.pill svg { width: 14px; height: 14px; }
.pill:hover { transform: translateY(-2px); border-color: var(--clay); color: var(--clay-deep); }
.pill.primary {
  background: var(--clay); color: #fbf4e9; border-color: var(--clay);
}
.pill.primary:hover { background: var(--clay-deep); color: #fff; border-color: var(--clay-deep); }

/* ============================================================
   Section heading - numbered serif, with rule
   ============================================================ */
section.block { padding: clamp(38px, 6vw, 60px) 0 6px; }
.sec-head {
  display: flex; align-items: baseline; gap: 16px;
  padding-bottom: 16px; margin-bottom: 4px;
  border-bottom: 1px solid var(--line);
}
.sec-num {
  font-family: var(--mono); font-size: 0.92rem; font-weight: 500;
  color: var(--clay); letter-spacing: 0.04em;
}
.sec-head h2 {
  font-family: var(--serif); font-weight: 600;
  font-size: clamp(1.7rem, 3.6vw, 2.5rem);
  line-height: 1.05; letter-spacing: -0.01em;
  color: var(--ink); margin: 0;
}

/* ============================================================
   Entry rows - date left, content right, logos kept
   ============================================================ */
.entries { display: flex; flex-direction: column; gap: 0; margin-top: 8px; }
.entry {
  position: relative;
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: clamp(16px, 3vw, 38px);
  align-items: start;
  padding: 26px 16px;
  margin: 0 -16px;
  border-top: 1px solid var(--line);
  border-radius: 12px;
  transition: background 0.2s ease;
}
.entry:first-child { border-top: none; }
.entry.is-clickable { cursor: pointer; }
/* left accent bar grows in on hover - the only "card" cue, and only while pointed at */
.entry.is-clickable::before {
  content: ""; position: absolute; left: 2px; top: 14px; bottom: 14px; width: 2px;
  background: var(--clay); border-radius: 2px;
  opacity: 0; transform: scaleY(0.35); transform-origin: center;
  transition: opacity 0.22s ease, transform 0.22s ease;
}
.entry.is-clickable:hover { background: rgba(56,97,143,0.035); }
.entry.is-clickable:hover::before { opacity: 1; transform: scaleY(1); }

/* Scroll reveal - entries + content cards fade up as they enter view.
   Gated on html.js-reveal (added by JS) so content is always visible when
   JS is off or fails; JS adds .in to each element as it scrolls in. */
.js-reveal .entry, .js-reveal .card {
  opacity: 0; transform: translateY(14px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.js-reveal .entry.in, .js-reveal .card.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .js-reveal .entry, .js-reveal .card { opacity: 1; transform: none; transition: none; }
}
.entry-date {
  font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--faint); line-height: 1.5; padding-top: 3px;
}
.entry-body { display: flex; gap: 16px; min-width: 0; }

.entry-logo {
  flex: 0 0 auto;
  width: 54px; height: 54px; border-radius: 13px;
  background: #fff; border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; box-shadow: var(--shadow-soft);
}
.entry-logo img { width: 100%; height: 100%; object-fit: contain; padding: 5px; }
.entry-logo.cover img { padding: 0; object-fit: cover; }
.entry-logo .mono-mark {
  font-family: var(--mono); font-weight: 600; font-size: 0.95rem; color: var(--clay-deep);
}
.entry-logo .serif-mark {
  font-family: var(--serif); font-weight: 700; font-size: 1.05rem; color: var(--ink); letter-spacing: -0.5px;
}
.entry-logo.icon { background: var(--paper-card); }
.entry-logo.icon img { padding: 12px; }

.entry-text { min-width: 0; }
.entry-title {
  font-family: var(--serif); font-weight: 600;
  font-size: 1.22rem; line-height: 1.25; color: var(--ink);
  margin: 0 0 6px;
}
.entry-title a { color: var(--ink); }
.entry-title a:hover { color: var(--clay-deep); }
.entry-text p { margin: 0 0 10px; color: var(--body); font-size: 0.97rem; line-height: 1.6; }
.entry-text p a { color: var(--link); text-decoration: underline; text-underline-offset: 2px; }
.entry-text p a:hover { color: var(--clay-deep); }

/* ============================================================
   Tags - muted, modern category chips
   ============================================================ */
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.tag {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--sans); font-size: 0.74rem; font-weight: 500;
  letter-spacing: 0.005em; line-height: 1;
  padding: 4px 10px 4px 9px; border-radius: 999px;
  background: rgba(0,0,0,0.05); color: var(--body);
  border: 1px solid transparent;
  white-space: nowrap;
  transition: background 0.16s ease, color 0.16s ease;
}
/* tiny category dot - the colour cue, instead of a loud filled chip */
.tag::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: currentColor; opacity: 0.85; flex: 0 0 auto;
}
.tag.title-tag { vertical-align: middle; margin-left: 8px; }
.tag.research    { color: #2c5188; }
.tag.systems     { color: #4a5663; }
.tag.agent       { color: #9a4a12; }
.tag.design      { color: #a8512c; }
.tag.medical     { color: #a93b3b; }
.tag.vision      { color: #5e39ab; }
.tag.perception  { color: #3a6256; }
.tag.pytorch     { color: #b0432a; }
.tag.cuda        { color: #557a1f; }
.tag.python      { color: #345f93; }

/* ============================================================
   Skills
   ============================================================ */
.skills-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 28px 36px; margin-top: 26px;
}
.skill-group {
  background: none; border: none;
  border-radius: 0; padding: 0; box-shadow: none;
}
.skill-group-title {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--clay-deep); margin: 0 0 14px;
}
.skill-group-title::before {
  content: ""; width: 14px; height: 1.5px; background: var(--clay); border-radius: 2px; opacity: 0.7;
}
.skill-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.skill-pill {
  font-family: var(--sans); font-size: 0.78rem; font-weight: 500; line-height: 1;
  padding: 6px 11px; border-radius: 8px;
  background: transparent; border: 1px solid var(--line);
  color: var(--body); transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.skill-pill:hover { background: rgba(56,97,143,0.08); border-color: rgba(56,97,143,0.40); color: var(--clay-deep); }
.skill-pill.highlight-pill { background: rgba(94,145,30,0.09); border-color: rgba(94,145,30,0.35); color: #557a1f; }

/* ============================================================
   Cards - certifications + writing
   ============================================================ */
.card-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr));
  gap: 22px 36px; margin-top: 24px;
}
.card {
  display: block; background: none;
  border: none; border-top: 1px solid var(--line); border-radius: 0;
  padding: 18px 0 4px; box-shadow: none;
  transition: opacity 0.16s ease;
}
.card:hover { transform: none; }
.card:hover .card-title { color: var(--clay-deep); }
.card-title {
  display: block; font-family: var(--serif); font-weight: 600;
  font-size: 1.1rem; line-height: 1.3; color: var(--ink); margin-bottom: 7px;
  transition: color 0.16s ease;
}
.card-meta {
  font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.03em;
  color: var(--clay-deep); margin-bottom: 9px;
}
.card-excerpt { font-size: 0.92rem; line-height: 1.55; color: var(--body); margin: 0; }

.section-cta { display: flex; justify-content: center; margin-top: 30px; }

/* ============================================================
   Contact
   ============================================================ */
.contact-wrap {
  display: grid; grid-template-columns: 0.85fr 1.15fr; gap: clamp(28px, 5vw, 56px);
  margin-top: 28px; align-items: start;
}
.contact-intro p { font-size: 1.05rem; color: var(--body); margin: 0 0 22px; }
.contact-meta { display: flex; flex-direction: column; gap: 12px; }
.contact-item {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--mono); font-size: 0.85rem; color: var(--ink);
}
.contact-item svg { width: 18px; height: 18px; fill: var(--clay-deep); }
.contact-item:hover { color: var(--clay-deep); }
.contact-social-row { display: flex; gap: 22px; }

.contact-form { display: flex; flex-direction: column; gap: 14px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.modern-input, .modern-textarea {
  width: 100%; font-family: var(--sans); font-size: 0.95rem;
  padding: 13px 15px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--paper-card); color: var(--ink);
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}
.modern-input:focus, .modern-textarea:focus {
  outline: none; border-color: var(--clay);
  box-shadow: 0 0 0 3px rgba(56,97,143,0.14);
}
.modern-textarea { min-height: 150px; resize: vertical; }
.form-actions { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.submit-btn {
  display: inline-flex; align-items: center; gap: 9px;
  font-family: var(--mono); font-size: 0.85rem;
  padding: 11px 20px; border-radius: 12px; cursor: pointer;
  background: var(--clay); color: #fbf4e9; border: 1px solid var(--clay);
  transition: background 0.16s ease, transform 0.16s ease;
}
.submit-btn:hover { background: var(--clay-deep); transform: translateY(-2px); }
.submit-btn:disabled { opacity: 0.6; cursor: default; transform: none; }

/* ============================================================
   Footer
   ============================================================ */
footer {
  margin-top: 64px; padding: 30px 0 50px;
  border-top: 1px solid var(--line);
  text-align: center;
  font-family: var(--mono); font-size: 0.76rem; color: var(--faint);
}

/* ============================================================
   Reveal animation
   ============================================================ */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity 0.6s ease, transform 0.6s ease; }
.reveal.active { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 860px) {
  .hero-inner { flex-direction: column-reverse; align-items: flex-start; gap: 22px; width: auto; padding: 24px 22px; }
  .hero-portrait { width: 150px; }
  .contact-wrap { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  .wrap { padding-inline: clamp(16px, 5vw, 26px); }
  .entry { grid-template-columns: 1fr; padding: 18px 18px; gap: 12px; }
  .form-row { grid-template-columns: 1fr; }
  .hero { padding-top: 24px; }
  section.block { padding-top: clamp(26px, 6vw, 40px); }
  .sec-head { gap: 12px; }
  .card-grid { gap: 14px; }
  .skills-grid { gap: 14px; }
}

/* Dock stays on one line on phones */
@media (max-width: 560px) {
  .topbar { padding-left: 10px; padding-right: 10px; }
  .topnav { gap: 1px; padding: 6px 8px; }
  .topnav a { font-size: 0.62rem; letter-spacing: 0.05em; padding: 6px 10px; }
}

@media (max-width: 480px) {
  .hero-portrait { width: 118px; }
  .entry-body { gap: 13px; }
  .entry-logo { width: 46px; height: 46px; }
  .hero h1 { font-size: clamp(1.8rem, 8vw, 2.4rem); }
}

@media (max-width: 380px) {
  .topnav a { font-size: 0.57rem; padding: 5px 8px; letter-spacing: 0.03em; }
}
