/* ── Custom Properties ───────────────────────────────── */
:root {
  --bg:        #ffffe0;
  --fg:        #2f4f4f;
  --muted:     #666666;
  --accent:    #2563eb;
  --border:    #e5e5e5;
  --code-bg:   #f5f5f5;
  --max-width: 740px;
  --font-serif: "Liberation Serif", "Microsoft Sans Serif", serif;
  --font-mono: "Source Code Pro", "LiberationMono", "Consolas", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:      #111111;
    --fg:      #e8e8e8;
    --muted:   #888888;
    --accent:  #60a5fa;
    --border:  #2a2a2a;
    --code-bg: #1c1c1c;
  }
}

/* ── Background animation canvas ────────────────────── */
#bg-animation {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
  will-change: transform;
}

/* ── Reset ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
img, video, svg { max-width: 100%; display: block; }

/* ── Base ────────────────────────────────────────────── */
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-serif);
  line-height: 1.7;
  padding: 0 1.25rem;
}

/* ── Layout — center content ─────────────────────────── */
#content,
#postamble {
  max-width: var(--max-width);
  margin-left: auto;
  margin-right: auto;
}

/* ── Contact header ──────────────────────────────────── */
.site-contact {
  max-width: var(--max-width);
  margin-left: auto;
  margin-right: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2.5rem;
}

/* ── Blog back nav ───────────────────────────────────── */
.blog-nav {
  max-width: var(--max-width);
  margin-left: auto;
  margin-right: auto;
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2.5rem;
}

.back-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
}

.back-link:hover { color: var(--accent); }

/* ── Content ─────────────────────────────────────────── */
#content {
  padding-bottom: 4rem;
}

/* ── Typography ──────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-serif);
  line-height: 1.3;
  margin-top: 2rem;
  margin-bottom: 0.6rem;
  font-weight: 600;
}

h1 { font-size: 2rem;   margin-top: 0; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.15rem; }
h4 { font-size: 1rem; }

p { margin-bottom: 1rem; }

a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: transparent;
  transition: text-decoration-color 0.15s;
}
a:hover { text-decoration-color: currentColor; }

ul, ol {
  padding-left: 1.5rem;
  margin-bottom: 1rem;
}
li { margin-bottom: 0.3rem; }

blockquote {
  border-left: 3px solid var(--border);
  padding-left: 1rem;
  color: var(--muted);
  margin: 1.5rem 0;
}

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

/* ── Code ────────────────────────────────────────────── */
code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--code-bg);
  padding: 0.15em 0.4em;
  border-radius: 3px;
}

pre {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem 1.25rem;
  overflow-x: auto;
  margin-bottom: 1.25rem;
  line-height: 1.5;
}

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

/* org-mode wraps src blocks in .src */
.src { background: var(--code-bg); }

/* ── Tables ──────────────────────────────────────────── */
table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.25rem;
  font-size: 0.95rem;
}
th, td {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  text-align: left;
}
th {
  background: var(--code-bg);
  font-weight: 600;
}

/* ── Org-specific cleanup ────────────────────────────── */
.outline-3, .outline-4 { margin-top: 1.5rem; }

.outline-2 {
  background: #fffacd;
  border-radius: 8px;
  margin-top: 1.5rem;
  overflow: hidden;
}

.outline-2 > h2 {
  background: #bfefff;
  padding: 0.5rem 1.25rem;
  margin-top: 0;
}

.outline-2 > .outline-text-2 {
  padding: 0.75rem 1.25rem;
}
.tag { display: none; }
#table-of-contents { margin-bottom: 2rem; }

/* ── Contact links ───────────────────────────────────── */
.contact-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.85rem;
}

.contact-link svg {
  width: 1em;
  height: 1em;
  flex-shrink: 0;
}

.contact-link:hover { color: var(--accent); }

/* ── Things grid ─────────────────────────────────────── */
.things-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
  margin-top: 1.5rem;
}

.things-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--code-bg);
  display: flex;
  flex-direction: column;
}


.things-card-body {
  padding: 0.9rem 1rem 1rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.things-card-body h3 {
  margin-top: 0;
  margin-bottom: 0.4rem;
  font-size: 1rem;
}

.things-card-body h3 a {
  color: var(--fg);
  text-decoration: none;
}

.things-card-body h3 a:hover { color: var(--accent); }

.things-card-body p {
  color: var(--muted);
  font-size: 0.88rem;
  margin-bottom: 0;
  line-height: 1.5;
}
