/* AstroPaper Inspired Minimalist CSS */
:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  
  /* Light Theme */
  --bg-color: #fbfbfb;
  --text-color: #282727;
  --heading-color: #111111;
  --accent-color: #049fd9;
  --accent-hover: #005073;
  --border-color: #e5e7eb;
  --card-bg: #ffffff;
  --code-bg: #f3f4f6;
  --muted-text: #6b7280;
  --tag-bg: #f3f4f6;
  --surface-bg: #edeff3;

  /* Code syntax highlighting (light) */
  --code-keyword: #b91c1c;
  --code-string: #047857;
  --code-number: #b45309;
  --code-function: #1d4ed8;
  --code-comment: #8a8f98;
  --code-class: #7c3aed;
  --code-punctuation: #57606a;
}

[data-theme="dark"] {
  --bg-color: #161618;
  --text-color: #e4e4e7;
  --heading-color: #ffffff;
  --accent-color: #38bdf8;
  --accent-hover: #7dd3fc;
  --border-color: #27272a;
  --card-bg: #1f1f23;
  --code-bg: #27272a;
  --muted-text: #9ca3af;
  --tag-bg: #27272a;
  --surface-bg: #2c2c31;

  /* Code syntax highlighting (dark) */
  --code-keyword: #f472b6;
  --code-string: #a3e635;
  --code-number: #fbbf24;
  --code-function: #38bdf8;
  --code-comment: #7d7d85;
  --code-class: #c4b5fd;
  --code-punctuation: #9ca3af;
}

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

html { overflow-x: hidden; }

img { max-width: 100%; height: auto; }

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 24px 0;
  border-radius: 6px;
}

.table-scroll table {
  width: auto !important;
  min-width: 100%;
  margin: 0 !important;
}

.table-scroll th,
.table-scroll td {
  white-space: nowrap;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-color);
  color: var(--text-color);
  line-height: 1.7;
  transition: background-color 0.2s ease, color 0.2s ease;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  max-width: 800px;
  width: 100%;
  margin: 0 auto;
  padding: 0 24px;
}

header {
  border-bottom: 1px dashed var(--border-color);
  padding: 32px 0 24px 0;
}

.nav-wrapper {
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
}

.site-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--heading-color);
  text-decoration: none;
  letter-spacing: -0.5px;
}

.site-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
}

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

nav {
  display: flex;
  align-items: center;
  gap: 20px;
}

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

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

.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-color);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 4px;
}
.theme-toggle:hover { color: var(--accent-color); }

.menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-color);
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 4px;
  flex: 0 0 auto;
}
.menu-toggle:hover { color: var(--accent-color); }

.hero {
  padding: 48px 0 36px 0;
  border-bottom: 1px dashed var(--border-color);
}

.hero h1 {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--heading-color);
  margin-bottom: 12px;
  letter-spacing: -0.8px;
}

.hero p {
  font-size: 1.08rem;
  color: var(--text-color);
  margin-bottom: 18px;
}

.social-links {
  display: flex;
  gap: 18px;
  margin-top: 15px;
  flex-wrap: wrap;
}

.social-links a {
  color: var(--muted-text);
  text-decoration: none;
  font-size: 0.9rem;
  font-family: var(--font-mono);
  transition: color 0.15s ease;
}

.social-links a:hover { color: var(--accent-color); }

section { padding: 40px 0; }

h2.section-title {
  font-size: 1.35rem;
  font-family: var(--font-mono);
  color: var(--heading-color);
  margin-bottom: 24px;
  display: flex;
  align-items: center;
}

h2.section-title::after {
  content: "";
  flex: 1;
  height: 1px;
  border-bottom: 1px dashed var(--border-color);
  margin-left: 16px;
}

.post-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.post-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.post-item.has-thumb {
  flex-direction: row;
  gap: 20px;
  align-items: flex-start;
}

.post-thumb {
  flex: 0 0 auto;
  width: auto;
  height: auto;
  max-width: 260px;
  max-height: 140px;
  object-fit: contain;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  display: block;
}

.post-item.has-thumb .post-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

@media (max-width: 640px) {
  .post-item.has-thumb {
    flex-direction: column;
  }
  .post-thumb {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 180px;
  }
}

.timeline-entry {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 20px;
}

.timeline-icon {
  flex: 0 0 auto;
  height: 40px;
  width: auto;
  max-width: 96px;
  object-fit: contain;
  border-radius: 6px;
  background: var(--code-bg);
  border: 1px solid var(--border-color);
  padding: 6px 8px;
}

.timeline-entry p {
  margin: 0;
}

.post-title {
  font-size: 1.2rem;
  font-weight: 600;
}

.post-title a {
  color: var(--heading-color);
  text-decoration: none;
  transition: color 0.15s ease;
}

.post-title a:hover {
  color: var(--accent-color);
  text-decoration: underline;
  text-decoration-style: dashed;
}

.post-meta {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--muted-text);
  display: flex;
  align-items: center;
  gap: 12px;
}

.post-desc {
  font-size: 0.98rem;
  color: var(--text-color);
}

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

.tag {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--muted-text);
  background: var(--tag-bg);
  padding: 3px 9px;
  border-radius: 4px;
  text-decoration: none;
  transition: all 0.15s ease;
}

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

.card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  padding: 22px;
  border-radius: 6px;
  transition: border-color 0.2s ease;
}

.card:hover { border-color: var(--accent-color); }

.card h3 {
  font-size: 1.15rem;
  color: var(--heading-color);
  margin-bottom: 8px;
}

.card h3 a { color: inherit; text-decoration: none; }
.card h3 a:hover { color: var(--accent-color); }

.card p {
  font-size: 0.95rem;
  color: var(--text-color);
  margin-bottom: 12px;
}

.card-meta {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--muted-text);
}

article { padding: 40px 0; }

article h1 {
  font-size: 2.3rem;
  color: var(--heading-color);
  line-height: 1.3;
  margin-bottom: 12px;
  letter-spacing: -0.5px;
}

.article-meta {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--muted-text);
  padding-bottom: 20px;
  margin-bottom: 30px;
  border-bottom: 1px dashed var(--border-color);
}

.article-content h2 {
  font-size: 1.5rem;
  color: var(--heading-color);
  margin: 36px 0 16px 0;
}

.article-content h3 {
  font-size: 1.25rem;
  color: var(--heading-color);
  margin: 28px 0 12px 0;
}

.article-content p { margin-bottom: 20px; font-size: 1.05rem; text-align: justify; text-justify: inter-word; }

.article-content ul, .article-content ol {
  margin: 16px 0 24px 28px;
}

.article-content li { margin-bottom: 8px; }

.article-content pre {
  background: var(--surface-bg);
  border: 1px solid var(--border-color);
  padding: 18px;
  border-radius: 6px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  margin: 24px 0;
  line-height: 1.5;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.article-content code {
  font-family: var(--font-mono);
  background: var(--code-bg);
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 0.9em;
}

.callout {
  background: var(--surface-bg);
  border-left: 4px solid var(--accent-color);
  padding: 16px 20px;
  border-radius: 4px;
  margin: 24px 0;
  font-size: 0.98rem;
}

footer {
  margin-top: auto;
  border-top: 1px dashed var(--border-color);
  padding: 32px 0;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--muted-text);
}

footer a { color: var(--text-color); text-decoration: none; }
footer a:hover { color: var(--accent-color); }

@media (max-width: 640px) {
  .hero h1 { font-size: 1.8rem; }

  .article-content p {
    text-align: left;
    text-justify: auto;
  }

  .menu-toggle {
    display: flex;
  }

  #site-nav {
    position: absolute;
    top: calc(100% + 1px);
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 8px 8px;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transition: max-height 0.25s ease, opacity 0.2s ease;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.08);
    z-index: 50;
  }

  #site-nav.nav-open {
    max-height: 420px;
    opacity: 1;
    visibility: visible;
    padding: 4px 0;
  }

  #site-nav a {
    width: 100%;
    padding: 14px 24px;
    font-size: 1rem;
    border-bottom: 1px dashed var(--border-color);
  }

  #site-nav .theme-toggle {
    margin: 6px 24px;
    align-self: flex-start;
  }

  .menu-toggle.is-active svg line:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
  }
  .menu-toggle.is-active svg line:nth-child(2) {
    opacity: 0;
  }
  .menu-toggle.is-active svg line:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
  }
  .menu-toggle svg line {
    transform-origin: center;
    transition: transform 0.2s ease, opacity 0.2s ease;
  }
}
