:root {
  --bg: #fbfaf8;
  --fg: #1c1b19;
  --muted: #6b6862;
  --accent: #8a4b2a;
  --border: #e2ded6;
  --code-bg: #f2efe9;
  --code-fg: #24211d;
  --wide: 68rem;   /* moldura da pagina: cabecalho, home, rodape */
  --texto: 52rem;  /* medida de leitura do artigo */
}

:root[data-tema="dark"] {
  --bg: #16151a;
  --fg: #e8e5df;
  --muted: #9a958c;
  --accent: #d9a06a;
  --border: #2c2a31;
  --code-bg: #1e1d24;
  --code-fg: #e8e5df;
}

:root[data-tema="dark"] img,
:root[data-tema="dark"] svg { color-scheme: dark; }

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 400 clamp(1rem, 0.96rem + 0.18vw, 1.0625rem)/1.7 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-feature-settings: "kern" 1;
}

.topo {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  max-width: var(--wide);
  margin: 0 auto;
  padding: 1.8rem 1.5rem 0;
}

.marca {
  font-weight: 650;
  letter-spacing: -0.01em;
  color: var(--fg);
  text-decoration: none;
}

.idiomas { font-size: 0.85rem; color: var(--muted); display: inline-flex; align-items: center; gap: 0.45rem; }
.idiomas a, .idiomas .atual { display: inline-flex; line-height: 0; opacity: 0.55; transition: opacity 0.12s ease; }
.idiomas a:hover { opacity: 1; }
.idiomas .atual { opacity: 1; }
.bandeira { width: 20px; height: 14px; border-radius: 2px; box-shadow: 0 0 0 1px rgba(0,0,0,.12); display: block; }

.controles { display: flex; align-items: center; gap: 1rem; }

.tema {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.12s ease, border-color 0.12s ease;
}
.tema:hover { color: var(--fg); border-color: var(--muted); }
.tema .icone { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.tema .sol { display: none; }
:root[data-tema="dark"] .tema .sol { display: block; }
:root[data-tema="dark"] .tema .lua { display: none; }

main {
  max-width: var(--wide);
  margin: 0 auto;
  padding: 1.6rem 1.5rem 4rem;
}

/* artigo: medida de leitura confortavel, centrada na moldura larga */
.artigo {
  max-width: var(--texto);
  margin: 0 auto;
}

h1, h2, h3, h4 {
  line-height: 1.25;
  letter-spacing: -0.015em;
  margin: 2.4rem 0 0.8rem;
}

h1 { font-size: clamp(1.7rem, 1.4rem + 1.1vw, 2.15rem); margin-top: 1rem; }
h2 { font-size: clamp(1.2rem, 1.1rem + 0.4vw, 1.4rem); padding-bottom: 0.35rem; border-bottom: 1px solid var(--border); }
h3 { font-size: 1.1rem; }

p, ul, ol, blockquote, table, pre { margin: 0 0 1.1rem; }

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }

ul, ol { padding-left: 1.3rem; }
li { margin: 0.3rem 0; }
li > p { margin-bottom: 0.4rem; }

blockquote {
  margin-left: 0;
  padding: 0.1rem 0 0.1rem 1rem;
  border-left: 3px solid var(--border);
  color: var(--muted);
}

blockquote p:last-child { margin-bottom: 0; }

hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 2.2rem 0;
}

code {
  font-family: ui-monospace, SFMono-Regular, "Cascadia Mono", Consolas, monospace;
  font-size: 0.875em;
  background: var(--code-bg);
  color: var(--code-fg);
  padding: 0.12em 0.35em;
  border-radius: 4px;
}

pre {
  position: relative;
  background: var(--code-bg);
  color: var(--code-fg);
  padding: 0.9rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  overflow-x: auto;
  font-size: 0.86rem;
  line-height: 1.55;
}

pre code {
  background: none;
  padding: 0;
  font-size: inherit;
  border-radius: 0;
}

.copiar {
  position: absolute;
  top: 0.45rem;
  right: 0.45rem;
  font: inherit;
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0.18rem 0.45rem;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.12s ease;
}

pre:hover .copiar, .copiar:focus { opacity: 1; }
.copiar:hover { color: var(--fg); }

table {
  display: block;
  width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  font-size: 0.93rem;
}

th, td {
  text-align: left;
  vertical-align: top;
  padding: 0.5rem 0.7rem;
  border-bottom: 1px solid var(--border);
}

th { font-weight: 620; }

.meta {
  color: var(--muted);
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  margin-bottom: 1.6rem;
}

.artigo > h1 + .meta { margin-top: -0.4rem; }

/* comentarios dentro da coluna do artigo, antes do rodape do site */
.comentarios {
  margin-top: 3.5rem;
  padding-top: 1.6rem;
  border-top: 1px solid var(--border);
}
.titulo-comentarios {
  font-size: 1.1rem;
  margin: 0 0 1rem;
  padding: 0;
  border: 0;
}

/* home: abertura larga e lista em duas colunas no desktop */
.abertura { max-width: 46rem; margin-bottom: 3rem; }
.abertura h1 { margin-bottom: 0.7rem; }

.linha-fina {
  color: var(--muted);
  font-size: 1.05rem;
  max-width: 40rem;
}

.lista {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0 2.5rem;
}

.lista li {
  padding: 1.1rem 0;
  border-bottom: 1px solid var(--border);
}

.lista a {
  font-weight: 620;
  font-size: 1.05rem;
  text-decoration: none;
  color: var(--fg);
  display: block;
}

.lista a:hover { color: var(--accent); }
.lista p {
  margin: 0.35rem 0 0.3rem;
  color: var(--muted);
  font-size: 0.95rem;
}
.lista .meta { display: block; }

.rodape {
  max-width: var(--wide);
  margin: 0 auto;
  padding: 2rem 1.5rem 3.5rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.88rem;
}

.rodape-topo {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.4rem;
}

.rodape-topo .marca { color: var(--fg); }

.rodape p { margin: 0 0 0.4rem; }
.miudo { font-size: 0.82rem; }

@media (min-width: 60rem) {
  main.home {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 3rem;
    align-content: start;
  }
  main.home .abertura { grid-column: 1 / -1; }
  main.home .lista { grid-template-columns: 1fr; }
  .topo { padding-top: 2.2rem; }
}

@media (max-width: 34rem) {
  body { font-size: 1rem; }
  .topo, main, .rodape { padding-left: 1.15rem; padding-right: 1.15rem; }
}
