@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;1,9..40,300;1,9..40,400&display=swap');

:root {
  --bg:        #F4EFE6;
  --text:      #2A2A2A;
  --text-muted:#7A7A7A;
  --border:    #D8D0C4;
  --red:       #B03A2E;
  --blue:      #2C5F8A;
  --yellow:    #C8960C;
  --font-head: 'DM Sans', system-ui, sans-serif;
  --font-body: 'DM Sans', system-ui, sans-serif;
}

.dark {
  --bg:        #0F0F0F;
  --text:      #E8E2D9;
  --text-muted:#6B6560;
  --border:    #2A2520;
  --red:       #C0504A;
  --blue:      #4A80AA;
  --yellow:    #D4A820;
}

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

html {
  background-color: var(--bg);
  background-image: radial-gradient(var(--border) 1px, transparent 1px);
  background-size: 24px 24px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 18px;
  line-height: 1.7;
}

body {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 48px;
}

/* Typography */
h1, h2, h3 {
  font-family: var(--font-head);
  line-height: 1.25;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.4rem; }

a {
  color: var(--blue);
  text-decoration: none;
}
a:hover { text-decoration: underline; }

/* Nav */
nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 36px 0;
  margin-bottom: 48px;
}

.nav-logo {
  color: var(--text);
  display: flex;
  align-items: center;
}
.nav-logo:hover { opacity: 0.7; text-decoration: none; }

.nav-right {
  display: flex;
  align-items: center;
  gap: 32px;
}

.nav-links {
  display: flex;
  gap: 28px;
  list-style: none;
}

.nav-links a {
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 0.9rem;
}

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

.nav-icons {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-icon {
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  transition: color 0.15s;
}

.nav-icon:hover { color: var(--text); }

/* sun/moon toggle logic */
.dark .icon-sun  { display: none; }
.icon-moon       { display: none; }
.dark .icon-moon { display: block; }

/* Homepage hero */
.home-hero {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 64px;
  align-items: center;
  min-height: 60vh;
}

.photo-placeholder {
  width: 100%;
  aspect-ratio: 3 / 4;
  background: var(--border);
  border-radius: 4px;
}

.home-bio h1 {
  font-size: 2rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 24px;
}

.home-bio p {
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1.75;
  margin-bottom: 16px;
}

.home-bio p strong { color: var(--text); font-weight: 500; }

.home-bio p a {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.home-contact {
  display: flex;
  gap: 20px;
  margin-top: 8px;
}

.home-contact-link {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted) !important;
  font-size: 0.88rem;
  text-decoration: none !important;
}

.home-contact-link:hover { color: var(--text) !important; }

/* Thoughts page */
.thoughts-page {
  display: flex;
  flex-direction: column;
  gap: 48px;
}

.thoughts-year {
  display: flex;
  gap: 48px;
}

.year-label {
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--text-muted);
  width: 48px;
  flex-shrink: 0;
  padding-top: 4px;
}

.thoughts-list {
  list-style: decimal;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.thought-link {
  color: var(--text);
  font-size: 0.95rem;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--border);
}

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

/* Post list */
.post-list {
  list-style: none;
  border-top: 1px solid var(--border);
}

.post-item {
  display: grid;
  grid-template-columns: 90px 1fr auto;
  align-items: center;
  gap: 24px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.post-date {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 300;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.post-title {
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 400;
  letter-spacing: -0.01em;
}

.post-title:hover { color: var(--blue); text-decoration: none; }

.post-tags {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.post-tag {
  font-size: 0.68rem;
  padding: 2px 7px;
  border-radius: 2px;
  font-weight: 500;
  letter-spacing: 0.03em;
  text-transform: lowercase;
}

.tag-red    { background: #9E4540; color: #fff; }
.tag-blue   { background: #2C5F8A; color: #fff; }
.tag-yellow { background: #A8820E; color: #fff; }
.tag-dark   { background: #3A3530; color: #F0EBE2; }

/* collection tags (home page only) */
.tag-blog     { background: var(--blue);   color: #fff; }
.tag-thoughts { background: var(--yellow); color: #fff; }

/* Article — simple mode */
.article-header {
  margin-bottom: 48px;
  max-width: 680px;
}

.article-header h1 {
  font-size: 1.8rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  margin-bottom: 10px;
  line-height: 1.3;
}

.article-meta {
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 300;
  letter-spacing: 0.02em;
}

.article-body {
  max-width: 680px;
}

.article-body p   { margin-bottom: 1.4em; }
.article-body h2  { margin: 2em 0 0.6em; font-size: 1.15rem; font-weight: 500; }
.article-body h3  { margin: 1.6em 0 0.4em; font-size: 1rem; font-weight: 500; }
.article-body blockquote {
  border-left: 2px solid var(--red);
  padding-left: 20px;
  color: var(--text-muted);
  font-style: italic;
  margin: 1.5em 0;
}

/* Article — TOC mode */
.article-toc-layout {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 64px;
  align-items: start;
}

.article-sidebar {
  position: sticky;
  top: 32px;
}

.article-sidebar .toc-label {
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.toc-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toc-list a {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.toc-list a:hover { color: var(--text); text-decoration: none; }

.toc-list .toc-h3 { padding-left: 12px; font-size: 0.78rem; }

.article-toc-content .article-header { margin-bottom: 40px; }
.article-toc-content .article-body   { max-width: 100%; }

/* Footer */
footer {
  margin: 80px 0 40px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.85rem;
  display: flex;
  justify-content: space-between;
}
