/* ===========================================================================
   Authsy Docs — developer documentation + multi-language SDK reference.
   Rides on portal.css design tokens (shadcn neutral-dark + green primary).
   =========================================================================== */

/* shadcn's dark theme is a neutral base with a near-white primary — the green
   in portal.css is RoDecomp's identity, not this one. Scoped to .docs so the
   decompiler and the other legacy surfaces keep theirs. */
.docs {
    --doc-primary: var(--cream);
    --doc-primary-ink: #0d0d0c;
    --doc-muted: var(--surface-2);
    --doc-ring: color-mix(in srgb, var(--cream) 22%, transparent);

    display: flex;
    min-height: 100vh;
    align-items: stretch;
}

/* ---- Left table of contents ---- */
.docs-toc {
    flex: none;
    width: 250px;
    border-right: 1px solid var(--border);
    background: var(--surface);
    padding: 18px 14px 40px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}
.docs-brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 16px; text-decoration: none; }
/* Inline SVG, so it inherits the link's colour. The generated mark carries its
   own `height:1em;width:Nem`, and an inline style beats a stylesheet rule — so
   drive its size from the parent's font-size rather than fighting it. */
.docs-brand { color: var(--text); font-size: 22px; }
.docs-brand .brand-tag {
    font-family: var(--font-mono); font-size: 8.5px; letter-spacing: .2em;
    text-transform: uppercase; color: var(--text-faint);
    padding: 2px 6px; border: 1px solid var(--border); border-radius: 6px;
}
.toc-group-label {
    padding: 14px 10px 4px; font-size: 10.5px; font-weight: 600;
    letter-spacing: .07em; text-transform: uppercase; color: var(--text-faint);
}
.toc-link {
    display: block; padding: 7px 10px; border-radius: var(--radius-sm);
    color: var(--text-muted); text-decoration: none; font-size: 13px;
    border-left: 2px solid transparent; transition: color .15s ease, background .15s ease;
}
.toc-link:hover { color: var(--text); background: var(--surface-2); }
.toc-link.active { color: var(--text); background: var(--surface-3); border-left-color: var(--doc-primary); font-weight: 550; }

/* ---- Main column ---- */
.docs-main { flex: 1; min-width: 0; }
.docs-topbar {
    position: sticky; top: 0; z-index: 30;
    display: flex; align-items: center; gap: 14px;
    padding: 12px 32px;
    border-bottom: 1px solid var(--border);
    background: color-mix(in srgb, var(--bg) 86%, transparent);
    backdrop-filter: blur(8px);
}
.docs-topbar .spacer { flex: 1; }
/* portal.css paints btn-primary green. Inside the docs it follows shadcn's
   near-white primary so the page matches the portal it links into. */
.docs .btn-primary {
    background: var(--doc-primary); color: var(--doc-primary-ink);
    border-color: var(--doc-primary);
}
.docs .btn-primary:hover { background: color-mix(in srgb, var(--doc-primary) 88%, #000); }
.docs-menu-btn { display: none; }
.docs-body { max-width: 860px; margin: 0 auto; padding: 30px 32px 120px; }

.docs-hero { padding: 18px 0 34px; border-bottom: 1px solid var(--border); margin-bottom: 34px; }
.docs-hero .eyebrow {
    font-family: var(--font-mono); font-size: 11px; letter-spacing: .18em;
    text-transform: uppercase; color: var(--text-faint); margin-bottom: 12px;
}
/* shadcn's type scale is tighter and a step smaller than this page ran. */
.docs-hero h1 { font-size: 34px; font-weight: 600; letter-spacing: -.035em; line-height: 1.1; }
.docs-hero p { color: var(--text-muted); font-size: 14.5px; line-height: 1.65; margin-top: 14px; max-width: 640px; }

.docs-section { padding-top: 26px; margin-top: 26px; scroll-margin-top: 76px; }
.docs-section > h2 {
    font-size: 21px; font-weight: 600; letter-spacing: -.02em;
    padding-bottom: 6px; margin-bottom: 6px;
}
.docs-section h3 { font-size: 15.5px; font-weight: 600; margin: 26px 0 8px; letter-spacing: -.012em; }
.docs-section p { color: var(--text-muted); line-height: 1.7; margin: 10px 0; font-size: 14px; }
.docs-section p strong { color: var(--text); font-weight: 600; }
.docs-section ul { color: var(--text-muted); line-height: 1.7; margin: 10px 0 10px 20px; font-size: 14px; }
.docs-section li { margin: 4px 0; }
/* Underline-on-hover with an offset, rather than a coloured link. */
.docs-section a {
    color: var(--text); text-decoration: underline;
    text-decoration-color: color-mix(in srgb, var(--text) 35%, transparent);
    text-underline-offset: 3px; font-weight: 500;
}
.docs-section a:hover { text-decoration-color: var(--text); }
code.inline {
    font-family: var(--font-mono); font-size: 12px; color: var(--text);
    background: var(--surface-2); border: 1px solid var(--border);
    border-radius: 5px; padding: 1px 6px;
}

/* SDK download cards */
.sdk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; margin: 18px 0 8px; }
.sdk-card {
    display: block; text-decoration: none; color: inherit;
    border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
    padding: 14px 16px; transition: border-color .15s ease, transform .15s ease;
}
/* shadcn cards lift on the ring, not on translate. */
.sdk-card:hover { border-color: var(--doc-ring); background: var(--surface-2); }
.sdk-card .sdk-lang { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-faint); margin-bottom: 8px; }
.sdk-card code { font-family: var(--font-mono); font-size: 14px; font-weight: 600; color: var(--text); }
.sdk-card p { margin: 8px 0 0; font-size: 12.5px; color: var(--text-muted); line-height: 1.5; }
.sdk-cmd { font-family: var(--font-mono); font-size: 11px; color: var(--text); }

/* method + path pill */
.endpoint {
    display: inline-flex; align-items: center; gap: 10px;
    font-family: var(--font-mono); font-size: 13px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 8px 12px; margin: 10px 0;
}
/* Method reads as a shadcn Badge: neutral secondary, not a filled accent. */
.endpoint .verb, .endpoint .method {
    font-weight: 600; color: var(--text); background: var(--surface-3);
    border: 1px solid var(--border); padding: 1px 7px; border-radius: 6px;
    font-size: 10.5px; letter-spacing: .04em; text-transform: uppercase;
}
.endpoint .path { color: var(--text); }

/* shadcn Alert: one hairline border and a muted surface — no left accent bar,
   with the leading <strong> acting as AlertTitle. */
.callout {
    border: 1px solid var(--border);
    background: var(--doc-muted); border-radius: var(--radius);
    padding: 13px 15px; margin: 18px 0; color: var(--text-muted); line-height: 1.6; font-size: 13.5px;
}
.callout strong:first-child {
    display: block; color: var(--text); font-weight: 600;
    font-size: 13.5px; margin-bottom: 3px; letter-spacing: -.005em;
}
.callout.warn { border-color: color-mix(in srgb, var(--warning) 38%, var(--border)); }
.callout strong { color: var(--text); }

/* ---- Code blocks with language tabs ---- */
.code-tabs {
    border: 1px solid var(--border); border-radius: var(--radius);
    overflow: hidden; margin: 16px 0 22px; background: #0b0b0d;
    box-shadow: var(--hard-sm);
}
.code-tabbar {
    display: flex; align-items: center; gap: 2px;
    padding: 6px 8px; border-bottom: 1px solid var(--border);
    background: var(--surface); overflow-x: auto; scrollbar-width: none;
}
.code-tabbar::-webkit-scrollbar { display: none; }
.code-tab {
    flex: none; border: 0; background: transparent; cursor: pointer;
    color: var(--text-muted); font-family: var(--font-sans); font-size: 12.5px;
    font-weight: 550; padding: 6px 12px; border-radius: var(--radius-sm);
    transition: color .12s ease, background .12s ease;
}
.code-tab:hover { color: var(--text); }
.code-tab.active { color: var(--text); background: var(--surface-3); }
.code-copy {
    margin-left: auto; flex: none;
    border: 1px solid var(--border-strong); background: var(--surface);
    color: var(--text-muted); border-radius: var(--radius-sm);
    font-size: 11.5px; font-weight: 550; padding: 5px 10px; cursor: pointer;
    transition: color .12s ease, border-color .12s ease;
}
.code-copy:hover { color: var(--text); border-color: var(--accent); }
.code-copy.copied { color: var(--accent); border-color: var(--accent); }
.code-panes { position: relative; }
.code-pane { display: none; }
.code-pane.active { display: block; }
.code-pane pre {
    margin: 0; padding: 18px 20px; overflow-x: auto;
    font-family: var(--font-mono); font-size: 12.5px; line-height: 1.65;
    color: #d6dbd8;
    -moz-tab-size: 4; tab-size: 4;
}
.code-pane pre .c { color: var(--text-faint); font-style: italic; } /* comment */
.code-pane pre .k { color: #7fb0e0; }  /* keyword */
.code-pane pre .s { color: #5ee88a; }  /* string */
.code-pane pre .f { color: #e2c069; }  /* function/ident */

@media (max-width: 900px) {
    .docs-toc { position: fixed; left: 0; top: 0; z-index: 60; transform: translateX(-100%); transition: transform .28s var(--ease); box-shadow: var(--hard); }
    .docs.toc-open .docs-toc { transform: translateX(0); }
    .docs-menu-btn { display: inline-flex; }
    .docs-body { padding: 24px 18px 100px; }
    .docs-topbar { padding: 12px 18px; }
    .docs-hero h1 { font-size: 32px; }
}
