:root {
  --bg: #fbfaf7;
  --surface: #ffffff;
  --text: #1c1f1a;
  --muted: #5b6157;
  --line: #e3e1d8;
  --accent: #2f7d32;
  --accent-ink: #ffffff;
  --code-bg: #f1efe7;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141713;
    --surface: #1c201a;
    --text: #e9ece4;
    --muted: #a3aa9b;
    --line: #2e342b;
    --accent: #6fbf73;
    --accent-ink: #10210f;
    --code-bg: #23281f;
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 4rem; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.65 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); }
main, footer, .top nav { max-width: 60rem; margin: 0 auto; padding: 0 16px; }

.top {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}
.top nav { display: flex; flex-wrap: wrap; gap: 4px 18px; align-items: center; padding-top: 10px; padding-bottom: 10px; font-size: 15px; }
.top a { text-decoration: none; color: var(--muted); }
.top a:hover { color: var(--text); }
.top .brand { color: var(--text); font-weight: 700; margin-right: auto; }

section { padding: 3rem 0 1rem; }
h1 { font-size: clamp(2.2rem, 6vw, 3.4rem); line-height: 1.1; margin: .3em 0; }
h2 { font-size: 1.7rem; margin: 0 0 .3em; }
h3 { font-size: 1.05rem; margin: 0 0 .4em; }
h3 small { color: var(--muted); font-weight: 400; margin-left: .4em; }

.hero { padding-top: 4rem; }
.kicker { color: var(--muted); font-size: .9rem; margin: 0; }
.lead { font-size: 1.15rem; max-width: 42rem; }
.tag { display: inline-block; margin: 0 0 .8rem; padding: 2px 10px; border: 1px solid var(--line); border-radius: 99px; color: var(--muted); font-size: .8rem; }

.btn { display: inline-block; padding: .6rem 1.1rem; border-radius: 8px; background: var(--accent); color: var(--accent-ink); text-decoration: none; font-weight: 600; margin: 0 .5rem .5rem 0; }
.btn.ghost { background: transparent; color: var(--accent); border: 1px solid var(--accent); }

.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); margin: 1rem 0; }
article { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; }
article p { margin: 0; font-size: .95rem; color: var(--muted); }

pre { background: var(--code-bg); border: 1px solid var(--line); border-radius: 10px; padding: 14px; overflow-x: auto; font-size: .85rem; line-height: 1.5; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9em; }
figure { margin: 1.2rem 0; }
figcaption, .note { color: var(--muted); font-size: .9rem; }

table { width: 100%; border-collapse: collapse; margin: 1rem 0; font-size: .95rem; display: block; overflow-x: auto; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; }

.steps li { margin-bottom: .5rem; }
.refs li { margin-bottom: .5rem; font-size: .95rem; }

.demo { display: grid; gap: 14px; grid-template-columns: 224px 1fr; align-items: start; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.drop { grid-column: 1 / -1; display: inline-block; padding: .6rem 1.1rem; border: 1px dashed var(--accent); border-radius: 8px; cursor: pointer; color: var(--accent); font-weight: 600; justify-self: start; }
.drop input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.drop:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
canvas { width: 224px; height: 224px; background: var(--code-bg); border-radius: 8px; max-width: 100%; }
#resultado { font-size: 1.05rem; }
.barra { height: 10px; background: var(--code-bg); border-radius: 99px; overflow: hidden; margin: .4rem 0 .8rem; }
.barra > span { display: block; height: 100%; background: var(--accent); }
.barra.mala > span { background: #c0392b; }
@media (max-width: 560px) { .demo { grid-template-columns: 1fr; } }

footer { padding-top: 2rem; padding-bottom: 3rem; color: var(--muted); font-size: .9rem; border-top: 1px solid var(--line); margin-top: 3rem; }
