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

:root {
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --font-serif: ui-serif, Georgia, "Times New Roman", serif;
  --font-mono: ui-monospace, "SF Mono", "Monaco", "Cascadia Code", "Roboto Mono", Consolas, "Courier New", monospace;
  --color-bg: #fff;
  --color-text: #222;
  --color-link: #2b6cb0;
  --color-secondary: #666;
}

@media (prefers-color-scheme: dark) {
    :root {
        --color-bg: #1a202c;
        --color-text: #e2e8f0;
        --color-link: #63b3ed;
        --color-secondary: #a0aec0;
        --border-subtle: #2d3748;
        --code-bg: #2d3748;
        --code-block-bg: #2d3748;
        --code-text: #e2e8f0;
        --code-border: #4a5568;
        --code-highlight-bg: #3a3a20;
    }
}

html {
  font-size: 18px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-serif);
  line-height: 1.7;
  color: #222;
  background-color: #fafaf8;
}

a {
  color: #1a5276;
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

/* ============================================================
   Layout
   ============================================================ */
.container {
  max-width: 740px;
  margin: 0 auto;
  padding: 0 1.2rem;
}

/* ============================================================
   Header
   ============================================================ */
.site-header {
  padding: 1rem 0;
  margin-bottom: 2.5rem;
}

.site-header .container {
  display: flex;
  align-items: baseline;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.site-title {
  font-size: 1.3rem;
  font-weight: bold;
  color: #111;
  flex-shrink: 0;
}

.site-header nav {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.site-header nav a {
  color: #444;
  font-size: 0.9rem;
}

/* ============================================================
   Footer
   ============================================================ */
.site-footer {
  border-top: 1px solid #ddd;
  margin-top: 3rem;
  padding: 1.5rem 0;
  font-size: 0.85rem;
  color: #888;
}

/* ============================================================
   Page heading
   ============================================================ */
.page-heading {
  font-family: var(--font-sans);
  margin-bottom: 1.8rem;
}

/* ============================================================
   Post list (index)
   ============================================================ */
.post-list {
  padding-bottom: 2rem;
}

.post-summary {
  margin-bottom: 2.2rem;
}

.post-summary h2 {
  font-size: 1.35rem;
  margin-bottom: 0.15rem;
}

.post-excerpt {
  color: #555;
  margin-top: 0.4rem;
  font-size: 0.95rem;
}

/* ============================================================
   Post meta (date + tags)
   ============================================================ */
.post-meta {
  font-size: 0.85rem;
  color: #888;
}

.post-meta time { color: #888; }

/* ============================================================
   Tags
   ============================================================ */
.tag {
  display: inline-block;
  background: #eef2f7;
  color: #1a5276;
  border-radius: 3px;
  padding: 0 0.45em;
  font-size: 0.8rem;
  font-family: var(--font-sans);
  line-height: 1.7;
}

.tag--current {
  background: #1a5276;
  color: #fff;
}

/* ============================================================
   Archive
   ============================================================ */
.archive-year {
  margin-bottom: 2rem;
}

.archive-year h2 {
  font-size: 1.4rem;
  margin-bottom: 0.6rem;
  color: #444;
}

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

.archive-list li {
  display: flex;
  align-items: baseline;
  gap: 0.8rem;
  padding: 0.3rem 0;
  border-bottom: 1px solid #f0f0f0;
  flex-wrap: wrap;
}

.archive-list time {
  font-size: 0.82rem;
  color: #999;
  flex-shrink: 0;
  min-width: 4.5rem;
}

.archive-list a {
  flex-grow: 1;
}

.archive-tags {
  display: flex;
  gap: 0.3rem;
  flex-wrap: wrap;
}

/* ============================================================
   Post / Page content
   ============================================================ */
.post-header {
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #eee;
}

.post-header h1, .page h1 {
  font-size: 2rem;
  line-height: 1.25;
  margin-bottom: 0.5rem;
}

.post-content, .page-content {
  margin-top: 1.5rem;
}

.post-content h2, .page-content h2, .post h2 {
  font-family: var(--font-sans);
  font-size: 1.5rem;
  margin: 2rem 0 0.6rem;
}

.post-content h3, .page-content h3 {
  font-size: 1.2rem;
  margin: 1.6rem 0 0.4rem;
}

.post-content p, .page-content p {
  margin-bottom: 1.1rem;
}

.post-content p:last-child, .page-content p:last-child {
  margin-bottom: 0;
}

.post-content ul,
.post-content ol,
.page-content ul,
.page-content ol {
  padding-left: 1.5rem;
  margin-bottom: 1.1rem;
}

.post-content li,
.page-content li { margin-bottom: 0.25rem; }

.post-content blockquote,
.page-content blockquote {
  border-left: 4px solid #ddd;
  padding: 0.2rem 1rem;
  color: #666;
  margin: 1.2rem 0;
  font-style: italic;
}

.post-content pre,
.page-content pre {
  background: #f4f4f2;
  border: 1px solid #e0e0dc;
  border-radius: 10px;
  padding: 1rem 1.2rem;
  overflow-x: auto;
  margin-bottom: 1.2rem;
  font-size: 0.88rem;
  font-weight: normal;
  line-height: 1.5;
}

.post-content code,
.page-content code {
  font-family: var(--font-mono);
  font-weight: normal;
  font-size: 0.85em;
  background: #f4f4f2;
  padding: 0.1em 0.3em;
  border-radius: 3px;
}

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

.post-content img,
.page-content img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 1rem auto;
}

.post-content table,
.page-content table {
  border-collapse: collapse;
  width: 100%;
  margin-bottom: 1.2rem;
  font-size: 0.9rem;
}

.post-content th,
.post-content td,
.page-content th,
.page-content td {
  border: 1px solid #ddd;
  padding: 0.45rem 0.7rem;
  text-align: left;
}

.post-content th,
.page-content th {
  background: #f0f0ee;
  font-weight: bold;
}

.page-content .about-photo {
  float: right;
  margin: 0.5em 0 0.5em 1.5em;
  width: 10em;
}

img {
  border-radius: 10px;
}

.post {
  margin-top: 4rem;
}

.post:first-child {
  margin-top: 0;
}

@media (prefers-color-scheme: dark) {
  body {
    background-color: #1a202c;
    color: #e2e8f0;
  }

  a {
    color: #63b3ed;
  }

  .post-content code,
  .page-content code {
    background-color: #2a303e;
  }

  .post-content pre,
  .page-content pre {
    background-color: #2a303e;
    border-color: #333947;
  }

  .post-meta time, .archive-list time {
    color: #7f879a;
  }

  .archive-year h2 {
    color: #fafaf8;
    font-family: var(--font-sans);
  }

  .archive-list li {
    border-bottom-color: #313641;
  }
}
