/**
 * Default Theme for PostStack
 * Clean, minimal design with excellent readability
 */

:root {
  /* Colors */
  --background: #ffffff;
  --surface: #f8f9fa;
  --surface-2: #e9ecef;
  --text-primary: #111827;
  --text-muted: #6b7280;
  --heading: #0f172a;
  --accent: #667eea;
  --link: #667eea;
  --border: rgba(0, 0, 0, 0.06);
  --card-bg: #ffffff;
  --card-border: rgba(0, 0, 0, 0.08);
  
  /* Spacing */
  --radius-base: 12px;
  --radius-lg: 16px;
  --spacing-sm: 8px;
  --spacing-md: 16px;
  --spacing-lg: 24px;
  
  /* Typography */
  --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-heading: Georgia, 'Times New Roman', serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, 'Roboto Mono', 'Courier New', monospace;
  
  --h1-size: 32px;
  --h2-size: 24px;
  --h3-size: 20px;
  --p-size: 16px;
  --line-height: 1.7;
  
  /* Code & Blocks */
  --code-bg: rgba(15, 23, 42, 0.08);
  --blockquote-bg: #f7f7f7;
  
  /* Editor.js specific */
  --editor-max-width: 780px;
}

/* Dark mode support */
.dark {
  --background: #0f172a;
  --surface: #1e293b;
  --surface-2: #334155;
  --text-primary: #f1f5f9;
  --text-muted: #94a3b8;
  --heading: #f8fafc;
  --accent: #818cf8;
  --link: #818cf8;
  --border: rgba(255, 255, 255, 0.1);
  --card-bg: #1e293b;
  --card-border: rgba(255, 255, 255, 0.12);
  --code-bg: rgba(255, 255, 255, 0.05);
  --blockquote-bg: rgba(255, 255, 255, 0.03);
}

/* Base Styles */
* {
  box-sizing: border-box;
}

body {
  font-family: var(--font-body);
  color: var(--text-primary);
  background: var(--background);
  line-height: var(--line-height);
  margin: 0;
  padding: 0;
}

/* Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--spacing-lg);
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  color: var(--heading);
  line-height: 1.2;
  margin: 1.5rem 0 0.75rem;
}

h1 { font-size: var(--h1-size); }
h2 { font-size: var(--h2-size); }
h3 { font-size: var(--h3-size); }

p {
  font-size: var(--p-size);
  margin: 0 0 1rem;
}

a {
  color: var(--link);
  text-decoration: none;
  transition: opacity 0.2s;
}

a:hover {
  opacity: 0.8;
}

/* Header */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: var(--spacing-lg) 0;
  margin-bottom: var(--spacing-lg);
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--spacing-md);
}

.site-branding {
  flex: 1;
}

.site-title {
  margin: 0;
  font-size: 28px;
  color: var(--heading);
}

.site-description {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 14px;
}

.site-logo {
  max-height: 50px;
  margin-right: var(--spacing-md);
  vertical-align: middle;
}

.site-nav {
  display: flex;
  gap: var(--spacing-md);
}

.site-nav a {
  padding: 8px 16px;
  border-radius: var(--radius-base);
  transition: background 0.2s;
}

.site-nav a:hover {
  background: var(--surface-2);
  opacity: 1;
}

/* Main Content */
.site-main {
  min-height: 60vh;
  padding: var(--spacing-lg) 0;
}

/* Layout Grid */
.layout-grid .main-content,
.layout-list .main-content,
.layout-masonry .main-content {
  flex: 1;
}

.sidebar-right {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: var(--spacing-lg);
}

.sidebar-left {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: var(--spacing-lg);
}

@media (max-width: 768px) {
  .sidebar-right,
  .sidebar-left {
    grid-template-columns: 1fr;
  }
}

/* Sidebar */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-lg);
}

.widget {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
}

.widget h3 {
  margin-top: 0;
  font-size: 18px;
}

.category-list,
.tag-cloud {
  list-style: none;
  padding: 0;
  margin: 0;
}

.category-list li {
  margin-bottom: 8px;
}

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  display: inline-block;
  padding: 4px 12px;
  background: var(--surface);
  border-radius: 999px;
  font-size: 14px;
  transition: background 0.2s;
}

.tag:hover {
  background: var(--surface-2);
}

/* Post Styles */
.post {
  max-width: var(--editor-max-width);
  margin: 0 auto;
}

.post-header {
  margin-bottom: var(--spacing-lg);
}

.post-cover {
  width: 100%;
  height: auto;
  border-radius: var(--radius-lg);
  margin-bottom: var(--spacing-lg);
}

.post-title {
  font-size: 36px;
  margin: 0 0 var(--spacing-md);
}

.post-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--spacing-md);
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: var(--spacing-lg);
}

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

.category {
  padding: 4px 12px;
  background: var(--accent);
  color: white;
  border-radius: 6px;
  font-size: 13px;
}

/* Post Navigation */
.post-navigation {
  display: flex;
  justify-content: space-between;
  gap: var(--spacing-md);
  margin-top: var(--spacing-lg);
  padding-top: var(--spacing-lg);
  border-top: 1px solid var(--border);
}

.prev-post,
.next-post {
  padding: var(--spacing-md);
  background: var(--surface);
  border-radius: var(--radius-base);
  flex: 1;
  transition: background 0.2s;
}

.prev-post:hover,
.next-post:hover {
  background: var(--surface-2);
}

/* Footer */
.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: var(--spacing-lg) 0;
  margin-top: var(--spacing-lg);
  color: var(--text-muted);
  font-size: 14px;
}

.footer-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--spacing-lg);
}

.footer-social {
  display: flex;
  gap: var(--spacing-md);
  margin-top: var(--spacing-md);
}

/* Editor.js Content Styles */
.editor-content,
.post-content {
  max-width: var(--editor-max-width);
  margin: 0 auto;
  font-family: var(--font-body);
  color: var(--text-primary);
  line-height: var(--line-height);
}

.editor-content p,
.post-content p {
  margin: 0 0 1rem;
  font-size: var(--p-size);
}

.editor-content h1,
.editor-content h2,
.editor-content h3,
.post-content h1,
.post-content h2,
.post-content h3 {
  margin: 1.5rem 0 0.75rem;
  font-family: var(--font-heading);
  color: var(--heading);
  line-height: 1.2;
}

.editor-content h1, .post-content h1 { font-size: var(--h1-size); }
.editor-content h2, .post-content h2 { font-size: var(--h2-size); }
.editor-content h3, .post-content h3 { font-size: var(--h3-size); }

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

.editor-content blockquote,
.post-content blockquote {
  margin: 1rem 0;
  padding: var(--spacing-md);
  background: var(--blockquote-bg);
  border-left: 4px solid var(--accent);
  color: var(--text-muted);
  border-radius: 8px;
}

.editor-content hr,
.post-content hr,
.ce-delimiter {
  height: 1px;
  background: var(--border);
  border: none;
  margin: var(--spacing-lg) 0;
}

.editor-content figure,
.post-content figure {
  margin: 1rem 0;
  text-align: center;
}

.editor-content figure img,
.post-content figure img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-lg);
}

.editor-content figcaption,
.post-content figcaption {
  margin-top: 8px;
  font-size: 14px;
  color: var(--text-muted);
}

.editor-content pre,
.editor-content code,
.post-content pre,
.post-content code {
  font-family: var(--font-mono);
}

.editor-content pre,
.post-content pre {
  background: var(--code-bg);
  padding: var(--spacing-md);
  border-radius: 8px;
  overflow: auto;
  border: 1px solid var(--border);
  font-size: 14px;
  margin: 0 0 1rem;
}

.editor-content code,
.post-content code {
  background: var(--code-bg);
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 0.9em;
}

.editor-content pre code,
.post-content pre code {
  background: none;
  padding: 0;
}

/* Image tool */
.image-tool,
.image-tool__image,
.image-tool__image-picture {
  display: block;
  margin: 1rem 0;
}

.image-tool__image-picture img {
  max-width: 100%;
  border-radius: var(--radius-lg);
}

/* Quote block */
.ce-block--quote,
.quote {
  margin: 1rem 0;
  padding: var(--spacing-md);
  border-left: 4px solid var(--accent);
  background: var(--blockquote-bg);
  border-radius: 8px;
}

/* Embed */
.embed {
  margin: 1rem 0;
  position: relative;
}

.embed iframe {
  width: 100%;
  min-height: 400px;
  border: 0;
  border-radius: var(--radius-lg);
}

/* Responsive */
@media (max-width: 768px) {
  .post-title {
    font-size: 28px;
  }
  
  .container {
    padding: 0 var(--spacing-md);
  }
  
  .site-header {
    padding: var(--spacing-md) 0;
  }
}
