@import url('https://fonts.googleapis.com/css2?family=Merriweather:ital,wght@0,400;0,700;0,900;1,400&family=Source+Code+Pro:wght@400;600&family=Oswald:wght@400;600;700&display=swap');

:root {
  --bg: #f5f0e8;
  --text: #2a2118;
  --accent: #c0392b;
  --accent2: #922b21;
  --muted: #7a6a58;
  --border: #d0c4b0;
  --code-bg: #1e1a14;
  --code-text: #e8dcc8;
  --highlight: #f39c12;
  --link: #1a5276;
  --white: #fff;
  --fiction-bg: #1a1a2e;
  --fiction-accent: #9b59b6;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Merriweather', Georgia, serif;
  font-size: 17px;
  line-height: 1.85;
}

/* ---- HEADER ---- */
.site-bar {
  background: var(--text);
  color: #aaa;
  padding: 8px 24px;
  font-family: 'Oswald', sans-serif;
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.site-bar a { color: #aaa; text-decoration: none; }
.site-bar a:hover { color: white; }

.blog-masthead {
  background: var(--accent);
  color: white;
  padding: 20px 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 4px solid var(--accent2);
}
.blog-masthead a { color: white; text-decoration: none; }

.blog-name {
  font-family: 'Oswald', sans-serif;
  font-size: 36px;
  font-weight: 700;
  letter-spacing: 1px;
  text-shadow: 2px 2px 0 rgba(0,0,0,0.25);
}

.blog-tagline {
  font-size: 13px;
  opacity: 0.85;
  font-style: italic;
  margin-top: 4px;
}

.masthead-right {
  font-family: 'Oswald', sans-serif;
  font-size: 12px;
  text-align: right;
  opacity: 0.8;
  line-height: 1.6;
}

.nav-bar {
  background: #2a2118;
  padding: 0 40px;
  display: flex;
  gap: 0;
  flex-wrap: wrap;
}
.nav-bar a {
  color: #ccc;
  text-decoration: none;
  font-family: 'Oswald', sans-serif;
  font-size: 13px;
  letter-spacing: 1px;
  padding: 10px 18px;
  display: block;
  transition: background 0.15s, color 0.15s;
  text-transform: uppercase;
}
.nav-bar a:hover, .nav-bar a.active { background: var(--accent); color: white; }

/* ---- LAYOUT ---- */
.index-container, .post-container {
  max-width: 1060px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 290px;
  gap: 44px;
  padding: 44px 24px;
}

/* ---- POST CARDS ---- */
.featured-post {
  background: var(--white);
  border: 2px solid var(--border);
  padding: 32px;
  margin-bottom: 32px;
  transition: border-color 0.15s;
  position: relative;
}
.featured-post::before {
  content: "FEATURED";
  position: absolute;
  top: -2px;
  right: 24px;
  background: var(--highlight);
  color: var(--text);
  font-family: 'Oswald', sans-serif;
  font-size: 10px;
  letter-spacing: 2px;
  padding: 4px 12px;
}
.featured-post:hover { border-color: var(--accent); }
.featured-post a { text-decoration: none; color: inherit; }

.post-card {
  border-bottom: 2px solid var(--border);
  padding: 24px 0;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: start;
  transition: background 0.1s;
}
.post-card a { text-decoration: none; color: inherit; }
.post-card:hover .card-title { color: var(--accent); }

.card-meta {
  font-family: 'Oswald', sans-serif;
  font-size: 11px;
  letter-spacing: 1.5px;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 8px;
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.cat-badge {
  background: var(--accent);
  color: white;
  padding: 2px 8px;
  font-size: 10px;
}
.cat-badge.fiction { background: var(--fiction-accent); }
.cat-badge.database { background: #1a5276; }
.cat-badge.backend { background: #1e8449; }
.cat-badge.distribution { background: #935116; }
.cat-badge.debugging { background: #515a5a; }
.cat-badge.personal { background: #7d6608; }
.cat-badge.engineering { background: #1b2631; }
.cat-badge.product { background: #935116; }

.card-title {
  font-family: 'Oswald', sans-serif;
  font-size: 22px;
  line-height: 1.25;
  color: var(--text);
  margin-bottom: 8px;
  transition: color 0.15s;
}

.card-excerpt {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.6;
  font-style: italic;
}

.card-readmore {
  font-family: 'Oswald', sans-serif;
  font-size: 11px;
  letter-spacing: 1px;
  color: var(--accent);
  text-transform: uppercase;
  white-space: nowrap;
  padding-top: 4px;
}

/* ---- SIDEBAR ---- */
.sidebar-widget {
  border: 2px solid var(--border);
  margin-bottom: 28px;
  background: var(--white);
}
.sidebar-widget-title {
  background: var(--text);
  color: var(--bg);
  font-family: 'Oswald', sans-serif;
  font-size: 12px;
  letter-spacing: 2px;
  text-transform: uppercase;
  padding: 9px 14px;
}
.sidebar-widget-body { padding: 14px; }
.sidebar-widget ul { list-style: none; padding: 0; }
.sidebar-widget li {
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  line-height: 1.4;
}
.sidebar-widget li:last-child { border: none; }
.sidebar-widget li a { color: var(--link); text-decoration: none; }
.sidebar-widget li a:hover { color: var(--accent); }

.tag-cloud { line-height: 2; }
.tag-cloud a {
  display: inline-block;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 3px 10px;
  margin: 2px 2px;
  font-size: 11px;
  font-family: 'Oswald', sans-serif;
  letter-spacing: 1px;
  text-decoration: none;
  transition: all 0.15s;
  text-transform: uppercase;
}
.tag-cloud a:hover { background: var(--accent); color: white; border-color: var(--accent); }

.comment-count {
  display: inline-block;
  background: var(--accent);
  color: white;
  font-family: 'Oswald', sans-serif;
  font-size: 10px;
  padding: 1px 6px;
  margin-left: 6px;
  vertical-align: middle;
}

.newsletter-input {
  width: 100%;
  padding: 8px;
  border: 1px solid var(--border);
  font-family: 'Merriweather', serif;
  font-size: 13px;
  margin-bottom: 8px;
  background: var(--bg);
}
.newsletter-btn {
  width: 100%;
  padding: 9px;
  background: var(--accent);
  color: white;
  border: none;
  font-family: 'Oswald', sans-serif;
  letter-spacing: 1.5px;
  font-size: 12px;
  cursor: pointer;
  text-transform: uppercase;
  transition: background 0.15s;
}
.newsletter-btn:hover { background: var(--accent2); }

/* ---- SINGLE POST ---- */
.post-meta-line {
  font-size: 11px;
  color: var(--muted);
  font-family: 'Oswald', sans-serif;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-bottom: 18px;
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
}

.post-title {
  font-family: 'Oswald', sans-serif;
  font-size: 42px;
  line-height: 1.1;
  margin-bottom: 12px;
  color: var(--text);
}

.post-subtitle {
  font-size: 19px;
  color: var(--muted);
  font-style: italic;
  margin-bottom: 28px;
  border-bottom: 2px solid var(--border);
  padding-bottom: 28px;
  line-height: 1.5;
}

.fiction-mode .post-title,
.fiction-mode .post-subtitle { color: #e8e0f0; }

.author-strip {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 36px;
  font-size: 13px;
  color: var(--muted);
}
.author-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--bg);
  font-family: 'Oswald', sans-serif;
  font-size: 17px;
  flex-shrink: 0;
}
.author-name { font-weight: 700; color: var(--text); font-size: 14px; }

/* Post body */
.post-body h2 {
  font-family: 'Oswald', sans-serif;
  font-size: 27px;
  margin: 44px 0 18px;
  color: var(--text);
  border-left: 4px solid var(--accent);
  padding-left: 14px;
  line-height: 1.2;
}
.post-body h3 {
  font-family: 'Oswald', sans-serif;
  font-size: 20px;
  margin: 30px 0 12px;
  color: var(--text);
}
.post-body p { margin-bottom: 22px; }
.post-body a { color: var(--link); }
.post-body ul, .post-body ol { margin: 0 0 22px 28px; }
.post-body li { margin-bottom: 8px; }
.post-body hr { border: none; border-top: 2px solid var(--border); margin: 28px 0; }

blockquote {
  border-left: 5px solid var(--accent);
  margin: 36px 0;
  padding: 18px 28px;
  background: var(--white);
  font-size: 20px;
  font-style: italic;
  color: var(--text);
  line-height: 1.55;
}

.callout {
  border: 2px solid var(--border);
  background: var(--white);
  padding: 20px 26px;
  margin: 30px 0;
  position: relative;
}
.callout-label {
  position: absolute;
  top: -12px;
  left: 16px;
  background: var(--highlight);
  color: var(--text);
  font-family: 'Oswald', sans-serif;
  font-size: 11px;
  letter-spacing: 2px;
  padding: 2px 12px;
  text-transform: uppercase;
}
.callout.danger { border-color: var(--accent); }
.callout.danger .callout-label { background: var(--accent); color: white; }
.callout p { margin: 0; font-size: 15px; }
.callout ul { margin: 8px 0 0 18px; }
.callout li { font-size: 15px; margin-bottom: 6px; }

pre {
  background: var(--code-bg);
  color: var(--code-text);
  padding: 22px 26px;
  margin: 28px 0;
  overflow-x: auto;
  font-family: 'Source Code Pro', monospace;
  font-size: 13px;
  line-height: 1.75;
  border-left: 4px solid var(--accent);
  position: relative;
}
pre::before {
  content: attr(data-lang);
  position: absolute;
  top: 8px;
  right: 14px;
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #555;
  font-family: 'Oswald', sans-serif;
}

.kw { color: #c678dd; }
.type { color: #e5c07b; }
.str { color: #98c379; }
.cm { color: #5c6370; font-style: italic; }
.fn { color: #61afef; }
.num { color: #d19a66; }

code {
  font-family: 'Source Code Pro', monospace;
  font-size: 13px;
  background: #e8e0d0;
  padding: 2px 6px;
  border-radius: 2px;
  color: #922b21;
  word-break: break-all;
}

.post-body, .comment-body {
  overflow-wrap: break-word;
  word-wrap: break-word;
}


/* Share / back */
.share-row {
  display: flex;
  gap: 10px;
  margin: 36px 0 0;
  flex-wrap: wrap;
  align-items: center;
}
.share-btn {
  padding: 8px 20px;
  font-family: 'Oswald', sans-serif;
  font-size: 12px;
  letter-spacing: 1px;
  text-transform: uppercase;
  border: none;
  cursor: pointer;
  color: white;
  transition: opacity 0.15s;
  text-decoration: none;
  display: inline-block;
}
.share-btn:hover { opacity: 0.85; }
.share-btn.twitter { background: #1da1f2; }
.share-btn.hackernews { background: #ff6600; }
.share-btn.reddit { background: #ff4500; }

.back-btn {
  padding: 8px 20px;
  font-family: 'Oswald', sans-serif;
  font-size: 12px;
  letter-spacing: 1px;
  text-transform: uppercase;
  border: 2px solid var(--border);
  background: none;
  cursor: pointer;
  color: var(--muted);
  margin-right: auto;
  transition: all 0.15s;
  text-decoration: none;
  display: inline-block;
}
.back-btn:hover { border-color: var(--accent); color: var(--accent); }

/* Comments */
.comments-section {
  margin-top: 48px;
  border-top: 3px solid var(--border);
  padding-top: 36px;
}
.comments-heading {
  font-family: 'Oswald', sans-serif;
  font-size: 16px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 24px;
}
.comment {
  display: flex;
  gap: 14px;
  margin-bottom: 26px;
  padding-bottom: 26px;
  border-bottom: 1px solid var(--border);
}
.comment:last-child { border: none; }
.comment-avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Oswald', sans-serif;
  font-size: 17px;
  color: white;
}
.comment-meta {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
  font-family: 'Oswald', sans-serif;
  letter-spacing: 0.5px;
}
.comment-meta strong { color: var(--text); font-size: 14px; }
.author-tag {
  background: var(--accent);
  color: white;
  font-size: 9px;
  padding: 1px 6px;
  letter-spacing: 1px;
  margin-left: 6px;
  text-transform: uppercase;
}
.comment-body { font-size: 14px; line-height: 1.7; color: var(--text); }


/* Pagination */
.pagination {
  display: flex;
  gap: 4px;
  justify-content: center;
  padding: 24px 0 0;
  list-style: none;
}
.page-item {
  display: flex;
}
.page-item.disabled .page-link {
  opacity: 0.35;
  cursor: default;
  pointer-events: none;
}
.page-link {
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  font-family: 'Oswald', sans-serif;
  font-size: 14px;
  border: 2px solid var(--border);
  background: var(--white);
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: var(--text);
}
.page-link:hover, .page-item.active .page-link { background: var(--accent); color: white; border-color: var(--accent); }

/* Footer */
footer {
  background: var(--text);
  color: #666;
  text-align: center;
  padding: 28px 24px;
  font-size: 12px;
  font-family: 'Oswald', sans-serif;
  letter-spacing: 1px;
  margin-top: 60px;
  line-height: 2;
}
footer a { color: #888; text-decoration: none; }
footer a:hover { color: white; }

@media (max-width: 720px) {
  .index-container, .post-container { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .post-title { font-size: 28px; }
  .blog-masthead { padding: 16px 20px; }
  .nav-bar { padding: 0 10px; }
  .blog-name { font-size: 26px; }
}
