/* === Reset & Base === */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #ffffff;
  --bg-card: #ffffff;
  --text: #1a1a1a;
  --text-secondary: #8e8e93;
  --border: #e5e5ea;
  --accent: #007aff;
  --max-width: 560px;
  --radius: 12px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1c1c1e;
    --bg-card: #2c2c2e;
    --text: #f2f2f7;
    --text-secondary: #8e8e93;
    --border: #3a3a3c;
    --accent: #0a84ff;
  }
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* === Layout === */
.site-wrapper {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 16px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.site-main {
  flex: 1;
}

/* === Header (Telegram channel style) === */
.site-header {
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}

.site-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.site-action-link {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  background: rgba(0, 122, 255, 0.06);
}

.site-action-link:hover {
  text-decoration: none;
  background: rgba(0, 122, 255, 0.1);
}

.site-header-link {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  text-decoration: none;
}

.site-header-link:hover {
  text-decoration: none;
}

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

.site-title {
  font-size: 18px;
  font-weight: 600;
  line-height: 1.2;
}

.site-description {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* === Post Feed === */
.post-feed {
  display: flex;
  flex-direction: column;
}

/* === Post Card (Telegram message style) === */
.post-card {
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}

.post-card:last-child {
  border-bottom: none;
}

.post-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.post-author {
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.post-author-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
}

.post-date {
  font-size: 12px;
  color: var(--text-secondary);
}

/* Post image */
.post-card-image {
  width: 100%;
  border-radius: var(--radius);
  margin-bottom: 10px;
}

/* Post content */
.post-card-content {
  margin-bottom: 8px;
}

.post-card-title {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 6px;
}

.post-card-title a {
  color: var(--text);
}

.post-card-title a:hover {
  color: var(--accent);
  text-decoration: none;
}

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

.post-card-readmore {
  font-size: 13px;
  color: var(--accent);
  font-weight: 500;
}

/* === Single Post === */
.post-full {
  padding: 16px 0;
}

.post-full-image {
  margin: 0 0 16px 0;
}

.post-full-image img {
  width: 100%;
  border-radius: var(--radius);
}

.post-full-title {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 16px;
}

/* Ghost editor content styles */
.post-full-content {
  font-size: 15px;
  line-height: 1.6;
}

.post-full-content p {
  margin-bottom: 1em;
}

.post-full-content h2 {
  font-size: 20px;
  font-weight: 700;
  margin: 1.5em 0 0.5em;
}

.post-full-content h3 {
  font-size: 17px;
  font-weight: 600;
  margin: 1.3em 0 0.4em;
}

.post-full-content ul, .post-full-content ol {
  margin: 0 0 1em 1.5em;
}

.post-full-content li {
  margin-bottom: 0.3em;
}

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

.post-full-content pre {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
  overflow-x: auto;
  margin: 1em 0;
  font-size: 13px;
}

.post-full-content code {
  font-family: 'SF Mono', SFMono-Regular, Menlo, monospace;
  font-size: 0.9em;
}

.post-full-content img {
  border-radius: var(--radius);
  margin: 1em 0;
}

.post-full-content figure {
  margin: 1em 0;
}

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

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

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

/* Ghost card styles */
.post-full-content .kg-image-card img,
.post-full-content .kg-gallery-image img {
  border-radius: var(--radius);
}

.post-full-content .kg-width-wide {
  margin-left: -16px;
  margin-right: -16px;
}

.post-full-content .kg-width-full {
  margin-left: -16px;
  margin-right: -16px;
}

.post-full-content .kg-bookmark-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin: 1em 0;
}

.post-full-content .kg-bookmark-container {
  display: flex;
  text-decoration: none;
  color: var(--text);
}

.post-full-content .kg-bookmark-content {
  padding: 12px 16px;
  flex: 1;
}

.post-full-content .kg-bookmark-title {
  font-weight: 600;
  font-size: 14px;
}

.post-full-content .kg-bookmark-description {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.post-full-content .kg-bookmark-thumbnail {
  width: 120px;
  min-height: 100%;
}

.post-full-content .kg-bookmark-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 0;
}

/* Video */
.post-full-content .kg-video-card,
.post-full-content .kg-video-container {
  border-radius: var(--radius);
  overflow: hidden;
  margin: 1em 0;
}

.post-full-content video {
  width: 100%;
  border-radius: var(--radius);
}

/* Embed (YouTube, etc.) */
.post-full-content .kg-embed-card {
  margin: 1em 0;
}

.post-full-content .kg-embed-card iframe {
  width: 100%;
  border-radius: var(--radius);
}

/* Gallery */
.post-full-content .kg-gallery-container {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 1em 0;
}

.post-full-content .kg-gallery-row {
  display: flex;
  gap: 4px;
  width: 100%;
}

.post-full-content .kg-gallery-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

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

.post-nav-link {
  font-size: 13px;
  color: var(--accent);
  max-width: 45%;
}

.post-nav-next {
  margin-left: auto;
  text-align: right;
}

/* === Tag page === */
.tag-header {
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
}

.tag-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
}

.tag-description {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* === Author page === */
.author-header {
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}

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

.author-header-name {
  font-size: 20px;
  font-weight: 700;
}

.author-header-bio {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* === Pagination === */
.pagination {
  padding: 20px 0;
  text-align: center;
  font-size: 13px;
  color: var(--text-secondary);
}

.pagination a {
  color: var(--accent);
  font-weight: 500;
}

/* === Footer === */
.site-footer {
  padding: 20px 0;
  border-top: 1px solid var(--border);
  margin-top: 16px;
  font-size: 12px;
  color: var(--text-secondary);
  text-align: center;
}

/* === Error page === */
.error-page {
  text-align: center;
  padding: 60px 0;
}

.error-code {
  font-size: 72px;
  font-weight: 700;
  color: var(--text-secondary);
}

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

.error-link {
  margin-top: 20px;
  display: inline-block;
}
