/* Tokens are the SAME system as client/assets/css/client.css and admin/assets/css/admin.css —
   greyscale primary, yellow accent (#f9d949), Inter. Copied rather than referenced because the
   two sites are separate docroots, but the values must not diverge: docs.docxtract.io and
   app.docxtract.io should read as one product. If the portal palette changes, change it here
   too. */
:root {
    --primary-h: 0;
    --primary-s: 0%;
    --primary-l: 0%;
    --secondary-h: 0;
    --secondary-s: 0%;
    --secondary-l: 100%;
    --accent-h: 49;
    --accent-s: 94%;
    --accent-l: 63%;
    --text-h: 0;
    --text-s: 0%;
    --text-l: 7%;

    --primary: hsl(var(--primary-h) var(--primary-s) var(--primary-l));
    --primary-dark: hsl(var(--primary-h) var(--primary-s) 18%);
    --primary-soft: hsl(var(--primary-h) var(--primary-s) 94%);
    --secondary: hsl(var(--secondary-h) var(--secondary-s) var(--secondary-l));
    --secondary-light: hsl(var(--secondary-h) var(--secondary-s) 93%);
    --accent: hsl(var(--accent-h) var(--accent-s) var(--accent-l));
    --accent-soft: hsl(var(--accent-h) var(--accent-s) 94%);
    --accent-dark: hsl(var(--accent-h) var(--accent-s) 30%);
    /* accent-dark (30%, as in client.css) measures 3.65:1 on --primary-soft — below the
       4.5:1 minimum for body text. This deeper shade is for text on light fills only; the
       shared 30% value is kept above for borders and fills, where contrast does not apply. */
    --accent-text: hsl(var(--accent-h) var(--accent-s) 22%);
    --text: hsl(var(--text-h) var(--text-s) var(--text-l));
    --text-soft: hsl(var(--text-h) var(--text-s) 32%);
    --text-muted: hsl(var(--text-h) var(--text-s) 46%);
    --text-faint: hsl(var(--text-h) var(--text-s) 62%);
    --text-inverse: hsl(0 0% 100%);
    --text-inverse-muted: hsl(0 0% 82%);
    --bg: var(--secondary-light);
    --surface: var(--secondary);
    --border: hsl(var(--secondary-h) var(--secondary-s) 88%);
    --border-soft: hsl(var(--secondary-h) var(--secondary-s) 93%);

    /* Callout semantics. Kept muted so they read as part of a greyscale system rather than
       competing with the yellow accent. */
    --info: hsl(212 60% 45%);
    --info-soft: hsl(212 60% 96%);
    --tip: hsl(158 55% 36%);
    --tip-soft: hsl(158 55% 96%);
    --warning: var(--accent-dark);
    --warning-soft: var(--accent-soft);
    --danger: hsl(0 62% 45%);
    --danger-soft: hsl(0 62% 97%);

    --shadow-sm: 0 4px 6px hsl(0 0% 0% / .05);
    --shadow-md: 0 6px 12px hsl(0 0% 0% / .10);
    --radius-sm: .5rem;
    --radius-md: .75rem;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, SFMono-Regular, Menlo, monospace;
    --maxw: 1180px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
}

/* In a greyscale palette a coloured link is not available, so links are distinguished by a
   persistent underline rather than by hue. Removing it would make them indistinguishable
   from body text. */
a { color: var(--primary); text-decoration: underline; text-decoration-color: var(--text-faint); text-underline-offset: .15em; }
a:hover { text-decoration-color: var(--primary); }
/* Chrome-style elements that read as controls, not prose links, opt out. */
.doc-logo, .doc-header__links a, .doc-card, .doc-btn, .doc-related li a, .doc-toc a, .doc-anchor,
.doc-breadcrumb a, .doc-popular li a, .doc-articlelist li > a, .doc-results li > a { text-decoration: none; }
.doc-breadcrumb a:hover, .doc-popular li a:hover, .doc-articlelist li > a:hover,
.doc-results li > a:hover, .doc-toc a:hover { text-decoration: underline; }

.doc-skip { position: absolute; left: -9999px; }
.doc-skip:focus { left: 1rem; top: 1rem; z-index: 100; background: var(--surface); padding: .5rem 1rem; border-radius: var(--radius-sm); }

/* ── header ─────────────────────────────────────────────────────────────── */
.doc-header { background: var(--primary); position: sticky; top: 0; z-index: 20; }
.doc-header__inner {
    max-width: var(--maxw); margin: 0 auto; padding: .8rem 1.25rem;
    display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap;
}
.doc-logo { color: var(--text-inverse); font-weight: 700; font-size: 1.05rem; letter-spacing: -.01em; }
.doc-logo span { color: var(--accent); }
.doc-logo em { color: var(--text-inverse-muted); font-style: normal; font-weight: 500; font-size: .85rem; }
.doc-logo:hover { text-decoration: none; }

.doc-search { position: relative; flex: 1 1 240px; max-width: 460px; }
.doc-search i { position: absolute; left: .7rem; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: .9rem; }
.doc-search input {
    width: 100%; padding: .5rem .75rem .5rem 2rem; border-radius: var(--radius-sm);
    border: 1px solid hsl(var(--primary-h) var(--primary-s) 22%);
    background: hsl(var(--primary-h) var(--primary-s) 11%); color: var(--text-inverse);
    font-family: var(--font); font-size: .9rem;
}
.doc-search input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

.doc-header__links { display: flex; gap: 1rem; }
.doc-header__links a { color: var(--text-inverse-muted); font-size: .875rem; }
.doc-header__links a:hover { color: var(--text-inverse); }

.doc-main { max-width: var(--maxw); margin: 0 auto; padding: 2rem 1.25rem 4rem; }

/* ── home ───────────────────────────────────────────────────────────────── */
.doc-hero { padding: 1rem 0 2rem; }
.doc-hero h1 { font-size: 2rem; margin: 0 0 .5rem; letter-spacing: -.02em; }
.doc-hero p { color: var(--text-muted); margin: 0 0 1.25rem; max-width: 60ch; }
.doc-hero__cta { display: flex; gap: .75rem; flex-wrap: wrap; }

.doc-btn {
    display: inline-block; padding: .55rem 1.1rem; border-radius: var(--radius-sm);
    background: var(--primary); color: var(--text-inverse); font-weight: 600; font-size: .9rem;
    border: 1px solid var(--primary);
}
.doc-btn:hover { background: var(--primary-dark); text-decoration: none; }
.doc-btn--ghost { background: transparent; color: var(--text); border-color: var(--border); }
.doc-btn--ghost:hover { background: var(--surface); }

.doc-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.doc-card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
    padding: 1.25rem; color: var(--text); display: block;
}
.doc-card:hover { border-color: var(--primary); text-decoration: none; transform: translateY(-1px); }
.doc-card i { color: var(--primary); font-size: 1.4rem; }
.doc-card h2 { font-size: 1.05rem; margin: .5rem 0 .35rem; }
.doc-card p { color: var(--text-muted); font-size: .875rem; margin: 0 0 .75rem; }
.doc-card__count { font-size: .75rem; color: var(--text-muted); font-family: var(--mono); }

.doc-popular { margin-top: 2.5rem; }
.doc-popular h2 { font-size: 1.1rem; margin: 0 0 .75rem; }
.doc-popular ul { list-style: none; padding: 0; margin: 0; display: grid; gap: .4rem; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.doc-popular li {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: .6rem .85rem; display: flex; justify-content: space-between; gap: .75rem; align-items: center;
}
.doc-popular li span { font-size: .72rem; color: var(--text-muted); white-space: nowrap; }

/* ── category + search listings ─────────────────────────────────────────── */
.doc-breadcrumb { font-size: .8rem; color: var(--text-muted); margin-bottom: 1rem; }
.doc-breadcrumb span { margin: 0 .35rem; opacity: .6; }

.doc-cattitle { font-size: 1.6rem; margin: 0 0 .35rem; letter-spacing: -.02em; }
.doc-cattitle i { color: var(--primary); }
.doc-catdesc { color: var(--text-muted); margin: 0 0 1.5rem; }

.doc-articlelist, .doc-results { list-style: none; padding: 0; margin: 0; display: grid; gap: .6rem; }
.doc-articlelist li, .doc-results li {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: .85rem 1rem;
}
.doc-articlelist li a, .doc-results li a { font-weight: 600; }
.doc-articlelist time { display: block; font-size: .72rem; color: var(--text-muted); margin-top: .15rem; }
.doc-results__cat { font-size: .7rem; color: var(--text-muted); margin-left: .5rem; }
.doc-results p { margin: .4rem 0 0; font-size: .85rem; color: var(--text-muted); }
.doc-results mark { background: var(--accent-soft); padding: 0 .1rem; }

.doc-empty {
    background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--primary);
    border-radius: var(--radius-sm); padding: 1.5rem;
}
.doc-empty h1 { font-size: 1.25rem; margin: 0 0 .5rem; }

/* ── article ────────────────────────────────────────────────────────────── */
.doc-layout { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 2.5rem; align-items: start; }
.doc-article {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
    padding: 2rem 2.25rem; min-width: 0;
}
.doc-article h1 { font-size: 1.9rem; margin: 0 0 .25rem; letter-spacing: -.02em; }
.doc-updated { font-size: .75rem; color: var(--text-muted); margin: 0 0 1.75rem; }

.doc-article h2 { font-size: 1.3rem; margin: 2.25rem 0 .75rem; padding-top: .5rem; border-top: 1px solid var(--border); }
.doc-article h3 { font-size: 1.05rem; margin: 1.75rem 0 .5rem; }
.doc-article h4 { font-size: .95rem; margin: 1.25rem 0 .4rem; }
.doc-article p { margin: 0 0 1rem; }

.doc-anchor { opacity: 0; margin-left: .4rem; color: var(--text-muted); font-weight: 400; text-decoration: none; }
h2:hover .doc-anchor, h3:hover .doc-anchor, h4:hover .doc-anchor { opacity: 1; }

.doc-list { margin: 0 0 1rem; padding-left: 1.35rem; }
.doc-list li { margin-bottom: .35rem; }

.doc-code {
    background: var(--primary-dark); color: var(--text-inverse-muted); padding: 1rem 1.1rem;
    border-radius: var(--radius-sm); overflow-x: auto; margin: 0 0 1.25rem;
    font-family: var(--mono); font-size: .8125rem; line-height: 1.6; position: relative;
}
.doc-code code { font-family: inherit; background: none; padding: 0; color: inherit; }
.doc-inlinecode {
    font-family: var(--mono); font-size: .85em; background: var(--primary-soft);
    padding: .12rem .35rem; border-radius: 4px; color: var(--accent-text);
    overflow-wrap: break-word;
}
.doc-copy {
    position: absolute; top: .5rem; right: .5rem; background: rgba(255,255,255,.12);
    color: var(--text-inverse-muted); border: 0; border-radius: 4px; padding: .2rem .5rem;
    font-size: .7rem; font-family: var(--font); cursor: pointer;
}
.doc-copy:hover { background: rgba(255,255,255,.22); }

.doc-tablewrap { overflow-x: auto; margin: 0 0 1.25rem; }
.doc-table { border-collapse: collapse; width: 100%; font-size: .875rem; }
.doc-table th, .doc-table td { border: 1px solid var(--border); padding: .5rem .7rem; text-align: left; vertical-align: top; }
.doc-table th { background: var(--primary-soft); font-weight: 600; }

.doc-callout {
    border-radius: var(--radius-sm); padding: .85rem 1rem; margin: 0 0 1.25rem;
    border-left: 3px solid var(--info); background: var(--info-soft);
}
.doc-callout__label { display: block; font-weight: 700; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; margin-bottom: .2rem; color: var(--info); }
.doc-callout__body > :last-child { margin-bottom: 0; }
.doc-callout--tip { border-left-color: var(--tip); background: var(--tip-soft); }
.doc-callout--tip .doc-callout__label { color: var(--tip); }
.doc-callout--warning { border-left-color: var(--warning); background: var(--warning-soft); }
.doc-callout--warning .doc-callout__label { color: var(--accent-text); }
.doc-callout--danger { border-left-color: var(--danger); background: var(--danger-soft); }
.doc-callout--danger .doc-callout__label { color: var(--danger); }
.doc-callout--success { border-left-color: var(--tip); background: var(--tip-soft); }
.doc-callout--success .doc-callout__label { color: var(--tip); }

.doc-quote { border-left: 3px solid var(--border); margin: 0 0 1.25rem; padding: .25rem 0 .25rem 1rem; color: var(--text-muted); }

.doc-figure { margin: 0 0 1.25rem; }
.doc-figure img { max-width: 100%; height: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); display: block; }
.doc-figure figcaption { font-size: .78rem; color: var(--text-muted); margin-top: .4rem; }

.doc-placeholder {
    border: 1px dashed var(--border); border-radius: var(--radius-sm);
    padding: 1.5rem; text-align: center; margin: 0 0 1.25rem; background: var(--border-soft);
}
.doc-placeholder span { display: block; font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); }
.doc-placeholder p { margin: .35rem 0 0; font-size: .85rem; color: var(--text-muted); }

/* Video: facade until clicked, so no third-party request happens on page load. */
.doc-video {
    position: relative; aspect-ratio: 16 / 9; background: var(--primary);
    border-radius: var(--radius-sm); margin: 0 0 1.25rem; overflow: hidden;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .4rem;
}
.doc-video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.doc-video__play {
    width: 56px; height: 56px; border-radius: 50%; border: 0; cursor: pointer;
    background: var(--accent); display: grid; place-items: center;
}
.doc-video__play:hover { background: var(--accent-light, var(--accent)); }
.doc-video__play span {
    width: 0; height: 0; margin-left: 4px;
    border-left: 16px solid var(--text-inverse); border-top: 10px solid transparent; border-bottom: 10px solid transparent;
}
.doc-video__title { color: var(--text-inverse); font-weight: 600; margin: 0; font-size: .95rem; padding: 0 1rem; text-align: center; }
.doc-video__note { color: var(--text-inverse-muted); font-size: .72rem; margin: 0; }

.doc-related { margin-top: 2.5rem; padding-top: 1.25rem; border-top: 1px solid var(--border); }
.doc-related h2 { font-size: 1rem; margin: 0 0 .5rem; border: 0; padding: 0; }
.doc-related ul { list-style: none; padding: 0; margin: 0; display: flex; gap: .5rem; flex-wrap: wrap; }
.doc-related li a {
    display: inline-block; padding: .35rem .7rem; border: 1px solid var(--border);
    border-radius: 999px; font-size: .82rem; background: var(--border-soft);
}
.doc-related li a:hover { border-color: var(--primary); text-decoration: none; }

.doc-feedback { margin-top: 1.5rem; font-size: .8rem; color: var(--text-muted); }

/* ── on-this-page ───────────────────────────────────────────────────────── */
.doc-toc { position: sticky; top: 5rem; font-size: .8125rem; }
.doc-toc__label { font-weight: 700; font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); margin: 0 0 .5rem; }
.doc-toc ul { list-style: none; padding: 0; margin: 0; border-left: 2px solid var(--border); }
.doc-toc li { margin: 0; }
.doc-toc li a { display: block; padding: .2rem 0 .2rem .75rem; color: var(--text-muted); margin-left: -2px; border-left: 2px solid transparent; }
.doc-toc li a:hover { color: var(--text); text-decoration: none; }
.doc-toc li a.is-active { color: var(--primary); border-left-color: var(--primary); font-weight: 600; }
.doc-toc__l3 a { padding-left: 1.5rem; font-size: .95em; }

/* ── footer ─────────────────────────────────────────────────────────────── */
.doc-footer { border-top: 1px solid var(--border); background: var(--surface); }
.doc-footer__inner { max-width: var(--maxw); margin: 0 auto; padding: 1.5rem 1.25rem; font-size: .82rem; color: var(--text-muted); }
.doc-footer__inner p { margin: 0 0 .25rem; }
.doc-footer__meta { font-size: .75rem; opacity: .8; }

/* ── responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
    .doc-layout { grid-template-columns: 1fr; }
    .doc-toc { position: static; order: -1; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .85rem 1rem; }
    .doc-article { padding: 1.5rem 1.25rem; }
}
@media (max-width: 620px) {
    .doc-header__inner { gap: .75rem; }
    .doc-header__links { order: 3; width: 100%; }
    .doc-hero h1 { font-size: 1.6rem; }
    .doc-main { padding: 1.25rem 1rem 3rem; }
}
