/* ── Design System ── */
:root {
  --accent: #20b2aa;
  --accent-dark: #178f88;
  --accent-light: #d4f5f2;
  --bg: #f7f9fc;
  --card-bg: #ffffff;
  --text: #2c3e50;
  --text-light: #7f8c9b;
  --text-heading: #1a1a2e;
  --border: #e8ecf1;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  --shadow-hover: 0 8px 24px rgba(0, 0, 0, 0.1);
  --radius: 12px;
  --radius-sm: 6px;
}

html, body {
  height: 100%;
  margin: 0;
}

body {
  display: flex;
  text-align: center;
  flex-direction: column;
  font-family: 'Raleway', 'Noto Sans SC', -apple-system, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.8;
  font-size: 16px;
}

h1, h2, h3, h4, h5 {
  color: var(--text-heading);
  font-weight: 700;
  line-height: 1.4;
}

main {
  margin: 0 auto;
  padding: 40px 24px 60px;
  flex: 1 0 auto;
  max-width: 820px;
  width: 100%;
  text-align: left;
}

/* ── Links ── */
a { color: var(--accent); transition: color 0.2s; }
a:hover { color: var(--accent-dark) !important; }

/* ── Section Headers ── */
main > h2 {
  font-size: 1.8rem;
  color: var(--text-heading);
  margin-bottom: 24px;
  padding-bottom: 10px;
  border-bottom: 3px solid var(--accent);
  display: inline-block;
}

/* ── Home page: Intro ── */
.intro {
  text-align: center;
  padding-top: min(10vh, 80px);
}

.intro > h1 {
  color: var(--text-heading);
  font-size: clamp(2.5rem, 7vh, 4rem);
  font-weight: 800;
  margin: 0 0 10px;
  letter-spacing: -0.5px;
}

.intro > h2 {
  color: var(--text-light);
  font-size: clamp(1rem, 2.5vmin, 1.3rem);
  font-weight: 400;
  font-style: italic;
  margin: 0;
}

/* ── Home page: ikirby-style Post List ── */
.home-post-list {
  max-width: 520px;
  margin: 40px auto 0;
  padding: 28px 0 0;
  border-top: 1px solid #e0e4e8;
}

.home-post-list ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.home-post-item {
  padding: 7px 0;
  display: flex;
  align-items: baseline;
  justify-content: flex-start;
  flex-wrap: wrap;
}

.home-post-item a {
  color: #555;
  font-size: 16px;
  text-decoration: none;
  transition: color 0.2s;
  line-height: 1.6;
}

.home-post-item a:hover {
  color: var(--accent);
  text-decoration: none;
}

.home-post-meta {
  color: #aaa;
  font-size: 14px;
  white-space: nowrap;
}

.slash {
  padding: 0 8px;
  color: #ccc;
}

/* ── Home Copyright ── */
.home-copyright {
  max-width: 520px;
  margin: 28px auto 0;
  text-align: center;
  color: #bbb;
  font-size: 13px;
}

/* ── Home Pagination ── */
.home-pagination {
  max-width: 520px;
  margin: 24px auto 0;
  text-align: right;
}

.home-pagination a.next-page {
  color: var(--text-light);
  font-size: 14px;
  text-decoration: none;
  transition: color 0.2s;
}

.home-pagination a.next-page:hover {
  color: var(--accent);
}

/* ═══════════════════════════
   ARTICLE PAGE STYLES
   ═══════════════════════════ */

.article-header {
  text-align: left;
  margin-bottom: 40px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--border);
}

.article-header h1 {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 800;
  line-height: 1.35;
  margin: 0 0 16px;
  color: var(--text-heading);
  letter-spacing: -0.3px;
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 24px;
  align-items: center;
  color: var(--text-light);
  font-size: 14px;
}

.article-meta .date {
  display: flex;
  align-items: center;
  gap: 4px;
}

.article-meta .reading-time {
  display: flex;
  align-items: center;
  gap: 4px;
}

.article-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.article-tags .tag {
  display: inline-block;
  background: var(--accent-light);
  color: var(--accent-dark) !important;
  padding: 4px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s;
}

.article-tags .tag:hover {
  background: var(--accent);
  color: #fff !important;
  text-decoration: none;
}

.article-content {
  background: var(--card-bg);
  padding: 40px 44px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  line-height: 1.9;
  font-size: 16px;
  text-align: left;
}

@media (max-width: 600px) {
  .article-content { padding: 24px 20px; }
}

.article-content h2 {
  font-size: 1.6rem;
  margin: 40px 0 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--accent-light);
  color: var(--text-heading);
}

.article-content h3 {
  font-size: 1.25rem;
  margin: 32px 0 12px;
  color: var(--text-heading);
}

.article-content h4 {
  font-size: 1.1rem;
  margin: 24px 0 10px;
  color: var(--text-heading);
}

.article-content p {
  margin: 0 0 18px;
}

.article-content img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
  margin: 24px auto;
  display: block;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.article-content pre {
  background: #1e1e2e;
  color: #cdd6f4;
  padding: 20px 24px;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  font-size: 14px;
  line-height: 1.6;
  margin: 20px 0;
  box-shadow: inset 0 1px 4px rgba(0,0,0,0.2);
}

.article-content pre code {
  background: transparent;
  color: inherit;
  padding: 0;
  font-size: inherit;
  border: none;
}

.article-content code {
  background: var(--accent-light);
  color: #1a5c55;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.88em;
  font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
}

.article-content blockquote {
  margin: 24px 0;
  padding: 16px 20px 16px 24px;
  border-left: 4px solid var(--accent);
  background: var(--accent-light);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: #3d5a5e;
}

.article-content blockquote p {
  margin: 0;
}

.article-content blockquote p + p {
  margin-top: 12px;
}

.article-content ul, .article-content ol {
  padding-left: 28px;
  margin: 16px 0;
}

.article-content li {
  margin-bottom: 8px;
}

.article-content li > ul, .article-content li > ol {
  margin: 6px 0;
}

.article-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 24px 0;
  font-size: 15px;
}

.article-content th, .article-content td {
  padding: 12px 16px;
  border: 1px solid var(--border);
  text-align: left;
}

.article-content th {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}

.article-content tr:nth-child(even) {
  background: #f8fafc;
}

.article-content tr:hover {
  background: var(--accent-light);
}

.article-content hr {
  border: none;
  height: 2px;
  background: linear-gradient(to right, transparent, var(--accent-light), transparent);
  margin: 36px 0;
}

.article-footer {
  margin-top: 40px;
  padding-top: 24px;
  padding-bottom: 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.article-footer .back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-light);
  text-decoration: none;
  font-size: 15px;
  transition: color 0.2s;
}

.article-footer .back-link:hover {
  color: var(--accent);
  text-decoration: none;
}

.article-copyright {
  text-align: center;
  color: var(--text-light);
  font-size: 13px;
  margin: 0;
  padding: 16px 0 8px;
  border-top: none;
}

/* ── Post list page ── */
.item {
  padding: 18px 24px;
  margin: 12px 0;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform 0.25s, box-shadow 0.25s;
  text-align: left;
}

.item:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
}

.item h4 {
  margin: 0 0 6px;
  font-size: 1.2em;
}

.item h4 a {
  color: var(--text);
  text-decoration: none;
  transition: color 0.2s;
}

.item h4 a:hover {
  color: var(--accent);
}

.item h5 {
  color: var(--text-light);
  font-size: 0.85em;
  margin: 0 0 10px;
  font-weight: 400;
}

.item-tag {
  background-color: var(--accent);
  color: #fff !important;
  border: none;
  padding: 3px 12px;
  border-radius: 20px;
  font-size: 0.78em;
  font-weight: 600;
  transition: opacity 0.2s;
}

.item-tag:hover {
  opacity: 0.85;
  color: #fff !important;
  text-decoration: none;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  main { padding: 24px 16px 40px; }
  .article-content { padding: 20px 16px; border-radius: var(--radius-sm); }
  .article-header h1 { font-size: 1.5rem; }
  .article-content pre { padding: 14px 16px; font-size: 13px; }
  .intro > h1 { font-size: 2rem; }
  .intro > h2 { font-size: 1rem; }
  .intro { padding-top: 4vh; }
  .home-post-list { max-width: 100%; }
  .home-copyright { max-width: 100%; }
  .home-pagination { max-width: 100%; }
  .item { padding: 14px 16px; }
}