/* Zen Blog - CSS baseado no design Figma */

:root {
  --zen-bg: #faf7f2;
  --zen-ink: #1a1714;
  --zen-muted: #7a6f63;
  --zen-rule: rgba(26, 23, 20, 0.10);
  --zen-accent: #b15b2a;
  --zen-paper: #fffdf8;
}

[data-theme="dark"] {
  --zen-bg: #1a1714;
  --zen-ink: #ebe5db;
  --zen-muted: #8a8074;
  --zen-rule: rgba(235, 229, 219, 0.12);
  --zen-accent: #d4824a;
  --zen-paper: #221d18;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Source Serif 4', Georgia, serif;
  background: var(--zen-bg);
  color: var(--zen-ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Header sticky */
.blog-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(250, 247, 242, 0.82);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  border-bottom: 0.5px solid var(--zen-rule);
  padding-top: env(safe-area-inset-top, 0);
}

[data-theme="dark"] .blog-header {
  background: rgba(26, 23, 20, 0.78);
}

.blog-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 22px;
  max-width: 800px;
  margin: 0 auto;
}

.blog-logo {
  border: none;
  background: transparent;
  cursor: pointer;
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.6px;
  color: var(--zen-ink);
  font-style: italic;
}

.blog-logo span {
  color: var(--zen-accent);
}

.blog-nav {
  display: flex;
  gap: 4px;
}

.blog-icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 22px;
  border: none;
  background: transparent;
  color: var(--zen-ink);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.blog-icon-btn:hover {
  background: rgba(0, 0, 0, 0.04);
}

[data-theme="dark"] .blog-icon-btn:hover {
  background: rgba(255, 255, 255, 0.06);
}

/* Container principal */
.blog-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 22px 80px;
}

/* Bio section */
.blog-bio {
  padding: 36px 0 28px;
}

.blog-bio h1 {
  font-size: 32px;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.8px;
  margin-bottom: 14px;
}

.blog-bio p {
  font-size: 17px;
  line-height: 1.55;
  color: var(--zen-muted);
}

/* Divider */
.blog-divider {
  height: 0.5px;
  background: var(--zen-rule);
  margin: 8px 0 24px;
}

/* Month group */
.blog-month {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--zen-muted);
  margin-bottom: 14px;
}

/* Post list item */
.post-item {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 14px 0;
  border-bottom: 0.5px solid var(--zen-rule);
  color: var(--zen-ink);
  font-family: inherit;
  text-decoration: none;
}

.post-item:hover {
  opacity: 0.8;
}

.post-item__meta {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 6px;
}

.post-item__date {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px;
  color: var(--zen-muted);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.post-item__tag {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px;
  color: var(--zen-accent);
  margin-left: auto;
  flex-shrink: 0;
  text-decoration: none;
}

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

.post-item__title {
  font-size: 19px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.3px;
  margin-bottom: 6px;
}

.post-item__excerpt {
  font-size: 15px;
  line-height: 1.5;
  color: var(--zen-muted);
  text-wrap: pretty;
}

/* Post page */
.post-page {
  padding: 12px 24px 60px;
}

.post-page__header {
  margin-bottom: 32px;
}

.post-page__meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.post-page__date {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 12px;
  color: var(--zen-muted);
}

.post-page__read {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 12px;
  color: var(--zen-muted);
}

.post-page__tag {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 12px;
  color: var(--zen-accent);
  margin-left: auto;
  text-decoration: none;
}

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

/* Meta separator */
.post-page__meta .post-page__date::after {
  content: '\00B7';
  opacity: 0.4;
  margin-left: 10px;
}

.post-page__meta .post-page__read::after {
  content: '\00B7';
  opacity: 0.4;
  margin-left: 10px;
}

.post-page__title {
  font-size: 30px;
  font-weight: 600;
  line-height: 1.18;
  letter-spacing: -0.6px;
  margin-bottom: 12px;
  text-wrap: balance;
}

.post-page__excerpt {
  font-size: 18px;
  line-height: 1.5;
  color: var(--zen-muted);
  font-style: italic;
  margin-bottom: 28px;
}

.post-page__body {
  font-size: 18px;
  line-height: 1.65;
}

.post-page__body p {
  margin-bottom: 1.5em;
}

.post-page__body h2 {
  font-size: 22px;
  font-weight: 600;
  margin: 2em 0 1em;
  letter-spacing: -0.4px;
}

.post-page__body code {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 14px;
  background: var(--zen-paper);
  padding: 2px 6px;
  border-radius: 4px;
}

.post-page__body pre {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 14px;
  background: var(--zen-paper);
  padding: 20px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 1.5em 0;
  border: 0.5px solid var(--zen-rule);
}

/* Critical: reserve space for images to prevent CLS */
.post-page__body img {
  max-width: 100%;
  height: auto;
  display: block;
  /* Prevent layout shift while loading */
  min-height: 200px;
  background: var(--zen-paper);
}

.post-page__body ul,
.post-page__body ol {
  margin: 1em 0 1.5em 1.5em;
  padding-left: 0.5em;
}

.post-page__body li {
  margin-bottom: 0.5em;
  line-height: 1.7;
}

.post-page__body ul {
  list-style-type: disc;
}

/* Tags index */
.tags-index {
  padding: 36px 0 80px;
}

.tags-index h1 {
  font-size: 28px;
  font-weight: 600;
  margin-bottom: 24px;
  letter-spacing: -0.6px;
}

.tag-list {
  list-style: none;
}

.tag-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 0.5px solid var(--zen-rule);
}

.tag-item a {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 15px;
  color: var(--zen-accent);
  text-decoration: none;
}

.tag-item a:hover {
  text-decoration: underline;
}

.tag-count {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 13px;
  color: var(--zen-muted);
}

/* Related posts */
.related-posts {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 0.5px solid var(--zen-rule);
}

.related-posts h2 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 16px;
  letter-spacing: -0.3px;
}

/* Theme toggle */
.theme-toggle {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 48px;
  height: 48px;
  border-radius: 24px;
  border: 0.5px solid var(--zen-rule);
  background: var(--zen-paper);
  color: var(--zen-ink);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Reading progress bar */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  z-index: 40;
  pointer-events: none;
}

.reading-progress__bar {
  height: 100%;
  width: 0%;
  background: var(--zen-accent);
  transition: width 60ms linear;
}

/* Back button */
.post-back-wrapper {
  max-width: 800px;
  margin: 0 auto;
  padding: 4px 24px 0;
}

.post-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 0;
  border: none;
  background: transparent;
  cursor: pointer;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 12px;
  color: var(--zen-muted);
  text-decoration: none;
}

.post-back-btn:hover {
  opacity: 0.7;
}

/* Post footer */
.post-footer {
  margin-top: 36px;
  padding-top: 20px;
  border-top: 0.5px solid var(--zen-rule);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.post-footer__tag {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 12px;
  color: var(--zen-accent);
  text-decoration: none;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 0;
}

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

.post-footer__copy {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px;
  color: var(--zen-muted);
}

/* Responsive */
@media (max-width: 600px) {
  .blog-container {
    padding: 0 18px 60px;
  }
  
  .post-page__title {
    font-size: 24px;
  }
  
  .blog-bio h1 {
    font-size: 28px;
  }
}
