/* EFRIS API — design tokens and base styles.
   No framework: the pages must render instantly and stay fully legible to
   crawlers and text-mode agents with CSS disabled. */

:root {
  --bg: #ffffff;
  --bg-soft: #f7f8fa;
  --bg-code: #f4f5f7;
  --border: #e3e6ea;
  --text: #16191d;
  --text-soft: #5a6270;
  --accent: #0b5fff;
  --accent-soft: #e8f0ff;
  --danger: #c0392b;
  --danger-soft: #fdecea;
  --ok: #1a7f4b;
  --ok-soft: #e7f6ee;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  --maxw: 46rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1116;
    --bg-soft: #161a21;
    --bg-code: #12161c;
    --border: #262c36;
    --text: #e6e9ee;
    --text-soft: #99a2b0;
    --accent: #5b9cff;
    --accent-soft: #16233a;
    --danger: #ff7a6b;
    --danger-soft: #2a1714;
    --ok: #55d99b;
    --ok-soft: #10231a;
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.65 var(--sans);
}

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 1.25rem; }
.wide { max-width: 62rem; }

/* --- header ------------------------------------------------------------ */
header.site {
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky; top: 0; z-index: 10;
}
header.site .wrap {
  display: flex; align-items: center; gap: 1.5rem;
  height: 3.5rem;
}
header.site a.brand {
  font-family: var(--mono); font-weight: 600; font-size: 0.95rem;
  color: var(--text); text-decoration: none; letter-spacing: -0.02em;
}
header.site nav { margin-left: auto; display: flex; gap: 1.25rem; }
header.site nav a {
  color: var(--text-soft); text-decoration: none; font-size: 0.9rem;
}
header.site nav a:hover { color: var(--text); }

/* --- type -------------------------------------------------------------- */
h1 { font-size: 2.1rem; line-height: 1.2; letter-spacing: -0.025em; margin: 2.5rem 0 0.75rem; }
h2 { font-size: 1.35rem; line-height: 1.3; letter-spacing: -0.015em; margin: 2.5rem 0 0.75rem;
     padding-top: 0.5rem; }
h3 { font-size: 1.05rem; margin: 1.75rem 0 0.5rem; }
p { margin: 0 0 1rem; }
a { color: var(--accent); }
.lead { font-size: 1.12rem; color: var(--text-soft); }
.muted { color: var(--text-soft); }
small { font-size: 0.85rem; }

code {
  font-family: var(--mono); font-size: 0.875em;
  background: var(--bg-code); border: 1px solid var(--border);
  border-radius: 4px; padding: 0.1em 0.35em;
}
pre {
  background: var(--bg-code); border: 1px solid var(--border);
  border-radius: 8px; padding: 1rem; overflow-x: auto; font-size: 0.85rem;
  line-height: 1.55;
}
pre code { background: none; border: 0; padding: 0; font-size: inherit; }

table { border-collapse: collapse; width: 100%; font-size: 0.92rem; margin: 1rem 0; }
th, td { text-align: left; padding: 0.55rem 0.7rem; border-bottom: 1px solid var(--border); }
th { font-weight: 600; color: var(--text-soft); font-size: 0.82rem;
     text-transform: uppercase; letter-spacing: 0.04em; }
.scroll-x { overflow-x: auto; }

/* --- components -------------------------------------------------------- */
.badge {
  display: inline-block; font-family: var(--mono); font-size: 0.78rem;
  padding: 0.15rem 0.5rem; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent); border: 1px solid transparent;
}
.badge.err { background: var(--danger-soft); color: var(--danger); }
.badge.ok  { background: var(--ok-soft); color: var(--ok); }

.callout {
  border: 1px solid var(--border); border-left: 3px solid var(--accent);
  background: var(--bg-soft); border-radius: 0 8px 8px 0;
  padding: 0.9rem 1rem; margin: 1.25rem 0;
}
.callout.warn { border-left-color: var(--danger); }
.callout p:last-child { margin-bottom: 0; }

.btn {
  display: inline-block; padding: 0.6rem 1.1rem; border-radius: 7px;
  background: var(--accent); color: #fff; text-decoration: none;
  font-weight: 550; font-size: 0.95rem; border: 1px solid transparent;
}
.btn.ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn:hover { opacity: 0.92; }

.grid { display: grid; gap: 1rem; }
@media (min-width: 40rem) { .grid.two { grid-template-columns: 1fr 1fr; } }
@media (min-width: 52rem) { .grid.three { grid-template-columns: repeat(3, 1fr); } }

.card {
  border: 1px solid var(--border); border-radius: 10px; padding: 1.1rem;
  background: var(--bg-soft);
}
.card h3 { margin-top: 0; }
.card p:last-child { margin-bottom: 0; }

.price { font-size: 1.9rem; font-weight: 650; letter-spacing: -0.02em; margin: 0.25rem 0; }
.price small { font-size: 0.85rem; font-weight: 400; color: var(--text-soft); }

ul.clean { list-style: none; padding: 0; }
ul.clean li { padding: 0.3rem 0 0.3rem 1.4rem; position: relative; }
ul.clean li::before {
  content: "→"; position: absolute; left: 0; color: var(--accent); font-family: var(--mono);
}

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

footer.site {
  border-top: 1px solid var(--border); margin-top: 4rem;
  padding: 2rem 0 3rem; color: var(--text-soft); font-size: 0.9rem;
}
footer.site a { color: var(--text-soft); }

/* Error-code index list */
.errlist { display: grid; gap: 0.5rem; margin: 1.5rem 0; }
.errlist a {
  display: flex; gap: 0.85rem; align-items: baseline;
  border: 1px solid var(--border); border-radius: 8px; padding: 0.7rem 0.9rem;
  text-decoration: none; color: var(--text); background: var(--bg-soft);
}
.errlist a:hover { border-color: var(--accent); }
.errlist .code { font-family: var(--mono); font-weight: 600; color: var(--danger); min-width: 3.2rem; }
.errlist .desc { color: var(--text-soft); font-size: 0.93rem; }

:target { scroll-margin-top: 4.5rem; }
