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

/* ===== DESIGN TOKENS ===== */
:root {
  --bg: #fafaf9;
  --bg-secondary: #f3f3f1;
  --text: #2c2c2c;
  --text-muted: #777;
  --accent: #5a7d5a;
  --accent-hover: #4a6a4a;
  --border: #e5e5e5;
  --nav-hover-bg: rgba(90, 125, 90, 0.06);
  --font: 'Inter', system-ui, -apple-system, sans-serif;
  --content-width: 680px;
  --transition: 0.25s ease;
}

[data-theme="dark"] {
  --bg: #161616;
  --bg-secondary: #1e1e1e;
  --text: #d8d8d8;
  --text-muted: #888;
  --accent: #8fb88f;
  --accent-hover: #a3cca3;
  --border: #2a2a2a;
  --nav-hover-bg: rgba(143, 184, 143, 0.08);
}

/* ===== BASE ===== */
html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  font-size: 16px;
  transition: background var(--transition), color var(--transition);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

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

::selection {
  background: var(--accent);
  color: #fff;
}

/* ===== HEADER ===== */
.site-header {
  width: 100%;
  padding: 2.5rem 2rem 2rem;
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 2rem;
}

.site-identity h1 {
  font-size: 1.4rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
  line-height: 1.3;
}

.site-identity h1 a {
  color: var(--text);
  text-decoration: none;
}

.site-identity h1 a:hover {
  color: var(--accent);
}

.site-subtitle {
  font-size: 0.88rem;
  color: var(--text-muted);
  font-weight: 400;
  margin-top: 0.2rem;
  letter-spacing: 0.02em;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.site-nav a {
  display: inline-block;
  padding: 0.3rem 0.7rem;
  font-size: 0.92rem;
  font-weight: 400;
  color: var(--text-muted);
  border-radius: 6px;
  transition: color var(--transition), background var(--transition);
}

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

.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  cursor: pointer;
  font-size: 1rem;
  padding: 0.35rem 0.55rem;
  border-radius: 8px;
  margin-left: 0.5rem;
  transition: background var(--transition), border-color var(--transition);
  line-height: 1;
  color: var(--text);
}

.theme-toggle:hover {
  background: var(--nav-hover-bg);
  border-color: var(--accent);
}

/* ===== DIVIDER ===== */
.header-divider {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 2rem;
}

.header-divider hr {
  border: none;
  border-top: 1px solid var(--border);
  transition: border-color var(--transition);
}

/* ===== MAIN CONTENT ===== */
.site-main {
  flex: 1;
  max-width: var(--content-width);
  width: 100%;
  margin: 0 auto;
  padding: 2.5rem 2rem 4rem;
}

/* ===== HOME PAGE ===== */
.home-intro {
  font-size: 1.08rem;
  line-height: 1.8;
  margin-bottom: 3rem;
  color: var(--text);
}

.home-intro p {
  margin-bottom: 1rem;
}

.section-index {
  margin-top: 2rem;
}

.section-index-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--border);
  transition: border-color var(--transition);
}

.section-index-item:first-child {
  border-top: 1px solid var(--border);
}

.section-index-item a {
  font-size: 1.02rem;
  font-weight: 500;
  color: var(--text);
  transition: color var(--transition);
}

.section-index-item a:hover {
  color: var(--accent);
}

.section-index-item .item-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  flex-shrink: 0;
  margin-left: 1rem;
}

/* ===== LIST PAGES (Essays, Life) ===== */
.page-heading {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
  letter-spacing: -0.01em;
}

.page-description {
  font-size: 0.92rem;
  color: var(--text-muted);
  margin-bottom: 2.5rem;
  line-height: 1.6;
}

.post-list {
  list-style: none;
}

.post-item {
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
  transition: border-color var(--transition);
}

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

.post-item-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.post-item-title {
  font-size: 1.02rem;
  font-weight: 500;
}

.post-item-title a {
  color: var(--text);
  transition: color var(--transition);
}

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

.post-item-date {
  font-size: 0.82rem;
  color: var(--text-muted);
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.post-item-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
  line-height: 1.5;
}

.post-item-tag {
  display: inline-block;
  font-size: 0.75rem;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  background: var(--nav-hover-bg);
  color: var(--accent);
  font-weight: 500;
  margin-top: 0.35rem;
  margin-right: 0.3rem;
}

/* ===== POST SINGLE ===== */
.post-header {
  margin-bottom: 2rem;
}

.post-meta {
  margin-top: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.post-body {
  font-size: 1.05rem;
  line-height: 1.8;
}

.post-body p {
  margin-bottom: 1.2rem;
}

.post-body h2 {
  font-size: 1.15rem;
  font-weight: 600;
  margin-top: 2.5rem;
  margin-bottom: 0.8rem;
}

.post-body h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin-top: 2rem;
  margin-bottom: 0.6rem;
}

.post-body ul, .post-body ol {
  padding-left: 1.5rem;
  margin-bottom: 1.2rem;
}

.post-body li {
  margin-bottom: 0.4rem;
}

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

.post-body code {
  font-size: 0.9em;
  background: var(--bg-secondary);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-family: 'SF Mono', 'Fira Code', monospace;
}

.post-body pre {
  background: var(--bg-secondary);
  padding: 1rem 1.2rem;
  border-radius: 8px;
  overflow-x: auto;
  margin-bottom: 1.2rem;
}

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

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

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

/* ===== ABOUT PAGE ===== */
.about-content {
  font-size: 1.05rem;
  line-height: 1.8;
}

.about-content p {
  margin-bottom: 1.2rem;
}

.about-content h2 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-top: 2.5rem;
  margin-bottom: 0.8rem;
  color: var(--text);
}

.about-content ul {
  list-style: none;
  padding: 0;
}

.about-content ul li {
  padding: 0.3rem 0;
  padding-left: 1.2rem;
  position: relative;
}

.about-content ul li::before {
  content: '·';
  position: absolute;
  left: 0;
  color: var(--accent);
  font-weight: 700;
  font-size: 1.2rem;
  line-height: 1.6;
}

.about-photo {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  object-fit: cover;
  float: right;
  margin: 0 0 1rem 1.5rem;
  border: 2px solid var(--border);
  transition: border-color var(--transition);
}

/* ===== PROJECTS PAGE ===== */
.project-item {
  padding: 1.1rem 0;
  border-bottom: 1px solid var(--border);
  transition: border-color var(--transition);
}

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

.project-item-header {
  display: flex;
  align-items: baseline;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.project-item-title {
  font-size: 1.02rem;
  font-weight: 500;
}

.project-item-title a {
  color: var(--text);
}

.project-item-title a:hover {
  color: var(--accent);
}

.project-item-links {
  display: flex;
  gap: 0.6rem;
}

.project-item-links a {
  font-size: 0.82rem;
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  transition: all var(--transition);
}

.project-item-links a:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.project-item-desc {
  font-size: 0.92rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
  line-height: 1.5;
}

/* ===== BOOKSHELF ===== */
.book-item {
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--border);
}

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

.book-title {
  font-size: 1.02rem;
  font-weight: 500;
  color: var(--text);
}

.book-author {
  font-size: 0.88rem;
  color: var(--text-muted);
}

.book-note {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
  font-style: italic;
}

.book-status {
  display: inline-block;
  font-size: 0.72rem;
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
  font-weight: 500;
  margin-left: 0.5rem;
  vertical-align: middle;
}

.book-status.reading {
  background: rgba(90, 125, 90, 0.12);
  color: var(--accent);
}

.book-status.finished {
  background: rgba(90, 125, 90, 0.06);
  color: var(--text-muted);
}

/* ===== FOOTER ===== */
.site-footer {
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem 2rem 2rem;
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.site-footer a {
  color: var(--text-muted);
}

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

/* ===== MOBILE ===== */
@media (max-width: 640px) {
  .site-header {
    flex-direction: column;
    gap: 1rem;
    padding: 1.8rem 1.25rem 1.2rem;
  }

  .site-nav {
    justify-content: flex-start;
    gap: 0;
  }

  .site-nav a {
    padding: 0.3rem 0.55rem;
    font-size: 0.88rem;
  }

  .theme-toggle {
    margin-left: 0.2rem;
  }

  .header-divider {
    padding: 0 1.25rem;
  }

  .site-main {
    padding: 1.8rem 1.25rem 3rem;
  }

  .section-index-item {
    flex-direction: column;
    gap: 0.15rem;
  }

  .section-index-item .item-desc {
    margin-left: 0;
  }

  .post-item-header {
    flex-direction: column;
    gap: 0.15rem;
  }

  .about-photo {
    float: none;
    margin: 0 0 1.5rem 0;
    display: block;
  }

  .site-footer {
    padding: 1.5rem 1.25rem 2rem;
  }
}