/* ── Variables ────────────────────────────────── */
:root {
  --bg:      #ffffff;
  --fg:      #1a1918;
  --muted:   #736f68;
  --accent:  #2563eb;
  --border:  #e0ddd5;
  --code-bg: #eceae2;
  --font:    system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono:    "JetBrains Mono", "Fira Code", "Cascadia Code", Consolas, monospace;
  --width:   1400px;
  --gap:     1.5rem;
}

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

/* ── Base ─────────────────────────────────────── */
html { font-size: 16px; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

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

/* ── Layout ───────────────────────────────────── */
main, footer {
  max-width: var(--width);
  margin: 0 auto;
  padding-left: var(--gap);
  padding-right: var(--gap);
}

/* ── Header / Nav ─────────────────────────────── */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(245, 244, 239, 0.88);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06), 0 2px 12px rgba(0, 0, 0, 0.05);
}

header nav {
  max-width: var(--width);
  margin: 0 auto;
  padding: 1.1rem var(--gap);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-title {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 1rem;
  color: var(--fg);
  letter-spacing: -0.02em;
}
.site-title:hover { text-decoration: none; opacity: 0.65; }

nav ul {
  list-style: none;
  display: flex;
  gap: 0.25rem;
}
nav ul li a {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--muted);
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
  letter-spacing: 0.01em;
}
nav ul li a:hover {
  color: var(--fg);
  background: rgba(0, 0, 0, 0.055);
  text-decoration: none;
}
nav ul li a.active {
  color: var(--fg);
  background: rgba(0, 0, 0, 0.07);
  text-decoration: none;
}

/* ── Main ─────────────────────────────────────── */
main {
  padding-top: 1.25rem;
  padding-bottom: 3rem;
  min-height: calc(100vh - 200px);
}

main.home-main {
  max-width: var(--width);
}

/* ── Home two-column layout ───────────────────── */
.home {
  display: grid;
  grid-template-columns: 1fr 290px;
  gap: 3rem;
  align-items: start;
}

/* ── Sidebar wrapper ──────────────────────────── */
.home-sidebar {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  position: sticky;
  top: 5rem;
  align-self: start;
}

/* ── About card ───────────────────────────────── */
.about-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04), 0 4px 20px rgba(0,0,0,0.05);
}

.about-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--fg);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  margin-bottom: 0.9rem;
}

.about-name {
  font-family: var(--mono);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--fg);
  letter-spacing: -0.01em;
  margin-bottom: 0.5rem;
}

.about-bio {
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.65;
  margin: 0;
}

.about-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.2rem 0;
}

.about-links {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.about-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.79rem;
  color: var(--accent);
  transition: opacity 0.15s;
  text-decoration: none;
}
.about-link:hover {
  opacity: 0.75;
  text-decoration: none;
}
.about-link svg { flex-shrink: 0; opacity: 0.75; }

/* ── Reads sidebar card ───────────────────────── */
.reads-sidebar-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04), 0 4px 20px rgba(0,0,0,0.05);
}

.reads-sidebar-heading {
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 1.1rem;
}

.reads-sidebar-group {
  margin-bottom: 1.2rem;
}

.reads-sidebar-cat {
  display: block;
  font-family: var(--mono);
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  opacity: 0.65;
  margin-bottom: 0.4rem;
}

.reads-sidebar-link {
  display: block;
  font-size: 0.82rem;
  color: var(--accent);
  margin-bottom: 0.35rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.reads-sidebar-link:hover { opacity: 0.75; text-decoration: none; }

.reads-sidebar-all {
  display: inline-block;
  margin-top: 0.75rem;
  font-size: 0.75rem;
  color: var(--muted);
}
.reads-sidebar-all:hover { color: var(--accent); text-decoration: none; }

/* ── Home ─────────────────────────────────────── */
.intro {
  margin-bottom: 0.75rem;
}
.intro h1 {
  font-family: var(--mono);
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 0.35rem;
}
.tagline {
  color: var(--muted);
  font-size: 0.95rem;
}

.home-section {
  margin-bottom: 1rem;
}
.home-section h2 {
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

/* ── List items (posts, notes) ────────────────── */
.list-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: 0.1rem 0;
}

.list-item a {
  color: var(--accent);
  font-size: 0.95rem;
}
.list-item a::before {
  content: '>';
  margin-right: 0.5rem;
  font-size: 0.8rem;
}
.list-item a:hover { opacity: 1; text-decoration: none; }

.list-item time {
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--muted);
  opacity: 0.7;
  white-space: nowrap;
  flex-shrink: 0;
}

.see-all {
  display: inline-block;
  margin-top: 0.75rem;
  font-size: 0.85rem;
  color: var(--muted);
}
.see-all:hover { color: var(--accent); text-decoration: none; }

/* ── Section pages ────────────────────────────── */
section > h1 {
  font-family: var(--mono);
  font-size: 1.2rem;
  margin-bottom: 0.25rem;
}
.section-intro, .section-desc {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 1.75rem;
}
.list { margin-top: 1.5rem; }

/* ── Article / Single ─────────────────────────── */
.article-header {
  margin-bottom: 1rem;
  padding: 1rem 1rem;
  background: rgba(245, 244, 239, 0.88);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04), 0 4px 20px rgba(0,0,0,0.04);
}
.article-header h1 {
  font-size: 1.75rem;
  line-height: 1.2;
  letter-spacing: -0.03em;
  margin-bottom: 0.5rem;
  color: var(--fg);
}
.article-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.article-meta time {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--muted);
  background: var(--code-bg);
  padding: 0.2em 0.65em;
  border-radius: 5px;
}

.tags { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.tag {
  background: var(--accent);
  color: #fff;
  font-family: var(--mono);
  font-size: 0.7rem;
  padding: 0.2em 0.6em;
  border-radius: 5px;
  letter-spacing: 0.01em;
  text-decoration: none;
  transition: opacity 0.15s;
}
.tag:hover { opacity: 0.8; text-decoration: none; }

.tags-sidebar-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04), 0 4px 20px rgba(0,0,0,0.05);
}

.tags-sidebar-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.75rem;
}

.tags-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.5rem;
}
.tag-count {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  padding: 0.3em 0.75em;
}
.tag-num {
  opacity: 0.7;
  font-size: 0.65rem;
}

/* ── Content typography ───────────────────────── */
.content { font-size: 1rem; }

.content h2 { font-size: 1.2rem; margin: 2.25rem 0 0.75rem; line-height: 1.3; }
.content h3 { font-size: 1.05rem; margin: 2rem 0 0.5rem; }
.content h4 { font-size: 0.95rem; margin: 1.5rem 0 0.4rem; color: var(--muted); }

.content p  { margin: 1.25rem 0; }
.content ul, .content ol { margin: 1.25rem 0; padding-left: 1.5rem; }
.content li { margin: 0.35rem 0; }

.content a { border-bottom: 1px solid var(--border); }
.content a:hover { border-color: var(--accent); text-decoration: none; }

.content code {
  font-family: var(--mono);
  font-size: 0.85em;
  background: var(--code-bg);
  padding: 0.15em 0.4em;
  border-radius: 3px;
}

.content pre {
  background: var(--code-bg);
  padding: 1.25rem;
  overflow-x: auto;
  border-radius: 6px;
  margin: 1.75rem 0;
  border: 1px solid var(--border);
}
.content pre code {
  background: none;
  padding: 0;
  font-size: 0.875rem;
  border-radius: 0;
}

.content blockquote {
  border-left: 3px solid var(--accent);
  margin: 1.75rem 0;
  padding: 0.1rem 0 0.1rem 1.25rem;
  color: var(--muted);
  font-style: italic;
}

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

.content img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  margin: 1.5rem 0;
}

.content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  margin: 1.5rem 0;
}
.content th, .content td {
  text-align: left;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
}
.content th { background: var(--code-bg); font-weight: 600; }

/* ── Reads ────────────────────────────────────── */
.reads-group { margin-bottom: 2.5rem; }
.reads-group h2 {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.75rem;
}

.read-item {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.read-item a { color: var(--fg); font-size: 0.93rem; }
.read-item a:hover { color: var(--accent); }
.read-note { color: var(--muted); font-size: 0.83rem; }

/* ── Footer ───────────────────────────────────── */
footer {
  padding-top: 1.5rem;
  padding-bottom: 2rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.78rem;
}

/* ── Responsive ───────────────────────────────── */
@media (max-width: 760px) {
  .home { grid-template-columns: 1fr; gap: 2rem; }
  .home-sidebar { position: static; }
}

@media (max-width: 600px) {
  :root { --gap: 1rem; }
  .list-item { gap: 0.5rem; }
  .list-item time { font-size: 0.68rem; color: var(--muted); opacity: 0.7; }
  .article-header h1 { font-size: 1.35rem; }
  header nav { flex-direction: column; align-items: flex-start; gap: 0.75rem; }
  nav ul { gap: 0.1rem; }
}
