/* ===== Variables ===== */
:root {
  --color-primary: #7f22fe;
  --color-primary-dark: #6a1bd4;
  --color-primary-light: #f3ecff;
}

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

html {
  font-size: 18px;
  overflow-wrap: break-word;
}

body {
  font-family: "Hiragino Kaku Gothic ProN", "Hiragino Sans", Meiryo, sans-serif;
  line-height: 1.8;
  color: #333;
  background: #f4f5f7;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--color-primary);
  text-decoration: none;
}

a:hover {
  color: #e53900;
  text-decoration: underline;
}

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

ul, ol {
  list-style: none;
}

/* ===== Utility ===== */
.wrap {
  max-width: 1256px;
  margin: 0 auto;
  padding: 0 2px;
}

/* ===== Container ===== */
.container {
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

/* ===== Header ===== */
.site-header {
  background: url('/images/bg.png') repeat-x center top;
  border-bottom: 1px solid #ddd;
}

.site-header .header-content {
  background-image: url('/images/header.png');
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  min-height: 200px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.header-content {
  padding: 12px 0;
  text-align: center;
}

.logo {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.site-name-text {
  font-size: 1.6rem;
  font-weight: 700;
  color: #333;
  text-decoration: none;
}

.site-name-text:hover {
  color: #333;
  text-decoration: none;
}

.tagline {
  font-size: 0.75rem;
  color: #888;
}

/* ===== Navigation ===== */
.nav {
  background: var(--color-primary);
}

.nav-list {
  display: flex;
  justify-content: center;
  list-style: none;
}

.menu-item a {
  display: block;
  padding: 10px 24px;
  color: #fff;
  font-size: 0.8rem;
  text-decoration: none;
  transition: background 0.2s;
}

.menu-item a:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  text-decoration: none;
}

/* ===== Content Layout ===== */
.content {
  padding: 20px 0;
}

.content-inner {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
}

/* ===== Main ===== */
.main {
  width: 860px;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 36px 29px;
}

/* ===== Entry Cards (Article List) ===== */
.entry-cards {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.entry-card {
  background: #fff;
  border-radius: 4px;
  overflow: hidden;
  transition: box-shadow 0.2s;
}

.entry-card:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.entry-card-link {
  display: flex;
  text-decoration: none;
  color: inherit;
}

.entry-card-link:hover {
  text-decoration: none;
  color: inherit;
}

.entry-card-thumb {
  flex-shrink: 0;
  width: 200px;
  height: 133px;
  overflow: hidden;
  margin: 0;
}

.entry-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.entry-card-thumb.no-image {
  background: #e8e8e8;
  display: flex;
  align-items: center;
  justify-content: center;
}

.no-image-text {
  color: #aaa;
  font-size: 0.75rem;
}

.entry-card-content {
  flex: 1;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.entry-card-title {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.5;
  color: #333;
  margin-bottom: 4px;
}

.entry-card-snippet {
  font-size: 0.78rem;
  color: #666;
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}

.entry-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.72rem;
  color: #999;
  margin-top: 4px;
}

.cat-label {
  display: inline-block;
  background: var(--color-primary);
  color: #fff;
  padding: 1px 8px;
  border-radius: 2px;
  font-size: 0.67rem;
  text-decoration: none;
}

a.cat-label:hover {
  opacity: 0.8;
  color: #fff;
  text-decoration: none;
}

/* ===== Single Article ===== */
.article-header {
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid #eee;
}

.article-title {
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 8px;
}

.article-meta {
  display: flex;
  gap: 16px;
  font-size: 0.78rem;
  color: #999;
  margin-bottom: 8px;
}

.article-categories {
  display: flex;
  gap: 4px;
}

.article-thumbnail {
  margin-bottom: 24px;
}

.article-thumbnail img {
  width: 100%;
  border-radius: 4px;
}

/* ===== Article Body ===== */
.article-body {
  font-size: 1rem;
  line-height: 2;
}

.article-body h2 {
  font-size: 1.4rem;
  font-weight: 700;
  padding: 12px 16px;
  margin: 40px 0 24px;
  background: var(--color-primary);
  color: #fff;
  border-radius: 4px;
}

.article-body h3 {
  font-size: 1.15rem;
  font-weight: 700;
  padding: 8px 0;
  margin: 32px 0 16px;
  border-bottom: 3px solid var(--color-primary);
}

.article-body h4 {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 24px 0 12px;
  padding-left: 12px;
  border-left: 4px solid var(--color-primary);
}

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

.article-body ul,
.article-body ol {
  margin: 0 0 1.5em 1.5em;
  list-style: revert;
}

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

.article-body blockquote {
  background: #f7f7f7;
  border-left: 4px solid #ccc;
  padding: 16px 20px;
  margin: 0 0 1.5em;
  color: #666;
}

.article-body pre {
  background: #272822;
  color: #f8f8f2;
  padding: 16px 20px;
  border-radius: 4px;
  overflow-x: auto;
  margin: 0 0 1.5em;
  font-size: 0.85rem;
  line-height: 1.5;
}

.article-body code {
  background: #f0f0f0;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 0.9em;
}

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

.article-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 1.5em;
}

.article-body th,
.article-body td {
  border: 1px solid #ddd;
  padding: 8px 12px;
}

.article-body th {
  background: #f7f7f7;
  font-weight: 700;
}

/* ===== Article Tags ===== */
.article-tags {
  margin-top: 32px;
  padding-top: 16px;
  border-top: 1px solid #eee;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag-link {
  display: inline-block;
  background: #f0f0f0;
  color: #666;
  padding: 4px 12px;
  border-radius: 3px;
  font-size: 0.78rem;
  text-decoration: none;
  transition: background 0.2s;
}

.tag-link:hover {
  background: #e0e0e0;
  color: #333;
  text-decoration: none;
}

/* ===== Post Navigation ===== */
.post-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 32px;
  padding-top: 16px;
  border-top: 1px solid #eee;
  gap: 16px;
}

.prev-post,
.next-post {
  flex: 0 0 calc(50% - 8px);
}

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

.post-nav a {
  display: block;
  padding: 12px;
  background: #f7f7f7;
  border-radius: 4px;
  text-decoration: none;
  transition: background 0.2s;
}

.post-nav a:hover {
  background: #eee;
  text-decoration: none;
}

.post-nav-label {
  display: block;
  font-size: 0.72rem;
  color: #999;
}

.post-nav-title {
  display: block;
  font-size: 0.85rem;
  color: #333;
  margin-top: 4px;
}

/* ===== Sidebar ===== */
.sidebar {
  width: 376px;
}

.sidebar-sticky {
  position: sticky;
  top: 16px;
}

.widget {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 20px;
  margin-bottom: 16px;
}

.widget-title {
  font-size: 0.9rem;
  font-weight: 700;
  padding-bottom: 8px;
  margin-bottom: 12px;
  border-bottom: 2px solid var(--color-primary);
}

/* Profile Widget */
.author-box {
  text-align: center;
}

.author-avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  border: 3px solid #ddd;
  margin-bottom: 8px;
}

.author-name {
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 4px;
}

.author-description {
  font-size: 0.78rem;
  color: #666;
}

/* Search Widget */
.search-form {
  display: flex;
}

.search-input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 4px 0 0 4px;
  font-size: 0.85rem;
  outline: none;
}

.search-input:focus {
  border-color: var(--color-primary);
}

.search-submit {
  padding: 8px 16px;
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: 0 4px 4px 0;
  font-size: 0.85rem;
  cursor: pointer;
}

.search-submit:hover {
  background: var(--color-primary-dark);
}

/* Recent Posts Widget */
.recent-posts li {
  border-bottom: 1px dashed #eee;
}

.recent-posts li:last-child {
  border-bottom: none;
}

.recent-post-title {
  display: block;
  padding: 8px 0;
  text-decoration: none;
  font-size: 0.85rem;
  color: #333;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.recent-post-title:hover {
  color: var(--color-primary);
  text-decoration: none;
}

/* Category Widget */
.category-list li {
  border-bottom: 1px dashed #eee;
}

.category-list li:last-child {
  border-bottom: none;
}

.category-list a {
  display: block;
  padding: 6px 0;
  font-size: 0.85rem;
}

/* Tag Cloud Widget */
.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* ===== Pagination ===== */
.pagination {
  display: flex;
  justify-content: center;
  gap: 4px;
  margin-top: 32px;
  list-style: none;
}

.page-item .page-link,
.pagination a,
.pagination span {
  display: inline-block;
  padding: 8px 14px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 0.85rem;
  color: #333;
  text-decoration: none;
}

.page-item.active .page-link,
.pagination .current {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}

.pagination a:hover {
  background: #f0f0f0;
  text-decoration: none;
}

/* ===== Archive Title ===== */
.archive-title {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 24px;
  padding-bottom: 8px;
  border-bottom: 3px solid var(--color-primary);
}

/* ===== 404 ===== */
.not-found {
  text-align: center;
  padding: 40px 0;
}

.not-found-image {
  width: 256px;
  height: 256px;
  margin-bottom: 24px;
}

.not-found-message {
  font-size: 1rem;
  color: #666;
  margin-bottom: 24px;
}

.not-found-link {
  display: inline-block;
  padding: 10px 24px;
  background: var(--color-primary);
  color: #fff;
  border-radius: 4px;
  text-decoration: none;
}

.not-found-link:hover {
  background: var(--color-primary-dark);
  color: #fff;
  text-decoration: none;
}

/* ===== Footer ===== */
.site-footer {
  background: #333;
  color: #fff;
  margin-top: 20px;
}

.footer-content {
  padding: 20px;
}

.footer-bottom {
  text-align: center;
}

.copyright {
  font-size: 0.78rem;
  color: #ccc;
}

.copyright a {
  color: inherit;
  text-decoration: none;
}

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

/* ===== Responsive ===== */
@media (max-width: 1023px) {
  .main {
    width: 100%;
  }

  .sidebar {
    width: 100%;
  }

  .content-inner {
    flex-direction: column;
    gap: 20px;
    padding: 0 12px;
  }

  .header-content {
    padding: 12px;
  }
}

@media (max-width: 834px) {
  html {
    font-size: 16px;
  }

  .main {
    padding: 24px 16px;
    border: none;
  }

  .entry-card-link {
    flex-direction: column;
  }

  .entry-card-thumb {
    width: 100%;
    height: 180px;
  }

  .header-content {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .nav-list {
    flex-wrap: wrap;
  }

  .sidebar-sticky {
    position: static;
  }
}

@media (max-width: 480px) {
  .article-title {
    font-size: 1.3rem;
  }

  .article-body h2 {
    font-size: 1.15rem;
  }

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

  .next-post {
    text-align: left;
  }
}
