/*
 * Shared Codepool demo landing-page and explainer styles.
 *
 * The tool and its crawlable guide are one light page, not a dark application
 * followed by a separate white article. Only camera and image viewports stay
 * dark because they are media surfaces. Codepool navigation appears once at
 * the top; the explainer does not repeat it at the tool/article transition.
 *
 * Everything in the explainer markers is Codepool-only. The standalone example
 * keeps its original application theme when sync_demo_example.py strips this
 * stylesheet and the guide.
 */

body.explainer-page {
    height: auto;
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0;
    padding: 0;
    overflow: auto;
    overscroll-behavior: auto;
    color-scheme: light;
    background: #ffffff;
    color: #303034;
    font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
}

/* One restrained navigation row. It is deliberately outside both the tool and
   the guide, so no menu-like strip appears at their transition. */
body.explainer-page>.demo-page-nav {
    box-sizing: border-box;
    width: 100%;
    max-width: 1180px;
    margin: 0 auto;
    padding: 14px 24px 10px;
    display: flex;
    justify-content: flex-end;
    gap: 22px;
    font-size: 0.82rem;
    line-height: 1.5;
}

body.explainer-page>.demo-page-nav a {
    color: #606068;
    text-decoration: none;
}

body.explainer-page>.demo-page-nav a:hover,
body.explainer-page>.demo-page-nav a:focus-visible {
    color: #a85100;
    text-decoration: underline;
}

/* Shared light page introduction. */
body.explainer-page .demo-header {
    box-sizing: border-box;
    width: 100%;
    max-width: 1180px;
    margin: 0 auto;
    padding: 20px 0 22px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    background: transparent;
    border: 0;
    border-bottom: 1px solid #e3e3e7;
    border-radius: 0;
    box-shadow: none;
    color: #303034;
}

body.explainer-page>.demo-header {
    width: calc(100% - 48px);
    margin-bottom: 24px;
}

body.explainer-page .demo-shell .demo-header,
body.explainer-page .app-container .demo-header {
    max-width: none;
    padding: 0 0 16px;
}

body.explainer-page .demo-brand {
    max-width: 100%;
    flex-wrap: wrap;
    row-gap: 8px;
}

body.explainer-page .demo-header .brand-logo {
    width: auto;
    height: 28px;
}

body.explainer-page .demo-header .brand-divider {
    height: 28px;
    background: #d8d8de;
}

body.explainer-page .demo-header h1 {
    margin: 0;
    color: #242427;
    font-family: 'Oswald', 'Open Sans', sans-serif;
    font-size: 1.65rem;
    font-weight: 400;
    line-height: 1.25;
    letter-spacing: 0.01em;
    white-space: normal;
}

body.explainer-page .demo-header .brand-tag {
    color: #9b4c00;
    background: #fff4e6;
    border-color: #efc58f;
}

body.explainer-page .demo-header .subtitle,
body.explainer-page .demo-header>p {
    max-width: 76ch;
    margin: 0;
    color: #606068;
    font-size: 0.94rem;
    line-height: 1.55;
    text-align: left;
}

/* GS1, driver licence and MRZ: a light application surface with a bounded
   height. The dark camera viewport remains inside the tool, where it belongs. */
body.explainer-page .demo-shell,
body.explainer-page .app-container {
    box-sizing: border-box;
    width: calc(100% - 48px);
    max-width: 1180px;
    height: min(760px, calc(100vh - 48px));
    height: min(760px, calc(100dvh - 48px));
    min-height: 640px;
    margin: 0 auto 24px;
    padding: 20px;
    background: #f7f7f8;
    color: #303034;
    border: 1px solid #e0e0e5;
    border-radius: 8px;
    box-shadow: none;
    overflow: hidden;
}

body.explainer-page .demo-shell {
    gap: 14px;
}

/* MRZ application panels. */
body.explainer-page .app-container {
    --line-dark: #ddddE3;
    --fill-dark: #f4f4f6;
    --panel-bg: #ffffff;
    --text: #303034;
}

body.explainer-page .app-container>.notice-banner {
    flex: 0 0 auto;
    margin: 0 0 12px;
    padding: 9px 12px;
    background: #fff8ef;
    border: 1px solid #f0d7b4;
    border-left: 3px solid #fe8e14;
    border-radius: 5px;
    color: #6b4a12;
}

body.explainer-page .app-container>.notice-banner strong {
    color: #3d2a06;
}

body.explainer-page .app-container>.mode-switch {
    flex: 0 0 auto;
    padding: 0;
    background: transparent;
    border-bottom: 1px solid #dddde3;
}

body.explainer-page .app-container .mode-tab {
    color: #606068;
}

body.explainer-page .app-container .mode-tab:hover:not(:disabled) {
    color: #303034;
    background: #eeeeF1;
}

body.explainer-page .app-container .mode-tab.is-active {
    color: #303034;
    background: #ffffff;
    border-color: #dddde3;
}

body.explainer-page .app-container main {
    min-height: 0;
    background: #ffffff;
    border: 1px solid #dddde3;
    border-radius: 0 0 6px 6px;
    color: #303034;
}

body.explainer-page .app-container .left-panel {
    background: #ffffff;
    border-right-color: #dddde3;
}

body.explainer-page .app-container .right-panel {
    background: #ffffff;
}

body.explainer-page .app-container button {
    color: #303034;
    background: #ffffff;
    border-color: #d4d4da;
}

body.explainer-page .app-container button:hover:not(:disabled) {
    color: #ffffff;
    background: #fe8e14;
    border-color: #fe8e14;
}

body.explainer-page .app-container button:disabled {
    color: #9999a0;
    background: #eeeeF1;
    border-color: #e4e4e8;
}

body.explainer-page .app-container .viewer-container {
    background: #18181b;
    border-color: #67676f;
}

body.explainer-page .app-container .result-group {
    background: #f6f6f8;
    border: 1px solid #e7e7eb;
}

body.explainer-page .app-container .result-group h3 {
    color: #303034;
    border-bottom-color: #dddde3;
}

body.explainer-page .app-container .data-box,
body.explainer-page .app-container .page-nav span,
body.explainer-page .app-container .hint,
body.explainer-page .app-container .progress-text,
body.explainer-page .app-container .bench-empty,
body.explainer-page .app-container .bench-note,
body.explainer-page .app-container .bench-table caption,
body.explainer-page .app-container .bench-table thead th,
body.explainer-page .app-container .bench-table tbody th,
body.explainer-page .app-container .bench-detail-table td:last-child {
    color: #55555d;
}

body.explainer-page .app-container .data-box {
    color: #303034;
}

body.explainer-page .app-container .bench-ok {
    color: #1e7a4b;
}

body.explainer-page .app-container .bench-bad {
    color: #b3261e;
}

body.explainer-page .app-container .bench-missing {
    color: #9999a0;
}

/* GS1 and driver licence controls. */
body.explainer-page .demo-shell #scanner-app {
    padding: 16px;
    background: #ffffff;
    border: 1px solid #e0e0e5;
    border-radius: 6px;
}

body.explainer-page .demo-shell #tip-message {
    color: #6b4a12;
    background: #fff8ef;
    border: 1px solid #f0d7b4;
    border-radius: 5px;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
}

body.explainer-page .demo-shell .mode-switch {
    background: #eeeeF1;
    border-color: #d8d8de;
    box-shadow: none;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
}

body.explainer-page .demo-shell .mode-switch[data-active] .mode-option:not(.active) {
    color: #606068;
}

body.explainer-page .demo-shell .mode-option.active,
body.explainer-page .demo-shell .mode-switch[data-active="upload"] .mode-option[data-mode="upload"],
body.explainer-page .demo-shell .mode-switch[data-active="image"] .mode-option[data-mode="image"] {
    color: #ffffff;
}

body.explainer-page .demo-shell .scope-select {
    color: #505058;
    background: #f5f5f7;
    border-color: #d8d8de;
    box-shadow: none;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
}

body.explainer-page .demo-shell .scope-select select {
    color: #303034;
    background-color: #ffffff;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23323234' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
}

body.explainer-page .demo-shell #camera-view {
    background: #18181b;
    box-shadow: none;
}

body.explainer-page .demo-shell .upload-zone {
    color: #303034;
    background: #fafafb;
    border-color: #bdbdc5;
}

body.explainer-page .demo-shell .upload-zone:hover,
body.explainer-page .demo-shell .upload-zone:focus-visible,
body.explainer-page .demo-shell .upload-zone.dragover {
    background: #fff8ef;
}

body.explainer-page .demo-shell .upload-zone kbd {
    border-color: #c6c6cd;
}

body.explainer-page .demo-shell .sample-chip {
    color: #303034;
    background: #ffffff;
    border-color: #d0d0d7;
}

body.explainer-page .demo-shell .sample-chip:hover,
body.explainer-page .demo-shell .sample-chip:focus-visible {
    background: #fff1df;
}

/* Barcode Scanner already uses light working cards; bring their width, border
   and spacing into the same page system rather than floating them on black. */
body.explainer-page>.container {
    box-sizing: border-box;
    width: calc(100% - 48px);
    max-width: 1100px;
    margin: 0 auto 18px;
    padding: 24px;
    border: 1px solid #e0e0e5;
    border-radius: 8px;
    box-shadow: none;
}

/* Web TWAIN uses the same light introduction and bordered working surface. */
body.explainer-page .demo-header .brand h1 {
    color: #242427;
    border-left-color: #d8d8de;
}

body.explainer-page .demo-header .brand h1 span {
    color: #a85100;
}

body.explainer-page>.workspace {
    box-sizing: border-box;
    width: 100%;
    max-width: 1180px;
    margin: 0 auto 24px;
    padding: 0 24px;
}

body.explainer-page>.workspace .settings,
body.explainer-page>.workspace .preview {
    border: 1px solid #e0e0e5;
    border-radius: 8px;
    box-shadow: none;
}

.demo-explainer {
    box-sizing: border-box;
    width: 100%;
    color-scheme: light;
    background: #ffffff;
    color: #303034;
    padding: 40px 24px 72px;
    border: 0;
    font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.65;
    text-align: left;
}

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

.demo-explainer-inner {
    max-width: 880px;
    margin: 0 auto;
}

.demo-explainer h2 {
    font-family: 'Oswald', 'Open Sans', sans-serif;
    font-size: 1.6rem;
    font-weight: 400;
    line-height: 1.25;
    color: #1f1f23;
    margin: 2.6em 0 0.6em;
}

.demo-explainer h2:first-of-type {
    margin-top: 0;
}

.demo-explainer h3 {
    font-family: 'Open Sans', sans-serif;
    font-size: 1.06rem;
    font-weight: 700;
    line-height: 1.4;
    color: #1f1f23;
    margin: 1.8em 0 0.4em;
}

.demo-explainer p {
    margin: 0 0 1em;
    max-width: 74ch;
}

/* The 40–80 word answer. Kept visually distinct so a reader (and a snippet
   extractor) can tell the summary from the detail that follows it. */
.demo-explainer .demo-explainer-answer {
    box-sizing: border-box;
    font-size: 1.08rem;
    line-height: 1.65;
    color: #3d3d43;
    border-left: 3px solid #fe8e14;
    background: #fffaf4;
    padding: 16px 18px;
    margin: 0 0 2em;
    max-width: 78ch;
}

.demo-explainer a {
    color: #b65b00;
}

.demo-explainer ul,
.demo-explainer ol {
    margin: 0 0 1em;
    padding-left: 1.4em;
    max-width: 74ch;
}

/* Restated because more than one demo stylesheet resets lists to `none` for its
   own toolbars, and a bulleted list without bullets reads as broken prose. */
.demo-explainer ul {
    list-style: disc outside;
}

.demo-explainer ol {
    list-style: decimal outside;
}

.demo-explainer li {
    margin: 0.3em 0;
}

.demo-explainer code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace;
    font-size: 0.875em;
    background: #f1f1f4;
    border-radius: 3px;
    padding: 0.12em 0.35em;
    overflow-wrap: anywhere;
}

.demo-explainer pre {
    margin: 0 0 1.2em;
    padding: 16px 18px;
    background: #f6f6f8;
    border: 1px solid #e3e3e8;
    border-radius: 6px;
    overflow-x: auto;
    font-size: 0.82rem;
    line-height: 1.55;
}

.demo-explainer pre code {
    background: none;
    padding: 0;
    font-size: inherit;
    /* Wrapped rather than scrolled horizontally: these excerpts carry long JSON
       strings (warning text, element strings) that would otherwise hide half
       the sentence behind a scrollbar, on phones especially. */
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

/* Worked-example screenshot. The image is evidence, so it keeps its native
   aspect ratio and gets a caption that says what produced it. */
.demo-explainer .demo-explainer-figure {
    margin: 1.4em 0 1.8em;
    max-width: 880px;
}

.demo-explainer .demo-explainer-figure img {
    display: block;
    width: 100%;
    height: auto;
    border: 1px solid #dddde3;
    border-radius: 8px;
    background: #ffffff;
}

.demo-explainer .demo-explainer-figure--portrait {
    max-width: 560px;
}

.demo-explainer .demo-explainer-figure figcaption {
    margin-top: 0.65em;
    color: #62626b;
    font-size: 0.8rem;
    line-height: 1.5;
}

/* Supported / not-supported matrix. Two columns of facts, no decoration. */
.demo-explainer table {
    width: 100%;
    border-collapse: collapse;
    margin: 0 0 1.4em;
    font-size: 0.92rem;
}

.demo-explainer caption {
    caption-side: bottom;
    text-align: left;
    font-size: 0.8rem;
    color: #6b6b74;
    padding-top: 0.6em;
}

.demo-explainer th,
.demo-explainer td {
    text-align: left;
    vertical-align: top;
    padding: 0.55em 0.7em;
    border-bottom: 1px solid #e7e7ec;
}

.demo-explainer thead th {
    background: #f6f6f8;
    border-bottom: 1px solid #d8d8dd;
    font-weight: 700;
    font-size: 0.86rem;
    letter-spacing: 0.01em;
}

.demo-explainer tbody th {
    font-weight: 600;
    width: 34%;
    color: #1f1f23;
}

/* Two intent paths: use the hosted tool, or build it into an app. */
.demo-explainer .demo-explainer-paths {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin: 0 0 1.6em;
}

.demo-explainer .demo-explainer-path {
    border: 1px solid #e3e3e8;
    border-radius: 8px;
    padding: 18px 20px;
    background: #fbfbfc;
}

.demo-explainer .demo-explainer-path h3 {
    margin-top: 0;
}

.demo-explainer .demo-explainer-path p {
    font-size: 0.94rem;
    margin-bottom: 0.8em;
}

.demo-explainer .demo-explainer-path ul {
    font-size: 0.94rem;
    margin-bottom: 0;
    padding-left: 1.1em;
}

.demo-explainer .demo-explainer-cta {
    display: inline-block;
    background: #fe8e14;
    color: #ffffff;
    font-weight: 700;
    font-size: 0.94rem;
    text-decoration: none;
    padding: 0.62em 1.1em;
    border-radius: 5px;
}

.demo-explainer .demo-explainer-cta:hover,
.demo-explainer .demo-explainer-cta:focus {
    background: #e07c0a;
    color: #ffffff;
}

.demo-explainer .demo-explainer-note {
    border-left: 3px solid #fe8e14;
    background: #fff8ef;
    padding: 14px 18px;
    margin: 0 0 1.4em;
    font-size: 0.94rem;
}

.demo-explainer .demo-explainer-note p:last-child {
    margin-bottom: 0;
}

/* Only genuine limits belong here — a Q&A that could be generated for any page
   is noise. */
.demo-explainer dl.demo-explainer-qa {
    margin: 0 0 1.4em;
}

.demo-explainer dl.demo-explainer-qa dt {
    font-weight: 700;
    color: #1f1f23;
    margin-top: 1.1em;
}

.demo-explainer dl.demo-explainer-qa dd {
    margin: 0.25em 0 0;
    max-width: 74ch;
}

/* A conventional closing footer, not another toolbar or CTA band. The markup
   remains available to the examples-repository synchronization script. */
body.explainer-page .demo-footer,
body.explainer-page footer {
    background: #ffffff;
    border-top: 1px solid #e7e7ec;
    color: #5b5b62;
    font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    font-size: 0.82rem;
    line-height: 1.7;
    text-align: center;
    max-width: none;
    margin: 0;
    padding: 22px 20px 28px;
}

body.explainer-page .demo-footer p,
body.explainer-page footer p {
    margin: 0 auto 0.4em;
    max-width: 74ch;
}

body.explainer-page .demo-footer p:last-child,
body.explainer-page footer p:last-child {
    margin-bottom: 0;
}

body.explainer-page .demo-footer a,
body.explainer-page footer a {
    color: #b65b00;
}

body.explainer-page .demo-footer .demo-footer-cta {
    display: inline;
    margin-left: 0.6em;
    padding: 0;
    background: none;
    border: 0;
    border-radius: 0;
    color: #a85100;
    font-weight: 600;
    text-decoration: underline;
}

@media (max-width: 768px) {
    body.explainer-page>.demo-page-nav {
        justify-content: flex-start;
        padding: 12px 16px 8px;
    }

    /* Scanability uses the tuner's masthead rather than .demo-page-nav. Keep
       the same two Codepool links available on phones instead of leaving only
       a trial button. */
    body.explainer-page .site-header-inner {
        flex-wrap: wrap;
        gap: 12px;
        padding: 12px 16px;
    }

    body.explainer-page .site-header .brand-divider,
    body.explainer-page .site-header .brand-product,
    body.explainer-page .site-header .header-nav[aria-label="Dynamsoft"] {
        display: none;
    }

    body.explainer-page .site-header .header-nav[aria-label="Codepool"] {
        display: flex;
        margin-left: auto;
        gap: 16px;
    }

    body.explainer-page .site-header .header-nav[aria-label="Codepool"] .nav-link {
        display: inline;
        font-size: 0.82rem;
    }

    body.explainer-page>.demo-header {
        width: calc(100% - 32px);
        margin-bottom: 16px;
        padding: 16px 0 18px;
    }

    body.explainer-page .demo-shell .demo-header,
    body.explainer-page .app-container .demo-header {
        padding: 2px 0 14px;
    }

    body.explainer-page .demo-header .brand-logo {
        height: 24px;
    }

    body.explainer-page .demo-header .brand-divider {
        height: 24px;
    }

    body.explainer-page .demo-header h1 {
        font-size: 1.3rem;
    }

    body.explainer-page .demo-header .subtitle,
    body.explainer-page .demo-header>p {
        display: block;
        max-width: 100%;
        font-size: 0.86rem;
    }

    body.explainer-page .demo-shell,
    body.explainer-page .app-container {
        width: calc(100% - 24px);
        height: auto;
        min-height: 0;
        margin-bottom: 12px;
        padding: 12px;
        overflow: hidden;
    }

    body.explainer-page .demo-shell #scanner-app {
        min-height: 540px;
        padding: 12px;
    }

    body.explainer-page .demo-shell #main-container,
    body.explainer-page .demo-shell .upload-zone {
        min-height: 370px;
    }

    body.explainer-page .app-container main {
        overflow: hidden;
    }

    body.explainer-page .app-container .left-panel {
        border-right: 0;
        border-bottom: 1px solid #dddde3;
    }

    body.explainer-page>.container {
        width: calc(100% - 24px);
        margin-bottom: 12px;
        padding: 16px;
    }

    body.explainer-page>.workspace {
        margin-bottom: 12px;
        padding: 0 12px;
    }

    .demo-explainer {
        padding: 36px 16px 48px;
    }

    .demo-explainer h2 {
        font-size: 1.35rem;
    }

    .demo-explainer .demo-explainer-paths {
        grid-template-columns: 1fr;
    }

    .demo-explainer table {
        font-size: 0.86rem;
    }

    .demo-explainer th,
    .demo-explainer td {
        padding: 0.5em 0.5em;
    }
}

@media (max-width: 480px) {
    body.explainer-page .demo-brand {
        gap: 8px;
    }

    body.explainer-page .demo-header h1 {
        font-size: 1.16rem;
    }

    body.explainer-page .demo-header .brand-tag {
        display: inline-block;
    }

    body.explainer-page .demo-shell #scanner-app {
        min-height: 500px;
    }

    body.explainer-page .demo-shell #main-container,
    body.explainer-page .demo-shell .upload-zone {
        min-height: 330px;
    }

    .demo-explainer .demo-explainer-answer {
        padding: 14px 14px;
        font-size: 1rem;
    }
}
