/* common.css — Tokyo Notes blog entry pages */
:root {
  --bg: #fafafa; --text: #1a1a1a; --text-sub: #6b7280;
  --accent: #2563eb; --accent-light: #eff6ff;
  --border: #e5e7eb; --card-bg: #fff; --code-bg: #f3f4f6;
  --tag-bg: #eff6ff;
  --header-bg: #111827; --header-text: #f9fafb; --header-sub: #9ca3af;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f172a; --text: #e2e8f0; --text-sub: #94a3b8;
    --accent: #60a5fa; --accent-light: #1e3a5f;
    --border: #334155; --card-bg: #1e293b; --code-bg: #1e293b;
    --tag-bg: #1e3a5f;
    --header-bg: #020617; --header-text: #f1f5f9; --header-sub: #64748b;
  }
}

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

body {
  font-family: "Noto Serif JP", "Hiragino Mincho ProN", "Yu Mincho", "Source Han Serif", "Times New Roman", serif;
  background: var(--bg); color: var(--text); line-height: 1.8; font-size: 16px;
}

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

/* ===== COMPACT HEADER ===== */
.site-header {
  background: var(--header-bg);
  color: var(--header-text);
  padding: 16px 20px;
}
.header-inner {
  max-width: 800px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
}
.header-title {
  font-size: 1.3em; font-weight: 900; letter-spacing: 0.06em;
  color: var(--header-text); text-decoration: none;
}
.header-title:hover { text-decoration: none; opacity: 0.85; }
.header-nav {
  display: flex; gap: 20px; font-size: 0.88em;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans", sans-serif;
}
.header-nav a {
  color: var(--header-sub); text-decoration: none;
  padding: 4px 0; border-bottom: 2px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}
.header-nav a:hover {
  color: var(--header-text); border-bottom-color: var(--accent);
  text-decoration: none;
}

/* ===== LAYOUT ===== */
.container { max-width: 800px; margin: 0 auto; padding: 0 20px; }

/* ===== OLD HEADER (fallback, overridden by site.js) ===== */
header { border-bottom: 1px solid var(--border); padding: 20px 0; margin-bottom: 30px; }
header h1 { font-size: 1.5em; }
header h1 a { color: var(--text); }
header p { font-size: 0.9em; opacity: 0.7; margin-top: 4px; }
nav { margin-top: 10px; font-size: 0.9em; }
nav a { margin-right: 12px; }

/* ===== POST LIST (top/category pages) ===== */
.post-list { list-style: none; }
.post-item { padding: 16px 0; border-bottom: 1px solid var(--border); }
.post-item h2 { font-size: 1.15em; margin-bottom: 4px; }
.post-meta { font-size: 0.85em; opacity: 0.6; }
.post-meta .cat { background: var(--tag-bg); padding: 2px 8px; border-radius: 4px; font-size: 0.85em; }

/* ===== ARTICLE ===== */
article { padding: 40px 0; }
article h1 { font-size: 1.6em; margin-bottom: 8px; line-height: 1.4; }
article .meta {
  font-size: 0.88em; color: var(--text-sub); margin-bottom: 32px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans", sans-serif;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
article .meta .cat a {
  font-size: 0.78em; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.04em; padding: 2px 10px; border-radius: 20px;
  text-decoration: none; transition: opacity 0.2s;
}
article .meta .cat a:hover { opacity: 0.8; text-decoration: none; }

/* Category colors */
.cat a[href*="overseas"]     { color: #059669; background: #ecfdf5; }
.cat a[href*="tech"]         { color: #2563eb; background: #eff6ff; }
.cat a[href*="diary"]        { color: #6b7280; background: #f3f4f6; }
.cat a[href*="gadget"]       { color: #d97706; background: #fffbeb; }
.cat a[href*="chinese"]      { color: #dc2626; background: #fef2f2; }
.cat a[href*="convenience"]  { color: #8b5cf6; background: #f5f3ff; }
.cat a[href*="music"]        { color: #ec4899; background: #fdf2f8; }
@media (prefers-color-scheme: dark) {
  .cat a[href*="overseas"]     { color: #6ee7b7; background: #064e3b; }
  .cat a[href*="tech"]         { color: #93c5fd; background: #1e3a5f; }
  .cat a[href*="diary"]        { color: #d1d5db; background: #374151; }
  .cat a[href*="gadget"]       { color: #fcd34d; background: #451a03; }
  .cat a[href*="chinese"]      { color: #fca5a5; background: #450a0a; }
  .cat a[href*="convenience"]  { color: #c4b5fd; background: #2e1065; }
  .cat a[href*="music"]        { color: #f9a8d4; background: #500724; }
}

/* ===== ARTICLE CONTENT ===== */
article .content { line-height: 1.9; }
article .content h1, article .content h2, article .content h3 {
  margin-top: 1.8em; margin-bottom: 0.6em;
}
article .content h2 {
  font-size: 1.3em; border-bottom: 1px solid var(--border); padding-bottom: 6px;
}
article .content h3 { font-size: 1.1em; }
article .content p { margin-bottom: 1em; }
article .content img {
  max-width: 100%; height: auto; border-radius: 6px; margin: 12px 0;
}
article .content table {
  border-collapse: collapse; width: 100%; margin: 16px 0; font-size: 0.9em;
}
article .content th, article .content td {
  border: 1px solid var(--border); padding: 8px 12px; text-align: left;
}
article .content th { background: var(--code-bg); }
article .content pre {
  background: var(--code-bg); padding: 16px; border-radius: 8px;
  overflow-x: auto; font-size: 0.9em; margin: 16px 0;
}
article .content code {
  background: var(--code-bg); padding: 2px 6px; border-radius: 3px; font-size: 0.9em;
}
article .content pre code { background: none; padding: 0; }
article .content blockquote {
  border-left: 3px solid var(--accent); padding-left: 16px;
  margin: 16px 0; color: var(--text-sub);
}
article .content ul, article .content ol { margin: 8px 0 16px 24px; }

/* ===== POST NAV (prev/next) ===== */
.post-nav {
  display: flex; justify-content: space-between; gap: 16px;
  padding: 24px 0; border-top: 1px solid var(--border); margin-top: 40px;
  font-size: 0.88em;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans", sans-serif;
}
.post-nav a { flex: 1; }
.post-nav a:last-child { text-align: right; }

/* ===== PAGINATION ===== */
.pagination { padding: 20px 0; text-align: center; font-size: 0.9em; }
.pagination a, .pagination span { margin: 0 8px; }
.pagination .current { font-weight: bold; }

/* ===== FOOTER ===== */
footer {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans", sans-serif;
  border-top: 1px solid var(--border); padding: 24px 0;
  text-align: center; font-size: 0.82em; color: var(--text-sub);
  margin-top: 40px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 600px) {
  body { font-size: 15px; }
  .container { padding: 0 16px; }
  .header-inner { flex-direction: column; gap: 8px; text-align: center; }
  .header-title { font-size: 1.15em; }
  .post-nav { flex-direction: column; gap: 12px; }
  .post-nav a:last-child { text-align: left; }
}
