/* ==========================================
   Ghost Clone — Public Theme (ala Ghost Casper)
   ========================================== */

:root {
  --accent: #ff3b3b;
  --bg: #ffffff;
  --bg-alt: #fafafa;
  --text: #15171a;
  --text-muted: #5b5f66;
  --text-light: #8a9099;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.12);
  --radius: 8px;
  --radius-lg: 16px;
  --max-w: 1180px;
  --reading-w: 680px;
  --font-ui: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', Roboto, sans-serif;
  --font-serif: 'Source Serif Pro', Georgia, 'Times New Roman', serif;
  --font-mono: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', monospace;
}

[data-theme="dark"] {
  --bg: #0d1117;
  --bg-alt: #161b22;
  --text: #e6edf3;
  --text-muted: #9ca3af;
  --text-light: #6b7280;
  --border: #21262d;
  --border-strong: #30363d;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.5);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }

body {
  font-family: var(--font-ui);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  font-size: 16px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background 0.2s, color 0.2s;
}

a { color: var(--accent); text-decoration: none; transition: opacity 0.2s; }
a:hover { opacity: 0.75; }

img, video { max-width: 100%; height: auto; display: block; }

/* ===== Site Header ===== */
.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(8px);
  background: color-mix(in srgb, var(--bg) 90%, transparent);
}

.site-header-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 18px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.site-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

.site-nav {
  display: flex;
  gap: 20px;
  align-items: center;
  font-size: 0.95rem;
  font-weight: 500;
}

.site-nav a { color: var(--text-muted); }
.site-nav a:hover { color: var(--text); opacity: 1; }

.btn-icon {
  background: transparent;
  border: 1px solid var(--border);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.2s;
}
.btn-icon:hover { border-color: var(--text-muted); color: var(--text); }

/* ===== Search form ===== */
.search-form {
  flex: 1;
  max-width: 280px;
}
.search-form input {
  width: 100%;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 0.9rem;
  background: var(--bg-alt);
  color: var(--text);
  font-family: inherit;
}
.search-form input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--bg);
}

/* ===== Main container ===== */
main {
  flex: 1;
  max-width: var(--max-w);
  width: 100%;
  margin: 0 auto;
  padding: 48px 24px;
}

/* ===== Hero (featured post) ===== */
.hero {
  margin-bottom: 64px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: center;
}
.hero-image {
  aspect-ratio: 16 / 10;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.hero-image img { width: 100%; height: 100%; object-fit: cover; }
.hero-content .eyebrow {
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 14px;
}
.hero-content h2 {
  font-size: 2.75rem;
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin-bottom: 18px;
  font-weight: 700;
}
.hero-content h2 a { color: var(--text); }
.hero-content .excerpt {
  font-size: 1.1rem;
  color: var(--text-muted);
  margin-bottom: 18px;
  line-height: 1.55;
}
.post-meta {
  display: flex;
  gap: 16px;
  align-items: center;
  font-size: 0.85rem;
  color: var(--text-light);
}

@media (max-width: 820px) {
  .hero { grid-template-columns: 1fr; gap: 24px; }
  .hero-content h2 { font-size: 2rem; }
}

/* ===== Post grid ===== */
.section-title {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-light);
  margin-bottom: 24px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 40px 32px;
}

.post-card { display: flex; flex-direction: column; }
.post-card .thumb {
  aspect-ratio: 16 / 10;
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 18px;
  background: var(--bg-alt);
}
.post-card .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}
.post-card:hover .thumb img { transform: scale(1.03); }
.post-card h3 {
  font-size: 1.35rem;
  line-height: 1.25;
  margin-bottom: 10px;
  font-weight: 700;
  letter-spacing: -0.015em;
}
.post-card h3 a { color: var(--text); }
.post-card .excerpt {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 14px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ===== Tag list ===== */
.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 64px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
}
.tag-chip {
  padding: 6px 14px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 0.85rem;
  color: var(--text-muted);
  transition: all 0.2s;
}
.tag-chip:hover {
  color: var(--accent);
  border-color: var(--accent);
  opacity: 1;
}

/* ===== Pagination ===== */
.pagination {
  margin-top: 64px;
  display: flex;
  justify-content: center;
  gap: 8px;
}
.pagination a, .pagination span {
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 0.9rem;
}
.pagination .active { background: var(--accent); color: white; border-color: var(--accent); }
.pagination a:hover { border-color: var(--text-muted); opacity: 1; }

/* ===== Article (single post) ===== */
.article {
  max-width: var(--reading-w);
  margin: 0 auto;
}

.article-header {
  text-align: center;
  margin-bottom: 48px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--border);
}
.article-header .eyebrow {
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 16px;
}
.article-header h1 {
  font-size: 3rem;
  line-height: 1.1;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 18px;
}
.article-header .lead {
  color: var(--text-muted);
  font-size: 1.2rem;
  line-height: 1.5;
  margin-bottom: 24px;
}

.feature-image {
  max-width: 1000px;
  margin: 0 auto 48px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.feature-image img { width: 100%; }

.article-body {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  line-height: 1.75;
  color: var(--text);
}

.article-body > * { margin-bottom: 1.4em; }

.article-body h1,
.article-body h2,
.article-body h3,
.article-body h4 {
  font-family: var(--font-ui);
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.25;
  margin-top: 2em;
}
.article-body h2 { font-size: 1.75rem; }
.article-body h3 { font-size: 1.4rem; }
.article-body h4 { font-size: 1.15rem; }

.article-body p { }
.article-body a { border-bottom: 1.5px solid currentColor; }
.article-body a:hover { border-bottom-color: transparent; }

.article-body img,
.article-body figure {
  margin: 2em -40px;
  border-radius: var(--radius);
  max-width: calc(100% + 80px);
}
@media (max-width: 760px) {
  .article-body img,
  .article-body figure { margin-left: 0; margin-right: 0; max-width: 100%; }
}

.article-body figure { text-align: center; }
.article-body figcaption {
  font-family: var(--font-ui);
  font-size: 0.85rem;
  color: var(--text-light);
  margin-top: 10px;
}

.article-body blockquote {
  border-left: 4px solid var(--accent);
  padding-left: 24px;
  margin-left: 0;
  font-style: italic;
  color: var(--text-muted);
  font-size: 1.2rem;
}

.article-body ul, .article-body ol {
  padding-left: 1.5em;
}
.article-body li { margin-bottom: 0.5em; }

.article-body code {
  font-family: var(--font-mono);
  background: var(--bg-alt);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.9em;
  border: 1px solid var(--border);
}

.article-body pre {
  background: #0d1117;
  color: #e6edf3;
  padding: 20px 24px;
  border-radius: var(--radius);
  overflow-x: auto;
  font-size: 0.9rem;
  line-height: 1.55;
}
.article-body pre code {
  background: transparent;
  border: none;
  padding: 0;
  color: inherit;
}

/* Syntax highlighting base */
.hljs { background: transparent; color: #e6edf3; }
.hljs-keyword, .hljs-selector-tag { color: #ff7b72; }
.hljs-string, .hljs-attr { color: #a5d6ff; }
.hljs-number, .hljs-literal { color: #79c0ff; }
.hljs-comment { color: #8b949e; font-style: italic; }
.hljs-function, .hljs-title { color: #d2a8ff; }
.hljs-built_in, .hljs-type { color: #ffa657; }

/* Article footer: tags + author */
.article-footer {
  max-width: var(--reading-w);
  margin: 64px auto 0;
  padding-top: 32px;
  border-top: 1px solid var(--border);
}
.article-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 32px;
}

.author-card {
  display: flex;
  gap: 16px;
  align-items: center;
  padding: 24px;
  background: var(--bg-alt);
  border-radius: var(--radius);
}
.author-card .avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--text);
  flex-shrink: 0;
}
.author-card .name { font-weight: 600; }
.author-card .bio { color: var(--text-muted); font-size: 0.9rem; margin-top: 4px; }

/* Related posts */
.related {
  max-width: var(--max-w);
  margin: 80px auto 0;
}
.related h3 {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-light);
  margin-bottom: 24px;
}
.related .post-grid {
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 24px;
}

/* ===== Empty state ===== */
.empty {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-muted);
}
.empty h2 { font-size: 2rem; margin-bottom: 12px; color: var(--text); }

/* ===== Site Footer ===== */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 32px 24px;
  text-align: center;
  color: var(--text-light);
  font-size: 0.9rem;
  margin-top: 80px;
}
.site-footer a { color: var(--text-muted); margin: 0 10px; }

/* Admin shortcut in header */
.admin-link {
  font-size: 0.85rem;
  color: var(--text-light);
  padding: 4px 10px;
  border-radius: 4px;
  border: 1px solid var(--border);
}
.admin-link:hover { color: var(--accent); border-color: var(--accent); opacity: 1; }
