/* ==========================================================================
   Bober Ghost Theme — swag.com-inspired layout
   ========================================================================== */

:root {
  --bg: #ffffff;
  --surface: #f8fafc;
  --text: #0f172a;
  --text-secondary: #475569;
  --muted: #94a3b8;
  --border: #e2e8f0;
  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --accent-light: #eef2ff;
  --radius: 12px;
  --radius-sm: 8px;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-heading: 'Plus Jakarta Sans', 'Inter', sans-serif;
  --max-width: 720px;
  --max-width-wide: 1200px;
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body { font-family: var(--font-body); color: var(--text); background: var(--bg); line-height: 1.7; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }

/* ==========================================================================
   Header
   ========================================================================== */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: var(--max-width-wide);
  margin: 0 auto;
  padding: 0 32px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-logo {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.02em;
}

.logo-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: var(--accent);
  color: #fff;
  border-radius: 7px;
  font-size: 15px;
  font-weight: 800;
}

.logo-text { color: var(--text); }

.logo-sep {
  width: 1px;
  height: 16px;
  background: var(--border);
  margin: 0 4px;
}

.logo-blog {
  color: var(--muted);
  font-weight: 500;
}

.site-nav ul {
  display: flex;
  list-style: none;
  gap: 4px;
}

.site-nav a {
  display: block;
  padding: 6px 14px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  transition: color 0.15s, background 0.15s;
}

.site-nav a:hover {
  color: var(--text);
  background: var(--surface);
}

/* ==========================================================================
   Featured Layout (Hero + Sidebar)
   ========================================================================== */

.featured-layout {
  max-width: var(--max-width-wide);
  margin: 0 auto;
  padding: 40px 32px 0;
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 32px;
  align-items: start;
}

/* --- Hero (left) --- */

.featured-post { position: relative; }

.featured-link {
  display: block;
  border-radius: var(--radius);
  overflow: hidden;
  transition: box-shadow 0.2s;
}

.featured-link:hover {
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
}

.featured-image {
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-radius: var(--radius);
}

.featured-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.featured-link:hover .featured-image img {
  transform: scale(1.02);
}

.featured-body {
  padding: 24px 4px 8px;
}

.card-tag {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  margin-bottom: 8px;
}

.featured-title {
  font-family: var(--font-heading);
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.featured-excerpt {
  margin-top: 12px;
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
}

.meta-sep { opacity: 0.5; }

/* --- Sidebar (right) --- */

.featured-sidebar {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.sidebar-card { }

.sidebar-link {
  display: block;
  transition: opacity 0.15s;
}

.sidebar-link:hover { opacity: 0.85; }

.sidebar-image {
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
}

.sidebar-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sidebar-body { }

.sidebar-body .card-tag {
  margin-bottom: 4px;
}

.sidebar-title {
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.35;
}

/* ==========================================================================
   Section Heading
   ========================================================================== */

.section-heading {
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

/* ==========================================================================
   Post Feed Grid (below featured)
   ========================================================================== */

.post-grid {
  max-width: var(--max-width-wide);
  margin: 0 auto;
  padding: 48px 32px 0;
}

.post-feed {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
  padding-bottom: 80px;
}

/* ==========================================================================
   Post Card
   ========================================================================== */

.post-card-link {
  display: flex;
  flex-direction: column;
  height: 100%;
  transition: opacity 0.15s;
}

.post-card-link:hover { opacity: 0.85; }

.post-card-image {
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: var(--surface);
  margin-bottom: 12px;
}

.post-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.post-card-body {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.post-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
}

.post-card-tag {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
}

.post-card-title {
  font-family: var(--font-heading);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.35;
  margin-bottom: 6px;
}

.post-card-excerpt {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
  flex: 1;
}

.post-card-footer {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  font-size: 13px;
  color: var(--muted);
}

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

/* ==========================================================================
   Single Post
   ========================================================================== */

.post-header {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 64px 24px 32px;
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 16px;
}

.post-tag {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
}

.post-tag:hover { text-decoration: underline; }

.post-title {
  font-family: var(--font-heading);
  font-size: clamp(28px, 5vw, 40px);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.post-excerpt {
  margin-top: 14px;
  font-size: 18px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.post-author {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 20px;
  font-size: 14px;
  color: var(--text-secondary);
}

.author-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
}

.author-name { font-weight: 600; color: var(--text); }

.post-reading-time { color: var(--muted); }
.post-reading-time::before { content: "\00b7"; margin-right: 10px; }

/* Feature Image */
.post-feature-image {
  max-width: 960px;
  margin: 0 auto 40px;
  padding: 0 24px;
}

.post-feature-image img {
  width: 100%;
  border-radius: var(--radius);
  object-fit: cover;
}

.post-feature-image figcaption {
  margin-top: 10px;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}

/* ==========================================================================
   Ghost Content (gh-content / kg-* cards)
   ========================================================================== */

.post-content {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px 80px;
  font-size: 17px;
  line-height: 1.8;
}

.post-content > * + * { margin-top: 1.5em; }

.post-content h2 {
  font-family: var(--font-heading);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.3;
  margin-top: 2.5em;
}

.post-content h3 {
  font-family: var(--font-heading);
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.3;
  margin-top: 2em;
}

.post-content h4 {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 700;
  margin-top: 1.5em;
}

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

.post-content a:hover { color: var(--accent-hover); }
.post-content strong { font-weight: 600; }

.post-content blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 20px;
  margin-left: 0;
  font-style: italic;
  color: var(--text-secondary);
}

.post-content pre {
  background: var(--text);
  color: #e2e8f0;
  padding: 24px;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  font-size: 14px;
  line-height: 1.6;
}

.post-content code {
  font-family: 'JetBrains Mono', 'SF Mono', Monaco, monospace;
  font-size: 0.9em;
}

.post-content :not(pre) > code {
  background: var(--surface);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.85em;
  border: 1px solid var(--border);
}

.post-content ul, .post-content ol { padding-left: 24px; }
.post-content li + li { margin-top: 0.5em; }

.post-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 3em 0;
}

.post-content img { border-radius: var(--radius-sm); }
.post-content figure { margin: 2em 0; }

.post-content figcaption {
  margin-top: 10px;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}

/* Ghost card widths */
.kg-width-wide {
  max-width: 960px;
  margin-left: calc(50% - 480px);
  margin-right: calc(50% - 480px);
}

.kg-width-full {
  max-width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
}

.kg-width-wide img, .kg-width-full img { width: 100%; }

.kg-callout-card {
  display: flex;
  gap: 12px;
  padding: 20px 24px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
}

.kg-bookmark-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.kg-bookmark-container { display: flex; text-decoration: none; }
.kg-bookmark-content { padding: 20px; flex: 1; }
.kg-bookmark-title { font-weight: 600; font-size: 15px; }

.kg-bookmark-description {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 8px;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.kg-bookmark-metadata {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  font-size: 13px;
  color: var(--muted);
}

.kg-bookmark-icon { width: 16px; height: 16px; }
.kg-bookmark-thumbnail { width: 200px; min-height: 100%; }
.kg-bookmark-thumbnail img { width: 100%; height: 100%; object-fit: cover; }

.kg-button-card { text-align: center; }

.kg-btn {
  display: inline-block;
  padding: 12px 28px;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 15px;
  text-decoration: none;
  transition: background 0.15s;
}

.kg-btn:hover { background: var(--accent-hover); }

.kg-toggle-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
}

/* ==========================================================================
   Post Footer & Read Next
   ========================================================================== */

.post-footer {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px 48px;
}

.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-link {
  display: inline-block;
  padding: 6px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 100px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: border-color 0.15s, color 0.15s;
}

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

.read-next {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px 80px;
}

.read-next-title {
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 24px;
}

/* ==========================================================================
   Tag & Author Pages
   ========================================================================== */

.tag-header, .author-header {
  max-width: var(--max-width-wide);
  margin: 0 auto;
  padding: 64px 32px 40px;
}

.tag-name, .author-name {
  font-family: var(--font-heading);
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 800;
  letter-spacing: -0.03em;
}

.tag-desc, .author-bio {
  margin-top: 10px;
  font-size: 16px;
  color: var(--text-secondary);
  max-width: 480px;
}

.tag-count {
  display: block;
  margin-top: 6px;
  font-size: 14px;
  color: var(--muted);
}

.author-avatar-large {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 16px;
}

/* ==========================================================================
   Error Page
   ========================================================================== */

.error-page {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 120px 24px;
  text-align: center;
}

.error-code {
  font-family: var(--font-heading);
  font-size: 100px;
  font-weight: 800;
  color: var(--border);
  line-height: 1;
}

.error-message {
  margin-top: 8px;
  font-size: 18px;
  color: var(--text-secondary);
}

.error-link {
  display: inline-block;
  margin-top: 28px;
  padding: 12px 28px;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 15px;
  transition: background 0.15s;
}

.error-link:hover { background: var(--accent-hover); }

/* ==========================================================================
   Pagination
   ========================================================================== */

.pagination {
  max-width: var(--max-width-wide);
  margin: 0 auto;
  padding: 0 32px 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  font-size: 14px;
}

.pagination-prev, .pagination-next {
  padding: 8px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-weight: 500;
  color: var(--text);
  transition: border-color 0.15s, color 0.15s;
}

.pagination-prev:hover, .pagination-next:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.pagination-info { color: var(--muted); }

/* ==========================================================================
   Footer
   ========================================================================== */

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.footer-inner {
  max-width: var(--max-width-wide);
  margin: 0 auto;
  padding: 40px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.footer-logo {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 16px;
}

.footer-tagline {
  display: block;
  margin-top: 4px;
  font-size: 13px;
  color: var(--muted);
}

.footer-right {
  display: flex;
  gap: 8px;
}

.footer-link {
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  transition: color 0.15s, background 0.15s;
}

.footer-link:hover {
  color: var(--text);
  background: rgba(0, 0, 0, 0.04);
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 1024px) {
  .featured-layout {
    grid-template-columns: 1fr 300px;
    gap: 24px;
  }

  .featured-title { font-size: 24px; }
  .post-feed { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .header-inner { padding: 0 16px; }
  .site-nav { display: none; }

  .featured-layout {
    grid-template-columns: 1fr;
    padding: 24px 16px 0;
  }

  .featured-sidebar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
  }

  .featured-title { font-size: 22px; }

  .post-grid { padding: 32px 16px 0; }

  .post-feed {
    grid-template-columns: 1fr;
    padding-bottom: 48px;
    gap: 24px;
  }

  .post-header { padding: 48px 16px 24px; }
  .post-content { padding: 0 16px 48px; font-size: 16px; }
  .post-feature-image { padding: 0 16px; }
  .post-footer { padding: 0 16px 32px; }
  .read-next { padding: 0 16px 48px; }

  .kg-width-wide { margin-left: -16px; margin-right: -16px; }
  .kg-bookmark-container { flex-direction: column; }
  .kg-bookmark-thumbnail { width: 100%; height: 200px; }

  .tag-header, .author-header { padding: 48px 16px 32px; }

  .footer-inner {
    flex-direction: column;
    text-align: center;
    padding: 32px 16px;
  }

  .pagination { padding: 0 16px 48px; }
}

@media (max-width: 480px) {
  .featured-sidebar {
    grid-template-columns: 1fr;
  }
}
