/* ═══════════════════════════════════════════════
   BLOG — Cloud Dancer 2026 (Pantone 11-4201)
   Fundo claro: #F5EFE8  |  Modo escuro incluso
   ═══════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,600;1,400&family=Lora:ital,wght@0,400;0,500;1,400&family=JetBrains+Mono:wght@400&display=swap');

/* ── Variáveis de cor ── */
:root {
  --bg:           #FFFAF6;
  --bg-2:         #E6E2DB;
  --bg-card:      #ECEAE4;
  --text:         #212529;
  --text-muted:   #4A4039;
  --accent:       #1A3557;
  --accent-soft:  #2C4A6E22;
  --border:       #D4CEC7;
  --tag-bg:       #E2DDD6;
  --tag-text:     #7A6F67;
  --code-bg:      #E4E0D9;
  --shadow:       0 2px 16px rgba(28,24,20,.08);
  --shadow-lg:    0 8px 40px rgba(28,24,20,.14);

  --radius:       6px;
  --font-body:    'Lora', Georgia, serif;
  --font-display: 'Playfair Display', Georgia, serif;
  --font-mono:    'JetBrains Mono', monospace;
  --max-w:        860px;
  --header-h:     7.5rem;

  --text-xs:   0.8rem;
  --text-sm:   1.1rem;
  --text-base: 1.1875rem;
  --text-md:   1.375rem;
  --text-lg:   1.625rem;
  --text-xl:   2rem;
  --text-2xl:  clamp(2.5rem, 5vw, 3.25rem);
}

[data-theme="dark"] {
  --bg:           #1C1814;
  --bg-2:         #252018;
  --bg-card:      #221F1B;
  --text:         #F0EEE9;
  --text-muted:   #A09588;
  --accent:       #4A7AAE;
  --accent-soft:  #4A7AAE22;
  --border:       #3A342E;
  --tag-bg:       #2E2923;
  --tag-text:     #A09588;
  --code-bg:      #252018;
  --shadow:       0 2px 16px rgba(0,0,0,.3);
  --shadow-lg:    0 8px 40px rgba(0,0,0,.5);
}

/* ── Reset & base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.75;
  transition: background .3s, color .3s;
  min-height: 100vh;
}

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

/* ── Textura sutil no fundo ── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23000000' fill-opacity='0.02'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
}

/* ── Layout ── */
.container {
  position: relative;
  z-index: 1;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: var(--header-h) 1.5rem 0;
}

/* ── Header fixo ── */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 12px rgba(28,24,20,.07);
  padding: .9rem 0;
  transition: background .3s, box-shadow .3s;
}

.site-header .inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.site-title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 400;
  letter-spacing: -.02em;
  color: var(--text);
}

.site-subtitle {
  font-size: var(--text-sm);
  color: var(--text-muted);
  font-style: italic;
}

.header-actions { display: flex; gap: .75rem; align-items: center; }

/* ── Botão modo escuro ── */
.btn-theme {
  background: transparent;
  border: 1.5px solid currentColor;
  border-radius: 999px;
  width: 2.25rem;
  height: 2.25rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  line-height: 1;
  color: var(--text);
  opacity: .6;
  transition: opacity .2s, transform .15s;
  flex-shrink: 0;
}
.btn-theme:hover { opacity: 1; transform: scale(1.08); }

/* garante visibilidade no dark mode */
[data-theme="dark"] .btn-theme {
  color: var(--text);
  opacity: .8;
}

/* ── Lista de posts ── */
.month-group { margin-bottom: 3rem; }
.month-group:first-child { margin-top: 2rem; }

.month-label {
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text);
  margin-bottom: 1rem;
  padding-bottom: .5rem;
  border-bottom: 1px solid var(--border);
}

.post-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: .75rem;
  padding: .85rem 0;
}

.post-day {
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  border-radius: 5px;
  padding: .2rem .55rem;
  min-width: 2rem;
  text-align: center;
  flex-shrink: 0;
}

.post-item-title {
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: 400;
  color: var(--text);
  line-height: 1.35;
  transition: color .15s;
}
.post-item-title:hover { color: var(--accent); text-decoration: none; }

/* ── Badge de tag — estilo unificado para home e post ── */
.post-tag {
  font-size: var(--text-xs);
  padding: .2rem .6rem;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 5px;
  letter-spacing: .04em;
  font-style: normal;
  font-family: var(--font-mono);
  flex-shrink: 0;
}

/* ── Post único ── */
.post-header {
  margin-bottom: 3rem;
  text-align: center;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}

.post-title {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: -.02em;
  margin-bottom: 1.25rem;
}

.post-meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .4rem;
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.post-meta .post-date {
  font-style: italic;
  font-family: var(--font-body);
}

/* ── Conteúdo do post ── */
.post-body { font-size: var(--text-base); line-height: 1.82; }

.post-body p { margin-bottom: 1.5rem; }
.post-body h2 {
  font-family: var(--font-display);
  font-size: var(--text-md);
  font-weight: 600;
  margin: 1.5rem 0 .75rem;
  letter-spacing: -.01em;
}
.post-body h3 {
  font-family: var(--font-display);
  font-size: var(--text-md);
  font-weight: 600;
  margin: 1.25rem 0 .75rem;
}
.post-body ul, .post-body ol { padding-left: 1.5rem; margin-bottom: 1.5rem; }
.post-body li { margin-bottom: .35rem; }

/* ── Lista de tarefas ── */
.task-item {
  list-style: none;
  display: flex;
  align-items: center;
  gap: .6rem;
  margin-left: -1.5rem;
  padding: .15rem 0;
}
.task-box {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.1rem;
  height: 1.1rem;
  border: 1.5px solid var(--border);
  border-radius: 3px;
  font-size: .7rem;
  color: transparent;
  background: var(--bg);
}
.task-box-done {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.task-done > span + * {
  color: var(--text-muted);
  text-decoration: line-through;
}

.post-body blockquote {
  border-left: 3px solid var(--accent);
  padding: .75rem 1.25rem;
  margin: 2rem 0;
  background: var(--accent-soft);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-style: italic;
  color: var(--text-muted);
}

.post-body code {
  font-family: var(--font-mono);
  font-size: .875em;
  background: var(--code-bg);
  padding: .15em .4em;
  border-radius: 3px;
}
.post-body pre {
  background: var(--code-bg);
  padding: 1.25rem;
  border-radius: var(--radius);
  overflow-x: auto;
  margin-bottom: 1.5rem;
  border: 1px solid var(--border);
}
.post-body pre code { background: none; padding: 0; }
.post-body hr { border: none; border-top: 1px solid var(--border); margin: 2.5rem 0; }
.post-body strong { font-weight: 600; }
.post-body em { font-style: italic; }
.post-body del { text-decoration: line-through; color: var(--text-muted); }

/* ── Tabelas ── */
.table-wrap {
  overflow-x: auto;
  margin: 2rem 0;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.table-wrap table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}
.table-wrap th {
  background: var(--bg-2);
  font-family: var(--font-display);
  font-weight: 600;
  text-align: left;
  padding: .65rem 1rem;
  border-bottom: 2px solid var(--border);
  color: var(--text);
}
.table-wrap td {
  padding: .6rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.table-wrap tr:last-child td { border-bottom: none; }
.table-wrap tr:hover td { background: var(--accent-soft); }

/* ── Imagens ── */
.post-body img {
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: var(--radius);
  margin: 1.5rem 0;
  box-shadow: var(--shadow);
}

/* ── Vídeo embed ── */
.video-wrap {
  position: relative;
  margin: 2rem 0;
  border-radius: var(--radius);
  overflow: hidden;
  background: #000;
}
.video-wrap iframe {
  display: block;
  width: 100%;
  height: 420px;
  border: none;
}

/* ── Áudio ── */
.post-body audio {
  width: 100%;
  margin: 1.5rem 0;
  accent-color: var(--accent);
}

/* ── Botão voltar ── */
.btn-back {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-top: 1.5rem;
  margin-bottom: 2rem;
  transition: color .2s;
}
.btn-back:hover { color: var(--accent); text-decoration: none; }

/* ── Footer ── */
.site-footer {
  padding: 2.5rem 0 3rem;
  margin-top: 4rem;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: var(--text-sm);
  color: var(--text-muted);
}
.accent-dot { color: var(--accent); font-size: 1.2em; }

/* ── Editor ── */
.editor-wrap { padding: 2rem 0; }

.editor-fields {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: .75rem;
  margin-bottom: 1rem;
}

.editor-input {
  font-family: var(--font-body);
  font-size: var(--text-base);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .6rem .9rem;
  color: var(--text);
  width: 100%;
  transition: border-color .2s, box-shadow .2s;
}
.editor-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.editor-input::placeholder { color: var(--text-muted); }

/* ── Abas do editor ── */
.tab-wrap { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.tab-bar { display: flex; background: var(--bg-2); padding: 0 .5rem; border-bottom: 1px solid var(--border); }
.tab-btn {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: .55rem 1.1rem;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: color .15s, border-color .15s;
}
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }

.editor-panes { background: var(--bg); height: calc(100vh - 310px); min-height: 380px; }
.tab-pane { display: none; flex-direction: column; height: 100%; }
.tab-pane.active { display: flex; }

#md-input {
  flex: 1;
  font-family: var(--font-mono);
  font-size: var(--text-base);
  line-height: 1.75;
  border: none;
  background: transparent;
  color: var(--text);
  padding: 1.25rem;
  resize: none;
  overflow-y: auto;
  width: 100%;
  height: 100%;
}
#md-input:focus { outline: none; }

#md-preview {
  flex: 1;
  padding: 1.5rem;
  overflow-y: auto;
  font-size: var(--text-base);
}

#md-preview p { margin-bottom: 1.25rem; }
#md-preview h2 { font-family: var(--font-display); font-size: var(--text-md); margin: 2rem 0 .75rem; }
#md-preview h3 { font-family: var(--font-display); font-size: var(--text-sm); margin: 1.5rem 0 .5rem; }
#md-preview blockquote { border-left: 3px solid var(--accent); padding: .5rem 1rem; background: var(--accent-soft); font-style: italic; margin: 1rem 0; }
#md-preview code { font-family: var(--font-mono); font-size: .85em; background: var(--code-bg); padding: .15em .4em; border-radius: 3px; }
#md-preview pre { background: var(--code-bg); padding: 1rem; border-radius: var(--radius); overflow-x: auto; margin: 1rem 0; }
#md-preview ul, #md-preview ol { padding-left: 1.5rem; margin-bottom: 1rem; }
#md-preview img { max-width: 100%; border-radius: var(--radius); }
#md-preview audio { width: 100%; margin: .75rem 0; }
#md-preview hr { border: none; border-top: 1px solid var(--border); margin: 1.5rem 0; }

.editor-toolbar {
  display: flex;
  gap: .5rem;
  align-items: center;
  padding: .75rem 0;
  flex-wrap: wrap;
}

.btn {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  padding: .4rem .85rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
  display: inline-flex;
  align-items: center;
  gap: .3rem;
}
.btn:hover { background: var(--bg-2); }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 500; }
.btn-primary:hover { filter: brightness(1.1); background: var(--accent); }
.btn-spacer { margin-left: auto; }

/* ── Modo foco ── */
body.focus-mode .site-header,
body.focus-mode .editor-toolbar,
body.focus-mode .editor-fields { opacity: 0; pointer-events: none; transition: opacity .4s; }
body.focus-mode .editor-panes { height: calc(100vh - 40px); }

/* ── Login ── */
.login-wrap { display: flex; align-items: center; justify-content: center; min-height: 60vh; }
.login-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2.5rem;
  width: 100%;
  max-width: 340px;
  box-shadow: var(--shadow);
  text-align: center;
}
.login-box h2 {
  font-family: var(--font-display);
  font-size: var(--text-md);
  margin-bottom: 1.5rem;
  color: var(--text-muted);
  font-weight: 400;
  font-style: italic;
}
.login-box .editor-input { margin-bottom: .75rem; }
.login-error { color: #c0392b; font-size: var(--text-xs); margin-bottom: .75rem; }

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: var(--text);
  color: var(--bg);
  padding: .75rem 1.25rem;
  border-radius: var(--radius);
  font-size: var(--text-sm);
  z-index: 999;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .25s, transform .25s;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateY(0); }

/* ── Responsivo ── */
@media (max-width: 640px) {
  .post-item { grid-template-columns: auto 1fr auto; gap: .5rem; }
  .editor-fields { grid-template-columns: 1fr; }

  /* Header mobile */
  .site-header .inner {
    flex-wrap: wrap;
    gap: .5rem;
    padding: 0 1rem;
  }
  .site-title { font-size: var(--text-md); }
  .site-subtitle { font-size: var(--text-xs); }
  .header-actions { gap: .4rem; }
  .post-tag { font-size: .7rem; padding: .15rem .45rem; }
}

/* ── Animação de entrada ── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.site-header, .month-group, .post-header, .post-body { animation: fadeUp .45s ease both; }
.month-group:nth-child(2) { animation-delay: .06s; }
.month-group:nth-child(3) { animation-delay: .12s; }
.month-group:nth-child(4) { animation-delay: .18s; }