/* ===================================================================
   The docs page (src/pages/docs.html). Shared building blocks are in style/pages.css; only this page's own parts go here.

   big animation .... .doc-stage: three panels — .doc-p-copy (StaSee: the code and its Copy button), .doc-p-edit (the website's
                      page in a code editor: the line types itself before </head>), .doc-p-live (StaSee: the first visit arrives)
   the docs ......... .doc-layout > .doc-toc (the sections; follows the reader on a wide screen) + .doc-main > .doc-part[id]
                      (.doc-h, .prose, .code-box.doc-box, .doc-dots, .doc-steps, .doc-plats, .doc-split, .doc-note, .doc-api)
   small ones ....... .doc-fx: .doc-spa (an address that changes, page views counted) and .doc-cs (consent: yes / no)
   =================================================================== */

/* ===================================================================
   The big animation
   =================================================================== */

.doc-stage {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.12fr);
    grid-template-areas:
        "copy edit"
        "live edit";
    align-items: start;
    gap: clamp(16px, 2vw, 28px);
    max-width: 1160px;
    margin-inline: auto;
}

.doc-p-copy { grid-area: copy; }
.doc-p-live { grid-area: live; }

/* the editor is as tall as its code (stretched to both panels beside it, it was half an empty dark block) */
.doc-p-edit {
    grid-area: edit;
    align-self: start;
}

.doc-panel {
    min-width: 0;
}

.doc-panel .app-frame {
    max-width: none;
}

/* "1 Copy your code": the step over each panel */
.doc-step {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;

    font-size: 14.5px;
    font-weight: 800;
}

.doc-step-n {
    display: grid;
    place-items: center;
    flex: none;

    width: 26px;
    height: 26px;

    border-radius: 50%;
    background: var(--color-green-ink);
    color: #ffffff;
    font-size: 13px;
}

:root[data-theme="dark"] .doc-step-n {
    background: var(--color-green);
    color: var(--color-green-ink);
}

.doc-step code {
    padding: 1px 6px;

    border: 1px solid color-mix(in srgb, var(--color-text) 14%, transparent);
    border-radius: 6px;
    background: color-mix(in srgb, var(--color-bg) 60%, transparent);

    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: .88em;
}

/* a website's badge (initials on its colour), as the app shows it */
.doc-fav {
    display: inline-grid;
    place-items: center;
    flex: none;

    width: 26px;
    height: 26px;

    border-radius: 7px;
    background: color-mix(in srgb, var(--s) 16%, var(--color-bg));

    font-size: 10px;
    font-style: normal;
    font-weight: 800;
    color: color-mix(in srgb, var(--s) 72%, #000000);
}

:root[data-theme="dark"] .doc-fav {
    background: color-mix(in srgb, var(--s) 24%, var(--color-bg-soft));
    color: color-mix(in srgb, var(--s) 55%, #ffffff);
}

/* ----- 1: the code in StaSee ----- */

.doc-copy {
    display: grid;
    gap: 12px;
}

.doc-copy-t {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 800;
}

/* the Copy button's two words share one place, so the button keeps its size */
.doc-copy-say {
    display: grid;
}

.doc-copy-say > span {
    grid-area: 1 / 1;
    visibility: hidden;
}

.doc-copy-say > span.is-on {
    visibility: visible;
}

.code-copy.is-press {
    transform: scale(.92);
}

.doc-p-copy .code-copy {
    transition: background-color .2s ease, color .2s ease, transform .16s var(--ease);
}

/* ----- 2: the website's page in a code editor ----- */

.doc-editor {
    overflow: hidden;

    border: 1px solid #1e293b;
    border-radius: clamp(14px, 1.6vw, 20px);
    background: #0b1120;
    box-shadow:
        0 34px 80px -34px rgba(5, 46, 22, .45),
        0 14px 32px -18px rgba(15, 23, 42, .22);
}

:root[data-theme="dark"] .doc-editor {
    border-color: var(--color-border);
    background: #060a14;
    box-shadow: 0 34px 80px -28px rgba(0, 0, 0, .75);
}

.doc-editor-bar {
    display: flex;
    align-items: center;
    gap: 14px;

    height: 40px;
    padding-inline: 14px;

    border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.doc-editor-bar .app-dots i {
    background: rgba(255, 255, 255, .18);
}

.doc-file {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12.5px;
    font-weight: 700;
    color: #cbd5e1;
}

.doc-saved {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-inline-start: auto;

    height: 24px;
    padding-inline: 10px;

    border-radius: 999px;
    background: rgba(34, 197, 94, .16);

    font-size: 12px;
    font-weight: 800;
    color: #86efac;

    opacity: 0;
    transform: translateY(-4px);
    transition: opacity .35s ease, transform .45s var(--ease);
}

.doc-saved svg {
    width: 13px;
    height: 13px;
}

.doc-saved.is-on {
    opacity: 1;
    transform: none;
}

.doc-code {
    counter-reset: ln;
    padding: 14px 16px 18px 0;

    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 13.5px;
    line-height: 1.7;
    color: #e2e8f0;
    text-align: left; /* code reads left to right in every language */

    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.doc-code code {
    font-family: inherit;
}

/* a line with its number; a long line wraps under itself */
.doc-ln {
    position: relative;
    display: block;
    min-height: 1.7em;
    padding-left: 3.4em;
}

.doc-ln::before {
    counter-increment: ln;
    content: counter(ln);
    position: absolute;
    left: 0;
    width: 2.4em;
    color: #475569;
    text-align: right;
}

/* the new line: lit while it is typed, then the light fades */
.doc-ln-new {
    transition: background-color 1.2s ease;
}

.doc-ln-new.is-typing,
.doc-ln-new.is-pasted {
    background: rgba(34, 197, 94, .12);
}

.doc-ln-new.is-typing::before {
    color: #86efac;
}

.doc-caret {
    display: none;
    width: 2px;
    height: 1.15em;
    margin-left: 1px;
    vertical-align: text-bottom;
    background: #86efac;
}

.doc-ln-new.is-typing .doc-caret {
    display: inline-block;
    animation: doc-caret 1.1s steps(1) infinite;
}

@keyframes doc-caret {
    50% { opacity: 0; }
}

#DOC_TYPED {
    transition: opacity .4s ease;
}

#DOC_TYPED.is-out {
    opacity: 0;
}

/* ----- 3: StaSee receives the first visit ----- */

.doc-live {
    display: grid;
    gap: 10px;
}

.doc-site,
.doc-online,
.doc-visit {
    border: 1px solid var(--color-border-soft);
    border-radius: 12px;
    background: var(--color-bg);
    box-shadow: var(--shadow-sm);
}

:root[data-theme="dark"] :is(.doc-site, .doc-online, .doc-visit) {
    border-color: var(--color-border);
    background: var(--color-bg-soft);
}

.doc-site {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
}

.doc-site-name {
    display: grid;
    min-width: 0;
    line-height: 1.3;
}

.doc-site-name b {
    font-size: 13.5px;
    font-weight: 800;
}

.doc-site-name small {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-soft);
}

/* "Waiting for the first visit" turns into "Live", in one place */
.doc-status {
    display: grid;
    justify-items: end;
    margin-inline-start: auto;
}

.doc-status > span {
    grid-area: 1 / 1;
    display: inline-flex;
    align-items: center;
    gap: 7px;

    height: 26px;
    padding-inline: 10px;

    border: 1px solid var(--color-border);
    border-radius: 999px;

    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;

    transition: opacity .4s ease, transform .5s var(--ease);
}

.doc-status-wait {
    background: var(--color-bg-soft);
    color: var(--color-text-soft);
}

.doc-status-live {
    border-color: color-mix(in srgb, var(--color-green) 45%, var(--color-border));
    background: var(--color-green-soft);
    color: var(--green-text);
    opacity: 0;
    transform: scale(.85);
}

.doc-status.is-live .doc-status-wait {
    opacity: 0;
    transform: scale(.85);
}

.doc-status.is-live .doc-status-live {
    opacity: 1;
    transform: none;
}

/* waiting: a grey dot that breathes slowly (only while the animation runs) */
.doc-wait-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-text-muted);
    animation: doc-breathe 2s ease-in-out infinite;
}

@keyframes doc-breathe {
    50% { opacity: .35; }
}

.doc-online {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 14px;

    font-size: 13px;
    font-weight: 700;
    color: var(--color-text-soft);
}

.doc-online b {
    font-size: 26px;
    font-weight: 800;
    color: var(--color-text);
    font-variant-numeric: tabular-nums;
    transition: color .6s ease;
}

.doc-online b.is-changed {
    color: var(--green-text);
}

.doc-feed {
    display: grid;
    align-content: start;
    gap: 6px;
    min-height: calc(2 * 44px + 6px);
}

.doc-visit {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;

    height: 44px;
    padding-inline: 12px;

    opacity: 0;
    transform: translateY(-10px);
    transition: opacity .45s ease, transform .6s var(--ease);
}

.doc-visit.is-in {
    opacity: 1;
    transform: none;
}

.doc-feed.is-out .doc-visit {
    opacity: 0;
    transform: none;
}

.doc-visit-ok {
    display: grid;
    place-items: center;

    width: 22px;
    height: 22px;

    border-radius: 50%;
    background: var(--color-green);
    color: var(--color-green-ink);
}

.doc-visit-ok svg {
    width: 13px;
    height: 13px;
}

.doc-visit-t {
    overflow: hidden;
    font-size: 13px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.doc-visit-t code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-soft);
}

.doc-visit-when {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-soft);
    white-space: nowrap;
}

/* "Your first visit is here." with a check that draws itself */
.doc-first {
    display: flex;
    align-items: center;
    gap: 9px;

    font-size: 14px;
    font-weight: 800;
    color: var(--green-text);

    opacity: 0;
    transition: opacity .4s ease;
}

.doc-first.is-on {
    opacity: 1;
}

.doc-first svg {
    flex: none;
    width: 26px;
    height: 26px;
    fill: none;
    stroke: var(--color-green);
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.doc-first-ring {
    stroke-dasharray: 60;
    stroke-dashoffset: 60;
    transform: rotate(-90deg);
    transform-origin: 12px 12px;
    transition: stroke-dashoffset .7s ease;
}

.doc-first-tick {
    stroke-dasharray: 14;
    stroke-dashoffset: 14;
    transition: stroke-dashoffset .4s ease .55s;
}

.doc-first.is-on :is(.doc-first-ring, .doc-first-tick) {
    stroke-dashoffset: 0;
}

/* ===================================================================
   The docs: a list of sections beside the sections
   =================================================================== */

.doc-layout {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    align-items: start;
    gap: clamp(32px, 5vw, 72px);
    max-width: 1180px;
    margin-inline: auto;
}

.doc-toc {
    position: sticky;
    top: calc(var(--header-height) + 24px);
}

.doc-toc-t {
    margin-bottom: 10px;

    font-size: 12.5px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--green-text);
}

/* the numbered lists of this page draw their own numbers (or none) */
.doc-toc ol,
.doc-steps,
.doc-spa-log {
    list-style: none;
}

.doc-toc ol {
    display: grid;
    border-inline-start: 2px solid var(--color-border-soft);
}

:root[data-theme="dark"] .doc-toc ol {
    border-inline-start-color: var(--color-border);
}

.doc-toc a {
    display: block;
    margin-inline-start: -2px;
    padding: 7px 14px;

    border-inline-start: 2px solid transparent;

    font-size: 14.5px;
    font-weight: 600;
    color: var(--color-text-soft);

    transition: color .2s ease, border-color .2s ease;
}

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

.doc-toc a.is-on {
    border-inline-start-color: var(--color-green);
    color: var(--green-text);
    font-weight: 800;
}

.doc-main {
    display: grid;
    gap: clamp(56px, 7vw, 96px);
    min-width: 0;
}

.doc-part {
    min-width: 0;
    scroll-margin-top: calc(var(--header-height) + 20px);
}

.doc-part > * + * {
    margin-top: 18px;
}

.doc-h {
    display: flex;
    align-items: center;
    gap: 14px;

    font-size: clamp(24px, 2.6vw, 32px);
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: -.02em;
    text-wrap: balance;
}

/* a long word (nl "Toestemmingsmodus") may break at 320 px instead of pushing the page wider */
.doc-h > span:not(.sec-icon) {
    min-width: 0;
    overflow-wrap: anywhere;
}

.doc-part > .doc-h + * {
    margin-top: 20px;
}

.doc-h3 {
    font-size: 18px;
    font-weight: 800;
}

/* the long text sits at the start of its column, not in the middle */
.doc-main .prose {
    max-width: 72ch;
    margin-inline: 0;
}

.doc-main .prose .table-scroll + .table-scroll {
    margin-top: 22px;
}

.doc-box pre {
    font-size: 13.5px;
}

/* a short list with green dots */
.doc-dots {
    display: grid;
    gap: 10px;
    max-width: 72ch;

    font-size: 16px;
    line-height: 1.65;
    color: var(--color-text-soft);
}

.doc-dots li {
    position: relative;
    padding-inline-start: 22px;
}

.doc-dots li::before {
    content: "";
    position: absolute;
    inset-inline-start: 4px;
    top: .68em;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--color-green);
}

.doc-dots strong {
    color: var(--color-text);
}

.doc-where {
    display: grid;
    gap: 10px;
}

.doc-know.know-list {
    max-width: none;
    margin-inline: 0;
}

/* numbered steps */
.doc-steps {
    display: grid;
    gap: 14px;
    max-width: 72ch;
}

.doc-steps li {
    display: grid;
    grid-template-columns: 32px minmax(0, 1fr);
    align-items: start;
    gap: 14px;
}

.doc-num {
    display: grid;
    place-items: center;

    width: 32px;
    height: 32px;

    border-radius: 50%;
    background: var(--color-green-soft);
    color: var(--green-text);
    font-weight: 800;
}

.doc-steps p {
    padding-top: 3px;
    font-size: 16.5px;
    line-height: 1.65;
    color: var(--color-text-soft);
}

.doc-steps strong {
    color: var(--color-text);
}

/* the answers of the collect request */
.doc-code-ok,
.doc-code-bad,
.doc-code-none {
    display: inline-flex;
    align-items: center;

    height: 26px;
    padding-inline: 10px;

    border-radius: 8px;
    font-size: 13.5px;
    font-weight: 800;
    white-space: nowrap;
}

.doc-code-ok,
.doc-code-bad {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.doc-code-ok {
    background: var(--color-green-soft);
    color: var(--green-text);
}

.doc-code-bad {
    background: color-mix(in srgb, #dc2626 11%, transparent);
    color: #b91c1c;
}

:root[data-theme="dark"] .doc-code-bad {
    background: color-mix(in srgb, #f87171 14%, transparent);
    color: #fca5a5;
}

.doc-code-none {
    background: var(--color-bg-soft);
    color: var(--color-text-soft);
    font-size: 13px;
}

:root[data-theme="dark"] .doc-code-none {
    background: var(--color-bg);
}

.doc-events td:first-child,
.doc-ref td:first-child {
    width: 38%;
}

.doc-main .prose td:not(:first-child) code {
    overflow-wrap: normal;
    white-space: nowrap;
}

.doc-check :is(th, td):first-child {
    width: 9.5em;
    white-space: nowrap;
}

.doc-events td:first-child code,
.doc-ref td:first-child code {
    display: inline-block;
    margin: 2px 4px 2px 0;
    white-space: nowrap;
}

/* platforms */
.doc-plats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.doc-plat {
    min-width: 0;
    padding: 20px 22px 22px;

    border: 1px solid var(--color-border-soft);
    border-radius: 18px;
    background: var(--color-bg);
    box-shadow: var(--shadow-sm);
}

:root[data-theme="dark"] .doc-plat {
    border-color: var(--color-border);
    background: var(--color-bg-soft);
}

.doc-plat-t {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 18px;
    font-weight: 800;
}

.doc-mono {
    display: grid;
    place-items: center;
    flex: none;

    width: 38px;
    height: 38px;

    border-radius: 11px;
    background: var(--color-green-soft);
    color: var(--green-text);

    font-size: 14px;
    font-weight: 800;
}

.doc-plat p {
    margin-top: 10px;
    font-size: 15px;
    line-height: 1.6;
    color: var(--color-text-soft);
}

.doc-plat strong {
    color: var(--color-text);
}

/* text beside a small animation */
.doc-split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: center;
    gap: clamp(20px, 3vw, 36px);
}

.doc-split .prose > * + * {
    margin-top: 14px;
}

.doc-note {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    max-width: 72ch;
    padding: 14px 16px;

    border-radius: 14px;
    background: var(--color-green-soft);

    font-size: 15px;
    line-height: 1.6;
    color: var(--color-text-soft);
}

.doc-note svg {
    flex: none;
    width: 20px;
    height: 20px;
    margin-top: 2px;
    color: var(--green-text);
}

.doc-api {
    display: grid;
    justify-items: start;
    gap: 18px;
    padding: clamp(20px, 3vw, 28px);

    border: 1px solid var(--color-border-soft);
    border-radius: 20px;
    background: var(--color-bg-soft);
}

:root[data-theme="dark"] .doc-api {
    border-color: var(--color-border);
}

.doc-api p {
    max-width: 62ch;
    font-size: 16.5px;
    line-height: 1.65;
    color: var(--color-text-soft);
}

/* ===================================================================
   The small animations
   =================================================================== */

.doc-fx {
    position: relative;
    overflow: hidden;

    border: 1px solid var(--color-border-soft);
    border-radius: 18px;
    background: var(--color-bg-soft);
    box-shadow: var(--shadow-sm);
}

:root[data-theme="dark"] .doc-fx {
    border-color: var(--color-border);
    background: var(--color-bg);
}

/* ----- a single-page app changes its address ----- */

.doc-spa-bar {
    display: flex;
    align-items: center;
    gap: 12px;

    height: 42px;
    padding-inline: 14px;

    border-bottom: 1px solid var(--color-border-soft);
    background: var(--color-bg);
}

:root[data-theme="dark"] .doc-spa-bar {
    border-bottom-color: var(--color-border);
    background: var(--color-bg-soft);
}

.doc-spa-url {
    display: inline-flex;
    align-items: center;
    flex: 1;
    gap: 6px;
    overflow: hidden;
    min-width: 0;

    height: 26px;
    padding-inline: 10px;

    border-radius: 8px;
    background: var(--color-bg-soft);

    font-size: 12.5px;
    font-weight: 600;
    color: var(--color-text-soft);
    white-space: nowrap;
}

:root[data-theme="dark"] .doc-spa-url {
    background: var(--color-bg);
}

.doc-spa-url svg {
    flex: none;
    width: 12px;
    height: 12px;
}

.doc-spa-path {
    overflow: hidden;
    margin-inline-start: -6px;
    color: var(--color-text);
    font-weight: 800;
    text-overflow: ellipsis;
    transition: color .6s ease;
}

.doc-spa-path.is-changed {
    color: var(--green-text);
}

.doc-spa-body {
    display: grid;
    gap: 10px;
    padding: 14px;
}

.doc-spa-count {
    display: flex;
    align-items: center;
    justify-content: space-between;

    font-size: 13px;
    font-weight: 700;
    color: var(--color-text-soft);
}

.doc-spa-count b {
    font-size: 26px;
    font-weight: 800;
    color: var(--color-text);
    font-variant-numeric: tabular-nums;
    transition: color .6s ease;
}

.doc-spa-count b.is-changed {
    color: var(--green-text);
}

.doc-spa-log {
    display: grid;
    align-content: start;
    gap: 6px;
    min-height: calc(4 * 36px + 3 * 6px);
}

.doc-spa-log li {
    display: flex;
    align-items: center;
    gap: 10px;

    height: 36px;
    padding-inline: 10px;

    border: 1px solid var(--color-border-soft);
    border-radius: 9px;
    background: var(--color-bg);

    opacity: 0;
    transform: translateY(-8px);
    transition: opacity .4s ease, transform .55s var(--ease);
}

:root[data-theme="dark"] .doc-spa-log li {
    border-color: var(--color-border);
    background: var(--color-bg-soft);
}

.doc-spa-log li.is-in {
    opacity: 1;
    transform: none;
}

.doc-spa-log.is-out li {
    opacity: 0;
}

.doc-spa-tag {
    flex: none;
    padding: 2px 9px;

    border-radius: 999px;
    background: var(--color-green-soft);

    font-size: 11.5px;
    font-weight: 800;
    color: var(--green-text);
    white-space: nowrap;
}

.doc-spa-log li.is-same .doc-spa-tag {
    background: var(--color-bg-soft);
    color: var(--color-text-soft);
}

.doc-spa-log code {
    overflow: hidden;
    margin-inline-start: auto;

    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12.5px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.doc-spa-log li.is-same code {
    color: var(--color-text-soft);
}

/* ----- consent: nothing moves until the visitor says yes ----- */

.doc-cs {
    display: grid;
    align-content: start;
    gap: 14px;
    min-height: 250px;
    padding: 16px;
}

.doc-cs-page {
    display: grid;
    gap: 8px;
}

.doc-cs-page i {
    height: 8px;
    border-radius: 4px;
    background: var(--color-border);
}

.doc-cs-page i:nth-child(1) { width: 62%; }
.doc-cs-page i:nth-child(2) { width: 88%; }
.doc-cs-page i:nth-child(3) { width: 48%; }

.doc-cs-flow {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
}

.doc-cs-end {
    display: grid;
    place-items: center;

    min-width: 36px;
    height: 34px;
    padding-inline: 9px;

    border: 1px solid var(--color-border);
    border-radius: 10px;
    background: var(--color-bg);

    font-size: 12.5px;
    font-weight: 800;
    color: var(--color-text-soft);
}

:root[data-theme="dark"] .doc-cs-end {
    background: var(--color-bg-soft);
}

.doc-cs-end svg {
    width: 18px;
    height: 18px;
}

.doc-cs-to {
    transition: color .4s ease, border-color .4s ease;
}

.doc-cs[data-state="on"] .doc-cs-to {
    border-color: color-mix(in srgb, var(--color-green) 55%, var(--color-border));
    color: var(--green-text);
}

.doc-cs-line {
    position: relative;
    height: 2px;
    background: repeating-linear-gradient(to right, var(--color-border) 0 6px, transparent 6px 11px);
}

.doc-cs-line i {
    position: absolute;
    top: -3px;
    left: 0;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-green);
    opacity: 0;
}

.doc-cs[data-state="on"] .doc-cs-line i {
    animation: doc-flow 1.8s linear infinite;
}

.doc-cs[data-state="on"] .doc-cs-line i:nth-child(2) {
    animation-delay: .6s;
}

.doc-cs[data-state="on"] .doc-cs-line i:nth-child(3) {
    animation-delay: 1.2s;
}

@keyframes doc-flow {
    0% { left: 0; opacity: 0; }
    12% { opacity: 1; }
    88% { opacity: 1; }
    100% { left: calc(100% - 8px); opacity: 0; }
}

.doc-cs-state {
    display: grid;
    font-size: 13.5px;
    font-weight: 800;
}

.doc-cs-state span {
    grid-area: 1 / 1;
    opacity: 0;
    transition: opacity .35s ease;
}

.doc-cs[data-state="wait"] [data-s="wait"],
.doc-cs[data-state="on"] [data-s="on"],
.doc-cs[data-state="off"] [data-s="off"] {
    opacity: 1;
}

[data-s="wait"] { color: var(--color-text-soft); }
[data-s="on"] { color: var(--green-text); }
[data-s="off"] { color: #b91c1c; }

:root[data-theme="dark"] [data-s="off"] {
    color: #fca5a5;
}

.doc-cs-banner {
    position: absolute;
    inset-inline: 12px;
    bottom: 12px;

    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;

    border: 1px solid var(--color-border);
    border-radius: 14px;
    background: var(--color-bg);
    box-shadow: var(--shadow-md);

    transition: opacity .4s ease, transform .55s var(--ease);
}

:root[data-theme="dark"] .doc-cs-banner {
    background: var(--color-bg-soft);
}

.doc-cs-banner p {
    flex: 1;
    min-width: 120px;
    font-size: 13.5px;
    font-weight: 800;
}

.doc-cs[data-state="on"] .doc-cs-banner,
.doc-cs[data-state="off"] .doc-cs-banner {
    opacity: 0;
    transform: translateY(16px);
}

.doc-cs-btn {
    display: inline-flex;
    align-items: center;

    height: 32px;
    padding-inline: 16px;

    border: 1px solid var(--color-border);
    border-radius: 9px;
    background: var(--color-bg-soft);

    font-size: 13px;
    font-weight: 800;

    transition: transform .16s var(--ease);
}

:root[data-theme="dark"] .doc-cs-btn {
    background: var(--color-bg);
}

.doc-cs-btn.is-yes,
:root[data-theme="dark"] .doc-cs-btn.is-yes {
    border-color: var(--color-green);
    background: var(--color-green);
    color: var(--color-green-ink);
}

.doc-cs-btn.is-press {
    transform: scale(.92);
}

/* ===================================================================
   Narrower screens
   =================================================================== */

@media (max-width: 1100px) {

    .doc-split {
        grid-template-columns: minmax(0, 1fr);
    }

    .doc-split .doc-fx {
        max-width: 520px;
    }
}

@media (max-width: 960px) {

    .doc-stage {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas:
            "copy"
            "edit"
            "live";
        max-width: 640px;
    }

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

    /* the sections become a row of chips at the top */
    .doc-toc {
        position: static;
    }

    .doc-toc ol {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        border: 0;
    }

    .doc-toc a,
    .doc-toc a.is-on {
        margin: 0;
        padding: 6px 12px;

        border: 1px solid var(--color-border);
        border-radius: 999px;
        background: var(--color-bg);

        font-size: 14px;
        font-weight: 700;
        color: var(--color-text-soft);
    }

    :root[data-theme="dark"] .doc-toc a {
        background: var(--color-bg-soft);
    }
}

@media (max-width: 640px) {

    .doc-plats {
        grid-template-columns: minmax(0, 1fr);
    }

    .doc-plat {
        padding: 18px 18px 20px;
    }

    .doc-code,
    .doc-box pre {
        font-size: 12.5px;
    }

    .doc-ln {
        padding-left: 3em;
    }

    .doc-ln::before {
        width: 2em;
    }

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

    .doc-status {
        justify-items: start;
        margin-inline-start: 36px;
    }

    .doc-steps p {
        font-size: 16px;
    }

    .doc-events td:first-child,
    .doc-ref td:first-child {
        width: auto;
    }
}

/* ===== less motion: the final picture (scripts/docs.js), nothing slides, blinks or breathes ===== */
@media (prefers-reduced-motion: reduce) {

    .doc-caret,
    .doc-wait-dot,
    .doc-cs-line i {
        animation: none !important;
    }

    .doc-visit,
    .doc-spa-log li,
    .doc-status > span,
    .doc-saved,
    .doc-cs-banner {
        transform: none !important;
    }
}

/* ===================================================================
   The contents list: a section's older parts sit under it, a little in; the "No visits showing up?" box under the install code
   =================================================================== */

.doc-toc li.is-sub a {
    padding-inline-start: 26px;
    font-size: .92em;
}

.doc-trouble {
    max-width: 72ch;
    margin-top: 28px;
    padding: 18px 20px 16px;

    border: 1px solid color-mix(in srgb, #d97706 35%, var(--color-border));
    border-radius: 16px;
    background: color-mix(in srgb, #f59e0b 7%, var(--color-bg));
}

:root[data-theme="dark"] .doc-trouble {
    border-color: color-mix(in srgb, #fbbf24 30%, var(--color-border));
    background: color-mix(in srgb, #f59e0b 8%, var(--color-bg-soft));
}

.doc-trouble .doc-dots {
    margin-top: 10px;
}

.doc-trouble-more {
    margin-top: 12px;
    font-size: 15px;
    line-height: 1.6;
    color: var(--color-text-soft);
}

.doc-more {
    margin-top: 16px;
}
