/* Dalibor Farny – product manuals. Built on the Dalibor Farny Design System tokens (ds-tokens.css):
   dark ink canvas by default, the "paper" theme for readers who prefer light; brass is the accent, the Nixie
   glow only marks "live" things (high-voltage callouts, the 404 digit). No build step: edit this file directly. */

/* Readers who prefer light get the design system's paper theme (same aliases as [data-theme="paper"]). */
@media (prefers-color-scheme: light) {
    :root:not([data-theme="dark"]) {
        --bg: var(--paper); --bg-deep: var(--paper-100);
        --surface: #FFFFFF; --surface-raised: #F8F8F6; --surface-sunken: var(--paper-100); --field: #FFFFFF;
        --text: var(--paper-ink); --text-secondary: var(--paper-ink-2); --text-muted: var(--paper-muted); --text-faint: var(--paper-faint);
        --accent: var(--brass-600); --accent-bright: var(--brass-500); --accent-deep: var(--brass-700);
        --glow: var(--glow-600); --glow-soft: var(--glow-500);
        --border: rgba(27, 27, 26, 0.12); --border-strong: rgba(27, 27, 26, 0.22);
        --border-brass: rgba(154, 120, 56, 0.55); --border-glow: rgba(226, 84, 15, 0.50);
        --focus-ring: rgba(226, 84, 15, 0.45);
        --shadow-1: 0 1px 2px rgba(27,27,26,0.10); --shadow-2: 0 4px 16px rgba(27,27,26,0.12); --shadow-3: 0 18px 48px rgba(27,27,26,0.16);
        --link: var(--brass-700);
        color-scheme: light;
    }
}

:root {
    --link: var(--brass-400);          /* readable brass for running text (paper: brass-700) */
    --sidebar: 290px;
    --content: 46rem;
    color-scheme: dark;
}

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

html { -webkit-text-size-adjust: 100%; scroll-padding-top: var(--space-4); }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 17px;
    line-height: var(--lh-body);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main { flex: 1 0 auto; }

a { color: var(--link); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { color: var(--accent-bright); }

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

::selection { background: var(--glow-700); color: var(--cream-50); }
:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }

.skip-link {
    position: absolute; left: -999px; top: 0; z-index: 10;
    background: var(--accent); color: var(--text-on-brass); padding: var(--space-2) var(--space-4);
}
.skip-link:focus { left: var(--space-4); }

/* eyebrow / label voice of the design system */
.eyebrow, .admonition-title, .content th, .pager__label, .result__product, .manual__brand, .product-card__action {
    font-family: var(--font-sans);
    font-weight: var(--fw-semibold);
    font-size: var(--label-sm);
    letter-spacing: var(--ls-label-sm);
    text-transform: uppercase;
}

/* ---- header (always the dark brand bar) -------------------------------------------------------------------- */

.site-header { background: var(--ink-900); color: var(--cream-50); border-bottom: 1px solid rgba(242, 241, 238, 0.10); }
.site-header__inner {
    max-width: 1280px; margin: 0 auto; padding: var(--space-3) var(--space-5);
    display: flex; align-items: center; gap: var(--space-4);
}
.brand { display: flex; align-items: center; gap: var(--space-4); text-decoration: none; margin-right: auto; min-width: 0; }
.brand__logo { height: 40px; width: auto; display: block; }
.brand__section {
    color: var(--brass-400); font-weight: var(--fw-semibold); font-size: var(--label-sm);
    letter-spacing: var(--ls-label); text-transform: uppercase; white-space: nowrap;
    padding-left: var(--space-4); border-left: 1px solid rgba(242, 241, 238, 0.18);
}
.brand:hover .brand__section { color: var(--brass-300); }

.site-search { position: relative; display: flex; }
.site-search input {
    width: 15rem; max-width: 40vw;
    background: var(--ink-700); color: var(--cream-50);
    border: 1px solid rgba(242, 241, 238, 0.10); border-radius: var(--r-sm);
    padding: var(--space-2) 2.2rem var(--space-2) var(--space-3); font: inherit; font-size: var(--text-sm);
    transition: border-color var(--dur-fast) var(--ease-out);
}
.site-search input::placeholder { color: var(--cream-400); }
.site-search input:focus { outline: none; border-color: var(--brass-500); }
.site-search__button {
    position: absolute; right: var(--space-1); top: 50%; transform: translateY(-50%);
    background: none; border: 0; color: var(--cream-300); font-size: 1.15rem; cursor: pointer; padding: 0 var(--space-2);
}

.lang-switch { position: relative; }
.lang-switch summary {
    list-style: none; cursor: pointer; padding: 6px var(--space-3); border: 1.5px solid rgba(181, 144, 78, 0.45);
    border-radius: var(--r-sm); font-size: var(--label-sm); font-weight: var(--fw-semibold);
    letter-spacing: 0.08em; color: var(--brass-400);
    transition: border-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.lang-switch summary:hover { border-color: var(--brass-400); color: var(--cream-50); }
.lang-switch summary::-webkit-details-marker { display: none; }
.lang-switch summary::after { content: " ▾"; }
.lang-switch__menu {
    position: absolute; right: 0; top: calc(100% + 6px); z-index: 20;
    list-style: none; margin: 0; padding: var(--space-1); min-width: 10rem;
    background: var(--ink-700); border: 1px solid rgba(242, 241, 238, 0.10); border-radius: var(--r-md);
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.55);
}
.lang-switch__menu a {
    display: block; padding: 6px var(--space-3); border-radius: var(--r-xs); color: var(--cream-100); text-decoration: none;
    font-size: var(--text-sm);
}
.lang-switch__menu a:hover { background: rgba(181, 144, 78, 0.10); color: var(--cream-50); }
.lang-switch__menu a.is-current { color: var(--brass-400); font-weight: var(--fw-semibold); }
.lang-switch__menu a.is-untranslated { color: var(--cream-400); }

/* ---- generic ----------------------------------------------------------------------------------------------- */

.page { width: 100%; }
.landing, .search-page, .error-page, .manual { max-width: 52rem; margin: 0 auto; padding: var(--space-8) var(--space-5) var(--space-16); }

h1, h2, h3, h4 { margin: 1.8em 0 0.6em; font-weight: var(--fw-semibold); }
h1, h2 {
    font-family: var(--font-display); font-weight: 400; text-transform: uppercase;
    letter-spacing: var(--ls-display); line-height: 1;
}
h1 { font-size: var(--display-sm); margin-top: 0.3em; }
h2 { font-size: 30px; }
h3 { font-size: var(--text-xl); line-height: var(--lh-tight); }
h4 { font-size: var(--text-lg); line-height: var(--lh-snug); }

.muted { color: var(--text-secondary); }

.button, .search-form button {
    display: inline-flex; align-items: center; justify-content: center; gap: 10px; height: 44px;
    padding: 0 22px; border: 1.5px solid var(--accent); border-radius: var(--r-sm);
    background: var(--accent); color: var(--text-on-brass);
    font-family: var(--font-sans); font-size: 13px; font-weight: var(--fw-semibold); letter-spacing: 0.08em;
    text-transform: uppercase; text-decoration: none; line-height: 1; cursor: pointer;
    transition: background var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}
.button:hover, .search-form button:hover {
    background: var(--accent-bright); border-color: var(--accent-bright); color: var(--text-on-brass);
}
.button:active, .search-form button:active { transform: translateY(1px); }

.notice {
    background: var(--surface-sunken); border-left: 3px solid var(--text-muted);
    padding: var(--space-3) var(--space-4); border-radius: var(--r-sm); font-size: var(--text-sm);
}
.notice--lang { border-left-color: var(--accent); }

.breadcrumbs { display: flex; flex-wrap: wrap; gap: 2px 0; font-size: var(--text-sm); color: var(--text-secondary); }
.breadcrumbs a { color: var(--text-secondary); text-decoration: none; }
.breadcrumbs a:hover { color: var(--accent-bright); }
.breadcrumbs a + a::before { content: "/"; margin: 0 var(--space-2); color: var(--text-faint); }

/* ---- hub --------------------------------------------------------------------------------------------------- */

.hero { background: var(--grad-vignette), var(--ink-900); color: var(--cream-50); border-bottom: 1px solid rgba(242, 241, 238, 0.10); }
.hero__inner { max-width: 1280px; margin: 0 auto; padding: var(--space-16) var(--space-5); }
.hero .eyebrow { color: var(--brass-500); margin: 0 0 var(--space-3); }
.hero h1 { margin: 0 0 var(--space-3); font-size: var(--display-lg); line-height: var(--lh-display); color: var(--cream-50); }
.hero__lead { color: var(--cream-300); margin: 0; font-size: var(--text-lg); }

.products { max-width: 1280px; margin: 0 auto; padding: var(--space-10) var(--space-5) var(--space-16); }
.product-grid {
    list-style: none; margin: 0; padding: 0;
    display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--space-6);
}
.product-card a {
    display: flex; flex-direction: column; height: 100%;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
    box-shadow: var(--shadow-2); overflow: hidden; text-decoration: none; color: var(--text);
    transition: transform var(--dur-med) var(--ease-out), box-shadow var(--dur-med) var(--ease-out), border-color var(--dur-med) var(--ease-out);
}
.product-card a:hover { transform: translateY(-2px); box-shadow: var(--shadow-3); border-color: var(--border-brass); color: var(--text); }
.product-card__image {
    display: flex; align-items: center; justify-content: center;
    aspect-ratio: 4 / 3; background: var(--ink-900); overflow: hidden;
}
.product-card__image img { width: 100%; height: 100%; object-fit: cover; }
.product-card__placeholder { font-family: var(--font-display); font-size: 5rem; color: var(--glow-500); text-shadow: var(--glow-md); }
.product-card__body { display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-4) var(--space-5) var(--space-5); }
.product-card__title { font-family: var(--font-display); font-size: var(--text-2xl); letter-spacing: var(--ls-display); text-transform: uppercase; line-height: 1; }
.product-card__action { color: var(--accent); }

/* ---- manual pages ------------------------------------------------------------------------------------------ */

.doc {
    max-width: 1280px; margin: 0 auto; padding: 0 var(--space-5);
    display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); gap: var(--space-10);
}
.doc-nav {
    position: sticky; top: 0; align-self: start; max-height: 100vh; overflow-y: auto;
    padding: var(--space-6) var(--space-2) var(--space-8) 0; border-right: 1px solid var(--border);
    font-size: 15px;
}
.doc-nav__product {
    display: block; font-family: var(--font-display); font-size: var(--text-2xl); line-height: 1; text-transform: uppercase;
    letter-spacing: var(--ls-display); color: var(--text); text-decoration: none; margin: 0 0 var(--space-4); padding-left: 10px;
}
.doc-nav__product:hover { color: var(--accent-bright); }
.doc-nav__all { display: block; margin: var(--space-5) 0 0 10px; font-size: var(--text-sm); color: var(--text-secondary); }

.toc, .toc ul { list-style: none; margin: 0; padding: 0; }
.toc .toc { padding-left: var(--space-3); border-left: 1px solid var(--border); margin-left: var(--space-3); }
.toc a {
    display: block; padding: 5px 10px; border-radius: var(--r-xs); color: var(--text-secondary); text-decoration: none; line-height: var(--lh-snug);
    border-left: 2px solid transparent;
    transition: color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
}
.toc a:hover { color: var(--text); background: rgba(181, 144, 78, 0.08); }
.toc a[aria-current="page"] { color: var(--text); background: rgba(181, 144, 78, 0.12); border-left-color: var(--accent); font-weight: var(--fw-semibold); }
.toc details > summary { list-style: none; display: flex; align-items: flex-start; cursor: pointer; }
.toc details > summary::-webkit-details-marker { display: none; }
.toc details > summary a { flex: 1; }
.toc details > summary::after {
    content: "›"; flex: none; width: 1.4rem; text-align: center; color: var(--text-muted);
    transition: transform var(--dur-fast) var(--ease-out); padding-top: 4px;
}
.toc details[open] > summary::after { transform: rotate(90deg); }

.doc-main { min-width: 0; max-width: var(--content); padding: var(--space-6) 0 var(--space-16); }
.doc-toolbar { display: flex; align-items: center; gap: var(--space-3); min-height: 2rem; }
.doc-toolbar .breadcrumbs { flex: 1; }
.print-button, .doc-nav-toggle {
    background: transparent; border: 1.5px solid var(--border-brass); color: var(--accent-bright); border-radius: var(--r-sm);
    padding: 6px var(--space-3); font: inherit; font-size: var(--label-sm); font-weight: var(--fw-semibold);
    letter-spacing: 0.08em; text-transform: uppercase; cursor: pointer;
    transition: border-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
}
.print-button:hover, .doc-nav-toggle:hover { border-color: var(--accent-bright); color: var(--text); background: rgba(181, 144, 78, 0.08); }
.doc-nav-toggle { display: none; }
.doc-main h1 { margin-top: var(--space-4); }

.pager {
    display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); margin-top: var(--space-12); padding-top: var(--space-6);
    border-top: 1px solid var(--border);
}
.pager a {
    display: flex; flex-direction: column; gap: var(--space-1); padding: var(--space-4) var(--space-5); border: 1px solid var(--border);
    border-radius: var(--r-lg); text-decoration: none; background: var(--surface);
    transition: transform var(--dur-med) var(--ease-out), border-color var(--dur-med) var(--ease-out);
}
.pager a:hover { border-color: var(--border-brass); transform: translateY(-2px); }
.pager__next { grid-column: 2; text-align: right; }
.pager__label { color: var(--accent); }
.pager__title { font-weight: var(--fw-semibold); color: var(--text); }

/* ---- content (rendered Markdown) --------------------------------------------------------------------------- */

.content > :first-child { margin-top: 0; }
.content p, .content ul, .content ol, .content .table-wrap, .content pre, .content figure { margin: 0 0 1.1em; }
.content p { text-wrap: pretty; }
.content ul, .content ol { padding-left: 1.5em; }
.content li + li { margin-top: 0.3em; }
.content li::marker { color: var(--accent); }
.content h2 { padding-bottom: var(--space-2); border-bottom: 1px solid var(--border); }
.content strong { font-weight: var(--fw-bold); }
.content code {
    font-family: var(--font-mono); font-size: 0.95em; letter-spacing: var(--ls-mono);
    background: var(--surface-sunken); border: 1px solid var(--border); padding: 0.05em 0.35em; border-radius: var(--r-xs);
}
.content pre {
    background: var(--surface-sunken); border: 1px solid var(--border); border-radius: var(--r-md);
    padding: var(--space-4); overflow-x: auto; line-height: 1.45;
}
.content pre code { background: none; border: 0; padding: 0; font-size: 0.9em; }
.content blockquote { margin: 0 0 1.1em; padding: 2px var(--space-4); border-left: 2px solid var(--border-strong); color: var(--text-secondary); }
.content hr { border: 0; border-top: 1px solid var(--border); margin: var(--space-8) 0; }

.table-wrap { overflow-x: auto; }
.content table { border-collapse: collapse; width: 100%; font-size: 15px; font-variant-numeric: tabular-nums; }
.content th, .content td { border-bottom: 1px solid var(--border); padding: var(--space-2) var(--space-3); text-align: left; vertical-align: top; }
.content th { color: var(--text-secondary); border-bottom-color: var(--border-strong); }

figure.image, figure.video { margin: var(--space-6) 0; }
figure.image a.lightbox { display: inline-block; max-width: 100%; cursor: zoom-in; }
/* the width/height attributes (file size or {width=…}) set the size; max-width keeps it on small screens */
figure.image img { display: block; max-width: 100%; height: auto; border-radius: var(--r-md); border: 1px solid var(--border); }
figcaption { font-size: var(--text-sm); color: var(--text-secondary); margin-top: var(--space-2); }
figure.video video { width: 100%; border-radius: var(--r-md); background: var(--black); }
.download a::before { content: "↓ "; font-family: var(--font-mono); }

.video-embed { position: relative; aspect-ratio: 16 / 9; margin: var(--space-6) 0; background: var(--black); border-radius: var(--r-md); overflow: hidden; }
.video-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.admonition {
    --tone: var(--accent);
    margin: var(--space-6) 0; padding: var(--space-4) var(--space-5); border-radius: var(--r-md);
    border: 1px solid var(--border); border-left: 3px solid var(--tone); background: var(--surface);
}
.admonition > :last-child { margin-bottom: 0; }
.admonition-title { margin: 0 0 var(--space-1); color: var(--tone); }
.admonition.tip { --tone: var(--ok-500); }
.admonition.important { --tone: var(--glow); box-shadow: inset 4px 0 14px -10px var(--glow); }   /* live / high voltage */
.admonition.warning { --tone: var(--warn-500); }
.admonition.caution { --tone: var(--danger-500); }

.content details { margin: 0 0 1.1em; border: 1px solid var(--border); border-radius: var(--r-md); padding: var(--space-2) var(--space-4); background: var(--surface); }
.content details > summary { cursor: pointer; font-weight: var(--fw-semibold); }

/* ---- product landing, whole manual, search, error ---------------------------------------------------------- */

.toc-list { padding-left: 1.3em; }
.toc-list li { margin: var(--space-1) 0; }
.toc-list li::marker { color: var(--accent); }
.toc-list .toc-list { margin-top: var(--space-1); }

.manual__cover { padding: var(--space-6) 0 var(--space-4); border-bottom: 1px solid var(--border); margin-bottom: var(--space-6); }
.manual__brand { color: var(--accent); margin: 0; }
.manual__cover h1 { margin: var(--space-2) 0; font-size: var(--display-md); line-height: var(--lh-display); }
.manual__url { color: var(--text-secondary); font-family: var(--font-mono); font-size: var(--text-sm); margin: 0; }
.manual__toc { margin-bottom: var(--space-10); }
.manual-section { padding-top: var(--space-4); }
.manual-section.depth-0 { margin-top: var(--space-10); border-top: 1px solid var(--border-strong); }
.manual-section__title { margin-top: var(--space-2); font-size: var(--display-sm); border: 0; }
.manual-section.depth-1 .manual-section__title { font-size: 32px; }
.manual-section.depth-2 .manual-section__title { font-size: 26px; }

.search-form { display: flex; flex-wrap: wrap; gap: var(--space-2); margin: var(--space-4) 0 var(--space-6); }
.search-form input[type="search"] { flex: 1 1 16rem; }
.search-form input, .search-form select {
    height: 44px; padding: 0 var(--space-3); border: 1px solid var(--border-strong); border-radius: var(--r-sm);
    background: var(--field); color: var(--text); font: inherit;
}
.search-form input:focus, .search-form select:focus { outline: none; border-color: var(--accent); }
.results { list-style: none; padding: 0; margin: 0; }
.result { padding: var(--space-4) 0; border-bottom: 1px solid var(--border); }
.result__title { font-weight: var(--fw-semibold); font-size: var(--text-lg); }
.result__product { display: block; color: var(--text-secondary); margin-top: 2px; }
.result__snippet { margin: var(--space-2) 0 0; font-size: 15px; color: var(--text-secondary); }
.result__snippet mark { background: rgba(181, 144, 78, 0.25); color: var(--text); padding: 0 0.1em; border-radius: 2px; }
.pagination { display: flex; gap: var(--space-2); margin-top: var(--space-6); }
.pagination a, .pagination span {
    min-width: 2.2rem; text-align: center; padding: var(--space-1) var(--space-2); border: 1px solid var(--border-strong);
    border-radius: var(--r-sm); text-decoration: none; font-family: var(--font-mono);
}
.pagination span { background: var(--accent); color: var(--text-on-brass); border-color: var(--accent); }

.error-page { text-align: center; }
.error-page__code {
    font-family: var(--font-display); font-size: var(--display-2xl); line-height: 1; margin: var(--space-4) 0 0;
    color: var(--glow-500); text-shadow: var(--glow-lg);
}
.error-page .search-form { justify-content: center; max-width: 30rem; margin: var(--space-6) auto; }
.trace { text-align: left; font-family: var(--font-mono); font-size: 0.75rem; overflow-x: auto; background: var(--surface-sunken); padding: var(--space-4); }

/* ---- footer (dark brand bar) ------------------------------------------------------------------------------- */

.site-footer { background: var(--ink-900); border-top: 1px solid rgba(242, 241, 238, 0.10); font-size: var(--text-sm); color: var(--cream-300); }
.site-footer__inner {
    max-width: 1280px; margin: 0 auto; padding: var(--space-5); display: flex; flex-wrap: wrap; gap: var(--space-4); justify-content: space-between;
}
.site-footer a { color: var(--cream-300); }
.site-footer a:hover { color: var(--brass-400); }

/* ---- lightbox (assets/js/docs.js) -------------------------------------------------------------------------- */

.lightbox-overlay {
    position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column; align-items: center; justify-content: center;
    background: rgba(12, 12, 13, 0.94); padding: var(--space-10) var(--space-4) var(--space-4); cursor: zoom-out;
}
.lightbox-overlay[hidden] { display: none; }
.lightbox-overlay img { max-width: 100%; max-height: calc(100vh - 6rem); width: auto; height: auto; border-radius: var(--r-sm); }
.lightbox-overlay p { color: var(--cream-200); margin: var(--space-3) 0 0; font-size: 15px; text-align: center; }
.lightbox-overlay button {
    position: absolute; top: var(--space-2); right: var(--space-3); background: none; border: 0; color: var(--cream-50);
    font-size: 2rem; cursor: pointer; line-height: 1;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; }
}

/* ---- small screens ----------------------------------------------------------------------------------------- */

@media (max-width: 900px) {
    .doc { display: block; }
    .doc-nav {
        display: none; position: static; max-height: none; border-right: 0; border-bottom: 1px solid var(--border);
        padding: var(--space-4) 0;
    }
    html:not(.js) .doc-nav, .doc-nav.is-open { display: block; }
    .doc-nav-toggle:not([hidden]) { display: inline-block; }
}

@media (max-width: 640px) {
    body { font-size: 16px; }
    h1 { font-size: 34px; }
    .hero h1 { font-size: var(--display-md); }
    .hero__inner { padding: var(--space-10) var(--space-5); }
    .site-header__inner { flex-wrap: wrap; }
    .brand__logo { height: 34px; }
    .site-search { order: 3; flex: 1 0 100%; }
    .site-search input { width: 100%; max-width: none; }
    .pager { grid-template-columns: 1fr; }
    .pager__next { grid-column: 1; }
    .doc-toolbar { flex-wrap: wrap; }
}
