/* ===== Reset & Base ===== */
*, *::before, *::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI",
               "Hiragino Sans", "Hiragino Kaku Gothic ProN",
               "Noto Sans JP", Meiryo, sans-serif;
  font-size: 1rem;
  line-height: 1.85;
  color: #1a1a1a;
  background: #fff;
}

img {
  max-width: 100%;
  height: auto;
}

a {
  color: #2563eb;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* ===== Layout ===== */
.container {
  max-width: 700px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* ===== Header / Navigation ===== */
.site-header {
  border-bottom: 1px solid #e8e8e8;
  padding: 1rem 0;
  margin-bottom: 3rem;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.site-title {
  font-weight: 700;
  font-size: 1.1rem;
  color: #1a1a1a;
  text-decoration: none;
  margin-right: auto;
}

.site-title:hover {
  text-decoration: none;
  color: #2563eb;
}

.nav-links {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 1.25rem;
}

.nav-links a {
  font-size: 0.875rem;
  color: #4b5563;
  text-decoration: none;
  letter-spacing: 0.02em;
}

.nav-links a:hover {
  color: #1a1a1a;
  text-decoration: none;
}

/* ===== Main Content ===== */
.site-main {
  min-height: calc(100vh - 200px);
}

/* ===== Post List (Index, /posts, tag pages) ===== */
.post-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.post-list-item {
  padding: 1.5rem 0;
  border-bottom: 1px solid #e8e8e8;
}

.post-list-item:first-child {
  padding-top: 0;
}

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

.post-list-title {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 0 0 0.375rem;
  line-height: 1.4;
}

.post-list-title a {
  color: #1a1a1a;
  text-decoration: none;
}

.post-list-title a:hover {
  color: #2563eb;
  text-decoration: none;
}

.post-list-meta {
  font-size: 0.8125rem;
  color: #6b7280;
  margin-bottom: 0.375rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.post-list-excerpt {
  color: #4b5563;
  font-size: 0.9375rem;
  margin: 0;
  line-height: 1.6;
}

/* ===== Tags (inline badges) ===== */
.tag-badge {
  font-size: 0.75rem;
  color: #6b7280;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  padding: 0.1rem 0.45rem;
  text-decoration: none;
  white-space: nowrap;
}

.tag-badge:hover {
  color: #2563eb;
  border-color: #93c5fd;
  text-decoration: none;
}

/* ===== Pagination ===== */
.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2rem 0 1rem;
  font-size: 0.875rem;
}

.pagination a {
  color: #2563eb;
  text-decoration: none;
}

.pagination a:hover {
  text-decoration: underline;
}

.pagination-info {
  color: #6b7280;
}

/* ===== Page Header ===== */
.page-heading {
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #e8e8e8;
}

.page-heading h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0;
  color: #1a1a1a;
}

/* ===== Post Page ===== */
.post-header {
  margin-bottom: 2rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid #e8e8e8;
}

.post-title {
  font-size: 1.625rem;
  font-weight: 700;
  line-height: 1.35;
  margin: 0 0 0.75rem;
  color: #1a1a1a;
}

@media (min-width: 600px) {
  .post-title {
    font-size: 1.875rem;
  }
}

.post-meta {
  font-size: 0.8125rem;
  color: #6b7280;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.625rem;
}

.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}

/* ===== Post Body ===== */
.post-body {
  font-size: 1rem;
  line-height: 1.85;
}

.post-body h2 {
  font-size: 1.375rem;
  font-weight: 700;
  margin: 2.5rem 0 0.75rem;
  padding-bottom: 0.375rem;
  border-bottom: 1px solid #e8e8e8;
  color: #1a1a1a;
}

.post-body h3 {
  font-size: 1.125rem;
  font-weight: 700;
  margin: 2rem 0 0.625rem;
  color: #1a1a1a;
}

.post-body h4 {
  font-size: 1rem;
  font-weight: 700;
  margin: 1.5rem 0 0.5rem;
}

.post-body p {
  margin: 0 0 1.25rem;
}

.post-body ul,
.post-body ol {
  margin: 0 0 1.25rem;
  padding-left: 1.5rem;
}

.post-body li {
  margin-bottom: 0.375rem;
}

.post-body blockquote {
  margin: 1.5rem 0;
  padding: 0.75rem 1.25rem;
  border-left: 3px solid #e8e8e8;
  color: #6b7280;
  font-style: italic;
}

.post-body blockquote p {
  margin: 0;
}

.post-body hr {
  border: none;
  border-top: 1px solid #e8e8e8;
  margin: 2rem 0;
}

.post-body a {
  color: #2563eb;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ===== Code Blocks (Shiki outputs inline styles, minimal overrides needed) ===== */
.post-body pre {
  border-radius: 8px;
  overflow-x: auto;
  font-size: 0.875rem;
  line-height: 1.6;
  margin: 1.5rem 0;
  /* Shiki provides background via inline styles */
}

.post-body pre > code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  background: none !important;
  padding: 0 !important;
}

/* Inline code */
.post-body :not(pre) > code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.875em;
  background: #f3f4f6;
  color: #1a1a1a;
  padding: 0.125em 0.35em;
  border-radius: 3px;
}

/* Shiki wrapper */
.post-body .shiki {
  padding: 1.25rem 1.5rem;
}

/* ===== Post Navigation ===== */
.post-nav {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid #e8e8e8;
  font-size: 0.875rem;
}

.post-nav a {
  display: flex;
  flex-direction: column;
  max-width: 45%;
  color: #4b5563;
  text-decoration: none;
}

.post-nav a:hover {
  color: #2563eb;
}

.nav-label {
  font-size: 0.75rem;
  color: #9ca3af;
  margin-bottom: 0.25rem;
}

.nav-title {
  font-weight: 600;
  line-height: 1.4;
}

.post-nav-next {
  margin-left: auto;
  text-align: right;
}

/* ===== About / Static Pages ===== */
.page-header {
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #e8e8e8;
}

.page-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0;
}

.page-body {
  font-size: 1rem;
  line-height: 1.85;
}

.page-body p { margin: 0 0 1.25rem; }
.page-body h1, .page-body h2, .page-body h3 {
  font-weight: 700;
  margin: 1.75rem 0 0.625rem;
}
.page-body ul { padding-left: 1.5rem; }

/* ===== Tags List Page ===== */
.tags-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.tags-list-item a {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.9375rem;
  color: #1a1a1a;
  text-decoration: none;
}

.tags-list-item a:hover {
  color: #2563eb;
}

.tag-count {
  font-size: 0.75rem;
  color: #9ca3af;
}

/* ===== Tag Page Header ===== */
.tag-header {
  margin-bottom: 2rem;
}

.tag-header h1 {
  font-size: 1.375rem;
  font-weight: 700;
  margin: 0 0 0.5rem;
}

.tag-description {
  font-size: 0.875rem;
  color: #6b7280;
}

/* ===== Footer ===== */
.site-footer {
  margin-top: 4rem;
  padding: 1.5rem 0 2rem;
  border-top: 1px solid #e8e8e8;
  font-size: 0.8125rem;
  color: #9ca3af;
  text-align: center;
}

.site-footer p {
  margin: 0 0 0.5rem;
}

.footer-links {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  justify-content: center;
  gap: 1rem;
}

.footer-links a {
  color: #9ca3af;
  text-decoration: none;
}

.footer-links a:hover {
  color: #6b7280;
}

/* ===== Responsive ===== */
@media (max-width: 480px) {
  .site-nav {
    gap: 1rem;
  }

  .post-title {
    font-size: 1.375rem;
  }

  .post-nav {
    flex-direction: column;
  }

  .post-nav a {
    max-width: 100%;
  }

  .post-nav-next {
    text-align: left;
    margin-left: 0;
  }
}
