/* ptbr-writer: uma folha, a caneta de quem escreve e a caneta da revisão. The rules are DESIGN.md. */
:root {
  /* the ground */
  --paper: #fbf8f1;
  --sheet: #ffffff;
  --rule: #e4ddcd;
  --ink: #1b1a17;
  --muted: #6b665c;
  /* the two pens, each with one meaning */
  --pen: #1d3fd0; /* the writer: the title, the links, the commands */
  --review: #c8102e; /* the correction: a rule's id, the levels of rigor, a warning */
  --display: "Fraunces", Georgia, serif;
  --prose: "Source Serif 4", Georgia, serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  /* the notebook: its rules and its margin, visible but under the text */
  --rule-ink: rgba(29, 63, 208, 0.16);
  --margin-ink: rgba(200, 16, 46, 0.35);
  --margin: max(12px, calc((100vw - 960px) / 2 - 16px));
  color-scheme: light;
}
* { box-sizing: border-box; }
html { background: var(--paper); scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  font: 400 1.15rem/1.6 var(--prose);
  /* a notebook page: blue rules every 32px over the whole page, and the red margin line */
  background:
    linear-gradient(to right, transparent 0 var(--margin), var(--margin-ink) var(--margin) calc(var(--margin) + 2px), transparent calc(var(--margin) + 2px)),
    repeating-linear-gradient(to bottom, transparent 0 31px, var(--rule-ink) 31px 32px),
    var(--paper);
  background-attachment: local;
}
main { counter-reset: sec; }
.wrap { max-width: 960px; margin: 0 auto; padding: 0 24px; }
a { color: var(--pen); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--ink); }
a:focus-visible { outline: 2px solid var(--pen); outline-offset: 3px; border-radius: 4px; }
h1, h2, h3 { font-family: var(--display); line-height: 1.1; margin: 0; }
h1 {
  font-size: clamp(3rem, 12vw, 6.5rem);
  font-weight: 800;
  color: var(--pen);
  letter-spacing: -0.02em;
  position: relative;
}
/* the review pen's stroke under the title */
h1::after {
  content: "";
  position: absolute;
  left: 0.04em;
  bottom: -0.08em;
  width: 2.6em;
  height: 0.09em;
  background: var(--review);
  border-radius: 999px;
  transform: rotate(-1.2deg);
  transform-origin: left;
}
h2 { font-size: clamp(1.7rem, 5vw, 2.4rem); font-weight: 800; margin-bottom: 0.3em; }
/* each section numbered by the page itself, never typed */
section h2::before {
  counter-increment: sec;
  content: "§ " counter(sec, decimal-leading-zero);
  display: block;
  font: 600 0.8rem var(--mono);
  color: var(--review);
  letter-spacing: 0.08em;
  margin-bottom: 0.4em;
}
h3 { font-size: 1.2rem; font-weight: 600; margin: 0.1em 0 0.3em; }
code, .chip, .id, .jump, .foot, .kicker, .state, .status { font-family: var(--mono); }
code { font-size: 0.85em; background: var(--sheet); border: 1px solid var(--rule); border-radius: 4px; padding: 0 0.3em; }

/* the cover */
.cover { padding: 72px 24px 40px; position: relative; }
/* pt-BR first: the flag leads the kicker */
.kicker { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.flag { width: 42px; height: auto; border-radius: 3px; box-shadow: 0 0 0 1px rgba(27, 26, 23, 0.15), 0 2px 6px rgba(27, 26, 23, 0.12); }
.first { font-weight: 600; color: var(--sheet); background: #009c3b; border-radius: 999px; padding: 0.15em 0.7em; letter-spacing: 0.04em; }
/* calligraphy: Machado de Assis's signature, in ink, on the page */
.calligraphy { position: absolute; right: 24px; top: 150px; width: 260px; height: auto; transform: rotate(-6deg); opacity: 0.8; mix-blend-mode: multiply; pointer-events: none; }
.kicker { color: var(--muted); font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase; margin: 0 0 18px; }
.brand { display: flex; align-items: center; gap: clamp(12px, 3vw, 28px); }
.mark { width: clamp(56px, 11vw, 104px); height: auto; flex: none; }
.lede { max-width: 36em; font-size: clamp(1.15rem, 2.6vw, 1.4rem); margin: 1.2em 0 0; }
.jump { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 1.4em 0; font-size: 0.85rem; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 1.4em 0; }
.button, .ghost { font: 600 1rem var(--display); padding: 0.6em 1.3em; border-radius: 999px; text-decoration: none; transition: transform 0.15s ease, box-shadow 0.15s ease; }
.button { background: var(--pen); color: var(--sheet); box-shadow: 0 6px 18px rgba(29, 63, 208, 0.25); }
.button:hover { background: var(--ink); color: var(--sheet); transform: translateY(-1px); }
.ghost { border: 1px solid var(--pen); background: var(--sheet); }
.ghost:hover { transform: translateY(-1px); }
.star { display: inline-flex; align-items: center; gap: 8px; }
/* the Archify pages, named and marked with Archify's icon, beside the GitHub pill */
.figure-pill { font-size: 0.9rem; display: inline-flex; align-items: center; gap: 8px; }
.figure-pill img { width: 20px; height: 18px; }
/* a mark that is a name (Zenodo's, 220 by 80) keeps its proportion */
.figure-pill img.wordmark { width: 55px; height: 20px; }
.count { height: 20px; }
/* made with: the languages, the agents and the local servers, with the owners' icons, on the cover and in the footer */
.made-with { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: 0.95rem; color: var(--muted); margin: 0.6em 0 0; }
.made-with a { display: inline-flex; align-items: center; gap: 6px; padding: 0.25em 0.75em; border: 1px solid var(--rule); border-radius: 999px; background: var(--sheet); color: var(--ink); text-decoration: none; }
.made-with a:hover { border-color: var(--pen); }
.made-with img { width: 18px; height: 18px; }

/* install: the command first, one copy, one paste */
.install { margin: 1.6em 0 0.4em; max-width: 46em; padding: 0; border-top: 0; }
.install-title { font: 600 0.8rem var(--mono); color: var(--review); letter-spacing: 0.08em; text-transform: uppercase; margin: 0 0 8px; }
.install-box { display: flex; align-items: stretch; gap: 0; background: var(--ink); border-radius: 10px; overflow: hidden; box-shadow: 0 6px 18px rgba(27, 26, 23, 0.18); }
.install-box pre { margin: 0; padding: 14px 16px; flex: 1; overflow-x: auto; }
.install-box code { background: none; border: 0; padding: 0; color: var(--sheet); font-size: 0.85rem; white-space: pre; font-variant-ligatures: none; /* `--marketplace`, not a dash */ }
.copy { font: 600 0.85rem var(--mono); border: 0; background: var(--pen); color: var(--sheet); padding: 0 18px; cursor: pointer; }
.copy:hover { background: var(--review); }
.copy:focus-visible { outline: 2px solid var(--sheet); outline-offset: -4px; }
.install-note { color: var(--muted); font-size: 0.9rem; margin: 8px 0 0; }

/* ELI5: the PDFs the plugin generated, one row each */
.eli5 { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.eli5 th, .eli5 td { text-align: left; padding: 8px 10px; border-bottom: 1px dashed var(--rule); vertical-align: baseline; }
.eli5 th { font: 600 0.75rem var(--mono); color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.eli5 .num { font-family: var(--mono); font-size: 0.85em; white-space: nowrap; }
@media (max-width: 560px) { .eli5 .num { white-space: normal; } }

/* the sections */
section { padding: 44px 24px; border-top: 1px solid var(--rule); }
section, .foot { background: transparent; }
.intro { color: var(--muted); margin-top: 0; max-width: 46em; }
.asks { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.levels, .recipes { display: grid; grid-template-columns: max-content 1fr; gap: 12px 22px; align-items: baseline; }
.levels dd, .recipes dd { margin: 0; }
.chip { color: var(--review); border: 1px solid var(--review); border-radius: 999px; padding: 0.1em 0.7em; font-size: 0.85em; background: var(--sheet); }
.chip.todo { border-style: dashed; color: var(--muted); border-color: var(--muted); }
.state { font-size: 0.65em; margin-left: 8px; padding: 0.1em 0.6em; border-radius: 999px; letter-spacing: 0.04em; }
.state.done { background: var(--pen); color: var(--sheet); }
.state.todo { border: 1px dashed var(--muted); color: var(--muted); }
.warn { border-left: 3px solid var(--review); background: var(--sheet); padding: 12px 16px; border-radius: 0 8px 8px 0; font-size: 0.95em; }

/* the rules: one card each, two columns when the page is wide enough */
.rules { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 270px), 1fr)); gap: 10px; }
.rules li { background: var(--sheet); border: 1px solid var(--rule); border-left: 3px solid var(--review); border-radius: 0 8px 8px 0; padding: 10px 12px; font-size: 0.92rem; line-height: 1.45; transition: box-shadow 0.15s ease; }
.rules h3 { font-size: 1rem; margin: 0.1em 0 0.25em; }
.rules li:hover, .rules li:target { box-shadow: 0 8px 24px rgba(27, 26, 23, 0.08); }
.rules p { margin: 0; }
.id { color: var(--review); font-weight: 600; font-size: 0.8em; letter-spacing: 0.04em; }
.from { font-size: 0.74em; line-height: 1.35; color: var(--muted); margin-top: 0.5em !important; padding-top: 0.4em; border-top: 1px dashed var(--rule); }
.origin, .limits { color: var(--muted); font-size: 0.95em; }
.steps { padding-left: 1.4em; }
.steps li { margin: 0.2em 0; }
.awesome { list-style: none; padding: 0; display: grid; gap: 12px; }
.awesome li { padding: 10px 0; border-bottom: 1px dashed var(--rule); }
.source { font-family: var(--mono); font-size: 0.8em; color: var(--muted); }
.roadmap { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 14px; }
.roadmap li { background: var(--sheet); border: 1px solid var(--rule); border-radius: 10px; padding: 14px 16px; }
.roadmap li.todo { border-style: dashed; background: transparent; }
.roadmap p { margin: 0; }
.status { font-size: 0.75em; border-radius: 999px; padding: 0.1em 0.7em; }
.done .status { background: var(--pen); color: var(--sheet); }
.doing .status { border: 1px solid var(--pen); color: var(--pen); }
.todo .status { border: 1px dashed var(--muted); color: var(--muted); }

/* the footer */
.foot { color: var(--muted); padding: 36px 24px 56px; border-top: 3px double var(--rule); font-size: 0.85rem; }
.foot p { margin: 0.5em 0; }
.foot .made-with { font-size: 0.9rem; }
.fork { font-size: 0.85em; }

/* one entrance: the title settles, the review stroke draws, the rest rises */
@media (prefers-reduced-motion: no-preference) {
  .brand { animation: settle 0.8s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
  h1::after { animation: draw 0.6s cubic-bezier(0.65, 0, 0.35, 1) 0.4s both; }
  .lede, .jump, .actions, .cover .made-with { animation: rise 0.6s ease-out 0.6s both; }
}
@keyframes settle { from { opacity: 0; transform: translateY(12px); } }
@keyframes draw { from { transform: rotate(-1.2deg) scaleX(0); } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

/* beside the title only when there is room; otherwise on its own line, under the kicker */
@media (max-width: 1000px) {
  .calligraphy { position: static; display: block; width: min(70%, 300px); margin: 4px 0 8px auto; }
}
@media (max-width: 560px) {
  .cover { padding-top: 40px; }
  .levels, .recipes { grid-template-columns: 1fr; gap: 2px; }
  .levels dd, .recipes dd { margin-bottom: 12px; }
}

.figures { list-style: none; padding: 0; display: grid; gap: 20px; }
.figures img { display: block; max-width: 100%; height: auto; margin-bottom: 6px; border: 1px solid var(--rule); border-radius: 6px; }
.wrap > pre { white-space: pre-wrap; overflow-wrap: anywhere; }

/* The whitepaper, embedded as closed-source's site embeds its paper: the PDF in a frame, with a rule
   above it, and a line for the phones where the frame does not show. */
.preview { display: block; width: 100%; height: min(80vh, 900px); margin: 16px 0 8px; border: 0; border-top: 3px solid var(--ink); background: var(--sheet); }
.sub { color: var(--muted); font-size: 0.9rem; margin: 4px 0 0; }
