/* ─── Reset & Variables ─── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --text: #1a1a1a;
  --text-secondary: #666;
  --bg: #fff;
  --link: #1a1a1a;
  --link-hover: #555;
  --border: #e0e0e0;
  --code-bg: #f5f5f5;
  --max-width: 660px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.75;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2.5rem 1.5rem;
}

/* ─── Navigation ─── */
nav {
  display: flex;
  align-items: baseline;
  gap: 1.5rem;
  margin-bottom: 3rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

nav .site-name {
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--text);
  text-decoration: none;
  margin-right: auto;
}

nav .site-name:hover {
  color: var(--text-secondary);
}

nav a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.95rem;
  transition: color 0.15s;
}

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

/* ─── Typography ─── */
h1 {
  font-size: 1.6rem;
  font-weight: 600;
  margin-bottom: 1rem;
  line-height: 1.3;
}

h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-top: 2.5rem;
  margin-bottom: 0.75rem;
  line-height: 1.35;
}

h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin-top: 2rem;
  margin-bottom: 0.5rem;
}

h4 {
  font-size: 1rem;
  font-weight: 600;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}

p {
  margin-bottom: 1rem;
}

a {
  color: var(--link);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  transition: color 0.15s;
}

a:hover {
  color: var(--link-hover);
}

strong {
  font-weight: 600;
}

/* ─── Lists ─── */
ul, ol {
  margin-bottom: 1rem;
  padding-left: 1.5rem;
}

li {
  margin-bottom: 0.35rem;
}

li > ul, li > ol {
  margin-top: 0.35rem;
  margin-bottom: 0.35rem;
}

/* ─── Horizontal Rule ─── */
hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

/* ─── Code ─── */
code {
  background: var(--code-bg);
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  font-size: 0.88em;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', 'Monaco', monospace;
}

pre {
  background: var(--code-bg);
  padding: 1rem 1.25rem;
  border-radius: 6px;
  overflow-x: auto;
  margin-bottom: 1.25rem;
  font-size: 0.85em;
  line-height: 1.6;
}

pre code {
  background: none;
  padding: 0;
  border-radius: 0;
}

/* ─── Blockquote ─── */
blockquote {
  border-left: 3px solid var(--border);
  padding-left: 1rem;
  margin: 1.25rem 0;
  color: var(--text-secondary);
  font-style: italic;
}

/* ─── Tables ─── */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.25rem 0;
  font-size: 0.9em;
}

th, td {
  padding: 0.6rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  font-weight: 600;
  border-bottom: 2px solid var(--border);
}

/* ─── Images ─── */
img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
}

.post-image {
  margin: 1.5rem 0;
}

/* ─── Profile Section ─── */
.profile-section {
  display: flex;
  align-items: flex-start;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

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

.intro-text {
  font-size: 1.05rem;
}

/* ─── Contact Links ─── */
.contact-links {
  display: flex;
  gap: 1.25rem;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

.contact-links a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
}

.contact-links a:hover {
  color: var(--text);
}

.contact-links svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}

/* ─── Writing List ─── */
.writing-list {
  list-style: none;
  padding: 0;
}

.writing-list li {
  margin-bottom: 2rem;
}

.writing-list .post-title {
  font-weight: 600;
  font-size: 1.05rem;
  text-decoration: none;
  color: var(--text);
}

.writing-list .post-title:hover {
  text-decoration: underline;
}

.writing-list .post-tag {
  display: inline-block;
  font-size: 0.75rem;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0.1rem 0.45rem;
  margin-left: 0.5rem;
  vertical-align: middle;
  font-weight: 400;
}

.writing-list .post-description {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-top: 0.3rem;
  line-height: 1.6;
}

/* ─── Books List ─── */
.books-list {
  list-style: none;
  padding: 0;
}

.books-list li {
  padding: 0.2rem 0;
  color: var(--text);
}

.books-list li::before {
  content: "– ";
  color: var(--text-secondary);
}

.book-links {
  font-size: 0.85em;
  color: var(--text-secondary);
}

.book-links a {
  color: var(--text-secondary);
  text-decoration: none;
}

.book-links a:hover {
  color: var(--text);
  text-decoration: underline;
}

/* ─── Post Page ─── */
.post-header {
  margin-bottom: 2rem;
}

.post-meta {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-top: 0.25rem;
}

.post-note {
  background: var(--code-bg);
  border-radius: 6px;
  padding: 0.75rem 1rem;
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
  font-style: italic;
}

.back-link {
  display: inline-block;
  margin-bottom: 1.5rem;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
}

.back-link:hover {
  color: var(--text);
}

.back-link::before {
  content: "← ";
}

/* ─── References ─── */
.references {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.references p {
  margin-bottom: 0.5rem;
  padding-left: 2rem;
  text-indent: -2rem;
}

sup a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.8em;
}

sup a:hover {
  text-decoration: underline;
}

/* ─── Mermaid ─── */
.mermaid {
  margin: 1.5rem 0;
  text-align: center;
}

/* ─── KaTeX overrides ─── */
.katex-display {
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0.5rem 0;
}

/* ─── Responsive ─── */
@media (max-width: 600px) {
  .container {
    padding: 1.5rem 1rem;
  }

  nav {
    flex-wrap: wrap;
    gap: 0.75rem;
  }

  .profile-section {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  h1 { font-size: 1.35rem; }
  h2 { font-size: 1.1rem; }

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

  table {
    font-size: 0.8em;
  }

  th, td {
    padding: 0.4rem 0.5rem;
  }
}



