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

:root {
  --bg: #faf9f6;
  --text: #1a1a1a;
  --text-muted: #6b6b6b;
  --accent: #c0392b;
  --border: #e0ddd8;
  --code-bg: #f0eeea;
  --font-body: 'Newsreader', Georgia, serif;
  --font-mono: 'JetBrains Mono', monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151515;
    --text: #e0ddd8;
    --text-muted: #8a8a8a;
    --accent: #e74c3c;
    --border: #2a2a2a;
    --code-bg: #1e1e1e;
  }
}

html { font-size: 18px; }

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

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

/* === Header === */
.site-header {
  margin-bottom: 3rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.site-title {
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.02em;
}

.site-title:hover { color: var(--accent); }

.site-header-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.site-nav {
  display: flex;
  gap: 1.2rem;
}

.site-nav a {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-decoration: none;
  letter-spacing: 0.02em;
}

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

.site-tagline {
  margin-top: 0.3rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  font-style: italic;
}

/* === Post List (homepage) === */
.post-list {
  list-style: none;
}

.post-list li {
  padding: 1.2rem 0;
  border-bottom: 1px solid var(--border);
}

.post-list li:last-child { border-bottom: none; }

.post-list-date {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 0.2rem;
}

.post-list-title {
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.post-list-title a {
  color: var(--text);
  text-decoration: none;
}

.post-list-title a:hover {
  color: var(--accent);
}

.post-list-excerpt {
  margin-top: 0.3rem;
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* === Single Post === */
.post-header { margin-bottom: 2rem; }

.post-date {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

.post-title {
  font-size: 2rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.03em;
}

.post-content p { margin-bottom: 1.3rem; }

.post-content h2 {
  font-size: 1.3rem;
  font-weight: 600;
  margin: 2.5rem 0 0.8rem;
  letter-spacing: -0.02em;
}

.post-content h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 2rem 0 0.6rem;
}

.post-content a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.post-content blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 1rem;
  margin: 1.5rem 0;
  color: var(--text-muted);
  font-style: italic;
}

.post-content code {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  background: var(--code-bg);
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
}

.post-content pre {
  background: var(--code-bg);
  padding: 1rem;
  border-radius: 4px;
  overflow-x: auto;
  margin: 1.5rem 0;
}

.post-content pre code {
  background: none;
  padding: 0;
}

.post-content ul, .post-content ol {
  margin: 1rem 0 1.3rem 1.5rem;
}

.post-content li { margin-bottom: 0.3rem; }

.post-content img {
  max-width: 100%;
  border-radius: 4px;
  margin: 1.5rem 0;
}

.post-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

/* === Navigation === */
.post-nav {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.post-nav a {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-decoration: none;
}

.post-nav a:hover { color: var(--accent); }

/* === Footer === */
.site-footer {
  margin-top: 4rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* === CV Page === */
.cv-header {
  margin-bottom: 2.5rem;
}

.cv-name {
  font-size: 2rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.03em;
  margin-bottom: 0.3rem;
}

.cv-tagline {
  font-size: 1rem;
  color: var(--text-muted);
  font-style: italic;
  margin-bottom: 1rem;
}

.cv-contact {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 1.2rem;
}

.cv-contact a {
  color: var(--text-muted);
  text-decoration: none;
}

.cv-contact a:hover { color: var(--accent); }

.cv-section {
  margin-bottom: 2.5rem;
}

.cv-section-title {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 1rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
}

.cv-entry {
  margin-bottom: 1.5rem;
}

.cv-entry:last-child { margin-bottom: 0; }

.cv-entry-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-bottom: 0.2rem;
}

.cv-entry-title {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.cv-entry-date {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.cv-entry-org {
  font-size: 0.88rem;
  color: var(--text-muted);
  font-style: italic;
  margin-bottom: 0.4rem;
}

.cv-entry-desc {
  font-size: 0.88rem;
  line-height: 1.6;
  color: var(--text);
}

.cv-entry-desc p { margin-bottom: 0.5rem; }
.cv-entry-desc p:last-child { margin-bottom: 0; }

.cv-skills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.cv-skill {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-muted);
  background: var(--code-bg);
  padding: 0.2rem 0.6rem;
  border-radius: 3px;
}

.cv-overview {
  display: block;
  width: 100%;
  margin-bottom: 2rem;
}

.cv-download {
  margin-top: 2rem;
}

.cv-download a {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  text-decoration: none;
  border: 1px solid var(--border);
  padding: 0.4rem 0.8rem;
  border-radius: 3px;
}

.cv-download a:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* === About Page === */
.about {
  padding-top: 0.5rem;
}

.about-hero {
  margin-bottom: 3rem;
  padding-bottom: 2.5rem;
  border-bottom: 1px solid var(--border);
}

.about-name {
  font-size: 2.4rem;
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1.1;
  margin-bottom: 0.4rem;
}

.about-name-chinese {
  font-weight: 400;
  color: var(--text-muted);
  font-size: 1.8rem;
  margin-left: 0.3rem;
}

.about-tagline {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 1.4rem;
}

.about-welcome {
  font-size: 1.05rem;
  color: var(--text-muted);
  font-style: italic;
  max-width: 42ch;
}

.about-body {
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

.about-section p {
  margin-bottom: 1rem;
  max-width: 62ch;
  font-size: 1rem;
  line-height: 1.75;
}

.about-section p:last-child { margin-bottom: 0; }

.about-section p a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.about-section-title {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 1rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
}

.about-links {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.about-link {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  padding: 0.8rem 0;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
  transition: color 0.15s;
}

.about-link:first-child {
  border-top: 1px solid var(--border);
}

.about-link:hover { color: var(--accent); }
.about-link:hover .about-link-label { color: var(--accent); }

.about-link-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text);
  white-space: nowrap;
  min-width: 8rem;
  transition: color 0.15s;
}

.about-link-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
}

/* === Thoughts intro === */
.thoughts-intro {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.thoughts-intro p {
  font-size: 0.92rem;
  color: var(--text-muted);
  font-style: italic;
}

/* === Comments (Cusdis) === */
.post-comments {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.comments-title {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

/* === Email subscription (Buttondown) === */
.subscribe {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.subscribe-label {
  font-size: 0.92rem;
  color: var(--text-muted);
  font-style: italic;
  margin-bottom: 0.85rem;
}

.subscribe-form {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.subscribe-form input[type="email"] {
  flex: 1 1 14rem;
  padding: 0.5rem 0.7rem;
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 3px;
}

.subscribe-form input[type="email"]:focus {
  outline: none;
  border-color: var(--accent);
}

.subscribe-form button {
  padding: 0.5rem 1rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.03em;
  color: var(--bg);
  background: var(--text);
  border: none;
  border-radius: 3px;
  cursor: pointer;
  transition: background 0.15s;
}

.subscribe-form button:hover { background: var(--accent); }
