:root {
  --bg: #fafaf9;
  --text: #2c3e50;
  --accent: #2563eb;
  --muted: #7f8c8d;
  --border: #ecf0f1;
  --card-bg: #f8f9fa;
  --nav-bg: #2c3e50;

  --motion-fast: 150ms;
  --motion-base: 200ms;
  --motion-slow: 300ms;

  --fs-xs: 0.75rem;
  --fs-sm: 0.875rem;
  --fs-base: 1rem;
  --fs-md: 1.125rem;
  --fs-lg: 1.25rem;
  --fs-xl: 1.5rem;
  --fs-2xl: 2rem;

  --radius-sm: 4px;
  --radius: 6px;
  --radius-md: 8px;
  --radius-lg: 10px;
  --radius-pill: 999px;

  --gray-50:  #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #cccccc;
  --gray-500: #888888;
  --gray-700: #555555;
  --ink-soft: #333333;
  --ink:      #111111;

  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
}

/* Base heading hierarchy (overridden by class-specific component rules) */
h1, h2, h3 {
  font-family: var(--font-display);
}
h1 {
  font-size: clamp(var(--fs-xl), 1rem + 3vw, var(--fs-2xl));
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.02em;
}
h2 {
  font-size: var(--fs-xl);
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.01em;
}
h3 {
  font-size: var(--fs-lg);
  font-weight: 600;
  line-height: 1.35;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 90px;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.7;
  font-size: 16px;
}

a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }

/* Navigation (site header — scoped to .site-header to avoid affecting other <nav>s like TOC) */
.site-header nav {
  background: var(--nav-bg);
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
}
.site-header nav .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.site-header nav .site-title {
  color: #fff;
  font-size: 1.3rem;
  font-weight: 700;
  text-decoration: none;
}
.site-header nav .nav-links a {
  color: #ecf0f1;
  margin-left: 2rem;
  font-size: 0.95rem;
  text-decoration: none;
  transition: color var(--motion-base) ease;
}
.site-header nav .nav-links a:hover {
  color: #fff;
}
.site-header nav .nav-links a.active {
  color: #fff;
  font-weight: 600;
  border-bottom: 2px solid #fff;
  padding-bottom: 4px;
}

/* Layout */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.page-header {
  padding: 3rem 0 1.5rem;
  border-bottom: 2px solid var(--border);
  margin-bottom: 2rem;
}
.page-header h1 {
  font-size: 2rem;
  font-weight: 700;
}
.page-header p {
  color: var(--muted);
  margin-top: 0.5rem;
}

.content {
  padding-bottom: 4rem;
}

/* Cards */
.card {
  background: var(--card-bg);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  border-left: 3px solid var(--accent);
}
.card h3 { margin-bottom: 0.3rem; }
.card .meta {
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
}
.card ul {
  margin-left: 1.2rem;
  margin-top: 0.5rem;
}
.card li { margin-bottom: 0.3rem; font-size: 0.95rem; }

/* Post list */
.post-list { list-style: none; }
.post-list li {
  padding: 1.2rem 0;
  border-bottom: 1px solid var(--border);
}
.post-list .post-date {
  color: var(--muted);
  font-size: 0.85rem;
}
.post-list .post-title {
  font-size: 1.15rem;
  font-weight: 600;
}

/* Bookmark grid */
.bookmark-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1rem;
}
.bookmark-card {
  background: var(--card-bg);
  border-radius: var(--radius-md);
  padding: 1.2rem;
  transition: transform var(--motion-fast) ease;
}
.bookmark-card:hover { transform: translateY(-2px); }
.bookmark-card h3 { font-size: 1rem; margin-bottom: 0.3rem; }
.bookmark-card .tag {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  font-size: 0.7rem;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-pill);
  margin-right: 0.3rem;
}
.bookmark-card p {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.5rem;
}

/* Post single */
.post-content h2 { margin-top: 2rem; margin-bottom: 0.8rem; }
.post-content p { margin-bottom: 1rem; }
.post-content img {
  display: block;
  max-width: 100%;
  margin: 1.5rem auto;
  border-radius: var(--radius-md);
}

/* Hero */
.hero {
  padding: 4rem 0 2rem;
  text-align: center;
}
.hero h1 { font-size: 2.5rem; margin-bottom: 0.5rem; }
.hero .subtitle {
  font-size: 1.15rem;
  color: var(--muted);
}
.hero .links { margin-top: 1.5rem; }
.hero .links a {
  margin: 0 0.8rem;
  font-weight: 500;
}

/* About section */
.about-section { margin-bottom: 2.5rem; }
.about-section h2 {
  font-size: 1.3rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.skill-tags { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.skill-tag {
  background: var(--card-bg);
  padding: 0.3rem 0.8rem;
  border-radius: var(--radius-pill);
  font-size: 0.85rem;
}

/* ====== Thoughts (posts list, grouped by year) ====== */
.thought-year-section {
  margin: 2.5rem 0 3.5rem;
}
.thought-year {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 1.5rem;
  letter-spacing: -0.01em;
}
.thought-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 2.5rem;
}
.thought-link {
  display: flex;
  gap: 2rem;
  align-items: center;
  text-decoration: none;
  color: inherit;
  transition: transform var(--motion-base) ease;
}
.thought-link:hover {
  text-decoration: none;
  transform: translateY(-2px);
}
.thought-image {
  width: 360px;
  height: 215px;
  object-fit: cover;
  border-radius: var(--radius-lg);
  flex-shrink: 0;
  background: var(--gray-100);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  transition: box-shadow var(--motion-base) ease;
}
.thought-link:hover .thought-image {
  box-shadow: 0 6px 28px rgba(0, 0, 0, 0.12);
}
.thought-image-placeholder {
  background: linear-gradient(135deg, var(--gray-100) 0%, var(--gray-200) 100%);
}
.thought-body {
  flex: 1;
  min-width: 0;
}
.thought-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 0.6rem;
  line-height: 1.35;
  letter-spacing: -0.01em;
}
.thought-link:hover .thought-title {
  color: var(--accent);
}
.thought-meta {
  font-size: 0.9rem;
  color: var(--gray-500);
  font-variant-numeric: tabular-nums;
}
.thought-meta-sep {
  margin: 0 0.5rem;
  color: var(--gray-400);
}
@media (max-width: 700px) {
  .thought-link {
    flex-direction: column;
    gap: 1rem;
    align-items: stretch;
  }
  .thought-image {
    width: 100%;
    height: 200px;
  }
  .thought-title {
    font-size: 1.1rem;
  }
}

/* ====== Single post page ====== */
.post {
  padding: 1rem 0 3rem;
}
.post-cover {
  display: block;
  margin: 1.5rem auto 2rem;
  max-width: 640px;
  width: 100%;
  height: auto;
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}
.post-header {
  margin: 2rem 0 1.5rem;
}
.post-title {
  font-size: 2rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.01em;
  margin: 0 0 0.4rem;
  line-height: 1.25;
}
.post-meta {
  color: var(--gray-500);
  font-size: 0.92rem;
  margin: 0;
}
.post-content {
  font-size: 1rem;
  line-height: 1.75;
  color: var(--ink-soft);
}
.post-content h2 {
  margin: 2rem 0 0.8rem;
  font-size: 1.4rem;
  color: var(--ink);
}
.post-content h3 {
  margin: 1.5rem 0 0.6rem;
  font-size: 1.15rem;
  color: var(--ink);
}
.post-content p {
  margin-bottom: 1rem;
}
.post-content img {
  max-width: 100%;
  border-radius: var(--radius);
}
.post-content code {
  background: var(--gray-100);
  padding: 0.1rem 0.35rem;
  border-radius: var(--radius-sm);
  font-size: 0.88em;
  font-family: "SF Mono", Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}
.post-content pre {
  background: #f6f8fa;
  color: #24292f;
  padding: 1rem 1.2rem;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  overflow-x: auto;
  font-size: 0.85rem;
  line-height: 1.6;
  font-family: "SF Mono", Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  margin: 1rem 0;
}
.post-content div.highlight,
.post-content figure.highlight {
  background: transparent;
  padding: 0;
  margin: 0;
  border: 0;
}
.post-content pre code,
.post-content .highlight code {
  background: transparent;
  padding: 0;
  color: inherit;
  font-family: inherit;
}

/* Rouge syntax highlighting (GitHub Light theme) */
.post-content .highlight .k,
.post-content .highlight .kc,
.post-content .highlight .kd,
.post-content .highlight .kn,
.post-content .highlight .kp,
.post-content .highlight .kr,
.post-content .highlight .kt,
.post-content .highlight .kv { color: #cf222e; }    /* keywords (FROM/RUN/SELECT etc.) */
.post-content .highlight .o,
.post-content .highlight .ow { color: #cf222e; }    /* operators */
.post-content .highlight .s,
.post-content .highlight .sb,
.post-content .highlight .sc,
.post-content .highlight .s2,
.post-content .highlight .se,
.post-content .highlight .sh,
.post-content .highlight .si,
.post-content .highlight .sx,
.post-content .highlight .s1,
.post-content .highlight .ss { color: #0a3069; }    /* strings */
.post-content .highlight .c,
.post-content .highlight .cm,
.post-content .highlight .cp,
.post-content .highlight .c1,
.post-content .highlight .cs { color: #6e7781; font-style: italic; }  /* comments */
.post-content .highlight .m,
.post-content .highlight .mb,
.post-content .highlight .mf,
.post-content .highlight .mh,
.post-content .highlight .mi,
.post-content .highlight .mo,
.post-content .highlight .il { color: #0550ae; }    /* numbers */
.post-content .highlight .nf,
.post-content .highlight .nc,
.post-content .highlight .nb { color: #8250df; }    /* functions / classes / builtins */
.post-content .highlight .nv,
.post-content .highlight .vc,
.post-content .highlight .vg,
.post-content .highlight .vi { color: #953800; }    /* variables */
.post-content .highlight .nt { color: #116329; }    /* tags */
.post-content .highlight .na { color: #0550ae; }    /* attributes */
.post-content .highlight .err { color: #cf222e; background: transparent; }

/* Post layout: 2-column (sticky TOC on left + article) on wide viewports */
main.container:has(.post-layout) {
  max-width: 1240px;
}
.post-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 48px;
  align-items: start;
}
.post-layout > .post-toc { order: 1; }
.post-layout > article.post { order: 2; }
/* Collapsed-TOC state (desktop only): hide sidebar, re-center article at
   its natural width so prose stays at a readable line length. */
@media (min-width: 1101px) {
  .post-layout.toc-hidden {
    grid-template-columns: minmax(0, 1fr);
  }
  .post-layout.toc-hidden > .post-toc {
    display: none;
  }
  .post-layout.toc-hidden > article.post {
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
  }
}
.post-toc {
  position: sticky;
  top: 90px;
  max-height: calc(100vh - 130px);
  overflow-y: auto;
  font-size: 0.875rem;
  line-height: 1.55;
  padding: 0.4rem 0;
}
@media (max-width: 1100px) {
  .post-layout { grid-template-columns: 1fr; }
  .post-toc {
    position: fixed;
    top: 0;
    left: 0;
    width: min(320px, 85vw);
    height: 100vh;
    max-height: 100vh;
    background: var(--bg);
    border-right: 1px solid var(--gray-200);
    padding: 4.5rem 1rem 2rem 1.5rem;
    margin: 0;
    transform: translateX(-100%);
    transition: transform var(--motion-base) ease;
    z-index: 200;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.06);
    overflow-y: auto;
  }
  .post-toc.open { transform: translateX(0); }
}
.toc-toggle {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--ink, #1a1a1a);
  color: #fff;
  border: none;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
  cursor: pointer;
  z-index: 150;
  display: none;
  align-items: center;
  justify-content: center;
  transition: transform var(--motion-fast) ease, background var(--motion-fast) ease;
}
.toc-toggle:hover { transform: translateY(-2px); }
.toc-toggle:active { transform: translateY(0); }
@media (max-width: 1100px) {
  .toc-toggle { display: flex; }
}
.toc-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.25);
  z-index: 199;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--motion-base) ease;
}
.toc-backdrop.show {
  opacity: 1;
  pointer-events: auto;
}
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent);
  transform-origin: left center;
  transform: scaleX(0);
  z-index: 101;
  pointer-events: none;
  will-change: transform;
}
.post-toc-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-right: 0.4rem;
  margin: 0 0 1rem;
}
.post-toc-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink);
  margin: 0;
  padding-left: 0.85rem;
  font-family: var(--font-display);
}
/* Collapse button in TOC head (desktop only) */
.toc-collapse {
  background: none;
  border: none;
  color: var(--gray-500);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--motion-fast) ease, background var(--motion-fast) ease;
}
.toc-collapse:hover {
  color: var(--ink);
  background: var(--gray-100);
}
@media (max-width: 1100px) {
  .toc-collapse { display: none; }
}
/* Floating expand button on left edge when TOC is collapsed (desktop only) */
.toc-expand {
  position: fixed;
  top: 50%;
  left: 0;
  transform: translateY(-50%);
  width: 28px;
  height: 56px;
  border-radius: 0 8px 8px 0;
  background: var(--bg);
  border: 1px solid var(--gray-200);
  border-left: none;
  color: var(--gray-600);
  cursor: pointer;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.06);
  transition: color var(--motion-fast) ease, background var(--motion-fast) ease;
}
.toc-expand[hidden] { display: none; }
.toc-expand:hover {
  color: var(--ink);
  background: var(--gray-100);
}
@media (max-width: 1100px) {
  .toc-expand { display: none !important; }
}
.post-toc nav ul {
  list-style: none;
  padding-left: 0;
  margin: 0;
}
.post-toc nav li { margin: 0; }
.post-toc nav li > ul {
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--motion-base) ease;
}
.post-toc nav li.expanded > ul {
  max-height: 4000px;
}
.toc-row {
  display: flex;
  align-items: stretch;
}
.toc-chevron,
.toc-spacer {
  flex: 0 0 18px;
  width: 18px;
  margin-left: 0.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.toc-chevron {
  background: none;
  border: none;
  color: var(--gray-500);
  cursor: pointer;
  padding: 0;
  border-radius: 3px;
  transition: color var(--motion-fast) ease;
}
.toc-chevron:hover { color: var(--ink); }
.toc-chevron svg {
  transition: transform var(--motion-fast) ease;
}
.post-toc nav li.expanded > .toc-row > .toc-chevron svg {
  transform: rotate(90deg);
}
.post-toc nav .toc-row > a {
  display: block;
  flex: 1 1 auto;
  padding: 0.42rem 0.85rem;
  color: var(--ink-soft);
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.45;
  text-decoration: none;
  border-left: 2px solid var(--gray-200);
  transition: color var(--motion-fast) ease, border-color var(--motion-fast) ease;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.post-toc nav li.toc-h3 .toc-row > a {
  font-size: 0.83rem;
  font-weight: 400;
  color: var(--gray-700);
}
.post-toc nav li.toc-h3 .toc-row { padding-left: 1rem; }
.post-toc nav li.toc-h4 .toc-row {
  padding-left: 2rem;
}
.post-toc nav li.toc-h4 .toc-row > a {
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--gray-600);
}
.post-toc nav li.toc-h5 .toc-row { padding-left: 3rem; }
.post-toc nav li.toc-h5 .toc-row > a {
  font-size: 0.76rem;
  color: var(--gray-500);
}
.post-toc nav .toc-row > a:hover {
  color: var(--ink);
  border-left-color: var(--gray-400);
}
.post-toc nav .toc-row > a.active {
  color: var(--accent);
  border-left-color: var(--accent);
  font-weight: 600;
}
.post-toc nav li.toc-h3 .toc-row > a.active,
.post-toc nav li.toc-h4 .toc-row > a.active,
.post-toc nav li.toc-h5 .toc-row > a.active {
  font-weight: 500;
}

/* Back-to-top button */
.back-to-top {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--ink, #1a1a1a);
  color: #fff;
  border: none;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
  cursor: pointer;
  z-index: 140;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity var(--motion-base) ease, transform var(--motion-base) ease;
}
.back-to-top.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.back-to-top:hover { transform: translateY(-2px); }
/* On mobile, both buttons exist — offset back-to-top up so they stack */
@media (max-width: 1100px) {
  .back-to-top { bottom: 5rem; }
}

/* Heading anchor link */
.post-content :is(h2, h3, h4, h5) {
  position: relative;
}
.heading-anchor {
  margin-left: 0.4em;
  color: var(--gray-400);
  text-decoration: none;
  font-weight: 400;
  opacity: 0;
  transition: opacity var(--motion-fast) ease, color var(--motion-fast) ease;
}
.post-content :is(h2, h3, h4, h5):hover .heading-anchor {
  opacity: 1;
}
.heading-anchor:hover {
  color: var(--accent);
  text-decoration: none;
}

/* Code copy button */
.post-content .highlight {
  position: relative;
}
.code-copy {
  position: absolute;
  top: 8px;
  right: 8px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  font-size: 0.72rem;
  font-family: inherit;
  color: var(--gray-700);
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid var(--gray-200);
  border-radius: 4px;
  cursor: pointer;
  opacity: 0;
  transition: opacity var(--motion-fast) ease, background var(--motion-fast) ease,
              color var(--motion-fast) ease, border-color var(--motion-fast) ease;
  backdrop-filter: blur(4px);
}
.post-content .highlight:hover .code-copy,
.code-copy:focus-visible {
  opacity: 1;
}
.code-copy:hover {
  background: #fff;
  color: var(--ink);
  border-color: var(--gray-400);
}
.code-copy.copied {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  opacity: 1;
}

/* Post-meta: published + updated */
.post-meta-sep {
  margin: 0 0.55em;
  color: var(--gray-400);
}
.post-meta-updated {
  color: var(--gray-600);
}

/* Mermaid diagrams */
.post-content .mermaid {
  margin: 1.6rem auto;
  text-align: center;
  overflow-x: auto;
  line-height: 1.4;
}
.post-content .mermaid svg {
  max-width: 100%;
  height: auto;
}

/* Image lightbox affordance — cursor + smooth zoom feel.
   medium-zoom overrides cursor at runtime; this is a fallback. */
.post-content img {
  cursor: zoom-in;
}
.medium-zoom-overlay {
  z-index: 250;
}
.medium-zoom-image--opened {
  z-index: 251;
}
.post-content blockquote {
  border-left: 3px solid var(--gray-300);
  margin: 1rem 0;
  padding: 0.25rem 0 0.25rem 1rem;
  color: var(--gray-700);
}
.post-content ul,
.post-content ol {
  padding-left: 1.5rem;
  margin: 0.6rem 0 1rem;
}
.post-content li {
  margin-bottom: 0.4rem;
}
.post-content li > ul,
.post-content li > ol {
  margin: 0.4rem 0;
}
.post-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.95rem;
}
.post-content thead th {
  text-align: left;
  padding: 0.6rem 0.8rem;
  border-bottom: 2px solid var(--gray-300);
  font-weight: 600;
  color: var(--ink);
}
.post-content tbody td {
  padding: 0.6rem 0.8rem;
  border-bottom: 1px solid var(--gray-200);
}
.post-content tbody tr:last-child td {
  border-bottom: none;
}
/* Short label columns (typically first) shouldn't be forced to wrap.
   width:1% + nowrap collapses the column to natural content width,
   leaving remaining space for the content column(s). */
.post-content thead th:first-child,
.post-content tbody td:first-child {
  white-space: nowrap;
  width: 1%;
}
/* On narrow screens allow wrapping again so the table doesn't blow out the page. */
@media (max-width: 600px) {
  .post-content thead th:first-child,
  .post-content tbody td:first-child {
    white-space: normal;
    width: auto;
  }
}

/* ====== Projects ====== */
.project-list {
  list-style: none;
  margin: 2.5rem 0 3rem;
  padding: 0;
  display: grid;
  gap: 2.5rem;
}
.project-card {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding: 2rem;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  background: #ffffff;
  transition: background var(--motion-base) ease, border-color var(--motion-base) ease, box-shadow var(--motion-base) ease;
}
.project-card:hover {
  border-color: var(--gray-300);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
}
.project-image {
  display: block;
  width: 100%;
  max-width: 510px;
  height: auto;
  margin: 0 auto;
  border-radius: var(--radius);
  background: var(--gray-100);
}
.project-body {
  flex: 1;
  min-width: 0;
}
.project-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 0.4rem;
}
.project-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--ink);
  margin: 0;
  line-height: 1.3;
}
.project-year {
  font-size: 0.88rem;
  color: var(--gray-500);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}
.project-desc {
  font-size: 0.93rem;
  color: var(--ink-soft);
  line-height: 1.6;
  margin: 0 0 0.6rem;
}
.project-tags {
  margin: 0 0 0.6rem;
}
.project-tag {
  display: inline-block;
  font-size: 0.72rem;
  color: var(--gray-700);
  background: var(--gray-100);
  padding: 0.15rem 0.55rem;
  border-radius: var(--radius-sm);
  margin-right: 0.35rem;
  margin-bottom: 0.25rem;
}
.project-links {
  margin: 0;
  font-size: 0.88rem;
}
.project-links a {
  color: var(--accent);
  text-decoration: none;
  margin-right: 1.2rem;
}
.project-links a:hover {
  text-decoration: underline;
}
@media (max-width: 700px) {
  .project-card {
    flex-direction: column;
    gap: 0.8rem;
  }
  .project-image {
    width: 100%;
    height: 180px;
  }
}

/* ====== Twemoji (cross-platform emoji rendering, esp. Windows flags) ====== */
img.emoji {
  height: 1em;
  width: 1em;
  margin: 0 0.05em 0 0.1em;
  vertical-align: -0.1em;
  display: inline-block;
}
/* 国旗在国家列表/访客表格里稍大 */
.country-flag img.emoji,
.row-flag img.emoji {
  height: 1.2em;
  width: 1.8em;
  vertical-align: -0.2em;
}

/* ====== Empty section state ====== */
.section-empty {
  color: var(--gray-500);
  font-style: italic;
  font-size: 0.9rem;
  padding: 1rem 0;
  margin: 0;
}

/* ====== Filter chips (shared by Bookmarks & Thoughts) ====== */
.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 2rem 0 2.5rem;
}
.filter-chips .chip {
  background: var(--gray-100);
  border: 1px solid transparent;
  padding: 0.4rem 1rem;
  border-radius: var(--radius-pill);
  cursor: pointer;
  font-size: 0.88rem;
  color: var(--gray-700);
  font-family: inherit;
  transition: background var(--motion-fast) ease, color var(--motion-fast) ease, border-color var(--motion-fast) ease;
}
.filter-chips .chip:hover {
  background: var(--gray-200);
  color: var(--ink);
}
.filter-chips .chip.active {
  background: var(--ink);
  color: #fff;
}

/* ====== Bookmarks ====== */
.bookmark-section {
  margin: 2.5rem 0 3rem;
}
.bookmark-section > h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 1.25rem;
  letter-spacing: -0.01em;
}
.bookmark-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.75rem;
}
.bookmark-card {
  position: relative;
  border: none;
  border-radius: var(--radius-md);
  background: var(--gray-100);
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  transition: transform var(--motion-fast) ease, box-shadow var(--motion-fast) ease;
}
.bookmark-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}
.bookmark-link {
  display: block;
  padding: 0.95rem 1rem 0.95rem 1.1rem;
  text-decoration: none;
  color: inherit;
}
.bookmark-link:hover {
  text-decoration: none;
}
.bookmark-title {
  display: block;
  font-weight: 600;
  font-size: 0.98rem;
  color: var(--ink);
  line-height: 1.35;
  margin-bottom: 0.3rem;
}
.bookmark-desc {
  display: block;
  font-size: 0.86rem;
  color: var(--gray-700);
  line-height: 1.5;
}

/* Sticky-note style: pastel background per category */
.bookmark-tool    { background: var(--gray-200); }   /* neutral gray */
.bookmark-ai      { background: #fae8ff; }   /* pink-purple (fuchsia) */
.bookmark-finance { background: #dcfce7; }   /* mint green */
.bookmark-other   { background: #fef3c7; }   /* warm yellow */

/* ====== Academic minimal: About page ====== */
@keyframes hero-fade-up {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.about-hero {
  padding: 3rem 0 0;
}
.about-hero h1,
.about-tagline,
.about-contact {
  animation: hero-fade-up 600ms cubic-bezier(0.2, 0.6, 0.2, 1) both;
}
.about-hero h1      { animation-delay: 0ms;   }
.about-tagline      { animation-delay: 120ms; }
.about-contact      { animation-delay: 240ms; }
.about-hero h1 {
  font-size: 2rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.02em;
  margin: 0;
}
.about-tagline {
  font-size: 1.05rem;
  color: var(--gray-700);
  margin-top: 0.4rem;
}
.about-contact {
  margin-top: 1.1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.about-contact a {
  display: inline-flex;
  align-items: center;
  color: var(--gray-700);
  text-decoration: none;
  transition: color var(--motion-fast) ease, transform var(--motion-fast) ease;
}
.about-contact a:hover {
  color: var(--ink);
  text-decoration: none;
  transform: translateY(-1px);
}
.about-contact svg {
  display: block;
}

.about-bio {
  display: flex;
  gap: 2.5rem;
  align-items: flex-start;
  margin: 2.5rem 0 3rem;
}
.bio-text {
  flex: 1;
  min-width: 0;
}
.about-bio p {
  font-size: 0.98rem;
  line-height: 1.75;
  color: var(--ink-soft);
  margin-bottom: 1rem;
}
.bio-photo {
  width: 300px;
  height: 300px;
  border-radius: 0;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--gray-100);
}
@media (max-width: 700px) {
  .about-bio {
    flex-direction: column-reverse;
    gap: 1.5rem;
  }
  .bio-photo {
    width: 200px;
    height: 200px;
  }
}

.about-skills {
  margin-bottom: 3rem;
}
.skill-row {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 1rem;
  padding: 0.4rem 0;
  font-size: 0.93rem;
  line-height: 1.6;
}
.skill-label {
  color: var(--gray-500);
  font-weight: 500;
}
.skill-list {
  color: var(--ink-soft);
}
@media (max-width: 600px) {
  .skill-row {
    grid-template-columns: 1fr;
    gap: 0.1rem;
    padding: 0.6rem 0;
  }
  .skill-label {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
  }
}

/* ====== Academic minimal entry style (Experiences) ====== */
.page-header-minimal {
  padding: 3rem 0 2rem;
  margin-bottom: 1rem;
}
.page-header-minimal h1 {
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--ink);
}
.page-header-minimal p {
  color: var(--gray-500);
  margin-top: 0.4rem;
  font-size: 0.95rem;
}

.entry-section {
  margin-bottom: 3.5rem;
}
.entry-section:first-of-type {
  margin-top: 2.5rem;
}
.entry-section > h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 1.25rem;
  padding-bottom: 0;
  border-bottom: none;
  letter-spacing: -0.01em;
}

.entry {
  display: flex;
  gap: 0.9rem;
  align-items: flex-start;
  margin-bottom: 1.75rem;
}
.entry-logo {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  margin-top: 0.1rem;
  object-fit: contain;
  box-sizing: border-box;
}
/* UTokyo 图片自带留白，其他 logo 充满 PNG，所以给非 UTokyo 加内边距匹配 */
.entry-logo:not([src*="utokyo"]) {
  padding: 8px;
}
.entry-body {
  flex: 1;
  min-width: 0;
}
.entry-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
}
.entry-title {
  flex: 1;
  min-width: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.4;
}
.entry-date {
  font-size: 0.88rem;
  color: var(--gray-500);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}
.entry-meta {
  font-size: 0.9rem;
  color: var(--gray-700);
  margin-top: 0.15rem;
}
.entry-points {
  margin: 0.5rem 0 0;
  padding-left: 0;
  list-style: none;
}
.entry-points li {
  font-size: 0.92rem;
  color: var(--ink-soft);
  line-height: 1.65;
  padding-left: 1rem;
  position: relative;
}
.entry-points li::before {
  content: '·';
  position: absolute;
  left: 0.15rem;
  color: var(--gray-400);
  font-weight: 700;
}

/* 一段工作下的子项目：和普通条目共用同一套要点样式，只多一个小标题 */
.entry-projects {
  margin-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}
.entry-project-title {
  font-family: inherit;   /* 不用 Fraunces，和条目正文同字体 */
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--ink);
  margin: 0;
}
.entry-project .entry-points {
  margin-top: 0.25rem;
}

/* ====== Footer ====== */
footer {
  text-align: center;
  padding: 2rem 0;
  color: var(--muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
}

/* ====== Daily (timeline feed) ====== */
.daily-feed {
  max-width: 640px;
  margin: 0 auto;
  padding: 2rem 0 4rem;
}
.daily-header {
  margin-bottom: 3rem;
  text-align: center;
}
.daily-title {
  font-family: var(--font-display);
  font-size: 2.4rem;
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 0.6rem;
  letter-spacing: -0.02em;
}
.daily-subtitle {
  color: var(--gray-500);
  font-size: 0.95rem;
  margin: 0;
}
.daily-empty {
  text-align: center;
  color: var(--gray-500);
  padding: 4rem 0;
  font-size: 0.95rem;
}
.daily-day {
  margin-top: 3.5rem;
  padding-top: 3.5rem;
  border-top: 1px solid var(--gray-300);
}
.daily-day:first-of-type {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}
.daily-day-header {
  font-size: 1.15rem;
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 1.4rem;
  letter-spacing: -0.01em;
}
/* Times within a day (rendered from `## HH:MM` in the daily file).
   The h2 also acts as the visual boundary between consecutive thoughts
   in the same day — subtle top divider + tabular-nums timestamp. */
.daily-day-body h2 {
  font-size: 0.82rem;
  font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  color: var(--gray-500);
  font-weight: 500;
  margin: 2.2rem 0 0.5rem;
  padding-top: 1.6rem;
  border-top: 1px dashed var(--gray-200);
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}
.daily-day-body > h2:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}
.daily-day-body p {
  margin: 0.4rem 0;
  color: var(--ink);
  line-height: 1.7;
}
.daily-day-body ul,
.daily-day-body ol {
  padding-left: 1.4rem;
  margin: 0.4rem 0;
  color: var(--ink);
  line-height: 1.7;
}
.daily-day-body code {
  background: var(--gray-100);
  padding: 0.1em 0.3em;
  border-radius: var(--radius-sm);
  font-size: 0.9em;
}
.daily-day-body pre {
  background: #f6f8fa;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 0.8rem 1rem;
  overflow-x: auto;
  font-size: 0.85rem;
  margin: 0.6rem 0;
}
.daily-day-body a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.daily-day-body blockquote {
  border-left: 3px solid var(--gray-300);
  margin: 0.6rem 0;
  padding: 0.1rem 0 0.1rem 0.9rem;
  color: var(--gray-700);
}
.daily-day-body img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-md);
  margin: 0.7rem 0;
}
/* When multiple images appear in the same thought, tighten their vertical
   rhythm so they group visually. */
.daily-day-body p:has(> img):has(+ p:has(> img)) img {
  margin-bottom: 0.35rem;
}

/* Responsive */
@media (max-width: 600px) {
  .site-header nav .container { flex-direction: column; gap: 0.8rem; }
  .site-header nav .nav-links a { margin-left: 1rem; }
  .hero h1 { font-size: 1.8rem; }
  .bookmark-grid { grid-template-columns: 1fr; }
  .daily-feed { padding: 1rem 0 3rem; }
  .daily-title { font-size: 1.9rem; }
}
