:root {
  --bg: #ffffff;
  --text: #0f172a;
  --muted: #475569;
  --card: #ffffff;
  --border: #e2e8f0;
  --accent: #0ea5a4;
  --accent-hover: #0d9488;
  --transition: all .3s ease;
}

/* Reset */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font: 16px/1.6 Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

/* Links */
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

/* Hero */
.blog-hero {
  position: relative;
  background: url('/assets/images/blog-hero.jpg') center/cover no-repeat;
  text-align: center;
  padding: 60px 20px;
  color: var(--text);
}
.blog-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.75);
}
.blog-hero h1,
.blog-hero p { position: relative; z-index: 1; }
.blog-hero h1 { font-size: 3rem; margin-bottom: .5rem; }
.blog-hero p { font-size: 1.125rem; color: var(--muted); }

/* Layout */
.container {
  display: flex;
  max-width: 1200px;
  margin: 40px auto;
  gap: 20px;
  padding: 0 20px;
}
.main-col { flex: 1; min-width: 0; }
.sidebar { width: 300px; flex-shrink: 0; }

@media (max-width: 900px) {
  .container { flex-direction: column; }
  .sidebar { width: 100%; }
}

/* Posts */
.post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}
.post-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  transition: var(--transition);
}
.post-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 20px rgba(15,23,42,.12);
}
.thumbnail { position: relative; overflow: hidden; }
.thumbnail img,
.thumbnail .no-thumb {
  width: 100%;
  height: 160px;
  object-fit: cover;
  background: var(--border);
  display: block;
}
.thumbnail .date {
  position: absolute;
  top: 10px; right: 10px;
  background: var(--accent);
  color: #ffffff;
  padding: 4px 8px;
  font-size: .85rem;
  font-weight: bold;
  border-radius: 4px;
  z-index: 2;
  text-transform: uppercase;
  box-shadow: 0 2px 4px rgba(15,23,42,.12);
}
.card-body { padding: 15px; }
.card-body h3 { margin-bottom: 8px; font-size: 1.2rem; color: var(--text); }
.card-body p { margin-bottom: 12px; color: var(--muted); font-size: .95rem; }
.read-more { font-weight: bold; color: var(--accent); }
.read-more:hover { color: var(--accent-hover); }

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 30px 0;
}
.pagination a {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  background: var(--card);
}
.pagination a:hover { border-color: var(--accent); color: var(--accent); }
.pagination .active a {
  background: var(--accent);
  color: #ffffff;
  border: 1px solid var(--accent);
}

/* Sidebar widgets */
.widget {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
}
.widget h4 {
  margin-bottom: 15px;
  color: var(--accent);
  border-bottom: 1px solid var(--border);
  padding-bottom: 5px;
}

/* Search */
.search-form { display: flex; gap: 6px; }
.search-form input {
  flex: 1;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 4px 0 0 4px;
  background: #ffffff;
  color: var(--text);
}
.search-form button {
  padding: 0 12px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #ffffff;
  border-radius: 0 4px 4px 0;
  cursor: pointer;
  transition: var(--transition);
}
.search-form button:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

/* Lists */
.popular-posts li,
.categories li {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.popular-posts img {
  width: 50px; height: 50px;
  object-fit: cover; border-radius: 4px;
}
.categories a { flex: 1; color: var(--text); }
.categories span { color: var(--muted); }

/* Tags */
.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tags a {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: .85rem;
  background: var(--bg);
  color: var(--text);
}
.tags a:hover { border-color: var(--accent); color: var(--accent); }

/* Back to top */
.up-to-top {
  position: fixed;
  right: 20px; bottom: 40px;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--accent);
  color: #ffffff;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
  cursor: pointer;
  transition: var(--transition);
  z-index: 100;
  border: 1px solid var(--accent);
}
.up-to-top:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

/* Subscribe */
.widget.subscribe-widget { }
.subscribe-description {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: .95rem;
  line-height: 1.4;
}
.subscribe-form { display: flex; width: 100%; gap: 6px; }
.subscribe-form input[type="email"] {
  flex: 1; min-width: 0;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 4px 0 0 4px;
  background: #ffffff;
  color: var(--text);
  font-size: 0.95rem;
  box-sizing: border-box;
}
.subscribe-form button {
  flex: 0 0 auto;
  padding: 0 12px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #ffffff;
  border-radius: 0 4px 4px 0;
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.95rem;
}
.subscribe-form button:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

/* Flash messages */
.flash {
  padding: 10px;
  border-radius: 6px;
  margin-bottom: 15px;
  font-weight: bold;
}
.flash-success {
  background: #ecfdf5;
  border: 1px solid #bbf7d0;
  color: #166534;
}
.flash-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}

/* Responsive */
@media (max-width: 768px) {
  .blog-hero { padding: 45px 15px; }
  .blog-hero h1 { font-size: 2.5rem; }
  .blog-hero p { font-size: 1rem; }

  .container {
    flex-direction: column;
    margin: 20px auto;
    padding: 0 15px;
    gap: 15px;
  }
  .sidebar { width: 100%; margin-top: 20px; }

  .post-grid { grid-template-columns: 1fr; gap: 15px; }
  .thumbnail img, .thumbnail .no-thumb { height: 120px; }

  .card-body { padding: 12px; }
  .card-body h3 { font-size: 1.1rem; }
  .card-body p { font-size: .9rem; }

  .pagination { margin: 20px 0; gap: 8px; }
  .pagination a { padding: 5px 10px; font-size: .9rem; }

  .widget { padding: 15px; margin-bottom: 15px; }
  .widget h4 { font-size: 1rem; }

  .search-form input { padding: 6px; font-size: .9rem; }
  .search-form button { padding: 0 10px; font-size: .9rem; }

  .popular-posts img { width: 40px; height: 40px; }
  .popular-posts li, .categories li { margin-bottom: 10px; }

  .tags { gap: 6px; }
  .tags a { padding: 5px 8px; font-size: .8rem; }

  .up-to-top {
    width: 36px; height: 36px;
    font-size: 1rem; right: 15px; bottom: 30px;
  }

  .subscribe-description { font-size: .9rem; margin-bottom: 10px; }
  .subscribe-form input[type="email"] { padding: 6px; font-size: .9rem; }
  .subscribe-form button { padding: 0 10px; font-size: .9rem; }

  .flash { padding: 8px; margin-bottom: 12px; font-size: .9rem; }
}

@media (max-width: 767px) {
  .blog-hero { padding: 30px 10px; }
  .blog-hero h1 { font-size: 2rem; }
  .blog-hero p { font-size: .9rem; }
  .card-body h3 { font-size: 1rem; }
}
