/* FPC documentation shell. Logical properties mirror with the page dir. */

:root {
  --canvas: #f4f7fb;
  --surface: #ffffff;
  --ink: #142033;
  --muted: #3d4c63;
  --link: #0b4f9c;
  --mark: #0b4f9c;
  --accent: #1e88e5;
  --focus: #0b57d0;
  --wash: #e8f3fc;
  --line: #d5deea;
  --input: #4a5a70;
  --font: "IBM Plex Sans Arabic", "IBM Plex Sans", "Segoe UI", "Noto Naskh Arabic", "Geeza Pro", Tahoma, sans-serif;
  --measure: 68ch;
  --rail: 17rem;
  --toc: 16rem;
  --gap: 1.25rem;
  --wide: 64rem;
  color-scheme: light dark;
}

/* Dark theme: same roles, every pair keeps WCAG AA (checked like the light set). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --canvas: #0e141d;
    --surface: #151d2a;
    --ink: #e9eef6;
    --muted: #b1bdcf;
    --link: #8fc3ff;
    --mark: #8fc3ff;
    --accent: #4c9ff0;
    --focus: #8fc3ff;
    --wash: #1c2c44;
    --line: #2a3648;
    --input: #7a8aa3;
  }
}

:root[data-theme="dark"] {
  --canvas: #0e141d;
  --surface: #151d2a;
  --ink: #e9eef6;
  --muted: #b1bdcf;
  --link: #8fc3ff;
  --mark: #8fc3ff;
  --accent: #4c9ff0;
  --focus: #8fc3ff;
  --wash: #1c2c44;
  --line: #2a3648;
  --input: #7a8aa3;
}

html {
  box-sizing: border-box;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font);
  font-size: 100%;
  line-height: 1.65;
  text-align: start;
}

body,
header,
nav,
main,
form,
search,
details,
summary,
div,
p,
ul,
ol,
li,
h1,
h2,
a,
button,
input,
section,
span,
label {
  box-sizing: inherit;
}

body {
  margin: 0;
  min-inline-size: 0;
  padding-block: 0 2.5rem;
  padding-inline: clamp(1rem, 3vw, 1.75rem);
  background: var(--canvas);
  color: var(--ink);
}

:where(h1, h2, p, ul, ol) {
  margin-block: 0;
}

h1,
h2 {
  text-wrap: balance;
  line-height: 1.3;
}

main p {
  text-wrap: pretty;
}

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

a:hover {
  text-decoration-thickness: 2px;
}

:where(a, button, summary, input, #docs-article):focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

:lang(ar) .locale-en,
:not(:lang(ar)) .locale-ar {
  display: none;
}

.skip-link {
  z-index: 5;
  background: var(--surface);
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
  border-radius: 0.6rem;
  box-shadow: 0 0 0 1px var(--line);
}

.skip-link:not(:focus-visible) {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link:focus-visible {
  position: fixed;
  inset-block-start: 0.75rem;
  inset-inline-start: 0.75rem;
  inline-size: auto;
  block-size: auto;
  max-inline-size: calc(100% - 1.5rem);
  margin: 0;
  padding-block: 0.65rem;
  padding-inline: 1rem;
  overflow: visible;
  clip-path: none;
  white-space: normal;
}

header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.25rem;
  padding-block: 0.9rem 0.85rem;
  border-block-end: 1px solid var(--line);
}

.product {
  margin: 0;
  min-inline-size: 0;
}

.product a {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  min-inline-size: 0;
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.product a::before {
  content: "FPC" / "";
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  inline-size: 2.6rem;
  block-size: 2.6rem;
  border-radius: 0.65rem;
  background: var(--mark);
  color: var(--surface);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0;
}

header nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

header nav a {
  display: inline-flex;
  align-items: center;
  min-block-size: 2.75rem;
  padding-inline: 0.95rem;
  border: 1px solid var(--input);
  border-radius: 999px;
  background: var(--surface);
  color: var(--link);
  font-weight: 700;
  text-decoration: none;
}

.docs-search,
body:not(:has(.docs-frame)) > form {
  display: block;
  margin-block: 1rem 0.25rem;
  padding-block: 0.85rem;
  padding-inline: 1rem;
  border: 1px solid var(--line);
  border-radius: 0.9rem;
  background: var(--surface);
}

search form,
form[role="search"] {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 0.5rem 0.75rem;
  margin: 0;
}

search form label,
form[role="search"] label {
  flex: 1 0 100%;
  font-weight: 700;
}

#docs-search {
  flex: 1 1 12rem;
  min-inline-size: 0;
  min-block-size: 3rem;
  padding-inline: 0.8rem;
  border: 1px solid var(--input);
  border-radius: 0.65rem;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: max(1rem, 1em);
}

button[data-clear] {
  min-block-size: 3rem;
  padding-inline: 1rem;
  border: 1px solid var(--input);
  border-radius: 0.65rem;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-weight: 700;
}

button[data-clear]:hover {
  background: var(--wash);
}

#docs-search-status {
  flex: 1 0 100%;
  margin: 0;
  color: var(--muted);
}

#docs-search-status:not(:empty) {
  min-block-size: 1.25rem;
}

#docs-search-results {
  flex: 1 0 100%;
  margin: 0;
  padding: 0;
  list-style: none;
}

#docs-search-results:empty {
  display: none;
}

#docs-search-results a {
  display: block;
  padding-block: 0.45rem;
  overflow-wrap: anywhere;
}

body > nav:has(> ol > li[aria-current="page"]) {
  margin-block: 0.85rem 0.2rem;
}

body > nav:has(> ol > li[aria-current="page"]) ol {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.4rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

body > nav:has(> ol > li[aria-current="page"]) li {
  display: inline-flex;
  align-items: center;
  min-inline-size: 0;
  color: var(--muted);
  overflow-wrap: anywhere;
}

body > nav:has(> ol > li[aria-current="page"]) li + li::before {
  content: "/" / "";
  margin-inline-end: 0.4rem;
  color: var(--muted);
}

body > nav:has(> ol > li[aria-current="page"]) a {
  color: var(--link);
}

body > nav:has(> ol > li[aria-current="page"]) [aria-current="page"] {
  color: var(--ink);
  font-weight: 700;
}

.docs-frame {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  gap: var(--gap);
  min-inline-size: 0;
  margin-block-start: 1rem;
}

.docs-article,
.docs-modules,
.docs-contents,
main,
nav {
  min-inline-size: 0;
}

.docs-article {
  max-inline-size: 100%;
}

main {
  max-inline-size: var(--measure);
}

main h1 {
  margin-block-end: 0.75rem;
  font-size: clamp(1.6rem, 1.25rem + 1vw, 2.05rem);
  overflow-wrap: anywhere;
}

main > p {
  margin-block-end: 1rem;
  color: var(--muted);
}

main section {
  margin-block: 1.35rem;
  padding-inline-start: 0.85rem;
  border-inline-start: 3px solid var(--accent);
}

main section h2 {
  margin-block-end: 0.45rem;
  font-size: 1.2rem;
}

main section p,
main section li {
  margin-block: 0.35rem;
}

main ol,
main ul {
  margin-block: 0.4rem;
  padding-inline-start: 1.25rem;
}

main a {
  overflow-wrap: anywhere;
}

main :is(section, li, h1, h2):target {
  scroll-margin-block-start: 1rem;
}

summary {
  min-block-size: 2.75rem;
  padding-block: 0.65rem;
  padding-inline: 0.85rem;
  border: 1px solid var(--input);
  border-radius: 0.7rem;
  background: var(--surface);
  font-weight: 700;
  cursor: pointer;
}

nav:has(> section) section + section {
  margin-block-start: 1rem;
  padding-block-start: 0.85rem;
  border-block-start: 1px solid var(--line);
}

nav:has(> section) h2 {
  margin-block: 0 0.35rem;
  color: var(--muted);
  font-size: 0.95rem;
}

nav:has(> section) ul,
nav:has(> ol) ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

nav:has(> section) a,
nav:has(> ol > li > a[href^="#"]) a {
  display: block;
  padding-block: 0.4rem;
  padding-inline: 0.7rem;
  border-radius: 0.5rem;
  color: var(--ink);
  text-decoration: none;
  overflow-wrap: anywhere;
}

nav:has(> section) a:hover,
nav:has(> ol > li > a[href^="#"]) a:hover {
  text-decoration: underline;
}

nav a[aria-current="page"] {
  background: var(--wash);
  border-inline-start: 3px solid var(--accent);
  font-weight: 700;
}

nav:has(> section):has(a[aria-current="page"]) {
  border-inline-start: 3px solid var(--accent);
  padding-inline-start: 0.35rem;
}

.docs-modules:not(:has(nav a)),
.docs-contents:not(:has(nav a)) {
  display: none;
}

@media (min-width: 64rem) {
  .docs-frame {
    grid-template-columns: minmax(13rem, var(--rail)) minmax(0, 42rem) minmax(12rem, var(--toc));
    column-gap: 2rem;
    justify-content: center;
  }

  .docs-modules > summary,
  .docs-contents > summary {
    display: none;
  }

  .docs-modules > nav,
  .docs-contents > nav,
  .docs-modules::details-content,
  .docs-contents::details-content {
    display: block;
    content-visibility: visible;
  }

  .docs-contents {
    position: sticky;
    inset-block-start: 1rem;
    align-self: start;
  }

  body:not(:has(.docs-frame)) {
    display: grid;
    grid-template-columns: minmax(13rem, var(--rail)) minmax(0, 42rem) minmax(12rem, var(--toc));
    column-gap: 2rem;
    row-gap: 0.5rem;
    justify-content: center;
    align-items: start;
  }

  body:not(:has(.docs-frame)) > :is(header, form, nav:has(> ol > li[aria-current="page"])) {
    grid-column: 1 / -1;
  }

  body:not(:has(.docs-frame)) > nav:not(:has(a, section, p)) {
    display: none;
  }
}

@media (max-width: 63.99rem) {
  body:not(:has(.docs-frame)) > nav:has(> section) {
    max-block-size: 12rem;
    overflow: auto;
    overscroll-behavior: contain;
    padding-block-end: 0.4rem;
    border: 1px solid var(--line);
    border-radius: 0.7rem;
    background: var(--surface);
  }
}

@media (pointer: coarse) {
  nav:has(> section) a,
  nav:has(> ol > li > a[href^="#"]) a,
  summary,
  header nav a,
  button[data-clear],
  #docs-search {
    min-block-size: 3rem;
  }
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

@media (forced-colors: active) {
  .product a::before {
    background: ButtonText;
    color: ButtonFace;
    forced-color-adjust: none;
  }

  nav a[aria-current="page"],
  main section {
    border-inline-start-color: Highlight;
  }

  :where(a, button, summary, input, #docs-article):focus-visible {
    outline-color: Highlight;
  }

  body > nav:has(> ol > li[aria-current="page"]) [aria-current="page"] {
    text-decoration: underline;
  }
}

/* The language chooser at /docs/ has no index of its own: no search box there. */
.docs-search:has(form[data-index=""]) {
  display: none;
}

/* On-this-page: step entries are whole sentences; keep them to two quiet lines. */
.docs-contents > nav li li > a[href^="#"] {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  padding-block: 0;
  margin-block: 0.45rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.docs-modules[open] > summary,
.docs-contents[open] > summary {
  margin-block-end: 0.5rem;
}
