* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  color: #1f2937;
  background: #f3f4f6;
  line-height: 1.5;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* ===== GLOBAL TYPOGRAPHY — JUSTIFIED TEXT ===== */

p {
  text-align: justify;
  text-justify: inter-word;
  text-align-last: left;  /* last line stays left — prevents ugly full-width stretch */
  line-height: 1.7;
}

/*
 * Short, single-line metadata elements — keep left-aligned.
 * Justified text has no visual effect on single lines, but this
 * makes intent explicit and prevents regressions if content wraps.
 */
.article-date,
.article-tags,
.lab-card-meta,
.lab-card-venue,
.timeline-university,
.project-updated,
.projects-status,
.hero-intro,
.hero-interests {
  text-align: left;
}

.site-shell {
  width: min(980px, 100%);
  margin: 0 auto;
  padding: 42px 20px 72px;
}

.dark-mode-toggle {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 1000;
  width: 42px;
  height: 42px;
  border: 1px solid #d1d5db;
  border-radius: 999px;
  background: #ffffff;
  color: #111827;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

.dark-mode-toggle .icon-sun {
  display: none;
}

.dark-mode-toggle .icon-moon {
  display: inline;
}

body.dark-mode .dark-mode-toggle .icon-sun {
  display: inline;
}

body.dark-mode .dark-mode-toggle .icon-moon {
  display: none;
}

.hero {
  display: flex;
  align-items: center;
  gap: 44px;
  margin-bottom: 56px;
}

.hero-photo {
  width: 320px;
  height: 320px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.hero-content h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 3.2rem);
  line-height: 1.1;
  font-weight: 400;
  color: #1f2937;
}

.hero-intro {
  margin: 12px 0 8px;
  font-size: clamp(1.2rem, 2.5vw, 1.85rem);
  font-style: italic;
  color: #6b7280;
}

.hero-interests {
  margin: 0;
  font-size: 1rem;
  color: #4b5563;
}

.social-links {
  margin-top: 20px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.social-link {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: #374151;
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: background-color 0.2s ease;
}

.social-link:hover {
  background: #111827;
}

.social-link svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.social-link-logo {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

.content-section {
  margin-top: 40px;
}

.section-title {
  margin: 0 0 16px;
  font-size: clamp(1.55rem, 2.8vw, 2rem);
  font-weight: 500;
  color: #111827;
}

.about-section p {
  margin: 0 0 14px;
  color: #374151;
  max-width: 78ch;
}

.about-journey-title {
  margin: 0 0 10px;
  font-size: 1.08rem;
  font-weight: 600;
  color: #374151;
}

.timeline {
  position: relative;
  margin-top: 18px;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 164px;
  top: 8px;
  bottom: 8px;
  width: 1px;
  background: #d1d5db;
}

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

.timeline-item:last-child {
  padding-bottom: 0;
}

.timeline-left {
  text-align: right;
  padding-right: 22px;
}

.timeline-year {
  margin: 0 0 10px;
  font-size: 0.95rem;
  color: #4b5563;
}

.timeline-logo {
  width: 60px;
  height: 60px;
  object-fit: contain;
  border-radius: 12px;
  border: 1px solid #d1d5db;
  background: #ffffff;
  display: block;
}

.timeline-logo img {
  width: 60px;
  height: 60px;
  object-fit: contain;
}

.timeline-right,
.timeline-content {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 16px 18px;
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

.timeline-right h3,
.timeline-content h3 {
  margin: 0;
  font-size: 1.1rem;
  color: #111827;
  line-height: 1.35;
}

.timeline-university {
  margin: 6px 0 10px;
  color: #4b5563;
  font-style: italic;
}

.timeline-right p,
.timeline-content p {
  margin: 0;
  color: #374151;
}

.timeline-content ul {
  margin: 10px 0 0;
  padding-left: 20px;
  color: #374151;
}

.timeline-content li {
  margin-bottom: 6px;
}

.timeline-content li:last-child {
  margin-bottom: 0;
}

.skills-section {
  margin-top: 44px;
}

/* Structured "skill matrix": stacked category cards, each with a colored
   heading and a dense, responsive grid of compact icon+label chips. */
.skills-matrix {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.skills-category {
  --skills-accent: #3b82f6;
  margin: 0;
  border: 1px solid #e5e7eb;
  border-left: 3px solid var(--skills-accent);
  border-radius: 12px;
  background: #ffffff;
  padding: 16px 18px;
}

.skills-category h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--skills-accent);
}

.skills-cat-icon {
  width: 18px;
  height: 18px;
  object-fit: contain;
  flex: none;
}

/* Category accent colors mirror the original infographic palette. */
.skills-category--blue { --skills-accent: #3b82f6; }
.skills-category--green { --skills-accent: #22c55e; }
.skills-category--purple { --skills-accent: #a855f7; }
.skills-category--amber { --skills-accent: #f59e0b; }
.skills-category--teal { --skills-accent: #14b8a6; }

.skills-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Compact chip: small icon + label, sized to content so ~5-6 fit per row
   where labels are short, wrapping naturally on narrower viewports. */
.skills-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 11px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #f9fafb;
  color: #374151;
  font-size: 0.8rem;
  line-height: 1.25;
  white-space: normal;
}

.skills-item img,
.skills-logo {
  width: 18px;
  height: 18px;
  object-fit: contain;
  flex: none;
}

.skills-item.no-logo {
  color: #4b5563;
}

.skill-badge {
  background: #e2e8f0;
  color: #1f2937;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.2;
}

.projects-section {
  margin-top: 44px;
}

.projects-subtitle {
  margin: 30px 0 14px;
  color: #111827;
  font-size: 1.22rem;
  font-weight: 600;
}

.projects-category-title {
  margin: 18px 0 10px;
  color: #1f2937;
  font-size: 1.02rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.projects-note {
  margin: 0;
}

.projects-shell {
  display: flex;
  align-items: center;
  gap: 12px;
}

.projects-grid-shell {
  display: block;
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}

.projects-status {
  margin: 0;
  color: #4b5563;
  font-style: italic;
}

.projects-carousel {
  flex: 1;
  display: flex;
  gap: 16px;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-behavior: smooth;
  padding: 8px 4px 14px;
}

.projects-carousel::-webkit-scrollbar {
  height: 8px;
}

.projects-carousel::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 999px;
}

.project-card {
  flex: 0 0 min(420px, 88%);
  min-height: 260px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

.project-image-placeholder {
  height: 150px;
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
  background: #f8fafc;
  color: #6b7280;
  display: flex;
  align-items: center;
  justify-content: center;
  font-style: italic;
}

.project-cover {
  width: 100%;
  height: 170px;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  object-fit: cover;
  background: #f8fafc;
}

.project-card h3 {
  margin: 0;
  font-size: 1.1rem;
  color: #111827;
}

.project-card p {
  margin: 0;
  color: #4b5563;
}

.project-year {
  margin: 2px 0 0;
  color: #374151;
  font-size: 0.9rem;
  font-weight: 600;
}

.project-highlights {
  margin: 0;
  padding-left: 18px;
  color: #374151;
}

.project-highlights li {
  margin-bottom: 4px;
}

.project-highlights li:last-child {
  margin-bottom: 0;
}

.project-detail {
  margin: 2px 0;
  color: #374151;
  line-height: 1.55;
}

.project-repo-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  min-height: 22px;
  margin-top: 8px;
  color: #4b5563;
  font-size: 0.9rem;
}

.project-stars {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
  color: #111827;
}

.project-updated {
  color: #6b7280;
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.project-tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid #d1d5db;
  background: #f8fafc;
  color: #374151;
  font-size: 0.8rem;
  line-height: 1.2;
}

.project-cta {
  margin-top: auto;
  align-self: flex-start;
  padding: 7px 12px;
  border-radius: 8px;
  border: 1px solid #2563eb;
  background: #eff6ff;
  color: #1d4ed8;
  font-weight: 600;
  text-decoration: none;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.project-cta:hover {
  background: #1d4ed8;
  color: #ffffff;
  border-color: #1d4ed8;
}

.project-github-link {
  margin-top: auto;
  color: #1d4ed8;
  text-decoration: none;
  pointer-events: none;
  opacity: 0.7;
}

.projects-note-block {
  margin: 34px 0 28px;
  padding: 18px 20px;
  border: 1px solid #d1d5db;
  border-radius: 12px;
  background: #f8fafc;
}

.carousel-arrow {
  width: 42px;
  height: 42px;
  border: 1px solid #d1d5db;
  border-radius: 50%;
  background: #ffffff;
  color: #111827;
  font-size: 1.1rem;
  cursor: pointer;
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

.carousel-arrow:hover {
  background: #f3f4f6;
}

.articles-section {
  margin-top: 44px;
}

.stats-section {
  margin-top: 44px;
}

.experience-highlight {
  margin-top: 14px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #f8fafc;
  padding: 14px;
  display: grid;
  grid-template-columns: minmax(180px, 220px) 1fr;
  gap: 14px;
}

.experience-highlight-image {
  width: 100%;
  height: 150px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  background: #ffffff;
}

.experience-highlight-content h4 {
  margin: 0 0 8px;
  color: #111827;
  font-size: 1.02rem;
}

.experience-highlight-content p {
  margin: 0 0 8px;
}

.fullstack-section {
  margin-top: 44px;
}

.fullstack-grid {
  display: grid;
  gap: 16px;
}

.fullstack-card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(220px, 300px) 1fr;
}

.fullstack-image {
  width: 100%;
  height: 100%;
  min-height: 260px;
  object-fit: cover;
  border-right: 1px solid #e5e7eb;
}

.fullstack-content {
  padding: 16px 18px;
}

.fullstack-content h3 {
  margin: 0 0 10px;
  color: #111827;
  font-size: 1.2rem;
}

.fullstack-content h4 {
  margin: 12px 0 6px;
  color: #111827;
  font-size: 1rem;
}

.fullstack-content p {
  margin: 0;
  color: #374151;
}

.fullstack-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 10px;
}

.fullstack-tags span {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid #d1d5db;
  background: #f8fafc;
  color: #374151;
  font-size: 0.82rem;
  line-height: 1.2;
}

.stats-grid {
  display: grid;
  gap: 16px;
}

.stats-card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 18px 20px;
}

.stats-card h3 {
  margin: 0 0 8px;
  font-size: 1.18rem;
  color: #111827;
}

.stats-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 12px;
  color: #374151;
  font-weight: 600;
}

.stats-brand svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.stats-brand-logo {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

.stats-media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

.stats-media-item {
  border: 1px solid #d1d5db;
  border-radius: 10px;
  overflow: hidden;
  background: #f8fafc;
}

.stats-contribution-chart {
  margin-top: 12px;
}

.stats-contribution-chart .stats-image {
  min-height: 120px;
  object-fit: cover;
}

.stats-image {
  display: block;
  width: 100%;
  height: auto;
}

.hf-model-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
}

.hf-model-card {
  display: block;
  padding: 14px 14px 13px;
  border: 1px solid #1f2937;
  border-radius: 12px;
  background: #0b1220;
  text-decoration: none;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.hf-model-card:hover {
  border-color: #334155;
  transform: translateY(-1px);
}

.hf-model-card h4 {
  margin: 0 0 7px;
  font-size: 1.03rem;
  color: #f8fafc;
  line-height: 1.35;
}

.hf-model-card p {
  margin: 0;
  color: #cbd5e1;
  font-size: 0.92rem;
}

.articles-grid {
  display: grid;
  gap: 16px;
}

.article-card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 18px 20px;
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

.article-title {
  margin: 0 0 8px;
  font-size: 1.15rem;
}

.article-title a {
  color: #111827;
  text-decoration: none;
}

.article-title a:hover {
  text-decoration: underline;
}

.article-date {
  margin: 0 0 10px;
  color: #6b7280;
  font-size: 0.9rem;
}

.article-preview {
  margin: 0 0 12px;
  color: #374151;
}

.article-read-more {
  color: #1d4ed8;
  text-decoration: none;
}

.article-read-more:hover {
  text-decoration: underline;
}

.research-intro {
  margin: 0 0 18px;
  color: #374151;
  max-width: 75ch;
}

.article-tags {
  margin: 0 0 12px;
  color: #4b5563;
  font-size: 0.85rem;
  font-style: italic;
}

.article-pagination {
  margin-top: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.article-pagination a,
.article-pagination span {
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  color: #374151;
  text-decoration: none;
  background: #ffffff;
}

.article-pagination .active {
  background: #111827;
  color: #ffffff;
  border-color: #111827;
}

.article-pagination .disabled {
  color: #9ca3af;
  cursor: default;
}

.linkedin-posts {
  margin-top: 8px;
}

.linkedin-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  align-items: stretch;
}

/* Each cell is an equal-size static card that links to the real post. */
.linkedin-cell {
  min-width: 0;
  min-height: 200px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 24px 20px;
  text-align: center;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #ffffff;
  text-decoration: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.linkedin-cell:hover {
  border-color: #0a66c2;
  box-shadow: 0 4px 14px rgba(10, 102, 194, 0.12);
  transform: translateY(-2px);
}

.linkedin-cell .lc-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: #0a66c2;
  color: #ffffff;
  font-weight: 700;
  font-size: 1.15rem;
  line-height: 1;
}

.linkedin-cell .lc-title {
  color: #111827;
  font-size: 1.05rem;
}

.linkedin-cell .lc-author {
  color: #6b7280;
  font-size: 0.85rem;
}

.linkedin-cell .lc-cta {
  margin-top: 4px;
  color: #1d4ed8;
  font-size: 0.9rem;
}

.linkedin-cell:hover .lc-cta {
  text-decoration: underline;
}

.linkedin-pagination {
  margin-top: 24px;
}

@media (max-width: 820px) {
  .linkedin-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 440px) {
  .linkedin-grid {
    grid-template-columns: 1fr;
  }
}

body.dark-mode {
  background: #0f172a;
  color: #ffffff;
}

body.dark-mode h1,
body.dark-mode h2,
body.dark-mode h3,
body.dark-mode .section-title {
  color: #ffffff;
}

body.dark-mode .hero-intro,
body.dark-mode .hero-interests,
body.dark-mode .timeline-year,
body.dark-mode .timeline-university,
body.dark-mode .about-journey-title,
body.dark-mode .article-date,
body.dark-mode .project-card p,
body.dark-mode .article-preview,
body.dark-mode .skills-item,
body.dark-mode .about-section p,
body.dark-mode .timeline-content li,
body.dark-mode .timeline-content p,
body.dark-mode .timeline-right p {
  color: #ffffff;
}

body.dark-mode .skills-category,
body.dark-mode .timeline-item,
body.dark-mode .article-card,
body.dark-mode .stats-card,
body.dark-mode .fullstack-card {
  background-color: #1e293b;
  color: #ffffff;
}

body.dark-mode .timeline-right,
body.dark-mode .timeline-content,
body.dark-mode .experience-highlight,
body.dark-mode .project-card,
body.dark-mode .article-pagination a,
body.dark-mode .article-pagination span {
  background: #1e293b;
  border-color: #374151;
}

body.dark-mode .project-image-placeholder {
  background: #1f2937;
  border-color: #475569;
  color: #ffffff;
}

/* Dark technical cards + compact chips for the skill matrix. */
body.dark-mode .skills-category {
  background-color: #0f172a;
  border-color: #1f2937;
  border-left-color: var(--skills-accent);
}

body.dark-mode .skills-item {
  background: #111827;
  border-color: #334155;
  color: #e5e7eb;
}

body.dark-mode .skills-item.no-logo {
  color: #cbd5e1;
}

body.dark-mode .linkedin-cell {
  border-color: #374151;
  background: #1e293b;
}

body.dark-mode .linkedin-cell .lc-title {
  color: #f9fafb;
}

body.dark-mode .linkedin-cell .lc-author {
  color: #9ca3af;
}

body.dark-mode .projects-status,
body.dark-mode .project-updated {
  color: #e5e7eb;
}

body.dark-mode .project-stars {
  color: #f8fafc;
}

body.dark-mode .project-year,
body.dark-mode .project-highlights {
  color: #e5e7eb;
}

body.dark-mode .project-detail {
  color: #e5e7eb;
}

body.dark-mode .project-tag {
  border-color: #475569;
  background: #0f172a;
  color: #e5e7eb;
}

body.dark-mode .project-cta {
  border-color: #60a5fa;
  background: #1e3a8a;
  color: #dbeafe;
}

body.dark-mode .project-cta:hover {
  background: #2563eb;
  color: #ffffff;
}

body.dark-mode .carousel-arrow,
body.dark-mode .dark-mode-toggle {
  background: #111827;
  color: #f8fafc;
  border-color: #475569;
}

body.dark-mode .carousel-arrow:hover,
body.dark-mode .dark-mode-toggle:hover {
  background: #1f2937;
}

body.dark-mode .article-read-more {
  color: #93c5fd;
}

body.dark-mode .stats-brand {
  color: #e5e7eb;
}

body.dark-mode .stats-media-item {
  border-color: #334155;
  background: #0f172a;
}

body.dark-mode .hf-model-card {
  border-color: #334155;
  background: #0f172a;
}

body.dark-mode .hf-model-card:hover {
  border-color: #475569;
}

body.dark-mode .hf-model-card h4 {
  color: #f8fafc;
}

body.dark-mode .hf-model-card p {
  color: #cbd5e1;
}

body.dark-mode .research-intro,
body.dark-mode .article-tags {
  color: #e5e7eb;
}

body.dark-mode .project-github-link {
  color: #93c5fd;
}

body.dark-mode .experience-highlight-content h4,
body.dark-mode .fullstack-content h3,
body.dark-mode .fullstack-content h4,
body.dark-mode .fullstack-content p {
  color: #ffffff;
}

body.dark-mode .projects-category-title {
  color: #e5e7eb;
}

body.dark-mode .projects-note-block {
  border-color: #334155;
  background: #0f172a;
}

body.dark-mode .experience-highlight-image {
  border-color: #374151;
  background: #0f172a;
}

body.dark-mode .fullstack-image {
  border-right-color: #374151;
  border-bottom-color: #374151;
}

body.dark-mode .fullstack-tags span {
  border-color: #475569;
  background: #0f172a;
  color: #e5e7eb;
}

body.dark-mode .skill-badge {
  background: #334155;
  color: #ffffff;
}

.post-content .mermaid-diagram {
  margin: 1.2rem 0;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #ffffff;
  padding: 0.8rem;
  overflow-x: auto;
}

.post-content .mermaid-diagram svg {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
}

/* ===== BLOG / POST TYPOGRAPHY — APTOS FONT FAMILY =====
   Applies the Aptos font family to all posts (layout: post): the post
   title, meta line, body copy, lists, blockquotes, tables, and headings.
   FONT FAMILY ONLY — font sizes, weights, line-heights, letter-spacing,
   margins, spacing, colors, and code-block typography are left untouched.
   Code blocks (pre/code) keep their monospace stack via their own rules. */
.post-content,
.post-header h1,
.post-header .meta {
  font-family: "Aptos", "Aptos Display", "Segoe UI", -apple-system,
    BlinkMacSystemFont, Roboto, Helvetica, Arial, sans-serif;
}

.post-content h1,
.post-content h2,
.post-content h3,
.post-content h4,
.post-content h5,
.post-content h6 {
  font-family: "Aptos Display", "Aptos", "Segoe UI", -apple-system,
    BlinkMacSystemFont, Roboto, Helvetica, Arial, sans-serif;
}

.post-content {
  max-width: 90ch;
  margin: 0 auto;
  line-height: 1.72;
}

.post-content p,
.post-content ul,
.post-content ol {
  margin: 0.85rem 0;
}

.post-content h2,
.post-content h3,
.post-content h4 {
  line-height: 1.25;
  letter-spacing: 0.01em;
}

.post-content h2 {
  margin-top: 2.2rem;
  margin-bottom: 0.85rem;
  font-size: clamp(1.45rem, 3vw, 1.85rem);
}

.post-content h3 {
  margin-top: 1.7rem;
  margin-bottom: 0.6rem;
  font-size: clamp(1.15rem, 2.3vw, 1.35rem);
}

.post-content h4 {
  margin-top: 1.3rem;
  margin-bottom: 0.45rem;
  font-size: clamp(1rem, 2vw, 1.1rem);
}

.post-content hr {
  border: 0;
  border-top: 1px solid #d1d5db;
  margin: 2rem 0;
}

.post-content img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 1.6rem auto;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
}

body.dark-mode .post-content img {
  border-color: #334155;
}

.post-content pre,
.post-content .highlight pre {
  display: block;
  margin: 1rem 0;
  padding: 14px 16px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  background: #f8fafc;
  color: #111827;
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.9rem;
  line-height: 1.6;
  overflow-x: auto;
}

.post-content code {
  font-family: Consolas, "Courier New", monospace;
}

.post-content :not(pre) > code {
  background: #eef2ff;
  border: 1px solid #dbe3ff;
  border-radius: 6px;
  padding: 1px 5px;
}

/* Rouge token colors for readable Python-style highlighting */
.post-content .highlight .k,
.post-content .highlight .kd,
.post-content .highlight .kn {
  color: #7c3aed;
  font-weight: 600;
}

.post-content .highlight .nf,
.post-content .highlight .nc {
  color: #1d4ed8;
}

.post-content .highlight .nb,
.post-content .highlight .bp {
  color: #0f766e;
}

.post-content .highlight .s,
.post-content .highlight .s1,
.post-content .highlight .s2 {
  color: #b45309;
}

.post-content .highlight .mi,
.post-content .highlight .mf {
  color: #2563eb;
}

.post-content .highlight .c,
.post-content .highlight .c1 {
  color: #6b7280;
  font-style: italic;
}

.post-content table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  border: 1px solid #d1d5db;
  margin: 1rem 0;
  display: block;
  overflow-x: auto;
  white-space: normal;
  background: #ffffff;
}

.post-content th,
.post-content td {
  border: 1px solid #d1d5db;
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
}

.post-content th {
  background: #f3f4f6;
  font-weight: 700;
}

.post-content tbody tr:nth-child(even) {
  background: #f8fafc;
}

body.dark-mode .post-content .mermaid-diagram {
  border-color: #334155;
  background: #0f172a;
}

body.dark-mode .post-content pre,
body.dark-mode .post-content .highlight pre {
  border-color: #334155;
  background: #0f172a;
  color: #e5e7eb;
}

body.dark-mode .post-content :not(pre) > code {
  border-color: #334155;
  background: #1e293b;
  color: #e5e7eb;
}

body.dark-mode .post-content .highlight .k,
body.dark-mode .post-content .highlight .kd,
body.dark-mode .post-content .highlight .kn {
  color: #c4b5fd;
}

body.dark-mode .post-content .highlight .nf,
body.dark-mode .post-content .highlight .nc {
  color: #93c5fd;
}

body.dark-mode .post-content .highlight .nb,
body.dark-mode .post-content .highlight .bp {
  color: #5eead4;
}

body.dark-mode .post-content .highlight .s,
body.dark-mode .post-content .highlight .s1,
body.dark-mode .post-content .highlight .s2 {
  color: #fcd34d;
}

body.dark-mode .post-content .highlight .mi,
body.dark-mode .post-content .highlight .mf {
  color: #93c5fd;
}

body.dark-mode .post-content .highlight .c,
body.dark-mode .post-content .highlight .c1 {
  color: #94a3b8;
}

body.dark-mode .post-content table {
  border-color: #334155;
  background: #1e293b;
}

body.dark-mode .post-content th,
body.dark-mode .post-content td {
  border-color: #334155;
}

body.dark-mode .post-content th {
  background: #0f172a;
}

body.dark-mode .post-content tbody tr:nth-child(even) {
  background: #172033;
}

@media (max-width: 820px) {
  .hero {
    flex-direction: column;
    text-align: center;
    gap: 24px;
  }

  .hero-photo {
    width: min(280px, 78vw);
    height: min(280px, 78vw);
  }

  .social-links {
    justify-content: center;
  }

  .timeline::before {
    display: none;
  }

  .timeline-item {
    grid-template-columns: 1fr;
    gap: 12px;
    padding-bottom: 20px;
  }

  .timeline-left {
    text-align: left;
    padding-right: 0;
    display: flex;
    align-items: center;
    gap: 12px;
  }

  .timeline-year {
    margin: 0;
  }

  .skills-grid {
    gap: 6px;
  }

  .skills-item {
    padding: 5px 9px;
    font-size: 0.76rem;
  }

  .skills-item img,
  .skills-logo {
    width: 16px;
    height: 16px;
  }

  .projects-shell {
    gap: 8px;
  }

  .carousel-arrow {
    width: 38px;
    height: 38px;
  }

  .project-card {
    flex-basis: 92%;
  }

  .projects-grid {
    grid-template-columns: 1fr;
  }

  .experience-highlight {
    grid-template-columns: 1fr;
  }

  .experience-highlight-image {
    height: 190px;
  }

  .fullstack-card {
    grid-template-columns: 1fr;
  }

  .fullstack-image {
    min-height: 180px;
    border-right: none;
    border-bottom: 1px solid #e5e7eb;
  }

  .post-content {
    max-width: 100%;
    line-height: 1.68;
  }

  .post-content h2 {
    margin-top: 1.7rem;
  }

  .post-content table {
    font-size: 0.92rem;
    white-space: nowrap;
  }

  .post-content th,
  .post-content td {
    padding: 8px 10px;
  }

  .post-content pre,
  .post-content .highlight pre {
    font-size: 0.84rem;
    line-height: 1.52;
    padding: 12px 13px;
  }
}

@media (max-width: 440px) {
  .hero-intro {
    font-size: 1.05rem;
  }

  .hero-interests {
    font-size: 0.95rem;
  }

  .post-content h2 {
    font-size: 1.28rem;
  }

  .post-content h3 {
    font-size: 1.08rem;
  }

  .post-content pre,
  .post-content .highlight pre {
    font-size: 0.8rem;
    border-radius: 8px;
  }

  .resume-viewer {
    min-height: 82vh;
  }
}

/* ===== POST ANCHOR NAVIGATION + TABLE OF CONTENTS =====
   Additive, reusable helpers for in-page anchor navigation on posts.
   Enables smooth scrolling to same-page section anchors and offsets
   headings so the sticky top nav (56px) never covers a linked heading. */
html {
  scroll-behavior: smooth;
}

.post-content h1,
.post-content h2,
.post-content h3,
.post-content h4 {
  scroll-margin-top: 80px;
}

.post-toc {
  margin: 1.8rem 0 2.2rem;
  padding: 20px 24px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #f8fafc;
}

.post-toc .post-toc-title {
  margin: 0 0 12px;
  font-size: 0.9rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #6b7280;
}

.post-toc ol {
  margin: 0;
  padding-left: 1.25rem;
  columns: 2;
  column-gap: 2.6rem;
}

.post-toc li {
  margin: 0.3rem 0;
  break-inside: avoid;
  line-height: 1.45;
}

.post-toc a {
  color: #1d4ed8;
  text-decoration: none;
}

.post-toc a:hover {
  text-decoration: underline;
}

@media (max-width: 680px) {
  .post-toc ol {
    columns: 1;
  }
}

body.dark-mode .post-toc {
  border-color: #334155;
  background: #0f172a;
}

body.dark-mode .post-toc .post-toc-title {
  color: #94a3b8;
}

body.dark-mode .post-toc a {
  color: #93c5fd;
}

/* ===== POST ILLUSTRATIVE DATA PANELS =====
   Reusable, non-code "information panel" for illustrative data cards
   (e.g. raw interaction signals, verbalized context). Shares the rounded,
   subtle-background language of .post-toc and supports dark mode. */
.info-panel {
  margin: 1.7rem 0;
  padding: 18px 22px;
  border: 1px solid #e5e7eb;
  border-left: 4px solid #6366f1;
  border-radius: 12px;
  background: #f8fafc;
}

.info-panel .panel-label {
  margin: 0 0 14px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #6b7280;
}

.info-panel .panel-note {
  margin: 14px 0 0;
  font-size: 0.85rem;
  font-style: italic;
  color: #6b7280;
}

.info-panel .signal-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 22px;
}

.info-panel .signal-item {
  padding: 10px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #ffffff;
}

.info-panel .signal-time {
  margin: 0 0 3px;
  font-size: 0.82rem;
  font-weight: 700;
  color: #4338ca;
}

.info-panel .signal-meta {
  margin: 0;
  font-size: 0.92rem;
  color: #111827;
}

.info-panel .panel-extra {
  margin: 14px 0 0;
  font-size: 0.9rem;
}

.info-panel .verbalized {
  margin: 0;
  font-size: 1rem;
  line-height: 1.7;
  color: #111827;
}

@media (max-width: 680px) {
  .info-panel .signal-grid {
    grid-template-columns: 1fr;
  }
}

body.dark-mode .info-panel {
  border-color: #334155;
  border-left-color: #818cf8;
  background: #0f172a;
}

body.dark-mode .info-panel .panel-label,
body.dark-mode .info-panel .panel-note {
  color: #94a3b8;
}

body.dark-mode .info-panel .signal-item {
  border-color: #334155;
  background: #1e293b;
}

body.dark-mode .info-panel .signal-time {
  color: #a5b4fc;
}

body.dark-mode .info-panel .signal-meta,
body.dark-mode .info-panel .verbalized {
  color: #e5e7eb;
}

/* ===== TOP NAV ===== */

.topnav {
  position: sticky;
  top: 0;
  z-index: 500;
  background: #ffffff;
  border-bottom: 1px solid #e5e7eb;
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

.topnav-inner {
  width: min(980px, 100%);
  margin: 0 auto;
  padding: 0 20px;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.topnav-brand {
  font-size: 1rem;
  font-weight: 600;
  color: #111827;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  margin-right: 12px;
}

.topnav-brand:hover {
  color: #374151;
}

.topnav-links {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: auto;
}

.topnav-link {
  padding: 6px 11px;
  border-radius: 8px;
  color: #374151;
  text-decoration: none;
  font-size: 0.92rem;
  white-space: nowrap;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.topnav-link:hover {
  background: #f3f4f6;
  color: #111827;
}

.topnav-link.active {
  background: #111827;
  color: #ffffff;
}

/* Dark mode toggle inside nav — override fixed positioning */
.topnav .dark-mode-toggle {
  position: static;
  flex-shrink: 0;
  margin-left: 10px;
}

/* Hamburger button */
.topnav-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 36px;
  height: 36px;
  padding: 6px 7px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  margin-left: auto;
  flex-shrink: 0;
}

.topnav-hamburger span {
  display: block;
  height: 2px;
  background: #374151;
  border-radius: 2px;
  transition: background-color 0.2s ease;
}

/* ===== TOP NAV — DARK MODE ===== */

body.dark-mode .topnav {
  background: #0f172a;
  border-bottom-color: #1e293b;
}

body.dark-mode .topnav-brand {
  color: #f8fafc;
}

body.dark-mode .topnav-link {
  color: #cbd5e1;
}

body.dark-mode .topnav-link:hover {
  background: #1e293b;
  color: #ffffff;
}

body.dark-mode .topnav-link.active {
  background: #f8fafc;
  color: #111827;
}

body.dark-mode .topnav-hamburger {
  border-color: #334155;
}

body.dark-mode .topnav-hamburger span {
  background: #cbd5e1;
}

body.dark-mode .topnav-links.open {
  background: #0f172a;
  border-bottom-color: #1e293b;
}

/* ===== LEARNING LAB ===== */

.lab-placeholder {
  margin-top: 32px;
  border: 1px dashed #d1d5db;
  border-radius: 14px;
  padding: 28px 24px;
  background: #f8fafc;
  max-width: 680px;
}

.lab-placeholder-title {
  margin: 0 0 10px;
  font-size: 0.95rem;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.lab-entry-mock {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.lab-field {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 12px;
  align-items: baseline;
}

.lab-field-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: #6b7280;
}

.lab-field-bar {
  height: 14px;
  border-radius: 6px;
  background: #e5e7eb;
}

.lab-field-bar.wide { width: 80%; }
.lab-field-bar.medium { width: 55%; }
.lab-field-bar.short { width: 35%; }
.lab-field-bar.tall {
  height: 42px;
  border-radius: 8px;
}

.lab-tags-row {
  display: flex;
  gap: 8px;
  margin-top: 2px;
}

.lab-tag-bar {
  height: 24px;
  width: 64px;
  border-radius: 999px;
  background: #e5e7eb;
}

body.dark-mode .lab-placeholder {
  background: #0f172a;
  border-color: #334155;
}

body.dark-mode .lab-field-bar,
body.dark-mode .lab-tag-bar {
  background: #1e293b;
}

/* ===== RESUME ===== */

.resume-actions {
  margin-bottom: 18px;
}

.resume-viewer-shell {
  width: 100%;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 8px 26px rgba(15, 23, 42, 0.08);
}

.resume-viewer {
  width: 100%;
  min-height: 90vh;
  border: 0;
  display: block;
}

body.dark-mode .resume-viewer-shell {
  background: #1e293b;
  border-color: #374151;
  box-shadow: none;
}

/* ===== LEARNING LAB ===== */

.lab-section {
  margin-top: 44px;
}

.lab-section-heading {
  margin-top: 0;
  margin-bottom: 8px;
}

.lab-papers-section,
.lab-books-section {
  margin-top: 44px;
}

/* Vertical feed — no carousel, no horizontal scroll */
.lab-feed {
  display: grid;
  gap: 16px;
}

/* Base card — mirrors fullstack-card geometry */
.lab-card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  overflow: hidden;
  display: grid;
  grid-template-columns: 160px 1fr;
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

/* ── Research paper image wrapper (contains img or placeholder) ── */
.lab-paper-card .lab-card-image-wrap {
  border-right: 1px solid #e5e7eb;
  background: #f8fafc;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 12px;
}

.lab-paper-image {
  width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
}

/* ── Fallback placeholder (shown when no image or image fails) ── */
.lab-paper-placeholder {
  background: linear-gradient(160deg, #eff6ff 0%, #dbeafe 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  height: 100%;
  min-height: 200px;
  padding: 16px;
}

.lab-paper-icon {
  font-size: 2.4rem;
  line-height: 1;
}

.lab-paper-year {
  font-size: 0.82rem;
  font-weight: 600;
  color: #1d4ed8;
  letter-spacing: 0.04em;
}

/* ── Book cover image panel — stacked (image top, content below) ── */
.lab-book-card {
  grid-template-columns: 1fr;
}

.lab-book-image-wrap {
  background: #f8fafc;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 40px;
}

.lab-book-image {
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 420px;
  object-fit: contain;
  display: block;
}

/* ── Card content ── */
.lab-card-content {
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.lab-card-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 500;
  color: #111827;
  line-height: 1.35;
}

.lab-card-meta {
  margin: 0;
  font-size: 0.9rem;
  color: #6b7280;
  font-style: italic;
}

.lab-card-venue {
  margin: 0;
  font-size: 0.82rem;
  color: #4b5563;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.lab-card-description {
  margin: 0;
  color: #374151;
  line-height: 1.65;
}

.lab-card-highlights {
  margin: 2px 0 0;
  padding-left: 18px;
  color: #374151;
}

.lab-card-highlights li {
  margin-bottom: 5px;
  line-height: 1.6;
}

.lab-card-highlights li:last-child {
  margin-bottom: 0;
}

/* ── Tag pills ── */
.lab-tag-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 2px;
}

.lab-tag-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid #d1d5db;
  background: #f8fafc;
  color: #374151;
  font-size: 0.8rem;
  line-height: 1.3;
}

/* ── Actions row (primary CTA + secondary link) ── */
.lab-card-actions {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.lab-card-cta {
  align-self: flex-start;
}

/* ── Secondary paper link ── */
.lab-paper-link {
  font-size: 0.88rem;
  color: #6b7280;
  text-decoration: none;
  opacity: 0.85;
  transition: color 0.2s ease, opacity 0.2s ease;
  white-space: nowrap;
}

.lab-paper-link:hover {
  color: #374151;
  opacity: 1;
  text-decoration: underline;
}

/* ── Pagination ── */
.lab-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin-top: 24px;
}

.lab-page-btn {
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border-radius: 50%;
  border: 1px solid #d1d5db;
  background: transparent;
  color: #374151;
  font-size: 0.88rem;
  font-family: inherit;
  cursor: pointer;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.lab-page-btn:hover {
  background: #f3f4f6;
  border-color: #9ca3af;
}

.lab-page-btn.active {
  background: #111827;
  color: #ffffff;
  border-color: #111827;
}

/* ── Breadcrumb on detail pages ── */
.lab-breadcrumb {
  margin-bottom: 22px;
}

.lab-breadcrumb-link {
  color: #1d4ed8;
  text-decoration: none;
  font-size: 0.92rem;
}

.lab-breadcrumb-link:hover {
  text-decoration: underline;
}

/* ── Paper detail header ── */
.lab-paper-detail-section {
  margin-top: 44px;
}

.lab-paper-detail-header {
  margin-bottom: 28px;
}

.lab-paper-detail-title {
  margin: 0 0 10px;
  font-size: clamp(1.4rem, 3vw, 1.9rem);
  font-weight: 500;
  color: #111827;
  line-height: 1.25;
}

.lab-paper-detail-authors {
  margin: 0 0 12px;
  color: #6b7280;
  font-style: italic;
}

.lab-paper-detail-tags {
  margin-top: 12px;
}

/* ── Coming soon block ── */
.lab-coming-soon {
  padding: 28px 24px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #f8fafc;
}

.lab-coming-soon-label {
  margin: 0 0 10px;
  font-size: 1.05rem;
  font-weight: 600;
  color: #111827;
}

.lab-coming-soon-note {
  margin: 0;
  color: #374151;
  line-height: 1.65;
}

/* ===== DARK MODE — LEARNING LAB ===== */

body.dark-mode .lab-card {
  background-color: #1e293b;
  border-color: #374151;
}

body.dark-mode .lab-paper-card .lab-card-image-wrap {
  background: #0f172a;
  border-right-color: #374151;
}

body.dark-mode .lab-paper-placeholder {
  background: linear-gradient(160deg, #1e3a8a 0%, #0f172a 100%);
}

body.dark-mode .lab-paper-link {
  color: #94a3b8;
}

body.dark-mode .lab-paper-link:hover {
  color: #cbd5e1;
}

body.dark-mode .lab-page-btn {
  border-color: #475569;
  color: #e5e7eb;
}

body.dark-mode .lab-page-btn:hover {
  background: #1e293b;
  border-color: #64748b;
}

body.dark-mode .lab-page-btn.active {
  background: #f1f5f9;
  color: #0f172a;
  border-color: #f1f5f9;
}

body.dark-mode .lab-paper-year {
  color: #93c5fd;
}

body.dark-mode .lab-book-image-wrap {
  background: #0f172a;
  border-bottom-color: #374151;
}

body.dark-mode .lab-card-title {
  color: #ffffff;
}

body.dark-mode .lab-card-meta {
  color: #94a3b8;
}

body.dark-mode .lab-card-venue {
  color: #cbd5e1;
}

body.dark-mode .lab-card-description,
body.dark-mode .lab-card-highlights {
  color: #e5e7eb;
}

body.dark-mode .lab-tag-pill {
  border-color: #475569;
  background: #0f172a;
  color: #e5e7eb;
}

body.dark-mode .lab-breadcrumb-link {
  color: #93c5fd;
}

body.dark-mode .lab-paper-detail-title {
  color: #ffffff;
}

body.dark-mode .lab-paper-detail-authors {
  color: #94a3b8;
}

body.dark-mode .lab-coming-soon {
  background: #0f172a;
  border-color: #334155;
}

body.dark-mode .lab-coming-soon-label {
  color: #ffffff;
}

body.dark-mode .lab-coming-soon-note {
  color: #e5e7eb;
}

/* ===== RESPONSIVE — LEARNING LAB ===== */

@media (max-width: 820px) {
  .lab-card {
    grid-template-columns: 1fr;
  }

  .lab-paper-card .lab-card-image-wrap {
    border-right: none;
    border-bottom: 1px solid #e5e7eb;
    min-height: 120px;
  }

  body.dark-mode .lab-paper-card .lab-card-image-wrap {
    border-right: none;
    border-bottom-color: #374151;
  }

  .lab-paper-placeholder {
    min-height: 120px;
    flex-direction: row;
    gap: 14px;
    justify-content: flex-start;
    padding: 14px 18px;
  }

  .lab-paper-icon {
    font-size: 1.8rem;
  }

  .lab-book-image-wrap {
    padding: 20px 24px;
  }

  .lab-book-image {
    max-height: 320px;
  }
}

/* ===== TOPNAV MOBILE ===== */

@media (max-width: 740px) {
  .topnav-hamburger {
    display: flex;
  }

  .topnav .dark-mode-toggle {
    margin-left: 8px;
  }

  .topnav-links {
    display: none;
    position: absolute;
    top: 56px;
    left: 0;
    right: 0;
    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;
    flex-direction: column;
    align-items: stretch;
    padding: 6px 12px 10px;
    gap: 2px;
    margin-left: 0;
    z-index: 499;
  }

  .topnav-links.open {
    display: flex;
  }

  .topnav-link {
    padding: 9px 12px;
  }

  .topnav-inner {
    position: relative;
  }
}

/* ===== PRODUCTION PROJECTS GRID ===== */

.production-projects-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  margin-top: 24px;
}

.production-project-card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.production-project-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.08);
}

.production-project-image-wrap {
  width: 100%;
  height: 200px;
  overflow: hidden;
  background: #f3f4f6;
}

.production-project-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-bottom: 1px solid #e5e7eb;
}

.production-project-content {
  padding: 18px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.production-project-title {
  margin: 0 0 12px;
  color: #111827;
  font-size: 1.25rem;
  font-weight: 600;
}

.production-project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 14px;
}

.production-project-tags span {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #475569;
  background: #f8fafc;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.production-project-overview {
  margin: 0 0 16px;
  color: #374151;
  line-height: 1.6;
}

.production-project-highlights {
  margin: 0 0 16px;
  flex: 1;
}

.production-project-highlights h4 {
  margin: 0 0 8px;
  color: #111827;
  font-size: 0.95rem;
  font-weight: 600;
}

.production-project-highlights ul {
  margin: 0;
  padding-left: 20px;
  color: #4b5563;
}

.production-project-highlights li {
  margin-bottom: 6px;
  line-height: 1.5;
}

.production-project-actions {
  display: flex;
  gap: 10px;
  margin-top: auto;
  padding-top: 12px;
}

/* Dark mode support */
body.dark-mode .production-project-card {
  background: #1e293b;
  border-color: #374151;
}

body.dark-mode .production-project-title,
body.dark-mode .production-project-highlights h4 {
  color: #f9fafb;
}

body.dark-mode .production-project-overview,
body.dark-mode .production-project-highlights li {
  color: #d1d5db;
}

body.dark-mode .production-project-tags span {
  border-color: #475569;
  background: #0f172a;
  color: #e5e7eb;
}

body.dark-mode .production-project-image {
  border-bottom-color: #374151;
}

/* Responsive */
@media (max-width: 768px) {
  .production-projects-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .production-project-image-wrap {
    height: 180px;
  }
}

/* ===== HONORS PAGE ===== */

.honors-intro {
  margin-top: 32px;
}

.honors-category {
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid #e5e7eb;
}

.honors-category:last-of-type {
  border-bottom: none;
}

.honors-category h3 {
  margin: 0 0 8px;
  color: #111827;
  font-size: 1.1rem;
  font-weight: 600;
}

.honors-placeholder {
  margin-top: 32px;
  padding: 20px;
  background: #f9fafb;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
}

/* Dark mode support */
body.dark-mode .honors-category {
  border-bottom-color: #374151;
}

body.dark-mode .honors-category h3 {
  color: #f9fafb;
}

body.dark-mode .honors-placeholder {
  background: #0f172a;
  border-color: #374151;
}

/* ===== AWARD / RECOGNITION CARD ===== */

.award-card {
  margin-top: 16px;
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 24px;
  align-items: center;
  padding: 20px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
}

.award-media {
  min-width: 0;
}

.award-media img {
  display: block;
  width: 100%;
  height: auto;
  max-width: 220px;
  object-fit: contain;
  border-radius: 8px;
}

.award-body {
  min-width: 0;
}

.award-title {
  margin: 0 0 6px;
  font-size: 1.15rem;
  font-weight: 600;
  color: #111827;
}

.award-lead {
  margin: 0 0 12px;
  color: #374151;
  font-weight: 500;
}

.award-body .research-intro {
  margin: 0 0 14px;
}

.award-tags {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.award-tags li {
  font-size: 0.78rem;
  color: #4b5563;
  padding: 3px 10px;
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  background: #ffffff;
}

@media (max-width: 620px) {
  .award-card {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: left;
  }

  .award-media img {
    max-width: 200px;
  }
}

body.dark-mode .award-card {
  background: #0f172a;
  border-color: #374151;
}

body.dark-mode .award-title {
  color: #f9fafb;
}

body.dark-mode .award-lead {
  color: #e5e7eb;
}

body.dark-mode .award-tags li {
  background: #1e293b;
  border-color: #374151;
  color: #cbd5e1;
}

/* ===== LOAD MORE PAGINATION ===== */

.load-more-container {
  margin-top: 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.load-more-btn {
  padding: 12px 28px;
  border-radius: 8px;
  border: 1px solid #2563eb;
  background: #eff6ff;
  color: #1d4ed8;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
  font-family: Georgia, "Times New Roman", serif;
}

.load-more-btn:hover {
  background: #1d4ed8;
  color: #ffffff;
  border-color: #1d4ed8;
}

.load-more-btn:active {
  transform: scale(0.98);
}

.load-more-status {
  margin: 0;
  color: #6b7280;
  font-size: 0.875rem;
  text-align: center;
}

/* Dark mode support */
body.dark-mode .load-more-btn {
  border-color: #60a5fa;
  background: #1e3a8a;
  color: #dbeafe;
}

body.dark-mode .load-more-btn:hover {
  background: #2563eb;
  color: #ffffff;
}

body.dark-mode .load-more-status {
  color: #9ca3af;
}

/* ===================================================================
   ENGINEERING IMPLEMENTATIONS — LANDING, DOMAINS & CATEGORY PAGES
   =================================================================== */

/* ── Hero stats row ── */
.eng-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin-top: 18px;
}

.eng-stat {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  background: #ffffff;
  color: #4b5563;
  font-size: 0.9rem;
  transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

.eng-stat strong {
  color: #111827;
  font-weight: 600;
}

/* ── Section spacing between landing blocks ── */
.engineering-intro-section,
.engineering-domains-section {
  margin-top: 48px;
}

/* ── Intro / philosophy lede ── */
.eng-lede {
  max-width: 74ch;
  font-size: 1.02rem;
  color: #374151;
}

.eng-lede + .eng-lede {
  margin-top: 14px;
}

body.dark-mode .eng-lede {
  color: #cbd5e1;
}

/* ── Domain card grid ── */
.eng-domain-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.eng-domain-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 20px 22px;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  background: #ffffff;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease,
    background-color 0.3s ease;
}

.eng-domain-card:hover {
  border-color: #9ca3af;
  box-shadow: 0 4px 14px rgba(17, 24, 39, 0.06);
  transform: translateY(-2px);
}

.eng-domain-title {
  margin: 0;
  font-size: 1.12rem;
  font-weight: 600;
  color: #111827;
  line-height: 1.35;
}

.eng-domain-desc {
  margin: 0;
  color: #4b5563;
  font-size: 0.92rem;
  line-height: 1.6;
  text-align: left;
}

.eng-domain-keywords {
  margin: 0;
  color: #6b7280;
  font-size: 0.8rem;
  letter-spacing: 0.01em;
  text-align: left;
}

.eng-domain-count {
  margin-top: auto;
  padding-top: 6px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #1d4ed8;
  font-size: 0.88rem;
  font-weight: 600;
}

.eng-domain-arrow {
  transition: transform 0.2s ease;
}

.eng-domain-card:hover .eng-domain-arrow {
  transform: translateX(3px);
}

/* ── Category page breadcrumb (multi-segment) ── */
.eng-breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.eng-breadcrumb-sep {
  color: #9ca3af;
}

.eng-breadcrumb-current {
  color: #6b7280;
  font-size: 0.92rem;
}

/* ── Subcategory filter bar ── */
.eng-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 20px 0 24px;
}

.eng-filter-pill {
  padding: 5px 14px;
  border-radius: 999px;
  border: 1px solid #d1d5db;
  background: #ffffff;
  color: #374151;
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.eng-filter-pill:hover {
  border-color: #9ca3af;
  background: #f3f4f6;
}

.eng-filter-pill.active {
  background: #111827;
  color: #ffffff;
  border-color: #111827;
}

.eng-no-results,
.eng-empty {
  color: #6b7280;
}

/* ── Responsive ── */
@media (max-width: 640px) {
  .eng-domain-grid {
    grid-template-columns: 1fr;
  }
}

/* ===================================================================
   DARK MODE — ENGINEERING IMPLEMENTATIONS
   =================================================================== */

body.dark-mode .eng-stat {
  background: #1e293b;
  border-color: #374151;
  color: #cbd5e1;
}

body.dark-mode .eng-stat strong {
  color: #ffffff;
}

body.dark-mode .eng-domain-card {
  background: #1e293b;
  border-color: #374151;
}

body.dark-mode .eng-domain-card:hover {
  border-color: #64748b;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}

body.dark-mode .eng-domain-title {
  color: #ffffff;
}

body.dark-mode .eng-domain-desc {
  color: #cbd5e1;
}

body.dark-mode .eng-domain-keywords,
body.dark-mode .eng-breadcrumb-current,
body.dark-mode .eng-no-results,
body.dark-mode .eng-empty {
  color: #94a3b8;
}

body.dark-mode .eng-domain-count {
  color: #93c5fd;
}

body.dark-mode .eng-filter-pill {
  background: #1e293b;
  border-color: #475569;
  color: #e5e7eb;
}

body.dark-mode .eng-filter-pill:hover {
  background: #0f172a;
  border-color: #64748b;
}

body.dark-mode .eng-filter-pill.active {
  background: #f1f5f9;
  color: #0f172a;
  border-color: #f1f5f9;
}
