/* =========================================================================
   rpdev.io — estética blog de dev, anos 2000 / monospace
   ========================================================================= */

:root {
  --bg:      #f6f6f3;   /* papel claro */
  --bg-2:    #ececE6;   /* fundo de código / caixas */
  --fg:      #1b1b1b;
  --fg-soft: #5f5f5a;   /* meta, kicker */
  --link:    #0a4fb0;
  --accent:  #1f7a3d;   /* prompt, "#", legendas */
  --rule:    #c9c9c2;

  --maxw: 72ch;                         /* coluna de leitura em mono */
  --pad:  clamp(1rem, 4vw, 2.5rem);
  --gap:  clamp(1.25rem, 3.5vw, 2rem);

  --mono: "SFMono-Regular", ui-monospace, Menlo, Consolas,
          "DejaVu Sans Mono", "Liberation Mono", monospace;
  --display: "Montserrat", system-ui, -apple-system, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:      #101216;
    --bg-2:    #1b1e24;
    --fg:      #d7d7d0;
    --fg-soft: #8b8b83;
    --link:    #6cb6ff;
    --accent:  #3fb950;
    --rule:    #2b2f37;
  }
}

/* --- reset leve ------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; }
a { color: var(--link); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--fg);
  color: var(--bg);
  padding: .5rem .9rem;
  font: 700 .8rem/1 var(--mono);
  z-index: 10;
}
.skip-link:focus { left: .5rem; top: .5rem; }

.wrap {
  max-width: 60rem;
  margin-inline: auto;
  padding-inline: var(--pad);
}

/* =========================================================================
   Masthead
   ========================================================================= */
.masthead {
  border-block: 1px solid var(--rule);
  margin-top: .5rem;
  padding-block: clamp(1rem, 3vw, 1.75rem);
}
.masthead__ascii {
  margin: 0 0 .6rem;
  color: var(--accent);
  font-size: clamp(.32rem, 1.5vw, .6rem);
  line-height: 1;
  overflow-x: auto;
  overflow-y: hidden;
}
.masthead__title {
  margin: 0;
  font-family: var(--display);
  font-weight: 900;
  text-transform: lowercase;
  letter-spacing: -.01em;
  line-height: 1;
  font-size: clamp(1.4rem, 5vw, 2.2rem);
}
.masthead__title a { color: inherit; text-decoration: none; }
.masthead__tagline {
  margin: .4rem 0 0;
  color: var(--fg-soft);
  font-size: .8rem;
}
.masthead__tagline::before { content: "// "; }
.masthead--compact .masthead__ascii { display: none; }

/* --- nav ------------------------------------------------------------- */
.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  padding-block: .9rem;
  border-bottom: 1px solid var(--rule);
  font-size: .85rem;
}
.nav a {
  color: var(--link);
  text-decoration: none;
  padding: .25rem 0;
}
.nav a::before { content: "["; color: var(--fg-soft); margin-right: .35em; }
.nav a::after  { content: "]"; color: var(--fg-soft); margin-left: .35em; }
.nav a:hover { text-decoration: underline; }
.nav a[aria-current="page"] { color: var(--accent); font-weight: 700; }

/* =========================================================================
   Meta / kicker / tags
   ========================================================================= */
.kicker {
  margin: 0;
  color: var(--fg-soft);
  font-size: .8rem;
}
.tags { color: var(--accent); }
.tags span::before { content: "#"; }
.tags span + span::before { content: " #"; }

/* =========================================================================
   Home — lista de posts (caixas estilo fieldset)
   ========================================================================= */
main { padding-block: var(--gap); }

.post-list { margin: 0; }
.post-item {
  position: relative;
  border: 1px solid var(--rule);
  padding: 1rem 1.15rem 1.15rem;
  margin-block: 1.6rem;
}
.post-item__title {
  position: absolute;
  top: -.72em;
  left: .8rem;
  margin: 0;
  padding-inline: .4rem;
  background: var(--bg);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
}
.post-item__title::before { content: "\00bb "; color: var(--accent); }
.post-item__title a { color: var(--fg); text-decoration: none; }
.post-item__title a:hover { text-decoration: underline; }
.post-item__summary { margin: .5rem 0 0; }
.post-item .kicker { margin-bottom: .25rem; }
.post-item__more {
  display: inline-block;
  margin-top: .6rem;
  font-size: .8rem;
  color: var(--link);
  text-decoration: none;
}
.post-item__more:hover { text-decoration: underline; }

/* =========================================================================
   Artigo
   ========================================================================= */
.article__head {
  padding-block: var(--gap) 1.25rem;
  border-bottom: 1px solid var(--rule);
}
.article__title {
  margin: .4rem 0 0;
  font-weight: 700;
  line-height: 1.15;
  font-size: clamp(1.4rem, 4.5vw, 2rem);
}
.article__title::before { content: "# "; color: var(--accent); }

.prose {
  max-width: var(--maxw);
  margin-inline: auto;
  padding-block: var(--gap);
}
.prose h2, .prose h3 {
  font-weight: 700;
  line-height: 1.2;
  margin-top: 2.25rem;
}
.prose h2 { font-size: 1.2rem; }
.prose h3 { font-size: 1.05rem; }
.prose h2::before { content: "## ";  color: var(--fg-soft); }
.prose h3::before { content: "### "; color: var(--fg-soft); }
.prose p, .prose ul, .prose ol { margin-block: 1rem; }
.prose li { margin-block: .3rem; }
.prose a { color: var(--link); text-decoration: underline; }
.prose blockquote {
  margin: 1.25rem 0;
  padding-left: 1rem;
  border-left: 2px solid var(--accent);
  color: var(--fg-soft);
}
.prose hr {
  border: 0;
  border-top: 1px dashed var(--rule);
  margin: 2rem 0;
}
.prose code {
  font-family: var(--mono);
  font-size: .92em;
  background: var(--bg-2);
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: 0 .3em;
}
.prose pre {
  background: var(--bg-2);
  border: 1px solid var(--rule);
  padding: .9rem 1rem;
  overflow-x: auto;
  line-height: 1.45;
}
.prose pre code { background: none; border: 0; padding: 0; font-size: .88em; }
.prose table {
  border-collapse: collapse;
  width: 100%;
  margin: 1.25rem 0;
  font-size: .92em;
}
.prose th, .prose td {
  border: 1px solid var(--rule);
  padding: .4rem .6rem;
  text-align: left;
}
.prose thead th { background: var(--bg-2); }
.prose table { display: block; overflow-x: auto; }

/* --- prev / next --------------------------------------------------- */
.postnav {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-block: 1.25rem;
  border-top: 1px solid var(--rule);
  font-size: .85rem;
}
.postnav a { color: var(--link); text-decoration: none; max-width: 48%; }
.postnav a:hover { text-decoration: underline; }
.postnav__next { margin-left: auto; text-align: right; }
.postnav .kicker { display: block; }

/* =========================================================================
   Estados (erro / vazio)
   ========================================================================= */
.notice {
  max-width: var(--maxw);
  margin-inline: auto;
  padding-block: var(--gap);
}
.notice h1 { font-weight: 700; font-size: 1.4rem; }
.notice h1::before { content: "! "; color: var(--accent); }

/* =========================================================================
   Footer
   ========================================================================= */
.colophon {
  border-top: 1px solid var(--rule);
  margin-top: var(--gap);
  padding-block: 1.5rem 2.5rem;
  color: var(--fg-soft);
  font-size: .8rem;
  display: flex;
  flex-wrap: wrap;
  gap: .25rem 1.5rem;
}

/* =========================================================================
   Impressão
   ========================================================================= */
@media print {
  :root {
    --bg: #fff; --bg-2: #fff; --fg: #000; --fg-soft: #333;
    --link: #000; --accent: #000; --rule: #999;
  }
  .masthead__ascii, .nav, .postnav, .colophon, .skip-link { display: none; }
  body { font-size: 11pt; }
}
