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

:root {
  --color-primary: #0d9488;
  --color-primary-light: #ccfbf1;
  --color-text: #1f2937;
  --color-text-light: #6b7280;
  --color-bg: #ffffff;
  --color-bg-alt: #f9fafb;
  --color-border: #e5e7eb;
  --max-width: 720px;
  --max-width-wide: 1080px;
}

html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.7;
}

a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; display: block; }

.container {
  max-width: var(--max-width-wide);
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ========== Header ========== */
.site-header {
  border-bottom: 1px solid var(--color-border);
  padding: 1rem 0;
  position: sticky;
  top: 0;
  background: var(--color-bg);
  z-index: 100;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.site-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--color-text);
  text-decoration: none;
}
.logo-icon { font-size: 1.4rem; }
.site-nav { display: flex; gap: 1.5rem; }
.nav-link {
  color: var(--color-text-light);
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
}
.nav-link:hover, .nav-link.active {
  color: var(--color-primary);
  text-decoration: none;
}

/* ========== Page Header ========== */
.page-header {
  padding: 3rem 0 2rem;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 2rem;
}
.page-header h1 { font-size: 2rem; }
.page-desc { color: var(--color-text-light); margin-top: 0.5rem; }

/* ========== Post List ========== */
.post-list {
  display: grid;
  gap: 2rem;
  max-width: var(--max-width-wide);
}
.post-card {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  padding: 1.5rem;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  transition: box-shadow 0.2s;
}
.post-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.08); }

@media (min-width: 640px) {
  .post-card.has-image {
    grid-template-columns: 280px 1fr;
  }
}

.post-card-image img {
  border-radius: 8px;
  width: 100%;
  height: 200px;
  object-fit: cover;
}
.post-card-title { font-size: 1.25rem; line-height: 1.4; }
.post-card-title a { color: var(--color-text); }
.post-card-title a:hover { color: var(--color-primary); text-decoration: none; }
.post-meta {
  font-size: 0.85rem;
  color: var(--color-text-light);
  margin: 0.25rem 0 0.75rem;
}
.post-excerpt {
  color: var(--color-text-light);
  font-size: 0.95rem;
  line-height: 1.6;
}
.read-more {
  display: inline-block;
  margin-top: 0.75rem;
  font-weight: 600;
  font-size: 0.9rem;
}

/* ========== Categories & Tags ========== */
.post-categories { margin-bottom: 0.5rem; }
.category-badge {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  background: var(--color-primary-light);
  color: var(--color-primary);
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
}
.post-tags { margin-top: 2rem; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.tag {
  padding: 0.25rem 0.75rem;
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  font-size: 0.85rem;
  color: var(--color-text-light);
  text-decoration: none;
}
.tag:hover { color: var(--color-primary); border-color: var(--color-primary); text-decoration: none; }

/* ========== Single Post ========== */
.post-single {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 0 4rem;
}
.post-header { margin-bottom: 2rem; }
.post-header h1 { font-size: 2rem; line-height: 1.3; margin-top: 0.5rem; }
.post-featured-image {
  margin-bottom: 2rem;
  border-radius: 12px;
  overflow: hidden;
}

/* ========== Table of Contents ========== */
.toc {
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 1rem 1.5rem;
  margin-bottom: 2rem;
}
.toc summary {
  font-weight: 700;
  cursor: pointer;
  font-size: 1rem;
  margin-bottom: 0.5rem;
}
.toc nav ul {
  list-style: none;
  padding-left: 0;
}
.toc nav ul ul { padding-left: 1.25rem; }
.toc nav li { margin: 0.3rem 0; }
.toc nav a {
  color: var(--color-text-light);
  font-size: 0.9rem;
}
.toc nav a:hover { color: var(--color-primary); }

/* ========== Post Content ========== */
.post-content h2 {
  font-size: 1.5rem;
  margin: 2.5rem 0 1rem;
  padding-top: 1rem;
}
.post-content h3 {
  font-size: 1.25rem;
  margin: 2rem 0 0.75rem;
}
.post-content p { margin: 1rem 0; }
.post-content ul, .post-content ol {
  margin: 1rem 0;
  padding-left: 1.5rem;
}
.post-content li { margin: 0.35rem 0; }
.post-content blockquote {
  border-left: 4px solid var(--color-primary);
  padding: 0.75rem 1.25rem;
  margin: 1.5rem 0;
  background: var(--color-bg-alt);
  border-radius: 0 8px 8px 0;
  color: var(--color-text-light);
}
.post-content img {
  border-radius: 8px;
  margin: 1.5rem 0;
}
.post-content strong { color: var(--color-text); }
.post-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.95rem;
}
.post-content th {
  background: var(--color-bg-alt);
  font-weight: 700;
  text-align: left;
  padding: 0.75rem 1rem;
  border: 1px solid var(--color-border);
}
.post-content td {
  padding: 0.75rem 1rem;
  border: 1px solid var(--color-border);
}

/* ========== Author Bio ========== */
.author-bio {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 3rem;
  padding: 1.5rem;
  background: var(--color-bg-alt);
  border-radius: 12px;
  border: 1px solid var(--color-border);
}
.author-name { display: block; font-size: 1rem; }
.author-role {
  display: block;
  color: var(--color-primary);
  font-size: 0.85rem;
  font-weight: 600;
}
.author-desc {
  margin-top: 0.5rem;
  font-size: 0.9rem;
  color: var(--color-text-light);
}
.author-links {
  margin-top: 0.5rem;
  display: flex;
  gap: 1rem;
  font-size: 0.85rem;
  font-weight: 600;
}

/* ========== Ad Container ========== */
.ad-container {
  margin: 2rem 0;
  text-align: center;
}

/* ========== Footer ========== */
.site-footer {
  border-top: 1px solid var(--color-border);
  padding: 2rem 0;
  margin-top: 4rem;
  text-align: center;
  color: var(--color-text-light);
  font-size: 0.85rem;
}

/* ========== Responsive ========== */
@media (max-width: 640px) {
  .page-header h1 { font-size: 1.5rem; }
  .post-header h1 { font-size: 1.5rem; }
  .post-content h2 { font-size: 1.3rem; }
  .site-logo .logo-text { font-size: 0.95rem; }
}
