/*
 * Palette and fonts are taken from the theme's own settings_data.json so the
 * docs site and the product look like the same thing.
 */
:root {
  --bg: #ffffff;
  --bg-soft: #fbf9f5;
  --bg-sunk: #f4f1ea;
  --text: #22312f;
  --text-soft: #5d6b68;
  --border: #e4dfd5;
  --accent: #0f7b84;
  --accent-soft: #e6f2f3;
  --coral: #ff6b4a;
  --code-bg: #f4f1ea;

  --heading-font: "Quicksand", ui-rounded, system-ui, sans-serif;
  --body-font: "Nunito Sans", system-ui, -apple-system, sans-serif;

  --page: 1180px;
  --radius: 16px;
  --radius-sm: 8px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161d1c;
    --bg-soft: #1c2524;
    --bg-sunk: #222c2b;
    --text: #eef2f1;
    --text-soft: #a3b1ae;
    --border: #33403e;
    --accent: #4bc4ce;
    --accent-soft: #1d3335;
    --coral: #ff8265;
    --code-bg: #111817;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 5.5rem;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--body-font);
  font-size: 1rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

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

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

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

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

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

.skip-link {
  position: absolute;
  top: -3rem;
  left: 1rem;
  z-index: 20;
  padding: 0.6rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  transition: top 0.15s;
}

.skip-link:focus {
  top: 1rem;
}

/* ---------- header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
}

.site-header__inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  max-width: var(--page);
  margin: 0 auto;
  padding: 0.85rem 1.25rem;
}

/* The logo is a white lockup, so it needs a coloured seat to sit on. Brand teal
 * is hard-coded rather than var(--accent) on purpose: the accent lightens in
 * dark mode, and a white logo needs the darker teal in both themes. */
.brand {
  display: inline-flex;
  align-items: center;
  flex: none;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  background: #0f7b84;
  text-decoration: none;
}

.brand:hover {
  filter: brightness(1.08);
}

.brand__logo {
  display: block;
  width: auto;
  height: 1.6rem;
}

.site-nav {
  display: flex;
  gap: 0.35rem;
}

.site-nav a {
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  color: var(--text-soft);
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
}

.site-nav a:hover {
  background: var(--bg-sunk);
  color: var(--text);
}

.site-nav a[aria-current="page"] {
  background: var(--accent-soft);
  color: var(--accent);
}

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

.site-search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  width: min(20rem, 34vw);
  margin-left: auto;
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-soft);
}

.site-search:focus-within {
  border-color: var(--accent);
}

.site-search__icon {
  flex: none;
  width: 1rem;
  height: 1rem;
  color: var(--text-soft);
}

.site-search__input {
  width: 100%;
  min-width: 0;
  border: 0;
  background: none;
  color: var(--text);
  font-family: inherit;
  font-size: 0.92rem;
}

.site-search__input:focus {
  outline: none;
}

.site-search__input::-webkit-search-cancel-button {
  cursor: pointer;
}

.site-search__key {
  flex: none;
  padding: 0.05rem 0.4rem;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--bg);
  color: var(--text-soft);
  font-family: inherit;
  font-size: 0.75rem;
}

.site-search__results {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  z-index: 30;
  width: min(28rem, calc(100vw - 2.5rem));
  max-height: min(28rem, calc(100vh - 6rem));
  overflow-y: auto;
  padding: 0.4rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  box-shadow: 0 18px 40px -20px rgb(0 0 0 / 35%);
}

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

.result__link {
  display: block;
  padding: 0.55rem 0.7rem;
  border-radius: var(--radius-sm);
  color: inherit;
  text-decoration: none;
}

.result.is-active .result__link,
.result__link:hover {
  background: var(--bg-sunk);
}

.result__title {
  display: block;
  font-family: var(--heading-font);
  font-size: 0.98rem;
  font-weight: 700;
}

.result__crumb {
  display: block;
  color: var(--text-soft);
  font-size: 0.78rem;
}

.result__sep {
  margin: 0 0.35rem;
}

.result__text {
  display: block;
  margin-top: 0.2rem;
  color: var(--text-soft);
  font-size: 0.86rem;
  line-height: 1.5;
}

.result__empty {
  margin: 0;
  padding: 0.7rem;
  color: var(--text-soft);
  font-size: 0.9rem;
}

mark {
  padding: 0 0.1em;
  border-radius: 3px;
  background: color-mix(in srgb, var(--accent) 22%, transparent);
  color: inherit;
}

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

.search-full {
  max-width: 40rem;
}

.search-full__field {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.7rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-soft);
}

.search-full__field:focus-within {
  border-color: var(--accent);
}

.search-full__icon {
  flex: none;
  width: 1.2rem;
  height: 1.2rem;
  color: var(--text-soft);
}

.search-full__input {
  width: 100%;
  min-width: 0;
  border: 0;
  background: none;
  color: var(--text);
  font-family: inherit;
  font-size: 1.05rem;
}

.search-full__input:focus {
  outline: none;
}

.search-full__status {
  margin: 0.8rem 0 0;
  color: var(--text-soft);
  font-size: 0.92rem;
}

.search-full__results {
  display: grid;
  gap: 0.7rem;
  max-width: 46rem;
  margin-top: 1.6rem;
}

.result-card {
  display: block;
  padding: 1.1rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-soft);
  color: inherit;
  text-decoration: none;
}

.result-card:hover {
  border-color: var(--accent);
}

.result-card__title {
  margin: 0;
  font-family: var(--heading-font);
  font-size: 1.1rem;
  font-weight: 700;
}

.result-card__text {
  margin: 0.4rem 0 0;
  color: var(--text-soft);
  font-size: 0.94rem;
}

.nav-toggle {
  display: none;
  margin-left: 0.4rem;
  width: 2.6rem;
  height: 2.6rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  cursor: pointer;
}

.nav-toggle__bar,
.nav-toggle__bar::before,
.nav-toggle__bar::after {
  display: block;
  width: 1.1rem;
  height: 2px;
  margin: 0 auto;
  background: var(--text);
  content: "";
}

.nav-toggle__bar::before {
  transform: translateY(-6px);
}

.nav-toggle__bar::after {
  transform: translateY(4px);
}

/* ---------- shell ---------- */

.shell {
  display: grid;
  max-width: var(--page);
  margin: 0 auto;
  padding: 0 1.25rem;
}

.layout-docs .shell {
  grid-template-columns: 15rem minmax(0, 1fr) 13rem;
  gap: 2.5rem;
  align-items: start;
}

.content {
  min-width: 0;
  padding: 2.5rem 0 4rem;
}

.layout-docs .content {
  grid-column: 2;
  grid-row: 1;
}

/* ---------- sidebar ---------- */

.sidebar {
  position: sticky;
  top: 4.6rem;
  padding: 2.5rem 0 2rem;
  font-size: 0.94rem;
  max-height: calc(100vh - 5rem);
  overflow-y: auto;
}

.sidebar__group + .sidebar__group {
  margin-top: 1.6rem;
}

.sidebar__heading {
  margin: 0 0 0.5rem;
  color: var(--text-soft);
  font-family: var(--body-font);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

.sidebar a {
  display: block;
  padding: 0.32rem 0.7rem;
  border-radius: var(--radius-sm);
  color: var(--text-soft);
  text-decoration: none;
}

.sidebar a:hover {
  background: var(--bg-sunk);
  color: var(--text);
}

.sidebar a[aria-current="page"] {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

/* ---------- table of contents ---------- */

/* A direct child of .shell, not of .content — inside .content it would stack
 * above the prose and its sticky positioning would ride over the text. */
.toc {
  grid-column: 3;
  grid-row: 1;
  position: sticky;
  top: 4.6rem;
  max-height: calc(100vh - 6rem);
  overflow-y: auto;
  padding: 2.9rem 0 2rem;
  font-size: 0.88rem;
}

.toc__heading {
  margin: 0 0 0.5rem;
  color: var(--text-soft);
  font-family: var(--body-font);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.toc ul {
  margin: 0;
  padding: 0;
  border-left: 1px solid var(--border);
  list-style: none;
}

.toc a {
  display: block;
  padding: 0.25rem 0 0.25rem 0.8rem;
  margin-left: -1px;
  border-left: 2px solid transparent;
  color: var(--text-soft);
  text-decoration: none;
}

.toc a:hover,
.toc a.is-active {
  border-left-color: var(--accent);
  color: var(--accent);
}

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

.prose {
  max-width: 46rem;
}

.prose > * + * {
  margin-top: 1.05rem;
}

.prose h1,
.prose h2,
.prose h3 {
  font-family: var(--heading-font);
  line-height: 1.25;
  text-wrap: balance;
}

.prose h1 {
  margin: 0 0 0.4rem;
  font-size: clamp(2rem, 4.5vw, 2.6rem);
  font-weight: 700;
  letter-spacing: -0.01em;
}

.prose h2 {
  margin-top: 2.6rem;
  padding-top: 0.4rem;
  font-size: 1.5rem;
  font-weight: 700;
}

.prose h3 {
  margin-top: 1.9rem;
  font-size: 1.15rem;
  font-weight: 600;
}

.prose .lede {
  color: var(--text-soft);
  font-size: 1.15rem;
}

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

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

.prose code {
  padding: 0.12em 0.36em;
  border-radius: 5px;
  background: var(--code-bg);
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.88em;
}

.prose kbd {
  padding: 0.05em 0.4em;
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--bg-soft);
  font-family: inherit;
  font-size: 0.85em;
}

.prose pre {
  margin: 0;
  padding: 1rem 1.1rem;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--code-bg);
  line-height: 1.5;
}

.prose pre code {
  padding: 0;
  background: none;
  font-size: 0.86rem;
}

.prose blockquote {
  margin: 1.4rem 0;
  padding: 0.1rem 0 0.1rem 1.1rem;
  border-left: 3px solid var(--accent);
  color: var(--text-soft);
}

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

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.93rem;
}

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

.prose thead th {
  background: var(--bg-soft);
  font-family: var(--heading-font);
  font-weight: 600;
  white-space: nowrap;
}

.prose tbody tr:last-child td {
  border-bottom: 0;
}

.note {
  padding: 1rem 1.15rem;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
  font-size: 0.95rem;
}

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

.note > :last-child {
  margin-bottom: 0;
}

.note--warn {
  border-left-color: var(--coral);
}

.note__label {
  display: block;
  margin-bottom: 0.2rem;
  font-family: var(--heading-font);
  font-weight: 700;
}

/* ---------- buttons ---------- */

.button {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.7rem 1.5rem;
  border: 0;
  border-radius: 999px;
  background: var(--coral);
  color: #fff;
  font-family: var(--heading-font);
  font-size: 1rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.button:hover {
  filter: brightness(0.94);
}

.button--ghost {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
}

.button--ghost:hover {
  background: var(--bg-sunk);
  filter: none;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-top: 1.6rem;
}

/* ---------- landing page ---------- */

.hero {
  padding: 3.5rem 0 1rem;
  text-align: center;
}

.hero__eyebrow {
  display: inline-block;
  margin-bottom: 1rem;
  padding: 0.3rem 0.85rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.hero h1 {
  margin: 0 auto 0.8rem;
  max-width: 22ch;
  font-family: var(--heading-font);
  font-size: clamp(2.3rem, 6vw, 3.7rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.hero p {
  margin: 0 auto;
  max-width: 52ch;
  color: var(--text-soft);
  font-size: 1.15rem;
}

.hero .button-row {
  justify-content: center;
}

.layout-page .content {
  padding-top: 0;
}

.layout-page .prose {
  max-width: none;
}

.section {
  padding: 3.5rem 0;
  border-top: 1px solid var(--border);
}

.section__head {
  max-width: 44rem;
  margin-bottom: 2rem;
}

.section__head h2 {
  margin: 0 0 0.5rem;
  font-family: var(--heading-font);
  font-size: clamp(1.6rem, 3.4vw, 2.1rem);
  font-weight: 700;
  letter-spacing: -0.01em;
}

.section__head p {
  margin: 0;
  color: var(--text-soft);
  font-size: 1.08rem;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: 1.1rem;
}

.card {
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-soft);
}

.card h3 {
  margin: 0 0 0.45rem;
  font-family: var(--heading-font);
  font-size: 1.1rem;
  font-weight: 700;
}

.card p {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.96rem;
}

.card__icon {
  display: block;
  margin-bottom: 0.7rem;
  font-size: 1.6rem;
}

.card--link {
  color: inherit;
  text-decoration: none;
}

.card--link:hover {
  border-color: var(--accent);
}

.feature {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(19rem, 1fr));
  gap: 2.5rem;
  align-items: center;
}

.feature + .feature {
  margin-top: 3.5rem;
  padding-top: 3.5rem;
  border-top: 1px dashed var(--border);
}

.feature h3 {
  margin: 0 0 0.6rem;
  font-family: var(--heading-font);
  font-size: 1.5rem;
  font-weight: 700;
}

.feature ul {
  margin: 1rem 0 0;
  padding-left: 1.2rem;
  color: var(--text-soft);
}

.shot {
  margin: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-sunk);
  overflow: hidden;
}

.shot img {
  display: block;
  width: 100%;
}

.shot__placeholder {
  display: grid;
  place-items: center;
  min-height: 15rem;
  padding: 2rem;
  color: var(--text-soft);
  font-size: 0.9rem;
  text-align: center;
}

.shot figcaption {
  padding: 0.7rem 1rem;
  border-top: 1px solid var(--border);
  color: var(--text-soft);
  font-size: 0.85rem;
}

/* ---------- faq ---------- */

.faq {
  max-width: 46rem;
}

.faq details {
  border-bottom: 1px solid var(--border);
}

.faq summary {
  padding: 1rem 2rem 1rem 0;
  position: relative;
  font-family: var(--heading-font);
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}

.faq summary::-webkit-details-marker {
  display: none;
}

.faq summary::after {
  position: absolute;
  right: 0.35rem;
  content: "+";
  color: var(--accent);
  font-size: 1.3rem;
  line-height: 1;
}

.faq details[open] summary::after {
  content: "–";
}

.faq details > :not(summary) {
  margin: 0 0 1rem;
  color: var(--text-soft);
}

/* ---------- form ---------- */

.form {
  max-width: 34rem;
  margin-top: 1.8rem;
}

.field + .field {
  margin-top: 1.1rem;
}

.field label {
  display: block;
  margin-bottom: 0.3rem;
  font-family: var(--heading-font);
  font-weight: 600;
}

.field__hint {
  display: block;
  margin-bottom: 0.4rem;
  color: var(--text-soft);
  font-size: 0.88rem;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 1rem;
}

.field textarea {
  min-height: 9rem;
  resize: vertical;
}

.field input[type="file"] {
  padding: 0.5rem;
  background: var(--bg-soft);
}

.required {
  color: var(--coral);
}

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

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--bg-soft);
}

.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: space-between;
  align-items: center;
  max-width: var(--page);
  margin: 0 auto;
  padding: 1.8rem 1.25rem;
  color: var(--text-soft);
  font-size: 0.92rem;
}

.site-footer__inner p {
  margin: 0;
}

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1.1rem;
}

/* ---------- responsive ---------- */

@media (max-width: 68rem) {
  .layout-docs .shell {
    grid-template-columns: 14rem minmax(0, 1fr);
  }

  .toc {
    display: none;
  }
}

@media (max-width: 48rem) {
  .nav-toggle {
    display: block;
    order: 2;
    margin-left: auto;
  }

  .site-nav {
    display: none;
    order: 4;
    flex-direction: column;
    width: 100%;
    margin: 0.6rem 0 0;
  }

  .site-header__inner {
    flex-wrap: wrap;
  }

  .brand {
    order: 1;
  }

  /* The field gets its own row: on a phone it would otherwise squeeze the logo
   * and the menu button into nothing. */
  .site-search {
    order: 3;
    width: 100%;
    margin: 0.55rem 0 0;
  }

  .site-search__key {
    display: none;
  }

  .site-search__results {
    width: 100%;
  }

  .site-nav.is-open {
    display: flex;
  }

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

  .sidebar {
    position: static;
    max-height: none;
    padding: 1.5rem 0 0;
    border-bottom: 1px solid var(--border);
  }

  .layout-docs .content {
    grid-column: 1;
    grid-row: auto;
    padding-top: 1.75rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  * {
    transition-duration: 0.01ms !important;
  }
}
