/* ==========================================================================
   Appservices — the guides page /docs (P11 D-412; P11 PR-4 owns this file). Linked after site2.css, whose tokens it
   uses (no colour literal here: the figures are drawn through the f-* classes below, so they follow light and dark).
   Logical properties (RTL mirrors itself) except inside the figures, which stay left-to-right: they show Chrome's
   English screens. No animation, so nothing to calm under reduced motion.
   ========================================================================== */

/* Text on --brand-soft: the brand text in light (7.5:1); in dark it would be 3.9:1, so the plain text colour. */
.docs { --docs-on-soft: var(--brand-text); }
:root[data-theme="dark"] .docs { --docs-on-soft: var(--text); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .docs { --docs-on-soft: var(--text); }
}

/* ── the head and the two columns ── */
.docs { background: var(--bg); }
.docs__head { padding-block: clamp(32px, 6vw, 64px) 8px; }
.docs__head h1 { font-size: clamp(32px, 4.6vw, 48px); font-weight: 800; letter-spacing: -.02em; }
.docs__lead { margin-block-start: 10px; max-width: 60ch; color: var(--text-2); font-size: clamp(16px, 1.5vw, 18px); }
.docs__layout { display: grid; grid-template-columns: 240px minmax(0, 760px); align-items: start; gap: 48px;
  padding-block: 32px 96px; }

/* ── the table of contents: a sticky column on desktop, a disclosure on phones ── */
.docs__toc { position: sticky; inset-block-start: calc(var(--header-h) + 24px); }
/* the body face: the display face's word spaces all but vanish at 14 px ("Onthispage"); AR/UR keep theirs */
.docs__toc-title { color: var(--muted); font: 700 14px/1.4 var(--as-font-body); }
.docs__toc ol { display: grid; gap: 2px; margin-block-start: 12px; padding-inline-start: 0;
  border-inline-start: 2px solid var(--line); }
.docs__toc a { display: flex; align-items: center; gap: 10px; min-height: 44px; margin-inline-start: -2px;
  padding: 8px 12px; border-inline-start: 2px solid transparent; color: var(--text-2); font-size: 15px;
  line-height: 1.35; text-decoration: none; }
.docs__toc a:hover { border-inline-start-color: var(--brand); color: var(--docs-on-soft);
  background: var(--brand-soft); }
.docs__toc .icon { width: 18px; height: 18px; color: var(--brand-text); }
.docs__toc-m { display: none; border: 1px solid var(--line); border-radius: var(--as-radius-14);
  background: var(--surface); }
.docs__toc-m summary { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 48px; padding: 10px 16px; font-weight: 600; cursor: pointer; list-style: none; }
.docs__toc-m summary::-webkit-details-marker { display: none; }
.docs__toc-m[open] summary .icon { transform: rotate(180deg); }
.docs__toc-m ol { display: grid; padding: 0 8px 8px; }
.docs__toc-m a { display: flex; align-items: center; min-height: 44px; padding: 8px; border-radius: var(--as-radius-10);
  color: var(--text-2); text-decoration: none; }
.docs__toc-m a:hover { background: var(--brand-soft); color: var(--docs-on-soft); }

/* ── a guide ── */
.docs__content { display: grid; gap: 32px; min-width: 0; }
.docs__guide { min-width: 0; padding: clamp(20px, 4vw, 36px); border: 1px solid var(--line);
  border-radius: var(--as-radius-20); background: var(--surface); box-shadow: var(--shadow-s); }
.docs__guide-head { display: flex; align-items: center; gap: 14px; }
.docs__guide-head h2 { font-size: clamp(22px, 2.6vw, 28px); }
.docs__tile { display: inline-grid; place-items: center; flex: none; width: 44px; height: 44px;
  border-radius: var(--as-radius-12); background: var(--brand-soft); color: var(--brand-text); }
.docs__tile .icon { width: 22px; height: 22px; }
.docs__intro { margin-block-start: 12px; color: var(--text-2); }
.docs__need { display: flex; align-items: flex-start; gap: 8px; margin-block-start: 12px; color: var(--muted);
  font-size: 15px; }
.docs__need .icon { width: 18px; height: 18px; margin-block-start: 3px; }
.docs__sub { margin-block-start: 32px; padding-block-start: 24px; border-block-start: 1px solid var(--line); }
.docs__sub h3 { display: flex; align-items: center; gap: 10px; font-size: 19px; }
.docs__sub h3 .icon { color: var(--brand-text); }

/* the numbered steps: Western digits in every language, matching the figures' badges */
.docs__steps { counter-reset: step; display: grid; gap: 4px; margin-block-start: 20px; }
.docs__steps > li { position: relative; min-height: 32px; padding-block: 4px 12px; padding-inline-start: 48px;
  counter-increment: step; }
.docs__steps > li::before { content: counter(step); position: absolute; inset-block-start: 0;
  inset-inline-start: 0; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%;
  background: var(--brand-soft); color: var(--docs-on-soft); font-weight: 700; font-size: 15px;
  font-family: var(--as-font-body); }
.docs__steps > li:not(:last-child)::after { content: ""; position: absolute; inset-block: 36px 0;
  inset-inline-start: 15px; width: 2px; background: var(--line); }
.docs code { padding: 2px 6px; border-radius: var(--as-radius-8); background: var(--surface-2);
  font: 500 .92em/1.4 var(--as-font-mono); unicode-bidi: isolate; }

.docs__actions { margin-block-start: 20px; }
.docs__actions .btn { max-width: 100%; white-space: normal; text-align: center; }
.docs__note { display: flex; align-items: flex-start; gap: 10px; margin-block-start: 20px; padding: 12px 16px;
  border-inline-start: 3px solid var(--brand); border-radius: var(--as-radius-12); background: var(--brand-soft);
  color: var(--text); font-size: 15px; }
.docs__note .icon { margin-block-start: 2px; color: var(--brand-text); }
.docs__more { margin-block-start: 16px; color: var(--text-2); }
.docs__more a { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; font-weight: 600; }
.docs__more .icon { width: 18px; height: 18px; }

/* ── for developers ── */
.docs__links { display: grid; gap: 8px; margin-block-start: 20px; }
.docs__links a { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px;
  padding: 10px 16px; border: 1px solid var(--line-2); border-radius: var(--as-radius-12); color: var(--text);
  font-weight: 600; text-decoration: none; }
.docs__links a:hover { border-color: var(--brand); color: var(--brand-text); }
.docs__links .icon { width: 18px; height: 18px; color: var(--muted); }
.docs__code-title { margin-block-start: 28px; font-size: 17px; }
.docs__code { margin: 10px 0 0; padding: 16px; overflow-x: auto; border: 1px solid var(--line);
  border-radius: var(--as-radius-12); background: var(--bg-2); color: var(--text); text-align: start;
  font: 500 13.5px/1.7 var(--as-font-mono); white-space: pre; }
.docs__code code { padding: 0; background: none; font: inherit; }
.docs__stuck { padding-inline: 4px; color: var(--muted); }

/* ── the figures (inline SVG; drawn left to right in every language)
   Phones: the drawing keeps 560 px (its smallest words stay 12 px and more) and scrolls inside its frame, which
   starts at the left in every language; wider screens show it whole. */
.docs-fig { margin-block-start: 24px; }
.docs-fig__scroll { overflow-x: auto; overscroll-behavior-x: contain; border: 1px solid var(--line);
  border-radius: var(--as-radius-16); direction: ltr; }
.docs-fig__art { display: block; width: 100%; min-width: 560px; height: auto; direction: ltr; unicode-bidi: isolate; }
.docs-fig figcaption { margin-block-start: 10px; color: var(--muted); font-size: 14px; }
.docs-fig text { font-family: var(--as-font-body); }
.f-page { fill: var(--bg-2); }
.f-win { fill: var(--surface); stroke: var(--line-2); stroke-width: 1.5; }
.f-raise { filter: drop-shadow(0 6px 14px color-mix(in srgb, var(--text) 14%, transparent)); }
.f-bar { fill: var(--surface-2); }
.f-pane { fill: var(--surface-2); }
.f-sep { stroke: var(--line); stroke-width: 1.5; fill: none; }
.f-dot { fill: var(--line-2); }
.f-field { fill: var(--bg-2); stroke: var(--line-2); stroke-width: 1.5; }
.f-ln { fill: var(--line); }
.f-ln2 { fill: var(--line-2); }
.f-tile { fill: var(--brand-soft); }
.f-sel { fill: var(--brand-soft); stroke: var(--brand); stroke-width: 2; }
.f-btn { fill: var(--brand); }
.f-btn2 { fill: var(--surface); stroke: var(--line-2); stroke-width: 1.5; }
.f-knob { fill: var(--on-brand); }
.f-okbox { fill: color-mix(in srgb, var(--ok) 16%, var(--surface)); stroke: var(--ok); stroke-width: 1.5; }
.f-ring { fill: none; stroke: var(--brand); stroke-width: 3; }
.f-ring-s { fill: none; stroke: var(--muted); stroke-width: 2; }
.f-badge { fill: var(--brand); stroke: var(--surface); stroke-width: 3; }
.f-flow { fill: none; stroke: var(--brand); stroke-width: 3; stroke-dasharray: 6 6; stroke-linecap: round; }
.f-flow-head { fill: none; stroke: var(--brand); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.f-ico, .f-ok-ico, .f-on-ico, .f-mut-ico { fill: none; stroke-width: 2; stroke-linecap: round;
  stroke-linejoin: round; }
.f-ico { stroke: var(--brand-text); }
.f-ok-ico { stroke: var(--ok); stroke-width: 2.6; }
.f-on-ico { stroke: var(--on-brand); stroke-width: 2.6; }
.f-mut-ico { stroke: var(--muted); }
.f-t { fill: var(--text); }
.f-t2 { fill: var(--text-2); }
.f-mut { fill: var(--muted); }
.f-btn-t { fill: var(--on-brand); font-weight: 600; }
.f-badge-t { fill: var(--on-brand); font-size: 17px; font-weight: 800; }
.f-num { fill: var(--docs-on-soft); font-size: 15px; font-weight: 700; }
.f-b { font-weight: 700; }
.f-xs { font-size: 14px; }
.f-s { font-size: 15px; }
.f-m { font-size: 17px; }
.f-l { font-size: 21px; }
.f-mono { font-family: var(--as-font-mono); }
.docs-fig text.f-mono { font-family: var(--as-font-mono); }

/* ── phones: one column, the table of contents folds ── */
@media (max-width: 980px) {
  .docs__layout { grid-template-columns: minmax(0, 1fr); gap: 24px; padding-block-start: 16px; }
  .docs__toc { display: none; }
  .docs__toc-m { display: block; }
}
@media (max-width: 480px) {
  .docs__guide { border-radius: var(--as-radius-16); }
  .docs__guide-head { align-items: flex-start; }
  .docs__steps > li { padding-inline-start: 44px; }
  .docs-fig__scroll { border-radius: var(--as-radius-12); }
}
@media (forced-colors: active) {
  .f-ring, .f-flow, .f-flow-head { stroke: Highlight; }
  .f-badge, .f-btn { fill: Highlight; }
}
