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

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Hiragino Sans", "Noto Sans JP", sans-serif;
  line-height: 1.8;
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
  color: #333;
  background-color: #fdfdfd;
}

/* Skip Link (アクセシビリティ) */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: #333;
  color: #fff;
  padding: 8px 16px;
  text-decoration: none;
  z-index: 100;
}
.skip-link:focus {
  top: 0;
}

/* ==========================================================================
   Header
   ========================================================================== */
header {
  border-bottom: 2px solid #333;
  margin-bottom: 40px;
  padding-bottom: 20px;
}

header h1 {
  margin: 0;
  font-size: 1.5rem;
}

header h1 a {
  color: #333;
  text-decoration: none;
  font-weight: 800;
}

/* ==========================================================================
   Article Card (一覧)
   ========================================================================== */
.article-list {
  display: flex;
  flex-direction: column;
  gap: 30px;
}

.article-card {
  padding-bottom: 30px;
  border-bottom: 1px solid #eee;
}

.article-card:last-child {
  border-bottom: none;
}

.article-card h2 {
  margin: 0 0 10px 0;
  font-size: 1.4rem;
  line-height: 1.4;
}

.article-card h2 a {
  color: #222;
  text-decoration: none;
  transition: color 0.2s;
}

.article-card h2 a:hover {
  color: #0066cc;
}

.article-card p {
  margin: 10px 0 0;
  color: #555;
  font-size: 0.95rem;
}

/* ==========================================================================
   Meta (日付等)
   ========================================================================== */
.meta,
time.meta {
  color: #666;
  font-size: 0.85em;
  background: #f0f0f0;
  display: inline-block;
  padding: 4px 10px;
  border-radius: 4px;
}

/* ==========================================================================
   Pagination
   ========================================================================== */
.pagination {
  margin-top: 50px;
  display: flex;
  gap: 20px;
  align-items: center;
  justify-content: center;
}

.pagination a,
.pagination span {
  padding: 8px 16px;
  border-radius: 4px;
  text-decoration: none;
}

.pagination a {
  background: #333;
  color: #fff;
  transition: background 0.2s;
}

.pagination a:hover {
  background: #555;
}

.pagination .disabled {
  color: #999;
}

.pagination .page-info {
  color: #666;
}

/* ==========================================================================
   Breadcrumb
   ========================================================================== */
.breadcrumb {
  margin-bottom: 20px;
  font-size: 0.9rem;
}

.breadcrumb ol {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.breadcrumb li {
  display: flex;
  align-items: center;
}

.breadcrumb li:not(:last-child)::after {
  content: "›";
  margin-left: 8px;
  color: #999;
}

.breadcrumb a {
  color: #0066cc;
  text-decoration: none;
}

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

/* ==========================================================================
   Article Detail
   ========================================================================== */
.article-detail {
  margin-bottom: 40px;
}

.article-header {
  margin-bottom: 30px;
}

.article-header h1 {
  font-size: 2.2rem;
  margin: 0 0 15px;
  line-height: 1.3;
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  color: #666;
  font-size: 0.9rem;
}

.article-meta .modified {
  color: #888;
}

.article-meta .author::before {
  content: "by ";
}

.article-footer {
  margin-top: 50px;
  padding-top: 30px;
  border-top: 1px solid #eee;
}

.back-link {
  color: #0066cc;
  text-decoration: none;
}

.back-link:hover {
  text-decoration: underline;
}

/* ==========================================================================
   Content (記事本文)
   ========================================================================== */
.content {
  margin-top: 30px;
  font-size: 1.05rem;
}

.content p {
  margin-bottom: 1.5em;
}

/* Headings */
.content h2 {
  margin-top: 2.5em;
  margin-bottom: 1em;
  border-left: 4px solid #333;
  padding-left: 15px;
  font-size: 1.6em;
}

.content h3 {
  margin-top: 2em;
  margin-bottom: 0.8em;
  font-size: 1.3em;
  font-weight: bold;
  border-bottom: 1px solid #ddd;
  padding-bottom: 0.3em;
}

.content h4 {
  margin-top: 1.5em;
  margin-bottom: 0.8em;
  font-size: 1.15em;
  font-weight: bold;
}

/* Lists */
.content ul,
.content ol {
  margin-bottom: 1.5em;
  padding-left: 2em;
}

.content li {
  margin-bottom: 0.5em;
}

/* Quotes */
.content blockquote {
  margin: 1.5em 0;
  padding: 1em 1.5em;
  background: #f9f9f9;
  border-left: 4px solid #ccc;
  font-style: italic;
  color: #555;
}

.content blockquote cite {
  display: block;
  margin-top: 0.5em;
  font-size: 0.9em;
  color: #777;
  font-style: normal;
  text-align: right;
}

/* Code */
.content pre {
  background: #2d2d2d;
  color: #f8f8f2;
  padding: 1em;
  overflow-x: auto;
  border-radius: 6px;
  margin-bottom: 1.5em;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 0.9em;
}

.content code {
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 0.9em;
}

.content p code {
  background-color: #f0f0f0;
  padding: 0.2em 0.4em;
  border-radius: 3px;
}

/* Images */
.content figure {
  margin: 2em 0;
  text-align: center;
}

.content img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.content figcaption {
  margin-top: 0.5em;
  color: #666;
  font-size: 0.9em;
  font-style: italic;
}

/* Tables */
.content table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.5em;
  font-size: 0.95em;
}

.content th,
.content td {
  border: 1px solid #ddd;
  padding: 0.8em;
  text-align: left;
}

.content th {
  background-color: #f5f5f5;
  font-weight: bold;
}

.content tr:nth-child(even) {
  background-color: #fafafa;
}

/* Delimiters */
.content hr {
  border: 0;
  border-top: 1px solid #ddd;
  margin: 3em 0;
}

/* Warning / Callout */
.content .warning {
  background-color: #fff3cd;
  border: 1px solid #ffeeba;
  color: #856404;
  padding: 1em;
  border-radius: 6px;
  margin-bottom: 1.5em;
}

.content .warning strong {
  display: block;
  margin-bottom: 0.5em;
}

/* Checklists */
.content .checklist {
  list-style: none;
  padding-left: 0;
}

.content .checklist li {
  display: flex;
  align-items: flex-start;
  gap: 0.5em;
}

/* ==========================================================================
   Eyecatch Images
   ========================================================================== */
.article-eyecatch {
  margin-bottom: 15px;
  border-radius: 8px;
  overflow: hidden;
}

.article-eyecatch img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  display: block;
}

.article-eyecatch-detail {
  margin: 0 0 30px;
  border-radius: 8px;
  overflow: hidden;
}

.article-eyecatch-detail img {
  width: 100%;
  max-height: 450px;
  object-fit: cover;
  display: block;
}

/* ==========================================================================
   Error Page (404等)
   ========================================================================== */
.error-page {
  text-align: center;
  padding: 60px 20px;
}

.error-page h1 {
  font-size: 6rem;
  margin: 0;
  color: #ddd;
  line-height: 1;
}

.error-page h2 {
  margin: 20px 0;
  font-size: 1.5rem;
}

.error-page p {
  color: #666;
  margin-bottom: 30px;
}

/* ==========================================================================
   Footer
   ========================================================================== */
footer {
  margin-top: 80px;
  text-align: center;
  color: #999;
  border-top: 1px solid #eee;
  padding-top: 30px;
  font-size: 0.9em;
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 600px) {
  body {
    padding: 15px;
  }

  .article-header h1 {
    font-size: 1.6rem;
  }

  .content h2 {
    font-size: 1.4em;
  }

  .article-eyecatch img {
    height: 150px;
  }

  .article-eyecatch-detail img {
    max-height: 250px;
  }

  .error-page h1 {
    font-size: 4rem;
  }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */
@media print {
  body {
    max-width: none;
    padding: 0;
  }

  header,
  footer,
  .pagination,
  .skip-link {
    display: none;
  }

  .article-detail {
    break-inside: avoid;
  }

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

  a[href]::after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
    color: #666;
  }
}