/* timEU.com.br — tokens, depois base, depois componentes. Sem dependências externas. */
:root {
  --bg: #f4f1ea;
  --bg-code: #ebe6da;
  --fg: #1c1b19;
  --muted: #655f55;
  --line: #d9d4c8;
  --accent: #b4401f;
  --code-fg: #26241f;

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "URW Palladio L", Georgia, serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-tema="claro"]) {
    --bg: #161513; --bg-code: #1f1d1a; --fg: #ece8df; --muted: #a39d90;
    --line: #2e2c28; --accent: #e8825c; --code-fg: #e4dfd3;
    color-scheme: dark;
  }
}
:root[data-tema="escuro"] {
  --bg: #161513; --bg-code: #1f1d1a; --fg: #ece8df; --muted: #a39d90;
  --line: #2e2c28; --accent: #e8825c; --code-fg: #e4dfd3;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 4rem; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 1.0625rem/1.6 var(--serif);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; width: 100%; max-width: 46rem; margin: 0 auto; padding: 2.5rem 1.25rem 4rem; }
body.wide main { max-width: 68rem; }

a { color: inherit; text-decoration-color: var(--accent); text-underline-offset: 0.18em; }
a:hover { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
.muted { color: var(--muted); }
.skip { position: absolute; left: -999px; top: 0; background: var(--fg); color: var(--bg); padding: .5rem 1rem; z-index: 10; }
.skip:focus { left: 0; }

/* topo e rodapé */
.topo {
  display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap;
  max-width: 68rem; width: 100%; margin: 0 auto; padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--line);
}
.marca { font-weight: 700; font-size: 1.15rem; text-decoration: none; letter-spacing: -0.01em; }
.marca { margin-right: auto; }
.topo nav { display: flex; gap: .25rem 1.25rem; flex-wrap: wrap; order: 3; flex-basis: 100%; font-size: .95rem; }
@media (min-width: 44rem) {
  .marca { margin-right: 0; }
  .topo nav { order: 0; flex: 1; flex-basis: auto; }
}
.topo nav a { text-decoration: none; color: var(--muted); padding: .35rem 0; }
.topo nav a:hover, .topo nav a[aria-current="page"] { color: var(--fg); }
.topo nav a[aria-current="page"] { text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: .35em; }
.tema {
  background: none; border: 1px solid var(--line); border-radius: 6px; color: var(--muted);
  width: 2.75rem; height: 2.75rem; display: grid; place-items: center; cursor: pointer;
}
.tema:hover { color: var(--fg); border-color: var(--muted); }
.rodape {
  max-width: 68rem; width: 100%; margin: 0 auto; padding: 1.5rem 1.25rem 2.5rem;
  border-top: 1px solid var(--line); display: flex; gap: 1.25rem; flex-wrap: wrap;
  font: .8rem var(--mono); color: var(--muted);
}
.rodape span { margin-right: auto; }
.rodape a { text-decoration: none; padding: .4rem 0; }
.rodape a:hover { color: var(--accent); }

/* home */
.masthead { display: flex; gap: 1.4rem; align-items: center; margin: .5rem 0 3.2rem; }
.masthead img { border-radius: 50%; flex: none; object-fit: cover; }
.masthead h1 { margin: 0; font-size: clamp(2.2rem, 7vw, 3.2rem); line-height: 1; letter-spacing: -0.03em; }
.tagline { margin: .55rem 0 0; color: var(--muted); font-style: italic; }
.block { margin-bottom: 3rem; }
.label {
  margin: 0 0 .5rem; font: 600 .72rem/1 var(--mono); text-transform: uppercase;
  letter-spacing: .12em; color: var(--muted);
}
.lead { margin: 0 0 1.25rem; color: var(--muted); }
.more { margin: 1rem 0 0; font-size: .95rem; }

/* listas em linhas */
.rows { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.rows li { border-bottom: 1px solid var(--line); }
.rows li[hidden] { display: none; }
.rows a {
  display: flex; justify-content: space-between; align-items: baseline; gap: 1.25rem;
  padding: .9rem 0; text-decoration: none; min-height: 2.75rem;
}
.row-main { display: flex; flex-direction: column; min-width: 0; }
.row-title { font-weight: 700; }
.row-desc { color: var(--muted); font-size: .9rem; line-height: 1.4; margin-top: .1rem; }
.row-meta { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: .2rem; font: .72rem var(--mono); color: var(--muted); }
.row-meta .tags { display: flex; gap: .5rem; }
.rows a:hover .row-title, .rows a:focus-visible .row-title { color: var(--accent); }
@media (max-width: 40rem) { .row-meta { display: none; } }

/* cabeçalhos de página */
.page-head { margin-bottom: 2rem; }
.page-head h1 { margin: 0 0 .6rem; font-size: clamp(1.9rem, 5vw, 2.6rem); line-height: 1.15; letter-spacing: -0.02em; }
.crumb { margin: 0 0 .5rem; font: .75rem var(--mono); text-transform: uppercase; letter-spacing: .1em; }
.crumb a { color: var(--muted); text-decoration: none; }
.crumb a:hover { color: var(--accent); }
.meta { margin: 0; color: var(--muted); font: .8rem var(--mono); }
.note { margin-top: 2rem; font-size: .9rem; }

/* filtro */
.filter { display: flex; align-items: center; gap: .75rem; margin-bottom: 1rem; flex-wrap: wrap; }
.filter label { font: 600 .72rem/1 var(--mono); text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
.filter input {
  flex: 1 1 14rem; min-height: 2.75rem; padding: .5rem .75rem; font: .95rem var(--mono);
  color: var(--fg); background: transparent; border: 1px solid var(--line); border-radius: 6px;
}
.filter input::placeholder { color: var(--muted); opacity: .8; }
.filter input:focus-visible { border-color: var(--accent); outline-offset: 0; }

/* tags */
.chips { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .6rem; }
.chips a {
  display: inline-flex; gap: .5rem; align-items: center; min-height: 2.75rem; padding: 0 .9rem;
  border: 1px solid var(--line); border-radius: 999px; text-decoration: none; font-size: .95rem;
}
.chips a span { color: var(--muted); font: .75rem var(--mono); }
.chips a:hover { border-color: var(--accent); }

/* documento (cheatsheet) */
.doc { display: block; }
.toc { display: none; }
@media (min-width: 64rem) {
  .doc { display: grid; grid-template-columns: 14rem minmax(0, 1fr); gap: 3rem; align-items: start; }
  .toc { display: block; position: sticky; top: 1.5rem; max-height: calc(100vh - 3rem); overflow: auto; font-size: .85rem; padding-right: .5rem; }
  .toc ol { list-style: none; margin: .5rem 0 0; padding: 0; border-left: 1px solid var(--line); }
  .toc a { display: block; padding: .3rem .75rem; color: var(--muted); text-decoration: none; line-height: 1.35; }
  .toc a:hover, .toc a.ativo { color: var(--fg); }
  .toc a.ativo { box-shadow: -1px 0 0 var(--accent); }
}
.prose { max-width: 46rem; }
.prose h2 { margin: 2.6rem 0 .8rem; font-size: 1.45rem; line-height: 1.25; letter-spacing: -0.01em; padding-top: 1rem; border-top: 1px solid var(--line); }
.prose h3 { margin: 1.8rem 0 .5rem; font-size: 1.1rem; }
.prose p, .prose ul, .prose ol { margin: 0 0 1.1rem; }
.prose li { margin-bottom: .3rem; }
.prose code { font: .88em var(--mono); background: var(--bg-code); padding: .1em .35em; border-radius: 4px; }
.prose table { border-collapse: collapse; width: 100%; margin: 0 0 1.4rem; font-size: .92rem; display: block; overflow-x: auto; }
.prose th, .prose td { text-align: left; padding: .5rem .75rem; border-bottom: 1px solid var(--line); }
.prose img { max-width: 100%; height: auto; }

.code { position: relative; margin: 0 0 1.4rem; }
.code pre {
  margin: 0; padding: 1rem 1.1rem; overflow-x: auto; background: var(--bg-code); color: var(--code-fg);
  border: 1px solid var(--line); border-radius: 6px; font: .85rem/1.55 var(--mono); tab-size: 4;
}
.code pre:focus-visible { outline-offset: 2px; }
.prose .code code { background: none; padding: 0; font: inherit; }
.code .c { color: var(--muted); font-style: italic; }
.copiar {
  position: absolute; top: .45rem; right: .45rem; min-width: 2.75rem; min-height: 2.75rem; padding: 0 .7rem;
  font: .72rem var(--mono); color: var(--muted); background: var(--bg); border: 1px solid var(--line);
  border-radius: 6px; cursor: pointer; opacity: 0; transition: opacity .15s;
}
.code:hover .copiar, .copiar:focus-visible { opacity: 1; }
.copiar:hover { color: var(--fg); border-color: var(--muted); }
@media (hover: none) { .copiar { opacity: 1; } }

.doc-foot { margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--line); max-width: 46rem; }
.tags-line { display: flex; flex-wrap: wrap; gap: .5rem 1rem; font: .8rem var(--mono); margin: 0 0 1.5rem; }
.tags-line a { color: var(--muted); }
.pn { display: flex; justify-content: space-between; gap: 1rem; }
.pn a { display: flex; flex-direction: column; text-decoration: none; font-weight: 700; min-height: 2.75rem; }
.pn small { font: 400 .7rem var(--mono); text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.pn .next { text-align: right; margin-left: auto; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
@media print {
  .topo, .rodape, .toc, .copiar, .tema, .filter, .pn { display: none; }
  body { background: #fff; color: #000; }
  .code pre { white-space: pre-wrap; border-color: #999; }
}
