/* ─────────────────────────────────────────────────────────────────────────
   valdeirsapara.com.br — tema "organic terminal"
   Tokens derivados do design system Organic, ajustados para o modo escuro
   padrão do blog. Tema claro via [data-theme="light"].
   ───────────────────────────────────────────────────────────────────────── */

:root {
  --bg: #15120e;
  --surface: #1e1a15;
  --sunken: #0f0d0a;
  --fg: #eee7db;
  --muted: #a19786;
  --line: #3a3229;
  --acc: #f6a06b;
  --acc2: #aebf92;

  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --body: "Figtree", system-ui, -apple-system, sans-serif;
  --disp: "Caprasimo", Georgia, serif;

  --measure: 760px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 14px;
}

:root[data-theme="light"] {
  --bg: #f5ead8;
  --surface: #ebddc5;
  --sunken: #e4d3b6;
  --fg: #201e1d;
  --muted: #645c50;
  --line: #d0c1a4;
  --acc: #8c491a;
  --acc2: #56633f;
}

*,
*::before,
*::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  transition: background .2s, color .2s;
}

a {
  color: var(--acc);
  text-decoration-color: color-mix(in srgb, var(--acc) 40%, transparent);
  text-underline-offset: 3px;
}
a:hover { color: var(--acc2); text-decoration-color: currentColor; }

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

::selection { background: color-mix(in srgb, var(--acc) 32%, transparent); }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }

@keyframes blink { 0%, 49% { opacity: 1 } 50%, 100% { opacity: 0 } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  padding: 10px 16px;
  background: var(--surface);
  color: var(--fg);
  border: 1px solid var(--line);
  border-radius: 0 0 var(--radius-md) 0;
  font-family: var(--mono);
  font-size: 13px;
  text-decoration: none;
}
.skip-link:focus { left: 0; }

/* — invólucro comum das páginas — */
.shell {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 48px 24px 120px;
}
.shell--post { padding-top: 56px; }
.shell--page { padding-top: 72px; }

/* ── cabeçalho ─────────────────────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.site-header__inner {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 20px;
}
.brand {
  font-family: var(--mono);
  font-size: 13.5px;
  font-weight: 500;
  text-decoration: none;
  color: var(--fg);
  display: flex;
  align-items: center;
  gap: 8px;
}
.brand:hover { color: var(--fg); }
.brand__caret { color: var(--acc); }

.site-nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: var(--mono);
  font-size: 13px;
}
.site-nav a {
  padding: 6px 10px;
  border-radius: 999px;
  text-decoration: none;
  color: var(--muted);
  background: transparent;
}
.site-nav a:hover { background: var(--surface); color: var(--fg); }
.site-nav a[aria-current="page"] { color: var(--fg); background: var(--surface); }

.theme-toggle {
  margin-left: 6px;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 13px;
}
.theme-toggle:hover { color: var(--acc); border-color: var(--acc); }

/* ── linha de prompt ───────────────────────────────────────────────────── */
.prompt {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 36px;
}
.prompt__user { color: var(--acc2); }
.prompt__sep { opacity: .6; }
.prompt__path { color: var(--acc); }
.prompt__note { opacity: .6; }
.prompt--tight { margin-bottom: 14px; }
.prompt--footer { margin: 36px 0 0; }

.cursor {
  display: inline-block;
  width: 8px;
  height: 15px;
  background: var(--acc);
  vertical-align: -2px;
  margin-left: 6px;
  animation: blink 1.1s steps(1) infinite;
}

/* ── home: listagem por mês ────────────────────────────────────────────── */
.month-group {
  padding: 0 0 36px;
  margin-bottom: 36px;
  border-bottom: 1px solid var(--line);
}
.month-group__title,
.section-title {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 24px;
}
.post-list { display: flex; flex-direction: column; gap: 26px; }

.post-row {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 20px;
  align-items: baseline;
}
.post-row__date {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--muted);
  opacity: .75;
}
.post-row__title {
  margin: 0 0 6px;
  font-family: var(--body);
  font-weight: 700;
  font-size: 20px;
  line-height: 1.3;
  letter-spacing: -0.01em;
}
.post-row__title a { color: var(--fg); text-decoration: none; }
.post-row__title a:hover { color: var(--acc); }
.post-row__description {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 15.5px;
  max-width: 56ch;
  text-wrap: pretty;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--muted);
  margin: 0;
  padding: 0;
  list-style: none;
}
.tag { padding: 3px 9px; border: 1px solid var(--line); border-radius: 999px; }

.empty-state { font-family: var(--mono); font-size: 13.5px; color: var(--muted); }

/* ── post ─────────────────────────────────────────────────────────────── */
.back-link {
  font-family: var(--mono);
  font-size: 13px;
  text-decoration: none;
  color: var(--muted);
}
.back-link:hover { color: var(--acc); }

.post-meta {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--muted);
  margin: 34px 0 14px;
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}
.post-meta__sep { opacity: .4; }
.post-meta__series { color: var(--acc2); }

.post-title {
  font-family: var(--disp);
  font-weight: 400;
  font-size: 44px;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 0 0 16px;
  text-wrap: pretty;
}
.post-lead {
  font-size: 19px;
  color: var(--muted);
  margin: 0 0 44px;
  max-width: 56ch;
  text-wrap: pretty;
}

.post-content {
  font-size: 17.5px;
  line-height: 1.75;
  max-width: 66ch;
}
.post-content > * { margin: 0 0 22px; }
.post-content p { text-wrap: pretty; }
.post-content h2 {
  font-family: var(--body);
  font-weight: 700;
  font-size: 26px;
  letter-spacing: -0.015em;
  margin: 44px 0 14px;
  line-height: 1.25;
}
.post-content h3 {
  font-family: var(--body);
  font-weight: 700;
  font-size: 21px;
  letter-spacing: -0.01em;
  margin: 32px 0 12px;
  line-height: 1.3;
}
.post-content ul,
.post-content ol { padding-left: 22px; }
.post-content li { margin-bottom: 8px; }
.post-content li::marker { color: var(--acc); }
.post-content sup { font-family: var(--mono); font-size: 12px; }
.post-content sup a { text-decoration: none; }

.post-content code {
  font-family: var(--mono);
  font-size: .86em;
  background: var(--sunken);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 2px 6px;
}

.post-content blockquote {
  padding: 0 0 0 20px;
  border-left: 2px solid var(--acc);
  font-size: 18px;
  color: var(--muted);
  text-wrap: pretty;
  margin: 0 0 26px;
}
.post-content blockquote p:last-child { margin-bottom: 0; }

.post-content img { border-radius: var(--radius-lg); border: 1px solid var(--line); }
.post-content figure { margin: 0 0 26px; }
.post-content figcaption {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 10px;
}

.post-content hr {
  height: 1px;
  border: 0;
  background: var(--line);
  margin: 40px 0;
}

.post-content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}
.post-content th {
  text-align: left;
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
}
.post-content td {
  padding: 8px 10px;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
}

/* — blocos de código com "chrome" de janela — */
.code-block {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin: 0 0 26px;
  background: var(--sunken);
}
.code-block__bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--muted);
}
.code-block__dots { display: flex; gap: 5px; }
.code-block__dots span {
  width: 9px;
  height: 9px;
  border-radius: 999px;
}
.code-block__dots span:nth-child(1) { background: var(--acc); opacity: .75; }
.code-block__dots span:nth-child(2) { background: var(--acc2); opacity: .6; }
.code-block__dots span:nth-child(3) { background: var(--muted); opacity: .4; }
.code-block__name { margin-left: 4px; }
.code-block__lang { margin-left: auto; letter-spacing: .08em; }
.code-block pre {
  margin: 0;
  padding: 18px 16px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--fg);
}
.code-block pre code {
  background: none;
  border: 0;
  padding: 0;
  font-size: inherit;
}

/* — sessão de terminal — */
.terminal {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--sunken);
  padding: 16px;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.7;
  margin: 0 0 26px;
  overflow-x: auto;
}
.terminal pre {
  margin: 0;
  font: inherit;
  color: var(--muted);
  white-space: pre;
}
.terminal code { background: none; border: 0; padding: 0; font-size: inherit; }

/* — notas de rodapé (marked: .footnotes) — */
.post-content .footnotes {
  margin: 48px 0 0;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.7;
  color: var(--muted);
}
.post-content .footnotes h2 { display: none; }

/* — navegação entre posts — */
.post-navigation {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin: 56px 0 0;
}
.post-navigation a {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 18px;
  text-decoration: none;
  color: var(--fg);
}
.post-navigation a:hover { border-color: var(--acc); color: var(--fg); }
.post-navigation__label {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--muted);
  margin-bottom: 8px;
}
.post-navigation__title { font-weight: 600; font-size: 15.5px; line-height: 1.35; }
.post-navigation__next { text-align: right; grid-column: 2; }

/* ── página "sobre" ───────────────────────────────────────────────────── */
.page-title {
  font-family: var(--disp);
  font-weight: 400;
  font-size: 46px;
  line-height: 1.08;
  letter-spacing: -0.02em;
  margin: 0 0 28px;
}

.about-grid {
  display: grid;
  grid-template-columns: 1fr 200px;
  gap: 40px;
  align-items: start;
}
.about-prose { font-size: 17.5px; line-height: 1.75; max-width: 60ch; }
.about-prose p { margin: 0 0 22px; text-wrap: pretty; }
.about-photo {
  border: 1px solid var(--line);
  border-radius: 999px;
  aspect-ratio: 1;
  background: var(--surface);
  display: grid;
  place-items: center;
  overflow: hidden;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--muted);
  text-align: center;
}
.about-photo img { width: 100%; height: 100%; object-fit: cover; border-radius: 999px; }

.terminal--about { margin: 48px 0 0; font-size: 13.5px; line-height: 1.9; }
.terminal__out { color: var(--muted); }
.terminal__line + .terminal__line { margin-top: 10px; }

/* ── rodapé ───────────────────────────────────────────────────────────── */
.site-footer { border-top: 1px solid var(--line); }
.site-footer__inner {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 26px 24px 40px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
}
.site-footer p { margin: 0; }

/* ── responsivo ───────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .site-header__inner { gap: 10px; }
  .site-nav { gap: 0; font-size: 12.5px; }
  .site-nav a { padding: 6px 8px; }
  .shell { padding: 36px 20px 90px; }
  .post-row { grid-template-columns: 1fr; gap: 6px; }
  .post-title { font-size: 34px; }
  .page-title { font-size: 36px; }
  .post-lead { font-size: 17px; }
  .post-content { font-size: 16.5px; }
  .post-navigation { grid-template-columns: 1fr; }
  .post-navigation__next { text-align: left; grid-column: 1; }
  .about-grid { grid-template-columns: 1fr; gap: 28px; }
  .about-photo { max-width: 180px; }
}

@media (max-width: 420px) {
  .brand__host { display: none; }
}
