/* ==========================================================
   Blog stylesheet — minimal, dual-theme
   ========================================================== */

:root {
  --bg: #fbfaf8;
  --bg-elevated: #ffffff;
  --text: #1a1a18;
  --text-muted: #6b6a66;
  --border: #e7e5e1;
  --accent: #3d5a4c;
  --accent-soft: #e8efe9;
  --code-bg: #f2f0eb;
  --shadow: 0 1px 2px rgba(20, 20, 18, 0.04);

  --font-display: "Zen Old Mincho", "Shippori Mincho", serif;
  --font-body: "Zen Maru Gothic", "Hiragino Sans", "Noto Sans JP", sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", Menlo, monospace;

  color-scheme: light;
}

html[data-theme="dark"] {
  --bg: #16171a;
  --bg-elevated: #1e2023;
  --text: #e9e8e4;
  --text-muted: #9a9a94;
  --border: #2c2e32;
  --accent: #8fb99e;
  --accent-soft: #23302a;
  --code-bg: #202226;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);

  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.85;
  letter-spacing: 0.01em;
  transition: background-color 0.25s ease, color 0.25s ease;
  min-height: 100vh;
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}
a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

img {
  max-width: 100%;
  display: block;
}

/* ---------- Layout ---------- */

.wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 24px;
}

.site-header {
  border-bottom: 1px solid var(--border);
  padding: 28px 0;
  position: sticky;
  top: 0;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  z-index: 10;
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.site-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text);
}
.site-title span {
  color: var(--accent);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 20px;
  font-size: 0.9rem;
}
.site-nav a {
  color: var(--text-muted);
}
.site-nav a:hover {
  color: var(--text);
}

/* ---------- Theme toggle ---------- */

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  cursor: pointer;
  color: var(--text);
  transition: border-color 0.2s ease, transform 0.2s ease;
  flex-shrink: 0;
}
.theme-toggle:hover {
  border-color: var(--accent);
}
.theme-toggle:active {
  transform: scale(0.92);
}
.theme-toggle svg {
  width: 18px;
  height: 18px;
}
.theme-toggle .icon-moon {
  display: none;
}
html[data-theme="dark"] .theme-toggle .icon-sun {
  display: none;
}
html[data-theme="dark"] .theme-toggle .icon-moon {
  display: block;
}

/* ---------- Main / Hero ---------- */

main {
  padding: 56px 0 96px;
}

.hero {
  margin-bottom: 56px;
}
.hero p {
  color: var(--text-muted);
  font-size: 0.95rem;
  max-width: 46ch;
}

/* ---------- Post list ---------- */

.post-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.post-item {
  padding: 22px 0;
  border-bottom: 1px solid var(--border);
}
.post-item:first-child {
  padding-top: 0;
}

.post-item .date {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: 0.03em;
}

.post-item h2 {
  margin: 6px 0 8px;
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 600;
  line-height: 1.5;
}
.post-item h2 a {
  color: var(--text);
}
.post-item h2 a:hover {
  color: var(--accent);
  text-decoration: none;
}

.post-item .excerpt {
  color: var(--text-muted);
  font-size: 0.92rem;
  margin: 0;
}

.tags {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.tag {
  font-size: 0.72rem;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--font-mono);
}

/* ---------- Article ---------- */

.article-header {
  margin-bottom: 40px;
}
.article-header .date {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
}
.article-header h1 {
  font-family: var(--font-display);
  font-size: 2rem;
  line-height: 1.5;
  margin: 10px 0 14px;
}

.article-body {
  font-size: 1.02rem;
}
.article-body h2 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  margin: 2.4em 0 0.8em;
  padding-top: 0.2em;
  border-top: 1px solid var(--border);
}
.article-body h3 {
  font-size: 1.15rem;
  margin: 2em 0 0.6em;
}
.article-body p {
  margin: 1.1em 0;
}
.article-body ul,
.article-body ol {
  padding-left: 1.4em;
}
.article-body li {
  margin: 0.4em 0;
}
.article-body blockquote {
  margin: 1.6em 0;
  padding: 0.2em 1.2em;
  border-left: 3px solid var(--accent);
  color: var(--text-muted);
  font-style: italic;
}
.article-body code {
  font-family: var(--font-mono);
  background: var(--code-bg);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  font-size: 0.88em;
}
.article-body pre {
  background: var(--code-bg);
  padding: 18px 20px;
  border-radius: 8px;
  overflow-x: auto;
  border: 1px solid var(--border);
}
.article-body pre code {
  background: none;
  padding: 0;
}
.article-body hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2.4em 0;
}
.article-body img {
  border-radius: 8px;
  margin: 1.6em 0;
}
.article-body a {
  text-decoration: underline;
  text-decoration-color: var(--border);
  text-underline-offset: 3px;
}
.article-body a:hover {
  text-decoration-color: var(--accent);
}

.post-nav {
  margin-top: 64px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-size: 0.9rem;
}
.post-nav a {
  color: var(--text-muted);
}
.back-link {
  display: inline-block;
  margin-bottom: 8px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ---------- Footer ---------- */

.site-footer {
  border-top: 1px solid var(--border);
  padding: 32px 0;
  color: var(--text-muted);
  font-size: 0.82rem;
}
.site-footer .wrap {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

/* ---------- Empty state ---------- */

.empty {
  color: var(--text-muted);
  padding: 40px 0;
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: 10px;
}

/* ---------- Responsive ---------- */

@media (max-width: 560px) {
  .wrap {
    padding: 0 18px;
  }
  .article-header h1 {
    font-size: 1.55rem;
  }
  .post-item h2 {
    font-size: 1.12rem;
  }
  .site-nav {
    gap: 12px;
  }
}
