/* ==========================================================================
   Gloty documentation — shared stylesheet
   --------------------------------------------------------------------------
   Self-contained by design: no external fonts, no CDN, no build step. The
   marketing site's CSP (`font-src 'self' data:`, `style-src 'self'`) forbids
   remote assets, so every token lives here. Colours are the same brand scale
   as the marketing surface (WP blue #2271b1 anchored), re-declared as plain
   custom properties because these pages are served from /public and never
   touch Tailwind.
   ========================================================================== */

:root {
  /* Brand */
  --brand-50: #eef6fc;
  --brand-100: #d6e9f8;
  --brand-200: #b0d3f0;
  --brand-300: #7bb5e4;
  --brand-500: #2271b1;
  --brand-600: #1b5f97;
  --brand-700: #164e78;
  --brand-900: #0e2f49;

  --azure: #38bdf8;
  --iris: #6366f1;

  /* Ink + surfaces */
  --ink: #0b1b2b;
  --ink-soft: #45586b;
  --muted: #5c6a78;
  --canvas: #ffffff;
  --canvas-alt: #f6f9fd;
  --canvas-cool: #eef3f8;
  --line: #e2e8f0;
  --line-soft: #eef2f6;

  /* Semantic */
  --success: #00a32a;
  --success-ink: #0a6b25;
  --warn: #dba617;
  --warn-ink: #7a5300;
  --danger: #d63638;
  --danger-ink: #a51f21;

  /* Type */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas,
    "Liberation Mono", monospace;

  /* Shape */
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;

  --sidebar-w: 264px;
  --toc-w: 208px;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --brand-50: #0f2334;
    --brand-100: #14304a;
    --brand-200: #1b4066;
    --brand-300: #2f6d9e;
    --brand-500: #62aade;
    --brand-600: #8cc4ea;
    --brand-700: #b0d9f4;
    --brand-900: #d8ecfa;

    --ink: #e8eef5;
    --ink-soft: #b3c2d1;
    --muted: #93a3b3;
    --canvas: #0b1622;
    --canvas-alt: #101f2e;
    --canvas-cool: #16283a;
    --line: #22384d;
    --line-soft: #1a2c3e;

    --success-ink: #6cd18a;
    --warn-ink: #e8c05a;
    --danger-ink: #ef8a8c;

    color-scheme: dark;
  }
}

/* ── Reset-ish ───────────────────────────────────────────────────────────── */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 88px;
}

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

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

a {
  color: var(--brand-600);
  text-decoration-color: color-mix(in srgb, var(--brand-600) 35%, transparent);
  text-underline-offset: 2px;
}

a:hover {
  text-decoration-color: currentColor;
}

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

/* ── Skip link ───────────────────────────────────────────────────────────── */

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  background: var(--brand-500);
  color: #fff;
  padding: 10px 16px;
  border-radius: 0 0 var(--radius-sm) 0;
  text-decoration: none;
}

.skip:focus {
  left: 0;
}

/* ── Header ──────────────────────────────────────────────────────────────── */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 16px;
  height: 60px;
  padding: 0 20px;
  background: color-mix(in srgb, var(--canvas) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: none;
  font-size: 17px;
}

.brand__mark {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: linear-gradient(135deg, var(--brand-500), var(--iris));
  color: #fff;
  font-size: 13px;
  font-weight: 800;
}

.brand__sep {
  color: var(--line);
  font-weight: 400;
}

.brand__label {
  color: var(--muted);
  font-weight: 500;
}

.topbar__spacer {
  flex: 1;
}

.topbar__links {
  display: flex;
  align-items: center;
  gap: 18px;
  font-size: 14px;
}

.topbar__links a {
  color: var(--ink-soft);
  text-decoration: none;
}

.topbar__links a:hover {
  color: var(--brand-600);
}

.menu-toggle {
  display: none;
  align-items: center;
  gap: 8px;
  font: inherit;
  font-size: 14px;
  background: var(--canvas-alt);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  cursor: pointer;
}

/* ── Shell ───────────────────────────────────────────────────────────────── */

.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  gap: 40px;
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 24px;
  align-items: start;
}

/* ── Sidebar ─────────────────────────────────────────────────────────────── */

.sidebar {
  position: sticky;
  top: 60px;
  max-height: calc(100vh - 60px);
  overflow-y: auto;
  padding: 28px 0 48px;
}

.sidebar__group + .sidebar__group {
  margin-top: 24px;
}

.sidebar__title {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

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

.sidebar__list a {
  display: block;
  padding: 6px 12px;
  margin-left: -12px;
  border-radius: var(--radius-sm);
  font-size: 14.5px;
  color: var(--ink-soft);
  text-decoration: none;
}

.sidebar__list a:hover {
  background: var(--canvas-alt);
  color: var(--ink);
}

.sidebar__list a[aria-current="page"] {
  background: var(--brand-50);
  color: var(--brand-700);
  font-weight: 600;
}

/* ── Content ─────────────────────────────────────────────────────────────── */

.content {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--toc-w);
  gap: 48px;
  padding: 36px 0 96px;
  align-items: start;
}

.article {
  min-width: 0;
  max-width: 760px;
}

.eyebrow {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--brand-600);
  margin: 0 0 10px;
}

.article h1 {
  font-size: clamp(30px, 4vw, 40px);
  line-height: 1.15;
  letter-spacing: -0.025em;
  margin: 0 0 12px;
}

.lede {
  font-size: 18px;
  line-height: 1.6;
  color: var(--ink-soft);
  margin: 0 0 28px;
}

.article h2 {
  font-size: 24px;
  line-height: 1.25;
  letter-spacing: -0.015em;
  margin: 48px 0 14px;
  padding-top: 8px;
  scroll-margin-top: 84px;
}

.article h3 {
  font-size: 18px;
  line-height: 1.35;
  margin: 32px 0 10px;
  scroll-margin-top: 84px;
}

.article h4 {
  font-size: 15px;
  margin: 24px 0 8px;
  color: var(--ink);
}

.article p {
  margin: 0 0 16px;
}

.article ul,
.article ol {
  margin: 0 0 16px;
  padding-left: 22px;
}

.article li {
  margin-bottom: 7px;
}

.article li > ul,
.article li > ol {
  margin-top: 7px;
}

hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 40px 0;
}

/* Anchor links on headings */
.anchor {
  margin-left: 8px;
  color: var(--brand-300);
  text-decoration: none;
  opacity: 0;
  font-weight: 400;
  transition: opacity 0.15s;
}

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

/* ── Code ────────────────────────────────────────────────────────────────── */

code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--canvas-cool);
  border: 1px solid var(--line-soft);
  border-radius: 5px;
  padding: 1px 5px;
  word-break: break-word;
}

pre {
  margin: 0 0 20px;
  padding: 16px 18px;
  background: var(--canvas-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow-x: auto;
  font-size: 13.5px;
  line-height: 1.6;
}

pre code {
  background: none;
  border: 0;
  padding: 0;
  font-size: inherit;
  word-break: normal;
}

kbd {
  font-family: var(--font-sans);
  font-size: 12px;
  background: var(--canvas-alt);
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 1px 6px;
  white-space: nowrap;
}

/* A UI path: Gloty → Settings → Languages */
.path {
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
}

/* ── Tables ──────────────────────────────────────────────────────────────── */

.table-wrap {
  overflow-x: auto;
  margin: 0 0 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14.5px;
}

thead th {
  text-align: left;
  background: var(--canvas-alt);
  color: var(--ink);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.01em;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: top;
}

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

td code {
  white-space: nowrap;
}

/* ── Callouts ────────────────────────────────────────────────────────────── */

.callout {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 12px;
  margin: 0 0 22px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-left-width: 3px;
  border-radius: var(--radius-sm);
  background: var(--canvas-alt);
  font-size: 15px;
}

.callout p {
  margin: 0 0 8px;
}

.callout p:last-child,
.callout ul:last-child {
  margin-bottom: 0;
}

.callout__icon {
  font-size: 15px;
  line-height: 1.6;
}

.callout__title {
  font-weight: 700;
  color: var(--ink);
}

.callout--note {
  border-left-color: var(--brand-500);
}

.callout--tip {
  border-left-color: var(--success);
}

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

.callout--danger {
  border-left-color: var(--danger);
}

/* ── Pills / badges ──────────────────────────────────────────────────────── */

.pill {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--canvas-alt);
  color: var(--ink-soft);
  white-space: nowrap;
  vertical-align: middle;
}

.pill--ok {
  border-color: color-mix(in srgb, var(--success) 40%, transparent);
  color: var(--success-ink);
  background: color-mix(in srgb, var(--success) 10%, transparent);
}

.pill--warn {
  border-color: color-mix(in srgb, var(--warn) 45%, transparent);
  color: var(--warn-ink);
  background: color-mix(in srgb, var(--warn) 12%, transparent);
}

.pill--danger {
  border-color: color-mix(in srgb, var(--danger) 40%, transparent);
  color: var(--danger-ink);
  background: color-mix(in srgb, var(--danger) 10%, transparent);
}

.pill--brand {
  border-color: color-mix(in srgb, var(--brand-500) 40%, transparent);
  color: var(--brand-700);
  background: var(--brand-50);
}

/* ── Card grid (docs index) ──────────────────────────────────────────────── */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
  margin: 0 0 28px;
  padding: 0;
  list-style: none;
}

.card {
  display: block;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--canvas);
  text-decoration: none;
  color: inherit;
  transition:
    border-color 0.15s,
    transform 0.15s,
    box-shadow 0.15s;
}

.card:hover {
  border-color: var(--brand-300);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px -12px rgba(34, 113, 177, 0.45);
}

.card__title {
  display: block;
  font-weight: 650;
  font-size: 15.5px;
  color: var(--ink);
  margin-bottom: 5px;
}

.card__body {
  display: block;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.55;
}

/* ── Numbered steps ──────────────────────────────────────────────────────── */

.steps {
  counter-reset: step;
  list-style: none;
  margin: 0 0 24px;
  padding: 0;
}

.steps > li {
  counter-increment: step;
  position: relative;
  padding-left: 42px;
  margin-bottom: 22px;
}

.steps > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: var(--brand-50);
  border: 1px solid color-mix(in srgb, var(--brand-500) 30%, transparent);
  color: var(--brand-700);
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
}

.steps h3 {
  margin: 2px 0 6px;
  font-size: 16.5px;
}

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

/* ── Definition rows ─────────────────────────────────────────────────────── */

.deflist {
  margin: 0 0 24px;
  border-top: 1px solid var(--line-soft);
}

.deflist > div {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 20px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line-soft);
}

.deflist dt {
  font-weight: 600;
  font-size: 14.5px;
}

.deflist dd {
  margin: 0;
  font-size: 15px;
  color: var(--ink-soft);
}

.deflist dd :last-child {
  margin-bottom: 0;
}

/* ── Pipeline diagram ────────────────────────────────────────────────────── */

.flow {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 8px;
  margin: 0 0 26px;
  padding: 0;
  list-style: none;
}

.flow li {
  flex: 1 1 130px;
  margin: 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--canvas-alt);
  font-size: 13.5px;
  line-height: 1.45;
}

.flow li strong {
  display: block;
  font-size: 12px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--brand-600);
  margin-bottom: 4px;
}

/* ── On this page ────────────────────────────────────────────────────────── */

.toc {
  position: sticky;
  top: 84px;
  font-size: 13.5px;
  padding-top: 8px;
  max-height: calc(100vh - 110px);
  overflow-y: auto;
}

.toc__title {
  margin: 0 0 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

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

.toc li {
  margin: 0;
}

.toc a {
  display: block;
  padding: 4px 0 4px 12px;
  margin-left: -1px;
  border-left: 1px solid transparent;
  color: var(--muted);
  text-decoration: none;
  line-height: 1.4;
}

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

.toc a.is-active {
  color: var(--brand-600);
  border-left-color: var(--brand-500);
  font-weight: 600;
}

.toc .toc--h3 a {
  padding-left: 24px;
  font-size: 13px;
}

/* ── Page footer / pager ─────────────────────────────────────────────────── */

.pager {
  display: flex;
  gap: 12px;
  margin-top: 56px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}

.pager a {
  flex: 1;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s;
}

.pager a:hover {
  border-color: var(--brand-300);
}

.pager small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 3px;
}

.pager strong {
  color: var(--brand-600);
  font-size: 15px;
  font-weight: 600;
}

.pager .is-next {
  text-align: right;
}

.docmeta {
  margin-top: 32px;
  font-size: 13px;
  color: var(--muted);
}

.sitefoot {
  border-top: 1px solid var(--line);
  background: var(--canvas-alt);
  padding: 26px 24px;
  font-size: 13.5px;
  color: var(--muted);
}

.sitefoot__inner {
  max-width: 1320px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 14px 24px;
  align-items: center;
}

.sitefoot a {
  color: var(--ink-soft);
  text-decoration: none;
}

.sitefoot a:hover {
  color: var(--brand-600);
}

/* ── Responsive ──────────────────────────────────────────────────────────── */

@media (max-width: 1140px) {
  .content {
    grid-template-columns: minmax(0, 1fr);
  }

  .toc {
    display: none;
  }
}

@media (max-width: 900px) {
  .shell {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }

  .menu-toggle {
    display: inline-flex;
  }

  .topbar__links .is-optional {
    display: none;
  }

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

  .sidebar.is-open {
    display: block;
  }

  .content {
    padding-top: 26px;
  }

  .deflist > div {
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
  }
}

@media print {
  .topbar,
  .sidebar,
  .toc,
  .pager,
  .sitefoot {
    display: none !important;
  }

  .shell,
  .content {
    display: block;
    max-width: none;
  }
}
