/* === Self-hosted fonts === */
@font-face {
  font-family: 'Libre Baskerville';
  font-style: normal;
  font-weight: 400 700;
  src: url('/fonts/LibreBaskerville/LibreBaskerville-Latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Libre Baskerville';
  font-style: italic;
  font-weight: 400 700;
  src: url('/fonts/LibreBaskerville/LibreBaskerville-Italic-Latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Source Sans 3';
  font-style: normal;
  font-weight: 200 900;
  src: url('/fonts/SourceSans3/SourceSans3-Variable.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* === Color tokens === */
:root {
  --bg:          #f5f0e8;
  --text:        #2a2520;
  --text-bright: #111;
  --text-dim:    #6b6560;
  --text-muted:  #8a847d;
  --accent:      #8b7355;
  --border:      #d4cfc8;
  --code-bg:     rgba(0, 0, 0, 0.06);
  --font-body: 'Libre Baskerville', Baskerville, Georgia, serif;
  --font-ui:   'Source Sans 3', 'Source Sans Pro', Arial, sans-serif;
  --font-mono: 'Courier New', monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:          #1a1a1a;
    --text:        #e8e4dd;
    --text-bright: #f0ece5;
    --text-dim:    #a09a93;
    --text-muted:  #8a847d;
    --border:      #333;
    --code-bg:     rgba(255, 255, 255, 0.08);
  }
}

/* JS toggle overrides system preference */
[data-theme="light"] {
  --bg:          #f5f0e8;
  --text:        #2a2520;
  --text-bright: #111;
  --text-dim:    #6b6560;
  --text-muted:  #8a847d;
  --border:      #d4cfc8;
  --code-bg:     rgba(0, 0, 0, 0.06);
}
[data-theme="dark"] {
  --bg:          #1a1a1a;
  --text:        #e8e4dd;
  --text-bright: #f0ece5;
  --text-dim:    #a09a93;
  --text-muted:  #8a847d;
  --border:      #333;
  --code-bg:     rgba(255, 255, 255, 0.08);
}

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

html { font-size: 17px; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.72;
  margin: 0;
  padding: 2rem 1rem;
}

/* === Layout === */
.site-wrapper {
  max-width: 680px;
  margin: 0 auto;
}

/* === Site header === */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 1rem;
  margin-bottom: 2.5rem;
  gap: 1.5rem;
}

@media (max-width: 480px) {
  .site-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }
}

.masthead {
  margin: 0;
}

.masthead .site-name {
  font-family: var(--font-ui);
  font-size: 24px;
  font-weight: 400;
  margin: 0;
  line-height: 1;
}

.masthead .site-name a {
  color: var(--text);
  text-decoration: none;
}

.masthead .site-tagline {
  font-family: var(--font-ui);
  font-size: 13px;
  color: var(--text-muted);
  margin: 0.3rem 0 0;
}

.masthead-rule { display: none; }

nav {
  font-family: var(--font-ui);
  font-size: 15px;
  font-weight: 400;
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin: 0;
}

nav a {
  color: var(--text-dim);
  text-decoration: none;
}

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

/* === Post list === */
.post-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

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

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

.post-list-item h2 {
  font-size: 1.25rem;
  margin: 0 0 0.25rem;
  font-weight: 400;
  line-height: 1.25;
}

.post-list-item h2 a {
  color: var(--text-bright);
  text-decoration: none;
}

.post-list-item h2 a:hover { text-decoration: underline; }

.post-summary {
  margin: 0.5rem 0 0;
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text-dim);
}

.post-summary-more {
  color: var(--accent);
  font-style: italic;
  text-decoration: none;
  white-space: nowrap;
}

/* === Post meta === */
.post-meta {
  font-family: var(--font-ui);
  font-size: 13px;
  color: var(--text-muted);
  margin: 0.2rem 0 0;
}

.post-meta a { color: var(--text-muted); text-decoration: none; }
.post-meta a:hover { text-decoration: underline; }

/* === Hero image === */
.post-hero {
  display: block;
  width: 100%;
  height: 200px;
  object-fit: cover;
  margin: 0 0 1rem;
}


/* === Single post === */
.post-title {
  font-size: 2rem;
  font-weight: 400;
  margin: 0 0 0.4rem;
  line-height: 1.2;
  color: var(--text-bright);
  letter-spacing: -0.01em;
}

.post-content {
  margin-top: 1.4rem;
}

.post-content p { margin: 0 0 1.3rem; }

.post-content a { color: var(--text); }

.post-content h2,
.post-content h3 {
  margin: 2rem 0 0.5rem;
  font-weight: 400;
  color: var(--text-bright);
}

.post-content code {
  font-family: var(--font-mono);
  font-size: 0.82em;
  background: var(--code-bg);
  padding: 0.1em 0.35em;
}

.post-content pre {
  background: var(--code-bg);
  padding: 1rem;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.82em;
  line-height: 1.5;
}

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

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

/* === Pagination === */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.4rem;
  margin: 2.5rem 0 1rem;
  font-family: var(--font-ui);
  font-size: 13px;
}

.pagination a,
.pagination span {
  padding: 0.3rem 0.65rem;
  color: var(--text-dim);
  text-decoration: none;
  border: 1px solid var(--border);
}

.pagination a:hover {
  color: var(--text);
  border-color: var(--text-dim);
}

.pagination .current {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}

/* === Archive === */
.archive-year {
  font-size: 1.3rem;
  font-weight: 400;
  margin: 2.5rem 0 0.5rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.3rem;
  color: var(--text-bright);
}

.archive-month {
  font-family: var(--font-ui);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 1.2rem 0 0.4rem;
  color: var(--accent);
}

.archive-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.archive-list li {
  display: flex;
  gap: 1rem;
  padding: 0.25rem 0;
}

.archive-list .archive-date {
  font-family: var(--font-ui);
  color: var(--text-muted);
  font-size: 13px;
  white-space: nowrap;
  padding-top: 0.1em;
  min-width: 4rem;
}

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

/* === Footer === */
footer {
  font-family: var(--font-ui);
  margin-top: 3rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
}

footer p { margin: 0; }
