/* =============================================
   Roger D. Newman-Norlund — Dark Tech Theme
   ============================================= */

/* --- Design tokens --- */
:root {
  --bg:        #0a0e17;
  --bg-card:   #111827;
  --bg-card-h: #1a2332;
  --text:      #e2e8f0;
  --text-dim:  #94a3b8;
  --muted:     #64748b;
  --border:    #1e293b;
  --accent:    #06d6a0;
  --accent-h:  #00f0b5;
  --accent-bg: rgba(6,214,160,0.08);
  --accent2:   #7c3aed;
  --accent2-bg:rgba(124,58,237,0.10);
  --cyan:      #22d3ee;
  --radius:    8px;
  --max-w:     1280px;
  --gap:       2.5rem;
  --mono:      'JetBrains Mono', 'Fira Code', 'SF Mono', 'Cascadia Code', monospace;
  --sans:      'Inter', system-ui, -apple-system, sans-serif;
}

/* --- Reset & base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

/* Subtle grid background */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(6,214,160,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(6,214,160,0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  z-index: 0;
}

a { color: var(--accent); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--accent-h); text-decoration: underline; }

h1, h2, h3 { line-height: 1.25; font-weight: 700; }

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

/* --- Layout --- */
nav, main, footer {
  max-width: var(--max-w);
  margin-inline: auto;
  padding-inline: 2rem;
  position: relative;
  z-index: 1;
}
@media (max-width: 768px) {
  nav, main, footer { padding-inline: 1rem; }
}

/* --- Navigation --- */
nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-block: 1rem;
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10,14,23,0.85);
}

.nav-name {
  font-family: var(--mono);
  font-weight: 700;
  color: var(--accent);
  font-size: 0.9rem;
  letter-spacing: -0.01em;
}
.nav-name::before { content: '> '; opacity: 0.5; }
.nav-name:hover { color: var(--accent-h); text-decoration: none; }

nav ul { list-style: none; display: flex; flex-wrap: wrap; gap: 0.2rem 0.75rem; }

nav ul a {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 500;
  padding: 0.25rem 0;
  transition: color 0.2s;
}
nav ul a:hover { color: var(--accent); text-decoration: none; }

nav ul a[href="#working"] { color: var(--cyan); font-weight: 600; }
nav ul a[href="#blog"] { color: var(--accent2); font-weight: 600; }

/* Active nav indicator */
nav ul a.active { color: var(--accent) !important; }

/* --- Sections --- */
section {
  padding-block: var(--gap);
  border-bottom: 1px solid var(--border);
}
section:last-of-type { border-bottom: none; }

section h2 {
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
section h2::before {
  content: '//';
  color: var(--muted);
  opacity: 0.5;
}

/* --- Hero --- */
#hero { padding-block: 3.5rem 2.5rem; border-bottom: 1px solid var(--border); }

.hero-layout {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2.5rem;
}
.hero-text { flex: 1; }

.hero-eyebrow {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--accent);
  margin-bottom: 0.5rem;
  opacity: 0.8;
}

#hero h1 {
  font-size: clamp(1.8rem, 5vw, 2.5rem);
  letter-spacing: -0.03em;
  margin-bottom: 0.5rem;
  color: #fff;
}

.tagline {
  font-size: 1rem;
  color: var(--text-dim);
}

.hero-sub {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.2rem;
}

.hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.25rem;
}

.badge {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 500;
  padding: 0.3rem 0.75rem;
  background: var(--accent-bg);
  color: var(--accent);
  border: 1px solid rgba(6,214,160,0.2);
  border-radius: 4px;
  transition: border-color 0.2s, background 0.2s;
}
.badge:hover {
  border-color: var(--accent);
  background: rgba(6,214,160,0.15);
}

.hero-photo-wrap { flex-shrink: 0; }

.hero-photo {
  width: 170px;
  height: 170px;
  object-fit: cover;
  border-radius: 50%;
  border: 3px solid var(--border);
  outline: 2px solid rgba(6,214,160,0.3);
  outline-offset: 3px;
  display: block;
  filter: grayscale(10%);
  transition: outline-color 0.3s, filter 0.3s;
}
.hero-photo:hover {
  outline-color: var(--accent);
  filter: grayscale(0%);
}

/* --- About --- */
.about-layout {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
}
.about-text { flex: 1; }
.about-text p + p { margin-top: 0.75rem; }
.about-text p { color: var(--text-dim); }

/* --- Stats row --- */
.stats-row {
  display: flex;
  gap: 1.5rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  flex: 1;
  min-width: 140px;
  transition: border-color 0.2s;
}
.stat-card:hover { border-color: var(--accent); }

.stat-num {
  font-family: var(--mono);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--accent);
  display: block;
}
.stat-label {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 0.1rem;
}

/* --- Research tags --- */
.tag-list { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.tag {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 500;
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--muted);
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}
.tag:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-bg);
}

/* --- Timeline --- */
.timeline { list-style: none; }

.timeline li {
  position: relative;
  padding-left: 1.5rem;
  padding-bottom: 1.25rem;
  border-left: 2px solid var(--border);
}
.timeline li:last-child { padding-bottom: 0; }

.timeline li::before {
  content: '';
  position: absolute;
  left: -5px;
  top: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg);
}

.tl-date {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--accent);
  font-weight: 600;
}
.tl-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  margin-top: 0.1rem;
}
.tl-sub {
  font-size: 0.82rem;
  color: var(--muted);
}

/* --- Projects grid --- */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}
.card:hover {
  border-color: rgba(6,214,160,0.4);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

.card-icon { font-size: 1.4rem; line-height: 1; margin-bottom: 0.2rem; }
.card h3 { font-size: 0.95rem; font-weight: 600; color: #fff; }

.card-desc {
  font-size: 0.85rem;
  color: var(--muted);
  flex: 1;
  line-height: 1.6;
}

.card-links {
  display: flex;
  gap: 1rem;
  margin-top: 0.6rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 600;
}

/* --- Publications --- */
.muted { color: var(--muted); }

.pub-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.pub-list li {
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
  padding: 0.75rem;
  border-radius: var(--radius);
  transition: background 0.2s;
}
.pub-list li:hover { background: var(--bg-card); }

.pub-year {
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent);
  min-width: 3.4rem;              /* keeps '2026' aligned across years */
  padding: 0.28rem 0.55rem;       /* pill padding so background chips fit */
  white-space: nowrap;            /* IN PREP / SUB stay on one line */
  flex-shrink: 0;                 /* don't let the flex row shrink the chip */
  border-radius: 4px;
  text-align: center;
  align-self: flex-start;
  box-sizing: border-box;
}
.pub-title {
  font-size: 0.88rem;
  font-weight: 500;
  line-height: 1.45;
  color: var(--text-dim);
}
.pub-venue {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.15rem;
}

/* --- Teaching --- */
.teach-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.75rem;
}

.teach-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.8rem 1rem;
  transition: border-color 0.2s;
}
.teach-item:hover { border-color: rgba(6,214,160,0.3); }

.teach-code {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--accent);
  font-weight: 600;
}
.teach-name {
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-top: 0.1rem;
}
.teach-years {
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--muted);
}

/* --- Contact --- */
.contact-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}
.contact-list li {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
}
.contact-label {
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
  min-width: 90px;
}

/* --- Blog --- */
.blog-toolbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.blog-new-btn {
  font-family: var(--mono);
  background: var(--accent2);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 0.45rem 1rem;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}
.blog-new-btn:hover { background: #6d28d9; }

/* ── Blog: wider, more editorial layout ─────────────────────────── */
/* When blog.html adds `class="blog-page"` to body, the page main widens
   to accommodate the essay column and floated images. Nav/footer stay
   in the standard site width. */
/* Blog page inherits the site-wide 1280px width; no override needed. */

/* ── Blog: cool editorial sticky header ────────────────────────── */
/* Sits below the site nav (which is already sticky at top:0) and
   pins the "Blog" wordmark + reader controls to the top of the
   viewport as you scroll. */
body.blog-page section.page-section > h2:first-of-type,
body.blog-page section.page-section > p.page-intro { display: none; } /* replaced by .blog-header */

.blog-header {
  position: sticky;
  top: 58px;            /* below the ~58px nav bar */
  z-index: 50;
  margin: 0 -2rem 2rem;
  padding: 1.6rem 2rem 0;
  background: rgba(10,14,23,0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
@media (max-width: 768px) {
  .blog-header { margin: 0 -1rem 1.5rem; padding: 1.1rem 1rem 0; top: 52px; }
}
.blog-header-inner {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 2rem;
  flex-wrap: wrap;
}
.blog-header-title { min-width: 0; }
.blog-header-eyebrow {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.45rem;
  display: flex; align-items: center; gap: 0.5rem;
}
.blog-header-eyebrow::before {
  content: '//';
  color: var(--muted);
  opacity: 0.6;
}
.blog-header-h {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: clamp(2rem, 6vw, 3.6rem);
  font-weight: 900;
  line-height: 1.25;              /* room for the g/p/y descenders */
  margin: 0;
  padding-bottom: 0.35rem;
  letter-spacing: -0.03em;
  background: linear-gradient(90deg, #06d6a0 0%, #22d3ee 50%, #7c3aed 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.blog-header-sub {
  color: var(--text-dim);
  font-size: 0.95rem;
  margin: 0.55rem 0 1.15rem;
  max-width: 62ch;
}
.blog-header-tools {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding-bottom: 1.15rem;
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
/* triple-color accent stripe at the very bottom of the header block.
   The top margin (not bottom) is what creates space between the
   wordmark descenders and the stripe. */
.blog-header-stripe {
  height: 3px;
  margin: 3.5rem -2rem 0;
  background: linear-gradient(90deg, #06d6a0 0%, #22d3ee 50%, #7c3aed 100%);
  border-radius: 2px;
  opacity: 0.85;
}
@media (max-width: 768px) {
  .blog-header-stripe { margin: 2.5rem -1rem 0; }
  .blog-header-tools { padding-bottom: 0.9rem; }
}

.blog-posts { display: flex; flex-direction: column; gap: 2rem; }

.blog-post {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid transparent;
  border-radius: 10px;
  padding: 2.25rem 2.5rem;
  transition: border-color 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease;
  position: relative;
}
.blog-post:hover {
  border-color: var(--border);
  border-left-color: var(--accent2);
  box-shadow: 0 8px 24px -12px rgba(124,58,237,0.28);
}
@media (max-width: 768px) {
  .blog-post { padding: 1.5rem 1.25rem; border-radius: 8px; }
}

.blog-post-date {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--accent2);
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  background: var(--accent2-bg);
  display: inline-block;
  padding: 0.28rem 0.7rem;
  border-radius: 999px;
  border: 1px solid rgba(124,58,237,0.28);
}
.blog-post-title {
  font-size: 1.65rem;
  font-weight: 800;
  color: #fff;
  margin: 0.65rem 0 1rem;
  line-height: 1.25;
  letter-spacing: -0.015em;
}
@media (max-width: 768px) {
  .blog-post-title { font-size: 1.3rem; }
}
.blog-post-body {
  font-size: 1.06rem;
  color: #f1f5fb;              /* near-white for maximum contrast on the dark card */
  line-height: 1.75;
}
.blog-post-body > * { max-width: 100%; }
/* Reader text-size selector: scales html root font-size in the
   inline blog.html script, which cascades to nav / header / footer /
   body / everything using rem units. These per-size rules keep
   the body prose comfortable at every scale. */
body.blog-text-sm .blog-post-body { line-height: 1.7; }
body.blog-text-md .blog-post-body { line-height: 1.75; }
body.blog-text-lg .blog-post-body { line-height: 1.8; }
body.blog-text-xl .blog-post-body { line-height: 1.85; }

/* High-contrast tweaks for body prose inside blog posts */
.blog-post-body p,
.blog-post-body li { color: #f1f5fb; }
.blog-post-body strong { color: #ffffff; }
.blog-post-body em { color: #ffffff; }
.blog-post-body h4 { color: var(--accent-h); }        /* brighter mint */
.blog-post-body a { color: var(--accent-h); }
.blog-post-body a:hover { color: #ffffff; }
.blog-post-body code { color: var(--accent-h); background: rgba(6,214,160,0.14); }

/* Text-size selector chrome (lives inside the site nav on the blog page
   AND inside .blog-header-tools). Size and paddings compact for nav fit. */
.blog-size-btns {
  display: inline-flex;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px;
}
.blog-size-btns button {
  font-family: var(--mono);
  background: transparent;
  color: var(--text-dim);
  border: 0;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  transition: background 0.2s, color 0.2s;
  line-height: 1;
}
.blog-size-btns button:hover { color: #ffffff; }
.blog-size-btns button.active {
  background: var(--accent2);
  color: #ffffff;
}
/* In-nav size selector wrapper. Present on every page via text-size.js. */
.nav-size {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--text-dim);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-left: 0.75rem;
}
@media (max-width: 640px) {
  .nav-size .label { display: none; }
  .nav-size { margin-left: 0.35rem; }
}
.blog-post-body p {
  margin: 0.7rem 0;
}
.blog-post-body p:first-child { margin-top: 0; }
.blog-post-body p:last-child { margin-bottom: 0; }
.blog-post-body ul, .blog-post-body ol {
  margin: 0.6rem 0 0.6rem 1.5rem;
}
.blog-post-body ul { list-style: disc; }
.blog-post-body ol { list-style: decimal; }
.blog-post-body li {
  margin-bottom: 0.35rem;
  line-height: 1.65;
}
.blog-post-body blockquote {
  margin: 1rem 0;
  padding: 0.5rem 1.15rem;
  border-left: 3px solid var(--accent);
  color: var(--text);
  font-style: italic;
}
.blog-post-body pre {
  background: #0f1320;
  border: 1px solid var(--border);
  padding: 0.85rem 1rem;
  border-radius: 6px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.82rem;
  overflow-x: auto;
  margin: 0.9rem 0;
}
.blog-post-body code {
  font-family: var(--mono);
  font-size: 0.86rem;
  background: rgba(6,214,160,0.09);
  padding: 0.12rem 0.4rem;
  border-radius: 3px;
  color: var(--accent);
}
.blog-post-body pre code { background: transparent; padding: 0; color: inherit; font-size: inherit; }
.blog-post-body strong { color: var(--text); font-weight: 700; }
.blog-post-body a { text-decoration: underline; text-underline-offset: 2px; }
.blog-post-body h4 {
  font-family: var(--mono);
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--accent);
  margin: 1.6rem 0 0.5rem;
  letter-spacing: 0.02em;
  clear: both;
  text-transform: none;
}
.blog-post-body h4:first-child { margin-top: 0; }

/* Images: default floated at ~40% up to 480px, always shrink to fit.
   For portrait/tall images, posts can override with an inline style. */
.blog-img {
  float: left;
  max-width: min(40%, 480px);
  height: auto;
  border-radius: 8px;
  border: 1px solid var(--border);
  margin: 0.25rem 1.25rem 0.75rem 0;
}
.blog-post-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.75rem;
}
.blog-post-actions button {
  font-family: var(--mono);
  font-size: 0.72rem;
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}
.blog-post-actions button:hover { border-color: var(--accent2); color: var(--accent2); }
.blog-post-actions button.blog-del:hover { border-color: #ef4444; color: #ef4444; }

/* Full-width figures (e.g. inline paper figures, iframes) fall inside
   the body's max reading width by default but can be broken out with
   .blog-figure-wide (span the whole card, useful for videos/charts). */
.blog-post-body .blog-figure-wide,
.blog-post-body iframe.blog-figure-wide,
.blog-post-body video.blog-figure-wide,
.blog-post-body img.blog-figure-wide {
  max-width: 100%;
  width: 100%;
  float: none;
  display: block;
  margin: 1rem auto;
  clear: both;
}

/* Videos in blog posts */
.blog-post-body video {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  border: 1px solid var(--border);
}
/* Iframes (embedded demos) */
.blog-post-body iframe {
  max-width: 100%;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #0b0e14;
}

/* Blog editor modal */
.blog-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}
.blog-modal-overlay.hidden { display: none; }

.blog-modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  overflow-y: auto;
}
.blog-modal h3 {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--accent2);
  margin-bottom: 1rem;
}

.blog-modal input,
.blog-modal textarea {
  width: 100%;
  font-family: var(--sans);
  font-size: 0.9rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.6rem 0.8rem;
  outline: none;
  transition: border-color 0.2s;
  margin-bottom: 0.75rem;
}
.blog-modal input:focus,
.blog-modal textarea:focus { border-color: var(--accent2); }

.blog-modal textarea {
  min-height: 180px;
  resize: vertical;
  line-height: 1.7;
}

.blog-modal-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  margin-top: 0.5rem;
}
.blog-modal-actions button {
  font-family: var(--mono);
  font-size: 0.8rem;
  padding: 0.45rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  border: none;
  transition: background 0.2s;
}
.blog-save-btn { background: var(--accent2); color: #fff; }
.blog-save-btn:hover { background: #6d28d9; }
.blog-cancel-btn { background: transparent; color: var(--muted); border: 1px solid var(--border) !important; }
.blog-cancel-btn:hover { border-color: var(--muted) !important; color: var(--text); }

.blog-empty {
  color: var(--muted);
  font-size: 0.9rem;
  font-family: var(--mono);
  padding: 2rem 0;
  text-align: center;
}

/* (tab mode removed — now multi-page) */

/* --- Working / Project Board --- */
.wb-workload {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
}
.wb-wl-heading {
  font-family: var(--mono);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.8rem;
}
.wb-wl-bars { display: flex; flex-direction: column; gap: 0.45rem; }
.wb-wl-row {
  display: grid;
  grid-template-columns: 130px 1fr 28px;
  align-items: center;
  gap: 0.6rem;
}
.wb-wl-label { display: flex; align-items: center; gap: 0.4rem; }
.wb-wl-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 0.6rem;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
}
.wb-wl-name { font-size: 0.8rem; font-weight: 500; color: var(--text-dim); }
.wb-wl-track {
  background: var(--border);
  border-radius: 999px;
  height: 6px;
  overflow: hidden;
}
.wb-wl-bar {
  height: 100%;
  border-radius: 999px;
  transition: width 0.4s ease;
  min-width: 3px;
}
.wb-wl-count {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  text-align: right;
}

.wb-toolbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.1rem;
}
.wb-add-btn {
  font-family: var(--mono);
  background: var(--cyan);
  color: var(--bg);
  border: none;
  border-radius: 6px;
  padding: 0.45rem 1rem;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
}
.wb-add-btn:hover { background: #06b6d4; }

.wb-sync-btn {
  font-family: var(--mono);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.4rem 0.7rem;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--muted);
  transition: border-color 0.15s, color 0.15s;
}
.wb-sync-btn:hover { border-color: var(--cyan); color: var(--cyan); }

.wb-status { font-family: var(--mono); font-size: 0.75rem; font-weight: 500; color: var(--muted); }
.wb-status.wb-s-ok   { color: var(--accent); }
.wb-status.wb-s-err  { color: #ef4444; }
.wb-status.wb-s-warn { color: #f59e0b; }

.wb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 0.85rem;
}
.wb-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  background: var(--bg-card);
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.wb-card:hover {
  border-color: rgba(34,211,238,0.3);
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}
.wb-card-header { display: flex; align-items: center; gap: 0.5rem; }

.wb-title-input {
  flex: 1;
  font-family: var(--sans);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  background: transparent;
  border: none;
  border-bottom: 1.5px solid transparent;
  outline: none;
  padding: 0 0 1px;
  min-width: 0;
  transition: border-color 0.15s;
}
.wb-title-input::placeholder { color: #334155; font-weight: 400; }
.wb-title-input:focus { border-bottom-color: var(--cyan); }

.wb-del {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.15rem;
  color: #475569;
  padding: 0;
  line-height: 1;
  flex-shrink: 0;
  transition: color 0.15s;
}
.wb-del:hover { color: #ef4444; }

.wb-chips { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.wb-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 30px;
  padding: 0 6px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: var(--bg);
  color: #475569;
  font-family: var(--sans);
  font-size: 0.7rem;
  font-weight: 800;
  cursor: pointer;
  transition: border-color 0.12s, color 0.12s, background 0.12s;
  letter-spacing: 0.02em;
}
.wb-chip:hover { border-color: #64748b; color: var(--text); }
.wb-chip.on { box-shadow: 0 1px 6px rgba(0,0,0,0.3); }
.wb-empty { color: var(--muted); font-size: 0.9rem; padding: 0.5rem 0; }

/* --- Footer --- */
footer {
  padding-block: 1.5rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
  text-align: center;
}

/* --- Page section (multi-page layout) --- */
.page-section {
  padding-block: var(--gap);
}
.page-section h2 { margin-bottom: 1.5rem; }

.page-intro {
  color: var(--text-dim);
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
  line-height: 1.7;
}

.sub-heading {
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--cyan);
  margin-top: 2rem;
  margin-bottom: 1rem;
}

/* Hero CTA buttons */
.hero-cta {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.btn-primary {
  font-family: var(--mono);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.55rem 1.25rem;
  background: var(--accent);
  color: var(--bg);
  border-radius: 6px;
  transition: background 0.2s;
}
.btn-primary:hover { background: var(--accent-h); text-decoration: none; color: var(--bg); }

.btn-secondary {
  font-family: var(--mono);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.55rem 1.25rem;
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 6px;
  transition: border-color 0.2s, color 0.2s;
}
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }

/* Active nav link */
nav ul a.active { color: var(--accent) !important; }
.nav-blog { color: var(--accent2) !important; }
.nav-working { color: var(--cyan) !important; }

/* About page photo */
.about-photo-wrap { flex-shrink: 0; }

/* ── Projects timeline ─────────────────────────────────────── */
.project-timeline {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.25rem;
  position: relative;
  padding-top: 1rem;
}
/* horizontal connecting line running through the year badges */
.project-timeline::before {
  content: '';
  position: absolute;
  left: 0; right: 0; top: 0.9rem;
  height: 2px;
  background: linear-gradient(90deg, #06d6a0 0%, #22d3ee 50%, #7c3aed 100%);
  opacity: 0.35;
  border-radius: 2px;
  z-index: 0;
}
.tl-card {
  position: relative;
  z-index: 1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.1rem 1.2rem 1rem;
  transition: border-color 0.2s, transform 0.2s;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.tl-card:hover { border-color: rgba(6,214,160,0.4); transform: translateY(-2px); }
.tl-card.tl-featured {
  border-color: rgba(124,58,237,0.55);
  box-shadow: 0 0 0 1px rgba(124,58,237,0.2), 0 8px 24px -12px rgba(124,58,237,0.4);
}
.tl-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: -1.85rem;   /* pull the year badge up onto the connecting line */
  margin-bottom: 0.35rem;
}
.tl-year {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--accent);
  background: var(--bg-card);
  padding: 0.28rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  white-space: nowrap;
}
.tl-featured .tl-year { color: var(--accent2); border-color: rgba(124,58,237,0.5); }
.tl-icon {
  font-size: 1.35rem;
  line-height: 1;
  padding: 0.2rem 0.35rem;
  background: var(--bg-card);
}
.tl-card h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin: 0.1rem 0 0.25rem;
  line-height: 1.3;
  display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap;
}
.tl-card p {
  font-size: 0.86rem;
  color: var(--text-dim);
  line-height: 1.5;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.tl-featured p {
  -webkit-line-clamp: 7;
}
.tl-links {
  margin-top: auto;
  padding-top: 0.5rem;
  font-family: var(--mono);
  font-size: 0.75rem;
}
.tl-tag {
  font-family: var(--mono);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent2);
  background: rgba(124,58,237,0.14);
  border: 1px solid rgba(124,58,237,0.35);
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
}
@media (max-width: 768px) {
  .project-timeline::before { display: none; }
  .tl-header { margin-top: 0; }
}

/* Contact grid */
.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
  align-items: start;
}
.contact-card { padding: 1.25rem 1.4rem; }
.contact-card h3 { margin-bottom: 0.6rem; }
.contact-card .card-desc,
.contact-card .contact-emails { line-height: 1.5; }
.contact-card a { overflow-wrap: anywhere; word-break: break-word; }
.contact-emails {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.contact-emails li { display: flex; flex-direction: column; gap: 0.05rem; }
.contact-emails .contact-label {
  font-family: var(--mono);
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--muted);
}
.contact-emails a { font-size: 0.9rem; }

/* Mentor highlights */
.mentor-highlights {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
  margin-top: 0.75rem;
}

/* Research themes (legacy grid) */
.research-themes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}

/* Research threads (narrative sections) */
.research-thread {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 1.75rem;
  margin-bottom: 1rem;
  transition: border-color 0.2s;
}
.research-thread:hover { border-color: rgba(6,214,160,0.3); }

.rt-header {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.rt-number {
  font-family: var(--mono);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--accent);
  opacity: 0.4;
  line-height: 1;
  flex-shrink: 0;
  min-width: 2rem;
}

.rt-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  margin: 0;
  line-height: 1.3;
}

.rt-era {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--muted);
  font-weight: 500;
}

.rt-body {
  padding-left: 3rem;
}

.rt-body p {
  font-size: 0.9rem;
  color: var(--text-dim);
  line-height: 1.7;
  margin-bottom: 0.6rem;
}
.rt-body p:last-child { margin-bottom: 0; }
.rt-body strong { color: var(--text); }
.rt-body em { color: var(--text-dim); }
.rt-body a { text-decoration: underline; }

@media (max-width: 640px) {
  .rt-body { padding-left: 0; margin-top: 0.5rem; }
  .rt-number { font-size: 1.2rem; }
}

/* Publication filters */
.pub-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1.5rem;
}

.pub-filter-btn {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.3rem 0.75rem;
  background: var(--bg-card);
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
  white-space: nowrap;   /* keep 'In prep / Submitted' on one line */
  flex: 0 0 auto;        /* don't shrink filter buttons */
}
.pub-filter-btn:hover { border-color: var(--accent); color: var(--accent); }
.pub-filter-btn.active {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}

/* --- Featured banners --- */
.featured-banner {
  background: var(--bg-card);
  border: 1px solid rgba(6,214,160,0.25);
  border-radius: var(--radius);
  padding: 2rem 2.25rem;
  margin-bottom: 1rem;
  position: relative;
  overflow: hidden;
  transition: border-color 0.3s;
}
.featured-banner::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--accent);
}
.featured-banner:hover { border-color: var(--accent); }

.featured-paper { border-color: rgba(124,58,237,0.25); }
.featured-paper::before { background: var(--accent2); }
.featured-paper:hover { border-color: var(--accent2); }

.featured-label {
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  display: block;
  margin-bottom: 0.5rem;
}
.featured-paper .featured-label { color: var(--accent2); }

.featured-title {
  font-size: 1.4rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 0.6rem;
}
.featured-title a { color: #fff; }
.featured-title a:hover { color: var(--accent); text-decoration: none; }

.featured-desc {
  font-size: 0.92rem;
  color: var(--text-dim);
  line-height: 1.7;
  margin-bottom: 1rem;
  max-width: 680px;
}

/* --- CV page --- */
.cv-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.cv-list li {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.cv-date {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent);
  min-width: 90px;
  flex-shrink: 0;
  padding-top: 0.15rem;
}

.cv-list li div {
  font-size: 0.88rem;
  color: var(--text-dim);
  line-height: 1.5;
}
.cv-list li div strong { color: var(--text); }

.cv-detail {
  font-size: 0.82rem;
  color: var(--muted);
}

.cv-summary {
  font-size: 0.88rem;
  color: var(--text-dim);
  line-height: 1.6;
}
.cv-summary p { margin-bottom: 0.4rem; }
.cv-summary p:last-child { margin-bottom: 0; }

@media (max-width: 640px) {
  .cv-list li { flex-direction: column; gap: 0.1rem; }
  .cv-date { min-width: auto; }
}

/* Card as link */
a.card-link {
  text-decoration: none;
  color: inherit;
}
a.card-link:hover { text-decoration: none; }
a.card-link:hover h3 { color: var(--accent); }

/* --- Responsive --- */
@media (max-width: 640px) {
  nav ul { gap: 0.15rem 0.6rem; }

  .hero-layout { flex-direction: column-reverse; align-items: flex-start; }
  .hero-photo { width: 120px; height: 120px; }

  .about-layout { flex-direction: column; }
  .stats-row { flex-direction: column; }

  .project-grid, .teach-grid { grid-template-columns: 1fr; }
  .wb-grid { grid-template-columns: 1fr; }
  .wb-wl-row { grid-template-columns: 110px 1fr 24px; gap: 0.4rem; }

  .contact-list li { flex-direction: column; gap: 0.1rem; }
}
