/*
 * apps-support.tringify.com. Self-contained; a monochrome palette and
 * system type, light and dark from the visitor's colour scheme. Pages are
 * centred: one readable column, or the sidebar and the text on docs pages.
 */

:root {
  color-scheme: light dark;
  --bg: hsl(0 0% 100%);
  --fg: hsl(0 0% 7%);
  --fg-soft: hsl(0 0% 24%);
  --fg-muted: hsl(0 0% 42%);
  --surface: hsl(0 0% 98.5%);
  --raised: hsl(0 0% 100%);
  --inset: hsl(0 0% 95.5%);
  --border: hsl(0 0% 90%);
  --border-strong: hsl(0 0% 80%);
  --header: hsl(0 0% 100% / 0.78);
  --ring: hsl(0 0% 7%);
  --mark: hsl(48 96% 64% / 0.55);
  --warn-bg: hsl(43 96% 95%);
  --warn-border: hsl(38 92% 58%);
  --shadow: 0 1px 2px hsl(0 0% 0% / 0.04), 0 4px 16px hsl(0 0% 0% / 0.04);
  --radius: 12px;
  --radius-sm: 8px;
  --measure: 46rem;
  --font-sans:
    ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI Variable", "Segoe UI",
    Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --font-mono:
    ui-monospace, SFMono-Regular, "SF Mono", Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: hsl(0 0% 3.5%);
    --fg: hsl(0 0% 97%);
    --fg-soft: hsl(0 0% 82%);
    --fg-muted: hsl(0 0% 60%);
    --surface: hsl(0 0% 6%);
    --raised: hsl(0 0% 8%);
    --inset: hsl(0 0% 11%);
    --border: hsl(0 0% 15%);
    --border-strong: hsl(0 0% 26%);
    --header: hsl(0 0% 3.5% / 0.72);
    --ring: hsl(0 0% 90%);
    --mark: hsl(45 90% 50% / 0.32);
    --warn-bg: hsl(38 55% 10%);
    --warn-border: hsl(38 75% 42%);
    --shadow: 0 1px 2px hsl(0 0% 0% / 0.4), 0 8px 24px hsl(0 0% 0% / 0.25);
  }
}

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

html {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  scroll-padding-top: 5rem;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
  padding-block: 3rem 5rem;
}

/* Links are monochrome: the underline carries them. */
a {
  color: var(--fg);
  text-decoration: underline;
  text-decoration-color: var(--border-strong);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  transition:
    text-decoration-color 0.15s ease,
    color 0.15s ease,
    background 0.15s ease,
    border-color 0.15s ease;
}
a:hover {
  text-decoration-color: currentColor;
}

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

::selection {
  background: var(--fg);
  color: var(--bg);
}

.wrap {
  width: 100%;
  max-width: calc(var(--measure) + 6rem);
  margin-inline: auto;
  padding-inline: clamp(1rem, 4vw, 3rem);
}
/* Docs and API reference pages add the sidebar beside the text. */
body:has(.docs) .wrap {
  max-width: 80rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
  padding: 0;
}

.skip {
  position: absolute;
  left: 1rem;
  top: -3rem;
  padding: 0.5rem 0.75rem;
  background: var(--fg);
  color: var(--bg);
  border-radius: var(--radius-sm);
  text-decoration: none;
  z-index: 20;
}
.skip:focus {
  top: 0.75rem;
}

/* Header and footer */

.top {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--border);
  background: var(--header);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  backdrop-filter: saturate(160%) blur(14px);
}
.top .wrap {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.625rem;
  min-height: 3.75rem;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  color: var(--fg);
  font-weight: 650;
  font-size: 1rem;
  letter-spacing: -0.01em;
  text-decoration: none;
}
.mark {
  display: inline-grid;
  place-items: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 7px;
  background: var(--fg);
  color: var(--bg);
  font-size: 0.875rem;
  font-weight: 700;
  line-height: 1;
}
.by {
  color: var(--fg-muted);
  font-size: 0.875rem;
}
.by::before {
  content: "";
  display: inline-block;
  width: 1px;
  height: 0.875rem;
  margin-right: 0.625rem;
  vertical-align: -0.125rem;
  background: var(--border-strong);
}

.foot {
  border-top: 1px solid var(--border);
  color: var(--fg-muted);
  font-size: 0.8125rem;
}
.foot p {
  margin: 0;
  padding-block: 1.75rem;
}

/* Text */

h1 {
  font-size: clamp(2rem, 1.5rem + 1.8vw, 2.75rem);
  line-height: 1.12;
  letter-spacing: -0.035em;
  font-weight: 700;
  margin: 0 0 0.875rem;
  text-wrap: balance;
}
h2 {
  font-size: 1.25rem;
  font-weight: 650;
  letter-spacing: -0.015em;
  margin: 3rem 0 1rem;
}
.lead {
  font-size: 1.1875rem;
  line-height: 1.55;
  color: var(--fg-soft);
  max-width: var(--measure);
  text-wrap: pretty;
}
.muted {
  color: var(--fg-muted);
}

.intro {
  max-width: var(--measure);
}

.button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6875rem 1.125rem;
  border-radius: 999px;
  background: var(--fg);
  color: var(--bg);
  font-weight: 550;
  font-size: 0.9375rem;
  text-decoration: none;
}
.button::after {
  content: "→";
}
.button:hover {
  opacity: 0.88;
}

/* App hub */

.cards {
  list-style: none;
  padding: 0;
  margin: 2rem 0 0;
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
}
.cards a {
  position: relative;
  display: flex;
  align-items: flex-end;
  min-height: 7.5rem;
  padding: 1.25rem 1.375rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--raised);
  box-shadow: var(--shadow);
  color: var(--fg);
  font-weight: 600;
  font-size: 1.0625rem;
  letter-spacing: -0.01em;
  text-decoration: none;
}
.cards a::after {
  content: "↗";
  position: absolute;
  top: 1.125rem;
  right: 1.25rem;
  color: var(--fg-muted);
  font-weight: 400;
  transition:
    transform 0.15s ease,
    color 0.15s ease;
}
.cards a:hover {
  border-color: var(--border-strong);
}
.cards a:hover::after {
  color: var(--fg);
  transform: translate(2px, -2px);
}
.links {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.5rem;
}

/* Documents */

.doc {
  min-width: 0;
  max-width: var(--measure);
}
.doc-head {
  margin-bottom: 2.25rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1rem 0 0;
}
.chip {
  display: inline-flex;
  align-items: center;
  height: 1.875rem;
  padding: 0 0.75rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--fg-soft);
  font-size: 0.8125rem;
  font-weight: 500;
}
.chip-link {
  text-decoration: none;
}
.chip-link::after {
  content: "→";
  margin-left: 0.375rem;
  color: var(--fg-muted);
}
.chip-link:hover {
  border-color: var(--border-strong);
  color: var(--fg);
}

.banner {
  max-width: var(--measure);
  margin-bottom: 2rem;
  padding: 0.875rem 1.125rem;
  border: 1px solid var(--warn-border);
  border-radius: var(--radius);
  background: var(--warn-bg);
}
.banner p {
  margin: 0;
}

.badge {
  display: inline-block;
  margin-left: 0.5rem;
  padding: 0.0625rem 0.5rem;
  border-radius: 999px;
  background: var(--fg);
  color: var(--bg);
  font-size: 0.6875rem;
  font-weight: 650;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  vertical-align: 0.125rem;
}
.versions {
  list-style: none;
  max-width: var(--measure);
  padding: 0;
  margin: 2rem 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--raised);
  overflow: hidden;
}
.versions li {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.25rem 0.75rem;
  padding: 0.875rem 1.125rem;
}
.versions li + li {
  border-top: 1px solid var(--border);
}
.versions a {
  font-weight: 600;
  text-decoration: none;
}
.versions .muted {
  margin-left: auto;
  font-size: 0.875rem;
}

/* Rendered markdown (sanitized by appservice) */

.prose {
  overflow-wrap: anywhere;
  color: var(--fg-soft);
  font-size: 1.0625rem;
}
.prose > :first-child {
  margin-top: 0;
}
.prose strong,
.prose b {
  color: var(--fg);
  font-weight: 600;
}
.prose h1,
.prose h2,
.prose h3,
.prose h4,
.prose h5,
.prose h6 {
  color: var(--fg);
  line-height: 1.3;
  font-weight: 650;
  letter-spacing: -0.015em;
  margin: 2.75rem 0 0.875rem;
  text-wrap: balance;
}
.prose h1 {
  font-size: 1.625rem;
}
.prose h2 {
  font-size: 1.375rem;
}
.prose h3 {
  font-size: 1.125rem;
  margin-top: 2rem;
}
.prose h4,
.prose h5,
.prose h6 {
  font-size: 1rem;
  margin-top: 1.75rem;
}
.prose p,
.prose ul,
.prose ol,
.prose blockquote,
.prose pre,
.prose table {
  margin: 0 0 1.125rem;
}
.prose ul,
.prose ol {
  padding-left: 1.375rem;
}
.prose li + li {
  margin-top: 0.375rem;
}
.prose li::marker {
  color: var(--fg-muted);
}
.prose blockquote {
  padding: 0.875rem 1.125rem;
  border-left: 3px solid var(--fg);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--surface);
  color: var(--fg-soft);
}
.prose blockquote > :last-child {
  margin-bottom: 0;
}
.prose code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  padding: 0.125em 0.4em;
  border-radius: 6px;
  background: var(--inset);
  border: 1px solid var(--border);
  color: var(--fg);
}
.prose pre {
  padding: 1rem 1.125rem;
  overflow-x: auto;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 0.875rem;
  line-height: 1.6;
}
.prose pre code {
  padding: 0;
  border: 0;
  background: none;
  font-size: inherit;
}
.prose img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
}
.prose hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 2.5rem 0;
}
.prose table {
  display: block;
  overflow-x: auto;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9375rem;
}
.prose th,
.prose td {
  padding: 0.625rem 0.875rem;
  text-align: left;
  vertical-align: top;
}
.prose td {
  border-top: 1px solid var(--border);
}
.prose th + th,
.prose td + td {
  border-left: 1px solid var(--border);
}
.prose th {
  background: var(--surface);
  color: var(--fg);
  font-weight: 600;
  font-size: 0.8125rem;
}

/* Docs */

.docs {
  display: grid;
  gap: 2.5rem;
}
@media (min-width: 900px) {
  .docs {
    grid-template-columns: 17rem minmax(0, 1fr);
    gap: clamp(2.5rem, 5vw, 5rem);
  }
  .docs-nav {
    position: sticky;
    top: 5.25rem;
    align-self: start;
    max-height: calc(100vh - 6.5rem);
    overflow-y: auto;
  }
}
.nav-label {
  margin: 1.5rem 0 0.5rem;
  padding-left: 0.875rem;
  color: var(--fg-muted);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.docs-nav ol {
  list-style: none;
  padding: 0;
  margin: 0;
  border-left: 1px solid var(--border);
}
.docs-nav a {
  display: block;
  margin-left: -1px;
  padding: 0.4375rem 0.875rem;
  border-left: 2px solid transparent;
  color: var(--fg-muted);
  text-decoration: none;
  font-size: 0.9375rem;
  line-height: 1.45;
}
.docs-nav a:hover {
  color: var(--fg);
  border-left-color: var(--border-strong);
}
.docs-nav a[aria-current="page"] {
  color: var(--fg);
  border-left-color: var(--fg);
  font-weight: 600;
}

.search {
  position: relative;
  display: flex;
}
.search-icon {
  position: absolute;
  left: 0.8125rem;
  top: 50%;
  width: 1rem;
  height: 1rem;
  transform: translateY(-50%);
  fill: none;
  stroke: var(--fg-muted);
  stroke-width: 2;
  stroke-linecap: round;
  pointer-events: none;
}
.search input {
  flex: 1;
  min-width: 0;
  height: 2.625rem;
  padding: 0 0.875rem 0 2.375rem;
  font: inherit;
  font-size: 0.9375rem;
  color: var(--fg);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  transition:
    border-color 0.15s ease,
    background 0.15s ease;
}
.search input::placeholder {
  color: var(--fg-muted);
}
.search input:hover {
  border-color: var(--border-strong);
}
.search input:focus {
  outline: none;
  border-color: var(--fg);
  background: var(--bg);
}
.doc .search {
  max-width: 32rem;
  margin: 1.5rem 0 0.5rem;
}

.results {
  list-style: none;
  padding: 0;
  margin: 1.5rem 0 0;
  display: grid;
  gap: 0.75rem;
}
.results li {
  padding: 1rem 1.125rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--raised);
}
.results a {
  font-weight: 600;
  text-decoration: none;
}
.results a:hover {
  text-decoration: underline;
}
.results p {
  margin: 0.375rem 0 0;
  color: var(--fg-muted);
  font-size: 0.9375rem;
}
mark {
  background: var(--mark);
  color: inherit;
  border-radius: 3px;
  padding: 0 0.125em;
}

.pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 3.5rem;
}
.pager a {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 1rem 1.125rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--raised);
  text-decoration: none;
  font-weight: 600;
}
.pager a:hover {
  border-color: var(--border-strong);
}
.pager a span {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--fg-muted);
}
.pager .prev span::before {
  content: "← ";
}
.pager .next {
  grid-column: 2;
  text-align: right;
}
.pager .next span::after {
  content: " →";
}
@media (max-width: 560px) {
  .pager {
    grid-template-columns: 1fr;
  }
  .pager .next {
    grid-column: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
