/* Rabbit Hole: plain, readable, a bit terminal-ish. */

:root {
  --bg: #fbfaf7;
  --fg: #1d1d1b;
  --muted: #6b6b66;
  --accent: #0a7c55;
  --link: #1d5fb8;
  --rule: #e2e0da;
  --code-bg: #f1efe9;
  --sans: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "JetBrains Mono", "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121412;
    --fg: #d8dbd4;
    --muted: #868b82;
    --accent: #5fd38d;
    --link: #7fb4ff;
    --rule: #2a2e2a;
    --code-bg: #1b1e1b;
  }
}

* { box-sizing: border-box; }

html { font-size: 17px; }

body {
  margin: 0 auto;
  padding: 0 16px;
  max-width: 72ch;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--mono);
  line-height: 1.65;
  -webkit-text-size-adjust: 100%;
}

/* ---------- header / footer ---------- */

header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem 1.5rem;
  padding: 1.5rem 0 1rem;
  border-bottom: 1px dashed var(--rule);
}

.prompt { color: var(--fg); text-decoration: none; font-weight: 700; }
.prompt .user { color: var(--accent); }
.prompt .dollar { color: var(--muted); }
.cursor { animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .cursor { animation: none; } }

nav a { margin-left: 1rem; }
nav a:first-child { margin-left: 0; }
nav a::before { content: "./"; color: var(--muted); }

footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem;
  margin: 4rem 0 2rem;
  padding-top: 1rem;
  border-top: 1px dashed var(--rule);
  color: var(--muted);
  font-size: 0.8rem;
}

/* ---------- text ---------- */

main { padding-top: 1.5rem; }

a { color: var(--link); text-underline-offset: 0.2em; }
a:hover { color: var(--accent); }

h1, h2, h3, h4 { line-height: 1.3; margin: 2rem 0 0.75rem; }
h1 { font-size: 1.5rem; margin-top: 0.5rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.05rem; }
article h2::before { content: "## "; color: var(--muted); }
article h3::before { content: "### "; color: var(--muted); }

.anchor { margin-left: 0.4rem; color: var(--muted); text-decoration: none; opacity: 0; }
h2:hover .anchor, h3:hover .anchor { opacity: 1; }

p, ul, ol, blockquote, pre, table { margin: 0 0 1.1rem; }

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

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

img, video { max-width: 100%; height: auto; border-radius: 4px; }

table { border-collapse: collapse; width: 100%; display: block; overflow-x: auto; }
th, td { border: 1px solid var(--rule); padding: 0.3rem 0.6rem; text-align: left; }

/* Post body: proportional for reading, the rest stays mono. */
article {
  font-family: var(--sans);
  font-size: 1.06rem;
  line-height: 1.7;
  letter-spacing: 0.005em;
}
article h1, article h2, article h3, article h4,
article .meta, article .draft, article table { font-family: var(--mono); letter-spacing: 0; }
article table { font-size: 0.9rem; }
article p, article li { max-width: 68ch; }
article li { margin-bottom: 0.25rem; }

/* ---------- code ---------- */

code, pre { font-family: var(--mono); font-size: 0.9em; }
:not(pre) > code { background: var(--code-bg); padding: 0.1em 0.35em; border-radius: 3px; }
pre, .hl {
  background: var(--code-bg) !important;
  padding: 0.9rem 1rem;
  overflow-x: auto;
  border-radius: 4px;
  line-height: 1.5;
}
.hl { margin: 0 0 1.1rem; }
.hl pre { padding: 0; margin: 0; background: none !important; }

/* ---------- post list ---------- */

.intro { color: var(--muted); }
.intro p:last-child { margin-bottom: 0; }

.year { color: var(--muted); font-size: 1rem; margin-top: 2rem; }
.year::before { content: "// "; }

.posts { list-style: none; padding: 0; }
.posts li { margin-bottom: 0.5rem; }
.posts time { color: var(--muted); margin-right: 0.5rem; }

.tag { color: var(--accent); text-decoration: none; font-size: 0.85em; margin-right: 0.4rem; }
.tag:hover { text-decoration: underline; }
.taglist { list-style: none; padding: 0; }

.meta, .muted { color: var(--muted); font-size: 0.85rem; }
.draft { color: #c0392b; font-weight: 700; }
.back { margin-top: 3rem; }
.back a::before { content: "$ "; color: var(--muted); }

::selection { background: var(--accent); color: var(--bg); }

@media (max-width: 480px) {
  html { font-size: 15px; }
  nav a { margin-left: 0.6rem; }
}
