/* docs.omniarc.eu — stylesheet.
   The palette, the AA text colours and the font stacks are site/public/style.css's,
   so the docs and the landing site are one brand. Same rules as there: nothing
   imported, nothing loaded from another origin, no web fonts. System stacks only.
   crates/omniarc-docs/tests/site_build.rs holds the built site to that. */

:root {
  --ink: #0b0b0b;
  --paper: #fcfcfb;
  --blue: #2a78d6;
  --orange: #eb6834;
  /* Text-only: --orange is 3.12:1 on paper, under AA for body copy. 5.04:1. */
  --orange-ink: #c2410c;
  /* 4.5:1 on paper; the deck's #8a8983 is not (site/public/style.css). */
  --muted: #6b6a63;
  --ink-2: #52514e;
  --rule: #dcdbd6;
  /* Text-only: --blue is 4.30:1 on paper, under AA; this is 5.67:1. */
  --link: #2166b3;
  --term-bg: #13161b;
  --term-ink: #e6e6e3;
  --term-dim: #9a9a97;

  --sans: ui-sans-serif, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;

  /* The docs' own. The code colours are the ones highlight/omniarc.json gives
     the highlighter, so the panel and the code blocks in the prose agree. */
  --code-key: #7fb2f0;
  --code-mark: #24303f;
  --code-rule: #262a30;
  --tint: #eef4fc;
  --inline-code: #f1f0ec;
  --field: #ffffff;
  --banner: #fdf0ea;
  --topbar-h: 3.6rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --orange-ink: #eb6834; /* 5.91:1 on the dark paper */
    --paper: #0e1116;
    --ink: #fcfcfb;
    --blue: #4d9bf0;
    --rule: #262a30;
    --muted: #9a9a97;
    --ink-2: #c9c9c6;
    /* Dark --blue clears AA for text (6.54:1) on this paper. */
    --link: var(--blue);
    --term-bg: #05070a;
    --code-mark: #1c2633;
    --code-rule: #1b1f25;
    --tint: #15253a;
    --inline-code: #1a1e24;
    --field: #171b21;
    --banner: #2a1a12;
  }
}

* {
  box-sizing: border-box;
}

html {
  background: var(--paper);
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img,
svg {
  max-width: 100%;
  height: auto;
}

a,
a:visited {
  color: var(--link);
}

:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

code,
kbd,
pre {
  font-family: var(--mono);
}

h1,
h2,
h3 {
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip {
  position: absolute;
  left: 0.5rem;
  top: -3rem;
  z-index: 20;
  padding: 0.4rem 0.8rem;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 4px;
}

.skip:focus {
  top: 0.5rem;
}

.mono {
  font-family: var(--mono);
  letter-spacing: 0;
}

/* ---------- top bar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  min-height: var(--topbar-h);
  padding: 0.55rem 1.25rem;
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
}

/* No gap: the lockup's own box already ends in clear space after the
   wordmark, and that is the gap before "docs". */
.brand {
  display: flex;
  align-items: center;
  gap: 0;
  flex: none;
  text-decoration: none;
}

.brand img {
  display: block;
  width: 141px;
}

.brand-docs {
  color: var(--muted);
  font-size: 1.05rem;
  font-weight: 600;
  padding-left: 0.55rem;
  border-left: 1px solid var(--rule);
  line-height: 1.2;
}

.search {
  position: relative;
  flex: 1 1 auto;
  max-width: 30rem;
}

.search input {
  width: 100%;
  padding: 0.42rem 3rem 0.42rem 0.75rem;
  font: inherit;
  font-size: 0.95rem;
  color: var(--ink);
  background: var(--field);
  border: 1px solid var(--rule);
  border-radius: 6px;
}

.search input::placeholder {
  color: var(--muted);
}

.kbd {
  position: absolute;
  right: 0.55rem;
  top: 50%;
  transform: translateY(-50%);
  padding: 0 0.35rem;
  font-size: 0.72rem;
  color: var(--muted);
  border: 1px solid var(--rule);
  border-radius: 4px;
  pointer-events: none;
}

.tabs {
  display: flex;
  gap: 1.4rem;
  margin-left: auto;
}

.tabs a,
.tabs a:visited,
.to-nav,
.to-nav:visited {
  color: var(--ink-2);
  text-decoration: none;
  font-size: 0.95rem;
  padding-block: 0.2rem;
  border-bottom: 2px solid transparent;
}

.tabs a:hover {
  color: var(--ink);
}

.tabs a[aria-current] {
  color: var(--link);
  font-weight: 600;
  border-bottom-color: var(--blue);
}

.to-nav {
  display: none;
}

/* The landing page has its own, bigger search box. */
.landing .topbar .search {
  visibility: hidden;
}

/* ---------- three columns ---------- */

.layout {
  display: grid;
  grid-template-columns: 15rem minmax(0, 1fr);
  grid-template-areas: "nav main";
  align-items: start;
}

.layout.has-panel {
  grid-template-columns: 15rem minmax(0, 1fr) minmax(0, 34rem);
  grid-template-areas: "nav main panel";
  align-items: stretch;
}

.nav {
  grid-area: nav;
  position: sticky;
  top: var(--topbar-h);
  max-height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  padding: 1.1rem 0.9rem 2rem;
  border-right: 1px solid var(--rule);
  font-size: 0.9rem;
  align-self: start;
}

.nav-h {
  margin: 1.1rem 0 0.3rem 0.5rem;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.nav-h:first-child {
  margin-top: 0.2rem;
}

.nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav ul ul {
  margin: 0.15rem 0 0.4rem 0.6rem;
  padding-left: 0.4rem;
  border-left: 1px solid var(--rule);
  font-size: 0.85rem;
}

.nav a,
.nav a:visited {
  display: block;
  padding: 0.14rem 0.5rem;
  color: var(--ink-2);
  text-decoration: none;
  border-radius: 4px;
  overflow-wrap: anywhere;
}

.nav a.mono {
  font-size: 0.86em;
}

.nav a:hover {
  color: var(--ink);
  background: var(--inline-code);
}

.nav a[aria-current="page"] {
  color: var(--link);
  font-weight: 600;
  background: var(--tint);
}

.main {
  grid-area: main;
  min-width: 0;
  padding: 1.6rem 2.5rem 3.5rem;
}

.crumbs {
  margin: 0 0 0.4rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.crumbs a,
.crumbs a:visited {
  color: var(--muted);
  text-decoration: none;
}

.crumbs a:hover {
  color: var(--link);
  text-decoration: underline;
}

.main h1 {
  font-size: 2rem;
  margin: 0 0 0.35rem;
}

.stamp {
  margin: 0 0 1.4rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.banner {
  margin: 0.4rem 0 1.4rem;
  padding: 0.7rem 1rem;
  background: var(--banner);
  border-left: 3px solid var(--orange);
  border-radius: 4px;
  max-width: 46rem;
}

/* ---------- prose ---------- */

.prose {
  max-width: 46rem;
}

.prose > :first-child {
  margin-top: 0;
}

.prose h2 {
  font-size: 1.3rem;
  margin: 2.4rem 0 0.7rem;
}

.prose h3 {
  font-size: 1.08rem;
  margin: 1.8rem 0 0.5rem;
}

.prose h2,
.prose h3 {
  position: relative;
  scroll-margin-top: calc(var(--topbar-h) + 1rem);
}

.anchor,
.anchor:visited {
  position: absolute;
  left: -1.1em;
  width: 1.1em;
  color: var(--muted);
  text-decoration: none;
  opacity: 0;
}

.prose h2:hover .anchor,
.prose h3:hover .anchor,
.anchor:focus-visible {
  opacity: 1;
}

.prose p,
.prose li {
  overflow-wrap: break-word;
}

.prose ul,
.prose ol {
  padding-left: 1.3rem;
}

.prose li + li {
  margin-top: 0.2rem;
}

.prose :not(pre) > code {
  font-size: 0.88em;
  padding: 0.1em 0.32em;
  background: var(--inline-code);
  border-radius: 4px;
}

/* A key's name in its heading is the heading: no chip behind it. After the
   rule above, which it ties with on specificity. */
.prose h2 > code,
.prose h3 > code {
  font-size: 0.95em;
  background: none;
  padding: 0;
}

.prose a code {
  color: inherit;
}

.prose pre,
.code-block pre {
  margin: 0;
}

.prose pre,
.code-block {
  margin: 1rem 0;
}

.prose pre {
  padding: 0.85rem 1rem;
  overflow-x: auto;
  font-size: 0.84rem;
  line-height: 1.55;
  color: var(--term-ink);
  background: var(--term-bg);
  border-radius: 6px;
}

.code-block {
  position: relative;
}

.code-block pre {
  padding-right: 4.5rem;
}

.prose table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  font-size: 0.9rem;
  margin: 1rem 0;
}

.prose th,
.prose td {
  padding: 0.45rem 0.7rem;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--rule);
}

.prose th {
  font-weight: 600;
  color: var(--ink-2);
  border-bottom-width: 2px;
}

.prose td:first-child {
  white-space: nowrap;
}

.cards {
  list-style: none;
  padding: 0;
  display: grid;
  gap: 0.75rem;
}

.cards a {
  display: block;
  padding: 0.9rem 1rem;
  border: 1px solid var(--rule);
  border-radius: 8px;
  text-decoration: none;
}

.cards a:hover {
  border-color: var(--blue);
}

.cards strong {
  display: block;
}

.cards span {
  color: var(--ink-2);
  font-size: 0.92rem;
}

/* ---------- code panel ---------- */

.panel {
  grid-area: panel;
  min-width: 0;
  border-left: 1px solid var(--rule);
  background: var(--term-bg);
  color: var(--term-ink);
}

.panel-inner {
  position: sticky;
  top: var(--topbar-h);
  max-height: calc(100vh - var(--topbar-h));
  overflow: auto;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 2.6rem;
  padding: 0.35rem 0.6rem 0.35rem 1.1rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--term-dim);
  border-bottom: 1px solid var(--code-rule);
}

.panel-code {
  margin: 0;
  padding: 0.8rem 0 1.2rem;
  font-size: 0.84rem;
  line-height: 1.6;
  overflow-x: auto;
}

.panel .l {
  display: block;
  padding: 0 1.1rem;
  color: inherit;
  background: none;
}

.panel mark.l {
  background: var(--code-mark);
  box-shadow: inset 2px 0 0 var(--code-key);
}

.panel .k,
.giallo-l .k {
  color: var(--code-key);
}

.panel .c {
  color: var(--term-dim);
}

/* The highlighter's own background is the light scheme's; the dark scheme's
   terminal is darker, so the block follows --term-bg instead. */
.prose pre.z-code {
  background: var(--term-bg);
}

/* ---------- copy buttons (docs.js adds them) ---------- */

.copy {
  font: inherit;
  font-family: var(--sans);
  font-size: 0.72rem;
  padding: 0.18rem 0.55rem;
  color: var(--term-dim);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid #3a3f47;
  border-radius: 4px;
  cursor: pointer;
}

.copy:hover {
  color: var(--term-ink);
  border-color: var(--term-dim);
}

.code-block .copy {
  position: absolute;
  top: 0.45rem;
  right: 0.45rem;
}

/* ---------- footer ---------- */

.footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 2rem;
  padding: 1.2rem 1.5rem;
  border-top: 1px solid var(--rule);
  font-size: 0.9rem;
  color: var(--muted);
}

.footer p {
  margin: 0;
}

.footer-meta a,
.footer-meta a:visited {
  color: var(--muted);
}

/* ---------- landing and 404 ---------- */

.home {
  width: min(64rem, 92vw);
  margin-inline: auto;
  padding: 3.5rem 0 4rem;
}

.home-hero h1 {
  font-size: clamp(2rem, 4.2vw, 2.9rem);
  margin: 0 0 0.8rem;
}

.home-lede p,
.home-hero > p {
  max-width: 42rem;
  font-size: 1.12rem;
  color: var(--ink-2);
  margin: 0 0 1rem;
}

.home-lede code {
  font-size: 0.9em;
  padding: 0.1em 0.32em;
  background: var(--inline-code);
  border-radius: 4px;
  color: var(--ink);
}

.search-big {
  max-width: 38rem;
  margin: 1.6rem 0 0;
}

.search-big input {
  padding: 0.8rem 3.2rem 0.8rem 1rem;
  font-size: 1.05rem;
  border-radius: 8px;
}

.home-cards {
  list-style: none;
  padding: 0;
  margin: 3rem 0 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.home-card,
.home-card:visited {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  height: 100%;
  padding: 1.3rem 1.3rem 1.4rem;
  color: var(--ink);
  text-decoration: none;
  border: 1px solid var(--rule);
  border-top: 3px solid var(--blue);
  border-radius: 8px;
  background: var(--paper);
}

.home-card:hover {
  border-color: var(--blue);
}

.home-card strong {
  font-size: 1.2rem;
  letter-spacing: -0.01em;
}

.home-card span:last-child {
  color: var(--ink-2);
  font-size: 0.95rem;
}

.home-card-step {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--orange-ink);
}

.home-more {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
}

.home-more h2 {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 0 0 0.8rem;
}

.home-more ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem 2rem;
}

.home-more span {
  color: var(--muted);
  font-size: 0.92rem;
}

.not-found .home-hero > p:last-child {
  margin-top: 2rem;
  font-size: 0.95rem;
}

/* ---------- narrower screens ---------- */

/* A laptop: the panel moves under the prose, the nav stays. */
@media (max-width: 75rem) {
  .layout.has-panel {
    grid-template-columns: 14rem minmax(0, 1fr);
    grid-template-areas: "nav main" "nav panel";
  }

  .layout {
    grid-template-columns: 14rem minmax(0, 1fr);
  }

  .panel {
    margin: 0 2.5rem 3rem;
    border-radius: 6px;
    overflow: hidden;
  }

  .layout.has-panel .main {
    padding-bottom: 1.5rem;
  }

  .panel-inner {
    position: static;
    max-height: none;
  }
}

/* A phone: one column. The prose, the panel under it, then the nav, which
   the top bar's Menu link jumps to. */
@media (max-width: 52rem) {
  .topbar {
    flex-wrap: wrap;
    gap: 0.6rem 1rem;
    padding: 0.6rem 1rem;
  }

  .search {
    order: 3;
    flex-basis: 100%;
    max-width: none;
  }

  .landing .topbar .search {
    display: none;
  }

  .tabs {
    gap: 1rem;
  }

  .kbd {
    display: none;
  }

  .to-nav {
    display: inline;
  }

  .layout,
  .layout.has-panel {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "main" "panel" "nav";
  }

  .main {
    padding: 1.2rem 1.1rem 1.5rem;
  }

  .main h1 {
    font-size: 1.6rem;
  }

  .panel {
    margin: 0 1.1rem 2rem;
  }

  .nav {
    position: static;
    max-height: none;
    border-right: 0;
    border-top: 1px solid var(--rule);
    padding: 1rem 1.1rem 1.5rem;
    /* Under the topbar when the Menu link jumps here. */
    scroll-margin-top: 7rem;
  }

  .anchor {
    display: none;
  }

  .home {
    padding-top: 2rem;
  }

  .home-cards,
  .home-more ul {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 30rem) {
  .brand-docs {
    font-size: 0.95rem;
  }

  .tabs a {
    font-size: 0.9rem;
  }
}

/* ---------- search ---------- */

/* Shown only when JavaScript is off (nojs.css): the box is a link then. */
.search-link {
  display: none;
  padding: 0.42rem 0.75rem;
  font-size: 0.95rem;
  color: var(--muted);
  background: var(--field);
  border: 1px solid var(--rule);
  border-radius: 6px;
  text-decoration: none;
}

.search-big .search-link {
  padding: 0.8rem 1rem;
  font-size: 1.05rem;
  border-radius: 8px;
}

/* Built by docs.js when the reader types: a list of pages under the box. */
.search-results {
  position: absolute;
  z-index: 20;
  left: 0;
  right: 0;
  top: calc(100% + 0.35rem);
  max-height: min(70vh, 32rem);
  overflow-y: auto;
  margin: 0;
  padding: 0.3rem;
  list-style: none;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14);
}

.search-results[hidden] {
  display: none;
}

.search-results a,
.search-results a:visited {
  display: block;
  padding: 0.55rem 0.7rem;
  color: var(--ink);
  text-decoration: none;
  border-radius: 6px;
}

.search-results a:hover,
.search-results a:focus-visible {
  background: var(--tint);
}

.search-results .hit-title {
  font-weight: 600;
}

.search-results .hit-where {
  margin-left: 0.5rem;
  font-size: 0.78rem;
  color: var(--muted);
}

.search-results .hit-text {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.88rem;
  color: var(--ink-2);
}

.search-results mark {
  background: var(--tint);
  color: inherit;
  border-bottom: 2px solid var(--blue);
}

.search-results .hit-none {
  padding: 0.6rem 0.7rem;
  color: var(--muted);
  font-size: 0.92rem;
}

/* The page list: dozens of short entries, so it runs in columns. */
.all-pages {
  padding-left: 1.1rem;
}

.mono-list {
  columns: 14rem;
  column-gap: 1.5rem;
}

.all-pages li > span {
  color: var(--muted);
  font-size: 0.92em;
}
