/* ricebaby blog — minimal INTJ theme */
:root {
  --bg: #fafafa;
  --bg-secondary: #f0f0f0;
  --text: #1a1a1a;
  --text-secondary: #666;
  --text-muted: #999;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --border: #e5e5e5;
  --code-bg: #f3f4f6;
  --card-bg: #fff;
  --shadow: 0 1px 3px rgba(0,0,0,0.06);
  --radius: 6px;
  --max-w: 720px;
  --header-h: 56px;
}

[data-theme="dark"] {
  --bg: #0f0f0f;
  --bg-secondary: #1a1a1a;
  --text: #e0e0e0;
  --text-secondary: #a0a0a0;
  --text-muted: #666;
  --accent: #60a5fa;
  --accent-hover: #93bbfd;
  --border: #2a2a2a;
  --code-bg: #1e1e1e;
  --card-bg: #161616;
  --shadow: 0 1px 3px rgba(0,0,0,0.3);
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  transition: background 0.3s, color 0.3s;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans SC", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.75;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--accent); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--accent-hover); }

/* ── Header ── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  height: var(--header-h);
}

.header-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.5px;
}

.site-logo span { color: var(--accent); }

nav { display: flex; align-items: center; gap: 20px; }

nav a {
  color: var(--text-secondary);
  font-size: 0.95rem;
  font-weight: 500;
  transition: color 0.2s;
  position: relative;
}

nav a:hover,
nav a.active { color: var(--text); }

nav a.active::after {
  content: "";
  position: absolute;
  bottom: -4px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent);
  border-radius: 1px;
}

/* ── Theme toggle ── */
.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 1.15rem;
  padding: 4px;
  line-height: 1;
  transition: color 0.2s;
}
.theme-toggle:hover { color: var(--text); }

/* ── Main content ── */
main {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 40px 24px 80px;
  flex: 1;
  width: 100%;
}

/* ── Hero (homepage) ── */
.hero {
  margin-bottom: 48px;
}

.hero h1 {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 8px;
}

.hero p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.7;
}

/* ── Post list ── */
.post-list { list-style: none; }

.post-item {
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
}

.post-item:last-child { border-bottom: none; }

.post-item a {
  color: var(--text);
  font-weight: 500;
  font-size: 0.95rem;
  flex: 1;
  transition: color 0.2s;
}

.post-item a:hover { color: var(--accent); }

.post-meta {
  color: var(--text-muted);
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── Section headers ── */
.section-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 24px;
  letter-spacing: -0.3px;
}

/* ── Tags ── */
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  margin-bottom: 32px;
}

.tag {
  display: inline-block;
  padding: 3px 10px;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border-radius: var(--radius);
  font-size: 0.8rem;
  font-weight: 500;
  transition: all 0.2s;
}

.tag:hover {
  background: var(--accent);
  color: #fff;
}

.tag-count {
  color: var(--text-muted);
  font-size: 0.75rem;
  margin-left: 2px;
}

/* ── Article (post page) ── */
.article-header {
  margin-bottom: 32px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.article-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  line-height: 1.4;
  margin-bottom: 10px;
}

.article-info {
  color: var(--text-muted);
  font-size: 0.82rem;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.article-info span::before {
  content: "·";
  margin-right: 12px;
  color: var(--border);
}

.article-info span:first-child::before { display: none; }

/* ── Article body ── */
.article-body h2 {
  font-size: 1.2rem;
  font-weight: 700;
  margin: 2em 0 0.8em;
  letter-spacing: -0.3px;
}

.article-body h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 1.5em 0 0.6em;
}

.article-body p {
  margin-bottom: 1em;
}

.article-body ul, .article-body ol {
  margin-bottom: 1em;
  padding-left: 1.5em;
}

.article-body li { margin-bottom: 0.3em; }

.article-body blockquote {
  border-left: 3px solid var(--accent);
  margin: 1em 0;
  padding: 0.5em 0 0.5em 1em;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  border-radius: 0 var(--radius) var(--radius) 0;
}

.article-body pre {
  background: var(--code-bg);
  padding: 14px 18px;
  border-radius: var(--radius);
  overflow-x: auto;
  font-size: 0.85rem;
  line-height: 1.6;
  margin-bottom: 1em;
  border: 1px solid var(--border);
}

.article-body code {
  font-family: "JetBrains Mono", "Fira Code", "SF Mono", Menlo, monospace;
  font-size: 0.88em;
}

.article-body p code,
.article-body li code {
  background: var(--code-bg);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.article-body pre code {
  background: none;
  padding: 0;
  border: none;
}

.article-body img {
  max-width: 100%;
  border-radius: var(--radius);
  margin: 1em 0;
}

.article-body hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2em 0;
}

.article-body table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1em;
  font-size: 0.9rem;
}

.article-body th, .article-body td {
  padding: 8px 12px;
  border: 1px solid var(--border);
  text-align: left;
}

.article-body th {
  background: var(--bg-secondary);
  font-weight: 600;
}

/* ── Post footer ── */
.post-footer {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.post-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }

/* ── Back link ── */
.back-link {
  display: inline-block;
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 24px;
}
.back-link:hover { color: var(--accent); }

/* ── Archive ── */
.archive-group { margin-bottom: 32px; }

.archive-year {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 12px;
  font-variant-numeric: tabular-nums;
}

/* ── About page ── */
.about-content p { margin-bottom: 1em; }
.about-content ul { padding-left: 1.5em; margin-bottom: 1em; }

/* ── Friend links ── */
.friend-links { display: flex; flex-direction: column; gap: 12px; }

.friend-card {
  padding: 14px 18px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.2s;
}

.friend-card:hover { border-color: var(--accent); }

.friend-name { font-weight: 600; font-size: 0.95rem; margin-bottom: 4px; }

.friend-desc { color: var(--text-secondary); font-size: 0.85rem; }

/* ── Linktree ── */
.linktree-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 24px;
}

.linktree-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-weight: 500;
  font-size: 0.95rem;
  transition: all 0.2s;
}

.linktree-link:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.linktree-icon { font-size: 1.2rem; }

/* ── Footer ── */
.site-footer {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 20px 24px;
  width: 100%;
  color: var(--text-muted);
  font-size: 0.78rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
}

/* ── Mobile ── */
@media (max-width: 600px) {
  :root { --header-h: 48px; }
  main { padding: 24px 16px 60px; }
  .hero h1 { font-size: 1.35rem; }
  .article-header h1 { font-size: 1.3rem; }
  .post-item { flex-direction: column; gap: 4px; }
  .post-meta { order: -1; }
  nav { gap: 14px; }
  .site-footer { flex-direction: column; gap: 4px; }
}

/* ── Transition ── */
body, .site-header, main, .site-footer {
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}
