*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --color-bg: #ffffff;
  --color-text: #1a1a1a;
  --color-muted: #6b7280;
  --color-accent: #2563eb;
  --color-accent-hover: #1d4ed8;
  --color-border: #e5e7eb;
  --color-card-bg: #f9fafb;
  --max-width: 1200px;
  --content-width: 760px;
}

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

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

/* Header */
.site-header {
  border-bottom: 1px solid var(--color-border);
  padding: 1rem 0;
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-logo {
  display: flex;
  align-items: center;
  text-decoration: none;
}

.site-logo img {
  height: 32px;
  width: auto;
}

.site-header nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.site-header nav a {
  color: var(--color-muted);
  text-decoration: none;
  font-size: 0.95rem;
}

.site-header nav a:hover {
  color: var(--color-accent);
}

.site-header nav a.nav-cta {
  color: #ffffff;
  background: #f97316;
  padding: 0.4rem 1rem;
  border-radius: 6px;
  font-weight: 500;
}

.site-header nav a.nav-cta:hover {
  background: #ea580c;
  color: #ffffff;
}

/* Hero */
.hero {
  text-align: center;
  padding: 3rem 0 2rem;
  max-width: var(--content-width);
  margin: 0 auto;
}

.hero h1 {
  font-size: 2rem;
  margin-bottom: 0.75rem;
}

.hero p {
  color: var(--color-muted);
  font-size: 1.1rem;
}

/* Post Grid */
.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 2rem;
  padding: 2rem 0 4rem;
}

.post-card {
  border: 1px solid var(--color-border);
  border-radius: 8px;
  overflow: hidden;
  transition: box-shadow 0.2s;
}

.post-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.post-card-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
  display: block;
}

.post-card-content {
  padding: 1.25rem;
}

.post-card-content h2 {
  font-size: 1.15rem;
  line-height: 1.4;
  margin-bottom: 0.5rem;
}

.post-card-content h2 a {
  color: var(--color-text);
  text-decoration: none;
}

.post-card-content h2 a:hover {
  color: var(--color-accent);
}

.post-card-content p {
  color: var(--color-muted);
  font-size: 0.9rem;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Post Meta */
.post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  color: var(--color-muted);
  font-size: 0.875rem;
  margin-bottom: 0.5rem;
}

.post-meta .author {
  font-weight: 500;
}

/* Tags */
.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tag {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  background: var(--color-card-bg);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  font-size: 0.8rem;
  color: var(--color-muted);
  text-decoration: none;
}

.tag:hover {
  color: var(--color-accent);
  border-color: var(--color-accent);
}

/* Single Post */
.post-single {
  max-width: var(--content-width);
  padding-top: 2rem;
  padding-bottom: 4rem;
}

.post-header h1 {
  font-size: 2.2rem;
  line-height: 1.3;
  margin-bottom: 0.75rem;
}

.featured-image {
  margin: 1.5rem 0 2rem;
}

.featured-image img {
  width: 100%;
  border-radius: 8px;
}

/* Post Content */
.post-content {
  font-size: 1.05rem;
  line-height: 1.8;
}

.post-content h2 {
  font-size: 1.6rem;
  margin: 2rem 0 0.75rem;
}

.post-content h3 {
  font-size: 1.3rem;
  margin: 1.75rem 0 0.5rem;
}

.post-content p {
  margin-bottom: 1.25rem;
}

.post-content a {
  color: var(--color-accent);
  text-decoration: underline;
}

.post-content a:hover {
  color: var(--color-accent-hover);
}

.post-content img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  margin: 1rem 0;
}

.post-content figure {
  margin: 1.5rem 0;
}

.post-content figure img {
  margin: 0;
}

.post-content figcaption {
  text-align: center;
  color: var(--color-muted);
  font-size: 0.9rem;
  margin-top: 0.5rem;
}

.post-content ul,
.post-content ol {
  margin: 1rem 0 1.25rem 1.5rem;
}

.post-content li {
  margin-bottom: 0.5rem;
}

.post-content blockquote {
  border-left: 3px solid var(--color-accent);
  padding-left: 1.25rem;
  margin: 1.5rem 0;
  color: var(--color-muted);
  font-style: italic;
}

.post-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
}

.post-content th,
.post-content td {
  border: 1px solid var(--color-border);
  padding: 0.75rem;
  text-align: left;
}

.post-content th {
  background: var(--color-card-bg);
  font-weight: 600;
}

/* Posts List (tags, etc) */
.posts-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding: 1rem 0 4rem;
}

.posts-list .post-card {
  display: flex;
  flex-direction: row;
}

.posts-list .post-card-image {
  width: 250px;
  min-width: 250px;
  height: auto;
  object-fit: cover;
}

/* 404 Error Page */
.error-page {
  text-align: center;
  padding: 4rem 0 6rem;
  max-width: var(--content-width);
  margin: 0 auto;
}

.error-code {
  font-size: 8rem;
  font-weight: 800;
  line-height: 1;
  color: var(--color-border);
  margin-bottom: 0.5rem;
}

.error-content h1 {
  font-size: 1.8rem;
  margin-bottom: 0.75rem;
}

.error-message {
  color: var(--color-muted);
  font-size: 1.1rem;
  margin-bottom: 2rem;
}

.error-actions {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 3rem;
}

.error-actions .btn-primary {
  display: inline-block;
  background: #f97316;
  color: #ffffff;
  padding: 0.6rem 1.5rem;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 500;
}

.error-actions .btn-primary:hover {
  background: #ea580c;
}

.error-actions .btn-secondary {
  display: inline-block;
  border: 1px solid var(--color-border);
  color: var(--color-text);
  padding: 0.6rem 1.5rem;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 500;
}

.error-actions .btn-secondary:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.error-suggestions {
  text-align: left;
  max-width: 400px;
  margin: 0 auto;
}

.error-suggestions h3 {
  font-size: 1rem;
  color: var(--color-muted);
  margin-bottom: 0.75rem;
}

.error-suggestions ul {
  list-style: none;
}

.error-suggestions li {
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--color-border);
}

.error-suggestions li:last-child {
  border-bottom: none;
}

.error-suggestions a {
  color: var(--color-text);
  text-decoration: none;
  font-size: 0.95rem;
}

.error-suggestions a:hover {
  color: var(--color-accent);
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--color-border);
  padding: 1.5rem 0;
  text-align: center;
  color: var(--color-muted);
  font-size: 0.875rem;
}

/* Responsive */
@media (max-width: 768px) {
  .site-header .container {
    flex-wrap: wrap;
  }

  .site-logo img {
    height: 26px;
  }

  .site-header nav {
    gap: 0.75rem;
  }

  .site-header nav a {
    font-size: 0.85rem;
  }

  .site-header nav a.nav-cta {
    padding: 0.3rem 0.7rem;
    font-size: 0.85rem;
  }

  .posts-grid {
    grid-template-columns: 1fr;
  }

  .posts-list .post-card {
    flex-direction: column;
  }

  .posts-list .post-card-image {
    width: 100%;
    min-width: unset;
    height: 200px;
  }

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

  .hero h1 {
    font-size: 1.5rem;
  }
}
