/* =========================================================================
   Mercado Público MCP — shared design system
   "Civic gazette meets terminal": ink ground, parchment ink, treasury gold.
   ========================================================================= */

:root {
  --bg:        #0a0c10;
  --bg-2:      #0d1015;
  --surface:   #13161d;
  --surface-2: #171b23;
  --text:      #ece6d8;
  --muted:     #9096a2;
  --faint:     #5b616d;
  --gold:      #e3a838;
  --gold-soft: #f2cd83;
  --clay:      #c2492f;
  --green:     #7fae5e;
  --line:        rgba(236, 230, 216, 0.10);
  --line-strong: rgba(236, 230, 216, 0.20);
  --shadow:    0 24px 60px -20px rgba(0, 0, 0, 0.7);
  --maxw: 1080px;
  --ff-display: "Fraunces", Georgia, serif;
  --ff-body: "Hanken Grotesk", system-ui, sans-serif;
  --ff-mono: "JetBrains Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--ff-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  position: relative;
}

/* Background atmosphere: gold dawn glow + faint civic grid + grain. */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: -2;
  background:
    radial-gradient(1100px 620px at 78% -8%, rgba(227, 168, 56, 0.13), transparent 60%),
    radial-gradient(900px 600px at 8% 0%, rgba(194, 73, 47, 0.08), transparent 55%),
    linear-gradient(180deg, var(--bg-2), var(--bg) 38%);
  background-attachment: fixed;
}
body::after {
  content: "";
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 28px; }

a { color: var(--gold-soft); text-decoration: none; }
a:hover { color: var(--gold); }

::selection { background: rgba(227, 168, 56, 0.28); color: #fff; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(14px);
  background: linear-gradient(180deg, rgba(10, 12, 16, 0.85), rgba(10, 12, 16, 0.55));
  border-bottom: 1px solid var(--line);
}
.site-header .wrap {
  display: flex; align-items: center; justify-content: space-between;
  height: 66px;
}
.brand {
  display: flex; align-items: center; gap: 11px;
  font-family: var(--ff-mono); font-size: 13px; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--text); font-weight: 500;
}
.brand .seal {
  width: 26px; height: 26px; border-radius: 50%;
  border: 1.5px solid var(--gold);
  display: grid; place-items: center;
  color: var(--gold); font-family: var(--ff-display); font-size: 14px;
  font-weight: 600; font-style: italic;
  box-shadow: inset 0 0 0 3px rgba(227, 168, 56, 0.12);
}
.brand b { color: var(--gold); font-weight: 600; }
.nav { display: flex; align-items: center; gap: 28px; }
.nav a {
  font-size: 14px; color: var(--muted); letter-spacing: 0.01em;
  font-weight: 500; transition: color 0.2s;
}
.nav a:hover { color: var(--text); }
.nav-cta {
  font-family: var(--ff-mono); font-size: 12.5px;
  padding: 8px 14px; border: 1px solid var(--line-strong);
  border-radius: 7px; color: var(--text) !important;
  transition: border-color 0.2s, background 0.2s;
}
.nav-cta:hover { border-color: var(--gold); background: rgba(227, 168, 56, 0.08); }
@media (max-width: 720px) { .nav a:not(.nav-cta) { display: none; } }

/* ---------- Typography ---------- */
.kicker {
  font-family: var(--ff-mono); font-size: 12px; letter-spacing: 0.22em;
  text-transform: uppercase; color: var(--gold);
  display: inline-flex; align-items: center; gap: 9px;
}
.kicker::before {
  content: ""; width: 26px; height: 1px; background: var(--gold); opacity: 0.7;
}
h1, h2, h3 { font-family: var(--ff-display); font-weight: 500; line-height: 1.08; letter-spacing: -0.01em; }
.section { padding: 92px 0; border-top: 1px solid var(--line); }
.section-head { max-width: 640px; margin-bottom: 52px; }
.section-head h2 { font-size: clamp(30px, 4.4vw, 44px); margin: 18px 0 14px; }
.section-head p { color: var(--muted); font-size: 17px; }

/* ---------- Hero ---------- */
.hero { padding: 96px 0 84px; position: relative; }
.hero h1 {
  font-size: clamp(44px, 7.4vw, 86px); margin: 24px 0 22px;
  letter-spacing: -0.025em;
}
.hero h1 em { font-style: italic; color: var(--gold); }
.hero .lede {
  font-size: clamp(18px, 2.3vw, 22px); color: var(--muted);
  max-width: 620px; line-height: 1.5;
}
.hero-stats { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 34px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--ff-mono); font-size: 12.5px; color: var(--muted);
  padding: 7px 13px; border: 1px solid var(--line);
  border-radius: 100px; background: rgba(255, 255, 255, 0.015);
}
.chip .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 10px var(--green); }

/* ---------- Endpoint terminal card ---------- */
.endpoint {
  margin-top: 44px; max-width: 660px;
  background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: 13px; overflow: hidden; box-shadow: var(--shadow);
}
.endpoint .bar {
  display: flex; align-items: center; gap: 8px;
  padding: 11px 15px; border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.018);
}
.endpoint .bar i { width: 11px; height: 11px; border-radius: 50%; background: #2a2f38; display: inline-block; }
.endpoint .bar i:nth-child(1) { background: var(--clay); }
.endpoint .bar i:nth-child(2) { background: var(--gold); }
.endpoint .bar i:nth-child(3) { background: var(--green); }
.endpoint .bar span {
  margin-left: 8px; font-family: var(--ff-mono); font-size: 11.5px;
  color: var(--faint); letter-spacing: 0.05em;
}
.endpoint .row {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 18px 18px;
}
.endpoint .url {
  font-family: var(--ff-mono); font-size: 15px; color: var(--text);
  word-break: break-all;
}
.endpoint .url .mt { color: var(--gold); }
.copy {
  flex-shrink: 0; cursor: pointer; border: 1px solid var(--line-strong);
  background: transparent; color: var(--text); font-family: var(--ff-mono);
  font-size: 12px; padding: 8px 12px; border-radius: 7px;
  transition: all 0.18s; letter-spacing: 0.04em;
}
.copy:hover { border-color: var(--gold); background: rgba(227, 168, 56, 0.1); color: var(--gold-soft); }
.copy.done { border-color: var(--green); color: var(--green); }

/* ---------- Tool cards ---------- */
.tools { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
@media (max-width: 760px) { .tools { grid-template-columns: 1fr; } }
.tool {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 13px; padding: 28px; position: relative;
  transition: border-color 0.25s, transform 0.25s;
}
.tool:hover { border-color: var(--line-strong); transform: translateY(-3px); }
.tool .tag {
  position: absolute; top: 22px; right: 22px;
  font-family: var(--ff-mono); font-size: 10.5px; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--faint);
  border: 1px solid var(--line); border-radius: 5px; padding: 3px 8px;
}
.tool h3 { font-size: 23px; margin-bottom: 4px; }
.tool .sig {
  font-family: var(--ff-mono); font-size: 13px; color: var(--gold-soft);
  margin: 14px 0 16px; padding: 12px 14px; background: var(--bg);
  border: 1px solid var(--line); border-radius: 8px; line-height: 1.7;
  overflow-x: auto;
}
.tool p { color: var(--muted); font-size: 15.5px; }
.tool .params { list-style: none; margin-top: 18px; display: grid; gap: 9px; }
.tool .params li { display: flex; gap: 12px; font-size: 14.5px; align-items: baseline; }
.tool .params code {
  font-family: var(--ff-mono); font-size: 13px; color: var(--text);
  background: var(--bg-2); border: 1px solid var(--line);
  padding: 2px 7px; border-radius: 5px; white-space: nowrap; flex-shrink: 0;
}
.tool .params span { color: var(--muted); }
.tool .returns {
  margin-top: 20px; padding-top: 18px; border-top: 1px dashed var(--line);
  font-size: 14px; color: var(--muted);
}
.tool .returns b { color: var(--text); font-family: var(--ff-mono); font-size: 12.5px; font-weight: 500; }

/* ---------- Integration ---------- */
.integrate { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
@media (max-width: 760px) { .integrate { grid-template-columns: 1fr; } }
.guide {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 13px; padding: 30px;
}
.guide .gh { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.guide .gh .badge {
  width: 38px; height: 38px; border-radius: 9px; display: grid; place-items: center;
  background: rgba(227, 168, 56, 0.1); border: 1px solid var(--line-strong);
  font-family: var(--ff-display); font-style: italic; color: var(--gold); font-size: 19px;
}
.guide .gh h3 { font-size: 21px; }
.guide .gh small { display: block; font-family: var(--ff-mono); font-size: 11px; color: var(--faint); letter-spacing: 0.08em; text-transform: uppercase; }
.steps { list-style: none; counter-reset: s; display: grid; gap: 16px; }
.steps li { counter-increment: s; padding-left: 38px; position: relative; font-size: 15px; color: var(--muted); }
.steps li::before {
  content: counter(s); position: absolute; left: 0; top: -1px;
  width: 25px; height: 25px; border-radius: 50%;
  border: 1px solid var(--line-strong); color: var(--gold);
  font-family: var(--ff-mono); font-size: 12px; display: grid; place-items: center;
}
.steps li b { color: var(--text); font-weight: 600; }
.steps code, .inline-code {
  font-family: var(--ff-mono); font-size: 12.5px; color: var(--gold-soft);
  background: var(--bg); border: 1px solid var(--line); padding: 1px 6px; border-radius: 4px;
  word-break: break-all;
}

/* ---------- Auth callout ---------- */
.callout {
  margin-top: 26px; display: flex; gap: 15px;
  background: linear-gradient(180deg, rgba(194, 73, 47, 0.08), rgba(194, 73, 47, 0.03));
  border: 1px solid rgba(194, 73, 47, 0.3); border-radius: 12px; padding: 20px 22px;
}
.callout .ic { color: var(--clay); font-size: 20px; flex-shrink: 0; line-height: 1.3; }
.callout p { font-size: 14.5px; color: var(--muted); }
.callout b { color: var(--text); }
.callout code {
  font-family: var(--ff-mono); font-size: 12.5px; color: var(--gold-soft);
  background: var(--bg); padding: 2px 6px; border-radius: 4px; border: 1px solid var(--line);
}

/* ---------- Example prompts ---------- */
.prompts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
@media (max-width: 680px) { .prompts { grid-template-columns: 1fr; } }
.prompt {
  background: var(--surface); border: 1px solid var(--line); border-radius: 11px;
  padding: 18px 20px; display: flex; gap: 13px; align-items: flex-start;
  transition: border-color 0.2s, background 0.2s;
}
.prompt:hover { border-color: var(--line-strong); background: var(--surface-2); }
.prompt .q { color: var(--gold); font-family: var(--ff-display); font-style: italic; font-size: 20px; flex-shrink: 0; line-height: 1.2; }
.prompt p { font-size: 15px; color: var(--text); }
.prompt p span { display: block; color: var(--faint); font-size: 12.5px; font-family: var(--ff-mono); margin-top: 5px; }

/* ---------- FAQ ---------- */
.faq { max-width: 800px; }
.faq details {
  border-bottom: 1px solid var(--line); padding: 4px 0;
}
.faq summary {
  cursor: pointer; list-style: none; padding: 22px 44px 22px 0; position: relative;
  font-family: var(--ff-display); font-size: 20px; color: var(--text);
  transition: color 0.2s;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary:hover { color: var(--gold-soft); }
.faq summary::after {
  content: "+"; position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  font-family: var(--ff-mono); font-size: 22px; color: var(--gold); transition: transform 0.25s;
}
.faq details[open] summary::after { transform: translateY(-50%) rotate(45deg); }
.faq details > div { padding: 0 44px 24px 0; color: var(--muted); font-size: 15.5px; animation: fade 0.4s ease; }
.faq details > div code { font-family: var(--ff-mono); font-size: 13px; color: var(--gold-soft); }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding: 56px 0 40px; margin-top: 30px; }
.site-footer .grid { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 30px; }
.site-footer .brand { margin-bottom: 14px; }
.site-footer p { color: var(--faint); font-size: 13.5px; max-width: 340px; }
.site-footer .links { display: flex; gap: 26px; flex-wrap: wrap; }
.site-footer .links a { color: var(--muted); font-size: 14px; }
.site-footer .links a:hover { color: var(--gold); }
.site-footer .legal-line {
  margin-top: 40px; padding-top: 22px; border-top: 1px solid var(--line);
  font-family: var(--ff-mono); font-size: 12px; color: var(--faint);
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px;
}

/* ---------- Document pages (legal / privacy) ---------- */
.doc { padding: 64px 0 40px; max-width: 760px; }
.crumb { font-family: var(--ff-mono); font-size: 12.5px; color: var(--faint); margin-bottom: 30px; letter-spacing: 0.04em; }
.crumb a { color: var(--muted); }
.doc h1 { font-size: clamp(34px, 5vw, 52px); margin-bottom: 14px; }
.doc .meta {
  font-family: var(--ff-mono); font-size: 12.5px; color: var(--faint);
  border-bottom: 1px solid var(--line); padding-bottom: 26px; margin-bottom: 14px;
  line-height: 1.9;
}
.doc .summary {
  background: var(--surface); border: 1px solid var(--line); border-left: 2px solid var(--gold);
  border-radius: 10px; padding: 20px 24px; margin: 28px 0 12px; color: var(--muted); font-size: 15px;
}
.doc .summary b { color: var(--text); }
.doc section { margin-top: 38px; }
.doc h2 { font-size: 23px; margin-bottom: 14px; display: flex; gap: 12px; align-items: baseline; }
.doc h2 .n { font-family: var(--ff-mono); font-size: 14px; color: var(--gold); flex-shrink: 0; }
.doc p { color: var(--muted); font-size: 15.5px; margin-bottom: 12px; }
.doc p b, .doc li b { color: var(--text); }
.doc ul { margin: 12px 0 12px 4px; padding-left: 22px; color: var(--muted); font-size: 15.5px; }
.doc ul li { margin-bottom: 8px; }
.doc table { width: 100%; border-collapse: collapse; margin: 16px 0; font-size: 14px; }
.doc th, .doc td { text-align: left; padding: 11px 14px; border: 1px solid var(--line); vertical-align: top; }
.doc th { background: var(--surface); font-family: var(--ff-mono); font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-weight: 500; }
.doc td code { font-family: var(--ff-mono); font-size: 12.5px; color: var(--gold-soft); }
.doc .back { display: inline-block; margin-top: 44px; font-family: var(--ff-mono); font-size: 13px; }

/* ---------- Cookie consent banner ---------- */
.cookie-banner {
  position: fixed; left: 50%; bottom: 20px; transform: translate(-50%, 160%);
  width: calc(100% - 36px); max-width: 660px; z-index: 200;
  background: var(--surface-2); border: 1px solid var(--line-strong); border-radius: 14px;
  box-shadow: var(--shadow); padding: 18px 20px; display: flex; gap: 18px; align-items: center;
  flex-wrap: wrap; transition: transform 0.45s cubic-bezier(.2,.8,.2,1);
}
.cookie-banner.show { transform: translate(-50%, 0); }
.cookie-banner p { font-size: 13.5px; color: var(--muted); flex: 1 1 300px; line-height: 1.55; }
.cookie-banner a { color: var(--gold-soft); }
.cookie-actions { display: flex; gap: 10px; flex-shrink: 0; }
.cookie-banner button {
  cursor: pointer; font-family: var(--ff-body); font-size: 13.5px; font-weight: 600;
  padding: 10px 20px; border-radius: 8px; border: 1px solid var(--line-strong);
  background: transparent; color: var(--text); transition: all 0.18s; white-space: nowrap;
}
.cookie-banner .ck-reject:hover { border-color: var(--muted); color: var(--text); }
.cookie-banner .ck-accept { background: var(--gold); border-color: var(--gold); color: #1a1206; }
.cookie-banner .ck-accept:hover { background: var(--gold-soft); }
@media (max-width: 520px) {
  .cookie-actions { width: 100%; }
  .cookie-banner button { flex: 1; }
}

/* ---------- Reveal animation ---------- */
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.reveal { opacity: 0; animation: fade 0.7s ease forwards; }
.d1 { animation-delay: 0.05s; } .d2 { animation-delay: 0.15s; }
.d3 { animation-delay: 0.25s; } .d4 { animation-delay: 0.35s; } .d5 { animation-delay: 0.45s; }
@media (prefers-reduced-motion: reduce) { .reveal { animation: none; opacity: 1; } html { scroll-behavior: auto; } }
