/* ── Solarized Light palette ─────────────────────────────────────────────── */
:root {
  --base3:   #fdf6e3;   /* page background          */
  --base2:   #eee8d5;   /* sidebar / code bg        */
  --base1:   #93a1a1;   /* borders, secondary text  */
  --base01:  #586e75;   /* headings, emphasis       */
  --base00:  #657b83;   /* body text                */
  --yellow:  #b58900;
  --orange:  #cb4b16;   /* inline code              */
  --red:     #dc322f;
  --magenta: #d33682;   /* numbers                  */
  --violet:  #6c71c4;
  --blue:    #268bd2;   /* links                    */
  --cyan:    #2aa198;   /* link hover, strings      */
  --green:   #859900;   /* keywords                 */
}

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

body {
  background: var(--base3);
  color: var(--base00);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue",
               Arial, sans-serif;
  font-size: 15px;
  line-height: 1.6;
}

/* ── Header ──────────────────────────────────────────────────────────────── */
.site-header {
  background: var(--base2);
  border-bottom: 1px solid var(--base1);
  padding: 0.75rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-title {
  font-size: 1.35em;
  font-weight: 700;
  color: var(--base01);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.site-header nav a {
  color: var(--base00);
  text-decoration: none;
  margin-left: 1.5rem;
  font-size: 0.95em;
}

.site-header nav a:hover        { color: var(--blue); }
.site-header nav a.active       { color: var(--blue); font-weight: 600; }

/* ── Two-column layout ───────────────────────────────────────────────────── */
.site-main {
  max-width: 1080px;
  margin: 2rem auto;
  padding: 0 1.5rem;
  display: grid;
  grid-template-columns: 1fr 260px;
  gap: 2.5rem;
  align-items: start;
}

.content  { min-width: 0; }
.sidebar  { position: sticky; top: 1.5rem; }

/* ── Typography (R Markdown feel) ────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  color: var(--base01);
  font-weight: 700;
  line-height: 1.3;
  margin: 1.6rem 0 0.5rem;
}

h1 {
  font-size: 1.9em;
  border-bottom: 2px solid var(--base2);
  padding-bottom: 0.35rem;
  margin-top: 0.75rem;
}

h2 {
  font-size: 1.45em;
  border-bottom: 1px solid var(--base2);
  padding-bottom: 0.2rem;
}

h3 { font-size: 1.2em; }
h4 { font-size: 1.05em; }

p { margin: 0.75rem 0; }

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

ul, ol             { margin: 0.75rem 0 0.75rem 1.6rem; }
li                 { margin: 0.25rem 0; }

blockquote {
  border-left: 3px solid var(--base1);
  padding: 0.3rem 1rem;
  margin: 1rem 0;
  color: var(--base01);
  font-style: italic;
}

hr { border: none; border-top: 1px solid var(--base1); margin: 1.5rem 0; }

img { max-width: 100%; height: auto; display: block; margin: 1rem 0; }

/* ── Code ────────────────────────────────────────────────────────────────── */
code {
  font-family: "Consolas", "Monaco", "Courier New", monospace;
  font-size: 0.88em;
  color: var(--orange);
  background: var(--base2);
  padding: 0.1em 0.35em;
  border-radius: 3px;
}

pre {
  background: var(--base2);
  border: 1px solid var(--base1);
  border-radius: 4px;
  padding: 0.9rem 1rem;
  overflow-x: auto;
  margin: 1rem 0;
}

pre code {
  color: var(--base00);
  background: none;
  padding: 0;
  font-size: 0.87em;
  border-radius: 0;
}

/* suppress pandoc line-anchor links inside code blocks */
pre a,
.sourceCode a {
  color: inherit;
  text-decoration: none;
}

/* ── Syntax highlighting — Solarized Light (pandoc classes) ──────────────── */
.sourceCode .kw { color: var(--green); }                          /* keyword    */
.sourceCode .dt { color: var(--blue); }                           /* data type  */
.sourceCode .dv,
.sourceCode .bn,
.sourceCode .fl { color: var(--magenta); }                        /* numbers    */
.sourceCode .st,
.sourceCode .ss { color: var(--cyan); }                           /* strings    */
.sourceCode .co { color: var(--base1); font-style: italic; }      /* comments   */
.sourceCode .fu { color: var(--blue); }                           /* functions  */
.sourceCode .ot { color: var(--orange); }                         /* operators  */
.sourceCode .at { color: var(--green); }                          /* attributes */
.sourceCode .er { color: var(--red); font-weight: bold; }         /* errors     */

/* ── Tables ──────────────────────────────────────────────────────────────── */
table {
  border-collapse: collapse;
  width: 100%;
  margin: 1rem 0;
  font-size: 0.93em;
}

th, td {
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--base1);
  text-align: left;
}

th {
  background: var(--base2);
  color: var(--base01);
  font-weight: 600;
}

tr:nth-child(even) td { background: var(--base2); }

/* ── Post list (index & tag pages) ──────────────────────────────────────── */
.post-summary        { margin-bottom: 0.25rem; }
.post-summary h2     { font-size: 1.3em; border: none; margin: 0 0 0.2rem; }
.post-summary h2 a   { color: var(--base01); }
.post-summary h2 a:hover { color: var(--blue); text-decoration: none; }

.post-meta {
  font-size: 0.84em;
  color: var(--base1);
  margin: 0.2rem 0 0.55rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.post-date { color: var(--base1); }

.post-tags a {
  background: var(--base2);
  color: var(--base01);
  border: 1px solid var(--base1);
  padding: 0.05em 0.45em;
  border-radius: 3px;
  font-size: 0.88em;
  text-decoration: none;
  display: inline-block;
}
.post-tags a:hover { background: var(--base1); color: var(--base3); }

.excerpt     { color: var(--base00); margin: 0.4rem 0 0.5rem; }
.read-more   { font-size: 0.88em; color: var(--blue); }
.read-more:hover { color: var(--cyan); }

.post-divider { margin: 1.75rem 0; }

/* tag archive heading */
.tag-heading { margin-top: 0; }
.tag-heading em { color: var(--blue); font-style: normal; }

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
.sidebar-section {
  background: var(--base2);
  border: 1px solid var(--base1);
  border-radius: 4px;
  padding: 0.9rem 1rem;
  margin-bottom: 1.25rem;
}

.sidebar-section h3 {
  color: var(--base01);
  font-size: 0.8em;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0 0 0.7rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--base1);
}

/* archive */
.archive-list                     { list-style: none; margin: 0; padding: 0; }
.archive-list .year               { margin-bottom: 0.5rem; }
.archive-list .year > strong      { color: var(--base01); font-size: 0.92em; }
.archive-list .year > ul          { list-style: none; margin: 0.2rem 0 0 0.8rem; padding: 0; }
.archive-list .year > ul > li     { margin: 0.15rem 0; font-size: 0.88em; }
.archive-list .year > ul > li > a { color: var(--base00); }
.archive-list .year > ul > li > a:hover { color: var(--blue); text-decoration: none; }
.count { color: var(--base1); font-size: 0.85em; }

/* tag cloud */
.tag-cloud             { line-height: 2.1; }
.tag-cloud a           { color: var(--base01); text-decoration: none; margin: 0 0.15em; }
.tag-cloud a:hover     { color: var(--blue); }

/* ── Footer ──────────────────────────────────────────────────────────────── */
.site-footer {
  text-align: center;
  padding: 1.5rem;
  margin-top: 3rem;
  border-top: 1px solid var(--base1);
  color: var(--base1);
  font-size: 0.84em;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 780px) {
  .site-main    { grid-template-columns: 1fr; }
  .sidebar      { position: static; }
  .site-header  { padding: 0.75rem 1rem; }
}
