/* libre.css — Zero JavaScript. Zero external dependencies. GPLv3+. */

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

/* === Light theme (warm, not harsh) === */
:root {
  --bg: #e8e4df;
  --bg-surface: #dedad4;
  --fg: #1a1a1a;
  --fg-muted: #4a4a4a;
  --link: #1a5276;
  --link-visited: #5b2c6f;
  --border: #b0aba3;
  --code-bg: #d5d0c9;
  --max-width: 42rem;
}

/* === Dark theme (system preference) === */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1a1a1a;
    --bg-surface: #242424;
    --fg: #e0e0e0;
    --fg-muted: #999;
    --link: #6db3d8;
    --link-visited: #b48cc8;
    --border: #444;
    --code-bg: #252525;
  }
}

/* === Typography === */
html {
  font-size: 18px;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: "DejaVu Serif", "Liberation Serif", Georgia, serif;
  color: var(--fg);
  background: var(--bg);
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 1rem;
}

h1, h2, h3, h4 {
  font-family: "DejaVu Sans", "Liberation Sans", Helvetica, sans-serif;
  line-height: 1.25;
  margin-top: 2em;
  margin-bottom: 0.5em;
}

h1 { font-size: 1.8rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.15rem; }

a { color: var(--link); text-decoration: underline; text-underline-offset: 2px; }
a:visited { color: var(--link-visited); }
a:hover { text-decoration-thickness: 2px; }

p, ul, ol, blockquote, pre, table, details { margin-bottom: 1.2em; }
ul, ol { padding-left: 1.5em; }
li + li { margin-top: 0.3em; }

code {
  font-family: "DejaVu Sans Mono", "Liberation Mono", monospace;
  font-size: 0.9em;
  background: var(--code-bg);
  padding: 0.15em 0.35em;
  border-radius: 3px;
}

pre {
  background: var(--code-bg);
  padding: 1em;
  overflow-x: auto;
  border-left: 3px solid var(--border);
  line-height: 1.45;
}

pre code { background: none; padding: 0; font-size: 0.85em; }

blockquote {
  border-left: 3px solid var(--border);
  padding-left: 1em;
  color: var(--fg-muted);
  font-style: italic;
}

table { border-collapse: collapse; width: 100%; }
th, td { border: 1px solid var(--border); padding: 0.5em 0.75em; text-align: left; }
th { font-weight: bold; }

img { max-width: 100%; height: auto; display: block; margin: 1.5em 0; }
hr { border: none; border-top: 1px solid var(--border); margin: 2em 0; }

/* === Site header === */
.site-header {
  margin-bottom: 3rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.site-header-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.site-header-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.site-header h1 { margin-top: 0; font-size: 1.5rem; }
.site-header nav { margin-top: 0.5rem; }
.site-header nav a { margin-right: 1em; text-decoration: none; }
.site-header nav a:hover { text-decoration: underline; }

/* === Language switcher === */
.lang-switcher { font-size: 0.85em; }
.lang-switcher a, .lang-switcher strong { margin-left: 0.5em; }
.lang-switcher strong { text-decoration: none; }

/* === Translation notice === */
.translation-notice {
  font-size: 0.9em;
  color: var(--fg-muted);
  border: 1px dashed var(--border);
  padding: 0.5em 0.75em;
  margin-bottom: 2rem;
}

/* === Post list === */
.post-list { list-style: none; padding: 0; }
.post-list li { margin-bottom: 1.5em; }
.post-list time {
  font-family: "DejaVu Sans Mono", monospace;
  font-size: 0.85em;
  color: var(--fg-muted);
  margin-right: 0.75em;
}

/* === Series badge === */
.series-badge {
  font-size: 0.75em;
  color: var(--fg-muted);
  border: 1px solid var(--border);
  padding: 0.1em 0.4em;
  border-radius: 3px;
  margin-left: 0.5em;
  vertical-align: middle;
}

/* === Single post === */
.post-header { margin-bottom: 2rem; }
.post-header h1 { margin-top: 0; margin-bottom: 0.25em; }
.post-meta { color: var(--fg-muted); font-size: 0.9em; }

/* === Table of contents === */
.toc {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  padding: 1em 1em 1em 1.5em;
  margin-bottom: 2rem;
}

.toc summary {
  font-family: "DejaVu Sans", "Liberation Sans", Helvetica, sans-serif;
  font-weight: bold;
  cursor: pointer;
  font-size: 0.95em;
  margin-bottom: 0.5em;
}

.toc nav ul { margin-bottom: 0; padding-left: 1.2em; }
.toc nav li { margin-top: 0.25em; font-size: 0.9em; }
.toc nav a { text-decoration: none; }
.toc nav a:hover { text-decoration: underline; }

/* === Series box === */
.series-box {
  border: 1px solid var(--border);
  padding: 1em;
  margin-bottom: 2rem;
  background: var(--bg-surface);
}

.series-title { font-weight: bold; margin-bottom: 0.5em; }
.series-toc { padding-left: 1.5em; margin-bottom: 0; }
.series-toc li { margin-bottom: 0.3em; }
.series-current { font-weight: bold; }

/* === Post navigation === */
.post-nav { margin-top: 3rem; display: flex; justify-content: space-between; }
.post-nav-next { margin-left: auto; }

/* === Social icons === */
.social-icons {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin-top: 0.75rem;
}

.social-icons a {
  display: flex;
  align-items: center;
  color: var(--fg-muted);
  text-decoration: none;
}

.social-icons a:visited { color: var(--fg-muted); }
.social-icons a:hover { color: var(--fg); }
.social-icons svg { width: 20px; height: 20px; fill: currentColor; }

/* === About page === */
.about-header {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
  margin-bottom: 2rem;
}

.about-photo {
  border-radius: 50%;
  width: 120px;
  height: 120px;
  object-fit: cover;
  flex-shrink: 0;
}

.about-intro h1, .about-intro h2 { margin-top: 0; }

@media (max-width: 480px) {
  .about-header {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
}

/* === Footer === */
.site-footer {
  margin-top: 4rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.85em;
  color: var(--fg-muted);
}

.site-footer .footer-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* === Print === */
@media print {
  body { color: #000; background: #fff; max-width: none; padding: 0; }
  a { color: #000; }
  a[href]::after { content: " (" attr(href) ")"; font-size: 0.8em; }
  .site-header nav, .site-footer, .toc { display: none; }
}
