:root {
  --color-text: #333333;
  --color-bg: #fff;
  --color-muted: #666;
  --color-border: #e2e2e2;
  --color-accent: #2b8900;
  --color-link: #2b8900;
  --color-link-active: #36ad00;
  --color-link-visited: #1f6600;
  --max-width: 1100px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, "Hiragino Sans", "Noto Sans JP", sans-serif;
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.7;
}

a {
  color: var(--color-link);
  text-decoration: none;
}
a:visited {
  color: var(--color-link-visited);
}
a:hover,
a:active {
  color: var(--color-link-active);
  text-decoration: underline;
}

/* --- header --- */
.site-header {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.site-title {
  display: flex;
  align-items: center;
  font-weight: bold;
  font-size: 1.2rem;
  color: var(--color-text);
}
.site-nav a {
  margin-left: 1rem;
  color: var(--color-text);
}

/* --- hero --- */
.hero {
  position: relative;
  height: 200px;
  overflow: hidden;
  background-color: #333;
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: center;
  justify-content: center;
}
.hero-overlay {
  color: #fff;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 2rem;
  padding-left: 14.3%;
}
.hero-overlay h1 {
  font-size: 2rem;
  margin: 0;
  text-align: center;
}
.hero-logo-link {
  display: block;
}
.hero-logo {
  max-height: 160px;
  width: auto;
}

/* --- 2-column layout --- */
.layout-2col {
  max-width: var(--max-width);
  margin: 2rem auto;
  padding: 0 1.5rem;
  display: flex;
  gap: 2rem;
  align-items: flex-start;
}
.main-col {
  flex: 1 1 0;
  min-width: 0;
}
.side-col {
  flex: 0 0 240px;
}

@media (max-width: 760px) {
  .layout-2col {
    flex-direction: column;
  }
  .side-col {
    flex-basis: auto;
  }
}

/* --- post card --- */
.post-card {
  border-bottom: 1px solid var(--color-border);
  padding: 1.25rem 0;
}
.post-card-link {
  display: flex;
  gap: 1rem;
  color: var(--color-text);
  text-decoration: none;
}
.post-card-link:hover h2 {
  text-decoration: underline;
}
.post-thumb {
  flex: 0 0 160px;
  width: 160px;
  height: 100px;
  object-fit: cover;
  border-radius: 4px;
}
.post-card-body h2 {
  margin: 0 0 0.4rem;
  font-size: 1.1rem;
}
.post-excerpt {
  margin: 0;
  color: var(--color-muted);
  font-size: 0.95rem;
}

@media (max-width: 480px) {
  .post-card-link {
    flex-direction: column;
  }
  .post-thumb {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
  }
}

/* --- category list --- */
.category-list,
.page-list {
  list-style: none;
  padding: 0;
  margin: 0 0 1.5rem;
}
.category-list li,
.page-list li {
  padding: 0.3rem 0;
}
.archive-select {
  width: 100%;
  padding: 0.4rem;
  font-size: 0.95rem;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  background: #fff;
  color: var(--color-text);
}

/* --- single post --- */
.single-post {
  max-width: 720px;
  margin: 2rem auto;
  padding: 0 1.5rem;
}
.draft-banner {
  color: #d94040;
  font-weight: bold;
  text-align: center;
  margin: 0 0 1rem;
}
.post-meta {
  color: var(--color-muted);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
}
.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.post-tag {
  display: inline-block;
  font-size: 0.82rem;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  background: rgba(43, 137, 0, 0.08);
  color: var(--color-link);
}
.post-tag:hover {
  background: rgba(43, 137, 0, 0.16);
  text-decoration: none;
}
.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1.5rem;
}
.related-posts {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--color-border);
}
.related-posts h3 {
  font-size: 1rem;
  margin: 0 0 0.6rem;
  color: var(--color-muted);
}
.related-posts-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.related-posts-list li {
  padding: 0.25rem 0;
}
.post-pager {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--color-border);
}
.post-pager-next {
  text-align: right;
  margin-left: auto;
}
.post-content img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 1rem 0;
}

.post-content blockquote {
  margin: 1.5rem 0;
  padding: 0.6rem 1.2rem;
  border-left: 4px solid var(--color-border);
  background: rgba(0, 0, 0, 0.035);
  color: var(--color-muted);
}
.post-content blockquote > :first-child {
  margin-top: 0;
}
.post-content blockquote > :last-child {
  margin-bottom: 0;
}

.post-content pre,
.post-content code {
  font-family: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.9rem;
}
.post-content code {
  background: rgba(0, 0, 0, 0.06);
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
}
.post-content pre code {
  background: none;
  padding: 0;
}
.post-content pre {
  padding: 1rem;
  border-radius: 6px;
  overflow-x: auto;
  background: #272822;
  color: #f8f8f2;
}
.post-content .highlight {
  margin: 1.5rem 0;
}
.post-content .highlight pre {
  margin: 0;
}

.post-content table {
  border-collapse: collapse;
  width: 100%;
  margin: 1.5rem 0;
  font-size: 0.95rem;
}
.post-content th,
.post-content td {
  border: 1px solid var(--color-border);
  padding: 0.5rem 0.8rem;
  text-align: left;
}
.post-content th {
  background: rgba(43, 137, 0, 0.1);
  font-weight: bold;
}
.post-content tbody tr:nth-child(even) {
  background: rgba(0, 0, 0, 0.03);
}

.embed {
  margin: 1.5rem 0;
}
.embed-youtube iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
}

.callout {
  margin: 1.5rem 0;
  padding: 0.8rem 1rem;
  border-left: 4px solid var(--color-accent);
  background: rgba(42, 110, 219, 0.08);
  border-radius: 4px;
}
.callout-title {
  margin: 0 0 0.4rem;
  font-weight: bold;
}
.callout-body > :first-child {
  margin-top: 0;
}
.callout-body > :last-child {
  margin-bottom: 0;
}
.callout-warning {
  border-left-color: #d9a400;
  background: rgba(217, 164, 0, 0.1);
}
.callout-danger,
.callout-error {
  border-left-color: #d94040;
  background: rgba(217, 64, 64, 0.1);
}
.callout-tip,
.callout-success {
  border-left-color: #2fa84f;
  background: rgba(47, 168, 79, 0.1);
}

/* --- pagination --- */
.pagination {
  display: flex;
  flex-wrap: wrap;
  list-style: none;
  padding: 0;
  margin: 2rem 0;
  gap: 0.4rem;
}
.page-item .page-link {
  display: inline-block;
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  color: var(--color-link);
  text-decoration: none;
}
.page-item .page-link:hover {
  text-decoration: none;
  background: rgba(43, 137, 0, 0.08);
}
.page-item.active .page-link {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: #fff;
}
.page-item.disabled .page-link {
  color: var(--color-muted);
  cursor: default;
}

/* --- 404 page --- */
.error-page {
  max-width: 600px;
  margin: 4rem auto;
  padding: 0 1.5rem;
  text-align: center;
}
.error-image {
  max-width: 100%;
  height: auto;
  margin-bottom: 2rem;
}
.error-page p {
  text-align: left;
  color: var(--color-text);
  line-height: 1.8;
}

/* --- footer --- */
.site-footer {
  max-width: var(--max-width);
  margin: 2rem auto;
  padding: 1.5rem;
  color: var(--color-muted);
  font-size: 0.85rem;
  text-align: center;
}
