/* ===== VARIABLES ===== */
:root {
  --bg: #fafaf9;
  --bg-card: #ffffff;
  --text: #1c1917;
  --text-secondary: #57534e;
  --text-tertiary: #a8a29e;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --border: #e7e5e4;
  --tag-bg: #f5f5f4;
  --tag-text: #57534e;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 2px 8px rgba(0,0,0,0.06);
  --code-bg: #f5f5f4;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1a1a1a;
    --bg-card: #242424;
    --text: #e7e5e4;
    --text-secondary: #a8a29e;
    --text-tertiary: #78716c;
    --accent: #60a5fa;
    --accent-hover: #93bbfd;
    --border: #333333;
    --tag-bg: #2a2a2a;
    --tag-text: #a8a29e;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.2);
    --shadow-md: 0 2px 8px rgba(0,0,0,0.3);
    --code-bg: #2a2a2a;
  }
}

/* User-override: explicit light */
[data-theme="light"] {
  --bg: #fafaf9;
  --bg-card: #ffffff;
  --text: #1c1917;
  --text-secondary: #57534e;
  --text-tertiary: #a8a29e;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --border: #e7e5e4;
  --tag-bg: #f5f5f4;
  --tag-text: #57534e;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 2px 8px rgba(0,0,0,0.06);
  --code-bg: #f5f5f4;
}

/* User-override: explicit dark */
[data-theme="dark"] {
  --bg: #1a1a1a;
  --bg-card: #242424;
  --text: #e7e5e4;
  --text-secondary: #a8a29e;
  --text-tertiary: #78716c;
  --accent: #60a5fa;
  --accent-hover: #93bbfd;
  --border: #333333;
  --tag-bg: #2a2a2a;
  --tag-text: #a8a29e;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.2);
  --shadow-md: 0 2px 8px rgba(0,0,0,0.3);
  --code-bg: #2a2a2a;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

/* ===== NAV ===== */
nav {
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem 1.5rem 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.nav-name {
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.01em;
}
.nav-links { display: flex; gap: 1.5rem; }
.nav-links a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.15s;
}
.nav-links a:hover { color: var(--accent); }
.nav-links a.active { color: var(--text); }

.nav-right { display: flex; align-items: center; gap: 1.5rem; }

.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 0.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s;
  border-radius: 4px;
}
.theme-toggle:hover { color: var(--accent); }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: none; }

/* Show moon in light mode (clicking switches to dark) */
:root .theme-toggle .icon-moon { display: block; }
/* Show sun in dark mode (clicking switches to light) */
@media (prefers-color-scheme: dark) {
  :root .theme-toggle .icon-sun { display: block; }
  :root .theme-toggle .icon-moon { display: none; }
}
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
[data-theme="light"] .theme-toggle .icon-sun { display: none; }
[data-theme="light"] .theme-toggle .icon-moon { display: block; }

/* ===== NAV MOBILE ===== */
@media (max-width: 600px) {
  nav { padding: 1.25rem 1rem 0; }
  .nav-name { font-size: 0.95rem; }
  .nav-right { gap: 0.75rem; }
  .nav-links { gap: 0.75rem; }
  .nav-links a { font-size: 0.82rem; }
}

/* ===== MAIN CONTAINER ===== */
main {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ===== HERO / INTRO ===== */
.hero {
  padding: 4rem 0 3rem;
  border-bottom: 1px solid var(--border);
}
.hero h1 {
  font-family: 'Lora', Georgia, serif;
  font-size: 2rem;
  font-weight: 500;
  margin-bottom: 1.25rem;
  letter-spacing: -0.02em;
  line-height: 1.3;
}
.hero p {
  color: var(--text-secondary);
  font-size: 1.05rem;
  line-height: 1.75;
  max-width: 600px;
}
.hero p + p {
  margin-top: 0.75rem;
}
.hero-links {
  margin-top: 1.5rem;
  display: flex;
  gap: 1.25rem;
  align-items: center;
}
.hero-links a {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  transition: color 0.15s;
}
.hero-links a:hover { color: var(--accent-hover); }
.hero-links svg { width: 16px; height: 16px; }

/* ===== SECTION ===== */
.section {
  padding: 2.5rem 0;
}
.section-title {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
  margin-bottom: 1.25rem;
}

/* ===== POST CARD ===== */
.post-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.75rem;
  text-decoration: none;
  color: var(--text);
  display: block;
  transition: box-shadow 0.2s, border-color 0.2s;
  box-shadow: var(--shadow-sm);
}
.post-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--accent);
}
.post-card + .post-card {
  margin-top: 1rem;
}
.post-meta {
  font-size: 0.8rem;
  color: var(--text-tertiary);
  margin-bottom: 0.75rem;
  display: flex;
  gap: 1rem;
  align-items: center;
}
.post-card h2 {
  font-family: 'Lora', Georgia, serif;
  font-size: 1.35rem;
  font-weight: 500;
  line-height: 1.35;
  margin-bottom: 0.6rem;
  letter-spacing: -0.01em;
}
.post-card .summary {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.65;
}
.post-tags {
  margin-top: 1rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.post-tags a,
.post-tags span {
  background: var(--tag-bg);
  color: var(--tag-text);
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.25rem 0.65rem;
  border-radius: 100px;
  text-decoration: none;
  transition: color 0.15s;
}
.post-tags a:hover {
  color: var(--accent);
}

/* ===== FOOTER ===== */
footer {
  max-width: 720px;
  margin: 0 auto;
  padding: 3rem 1.5rem;
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--text-tertiary);
  font-size: 0.8rem;
}

/* ===== ABOUT PAGE ===== */
.about-content {
  padding: 3rem 0;
}
.about-content h1 {
  font-family: 'Lora', Georgia, serif;
  font-size: 2rem;
  font-weight: 500;
  margin-bottom: 2rem;
  letter-spacing: -0.02em;
}
.about-content h2 {
  font-family: 'Lora', Georgia, serif;
  font-size: 1.4rem;
  font-weight: 500;
  margin: 2.5rem 0 1rem;
  color: var(--text);
}
.about-content p {
  color: var(--text-secondary);
  font-size: 1.02rem;
  line-height: 1.8;
  margin-bottom: 1.25rem;
}
.about-content a {
  color: var(--accent);
  text-decoration: none;
}
.about-content a:hover {
  color: var(--accent-hover);
}

/* ===== BLOG POST PAGE ===== */
.post-content {
  padding: 3rem 0;
}
.post-content .post-header {
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}
.post-content .post-header h1 {
  font-family: 'Lora', Georgia, serif;
  font-size: 2.1rem;
  font-weight: 500;
  line-height: 1.3;
  margin-bottom: 0.75rem;
  letter-spacing: -0.02em;
}
.post-content .post-body p {
  color: var(--text-secondary);
  font-size: 1.02rem;
  line-height: 1.85;
  margin-bottom: 1.25rem;
}
.post-content .post-body h2 {
  font-family: 'Lora', Georgia, serif;
  font-size: 1.4rem;
  font-weight: 500;
  margin: 2.5rem 0 1rem;
  color: var(--text);
}
.post-content .post-body h3 {
  font-family: 'Lora', Georgia, serif;
  font-size: 1.15rem;
  font-weight: 500;
  margin: 2rem 0 0.75rem;
  color: var(--text);
}
.post-content .post-body blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 1.25rem;
  margin: 1.5rem 0;
  color: var(--text-secondary);
  font-style: italic;
}

/* ===== TABLE OF CONTENTS ===== */
.toc {
  margin-bottom: 2rem;
  padding: 1.25rem 1.5rem;
  background: var(--tag-bg);
  border-radius: 8px;
  border: 1px solid var(--border);
}
.toc summary {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
  cursor: pointer;
  list-style: none;
}
.toc summary::-webkit-details-marker { display: none; }
.toc nav,
.toc #TableOfContents {
  margin-top: 0.75rem;
}
.toc ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.toc li {
  margin: 0;
}
.toc > details > #TableOfContents > ul > li > a {
  font-size: 0.9rem;
  color: var(--text-secondary);
  text-decoration: none;
  display: block;
  padding: 0.3rem 0;
  transition: color 0.15s;
}
.toc a {
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-decoration: none;
  display: block;
  padding: 0.3rem 0;
  transition: color 0.15s;
}
.toc a:hover { color: var(--accent); }
.toc ul ul {
  padding-left: 1rem;
}
.toc ul ul a {
  font-size: 0.82rem;
  color: var(--text-tertiary);
}

/* ===== IMAGES ===== */
.post-content .post-body figure {
  margin: 1.5rem 0;
}
.post-content .post-body figure img {
  margin: 0;
}
.post-content .post-body img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 1.5rem 0;
  border: 1px solid var(--border);
  cursor: zoom-in;
}
.post-content .post-body figcaption {
  font-size: 0.82rem;
  color: var(--text-tertiary);
  text-align: center;
  margin-top: 0.5rem;
  font-style: italic;
  line-height: 1.5;
}

/* ===== LIGHTBOX ===== */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.85);
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
}
.lightbox.active { display: flex; }
.lightbox img {
  max-width: 90vw;
  max-height: 90vh;
  border-radius: 8px;
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.5);
}

/* ===== CODE BLOCKS ===== */
.post-content .post-body code {
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 0.88em;
  background: var(--code-bg);
  padding: 0.15em 0.4em;
  border-radius: 4px;
}
.post-content .post-body pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
  overflow-x: auto;
  margin: 1.5rem 0;
}
.post-content .post-body pre code {
  background: none;
  padding: 0;
  font-size: 0.85rem;
  line-height: 1.6;
}

/* ===== LISTS ===== */
.post-content .post-body ul,
.post-content .post-body ol {
  color: var(--text-secondary);
  font-size: 1.02rem;
  line-height: 1.85;
  margin: 1rem 0 1.25rem 1.5rem;
}
.post-content .post-body li {
  margin-bottom: 0.35rem;
}
.post-content .post-body li::marker {
  color: var(--text-tertiary);
}

/* ===== LINKS IN POST BODY ===== */
.post-content .post-body a {
  color: var(--accent);
  text-decoration: none;
}
.post-content .post-body a:hover {
  color: var(--accent-hover);
}

/* ===== HORIZONTAL RULE ===== */
.post-content .post-body hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2.5rem 0;
}

/* ===== BLOG LIST PAGE ===== */
.list-content {
  padding: 3rem 0;
}
.list-content h1 {
  font-family: 'Lora', Georgia, serif;
  font-size: 2rem;
  font-weight: 500;
  margin-bottom: 2rem;
  letter-spacing: -0.02em;
}

/* ===== PROFILE PHOTO (optional) ===== */
.hero-profile {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 1.5rem;
  border: 2px solid var(--border);
}
