/* Component reference — hand-written CSS, independent from the marketing site's
   precompiled Tailwind (whose content scan never sees these generated pages).
   Colours mirror docs-site/tailwind.config.js: teal = primary, orange = accent. */

:root {
  --bg: #ffffff;
  --bg-soft: #f8fafc;
  --bg-code: #f6f8fa;
  --fg: #111827;
  --fg-soft: #4b5563;
  --muted: #6b7280;
  --border: #e5e7eb;
  --primary: #16778c;
  --primary-soft: #edfafb;
  --primary-fg: #155f72;
  --accent: #f86d2b;
  --ok-bg: #ecfdf5;
  --ok-fg: #047857;
  --warn-bg: #fff7ed;
  --warn-fg: #c2410c;
  --tk-k: #a626a4;
  /* Code tokens: 4.5:1 at least on --bg-code (strings and comments read at
     3.0:1, numbers at 3.9:1). */
  --tk-s: #387a35;
  --tk-t: #0f6f86;
  --tk-n: #9a5b00;
  --tk-c: #646b76;
  --radius: 10px;
  --header: 64px;
  color-scheme: light;
}

:root.dark {
  --bg: #030712;
  --bg-soft: #0b1220;
  --bg-code: #0d1525;
  --fg: #f3f4f6;
  --fg-soft: #cbd5e1;
  --muted: #94a3b8;
  --border: #1f2937;
  --primary: #38b2c1;
  --primary-soft: rgba(22, 119, 140, 0.18);
  --primary-fg: #a6e4ea;
  --accent: #fba75c;
  --ok-bg: rgba(16, 185, 129, 0.14);
  --ok-fg: #6ee7b7;
  --warn-bg: rgba(249, 115, 22, 0.14);
  --warn-fg: #fdba74;
  --tk-k: #d19af0;
  --tk-s: #a3d987;
  --tk-t: #70cfd9;
  --tk-n: #f5c07a;
  --tk-c: #7c8696;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html {
  scroll-padding-top: calc(var(--header) + 16px);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.65 Inter, ui-sans-serif, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--primary);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

code,
pre {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.86em;
}

:not(pre) > code {
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0.05em 0.35em;
  overflow-wrap: anywhere;
}

.skip {
  position: absolute;
  left: -9999px;
}
.skip:focus {
  left: 16px;
  top: 12px;
  z-index: 100;
  background: var(--bg);
  padding: 8px 12px;
  border-radius: 8px;
}

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

/* Header ------------------------------------------------------------------ */

.top {
  position: sticky;
  top: 0;
  z-index: 30;
  height: var(--header);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(10px);
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--fg);
  font-weight: 700;
  letter-spacing: -0.01em;
}
.brand:hover {
  text-decoration: none;
}
.brand img {
  width: 40px;
  height: 40px;
  object-fit: contain;
}
.brand b {
  color: var(--primary);
}
.spacer {
  flex: 1;
}
.top-link {
  color: var(--fg-soft);
  font-size: 14px;
  font-weight: 500;
}
.lang {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  font-size: 12px;
  font-weight: 600;
}
.lang a,
.lang span {
  padding: 6px 9px;
  color: var(--fg-soft);
}
.lang a:hover {
  text-decoration: none;
  background: var(--bg-soft);
}
.lang span {
  background: var(--primary);
  color: #fff;
}
:root.dark .lang span {
  color: #082932;
}
.theme,
.menu-btn {
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--fg-soft);
  border-radius: 8px;
  height: 34px;
  min-width: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font: inherit;
  font-size: 14px;
}
.menu-btn {
  display: none;
  padding: 0 12px;
}

/* Shell ------------------------------------------------------------------- */

.shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr) 220px;
  max-width: 1480px;
  margin: 0 auto;
}

aside {
  position: sticky;
  top: var(--header);
  height: calc(100vh - var(--header));
  overflow-y: auto;
  border-right: 1px solid var(--border);
  padding: 16px 12px 40px;
}
/* The field stays at the top of the sidebar, which opens scrolled to the
   current page: the search is where a reader starts from (MK-14). */
.search {
  position: sticky;
  top: -16px;
  z-index: 1;
  margin: -16px -12px 0;
  padding: 16px 12px 0;
  background: var(--bg);
}
.search input {
  width: 100%;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-soft);
  color: var(--fg);
  padding: 0 10px;
  font: inherit;
  font-size: 14px;
  margin-bottom: 12px;
}
.side-group {
  margin-top: 14px;
}
.side-title {
  margin: 0 0 4px;
  padding: 0 10px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.side-link {
  display: block;
  padding: 4px 10px;
  border-radius: 6px;
  color: var(--fg-soft);
  font-size: 14px;
}
.side-link:hover {
  background: var(--bg-soft);
  text-decoration: none;
}
.side-link.active {
  background: var(--primary-soft);
  color: var(--primary-fg);
  font-weight: 600;
}
.side-link[hidden],
.side-group[hidden],
.side-nav[hidden],
.search-results[hidden] {
  display: none;
}

/* The search (MK-14). The status line is always in the document, so that a
   screen reader hears it change; empty, it takes no room. */
.search-status {
  margin: 0;
  padding: 0 10px;
  font-size: 12px;
  color: var(--muted);
}
.search-status:not(:empty) {
  margin: -4px 0 8px;
}
.search-results {
  list-style: none;
  margin: 0;
  padding: 0;
}
.search-hit {
  display: block;
  padding: 6px 10px;
  border-radius: 6px;
  color: var(--fg-soft);
  font-size: 13px;
  line-height: 1.4;
}
.search-hit:hover,
.search-hit:focus-visible {
  background: var(--bg-soft);
  text-decoration: none;
}
.hit-name {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 13px;
  font-weight: 600;
  color: var(--fg);
  overflow-wrap: anywhere;
}
.hit-words {
  font-family: inherit;
  font-size: 14px;
}
.hit-name mark {
  background: var(--primary-soft);
  color: var(--primary-fg);
  border-radius: 3px;
}
.hit-meta {
  font-size: 12px;
  color: var(--muted);
}
.hit-desc {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
}

/* A heading or a row reached by its address is not left under the sticky
   header, and the row of a prop a result led to says so. */
[id] {
  scroll-margin-top: calc(var(--header) + 16px);
}
table.api tr:target > td {
  background: var(--primary-soft);
}

main {
  min-width: 0;
  padding: 32px 40px 96px;
}
.content {
  max-width: 920px;
}

.toc {
  position: sticky;
  top: var(--header);
  align-self: start;
  max-height: calc(100vh - var(--header));
  overflow-y: auto;
  padding: 32px 16px;
  font-size: 13px;
}
.toc a {
  display: block;
  color: var(--fg-soft);
  padding: 2px 0 2px 10px;
  border-left: 2px solid var(--border);
}
.toc a.sub {
  padding-left: 22px;
  color: var(--muted);
}
/* The section being read (MK-14), marked by docs.js. */
.toc a[aria-current] {
  border-left-color: var(--primary);
  color: var(--primary-fg);
  font-weight: 600;
}

/* Content ----------------------------------------------------------------- */

h1 {
  font-size: 34px;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin: 4px 0 12px;
}
h2 {
  font-size: 24px;
  letter-spacing: -0.01em;
  margin: 48px 0 12px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
h2.group {
  font-size: 18px;
  border-top: none;
  margin-top: 28px;
  color: var(--fg-soft);
}
h3 {
  font-size: 18px;
  margin: 28px 0 6px;
}
h4 {
  font-size: 14px;
  margin: 18px 0 8px;
}
/* A heading's text is the link to it. The "#" in its margin is decoration,
   with an empty alternative text so that the link is named by the heading
   alone (WEB-21). */
.heading-link {
  color: inherit;
}
.heading-link:hover {
  text-decoration: none;
}
.heading-link::before {
  content: "#";
  content: "#" / "";
  display: inline-block;
  width: 1em;
  margin-left: -1em;
  opacity: 0;
  color: var(--muted);
  font-weight: 400;
}
h3:hover .heading-link::before,
.heading-link:focus-visible::before {
  opacity: 1;
}
.crumb {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}
.lead {
  font-size: 16px;
  color: var(--fg-soft);
}
.muted {
  color: var(--muted);
}
.meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.pill {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: var(--primary-soft);
  color: var(--primary-fg);
  border: none;
  white-space: nowrap;
}
.pill.ok {
  background: var(--ok-bg);
  color: var(--ok-fg);
}
.pill.warn {
  background: var(--warn-bg);
  color: var(--warn-fg);
}
.pill.mono {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-weight: 500;
  background: var(--bg-code);
  border: 1px solid var(--border);
  color: var(--fg-soft);
}
.pill.version {
  font-size: 11px;
}
.btn {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 12px;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
}
:root.dark .btn {
  color: #082932;
}
.btn:hover {
  text-decoration: none;
  filter: brightness(1.08);
}

/* Previews ---------------------------------------------------------------- */

/* The example, running, and its source under it: one card. The frame holds
   the library's own stylesheet, so nothing of this file reaches the component
   and nothing of the component reaches this page. */
.preview {
  position: relative;
  margin: 10px 0 0;
  border: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
  overflow: hidden;
  /* What the frame paints once loaded (preview/preview.css). */
  background: #ffffff;
}
:root.dark .preview {
  background: #101828;
}
.preview-frame {
  display: block;
  width: 100%;
  /* Until the example says how tall it is (docs.js). */
  height: 96px;
  border: 0;
}
.preview + .code {
  margin-top: 0;
}
.preview + .code pre {
  border-top: 0;
  border-radius: 0 0 var(--radius) var(--radius);
}
/* Under the frame, never over it: a pill in the corner covered the last
   button of a paginator the moment the pointer came near it. */
.preview-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg-soft);
  padding: 5px 12px;
  font-size: 12px;
}
.preview-open,
.preview-try {
  border: 0;
  background: none;
  padding: 0;
  color: var(--muted);
  font: inherit;
  text-decoration: none;
  cursor: pointer;
}
.preview-open:hover,
.preview-open:focus-visible,
.preview-try:hover,
.preview-try:focus-visible {
  color: var(--primary);
}
.preview-open::after,
.preview-try::after {
  content: " ↗";
  /* Decoration: the second form gives it an empty alternative text, so the
     name read aloud stays "Essayer sur StackBlitz". */
  content: " ↗" / "";
}

/* Code -------------------------------------------------------------------- */

.code {
  position: relative;
  margin: 10px 0 16px;
}
.code pre {
  margin: 0;
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  overflow-x: auto;
  line-height: 1.55;
  tab-size: 2;
}
.copy {
  position: absolute;
  top: 8px;
  right: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--fg-soft);
  border-radius: 6px;
  font: inherit;
  font-size: 12px;
  padding: 2px 8px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s;
}
.code:hover .copy,
.copy:focus-visible {
  opacity: 1;
}
@media (hover: none) {
  .copy {
    opacity: 1;
  }
}
.tk-k {
  color: var(--tk-k);
}
.tk-s {
  color: var(--tk-s);
}
.tk-t {
  color: var(--tk-t);
}
.tk-n {
  color: var(--tk-n);
}
.tk-c {
  color: var(--tk-c);
  font-style: italic;
}

/* API --------------------------------------------------------------------- */

.sym {
  border-top: 1px dashed var(--border);
  margin-top: 28px;
}
.sym-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.sym-head h3 {
  margin: 20px 0 6px;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 17px;
  margin-right: 4px;
}
.kind-hook,
.kind-function {
  background: var(--warn-bg);
  color: var(--warn-fg);
}
.kind-interface,
.kind-type,
.kind-constant {
  background: var(--bg-code);
  color: var(--fg-soft);
}
.doc p {
  margin: 6px 0;
}
.signature {
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  margin: 8px 0;
  overflow-x: auto;
}
.signature code {
  background: none;
  border: none;
  padding: 0;
  white-space: pre-wrap;
}
.params,
.returns {
  font-size: 14px;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
table.api {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
table.api th {
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  background: var(--bg-soft);
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}
table.api td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
table.api tr:last-child td {
  border-bottom: none;
}
table.api td.name {
  white-space: nowrap;
}
table.api td.type {
  min-width: 180px;
  max-width: 340px;
}
table.api td.type code,
table.api td.default code {
  background: none;
  border: none;
  padding: 0;
  color: var(--tk-t);
}
table.api td.desc p {
  margin: 0 0 6px;
}
table.api td.desc p:last-child {
  margin-bottom: 0;
}
table.api tr.deprecated td.name code {
  text-decoration: line-through;
}
.req {
  color: var(--accent);
  font-weight: 800;
  margin-left: 4px;
}
.inherited {
  font-size: 13px;
  color: var(--muted);
  margin: 8px 0 0;
}

/* Overview ---------------------------------------------------------------- */

.cat h2 {
  font-size: 18px;
  border-top: none;
  margin-top: 24px;
}
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}
.card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--fg);
  transition: border-color 0.15s, background 0.15s;
}
.card:hover {
  text-decoration: none;
  border-color: var(--primary);
  background: var(--bg-soft);
}
.card span {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}

/* Previous and next ------------------------------------------------------- */

/* The page before and the page after, in the order of the sidebar (MK-14). */
.pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  max-width: 920px;
  margin-top: 64px;
}
.pager a {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--fg);
  transition: border-color 0.15s, background 0.15s;
}
.pager a:hover {
  text-decoration: none;
  border-color: var(--primary);
  background: var(--bg-soft);
}
.pager span {
  font-size: 13px;
  color: var(--muted);
}
.pager-prev span::before {
  content: "← " / "";
}
.pager-next {
  grid-column: 2;
  text-align: right;
}
.pager-next span::after {
  content: " →" / "";
}

/* Footer ------------------------------------------------------------------ */

/* Who publishes the library, its licence and where to write: the reference
   had no foot at all (WEB-21). */
.foot {
  position: relative;
  /* Over the sticky sidebar, which ends where the shell does. */
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 24px;
  border-top: 1px solid var(--border);
  background: var(--bg);
  padding: 24px 40px 32px;
  font-size: 13px;
  color: var(--muted);
}
.foot p {
  margin: 0;
}
.foot nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
}
.foot a {
  color: var(--fg-soft);
}

/* Responsive -------------------------------------------------------------- */

@media (max-width: 1200px) {
  .shell {
    grid-template-columns: 240px minmax(0, 1fr);
  }
  .toc {
    display: none;
  }
}

@media (max-width: 860px) {
  .shell {
    grid-template-columns: minmax(0, 1fr);
  }
  .menu-btn {
    display: inline-flex;
  }
  .top-link {
    display: none;
  }
  .top {
    padding: 0 16px;
  }
  aside {
    position: fixed;
    inset: var(--header) 0 0 0;
    height: auto;
    z-index: 20;
    background: var(--bg);
    border-right: none;
    display: none;
  }
  aside.open {
    display: block;
  }
  main {
    padding: 24px 16px 80px;
  }
  h1 {
    font-size: 28px;
  }
  .heading-link::before {
    display: none;
  }
  .foot {
    padding: 20px 16px 28px;
  }
}

@media (max-width: 480px) {
  .brand span,
  .pill.version {
    display: none;
  }
  .pager {
    grid-template-columns: minmax(0, 1fr);
  }
  .pager-next {
    grid-column: auto;
  }
}

/* Prose in a code block (the text of the licence) wraps instead of scrolling. */
.code pre code.lang-text {
  white-space: pre-wrap;
}

/* The changelog (MK-8): each release under its number, its day just below. */
.release-date {
  margin: -4px 0 0;
  font-size: 13px;
  color: var(--muted);
}
.release h3 {
  font-size: 15px;
  margin-top: 20px;
}
.release-notes > ul {
  padding-left: 20px;
}
.release-notes li + li {
  margin-top: 10px;
}
.release-notes li > p {
  margin: 0 0 8px;
}
.release-notes ul ul li + li {
  margin-top: 4px;
}
.release-notes .code {
  margin: 8px 0 12px;
}
