/* ============================================================================
   DCA Onchain - documentation site
   Design system ported from the app landing (neo-brutalist white): pure-white
   ground, true-black ink, electric violet primary, acid lime + coral accents,
   2.5px ink borders and hard offset shadows. Tuned for reading, not selling -
   calm hierarchy, comfortable body type, accents used as signals.

   Fonts (Archivo display + Space Mono labels) load from Google Fonts to match
   the app; both fall back to system stacks, so pages still render offline.
   ============================================================================ */

@import url("https://fonts.googleapis.com/css2?family=Archivo:wght@600;700;800;900&family=Space+Mono:wght@400;700&display=swap");

:root {
  /* Brand palette - one source of truth, mirrors the app's design tokens. */
  --ground:   #ffffff;   /* pure-white ground + cards */
  --ink:      #0d0d0d;   /* true black text + borders */
  --ink-soft: #333333;   /* body-secondary */
  --ink-faint:#6b6b6b;   /* captions, meta */
  --violet:   #5b3df5;   /* electric primary */
  --lime:     #c6ff3a;   /* acid highlight */
  --coral:    #ff5436;   /* hot accent (marks, links hover) */
  --cyan:     #7fe7e7;   /* cool tint */
  --sun:      #ffce47;   /* warm tint */
  --good:     #12b76a;   /* success green */
  --bad:      #f03d3d;   /* failure red */

  /* Callout accents keyed to the palette. */
  --red:    #d23a28;  --red-bg:    #fdeeeb;
  --amber:  #a86e12;  --amber-bg:  #fff5db;
  --green:  #0f9d63;  --green-bg:  #e8faf1;
  --blue:   var(--violet);  --blue-bg: #efecff;

  --mono:  "Space Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --sans:  system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --display: "Archivo", var(--sans);

  --bd:    2.5px solid var(--ink);   /* structural boxes */
  --hair:  1px solid rgba(13, 13, 13, 0.14); /* internal hairlines */
  --shadow:    5px 5px 0 var(--ink);
  --shadow-sm: 3px 3px 0 var(--ink);

  --maxw: 50rem;
  --sidebar-w: 17rem;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; overflow-x: hidden; }

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--ground);
  line-height: 1.65;
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ----- Layout ------------------------------------------------------------ */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--ground);
  color: var(--ink);
  position: sticky;
  top: 0;
  align-self: flex-start;
  height: 100vh;
  overflow-y: auto;
  padding: 1.7rem 1.35rem 3rem;
  border-right: var(--bd);
}

/* Brand: violet tile logo + wordmark + tagline, mirroring the app header. The
   tile is the real vector asset (logo-tile.svg, which bakes in the ink border,
   hard shadow, and -3deg tilt), drawn as a pseudo-element so the shared page
   markup stays untouched across every doc page. */
.brand {
  position: relative;
  display: block;
  text-decoration: none;
  padding-left: 54px;
  min-height: 40px;
  margin-bottom: 1.9rem;
}
.brand::before {
  content: "";
  position: absolute;
  left: -5px;
  top: -4px;
  width: 54px;
  height: 48px;
  background: url("/logo/logo-tile.svg") center/contain no-repeat;
}
.brand .mark {
  display: block;
  font-family: var(--mono);
  font-size: 1.02rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--ink);
  line-height: 1.15;
}
.brand .tag {
  display: block;
  font-family: var(--mono);
  font-size: 0.64rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--violet);
  margin-top: 0.3rem;
  font-weight: 700;
}

.nav-group { margin: 1.4rem 0 0; }
.nav-group h4 {
  font-family: var(--mono);
  font-size: 0.64rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-faint);
  margin: 0 0 0.55rem;
  font-weight: 700;
}
.sidebar nav a {
  display: block;
  color: var(--ink);
  text-decoration: none;
  padding: 0.34rem 0.6rem;
  font-family: var(--mono);
  font-size: 0.86rem;
  margin: 0.12rem 0;
  border: 2px solid transparent;
  transition: background 0.1s, color 0.1s, border-color 0.1s;
}
.sidebar nav a:hover { background: var(--lime); border-color: var(--ink); }
.sidebar nav a.active {
  background: var(--violet);
  color: #fff;
  border-color: var(--ink);
  font-weight: 700;
  box-shadow: var(--shadow-sm);
}

.content {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  justify-content: center;
  padding: 3.2rem 2.4rem 6rem;
}
.content > article { width: 100%; max-width: var(--maxw); }

/* ----- Header / mobile --------------------------------------------------- */
.topbar { display: none; }

/* ----- Typography -------------------------------------------------------- */
h1, h2, h3, h4 { color: var(--ink); }
h1 {
  font-family: var(--display);
  font-weight: 900;
  font-size: 2.5rem;
  line-height: 1.02;
  letter-spacing: -0.015em;
  text-transform: uppercase;
  margin: 0 0 0.5rem;
}
.eyebrow {
  display: inline-block;
  margin: 0 0 0.85rem;
  background: var(--ink);
  color: var(--ground);
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 5px 10px;
}
.subtitle {
  font-size: 1.12rem;
  color: var(--ink-soft);
  margin: 0 0 2rem;
  line-height: 1.5;
}
h2 {
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.5rem;
  line-height: 1.1;
  letter-spacing: -0.005em;
  text-transform: uppercase;
  margin: 3rem 0 0.9rem;
  padding-top: 1.5rem;
  border-top: var(--bd);
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
h2::before {
  content: "";
  width: 13px;
  height: 13px;
  background: var(--violet);
  border: 2px solid var(--ink);
  flex-shrink: 0;
}
h2:first-of-type { border-top: none; padding-top: 0; }
h3 {
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.2rem;
  line-height: 1.2;
  margin: 1.9rem 0 0.6rem;
}
h4 {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 0.92rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 1.4rem 0 0.5rem;
  color: var(--ink-soft);
}

p { margin: 0.85rem 0; }
a {
  color: var(--violet);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 2px;
}
a:hover { color: var(--coral); }

strong { font-weight: 700; }
ul, ol { padding-left: 1.3rem; }
li { margin: 0.35rem 0; }
li::marker { color: var(--violet); }

hr { border: none; border-top: var(--bd); margin: 2.5rem 0; }

/* ----- Code -------------------------------------------------------------- */
code {
  font-family: var(--mono);
  font-size: 0.82em;
  background: rgba(91, 61, 245, 0.08);
  padding: 0.12em 0.4em;
  border: 1px solid rgba(13, 13, 13, 0.18);
  word-break: break-word;
}
pre {
  background: var(--ink);
  color: #e9e9e9;
  padding: 1.1rem 1.25rem;
  border: var(--bd);
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 0.84rem;
  line-height: 1.55;
  margin: 1.3rem 0;
}
pre code {
  background: none;
  border: none;
  padding: 0;
  color: inherit;
  font-size: inherit;
}
.addr { font-family: var(--mono); font-size: 0.8em; white-space: nowrap; }

/* ----- TL;DR / summary callout (plain-language layer) -------------------- */
.tldr {
  background: var(--ground);
  border: var(--bd);
  box-shadow: 5px 5px 0 var(--lime);
  padding: 1.15rem 1.35rem;
  margin: 1.3rem 0 1.7rem;
}
.tldr p { margin: 0.4rem 0; }
.tldr p:first-child { margin-top: 0; }
.tldr p:last-child { margin-bottom: 0; }
.tldr .label {
  display: inline-block;
  background: var(--ink);
  color: var(--ground);
  font-family: var(--mono);
  font-size: 0.64rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 700;
  padding: 4px 9px;
  margin-bottom: 0.7rem;
}

/* ----- Callouts ---------------------------------------------------------- */
.note, .warn, .crit, .info {
  padding: 0.9rem 1.2rem;
  margin: 1.2rem 0;
  border: 2px solid var(--ink);
  border-left-width: 6px;
  box-shadow: var(--shadow-sm);
  font-size: 0.95rem;
  background: var(--ground);
}
.note { border-left-color: var(--green); background: var(--green-bg); }
.info { border-left-color: var(--violet); background: var(--blue-bg); }
.warn { border-left-color: var(--amber); background: var(--amber-bg); }
.crit { border-left-color: var(--red); background: var(--red-bg); }
.note .h, .warn .h, .crit .h, .info .h {
  font-family: var(--mono);
  font-weight: 700;
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.note .h { color: var(--green); }
.info .h { color: var(--violet); }
.warn .h { color: var(--amber); }
.crit .h { color: var(--red); }

/* ----- Badges ------------------------------------------------------------ */
.badge {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.18em 0.6em;
  border: 2px solid var(--ink);
  vertical-align: middle;
  white-space: nowrap;
}
.badge.pass    { background: var(--lime);  color: var(--ink); }
.badge.blocked { background: var(--coral); color: #fff; }
.badge.hold    { background: var(--sun);   color: var(--ink); }
.badge.partial { background: var(--cyan);  color: var(--ink); }
.badge.neutral { background: var(--ground); color: var(--ink-soft); }

/* ----- Tables ------------------------------------------------------------ */
.table-wrap {
  overflow-x: auto;
  margin: 1.3rem 0;
  border: var(--bd);
  box-shadow: var(--shadow-sm);
}
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.92rem;
}
th, td {
  text-align: left;
  padding: 0.62rem 0.85rem;
  border-bottom: var(--hair);
  vertical-align: top;
}
th {
  font-family: var(--mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ground);
  background: var(--ink);
  font-weight: 700;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(91, 61, 245, 0.05); }
td code { font-size: 0.82em; }

/* ----- Cards (index landing) --------------------------------------------- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: 1rem;
  margin: 1.6rem 0;
}
.card {
  display: block;
  text-decoration: none;
  color: inherit;
  background: var(--ground);
  border: var(--bd);
  box-shadow: var(--shadow-sm);
  padding: 1.15rem 1.25rem;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.card:hover {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 var(--violet);
}
.card h3 { margin: 0.15rem 0 0.3rem; font-size: 1.05rem; font-family: var(--display); font-weight: 800; }
.card p { margin: 0; font-size: 0.9rem; color: var(--ink-soft); }
.card .kicker {
  font-family: var(--mono);
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--coral);
  font-weight: 700;
}

/* ----- Diagrams (ASCII / pre-based) -------------------------------------- */
.diagram {
  background: var(--ground);
  border: var(--bd);
  box-shadow: var(--shadow-sm);
  padding: 1.2rem;
  margin: 1.4rem 0;
  overflow-x: auto;
}
.diagram pre {
  background: none;
  color: var(--ink);
  border: none;
  box-shadow: none;
  padding: 0;
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.4;
}
.caption {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--ink-faint);
  margin-top: 0.7rem;
  letter-spacing: 0.02em;
}

/* ----- Collapsible detail ------------------------------------------------ */
details {
  border: 2px solid var(--ink);
  box-shadow: var(--shadow-sm);
  padding: 0.4rem 1.15rem;
  margin: 1.1rem 0;
  background: var(--ground);
}
details[open] { padding-bottom: 0.9rem; }
summary {
  cursor: pointer;
  font-family: var(--mono);
  font-weight: 700;
  padding: 0.55rem 0;
  list-style: none;
  color: var(--ink);
}
summary::-webkit-details-marker { display: none; }
summary::before { content: "+ "; color: var(--coral); font-weight: 700; }
details[open] summary::before { content: "\2212  "; }

/* ----- Definition list --------------------------------------------------- */
dl { margin: 1.1rem 0; }
dt {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 0.92rem;
  margin-top: 1rem;
  color: var(--ink);
}
dd { margin: 0.2rem 0 0 0; color: var(--ink-soft); }

/* ----- Footer ------------------------------------------------------------ */
.docfoot {
  margin-top: 4rem;
  padding-top: 1.4rem;
  border-top: var(--bd);
  font-family: var(--mono);
  font-size: 0.76rem;
  color: var(--ink-faint);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.docfoot a { color: var(--ink-faint); }
.docfoot a:hover { color: var(--violet); }

/* ----- Pill row / meta --------------------------------------------------- */
.meta-row { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0 0 1.7rem; }
.pill {
  font-family: var(--mono);
  font-size: 0.72rem;
  background: var(--ground);
  border: 2px solid var(--ink);
  padding: 0.24em 0.7em;
  color: var(--ink-soft);
}
.pill strong { color: var(--ink); }

/* ----- Mobile ------------------------------------------------------------ */
.menu-toggle { display: none; }

@media (max-width: 860px) {
  .layout { flex-direction: column; }
  .sidebar {
    position: static;
    width: 100%;
    height: auto;
    flex-basis: auto;
    padding: 1.1rem 1.25rem;
    border-right: none;
    border-bottom: var(--bd);
  }
  .sidebar nav { display: none; margin-top: 0.8rem; }
  .sidebar nav.open { display: block; }
  .topbar { display: flex; margin-top: 0.9rem; }
  .menu-toggle {
    display: inline-block;
    background: var(--lime);
    color: var(--ink);
    border: var(--bd);
    box-shadow: var(--shadow-sm);
    font-family: var(--mono);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.4rem 0.85rem;
    font-size: 0.8rem;
    cursor: pointer;
  }
  .content { padding: 1.8rem 1.2rem 4rem; }
  h1 { font-size: 1.95rem; }
  body { font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .card { transition: none; }
}
